Skip to content

Stage shadcn registry items and Agent Skills as data; opt-in materialization (#844) - #878

Merged
jimhoyd merged 4 commits into
mainfrom
claude/stage-source-assets
Sep 29, 2026
Merged

jimhoyd merged 4 commits into
mainfrom
claude/stage-source-assets

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Delivers #844 operation 2: "Stage source assets from an existing component/skill format as data with a complete file/dependency diff … Materialization is a separate opt-in."

Staging

  • urlcode artifacts stage <source> [--into DIR] [--json] and the read-only MCP tool stage_source_assets share one core function (packages/core/src/source-stage.ts). The MCP tool is confined to the site and never writes.
  • Sources:
    • a shadcn registry-item.json, with inline content or path files beside the item. target, ~/ and @components/ style placeholders map to shadcn's default folders.
    • an Agent Skill directory with SKILL.md, whose frontmatter is checked against the spec.
    • Offline only: nothing is fetched, installed or executed.
  • Report:
    • Format, and for each file: target, sha256, size, media type and class (code, data, docs or other). Code and unclassified files are flagged for review; SKILL.md is labelled agent instructions.
    • create or exists for each target when --into is given.
    • npm, dev and registry dependencies, compared with the site's package.json, plus the npm install --ignore-scripts commands the operator could run. Nothing is installed.
    • shadcn cssVars, css, tailwind, envVars and font, as data only.
    • Notices that all source text is untrusted, and that staging does not make code inert.
  • Diagnostics:
    • Errors: .., absolute targets, hidden target segments, symlinks, limits, URLs used as file paths, duplicate targets, invalid fields. Any error exits 1.
    • Warnings: remote dependency URLs, unresolved registry dependencies or extends, and allowed-tools, which is reported and never granted.
  • Limits: 256 files, 1 MiB per file, 8 MiB total, 8 path segments, 512-character paths.

Materialization (explicit opt-in)

--materialize --into DIR [--allow-app]:

  • Refuses on any staging error, an existing target, a symlinked or non-folder path, overlap with the source, or app/ without --allow-app.
  • Writes exactly the staged bytes with no execute bit and never overwrites.
  • All or nothing, with rollback.
  • Installs nothing. There is no MCP tool for this step.

Evidence (macOS, Node 26)

  • npm run verify and npm run test:package pass: root 1140, test:addons 6/6, test:proof 12/12.
  • test/source-stage.test.ts (10 tests):
    • fixtures for a shadcn item, a skill with prompt-injection prose and allowed-tools, and a malicious item;
    • runtime-created symlinks, oversize and over-deep paths, too many files, YAML anchors;
    • lifecycle scripts and modules never run;
    • digests match after materialization;
    • refusals, and rollback after a mid-write failure;
    • the CLI and MCP agree, and MCP is confined to the site.
  • The core size budget is raised to 887/3525 KiB (measured 904,925 / 3,606,184 bytes). dist/source-stage.js is about 40 KB.

Limits

  • Code detection uses the extension, the #! line, the execute bit or scripts/, not the file's content.
  • A project's components.json aliases are not applied, and registry dependencies are not resolved.
  • Windows path checks are untested locally.
  • This is not an independent security review.

🤖 Generated with Claude Code

#844 operation 2. `urlcode artifacts stage <source> [--into DIR] [--json]`
and the read-only MCP tool `stage_source_assets` share one core function
that reads a local shadcn registry item or Agent Skill directory offline
and reports every file it would write (target, sha256, size, media type,
code/data/docs/other, review flag, create/exists against --into), its npm
and registry dependencies (listed with the site's declared range, never
installed, resolved or fetched), shadcn style/config deltas and skill
frontmatter as data, and diagnostics for path escapes, absolute and hidden
targets, symlinks, limits, remote URLs and unknown fields. All source
content is labelled untrusted, and the report states that staging does
not make code inert.

`--materialize --into DIR` is the separate opt-in: refused on any error,
an existing target, a symlinked or non-directory segment, overlap with the
source, or the site's app/ without --allow-app; writes exactly the staged
bytes exclusively without an execute bit, all or nothing with rollback,
and installs nothing.

Docs: EXTENSIONS "Staging source assets", RIM-SOURCE-STAGE-001, TOOLING
(31 read tools), AI-AUTHORING and the authoring skill, llms-full.txt.
Core package budget raised with a measured comment.

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