Skip to content

feat(tools,www): generated API + Custom Element reference from repository truth (#1158, B2.4) - #1304

Merged
SisyphusZheng merged 1 commit into
devfrom
kimi/v044-b24-1158-api-truth
Sep 4, 2026
Merged

feat(tools,www): generated API + Custom Element reference from repository truth (#1158, B2.4)#1304
SisyphusZheng merged 1 commit into
devfrom
kimi/v044-b24-1158-api-truth

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

Closes #1158 (B2.4, stage #1288). Follows #1157 (content graph, PR #1303).

Problem

The website API reference was a handwritten inventory in www/app/routes/apilist.tsx that could silently drift from the real public exports; nothing derived per-export documentation, anchors, source links or search records from repository truth, and no gate detected missing/removed/internal/undocumented exports.

Owner

B2.4 / #1158 — generated API + Custom Element reference (tools + generated www data module + apilist consumption).

Before

  • Handwritten package/subpath inventory in the apilist route, regex-validated by check-package-surface.ts against literal chips.
  • 66 stable-candidate exports with no JSDoc summary.
  • No generated per-export reference, anchors, source links or search records.

After

  • tools/lib/api-reference.ts: deterministic export enumeration via the TypeScript compiler API (same program configuration as the public-interface snapshot — no hand-rolled parser, no deno doc subprocess), with a workspace paths map so cross-package re-exports resolve to their true declarations; PACKAGE_SURFACE.md machine-block parsing; JSDoc summary extraction.
  • tools/generate-api-reference.ts + deno task generate:api-reference / deno task api-reference:check: generates www/app/data/_generated-api-reference.ts (5 packages, 167 documented exports with kind/summary/stability/anchor/source location, 10 custom elements with attributes/events/slots/CSS parts/layer/hydrate/module, plus search records). Fails closed on: unclassified exports, stale classifications (removed exports), undocumented stable-candidates, internal-importable exports leaking into the documented surface, and duplicate anchors.
  • www/app/routes/apilist.tsx: handwritten inventory deleted; the route consumes the generated module and keeps only authored bilingual prose, with a fail-closed projection (a generated package without authored copy, or authored copy without a generated package, throws at build/SSR time).
  • tools/check-package-surface.ts: the apilist gate now validates the generated module's supported+internal subpath inventory against each package's real exports map instead of regexing handwritten literals.
  • Comment-only JSDoc added to every previously undocumented stable-candidate export (adapter-vite, app, element, ui); open-props-tokens.ts documentation lives in its generator template so generate:ui-tokens regeneration cannot drop it.
  • CI gate api-reference:check registered in tools/autoflow/policy.ts (ci + release tiers).

Why-not-second-owner

The package edits are JSDoc comments only — no public-surface, behavioral or frozen-semantics change (ADR-0151 cited; freeze:semantics:check and the public-interface snapshot pass unchanged). The adapter-vite enumeration approach deliberately reuses the existing TS-API pattern instead of adding a deno doc --json subprocess dependency.

Evidence

  • deno run tools/generate-api-reference.ts → 5 packages / 167 documented exports / 10 custom elements; deno task api-reference:check byte-identical; render determinism asserted in tests.
  • tools/lib/api-reference.test.ts — 5 passed (block parsing, paths mapping, enumeration kind/summary/source on a fixture, zero-failure real-repo build, unique anchors, no internal leak, byte-identical regeneration).
  • deno task test — 1823 passed (105 steps) | 0 failed | 1 ignored; supabase example 150 passed.
  • deno task build — green; built /apilist renders all five generated package rows (+8 more overflow chip for UI's 12 subpaths within the fixed 5-chip grammar).
  • deno task pack:dry-run — 5 tarballs; deno task package-artifacts:check — passed.
  • deno fmt --check, deno lint, deno task lint:markdown, deno task typecheck — clean.
  • Adjacent gates green: package-surface:check, interface:snapshot, freeze:semantics:check, www:check-current-truth, docs:check-current, check-package-surface.test.ts (11), generate:ui-tokens:check.
  • CI=true deno task test:e2e (chromium) — see CI run on this PR; local run results in the PR checks thread.

Scope

New: tools/lib/api-reference.ts + test, tools/generate-api-reference.ts, www/app/data/_generated-api-reference.ts. Modified: apilist route (inventory → generated consumption), check-package-surface.ts apilist gate, policy.ts gate registration, deno.json tasks, generate-ui-token-module.ts template, and JSDoc-only comment additions in 24 package source files.

Risk / recorded scope notes

  • Per-export anchor/search-record data and the Custom Element table are generated and gated; rendering a full per-export reference page is intentionally deferred — the compiled apilist page grammar is fixed and Pagefind indexes built HTML (noted for [0.44 beta.2] Drive website navigation, releases, i18n, SEO, and links from owned truth #1159 follow-up consumption).
  • The /apilist visual baseline snapshots (the explicit, CI-skipped OPEN_VISUAL_REGRESSION review gate) will show the chip change on next reviewed refresh; no baseline was silently normalized.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploying openelement with  Cloudflare Pages  Cloudflare Pages

Latest commit: ff9851c
Status: ✅  Deploy successful!
Preview URL: https://7d772b66.lessjs.pages.dev
Branch Preview URL: https://kimi-v044-b24-1158-api-truth.lessjs.pages.dev

View logs

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

…tory truth (#1158, B2.4)

Generate www/app/data/_generated-api-reference.ts from the real public
exports of every supported subpath (TypeScript compiler API enumeration
with workspace paths resolution, matching the public-interface snapshot),
each export's JSDoc summary and declaration location, the PACKAGE_SURFACE.md
stability classes, and the @openelement/ui compiler manifest (tags,
attributes, events, slots, CSS parts, SSR/DSD layer, hydration/activation).

The generator fails closed on unclassified exports, stale classifications
(removed exports), undocumented stable-candidate exports, internal exports
leaking into the documented surface, and duplicate anchors. --check is the
CI drift gate (byte-identical regeneration), registered in the AutoFlow
policy.

The handwritten API inventory in www/app/routes/apilist.tsx is gone: the
route consumes the generated inventory and keeps only authored bilingual
prose, with a fail-closed projection that refuses stale or missing copy
keys. check-package-surface.ts now validates the generated module's
subpath inventory against each package's exports map instead of regexing
handwritten literals.

Comment-only JSDoc summaries were added to previously undocumented
stable-candidate exports across packages (ADR-0151; no behavioral change —
freeze:semantics:check and the public interface snapshot are unchanged).
@SisyphusZheng
SisyphusZheng force-pushed the kimi/v044-b24-1158-api-truth branch from b101b01 to ff9851c Compare September 4, 2026 03:32
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@SisyphusZheng
SisyphusZheng merged commit f72ef28 into dev Sep 4, 2026
10 checks passed
@SisyphusZheng
SisyphusZheng deleted the kimi/v044-b24-1158-api-truth branch September 4, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant