Skip to content

Asset reference diagnostics, local agent bootstrap, SPA and headless-auth recipes, forms inline success (#805, #807, #808, #809, #810) - #813

Merged
jimhoyd merged 11 commits into
mainfrom
claude/issues-805-810
Sep 27, 2026
Merged

jimhoyd merged 11 commits into
mainfrom
claude/issues-805-810

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

This PR covers five issues. The owner decided the approach for #805, #807 and #809 on 2026-09-27; the decisions are recorded on each issue.

#808: missing file and directory references name the route, field and project root

Before: static.directory: app/assets printed only Required file or directory not found.

Now: the error gives urlcode.yaml:5:7: Route /assets/*: static.directory "app/assets" does not exist; … resolve relative to the selected project directory …; did you mean "assets"? together with code, route, pointer, file, line and column.

  • The fix: one resolver now handles every page, download and static reference, plus site.favicon, llms and notFound. The app/… hint appears only when the shorter path exists inside the project as the right kind (file or directory).
  • Traversal, absolute and symlink references: they are refused before anything outside the project is looked up, and the reference is not named. The answer is identical whether or not the target exists.
  • Existence oracle closed: with a sitemap enabled, main answered differently depending on whether ../outside existed, and read that directory. The sitemap walker now checks each reference first.
  • Tooling: MCP validate, inspect and get_context now check references the same way, and their text matches the CLI. They now fail where only activation did before.
  • Server responses are unchanged.

#809: spa-shell recipe (owner decision: a recipe, no new YAML)

  • YAML owns /, /assets/*, /api/status and a root /* static mount. A minimal plugin serves the shell only for extensionless GET and HEAD on /*, and returns a JSON 404 for unmatched /api/*.
  • It never rewrites a response and refuses a shell outside the project.
  • The host code lives in the README, because a host file inside the project is refused. The tests extract it from the README.
  • The docs that said there is no SPA fallback now link the recipe.

#810: headless-auth-profile recipe

  • Audit result: auth's existing JSON API (@1) plus an owner-scoped store collection already cover register, login, profile read and update, logout and cross-user denial. No new API and no project code were needed.
  • Recipe: three routes. Every status code is listed in its README and asserted in packages/auth/test/headless-auth-profile-recipe.test.ts, run against the real auth and store extensions.
  • Build infrastructure:
    • auth gains a store devDependency.
    • scripts/workspaces.ts also orders packages by sibling devDependencies.
    • In ci-plan, auth and admin now also depend on store.

#805: forms opt-in inline success (owner decision)

  • flows.<name>.success: {mode: redirect|inline, status?: 200|201}. The default is still the 303 redirect.
  • Inline mode renders the existing escaped confirmation with no-store and no handoff cookie, so a fresh GET shows an empty form.
  • Admission, CSRF and binding-cookie checks, the body limit, abuse checks, the 422 response, onSubmit and notify all run unchanged first.
  • form-records supports both modes. An inline create at 201 adds Location.
  • The export contract stays at v1; the additions are success, confirmationPage({status}), FormSuccess and FormSuccessSpec.

#807: urlcode bootstrap, a local agent bootstrap (owner decision: local only; #806 deferred)

  • Command: urlcode bootstrap [DIR] [--capabilities …] [--target T] [--origin URL] [--create] [--json]. It is also available through MCP get_context {bootstrap: true}, which is read-only.
  • Output: site and project roots, entry file and host file, and a runtime check comparing the running version and schema digest against what the site pins and has installed (matched, mismatched or unverified). It also includes exact quoted commands, the site-to-project path mapping, and a packet for explicitly named capabilities (at most 8): schema fragments, constraints, target support and the smallest example.
  • Creating a site: it creates only with --create and an explicit directory, which hands off to init. It refuses app/app and locations inside a project, and repeated runs change nothing.
  • Reporting: unknown capabilities are reported rather than guessed.
  • Skill: the authoring skill now runs it before the first edit.

Follow-ups filed

Verification

  • npm run verify exits 0 on this exact tree. Core: 1024 pass. Every workspace suite has 0 failures; forms has 57 and auth 266, both including the new tests. test:addons passes 4/4.

  • npm run test:package exits 0: "39 packaged example commands ran from consumer copies; Packed installation and starter/cookbook checks passed".

  • Core package budget, raised deliberately in scripts/package-audit.ts from the merged measurement:

    Old budget New budget Measured
    Packed 788 KiB 812 KiB 827444 bytes
    Unpacked 3140 KiB 3220 KiB 3290761 bytes
    Entries 480 495 485
  • New tests:

    • test/asset-reference-errors.test.ts
    • test/spa-shell-recipe.test.ts
    • test/bootstrap.test.ts
    • packages/auth/test/headless-auth-profile-recipe.test.ts
    • Additions to the forms and form-records tests.

Limitations

Closes #805
Closes #807
Closes #808
Closes #809
Closes #810

🤖 Generated with Claude Code

jimhoyd and others added 10 commits September 27, 2026 02:16
…status (#805)

A flow may declare `success: {mode: inline, status: 200|201}` to answer a
valid POST with its confirmation (title, message, opted-in `show` values,
escaped, no-store) in the response body. Redirect-after-POST (303 to
<mount>/confirmation) stays the default. `status` defaults to 200 inline and
is refused with `mode: redirect`; any other mode or status is refused at
activation. Same-origin, CSRF token/binding cookie, abuse admission, field
validation (422), onSubmit and notify run first, unchanged. Inline mode seals
no handoff cookie, so a later GET shows an empty form; a filled honeypot gets
the fixed inline confirmation.

`success` is part of formFlowBodySchema. FormsFlow exposes `success` and
confirmationPage accepts `status: 200|201` (export contract stays version 1,
additive). form-records honours it: an inline create answers the saved
record's confirmation (201 adds Location: <mount>/<id>), an inline edit 200.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…issing assets (#808)

A missing page/download/static reference used to surface as the bare system
message "Required file or directory not found". Each reference is now resolved
by one check in assets.ts that fails naming the route, the YAML field and its
file:line:column (recorded by the config worker), the reference as written and
that references resolve relative to the selected project directory. When the
reference starts with the project directory's own name (app/assets for a
project at app/), it suggests the shorter reference, only when that exists
inside the project. Function and middleware sources get the same hint.

Absolute, `..` and symlinked references are refused before any lookup outside
the project and are never echoed (#610). The sitemap walker now checks a
reference before reading it: before this, `site.sitemap` with
`static.directory: ../x` read outside the project and answered differently
depending on whether the target existed.

validate/inspect (MCP validate) and get_context check the references after
the routes compile, with the same message, without reading asset bytes.
Activation keeps target compatibility ahead of asset checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
URLCode has no native SPA fallback. Per the owner decision on #809, publish
the proven composition as a first-party recipe instead of new YAML: native
page (/), static assets (/assets/*), a respond JSON endpoint (/api/status)
and a root /* static mount, plus a small operator plugin in the README's
host file (composeHost(import.meta.url, [], {plugins: [spaShell()]})).

The plugin acts only on the catch-all route via onRequest: extensionless
GET/HEAD paths get the shell, unmatched /api paths get a JSON 404 for any
method, and other methods, excluded prefixes and file-like paths fall
through to the mount (405, the file or 404). It never rewrites a response,
and a protected catch-all is authorized before it runs. The shell must
resolve inside the project.

Tests drive the README host over real HTTP (unseen deep paths, query
strings, HEAD, 405s, assets/API exclusions, dot paths, a protected
catch-all, containment), run the fixtures through the CLI with
--host-file, and the package smoke runs them from the packed install.
Docs that say "no SPA fallback" now link the recipe; the recipe index,
AI authoring table, llms files and authoring skill list it. Package
budget raised for the added recipe files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add recipes/headless-auth-profile: register, sign in, read and update the
auth-owned profile, keep one application profile per user and sign out,
composed from existing public contracts only. Auth's JSON endpoints serve
/account/*; an ownership: owner store collection behind auth: true holds the
application's profile fields, so another user's record is a 404. No function,
no secret in the project; the README states every request and response shape,
status code, header and owner boundary.

- packages/auth/test/headless-auth-profile-recipe.test.ts composes the real
  audit, mail, ui, auth and store definitions through composeHost and drives
  register, login, both profile reads and updates, CSRF and origin refusals,
  cross-user 404s, logout and the revoked session's 401s, plus the recipe's
  signed-out fixtures. auth gains a store devDependency for it.
- scripts/workspaces.ts orders an add-on after the sibling add-ons its
  package.json lists as devDependencies, so a clean serial verify builds store
  before auth's tests import it; ci-plan's per-package deps match.
- Catalog, planner terms, RECIPES.md, AI-AUTHORING.md, llms.txt, the auth
  llms.txt and JSON API page, and the authoring skill link the recipe as the
  bounded entry point; the core package budget grows by the recipe's bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ability catalog (#807)

`urlcode bootstrap [DIR] [--capabilities a,b] [--target T] [--origin URL]
[--create] [--json]`, and MCP `get_context` with `bootstrap: true`, return in
one local call: whether DIR holds a site, its root, route project, entry and
host file; the running runtime's version and schema digest against the site's
pinned and installed runtime (a mismatch withholds the packet); exact
start/dev/validate/test/context commands to run from the quoted site root;
the site/project file-reference mapping with a concrete example and the site
directories YAML cannot reach (a supplied frontend); and, only for named
capabilities, a bounded packet (at most 8) of this runtime's schema
fragments, constraints, target support and the shortest bundled example.
Unknown names, add-on names and target refusals are reported, not guessed.
Nothing is written unless --create names a destination, which delegates to
init once; it is refused at an app/ directory and inside a project, so no
app/app. No network, hosted service or MCP is needed.

The authoring skills, llms.txt and AI-AUTHORING lead with it; TOOLING.md
documents it. The core packed/unpacked budgets rise for the new module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured on the merged branch (Node 26): 827444 packed, 3290761 unpacked,
485 entries. Budgets: 812 KiB packed, 3220 KiB unpacked, 495 entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xists

Windows CI (verify windows-latest, 24, 1) failed two bootstrap tests with a
null exit status: the emitted commands were spawned via /bin/sh, which
Windows runners do not have. Skip only that shell step on win32, as
test/context-commands.test.ts already does; the site/project mapping check
runs there through the CLI with the same arguments, so the rest of both
tests still runs on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd merged commit 2357b90 into main Sep 27, 2026
30 checks passed
@jimhoyd
jimhoyd deleted the claude/issues-805-810 branch September 27, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment