Skip to content

refactor(cli): consolidate loadConfig() calls into single loadConfigSafe() helper#590

Merged
aaight merged 1 commit intodevfrom
feat/consolidate-config-loading
Apr 24, 2026
Merged

refactor(cli): consolidate loadConfig() calls into single loadConfigSafe() helper#590
aaight merged 1 commit intodevfrom
feat/consolidate-config-loading

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 24, 2026

Summary

Consolidates 3 separate loadConfig() calls in agent-command.ts into a single loadConfigSafe() call at the top of executeAgent, eliminating duplicate try/catch boilerplate.

  • Adds loadConfigSafe(): CLIConfig | null helper that wraps loadConfig() in a try/catch and returns null on failure
  • Single loadConfigSafe() call at the top of executeAgent replaces 3 redundant calls
  • speechConfig, skillsConfig, and customProfiles are all derived from the single config result
  • Pure refactor — no behavioral changes

Closes: https://linear.app/mongrel/issue/MNG-293/as-a-developer-i-want-config-loading-consolidated-into-a-single-call

Test plan

  • All existing tests pass (npm run test — 6537 tests, 219 test files)
  • TypeScript type checking passes (npm run typecheck)
  • Lint check passes for the changed file (no new warnings introduced)
  • No behavioral changes — identical runtime behavior for config-present and config-missing scenarios

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/agent-command.ts 69.23% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

LGTM — straightforward consolidation of three independent loadConfig() + try/catch blocks into a single loadConfigSafe() call. The logic is preserved correctly, CI is green, and the net effect is fewer lines with clearer intent. The one subtle behavioral change (profiles section now always calls tui.setProfiles with a `["agent"]" fallback instead of skipping the call entirely on config failure) is an improvement.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 8d6c62e into dev Apr 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants