Skip to content

fix: refactor config.ts env var loading to table-driven pattern#219

Merged
himerus merged 1 commit intodevfrom
feature/fix-refactor-configts-env-var-loading
Mar 26, 2026
Merged

fix: refactor config.ts env var loading to table-driven pattern#219
himerus merged 1 commit intodevfrom
feature/fix-refactor-configts-env-var-loading

Conversation

@himerus
Copy link
Copy Markdown
Contributor

@himerus himerus commented Mar 26, 2026

Summary

packages/core/src/config.ts lines 95-124 contain 10 nearly identical if-blocks for loading env vars:

if (process.env['MCP_WC_CEM_PATH'] !== undefined) { config.cemPath = process.env['MCP_WC_CEM_PATH']; }
if (process.env['MCP_WC_PROJECT_ROOT'] !== undefined) { config.projectRoot = process.env['MCP_WC_PROJECT_ROOT']; }
// ... 8 more identical patterns

This is duplicate code that's error-prone (typos in env var names would be silent). Should be refactored to a lookup table mappi...


Created automatically by Automaker

- Replace 10 nearly-identical if-blocks with ENV_MAP_STRING and
  ENV_MAP_NULLABLE lookup tables iterated in a loop
- Remove deprecated mcpwc.config.json fallback and its warning message
- readConfigFile() now only reads helixir.mcp.json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@himerus himerus merged commit 496dede into dev Mar 26, 2026
4 of 8 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Warning

Rate limit exceeded

@himerus has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 994a8435-c20a-4fae-b958-72a8b4d2b3f8

📥 Commits

Reviewing files that changed from the base of the PR and between 37eca94 and 2bbbfb7.

📒 Files selected for processing (1)
  • packages/core/src/config.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix-refactor-configts-env-var-loading

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant