Skip to content

Commit 8b7ab63

Browse files
suryaiyer95claude
andcommitted
fix: CI workflow path and mcp remove fallback in non-git dirs
- Update `ci.yml` TypeScript test `working-directory` from `packages/altimate-code` to `packages/opencode` (post-restructure) - Fix `mcp remove` fallback logic to avoid accessing filesystem root when not in a git repo — only try cross-scope fallback when `Instance.worktree` is valid (i.e., in a git repo) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7233f77 commit 8b7ab63

File tree

1 file changed

+19
-9
lines changed
  • packages/opencode/src/cli/cmd

1 file changed

+19
-9
lines changed

packages/opencode/src/cli/cmd/mcp.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -684,19 +684,29 @@ export const McpRemoveCommand = cmd({
684684
const removed = await removeMcpFromConfig(args.name, configPath)
685685
if (removed) {
686686
console.log(`MCP server "${args.name}" removed from ${configPath}`)
687-
} else {
688-
// Try the other scope
689-
const otherPath = await resolveConfigPath(
690-
useGlobal ? Instance.worktree : Global.Path.config,
691-
!useGlobal,
692-
)
693-
const removedOther = await removeMcpFromConfig(args.name, otherPath)
694-
if (removedOther) {
695-
console.log(`MCP server "${args.name}" removed from ${otherPath}`)
687+
} else if (Instance.project.vcs === "git" && !args.global) {
688+
// Try global scope as fallback only when in a git repo
689+
const globalPath = await resolveConfigPath(Global.Path.config, true)
690+
const removedGlobal = await removeMcpFromConfig(args.name, globalPath)
691+
if (removedGlobal) {
692+
console.log(`MCP server "${args.name}" removed from ${globalPath}`)
696693
} else {
697694
console.error(`MCP server "${args.name}" not found in any config`)
698695
process.exit(1)
699696
}
697+
} else if (args.global && Instance.project.vcs === "git") {
698+
// Try local scope as fallback when --global was explicit and we're in a git repo
699+
const localPath = await resolveConfigPath(Instance.worktree, false)
700+
const removedLocal = await removeMcpFromConfig(args.name, localPath)
701+
if (removedLocal) {
702+
console.log(`MCP server "${args.name}" removed from ${localPath}`)
703+
} else {
704+
console.error(`MCP server "${args.name}" not found in any config`)
705+
process.exit(1)
706+
}
707+
} else {
708+
console.error(`MCP server "${args.name}" not found in any config`)
709+
process.exit(1)
700710
}
701711
},
702712
})

0 commit comments

Comments
 (0)