Package Extension
Produces ai-engineer-coach-<version>.vsix at the repo root, suitable for code --install-extension.
Prerequisites
- Node.js (matches
engines.vscodeof^1.120.0frompackage.json; any recent LTS works). npm cito install dependencies — do not usenpm installfor a packaging build, since the lockfile is the source of truth.vsceis invoked throughnpx; no global install needed.
Steps
bash
npm ci
npm run packagenpm run package runs scripts/package-readme-swap.mjs, which:
- Renames the GitHub-facing
README.mdtoREADME.github.md. - Copies
README.extension.mdintoREADME.md(this is the README the Marketplace shows). - Runs
vsce package --allow-missing-repository --no-dependencies, which itself triggers thevscode:prepublishscript →npm run build→node esbuild.mjsto bundle intodist/extension.js. - Restores the original
README.mdregardless of build success.
The --no-dependencies flag is required because runtime dependencies are bundled into dist/extension.js by esbuild; node_modules/ is excluded via .vscodeignore.
Output
ai-engineer-coach-<version>.vsixat the repo root.dist/extension.js(the bundled entry point).
Install locally to smoke-test:
bash
code --install-extension ai-engineer-coach-*.vsixThen AI Engineer Coach: Open Dashboard from the command palette.
Size budgets
scripts/check-bundle-size.mjs enforces:
dist/extension.js≤ 2 MB- Any
*.vsixat the repo root ≤ 5 MB
Run it after packaging:
bash
npm run check-sizeTroubleshooting
README.github.mdleft behind — the swap script aborted before itsfinallycould rename the file back. Manuallymv README.github.md README.mdbefore re-running.vsce: command not found—npx vsceshould resolve throughnode_modules/.bin/; runnpm ciif it doesn't, sincevsceis a transitive dev dependency.Missing publisher name— thepublisherfield inpackage.jsonis required; do not remove it when bumping the version.- Bundle over budget — usually a new dependency that wasn't tree-shaken. Check
npm run analyze:data-inventoryand the esbuild output, then either drop the dep or split it into a dynamic import. - Spellcheck or lint fails first —
npm run check(typecheck + lint + spellcheck + knip + test) is what CI runs; fix those before packaging if the goal is a release.
Versioning
Bump version in package.json, add a CHANGELOG.md entry, then commit before packaging so the .vsix filename matches the released tag. Do not amend the commit after building — it's fine to ship a .vsix whose embedded git SHA differs from the tag.
Anti-patterns
- Don't run
vsce packagedirectly — you'll shipREADME.md(the GitHub one with screenshots and badges) instead ofREADME.extension.md. - Don't commit the
.vsix; it's listed in.gitignorestyle via convention. Attach it to a GitHub Release instead. - Don't disable
--no-dependencies"to be safe" — it will bloat the package past the 5 MB budget and double-ship code that's already bundled.