## Merge Verdict
**[APPROVE]** — Region URL rewriting is now complete across every
artifact channel; global build verified untouched.
> 6 files · +73 / -26 · `docs/.vitepress` `scripts/` `package.json`
---
## Summary
- Extract a shared `buildRegionUrlReplacements()` in `region-utils.ts`
that emits **four** rules per non-default hostname (protocol-prefixed +
bare-text for both `siteHostname` and `apiBaseUrl`), and route the four
pre-existing rewrite sites (`region-filter.ts`, `transformHtml`,
`buildEnd install`, plus the new ones) through it.
- Add a new Vite `region-source-url-rewrite` plugin (`enforce: 'pre'`)
that rewrites hardcoded hostnames inside `.vue/.ts/.json/.yaml` source
modules — this is the only channel that reaches Vite-compiled JS bundles
(install command strings in Vue components, `mcp-tools.json` connect
links, `openapi.yaml` error-message text).
- Bring `.md` copies + `llms.txt` into region rewriting:
`normalize_md.ts` (the real writer of `dist/**/*.md`) and
`generate-llms.ts` (the static `llms-intro.md` injection point) now
share the same helper.
- Fix root-cause env-leak: `build:cn` now also passes `VITE_REGION=cn`
to the `bun run build:llms` segment — previously `cross-env` only scoped
to the `vitepress build` process, so `normalize_md`/`generate-llms`
never knew it was a CN build and silently produced `.com` artifacts.
---
## Risk Analysis
| Risk | Level | Mitigation |
|------|-------|-----------|
| Global build (`build:release`) accidentally rewritten | ✅ | Shared
helper returns `[]` when `VITE_REGION` is unset → every call site is a
no-op. Verified: `dist/longbridge-terminal/install.ps1` is
byte-identical to source; `mcp.html` keeps all 9 `.com`; `llms-full.txt`
keeps all 112 `open.longbridge.com`. |
| Bare-rule replacement double-matches | ✅ | `open.longbridge.com` is
**not** a substring of `openapi.longbridge.com` (5th char `.` vs `a`),
so the four rules are mutually independent regardless of order. |
| Vite `transform` runs on every module — performance hit | 🟢 |
`buildRegionUrlReplacements()` is lightweight (one env read + small
array build). On global builds it short-circuits via
`replacements.length === 0`. |
| `enforce: 'pre'` ordering vs `yaml-transform` | ✅ | `'pre'` plugins
run before normal plugins, so this transform sees raw YAML text and
rewrites it before `yaml-transform` JSON-stringifies it. |
| Hardcoded global hostnames in helper | 🟡 | Helper compares against the
literal `'https://open.longbridge.com'` /
`'https://openapi.longbridge.com'`. If the global domain ever changes,
this file plus `region.config.ts` must be updated together. Same
constraint already existed before this PR. |
---
## Design Decisions
- **Centralize rules in `region-utils.ts`** instead of inlining at four
call sites — four sites already drifted (HTML had two rules but markdown
had only the URL form before the previous PR). One source of truth
prevents future drift.
- **Pre-stage Vite transform** rather than a post-build dist scan —
keeps source maps intact and lets the rewrite participate in dependency
invalidation. It also naturally covers `openapi.yaml` (huge but fine —
string `split/join` is O(n) and only runs once per module per build).
- **Bare-hostname rules alongside URL rules** — covers
`[open.longbridge.com/connect](https://...)` markdown patterns where
only the link target gets matched by URL rules; the display text needs
the bare-host rule.
- **Source `install` / `install.ps1` keep `.com`** — global build's
`buildEnd` already had a rewrite pass; making source `.com`-default lets
the existing rewrite mechanism do the work and avoids two
source-of-truth files.
---
## Code Notes
1. **[Info]** `region-utils.ts:25` comment "first so bare rules don't
double-match"
In practice both orderings are correct because after either rule runs
the other one's "from" string no longer exists in the result. The note
is defensive rather than load-bearing.
— Author note: deferred to next iteration.
2. **[Info]** `config.mts` Vite transform hook calls
`buildRegionUrlReplacements()` per module
The helper is cheap but is invoked once per source module on every
build. Could be hoisted to the closure top if profiling ever flags it;
not worth the structural change today.
— Author note: deferred to next iteration.
3. **[Info]** `package.json` build:cn duplicates `cross-env
VITE_REGION=cn` across two segments
Maintainable but easy to forget if a third stage is added later. Could
be solved with `cross-env-shell` wrapping the whole chain, but that's a
separate cleanup.
— Author note: deferred to next iteration.
4. **[Needs review]** Vite `transform` regex includes `.yaml`/`.yml`
This is intentional — `openapi.yaml` ships hardcoded
`https://open.longbridge.com/sdk` and error-message URLs that must be
rewritten for CN. Reviewer should confirm there's no other YAML in the
dependency graph whose `.com` strings must be preserved as global
references. None observed in the current tree.
---
## Verification
- ✅ `bun run build:cn` succeeds; `rg -l
'(open|openapi)\.longbridge\.com' docs/.vitepress/dist` → **zero
residual `.com`** across HTML/MD/JS/scripts.
- ✅ `bun run build:release` succeeds; `install.ps1` and `install` are
byte-identical to source; `mcp.html` keeps 9× `.com`; `llms-full.txt`
keeps 112× `open.longbridge.com`; CN endpoint mentions inside docs
(`getting-started.md` etc.) are preserved as intended.
- ✅ `openapi-quote.longbridge.cn` / `openapi-trade.longbridge.cn` counts
in `getting-started.html` match source 1:1 (no over-rewrite).
- 📋 Reviewer to confirm: CN site (`open.longbridge.cn`) renders `mcp.md`
/ `skill/install` pages with the new URLs after deploy.
Co-authored-by: 袁昌瑞 <changrui.yuan@longbridge-inc.com>
Inject the `google-one-tap.es.js` CDN bundle into every page <head> via
VitePress `head` config, so it loads in both `bun run dev` and built
output (works around `transformHtml` being build-only).
- Gated by `VITE_REGION !== 'cn'` (Google unavailable in China).
- `data-proxy` attribute driven by `process.env.PROXY`: `canary` for
`dev:canary` / `build:canary`, otherwise `production`. CI inherits via
the same npm scripts — no workflow edits required.
- No `data-region` passed: the bundle falls back to `app-id` / `region`
cookies with `sg` default, which is correct for this first-party
`.longbridge.com` site.
- On success the bundle writes session cookies on `.longbridge.com` and
reloads, so `longportInternal.isLogin()` picks it up.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
## Summary
Implements a dedicated pricing page similar to
[financialdatasets.ai/pricing](https://www.financialdatasets.ai/pricing)
that visually compares different market data subscription levels and
their capabilities.
## Changes
- **`Pricing.vue`**: New Vue component that displays market data
subscription tiers in a pricing comparison table format, highlighting
feature availability and pricing across different permission levels
- **`index.ts`**: Registers the new `Pricing` component for use in
VitePress pages
- **`docs/en/docs/pricing.md`**: English pricing page
- **`docs/zh-CN/docs/pricing.md`**: Simplified Chinese pricing page
- **`docs/zh-HK/docs/pricing.md`**: Traditional Chinese pricing page
## Motivation
Users need a clear way to understand what market data features are
available at each subscription tier and how the tiers differ in price
and capability. A pricing comparison page makes it easy to evaluate
which subscription level fits their needs.
🤖 Auto-generated by Endless.
---------
Co-authored-by: Huacnlee Li Huashun <huacnlee@longbridge-inc.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
## Summary
- Promote MCP from a Docs sub-page to a top-level nav entry (URL stays
`/docs/mcp`)
- Add **Available tools** section: 100+ tools live-fetched at build time
from `openapi.longbridge.com/mcp/tools.json`, with search +
single-expand accordion + snapshot fallback
- Rewrite **Available capabilities** to 6 rows (realtime / fundamentals
/ derivatives / account / trading / automation)
- Bump CLI command count `65+` -> `120+`
All changes synced across `en` / `zh-CN` / `zh-HK`.
## Test plan
- [ ] Top nav shows MCP between CLI and API Reference; `/docs/mcp` has
no left sidebar
- [ ] Section order: Available capabilities -> Available tools ->
Prerequisites -> Client setup
- [ ] Search + expand works; only one tool expanded at a time;
out-of-view auto-scrolls inside the panel only
- [ ] `bun run build:canary` passes; snapshot fallback triggers on URL
sabotage
---------
Co-authored-by: 袁章洪 <zhanghong.yuan@longbridge-inc.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
## Summary
- Add `my_topics` and `create_topic` API reference pages in all 3
locales (en/zh-CN/zh-HK), using `<SDKLinks>` + `<Tabs>` pattern with
CLI, Python, Python async, Node.js, Java, Rust, C++, Go examples
- Rename Content sidebar category → **Community** across all locales
- Rename `security_topics` page title → "Get Community Topics by Symbol"
- Add Community content section to `cli.md` (all locales)
- Update `openapi.yaml`: add `x-codeSamples` for `list_my_topics` and
`create_topic`, fix `create_topic` schema (`title` not required at
schema level), move all community endpoints to `Community` tag
- Update CLI skill overview with `longbridge update` command details
## Key design notes
- `create_topic` page includes an article/post comparison table
explaining title requirement and body format differences
- SDK method signatures verified from source code
(`/Users/jason/work/openapi/`)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
## Summary
- **New `/skill` page** with full trilingual support (en / zh-CN /
zh-HK)
- **Interactive chat demo**: 4 scenarios (Live Quote, Portfolio,
Subscription, Earnings) × 5 AI clients (OpenClaw, ChatGPT, Claude,
Claude Code, Codex) with typewriter animation
- **Rich response rendering**: tables with Shadcn-style borders, mini
SVG sparkline charts, syntax-highlighted code blocks
- **Scenario cards section** below the demo describing use cases
- **Nav update**: Skill link added to all three locale nav configs
## Bug Fixes
- **Syntax highlighter**: replaced chained-regex approach with a
single-pass tokenizer. The old code ran number → keyword → string
regexes sequentially on the same string — the keyword regex matched
`class` inside generated `<span class="hl-n">` attributes, and the
string regex matched `"hl-n"` as a string literal, corrupting the HTML
structure entirely
- **v-html routing**: replaced `currentMessages[2]?.rich` template
condition with an explicit `isRichResponse` ref set in `runAnimation()`
to prevent incorrect branch selection when switching client tabs
## Test plan
- [ ] Visit `/skill`, `/zh-CN/skill`, `/zh-HK/skill` — page loads in all
locales
- [ ] Click through all 4 scenario tabs — animation plays correctly for
each
- [ ] Click through all 5 client tabs — correct message shown, Claude
Code tab shows syntax-highlighted code (not raw HTML)
- [ ] Verify sparkline charts render in the Live Quote / OpenClaw
scenario
- [ ] Verify table borders render correctly (outer border + row
dividers, no missing bottom border)
- [ ] Verify gain/loss values show green/red colors in tables
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
## Summary
- Rename project from "OpenAPI" to "Longbridge Developers" across all
locales, config, and docs
- Add local SVG assets for homepage features (replacing external CDN
URLs)
- **TipContainer**: replace emoji with SVG icons, Shadcn-style
border/bg/text per type using `data-type` + CSS `@apply`
- **Tabs**: improved tab styling, fix `ul`/`ol` indentation in tab
content
- **Sidebar**: active item uses brand color background (color-mix) with
rounded corners
- **Doc footer**: LLMs Text + Edit this page on same row, subdued
colors, lighter "Updated at"
- **Breadcrumb**: remove primary color
- **UserMenu**: rename Profile → Dashboard (控制台)
- **Style**: inline code color fix, blockquote updates, font
improvements
## Test plan
- [ ] Verify rename appears correctly in EN / zh-CN / zh-HK locales
- [ ] Check homepage SVGs load from `/assets/`
- [ ] Check TipContainer all 6 types render with correct
border/bg/text/icon colors in light and dark mode
- [ ] Check Tabs styling and list indentation
- [ ] Check sidebar active item background
- [ ] Check doc footer layout (LLMs Text + Edit this page same row)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace localStorage-based session management with LongPort Internal
API calls
- Add LongPort Internal SDK script injection via head tag and Vite
plugin
- Create TypeScript definitions for Internal SDK interfaces (UserInfo,
Member, Setting, etc.)
- Refactor UserAvatar component to use Internal API for user info and
login state
- Add useAvatar composable for fetching user avatar from Internal API
- Update UserAvatarIcon to handle empty avatar state with fallback
styling
- Include SDK type definitions in TypeScript compilation
- Update Node.js engine requirement to >=24.0.0
- Remove @ts-ignore comments for Vite plugins
- Add Edit Link
Co-authored-by: 石石 <lei.yang@longbridge-inc.com>