AGENTS.md
Guidance for coding agents working on Claude Usage Build Package and Selftest in the claude-usage-cost project.
Project overview
This guide covers build and verification entry points. The extension bundles src/extension.ts with esbuild, leaves vscode external for the host, typechecks with TypeScript, packages a VSIX through vsce, and can bundle src/selftest.ts for command-line parser verification.
Primary source files
- package.json defines compile, watch, check-types, package, and vscode prepublish scripts.
- esbuild.js bundles the extension entry point to out/extension.js.
- src/selftest.ts bundles separately for standalone parser and pricing checks.
- README.md documents install and validation commands.
Setup commands
npm install npm run compile npm run check-types npm run package npx esbuild src/selftest.ts --bundle --platform=node --format=cjs --outfile=out/selftest.js node out/selftest.js <transcript-dir>
Change rules
- Keep vscode external in the extension bundle.
- Use production minification only for the package path.
- Keep sourcemaps available for non-production compile.
- Keep selftest out of the shipped extension entry point.
- Do not publish private transcript paths or selftest output in archive items.
Testing
Run compile, check-types, package, and selftest bundling. Use a synthetic transcript directory for repeatable parser verification when possible.
PR checklist
- out/extension.js is generated by esbuild, not hand-edited.
- VSIX packaging succeeds from package.json scripts.
- selftest uses the same UsageStore and pricing engine as the extension.
- npm run check-types and npm run compile pass.