Commit Graph

37 Commits

Author SHA1 Message Date
袁章洪 6eac1cb656 fix(api-reference): cast markdown-it-container plugin type for astro check
@types/markdown-it-container targets a different @types/markdown-it build, so
its plugin signature doesn't unify with our MarkdownIt instance — astro check
(tsc) failed. Cast it to the expected use() parameter type.
2026-09-14 16:37:21 +08:00
袁章洪 22a9257279 feat(api): path-based endpoint URLs (/docs/api/<op>)
Make /docs/api/<operationId> the canonical shareable URL for an endpoint
(previously only /docs/api?op=<id> worked). The React app now reads the op from
the pathname (query ?op= kept as a fallback for old links) and pushes path URLs
on navigation. Add prerendered [op].astro routes (en + zh-CN/zh-HK) so direct
load, refresh, and sharing of /docs/api/<op> resolve — rendering the same
interactive reference, with the endpoint summary in the page title.
2026-09-14 15:45:40 +08:00
袁章洪 88fe062d22 docs(api): render :::admonitions as docs-style callout boxes
Region warnings, tips, etc. were rendering as plain blockquotes in the
reference. Convert them back to ::: container syntax in the descriptions and
add a markdown-it-container plugin that emits the same DOM as the docs
remark-callout (.callout.callout-<type> + .callout-title), with the docs
callout.css copied into the package. Now :::warning/:::tip render as the same
colored boxes as docs; the .md keeps readable ::: blocks for AI consumers.
2026-09-14 11:44:08 +08:00
袁章洪 dd5fba5292 docs(api): style QuotePermission card to match docs
The reference's QuotePermission was rendering unstyled (plain text, no green
box / shield icon / badge pill) because its class names had no CSS and it only
supported 'command' (level-only watchlist ops rendered nothing). Port it 1:1
from the docs MDX component: shield icon, data-level color theming, market tag,
description, footer link + note; resolve command/level/market. Copy the docs
QuotePermission.css into the package and load it via api-reference.css.
2026-09-14 11:35:36 +08:00
袁章洪 ba609b634a docs(api): 3-level sidebar mirroring docs (section > subsection > endpoint)
Add x-subgroup (docs subsection) to every op and x-subgroups (ordered
subsection labels, trilingual) to each tag, so the reference sidebar nests
like the docs menu: e.g. 行情 > 个股行情/期权/数据分析/自选股, 交易 >
订单/网格交易/成交/资产. Screener stays flat (no docs subsections).

- Loader: SubGroup type; parseSpec partitions each tag's endpoints into
  ordered subgroups (by op x-subgroup, ordered per tag x-subgroups) plus
  leftover flat endpoints.
- ApiReference: nested collapsible subgroup level in the sidebar.
- openapi-markdown: render ## section > ### subsection > #### endpoint;
  fix endpointList / endpointMarkdownById to include subgroup endpoints
  (they previously only walked flat endpoints, 404-ing per-endpoint .md).
2026-09-14 11:30:19 +08:00
袁章洪 c6a6abaf0b docs(api): carry special docs markers (quote permission, region warnings) into reference
Audited all 116 backing-page ops for special markers. Fixes:
- QuotePermission: render x-quote-command/level/market as a callout in BOTH
  the CSR page and the AI markdown (openapi-markdown resolves
  quote-permissions.yaml). Convert the 4 watchlist ops' leaked
  '<QuotePermission level="basic" />' raw tags to x-quote-level: basic.
- Convert 2 topics ops' leaked '<TipContainer>' tags to blockquotes.
- Restore 3 admonitions dropped by the description cut / descOverride:
  dca_toggle (US-account region warning), grid_trigger_history (uses
  grid_order_id not order_id), ai_conversation (how to find an Agent UID).
- Loader: add x-quote-level / x-quote-market. CSR: pass level+market to
  <QuotePermission>, render when any of command/level/market is set.
2026-09-14 10:34:23 +08:00
袁章洪 fa27c69ec1 docs(api): fix AI-consumption issues from review
- Correct 5 endpoints' request params to true HTTP wire names (Rust does
  client-side transforms): screener/search body (filters/returns/page/size),
  broker-holding (add type), broker-holding/daily (parti_number),
  ahpremium/klines (line_type/line_num), finance_calendar (date/date_end/
  types[]/markets[]); fix finance_calendar response type wire name.
- Make POST examples executable: include full body (not just required) with
  type-aware placeholders (arrays/ints/objects), so top_movers etc. no longer
  emit an empty POST.
- Disambiguate duplicate summaries: short_positions/short_trades hk vs us now
  carry market-specific titles.
- Strip embedded leading headings from descriptions (removes duplicate H1).
- Renderer: drop page-body heading that repeats the page title (fixes the
  doubled '## Error Codes' in the aggregated api.md).
