Surfaced during review of #6: a missing import in subagent.ts was nearly shipped and caught only because reviewers manually ran tsc. The current npm test runs vitest but no type-check, so tests that import from peer-dep-free modules (e.g. subagent-diagnostics.ts) don't exercise the main extension's type graph.
Goal
Add a type-check step that fails the build on type errors in src/, without requiring pi peer deps at runtime install time.
Why it's not trivial
The project intentionally keeps @mariozechner/pi-coding-agent, @mariozechner/pi-ai, and @sinclair/typebox as peer deps so consumers resolve a single copy. tsc still needs to find those types during the check, so they need to be present as dev deps (or the tsconfig needs to reference them via paths / a types-only package).
Proposed approach
- Add a minimal
tsconfig.json covering src/ with noEmit: true, strict: true, moduleResolution: bundler.
- Add peer deps as dev deps so
pnpm install resolves types for the check.
- Add
"typecheck": "tsc --noEmit" to package.json scripts.
- Wire
typecheck into npm test (runs before vitest).
- Verify with a deliberately broken import (revert after) that the check actually fails.
Non-goals
- Emitting
.d.ts or compiled JS — the extension ships .ts direct via pi's tsx loader.
- Adopting stricter lint rules in the same PR — keep it to the type-check introduction.
Surfaced during review of #6: a missing import in
subagent.tswas nearly shipped and caught only because reviewers manually rantsc. The currentnpm testruns vitest but no type-check, so tests that import from peer-dep-free modules (e.g.subagent-diagnostics.ts) don't exercise the main extension's type graph.Goal
Add a type-check step that fails the build on type errors in
src/, without requiring pi peer deps at runtime install time.Why it's not trivial
The project intentionally keeps
@mariozechner/pi-coding-agent,@mariozechner/pi-ai, and@sinclair/typeboxas peer deps so consumers resolve a single copy.tscstill needs to find those types during the check, so they need to be present as dev deps (or the tsconfig needs to reference them viapaths/ a types-only package).Proposed approach
tsconfig.jsoncoveringsrc/withnoEmit: true,strict: true,moduleResolution: bundler.pnpm installresolves types for the check."typecheck": "tsc --noEmit"topackage.jsonscripts.typecheckintonpm test(runs before vitest).Non-goals
.d.tsor compiled JS — the extension ships.tsdirect via pi's tsx loader.