mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
What changed: - Added a shared utility `getErrorMessage(error: unknown)` in `packages/cli/src/utils/errors.ts`. - Refactored `packages/cli/src/commands/daemon/start.ts` to use `getErrorMessage` and a local `exitWithError` helper instead of repeating inline error-message extraction + exit logic in each catch block. - Added `packages/cli/tests/19-errors-utils.test.ts` to lock utility behavior for Error and non-Error throw values. Reasoning: - `runStart` had repeated branching (`err instanceof Error ? err.message : String(err)`) across multiple catch sites. - Centralizing this keeps behavior stable while reducing duplication and cognitive overhead, aligned with the refactor skill guidance to simplify structure without changing user-visible behavior. Verification: - Ran `npx tsx packages/cli/tests/18-local-daemon-utils.test.ts` (pass). - Ran `npx tsx packages/cli/tests/19-errors-utils.test.ts` (pass). - Ran `npm run -w @getpaseo/cli typecheck` (pass). Notes for next agent: - Existing `scripts/codex-refactor-loop.sh` was already modified before this change and is intentionally not included. - `packages/cli/tests/03-daemon.test.ts` currently failed in this environment because Test 3 expected daemon status failure, but command exited successfully (likely environment state dependent). This refactor does not touch that path; worth deflakifying or isolating in a follow-up.