2026-09-14 10:16:01 +08:00
袁章洪 60745f7c32 feat(api-reference): AI-readable markdown — /docs/api.md, /docs/api/<op>.md (3 locales) from openapi.yaml; wire into llms.txt/llms-full.txt 2026-09-11 16:24:17 +08:00
袁章洪 bac1f434b7 style(api-reference): pin DocFooter to the bottom on short pages (flex-fill docs-inner) 2026-09-11 16:08:22 +08:00
袁章洪 e25bab222e feat(api-reference): copy button on x-page markdown code blocks 2026-09-11 11:35:18 +08:00
袁章洪 f66865bf80 style(api-reference): syntax-highlight x-page code blocks (github-light), guard against double H1 title 2026-09-11 10:50:36 +08:00
袁章洪 8674bb47ba style(api-reference): style x-page markdown code blocks as light code cards (match CodeTabs/Response JSON card) 2026-09-11 10:18:24 +08:00
袁章洪 44765e5a9c style(api-reference): render x-pages with a title h1 and native docs-content typography (match endpoint page style) 2026-09-11 10:06:17 +08:00
袁章洪 3737b53a56 style(api-reference): align page-item icons to the method-badge column width so all sidebar text lines up 2026-09-10 19:28:09 +08:00
袁章洪 aa3bba9fd2 feat(api-reference): 7-language API-Key signing helpers as CodeTabs on Authentication page (cURL/Python/Node/Java/Rust/C++/Go) 2026-09-10 17:04:25 +08:00
袁章洪 87d2d7ecb9 feat(api-reference): request examples default to OAuth Bearer; add per-language API-Key signing helpers to Authentication page; link endpoints to it 2026-09-10 16:58:14 +08:00
袁章洪 eb29bd5616 fix(api-reference): unique row keys + dedupe response fields — fixes stale rows leaking across endpoints on CSR navigation 2026-09-10 16:49:33 +08:00
袁章洪 2c3fd1afa2 style(api-reference): remove inline-code background on field-name cells in param/response tables (match docs) 2026-09-10 16:14:04 +08:00
袁章洪 87e00ea247 style(api-reference): fixed-width, subtler sidebar method badges so items align and match the docs sidebar 2026-09-10 16:11:30 +08:00
袁章洪 546d1a7ee2 feat(api-reference): split params into Path/Query/Request Body with real HTTP wire field names; drop 'SDK method parameters' note; regenerate DCA (wire request) 2026-09-10 15:53:38 +08:00
袁章洪 71e2f4ee98 feat(api-reference): add docs breadcrumb + slim DocFooter (in .docs-inner), suppress big marketing footer — full docs parity 2026-09-10 15:31:40 +08:00
袁章洪 b4ae113c18 refactor(api-reference): render endpoint pages with the docs DOM structure (docs-layout/sidebar/docs-body/docs-inner/docs-main/article.docs-content/docs-toc) so HTML + styling match docs exactly 2026-09-10 15:24:29 +08:00
袁章洪 85c9c8c2cd feat(api-reference): rebuild sidebar to match docs structure/style (bare page group, dividers, collapsible tag sections with caret, rounded brand highlight) 2026-09-10 15:11:34 +08:00
袁章洪 381b844fb2 fix(api-reference): center docs-model layout (margin auto like docs .docs-inner) 2026-09-10 14:57:52 +08:00
袁章洪 be3cea2bff feat(api-reference): reuse docs CliCommand card for parity; widen docs-model layout to 80rem/14rem to match docs 2026-09-10 13:56:10 +08:00
袁章洪 73490b7e31 fix(api-reference): correct auth (App Key/Secret/Access Token + HMAC signature) in raw-HTTP examples, add Authentication page, fix code highlighter corrupting URLs 2026-09-10 13:47:46 +08:00
袁章洪 a3fe260b07 fix(api-reference): cap docs-model endpoint layout width (content + TOC) so it is not full-bleed 2026-09-10 13:39:57 +08:00
袁章洪 8990e4f8a5 feat(api-reference): full docs-mirror endpoint pages (Request/Parameters/Request Example tabs, Response Properties, Response JSON, Error Code, On-this-page TOC, light code); regenerate DCA 2026-09-10 12:04:58 +08:00
袁章洪 c6eb762787 feat(api-reference): single-column docs-style endpoint detail with parameter tables 2026-09-10 11:46:10 +08:00
袁章洪 494ff0a594 feat(api-reference): docs-mirror endpoint detail (Parameters table, CLI block, raw-HTTP request); regenerate DCA 2026-09-10 11:29:41 +08:00
袁章洪 2d6f28b359 test(api-reference): add openapi.yaml invariants; add tag taxonomy + zh-HK summaries 2026-09-10 10:48:39 +08:00
袁章洪 46d4c2f457 feat(api-reference): wire zh-HK locale, websocket detail, full description render 2026-09-10 10:45:44 +08:00
袁章洪 60b798bb8f feat(api-reference): add pickLocale + zh-HK fields and websocket parsing to loader 2026-09-10 10:43:57 +08:00
twosugar 2843b64766 fix: 补 @types/markdown-it 依赖 2026-08-28 17:26:28 +08:00
twosugar 43a386ca92 chore(lint): 引入 oxlint 并清理未使用代码
新增 oxlint@1.80.0 + .oxlintrc.json + lint/lint:fix 脚本;清空所有
no-unused-vars 告警(未用 React/导入/变量/参数),删除无引用的 ui/Skill。
oxlint exit 0。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-28 16:14:18 +08:00
twosugar 2cdddf342f fix(build): bidirectional copy-routes, css minify, sitemap filter & CI dist path
copy-routes now emits both foo.html and foo/index.html so the unchanged nginx serves docs/sdk (.html) and the catch-all (/index.html). Fix an invalid empty selector in api-reference.css that broke lightningcss minify. Exclude migration URLs from the sitemap. Point the release/canary deploy at dist/ instead of the removed docs/.vitepress/dist (was uploading an empty dir → no md/html on OSS).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-28 15:04:41 +08:00
twosugar 535dc86a7a feat(migrate): port ApiReference (Scalar-style) to React workspace package
Sprint 2 §S6. Ports legacy `docs/.vitepress/theme/components/ApiReference.vue`
(1370 lines) to React inside a new `packages/api-reference` workspace
published as `@longbridge/openapi-api-reference`. Zero use of
`@scalar/*` or any third-party OpenAPI viewer — this is a manual 1:1 port.

