Repository navigation
Let the urlcode-ui CLI see the namespaces peer extensions ship - #229
Merged
Merged
Conversation
`urlcode-ui` built its kit from `kitCatalogue` and `kitTemplates` alone, so in a site composed with `--with ui,auth,admin` it described a kit the site never renders: `list` showed no `auth/*` or `admin/*` name, `eject auth/sign-in` exited 1, `doctor` reported a project override of an extension template with no `expected` view model (so its `behind` flag could never fire, which is the one thing it exists for), and `copy --missing` skeletons covered kit ids only. Every command now takes `--extensions PKG,PKG`. Each package is resolved from `--project` with Node package resolution and imported for the namespace it already hands the host; one that is not installed there is skipped with a note, so the command still runs. The site's `host.mjs` is deliberately not read: it builds services and reads secrets at its top level, and a read-only `list` or `doctor` must not run it, while parsing it statically means parsing a file the operator is invited to edit. So the CLI needs no export name per peer, `ExtensionTemplates` gains two optional tooling-facing fields — `catalogue`, the English copy the host registers in `sources`, and `samples`, a view model per template for `preview`. `authUiTemplates` and `adminUiTemplates` carry them and the loader finds the object by shape. `adminUiTemplates` carries no catalogue on purpose: its templates use no copy key, and admin composes `adminCatalogue` onto the kit's presentation rather than registering it there, so offering those ids to a translator would ask for keys the runtime ignores (#227). `scaffold` writes the flag into the generated commands and README, and offers `eject auth/sign-in` over `eject layout` when auth is composed. ui depends on neither peer: the operator names them. Also corrects the auth and admin READMEs, which claimed flatly that `urlcode-ui doctor` reports every `auth/*`/`admin/*` template behind its view model, and documents the behaviour in the ui README, FRAMEWORK.md, llms.txt and ui/AGENTS.md. Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd
force-pushed
the
claude/nice-feynman-980861
branch
from
September 20, 2026 04:44
3654919 to
17d1e2c
Compare
jimhoyd
added a commit
that referenced
this pull request
Sep 20, 2026
#229 gave `urlcode-ui` an `--extensions` option: it resolves the named packages from `--project` and loads the namespaces they ship, so `list`, `eject`, `preview`, `doctor` and `copy --missing` cover `auth/*` and `admin/*` as the host that registers them does. This page still described the gap as current, and its example commands omitted the flag, so a reader following them would reproduce the old behaviour and conclude the tooling was broken. The section now describes what the CLI does, including the `extensions` field in the `doctor` report and why admin-owned `adminUi.*` ids are deliberately absent from `copy --missing` (#227). Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd
added a commit
that referenced
this pull request
Sep 20, 2026
…217) (#226) * Demonstrate the composed ui/auth/admin override path and document it (#217) first: the wiring half is already done. #220 (d9d627f) made the ui scaffold register authCatalogue/authUiTemplates/adminUiTemplates and pass the kit into authExtension/adminExtension, so all three "observed source evidence" bullets in the issue are stale. It also retired the UI primitive fallback, which means the issue's "preserve standalone auth/admin without ui" requirement no longer describes a supported configuration: those combinations now refuse at scaffold time. Nothing here re-opens that decision. What was missing was the demonstration and the documentation. Generated-consumer regression (test/workspace-scaffold.integration.ts): runs `init site --with ui,auth,admin` against the built packages, writes ui/templates/auth/sign-in.html, ui/templates/admin/dashboard.html and ui/copy/en.json into the generated site, bootstraps an administrator through the generated operator module, creates a runtime from the extension array the generated host.mjs exports, and asserts both the template and the copy override appear on a rendered /account/login and a rendered /admin. Verified to fail — not just compile — by removing adminUiTemplates from the ui scaffold: the composition assertion fails and the render test fails at activation. It skips, with the reason printed, when the host SQLite is not the one auth's store requires. The same test now also pins ui-alone to `sources: [], extensions: []` with no peer import. A throwing onSignUp is covered in packages/auth/test/lifecycle-hooks.test.ts, so the documented "post-action hooks cannot undo anything, keep them non-throwing" rule is a tested property. docs/COMPOSING-A-SITE.md is the new root document, linked from docs/AI-AUTHORING.md's reading order, llms.txt and llms-full.txt. It separates declarative config, project functions used for lifecycle hooks, and the TypeScript a new extension needs; tabulates each supported --with combination and each refusal; and gives per-package hook input, verdict, timing and failure semantics read from the implementation (get_extensions exposes the schemas but not these). It also records a gap found while writing it and confirmed by running the CLI: `urlcode-ui` builds its kit without the auth and admin namespaces, so `list` omits auth/* and admin/*, `eject auth/sign-in` is refused, `copy --missing` skeletons cover kit ids only, and `doctor` reports a project override of an extension template with no `expected` view model, so its `behind` flag cannot detect a stale extension override. The runtime path is unaffected. Not established: no HTTP listener, TLS proxy, browser or deployed site was exercised, and no published npm tarball was compared against this checkout. packages/ui/README.md's claim that auth/admin have not adopted the kit is left to #200. Co-Authored-By: Claude Opus 5 <[email protected]> * Retire the superseded UI-fallback row in OPEN-DECISIONS #220 merged and retired the UI primitive fallback, but the decisions table still described the code as retaining "tested primitive rendering without it" and recommended keeping both pending a decision. Verified against main: packages/auth/src/auth.ts:71 now refuses activation without ui and says outright there is no shared-primitive fallback, so the row was wrong about the current code and contradicted the composition path this branch documents. Moved to the closed-questions list rather than deleted, so the resolution stays on the record. Co-Authored-By: Claude Opus 5 <[email protected]> * Load the companion packages through a computed specifier CI's `static` job runs typecheck after `npm ci` but without a workspace build, so `@jimhoyd/urlcode-auth` and `@jimhoyd/urlcode-admin` have no type declarations there and the two literal dynamic-import specifiers failed with TS2307. It passed locally only because this worktree had the packages built. The specifier is now computed, which TypeScript does not resolve. Verified the mechanism rather than assuming it: a literal `import('@not/installed-anywhere')` reports TS2307 under the same compiler settings and the computed form reports nothing. Runtime resolution is unchanged and verify:workspaces still passes. Co-Authored-By: Claude Opus 5 <[email protected]> * Release the SQLite WAL before removing the generated site The new override test failed on Windows with EBUSY unlinking site/data/auth.sqlite-wal, then hung until the job was cancelled at ten minutes. Cause: node:test runs after-hooks in registration order, and the project() helper registers its own directory removal first. The auth store's closes are registered later in the test body, so the directory was removed while SQLite still held the WAL open. POSIX unlinks an open file without complaint, which is why this passed everywhere except Windows. This test now takes its own mkdtemp and registers the removal last, after the host and runtime closes. The first test in the file keeps project(): it opens no store, so the helper's ordering is fine there. Not established: I could not reproduce the EBUSY locally, having no Windows host. The ordering defect it reports is real and reproducible by inspection -- the removal genuinely ran first -- but only the Windows CI leg can confirm the fix. Co-Authored-By: Claude Opus 5 <[email protected]> * Describe the CLI's extension namespaces instead of the closed gap #229 gave `urlcode-ui` an `--extensions` option: it resolves the named packages from `--project` and loads the namespaces they ship, so `list`, `eject`, `preview`, `doctor` and `copy --missing` cover `auth/*` and `admin/*` as the host that registers them does. This page still described the gap as current, and its example commands omitted the flag, so a reader following them would reproduce the old behaviour and conclude the tooling was broken. The section now describes what the CLI does, including the `extensions` field in the `doctor` report and why admin-owned `adminUi.*` ids are deliberately absent from `copy --missing` (#227). Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
packages/ui/src/host/cli.tsbuilt its kit withcreateKit({presentation, theme, templates, stylesheet})from
kitCatalogueandkitTemplatesonly. In a site produced byurlcode init site --with ui,auth,adminit therefore described a kit the site never renders:
urlcode-ui listshowed noauth/*oradmin/*template name.urlcode-ui eject auth/sign-in --out ui/templatesexited 1 —ejectonly checkedkitTemplates.urlcode-ui doctorlisted a project override ofauth/sign-inwithorigin: "project"but noexpectedview model, so its
behindflag could never detect that the override had fallen behind the shippedtemplate. That is the one thing the flag exists for.
urlcode-ui copy --missing <lang>skeletons covered kit ids only, so a translator never saw the auth idsthe account screens use.
The runtime path was fine; this was tooling only.
The decision, and why
An option that names packages, not reading
host.mjs. Every command now takes--extensions @jimhoyd/urlcode-auth,@jimhoyd/urlcode-admin. Each specifier is resolved from--projectwith Node package resolution, imported for the namespace it exports, and skipped with a note on stderr when
it is not installed there.
host.mjswas rejected on purpose. That module callscreateUiExtension, builds the auth service, opensstores and throws without
PROJECT_SHA256at its top level — importing it to inspect it would run thesite's host wiring as a side effect, and a read-only
listordoctormust not do that. Parsing itstatically instead means re-implementing a JS parser against a file the operator is explicitly invited to
edit. Naming packages stays inert and declarative, and
scaffoldknowsrequest.names, so the generatedcommands carry the flag already — the operator never has to remember it.
One export per package, found by shape. Rather than teaching ui an export name per peer,
ExtensionTemplatesgains two optional tooling-facing fields:catalogue(the English copy the hostregisters in
sources) andsamples(a view model per template, forpreview).authUiTemplatesandadminUiTemplatescarry them, so one export describes the whole contribution and cannot drift from what thehost registers.
createKititself takes copy from thePresentationit is given and ignores both.adminUiTemplatesdeliberately carries no catalogue: its templates use no copy key, and admin composesadminCatalogueonto the kit's presentation rather than registering it there. Offering those ids incopy --missingwould ask a translator for keys the runtime then ignores — see #227, filed from this work.Result, against the real packages
listshows 49 templates withextension:auth/extension:adminorigins,eject auth/sign-inwrites theshipped source,
preview admin/dashboardrenders the console's own sample.doctorgained anextensionsfield naming the namespaces the report covers, because a report missing a peer describes a different kit
from the one the site renders.
@jimhoyd/urlcode-uistill depends on neither peer, and ui's own tests exercise the loader against afixture package rather than a real one.
Documentation
docs/COMPOSING-A-SITE.mddoes not exist in this repository, and neither does the gap paragraph quoted inthe task (the whole tree was searched). The prose that actually made the claim was corrected instead: the
auth and admin READMEs both stated flatly that
urlcode-ui doctorreports everyauth/*/admin/*templatebehind its view model, which was exactly the false claim. Updated alongside: the CLI section of the ui
README, the composition section of
docs/FRAMEWORK.md,packages/ui/llms.txt,packages/ui/AGENTS.md, anda regenerated
llms-full.txt.nextStepsnow readsnpx urlcode-ui doctor --project . --extensions …and, when auth is composed,eject auth/sign-inrather thaneject layout— an extension screen is the override a composed site is farmore likely to want.
Verification
From a worktree that started without
node_modules:npm ci,npm run build,npm run workspace:styles,the three workspace builds, then
npm run lint,npm run typecheck,npm run check,npm test(531passed, 1 skipped),
npm run verify:workspaces(ui 59, auth 196, admin 63, workspace integration 1 — allpassing) and
npm run test:package. CI passing is not an independent security review.New coverage: a fixture peer package in
packages/ui/test/cli.test.tscovering the namespace loader,resolution from
--project, the skipped-package and bounded-specifier paths, and the drift check against astale override; scaffold assertions for the generated flag per composition; and an integration assertion
that runs the built
urlcode-uiCLI inside a realinit --with ui,auth,adminsite against the actualauthUiTemplates/adminUiTemplatesexports.Filed, not fixed
#227 — in a composed site, admin's copy is not translatable at all:
presentationSourcecallscreateAdminPresentation({base: kit.presentation})with nocatalogues, so aui/copy/fr.jsonentry foran
adminUi.*id is dropped and coverage still reports the key missing. Reproduced, out of scope here, andthe reason admin's namespace ships no catalogue.
🤖 Generated with Claude Code