Skip to content

Conversation

@boneskull
Copy link
Owner

src/cli/handlers.ts: Replaced nested ternary with readable switch statement for signal exit codes
src/cli/commands/baseline.ts: Removed duplicate formatDuration and formatOpsPerSec functions, now imports from shared utils
src/cli/commands/history.ts: Removed duplicate formatBytes function, now imports from shared utils
src/errors/base.ts: Consolidated isError type guard to use the one in type-guards.ts

`src/cli/handlers.ts`: Replaced nested ternary with readable switch statement for signal exit codes
`src/cli/commands/baseline.ts`: Removed duplicate formatDuration and formatOpsPerSec functions, now imports from shared utils
`src/cli/commands/history.ts`: Removed duplicate formatBytes function, now imports from shared utils
`src/errors/base.ts`: Consolidated isError type guard to use the one in `type-guards.ts`
Copilot AI review requested due to automatic review settings January 9, 2026 22:32
@github-actions github-actions bot added the chore Build tooling, tests, configuration, overhead label Jan 9, 2026
Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates duplicate utility functions and improves code readability through refactoring.

Key Changes:

  • Consolidated the isError type guard by removing duplicate from src/errors/base.ts and using the shared implementation from src/utils/type-guards.ts
  • Replaced a nested ternary operator with a more readable switch statement for computing signal exit codes
  • Removed duplicate formatting functions (formatBytes, formatDuration, formatOpsPerSec) from command files, now importing from shared reporter-utils.ts

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/errors/base.ts Removes duplicate isError type guard, imports from shared type-guards.ts
src/cli/handlers.ts Replaces nested ternary with switch statement for signal exit codes; updates isError import
src/cli/commands/history.ts Removes duplicate formatBytes function, imports from shared reporter-utils.ts
src/cli/commands/baseline.ts Removes duplicate formatDuration and formatOpsPerSec functions, imports from shared reporter-utils.ts; updates function name to formatOpsPerSecond

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@boneskull boneskull merged commit 47efa9b into main Jan 9, 2026
19 checks passed
@boneskull boneskull deleted the refactor-simplify branch January 9, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build tooling, tests, configuration, overhead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants