Skip to content

fix(cli): extensions add/remove preserve YAML formatting; list --strict accepts library-only add-ons; add-on authoring rules (#715, #718, #712) - #728

Merged
jimhoyd merged 4 commits into
mainfrom
claude/sleepy-shannon-xvazgl
Sep 25, 2026
Merged

jimhoyd merged 4 commits into
mainfrom
claude/sleepy-shannon-xvazgl

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

  • Closes [Bug]: urlcode extensions add reformats the whole app/urlcode.yaml #715: extensions add/remove no longer reformat app/urlcode.yaml. The yaml library's serializer can't keep untouched lines byte-identical, even with keepSourceTokens, lineWidth: 0 or flowCollectionPadding: false. It still rewrote spacing inside [...]/{...}, after key: and before comments.
    • Edits the text directly: new helpers (yamlInsertEntry, yamlAppendItem, yamlDelete in packages/core/src/addon-install.ts) change the file only at the source span of the extensions.<name> entry or includes item being added or removed. They handle indented blocks and one-line {...}/[...] layouts, CRLF, and files with no final newline.
    • Checks every edit: checkedYamlEdit re-parses the result and compares its data with the previous in-memory edit. If that fails, or the layout isn't one the helpers support, the command refuses and prints the block to add by hand. The normal rollback runs, and the file is never reformatted.
    • Tests: whole-file byte comparisons after a blank add, an --example add, a second add and both removes. The round trip gives back the original hand-written file exactly.
  • Closes [Request]: extensions list --strict should accept an add-on installed only as a library #718: extensions list --strict accepts library-only add-ons. An installed add-on that is neither declared in app/urlcode.yaml nor imported by host.mjs as an extension is reported as mode: "library".
    • What is skipped: declaration drift is not reported for library installs.
    • What is still checked strictly: the package.json URL, lock integrity and resolved URL, nested copies and requires.
    • Wired extensions keep their checks: drift is still reported when only one of YAML / host.mjs names the add-on.
  • Closes Document generic extension and artifact authoring rules #712: generic add-on authoring rules.
    • Rules: a new section in docs/EXTENSIONS.md with five "must" rules. It covers owning only your declared surface, explicit cross-extension dependencies, prerequisites-only scaffolds with opt-in example(), inert artifacts, and a second-provider fixture for every seam.
    • Checklist: the section ends with an author checklist.
    • Linked from: CONTRIBUTING.md, docs/FRAMEWORK.md, llms.txt, and the create-extension README/AGENTS templates and next steps.
  • Package budget:

Verification

Run on Node v26.10.0:

Compatibility and security

  • [Bug]: urlcode extensions add reformats the whole app/urlcode.yaml #715: a YAML layout the text editor can't handle safely (for example an empty extensions: value, or includes: x) is now refused with the block to add by hand, instead of the file being rewritten. Comment lines just above a removed entry are kept.

  • [Request]: extensions list --strict should accept an add-on installed only as a library #718: extensions list --json gains mode (extension | library | artifact). --strict now passes for library-only installs whose pins are correct.

  • No change to runtime behaviour.

  • Changes match the documented portable contract; docs/examples are updated where needed.

  • Relevant tests and package checks pass, or limitations are explained above.

  • No credentials, customer data or private project material are included.

  • Runtime/starter changes remain aligned where applicable.

🤖 Generated with Claude Code

https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP


Generated by Claude Code

Re-serialising the parsed app/urlcode.yaml respaced flow collections,
folded long scalars and normalised spacing across the whole file, and no
yaml toString option preserves source spacing. add and remove now splice
text only at the source range of the extensions.<name> entry and the
includes item they change (block or flow, LF or CRLF), re-parse after each
edit, and refuse with the block to write by hand, rather than reformat,
when the result does not parse to the same data as the document edit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
An installed extension package that app/urlcode.yaml does not declare and
host.mjs does not import (in any form) is now a library install: listed
with mode "library" ("extension" when wired, "artifact" for artifacts)
and shown as (library) in text output. Its package.json URL, lock
integrity/resolved URL and nested copies are still checked strictly, but
the missing declaration and import are no longer drift. Drift is reported
only when one of urlcode.yaml or host.mjs names it and the other does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
… authoring-rules batch (#711, #715, #712)

Unpacked 2650 -> 2700 KiB (content reached about 2653 KiB) and packed
650 -> 660 KiB (about 646 KiB, inside npm gzip variance of the old
budget); rationale recorded next to the budget as for earlier raises.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
@jimhoyd
jimhoyd merged commit b75b90d into main Sep 25, 2026
23 checks passed
@jimhoyd
jimhoyd deleted the claude/sleepy-shannon-xvazgl branch September 25, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants