-
Notifications
You must be signed in to change notification settings - Fork 6k
fix: actually modify opencode config with mcp add
#7339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
/review |
|
|
||
| let text = "{}" | ||
| if (await file.exists()) { | ||
| text = await file.text() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style suggestion: The let text with conditional reassignment could be simplified using a ternary or IIFE. Something like:
const text = await file.exists() ? await file.text() : "{}"This is a minor suggestion - the current code is fine if you prefer the explicit check.
|
|
||
| // Resolve config paths eagerly for hints | ||
| const [projectConfigPath, globalConfigPath] = await Promise.all([ | ||
| resolveConfigPath(Instance.worktree), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style suggestion: The let configPath with conditional reassignment is a pattern the style guide discourages. Consider using a ternary or restructuring:
const configPath = project.vcs === "git"
? await (async () => {
const result = await prompts.select({...})
if (prompts.isCancel(result)) throw new UI.CancelledError()
return result
})()
: globalConfigPathHowever, given the interactive prompt flow and the need to throw on cancel, the current approach may actually be the clearest. Your call on whether to change it.
This makes so that when using the command
mcp addthe config will actually be updated (asking the user if he want's to add it globally or locally).