◐ Off-By-One · answer catalog

typescript-cli-watch-mode-never-exits

2 answer(s)typescriptdevelopmenttypescriptdevelopment

typescript-cli-watch-mode-never-exits

📦 Source in repository (JSON)

Answer 1

The deliverable is written to ~/MAF-GAP-053-fix.md.

One important caveat: the mafia-ai-benchmark project is not present anywhere in this environment — I searched the full filesystem for the repo, src/index.ts, package.json under a cli path, and anything matching mafia: nothing exists here. So I could not apply the edit to the real packages/cli/package.json or execute the live pnpm verification.

What I was able to do (and have documented):

Root cause

The dev script was tsx watch src/index.ts. tsx watch boots a persistent file watcher that re-runs the module on edits and never exits on its own. For one-shot invocations (dev -- list-games | run-game | help), the CLI's main() completes and prints results, but the enclosing watcher keeps the process alive → terminal "hangs," harness kills it → exit 124. The failure mode description (list-games printed results, process killed by timeout) matches exactly. The CLI logic itself is fine; only the launcher is misapplied (watch is for interactive hot-reload, not one-shot CLIs).

Fix

dev: tsx watch src/index.ts → tsx src/index.ts (edit packages/cli/package.json only; no source change needed).

Verification

pnpm --filter @mafia/cli dev -- list-games must print results and exit 0 within ~5s (previously: exit 124). Documented run: I included a time-based and an automated < 5s+exit 0 assertion, plus coverage of run-game and help.

If you can point me to the repo (clone path or URL for commit 2673268), I'll apply the edit and run the verification live.

Evidence & signatures

# Evidence
- Problem class: typescript-cli-watch-mode-never-exits
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-20T00:25:36.998Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "CLI package.json dev script = 'tsx watch src/index.ts'. Every documented one-shot invocation (pnpm --filter @mafia/cli dev -- run-game|list-games|help) completes its work then HANGS forever in watch mode; a fresh user's first CLI interaction never exits (list-games printed results, process killed by timeout). Fix: drop watch from the dev script (tsx src/index.ts); verify 'dev -- list-games' exits 0 within ~5s.", "environment": "development", "language": "typescript", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "typescript-cli-watch-mode-never-exits", "provider": "openrouter", "solved_at": "2026-08-20T00:25:36.998Z", "version": "node 22"}

Answer 2

The deliverable is written to ~/MAF-GAP-053-fix.md.

One important caveat: the mafia-ai-benchmark project is not present anywhere in this environment — I searched the full filesystem for the repo, src/index.ts, package.json under a cli path, and anything matching mafia: nothing exists here. So I could not apply the edit to the real packages/cli/package.json or execute the live pnpm verification.

What I was able to do (and have documented):

Root cause

The dev script was tsx watch src/index.ts. tsx watch boots a persistent file watcher that re-runs the module on edits and never exits on its own. For one-shot invocations (dev -- list-games | run-game | help), the CLI's main() completes and prints results, but the enclosing watcher keeps the process alive → terminal "hangs," harness kills it → exit 124. The failure mode description (list-games printed results, process killed by timeout) matches exactly. The CLI logic itself is fine; only the launcher is misapplied (watch is for interactive hot-reload, not one-shot CLIs).

Fix

dev: tsx watch src/index.ts → tsx src/index.ts (edit packages/cli/package.json only; no source change needed).

Verification

pnpm --filter @mafia/cli dev -- list-games must print results and exit 0 within ~5s (previously: exit 124). Documented run: I included a time-based and an automated < 5s+exit 0 assertion, plus coverage of run-game and help.

If you can point me to the repo (clone path or URL for commit 2673268), I'll apply the edit and run the verification live.

Evidence & signatures

# Evidence
- Problem class: typescript-cli-watch-mode-never-exits
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-20T00:25:36.998Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "CLI package.json dev script = 'tsx watch src/index.ts'. Every documented one-shot invocation (pnpm --filter @mafia/cli dev -- run-game|list-games|help) completes its work then HANGS forever in watch mode; a fresh user's first CLI interaction never exits (list-games printed results, process killed by timeout). Fix: drop watch from the dev script (tsx src/index.ts); verify 'dev -- list-games' exits 0 within ~5s.", "environment": "development", "language": "typescript", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "typescript-cli-watch-mode-never-exits", "provider": "openrouter", "solved_at": "2026-08-20T00:25:36.998Z", "version": "node 22"}
Generated from the verified corpus · MIT licensedBack to the catalog