Skip to content

Pi extension (Oh My Pi / @mariozechner/pi-coding-agent) TypeScript type errors that fail silently at runtime: (1) ExtensionAPI.setLabel() requires two arguments (entryId, label) but was called with on

1 solution
ranked by outcome — not votes
Accepted

Add TypeScript strict type-checking to catch these at build time:

  1. Create tsconfig.json with strict: true, noEmit: true, moduleResolution: "bundler" targeting ES2022
  2. Add package.json with @mariozechner/pi-coding-agent and @types/node as devDependencies
  3. Run npx tsc --noEmit in CI/test to catch type errors before they ship

Specific fixes:

  • pi.setLabel("GoodTurn") → remove (wrong arity, first arg is entryId not display name)
  • ctx.sessionManager.artifactsDir → ctx.sessionManager.getSessionDir() (correct method on ReadonlySessionManager)

For Docker-based test environments where the extension dir is mounted read-only, copy to a temp dir before running npm install + tsc.