Match legacy behaviour:
- Hash routing via `?op=<epId>` and `?page=<pageId>` + popstate listener
- Three views: intro / page / endpoint
- Sidebar with search + tag groups + method-color badges (GET/POST/PUT/DELETE)
- markdown-it prose rendering + external-link renderer patch
- Schema tree walker with `$ref` resolution + envelope detection
- Code-sample tabs (JS/Python/Rust/Java/Go/C++) via inline regex highlighter
- `QuotePermission` badge sourced from `quote-permissions.yaml`
- Locale-aware doc-link rewrites (`localizeDocLinks`)
- Dark mode double-guard `[data-theme="dark"]` + `prefers-color-scheme`

Files created:
- `packages/api-reference/package.json` — bun workspace, deps js-yaml + markdown-it
- `packages/api-reference/tsconfig.json` — extends root, includes .astro types
- `packages/api-reference/src/index.ts` — barrel
- `packages/api-reference/src/openapi-loader.ts` — yaml.load + $ref resolver
- `packages/api-reference/src/ApiReference.tsx` — top-level CSR component
- `packages/api-reference/src/CodeSample.tsx` — code panel + syntax highlight
- `packages/api-reference/src/QuotePermission.tsx` — permissions badge
- `packages/api-reference/src/api-reference.css` — 280px sidebar + fluid main +
  440px code panel + method colors + dark-mode

Files modified:
- `src/layouts/ApiReferenceLayout.astro` — mounts <ApiReference client:load
  rawYaml={rawYaml} locale={locale} /> with the CSS import (needed subpath in
  the package's `exports` field to resolve the CSS through the workspace name)
- `src/data/locale.{en,zh-CN,zh-HK}.ts` — api.* keys (search, section labels,
  copy states, intro copy, param labels, fallback, pathCopy)
- `src/mdx-components.tsx` — remove dead ApiReference entry (mounted via
  layout, not mdx tag)
- root `package.json` — workspace dep `@longbridge/openapi-api-reference`

Files deleted:
- `src/components/mdx/placeholders/ApiReference.tsx`

Runtime bugfix (post-subagent): package.json `exports` field only exposed
`.` and rejected `./src/api-reference.css` subpath, throwing a 500 on every
route once the layout tried to import the CSS. Added the CSS subpath to
`exports`. All 15 canonical URLs return 200 after fix.

Verified:
- astro check: 0 errors (85 files)
- /docs/api renders with sidebar (Overview / Real-Time Market Data / Error
  Codes + tag groups Watchlist Management / Market Temperature / Portfolio
  & Cash / News & Filings + method-color badges) + intro cards
  (REST API / WebSocket) — screenshot in gate/s6-verify-api.png
- /zh-CN/docs/api, /zh-HK/docs/api, /docs/quote/overview all 200
- `data-lbus-component` on api-reference / api-sidebar / api-intro

Closes Sprint 2 §S6 (gate finding A13 / A14).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-19 01:00:50 +08:00