Skip to content

Commit e296e1d

Browse files
os-zhuangclaude
andauthored
feat(cli): wire SDUI manifest — build-console.sh generates it, os build resolves from @objectstack/console (ADR-0080) (#2454)
build-console.sh: guarded best-effort step that boots the just-built console's registry and dumps the public-tier manifest into @objectstack/console/dist/ sdui.manifest.json (skips on a sha without the dump tooling; never fails the build). validate.ts: resolve the manifest from @objectstack/console too (cli already deps it) → full component/prop validation when present, parse-level otherwise. Activation = bump .objectui-sha to >=96b1293 (a release step). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 59576d0 commit e296e1d

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

.changeset/sdui-manifest-wiring.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@objectstack/cli": minor
3+
---
4+
5+
ADR-0080: wire the SDUI manifest end-to-end. `build-console.sh` now (best-effort, guarded) generates `sdui.manifest.json` from the just-built console's public-tier registry into `@objectstack/console/dist/`; the `os build` / `os validate` JSX gate resolves the manifest from `@objectstack/console` (in addition to the project root) and does full component/prop validation when present. Activating full validation requires bumping `.objectui-sha` to an objectui commit that ships the dump tooling (>=96b1293); until then the gate falls back to parse-level and the build step skips.

packages/cli/src/commands/validate.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Args, Command, Flags } from '@oclif/core';
44
import { existsSync, readFileSync } from 'node:fs';
5+
import { createRequire } from 'node:module';
56
import { join } from 'node:path';
67
import chalk from 'chalk';
78
import { ZodError } from 'zod';
@@ -179,6 +180,12 @@ export default class Validate extends Command {
179180
try {
180181
const mp = join(process.cwd(), 'sdui.manifest.json');
181182
if (existsSync(mp)) sduiManifest = JSON.parse(readFileSync(mp, 'utf8'));
183+
if (!sduiManifest) {
184+
// Fall back to the manifest shipped inside @objectstack/console
185+
// (built from objectui's public-tier registry; cli already deps it).
186+
const cp = createRequire(import.meta.url).resolve('@objectstack/console/dist/sdui.manifest.json');
187+
if (existsSync(cp)) sduiManifest = JSON.parse(readFileSync(cp, 'utf8'));
188+
}
182189
} catch { /* fall back to parse-level */ }
183190
const jsxFindings = validateJsxPages(
184191
result.data as Record<string, unknown>,

scripts/build-console.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,26 @@ cp -R "$CONSOLE_DIST" "$TARGET"
128128

129129
BYTES="$(du -sk "$TARGET" 2>/dev/null | awk '{print $1}')"
130130
echo "✓ @objectstack/console dist ready (${BYTES} KB) from objectui@${PINNED_SHA:0:12}"
131+
132+
# ADR-0080: generate the public-tier SDUI manifest from the just-built console's
133+
# registry so the framework os-build JSX gate can do full component/prop
134+
# validation. Best-effort and GUARDED: skips on a sha without the dump tooling,
135+
# and never fails the console build (the gate falls back to parse-level).
136+
DUMP_PAGE="${BUILD_ROOT}/apps/console/dev/manifest-dump.html"
137+
DUMP_SCRIPT="${BUILD_ROOT}/scripts/dump-public-manifest.mjs"
138+
if [[ -f "$DUMP_PAGE" && -f "$DUMP_SCRIPT" ]]; then
139+
echo "→ Generating SDUI public-tier manifest (ADR-0080)..."
140+
pushd "$BUILD_ROOT" > /dev/null
141+
pnpm --filter @object-ui/console exec vite dev --port 5180 > /tmp/sdui-dump-dev.log 2>&1 &
142+
DUMP_DEV_PID=$!
143+
for _ in $(seq 1 90); do curl -sf "http://localhost:5180/" > /dev/null 2>&1 && break; sleep 1; done
144+
if BASE_URL="http://localhost:5180" OUT="${TARGET}/sdui.manifest.json" node scripts/dump-public-manifest.mjs; then
145+
echo "✓ wrote ${TARGET}/sdui.manifest.json"
146+
else
147+
echo "⚠ manifest generation failed — os-build JSX gate falls back to parse-level (non-fatal)"
148+
fi
149+
kill "$DUMP_DEV_PID" 2>/dev/null || true
150+
popd > /dev/null
151+
else
152+
echo "ℹ manifest dump tooling not present at objectui@${PINNED_SHA:0:12} — skipping (bump .objectui-sha to >=96b1293 to enable full JSX validation)"
153+
fi

0 commit comments

Comments
 (0)