Skip to content

ci: add tsc --noEmit step to npm test #7

@samfoy

Description

@samfoy

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

  1. Add a minimal tsconfig.json covering src/ with noEmit: true, strict: true, moduleResolution: bundler.
  2. Add peer deps as dev deps so pnpm install resolves types for the check.
  3. Add "typecheck": "tsc --noEmit" to package.json scripts.
  4. Wire typecheck into npm test (runs before vitest).
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions