Skip to content

Let the urlcode-ui CLI see the namespaces peer extensions ship - #229

Merged
jimhoyd merged 1 commit into
mainfrom
claude/nice-feynman-980861
Sep 20, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/nice-feynman-980861

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

The gap

packages/ui/src/host/cli.ts built its kit with createKit({presentation, theme, templates, stylesheet})
from kitCatalogue and kitTemplates only. In a site produced by urlcode init site --with ui,auth,admin
it therefore described a kit the site never renders:

  • urlcode-ui list showed no auth/* or admin/* template name.
  • urlcode-ui eject auth/sign-in --out ui/templates exited 1 — eject only checked kitTemplates.
  • urlcode-ui doctor listed a project override of auth/sign-in with origin: "project" but no expected
    view model, so its behind flag could never detect that the override had fallen behind the shipped
    template. 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 ids
    the 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 --project
with Node package resolution, imported for the namespace it exports, and skipped with a note on stderr when
it is not installed there.

host.mjs was rejected on purpose. That module calls createUiExtension, builds the auth service, opens
stores and throws without PROJECT_SHA256 at its top level — importing it to inspect it would run the
site's host wiring as a side effect, and a read-only list or doctor must not do that. Parsing it
statically instead means re-implementing a JS parser against a file the operator is explicitly invited to
edit. Naming packages stays inert and declarative, and scaffold knows request.names, so the generated
commands 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,
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, so one export describes the whole contribution and cannot drift from what the
host registers. createKit itself takes copy from the Presentation it is given and ignores both.

adminUiTemplates deliberately carries no catalogue: its templates use no copy key, and admin composes
adminCatalogue onto the kit's presentation rather than registering it there. Offering those ids in
copy --missing would ask a translator for keys the runtime then ignores — see #227, filed from this work.

Result, against the real packages

behind      [{"name":"auth/sign-in","viewModel":"auth/sign-in@0","expected":"auth/sign-in@1","behind":true}]
extensions  [{"specifier":"@jimhoyd/urlcode-auth","templates":22,"catalogue":474,"samples":22},
             {"specifier":"@jimhoyd/urlcode-admin","templates":13,"catalogue":0,"samples":13}]
fr missing  502 keys, first: abuse.required, abuse.retry, abuse.title

list shows 49 templates with extension:auth/extension:admin origins, eject auth/sign-in writes the
shipped source, preview admin/dashboard renders the console's own sample. doctor gained an extensions
field naming the namespaces the report covers, because a report missing a peer describes a different kit
from the one the site renders.

@jimhoyd/urlcode-ui still depends on neither peer, and ui's own tests exercise the loader against a
fixture package rather than a real one.

Documentation

docs/COMPOSING-A-SITE.md does not exist in this repository, and neither does the gap paragraph quoted in
the 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 doctor reports every auth/*/admin/* template
behind 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, and
a regenerated llms-full.txt.

nextSteps now reads npx urlcode-ui doctor --project . --extensions … and, when auth is composed,
eject auth/sign-in rather than eject layout — an extension screen is the override a composed site is far
more 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 (531
passed, 1 skipped), npm run verify:workspaces (ui 59, auth 196, admin 63, workspace integration 1 — all
passing) 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.ts covering the namespace loader,
resolution from --project, the skipped-package and bounded-specifier paths, and the drift check against a
stale override; scaffold assertions for the generated flag per composition; and an integration assertion
that runs the built urlcode-ui CLI inside a real init --with ui,auth,admin site against the actual
authUiTemplates/adminUiTemplates exports.

Filed, not fixed

#227 — in a composed site, admin's copy is not translatable at all: presentationSource calls
createAdminPresentation({base: kit.presentation}) with no catalogues, so a ui/copy/fr.json entry for
an adminUi.* id is dropped and coverage still reports the key missing. Reproduced, out of scope here, and
the reason admin's namespace ships no catalogue.

🤖 Generated with Claude Code

`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
jimhoyd force-pushed the claude/nice-feynman-980861 branch from 3654919 to 17d1e2c Compare September 20, 2026 04:44
@jimhoyd
jimhoyd merged commit 6083c64 into main Sep 20, 2026
20 checks passed
@jimhoyd
jimhoyd deleted the claude/nice-feynman-980861 branch September 20, 2026 04:52
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]>
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