Skip to content

Commit 96b1293

Browse files
os-zhuangclaude
andauthored
feat(console): public-tier manifest dump (ADR-0080 generation) (#2068)
* feat(console): public-tier manifest dump entry + extractor (ADR-0080) manifest-dump.html registers everything the console does and exposes window.__MANIFEST = manifestFromConfigs(getPublicConfigs()); scripts/ dump-public-manifest.mjs reads it in headless chromium and writes sdui.manifest.json. Verified end-to-end: 35 public blocks with full contracts; compile() against the dumped manifest catches missing-required/bad-enum/unknown. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(console): manifest-dump is a dev/ tool; declare @object-ui/sdui-parser dep CI Build Console failed (TS2307) because @object-ui/sdui-parser wasn't a console dep, so turbo didn't build its types before tsc. Declare it. Move the dump page to dev/ (tsconfig-included for tsc, but not a root .html → not auto-built into the shipped console bundle). dump script now loads /dev/manifest-dump.html. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 48f25e1 commit 96b1293

6 files changed

Lines changed: 70 additions & 1 deletion

File tree

.changeset/sdui-manifest-dump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@object-ui/console": patch
3+
---
4+
5+
ADR-0080: ship a `manifest-dump.html` build entry + `scripts/dump-public-manifest.mjs` that serialize the registry's public tier (`getPublicConfigs()`) to `sdui.manifest.json` — the artifact the framework `os build` JSX gate consumes for full component/prop validation. Generated in a real browser (the registry pulls browser-only deps); wired into `build-console.sh` framework-side.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!doctype html><html><head><meta charset="UTF-8"/><title>SDUI manifest dump</title></head>
2+
<body><pre id="out">computing…</pre><script type="module" src="/dev/manifest-dump.tsx"></script></body></html>

apps/console/dev/manifest-dump.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* ADR-0080: headless dump of the public-tier component manifest.
2+
* Registers everything the console does, then serializes getPublicConfigs(). */
3+
import '@object-ui/components';
4+
import '@object-ui/plugin-grid';
5+
import '@object-ui/plugin-form';
6+
import '@object-ui/plugin-view';
7+
import '@object-ui/plugin-list';
8+
import '@object-ui/plugin-detail';
9+
import '@object-ui/plugin-dashboard';
10+
import '@object-ui/plugin-charts';
11+
import '@object-ui/plugin-kanban';
12+
import '@object-ui/plugin-calendar';
13+
import '@object-ui/plugin-gantt';
14+
import '@object-ui/plugin-timeline';
15+
import '@object-ui/plugin-map';
16+
import '@object-ui/plugin-markdown';
17+
import '@object-ui/plugin-report';
18+
import '@object-ui/plugin-tree';
19+
import { ComponentRegistry } from '@object-ui/core';
20+
import { manifestFromConfigs } from '@object-ui/sdui-parser';
21+
22+
const manifest = manifestFromConfigs(ComponentRegistry.getPublicConfigs() as never);
23+
const json = JSON.stringify(manifest, null, 2);
24+
document.getElementById('out')!.textContent = json;
25+
(window as unknown as { __MANIFEST: string }).__MANIFEST = json;

apps/console/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@object-ui/console",
33
"version": "11.2.0",
4-
"description": "ObjectStack Console opinionated, fork-ready runtime console built on @object-ui/app-shell with the full plugin set wired up. Ships as a Hono UI plugin serving a pre-built SPA.",
4+
"description": "ObjectStack Console \u2014 opinionated, fork-ready runtime console built on @object-ui/app-shell with the full plugin set wired up. Ships as a Hono UI plugin serving a pre-built SPA.",
55
"license": "MIT",
66
"type": "module",
77
"homepage": "https://www.objectui.org/docs/guide/console",
@@ -111,5 +111,8 @@
111111
"typescript": "^6.0.3",
112112
"vite": "^8.0.16",
113113
"vitest": "^4.1.9"
114+
},
115+
"dependencies": {
116+
"@object-ui/sdui-parser": "workspace:*"
114117
}
115118
}

pnpm-lock.yaml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/dump-public-manifest.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ADR-0080: generate the public-tier SDUI component manifest.
2+
//
3+
// The registry is a browser app (plugin-map/charts pull browser-only deps), so
4+
// the reliable way to enumerate it is in a real browser: load the built
5+
// `manifest-dump.html` (which registers everything the console does and exposes
6+
// `window.__MANIFEST = manifestFromConfigs(getPublicConfigs())`) and read it.
7+
//
8+
// Usage (build-console.sh wires this after building + serving the console dist):
9+
// BASE_URL=http://localhost:4173 OUT=packages/console/dist/sdui.manifest.json \
10+
// node scripts/dump-public-manifest.mjs
11+
import { writeFileSync } from 'node:fs';
12+
import { chromium } from 'playwright';
13+
14+
const BASE = process.env.BASE_URL ?? 'http://localhost:5180';
15+
const OUT = process.env.OUT ?? 'sdui.manifest.json';
16+
17+
const browser = await chromium.launch();
18+
try {
19+
const page = await browser.newPage();
20+
await page.goto(`${BASE}/dev/manifest-dump.html`, { waitUntil: 'networkidle', timeout: 120_000 });
21+
const json = await page.waitForFunction(() => globalThis.__MANIFEST, null, { timeout: 120_000 })
22+
.then((h) => h.jsonValue());
23+
const manifest = JSON.parse(json);
24+
const n = Object.keys(manifest.components ?? {}).length;
25+
if (n === 0) throw new Error('empty manifest — registry not populated');
26+
writeFileSync(OUT, JSON.stringify(manifest, null, 2));
27+
console.log(`✓ wrote ${n} public blocks → ${OUT}`);
28+
} finally {
29+
await browser.close();
30+
}

0 commit comments

Comments
 (0)