Skip to content

feat: pin scripts to aged exact versions and match the official runtime calls - #15

Merged
kpal81xd merged 1 commit into
mainfrom
feat/port-official-artifact-rules
Nov 17, 2026
Merged

kpal81xd merged 1 commit into
mainfrom
feat/port-official-artifact-rules

Conversation

@kpal81xd

Copy link
Copy Markdown
Owner

Ports two things from the official artifacts that the plugin was missing.

Script version rule. Claude is now told to pin every script URL to an exact version at least two weeks old: react@18.3.1 on jsDelivr or unpkg, react/18.3.1/… on cdnjs, cdn.tailwindcss.com/3.4.17. It never uses a bare name, a range or a tag (react, react@18, @latest). Any version Claude knew before the conversation counts as old enough. The rule is in the tool description (server/prompts.ts) and in the spatial-design skill's "Load a library" paragraph.

Runtime calls that broke for pages written to the official contract (web/runtime.js, with the spatial-capabilities types updated to match):

  • collection(x).doc() with no id now creates a random 20-character id, so a retried create makes at most one document. Before, it wrote to x/undefined.
  • assets.upload(blob, { type }) now uses type as the content type, and the result includes sizeBytes. Before, the options object was ignored, so a blob with no type was refused. Pages that call upload(file, 'name.txt') keep working.
  • user.isOwner(), canEdit() and can() now return Promises, as they do officially. A page that checks if (user.isOwner()) still sees a true result.

Smoke test

  1. Ask Claude for a page that loads a library from a CDN, such as a chart. The script URL pins an exact version, like chart.js/4.4.1/…, never a bare name or @latest.
  2. Ask Claude for a page with the db capability that adds items with db.collection('items').doc().set(...). Add two items: each gets its own random id and both persist after a reload.
  3. Ask Claude for a page with the assets capability that uploads new Blob(['a,b']) with { type: 'text/csv' }. The upload succeeds with content type text/csv and a sizeBytes of 3.
  4. On a page with the user capability, call await user.isOwner(). It resolves true.

https://claude.ai/code/session_012Q19Vb4PXCSzxLEiwnmRfn

@kpal81xd kpal81xd added the enhancement New feature or request label Nov 17, 2026
@kpal81xd kpal81xd self-assigned this Nov 17, 2026
@kpal81xd
kpal81xd merged commit aaf9d40 into main Nov 17, 2026
3 checks passed
@kpal81xd
kpal81xd deleted the feat/port-official-artifact-rules branch November 17, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant