Repository navigation
feat(app-shell): Markdown editor with live preview for doc items in Studio (objectui#10188) - #11241
Conversation
Studio's metadata admin edits a `doc` (ADR-0046) through the one generic edit flow, with `previews/DocPreview` as the type's canvas: a Markdown source pane beside a live preview rendered through the registry's `markdown` component (the docs portal's renderer), the doc's locale variants as entries of `translations`, and its placement in a book as the doc-side `group` key, read back through the spec's `resolveBookTree`. `doc` joins the create-mode canvas types and owns `content`, `translations` and `group` on the canvas; the create form asks for the header keys and suggests `name` from the title. Part of objectui#10188. Claude-Session: https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ Co-authored-by: Claude <noreply@anthropic.com>
…lus changeset `previews/doc-draft.ts` holds the pure patch/placement functions so `DocPreview.tsx` exports only its component; the book list no longer resets its own state synchronously inside the effect. Adds the `@object-ui/app-shell` minor changeset for the doc editor. Part of objectui#10188. Claude-Session: https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ Co-authored-by: Claude <noreply@anthropic.com>
… `doc` `ConditionWidget.conditionScope.test.tsx` enumerates the registered metadata resources against `CONDITION_SCOPE_BY_METADATA_TYPE`; `doc` is now registered (its create hints), so it takes the ruling's own last row, `none`: `DocSchema` declares no condition key. Part of objectui#10188. Claude-Session: https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ Co-authored-by: Claude <noreply@anthropic.com>
Describes the doc canvas (Markdown source + live preview through the registry's `markdown` renderer, locale variants as `translations` entries, book placement as the doc's own `group` key) under "Metadata designers", per AGENTS.md rule #2. Part of objectui#10188. Claude-Session: https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ Co-authored-by: Claude <noreply@anthropic.com>
Brings in PR objectui#11207 (the doc navigation entry) and the other main commits since this branch's base; no file of that PR is edited here. Claude-Session: https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ Co-authored-by: Claude <noreply@anthropic.com>
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: Inputs read: card #10188 (body and all six comments — the director's addendum ① Derived judgmentsAccept-set — what the editor writes, against
Check-runs on the head (read 2026-09-30T17:11Z): 32 ② Semver level
Changeset body against the diff, line by line: the title line — delivered; "a Markdown source pane beside a live preview, rendered by the same
③ Boundary flagsDev deviations (PR body and report), each answered:
Out-of-scope findings, routed:
Gate state: the seven Blocking findings: none. Implemented-by: VERDICT: PASS |
Part of #10188 — the editor half. The menu half (body scope item 2, the addendum) and the acceptance checklist item stay with the card.
Clause-②: no
What this does
Studio's metadata admin can now author a
doc(ADR-0046) the way the maintainer asked for: an admin writes Markdown in the UI, sees it rendered live, and places it in a book. It is built INTO the existing edit flow, not beside it:MetadataResourceEditPageloads and saves the doc through the standard metadata write door (PUT /meta/doc/:name,mode=draft, then Publish), and a newdocPreview (previews/DocPreview.tsx) is the type's canvas, the way the object designer is the canvas forfields.SchemaRendereras{ type: 'markdown' }, the registry entry@object-ui/plugin-markdownprovides and the docs portal (DocPage) renders with.@object-ui/app-shelltakes no new dependency.DocSchemadeclares. The installed spec (17.5.0) has notitleand nolocalekey on a doc: the title islabel(titleis a refused alias of it) and a locale variant is an entry oftranslations({ label?, description?, content }). The locale switcher editstranslations[tag]; a new variant is seeded from the default body, because an empty variant is served to that locale's readers as an empty page.groupkey, or a group's name/tag rule claims it. The picker lists every listed book's groups and writesdoc.group; the readout under it ("Appears in: BOOK › GROUP") is computed with the spec's ownresolveBookTreeover this one doc, so it also reports a placement a rule makes with no explicitgroup, lists every book a shared group key lands in, and marks a public book.content,translationsandgroup(CANVAS_OWNED_KEYS), so the properties form shows the header keys only;docjoinsCREATE_MODE_CANVAS_TYPES, so the editor is up during create too. The create form asks forlabel/name/description, suggestsnamefrom the title, and seedscontent: ''(the one other key the spec requires).en/zhtables (metadata-admin/i18n.ts, theengine.*carve-out), plus adoctype label ("Documentation" / "文档"). No locale pack underpackages/i18nchanges.Premise readings (dispatch zone 2)
doctoday — measured on the published 17.5.0 console (/_console) against a 17.5.0 backend: the Documentation tile exists (the probe package ships a doc) and create is the generic SchemaForm (Name*,Content*,Label,Description) withContenta one-line text input (zero textareas) and no preview; the edit form of a packaged doc shows every key incl. the_lock*envelope andTranslationsas a JSON fallback. Holds as the PM guessed.GET /meta/typesserves the doc row withallowRuntimeCreate: true,allowOrgOverride: falseandDocSchema's JSON Schema (name,label,description,content,order,group,tags,translations+ the envelope; requiredname,content).PUT /meta/doc/:name?mode=draftanswered 200 (state=draft), publish 200, andGET /meta/doc/:nameserved the doc afterwards. Falsified in part: the card's key list namestitleandlocale, which the spec does not declare (see above); the editor writeslabelandtranslations.markdownlazily (register-plugins.ts); the live run below rendered a heading, a list and a link through it.groupkey is the explicit placement; the server's tree endpoint honours it (measured: a doc saved withgroup: referenceis listed under that group byGET /meta/book/docprobe_manual/tree). No book-write path was added. (For the record:bookisallowRuntimeCreate: true,allowOrgOverride: falseon 17.5.0, so runtime books are creatable and packaged ones are read-only.)Live reading (reach)
A published
@objectstack/cli@17.5.0backend (os dev --fresh --seed-admin, a probe package with bookdocprobe_manual= groupsgetting_started(ruledocprobe_gs_*) andreference), this branch's console on vite, driven with Playwright:/apps/setup/metadata/doc/new: title "Live Guide" suggestedname = live_guide; the picker offered "Not placed in a section, Getting started, Reference"; choosing Reference read back "Appears in: Probe Manual › Reference"; the live preview drewh1"Live Guide",li"first item" / "second item" anda[href="https://example.com/docs"]"the portal"./apps/setup/metadata/doc/live_guidewith the same body and section; Publish cleared the pending draft; a full page reload showed the same body and section again./docs/docprobe_manual/live_guiderendered the same heading, list and link.titleanswers422 INVALID_METADATAwithissues[0].message"Unrecognized key(s) on this doc:title. Did you meantitle→label? …"; the page test replays that envelope verbatim.Tests
All at HEAD
49a07a8a96(this branch after mergingorigin/maindded788ada), run from the worktree root through the shared verify lock, exit codes captured before any pipe:pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build— exit 0 (re-run after the merge).pnpm --filter @object-ui/app-shell type-check— exit 0 (tsc --noEmit && tsc -p tsconfig.test.json; the test project compiles both new suites).pnpm exec vitest run --maxWorkers=3 --shard=K/6 packages/app-shell/, K = 1 to 6 — all six exit 0: 932 test files (931 passed, 1 skipped), which is every tracked app-shell test file; 9301 tests passed, 9 skipped.previews/DocPreview.test.tsx(13 tests: source tocontentand the live preview, read-only mode, locale variants astranslationsentries and the refused tags, book placement written asdoc.groupwith the resolver's readout incl. a rule placement, a shared key and a public book, an unknown key kept visible, a failed book list reported, a full-parseDocSchema.safeParseof a draft edited through every control, and no untranslated key in zh-CN) andResourceEditPage.docEditor-10188.test.tsx(3 tests: create sends one spec-cleanPUTthrough the standard door; reload shows the same body and section; the server's refusal message reaches the author).ConditionWidget.conditionScope.test.tsx("every registered metadata resource has a ruled row") oncedocbecame a registered resource; with thedoc: 'none'row it is green.node scripts/check-changeset-presence.mjs,check:control-bytes,check:i18n-designer-parity,check:i18n-keys,check:vi-mock-specifiers,check:vi-mock-inherit,check:vi-mock-override-shape,check:test-path-roots,check:new-line-citations(0 new citations),check:phantom-deps,check:unused-deps,check:registry-bare-names,check:unreferenced-sources,check:changeset-claims,check:pending-changeset-literals. No locale pack underpackages/i18nchanged, so the pack-parity suites are not owed.eslint .), narrowed to the 9 changed source files with--format json: 0 errors;ResourceEditPage.tsxreports 53 warnings, the same 53 its base version reports (linted fromgit showthrough--stdin), and every other changed file 0. The narrowing excludes nothing: the config sets no type-aware parser options and its local rules read no files, so this diff cannot move a verdict on an untouched file.check:eager-closure,check:sdui-registration-pins(exit 2, "No console build to weigh"),check:published-dist, andcheck:readme-exportsas a whole (it cannot judge other unbuilt packages; with app-shell built, no app-shell README line was left unjudged). The editor's one value import from@objectstack/spec/systemnames a module the package entry already reaches through a static chain (register-builtins→DashboardDefaultInspector→dashboard-schema→metadata-form-i18n, which imports it); the eager-closure figure itself is CI's to read.Acceptance notes
apps/consoleis outside this card). After the live run,GET /meta/book/docprobe_manual/treelistslive_guideunder Reference, but the portal page/docs/docprobe_manual/live_guiderenders a sidebar with Reference empty — on this branch's console and on the published 17.5.0 console alike. The console resolves the tree client-side andscopeDocsToBook(apps/console/src/pages/book-nav.ts) first drops docs outside the book's package, while the spec'sresolveBookTreeplaces a doc by its explicitgroupwith no package scope. So a doc placed from this editor opens fine but is missing from the book's navigation./metadata/doclist and its New button do not depend on it.WRITABLE_PACKAGE_REQUIRED(measured with?package=com.example.docprobe); the live run authored env-wide, which the server accepted.doc(clientValidation.tshas nodocloader), so a malformed doc is refused on Save by the server, not while typing.Deviations
packages/app-shell/README.mdgains a short "Documentation pages (doc)" section (AGENTS.md's docs-driven commandment: a feature is not done until the package README reflects it); the claim's file surface did not list it.metadata-admin/conditionScope.tsgains the rowdoc: 'none': registeringdoc's create hints made it a served type, andConditionWidget.conditionScope.test.tsxrequires every served type to carry a ruled row.noneis the ruling's own last row (a type with no condition key;DocSchemadeclares none).origin/mainwas merged in after PR objectui#11207 landed (the menu half's navigation entry); none of its files is edited here.Generated by Claude Code