Parent: #2129
Blocked by: none. Wave 1; this is CLI process lifecycle, not host process execution.
Scope — exact tracked files
Production:
src/utils/process-exit.ts
Tests:
src/utils/__tests__/process-exit.test.ts
Destination and importer edits
Move to:
src/cli/process-exit.ts
src/cli/process-exit.test.ts
Update exactly these production importers:
src/bin.ts
src/cli.ts
src/cli/process-entry.ts
Keep the implementation beside the existing CLI entry/process boundary. Do not move it into host-kit/process and do not add a generic process facade.
Behavior invariants
Preserve stdout/stderr drain ordering, the bounded drain timeout, flush behavior, exit-code propagation, and the distinction between normal command completion and process-entry failure. Preserve CLI startup and signal/error behavior; do not change daemon child-process ownership or host command execution.
Focused validation
Run:
pnpm vitest run src/cli/process-exit.test.ts
- the existing CLI process-entry and CLI error tests
pnpm check:affected --run
Planted-red proof
No new structural rule is added. Temporarily remove the stdout/stderr drain await or shorten the bounded timeout in the moved test seam and observe the independent lifecycle assertion fail; restore the exact implementation before the final run.
Dependency order
Wave 1. The terminal child is blocked by this child. No other owner slice should import this module.
Shrink target
Delete the old utility module and test with no compatibility re-export. The CLI destination must be a physical move with no production LOC growth after discounting the move.
Parent: #2129
Blocked by: none. Wave 1; this is CLI process lifecycle, not host process execution.
Scope — exact tracked files
Production:
src/utils/process-exit.tsTests:
src/utils/__tests__/process-exit.test.tsDestination and importer edits
Move to:
src/cli/process-exit.tssrc/cli/process-exit.test.tsUpdate exactly these production importers:
src/bin.tssrc/cli.tssrc/cli/process-entry.tsKeep the implementation beside the existing CLI entry/process boundary. Do not move it into host-kit/process and do not add a generic process facade.
Behavior invariants
Preserve stdout/stderr drain ordering, the bounded drain timeout, flush behavior, exit-code propagation, and the distinction between normal command completion and process-entry failure. Preserve CLI startup and signal/error behavior; do not change daemon child-process ownership or host command execution.
Focused validation
Run:
pnpm vitest run src/cli/process-exit.test.tspnpm check:affected --runPlanted-red proof
No new structural rule is added. Temporarily remove the stdout/stderr drain await or shorten the bounded timeout in the moved test seam and observe the independent lifecycle assertion fail; restore the exact implementation before the final run.
Dependency order
Wave 1. The terminal child is blocked by this child. No other owner slice should import this module.
Shrink target
Delete the old utility module and test with no compatibility re-export. The CLI destination must be a physical move with no production LOC growth after discounting the move.