CLI: manifest command; defineSettings({ contributed: false }) for sections an extension only reads - #52
Merged
Merged
Conversation
`vscode-ext-kit manifest <entry>` compares the plan an extension compiles with its package.json — the comparison `assertManifestMatches` makes in a test — and reports every disagreement, as text or JSON, exiting 1 when there is one. `--apply` adds what the manifest is missing and the source can supply: commands and settings, complete in everything mechanical, with placeholder titles and descriptions a person has to replace. What a person has to decide is reported and left alone: a view needs a container the declaration does not name, a drifted default has two candidates, an entry only the manifest has may be there on purpose. Running it against a real extension found a gap in the declarations: `editor.tabSize` belongs to VS Code, and an extension that declares it to read it through the same typed accessor was indistinguishable from one that owns it — so the check asked package.json for it. `defineSettings` now takes `contributed: false` for a section the extension only reads. `describePlan` carries the answer, and `diffManifest`, `assertManifestMatches` and the command line leave such a section out of the comparison. `verify:package` runs the new command from the installed tarball, which is the first place the package's `./testing` entry is resolved through a real install rather than this repository's layout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Checking that the file exists and then reading it leaves a window in which it can change; CodeQL calls it js/file-system-race. The read is the only check that means anything, so a missing file is now recognised from the read's own ENOENT. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vscode-ext-kit manifest <entry>brings the manifest check to the command line. It compares the plan an extension compiles at import time with itspackage.json— the same comparisonassertManifestMatchesmakes in a test — and reports every disagreement at once, as text or JSON, exiting 1 when there is one.--applyadds what the manifest is missing and the source can supply: commands and settings, complete in everything mechanical (id, type, default, enum, scope) and with placeholder titles and descriptions markedTODO, so generated text cannot quietly become user-facing documentation. What a person has to decide is reported and left alone: a view needs a container the declaration does not name, a drifted default has two candidates, and an entry only the manifest has may be there on purpose. The file is written back in its own indentation.A gap the command found:
defineSettings({ contributed: false })Running the command against a real extension turned up one disagreement that was not a mistake in the manifest. The extension declares
editor.tabSize— VS Code's setting — so it can read it through the same typed accessor as its own settings. Nothing in the declaration said the section was not the extension's to contribute, so the check askedpackage.jsonfor it, and--applywould have added it.defineSettingsnow takescontributed: falsefor a section the extension only reads.describePlancarries the answer (SettingsSectionDescription.contributed), anddiffManifest,assertManifestMatchesand the command line leave such a section out of the comparison. The default istrue, so existing declarations mean what they always did.This is a small addition to the public API rather than a CLI-only workaround, because whether a section is the extension's is a fact only the declaration knows.
What changed
bin/vscode-ext-kit.mjs: themanifestsubcommand (--manifest,--format text|json,--apply);--formatis now validated per command; the usage text covers both commands.defineSettings:contributed?: boolean(defaulttrue), carried on the definition and in the plan.describePlan:SettingsSectionDescription.contributed.diffManifest/assertManifestMatches: skip settings groups declared withcontributed: false.verify:package: runsmanifestfrom the installed tarball, the first check that resolves the package's./testingentry through a real install.editorsection declared as read-only) and its plan section, CHANGELOG.Verification
npm run quality: 1080 tests, TypeDoc clean.npm run verify:package: both CLI commands work from the installed package.editor.tabSizecase; withcontributed: falseon that declaration and a rebuild,manifest ok: 47 command(s), 10 setting(s), 3 view(s) agree. The extension's own typecheck, 236 unit and 35 integration tests pass against the tarball.🤖 Generated with Claude Code