AGENTS.md
Guidance for coding agents working on Codex Token Build Test and Selftest in the codexTokencount project.
Project overview
This guide covers build and verification. The project uses tsx with the Node test runner for src tests, esbuild for extension bundling, TypeScript for no-emit typechecks, vsce for VSIX packaging, and a separately bundled selftest entry for parser verification against a supplied sessions directory.
Primary source files
- package.json defines test, compile, watch, check-types, package, and VS Code prepublish scripts.
- esbuild.js bundles the extension entry point and keeps vscode external.
- src/parser.test.ts covers parser and pricing invariants.
- src/selftest.ts prints aggregate usage JSON using the same UsageStore path.
Setup commands
npm install npm test 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 <sessions-dir>
Change rules
- Do not hand-edit generated out files.
- Keep vscode external in the extension bundle.
- Keep selftest separate from the shipped extension entry point.
- Use synthetic session fixtures for repeatable tests.
- Do not publish private selftest output or local session paths.
Testing
Run npm test first, then compile, check-types, package, and selftest bundling. Use a placeholder sessions directory or synthetic fixtures for any documented selftest examples.
PR checklist
- Parser tests cover new log shapes.
- Package script still creates a VSIX.
- Selftest uses the same parser and pricing code as the extension.
- npm test, npm run compile, and npm run check-types pass.