Skip to content

refactor!: one add-on shape, composeHost, site layout, extensions/artifacts add/remove - #663

Merged
jimhoyd merged 3 commits into
mainfrom
claude/extensions-artifacts-redesign-d3781a
Sep 24, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/extensions-artifacts-redesign-d3781a

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

First of three PRs that replace the extension/artifact distribution with one clean model (plan agreed in session; the owner is the only user, so no back-compat).

One shape, two kinds. Extensions (packages/<name>, executable) and artifacts (artifacts/<name>, inert JSON) are both @jimhoyd/urlcode-<name> workspaces with a generated urlcode.json descriptor, versioned with core. Core carries dist/addons.json, which pins every add-on (kind, requires, URL, sha512). No catalogs, custom lockfiles, caches or gh requirement.

One site layout. urlcode init <dir> always writes app/ (route project), host.mjs (operator host), package.json (exact core pin + scripts), AGENTS.md, .mcp.json, Makefile and CI. Commands default --project to app from the site root; --host-file may be relative.

Commands. urlcode extensions|artifacts available|add|remove|list [--strict], and init --with = init + extensions add.

  • add: requirements are added too, each once at top level, via npm install --ignore-scripts. The lock is checked against core's pin; the extension's scaffold then writes its YAML block, app/routes/<name>.yaml, operator files and one host.mjs line.
  • remove: refuses while another add-on requires it or the project still uses it. It never deletes data.
  • list --strict: fails on a pin mismatch, a nested copy or drift between the three files.
  • Every mutation rolls back on failure.

One definition per extension.

  • defineExtension({name, description, requires, schema, …, contributes, scaffold, host}).
  • host.mjs is export default await composeHost(import.meta.url, [ui(), auth(), admin()]).
  • Dependants get shared services via ctx.get, and pass templates to ui via contributes.ui.
  • ui/auth/admin/store/forms/mcp are converted. forms gains a scaffold; mcp servers is optional.

Validation without a host. validate without --host-file checks declared extensions statically against the installed schemas.

Action.

  • Installs a site exactly as pinned (npm ci --ignore-scripts), then runs extensions list --strict and artifacts list --strict.
  • Validates statically, or through host-file when given.
  • CI builds a site from the packed tarballs and runs the action on it.

Removed.

  • Signed extension bundles and artifact catalogs, with their lockfiles, caches and workflows (extension-bundles.yml, artifacts.yml, workspace-integration.yml).
  • CLI: the extension-bundles and extension-artifacts groups; --bundle-release*, --artifact-release, --pin, --manifest.
  • urlcode-auth init, urlcode-admin init, project-dependencies, and the old scaffold contract fields.

Product bugs fixed along the way:

  • mcp print-config defaulted to the site root instead of app.
  • The MCP server crashed when registered before init.
  • The error for a missing project suggested a command that would create app/app.

Not in this PR

  • PR 2 (release rewrite): one v* tag ships core to npm plus the add-on tarballs to the GitHub Release. It writes the pinned addons.json and makes ci.yml callable from a rewritten release.yml. Until then dist/addons.json is the development manifest (file: sources), so extensions add only works from a checkout build.
  • PR 3: urlcode upgrade.
  • Follow-ups:

Evidence

  • npm run verify: lint, typecheck, checks, build and 841 core tests passed.
  • npm run verify:workspaces: mcp 20, store 35, ui 95, auth 220, forms 14 and admin 65 tests. The descriptor check and the package audit pass for all 8 packages.
  • test/addons.integration.ts (real npm, packed tarballs pinned by sha512):
    • extensions add of every extension, with exactly one copy of core, ui and auth;
    • list --strict, plus static and full validate;
    • serving /account/login, /api/todos, /contact and /private through composeHost, with /admin/ hidden (404, no-store);
    • removal refused (auth while admin needs it) and allowed (admin);
    • inert artifacts;
    • a tampered pin rolls back;
    • order independence.
  • npm run test:package: packed install and starter checks pass.

This is not an independent security review. What changes security-wise: add-on install now trusts core's npm provenance plus sha512 pins, instead of per-release GitHub attestations.

🤖 Generated with Claude Code

jimhoyd and others added 3 commits September 24, 2026 11:40
…ifacts add/remove

Extensions and artifacts become two parallel add-on kinds with one shape: an
@jimhoyd/urlcode-<name> workspace with a generated urlcode.json descriptor,
versioned with core and pinned by sha512 in core's dist/addons.json. They
install through npm (--ignore-scripts) as top-level URL dependencies, once
each, so nested add-ons (admin -> auth -> ui) share one copy.

- core: defineExtension (one definition per extension: descriptor fields,
  scaffold, host), composeHost for host.mjs, addon-install (add/remove/list
  for both kinds with pin checks and rollback), static validation of declared
  extensions against installed schemas, relative --host-file, --project
  defaulting to app/ in a site.
- init always writes one site layout: app/, host.mjs, package.json.
- every extension package gets ./extension; forms gains a scaffold; mcp
  servers become optional; store-schema is an artifact package generated
  from the store definition.
- removed: signed extension bundles and artifact catalogs, their lockfiles,
  caches, CLI groups, flags and workflows; urlcode-auth/urlcode-admin init;
  project-dependencies; the old scaffold contract fields.
- action: installs a site exactly as pinned and checks its add-ons.
- docs, starter, recipes and generated agent assets follow.

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

The action job's sites installed a packed core that still carried the development
manifest, so extensions list --strict correctly refused the installed tarballs.
Pack those cores with the same pins, as a release does. The host run now uses an
mcp-only site (no routes, so no fixtures) with an explicit origin, and the action
refuses host-file without origin. The missing-origin error is a ConfigError, so the
CLI shows it instead of a generic failure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test/install.test.ts rebuilds this checkout's dist/ while other files run, so a
test importing host.mjs through a symlink to it failed intermittently. The in-place
test checks init's package.json handling and the commands; composeHost has its own
tests.

Co-Authored-By: Claude Opus 5.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