This file documents automation, scripts, CI checks, and packaging conventions used in this repository.
- Purpose: keep automation behavior and developer conventions in one place.
- Scope: dependency checks, test execution, packaging/release commands, and CI expectations.
- Canonical runner:
scripts/run-depcheck.cjs - Command:
npm run deps:check - Behavior: runs
depcheckprogrammatically, writes.depcheck.json, filters references found in repository files/scripts, and exits non-zero when unused packages remain. - Rationale: avoids
npxplatform inconsistencies and keeps local/CI behavior aligned.
- Unit test titles must start with
should(enforced by ESLint). - Shared test helpers live in
src/test/testTypes.ts. - Test runner script:
scripts/run-tests.cjs. - Test compilation script:
scripts/run-compile-tests.cjs; it removes only staledist/srcanddist/testcompiler outputs before invoking TypeScript so deleted sources cannot affect tests or coverage. - Test discovery is glob-based in
dist/test/**anddist/src/test/**to support platform/compiler output differences. - Test commands:
npm test- compile tests, compile extension, lint, then run testsnpm run test:unit- compile tests, compile extension, then run tests (no lint)npm run test:vscode- compile tests and the current extension bundle, then run the VS Code extension-host contract fromdist/src/test/runTest.jsnpm run coverage:verify- run the complete test suite with strict per-file coveragenpm run memory:check- run bounded heap-retention and async-resource checks
All unit tests must follow the FAST principle:
- Fast: avoid network access, subprocesses, real timers, and unnecessary compiler or VS Code startup. Keep stress and heap diagnostics in dedicated scripts rather than the unit suite.
- Autonomous: isolate state per test; do not depend on execution order, prior tests, external services, user configuration, or machine-specific paths.
- Self-validating: use deterministic assertions and fail automatically without inspecting logs, generated reports, or snapshots by hand.
- Timely: add or update tests with the behavior they specify, including regression tests for discovered edge cases.
npm run coverage:verifyis the canonical coverage gate.- Every included executable production file must exceed 95% statements, branches, functions, and
lines. Thresholds are configured as 95.01% with c8's per-file enforcement and
all: true, so never-loaded runtime modules fail the gate. Exclusions are limited to tests, barrels, declarations, and compiler-emitted stubs for type-only modules; do not weaken thresholds or exclude executable production files to make the gate pass. npm run memory:checkis the bounded, offline heap-retention check. It warms up runtime caches, forces garbage collection between samples, verifies bounded caches release entries, and rejects retained growth or leaked asynchronous resources.- Memory stress checks are not unit tests and must remain deterministic and reasonably short.
- The VS Code extension-host test is intentionally separate from the FAST unit suite. It must
activate
coderrob.barrel-roll, verify contributed command registration, execute barrel generation through VS Code, and validate the generated file. Do not silently skip this test based on CI, TTY, or operating-system detection; provide the required display host on headless Linux.
- Validate boundary assumptions before destructive file operations, compiler invocation, resource accounting, and concurrency setup. Fail with an error that identifies the violated invariant.
- Concurrency helpers must bound both active operations and pending worker promises. Recursive traversal must preserve one effective file-system concurrency ceiling across sibling directories.
- Name functions and state after observable behavior (
collectFileEntries,longLivedParser) and document concrete inputs, outputs, and failure conditions; placeholder contract text is not acceptable. - Use
ReadonlyMapandReadonlySetfor read-only inputs. When state must change, return a new collection or make the mutation boundary explicit rather than disguising mutable state as read-only. - Release temporary parser/compiler resources in
finallyblocks and keep regression tests focused on public behavior, including ignored, empty, malformed, and failure inputs.
- Bundle compile:
npm run package - VSIX package:
npm run ext:package - Install packaged VSIX:
npm run ext:install - Quick reinstall:
npm run ext:reinstall
.vscodeignore uses an allowlist strategy. Intended packaged files are:
package.jsonLICENSEREADME.mddist/extension.jspublic/img/barrel-roll-icon.png
Verify with npx @vscode/vsce ls before publishing.
vsce may include generated companion files in some builds (for example, source maps and webpack license sidecars). Always validate the actual file list from vsce ls before release.
CI runs dependency checks, architectural dependency validation, TypeScript-aware circular/orphan
analysis, duplication checks, per-file coverage, memory-retention checks, and tests. The canonical aggregate quality command is
npm run quality; npm run lint:deps invokes dependency-cruiser directly.
See:
.github/workflows/ci.yml.github/workflows/release.yml
npm install
npm run deps:check
npm run lint
npm run coverage:verify
npm run memory:checkWhen changing automation scripts, update this document and relevant user-facing docs (README.md, CONTRIBUTING.md) in the same PR.
