Repository navigation
feat(core): [v2] restore OPENCODE_DISABLE_CLAUDE_CODE - #51888
malarahfelipe wants to merge 13 commits into
Conversation
…_CODE - testLayer now provides ConfigProvider (empty env by default) so config discovery never reads the ambient process environment. - Add an env-path test alongside the disableClaudeCode option test, with a no-flag assertion so it cannot pass trivially. - Assert via Config.compatibility(); the claude/agents entry types were removed on v2, which left the option test red after the rebase. - Document the OPENCODE_DISABLE_CLAUDE_CODE fallback on the option.
Extract the duplicated claude/agents root building into an optionalRoots helper: roots vanish when disabled, and the global directory joins only while the global scope is enabled. No behavior change; covered by the config discovery tests.
Config.withDefault only covers absent input, so a malformed OPENCODE_DISABLE_CLAUDE_CODE value leaked ConfigError into discovery and, through Config.node, broke replacement typing in @opencode/server tests. Fall back to false on any ConfigError.
|
@rekram1-node could you approve the workflows on this branch? It's up to date with This replaces #44725 (auto-closed by the PR cleanup; the author can't reopen it — |
|
@craftsamo can you help me get this cleared? |
# Conflicts: # packages/core/test/config/config.test.ts
# Conflicts: # packages/core/src/config/discovery.ts
|
Conflicts resolved — GitHub now reports this as It had been retargeted to Verified on the merged head @thdxr thanks for moving this to |
V1 parity for the skill catalog: OPENCODE_DISABLE_CLAUDE_CODE and OPENCODE_DISABLE_CLAUDE_CODE_SKILLS now drop the ~/.claude compatibility roots at discovery, so the compatibility skill plugin loads no Claude skills. The variables were ignored by the V2 rewrite (anomalyco#36990); upstream anomalyco#51888 restored them but was closed unmerged. Discovery is the single producer of claude roots, so gating here covers every consumer; the existing options.claude === false escape hatch still applies.

Issue for this PR
Part of #36990
Replacement for #44725 (auto-closed by the stale-PR cleanup; the author can't reopen it). Same branch and reviewed change.
Type of change
What does this PR do?
Brings back
OPENCODE_DISABLE_CLAUDE_CODEsupport. V1 honored this flag to keep OpenCode from reading~/.claude(prompt + skills); on v2 the env var was declared but never wired into config discovery, so the global~/.claudeand project.claudedirs kept loading.Discovery now gates the
claudesources onConfig.Options.disableClaudeCodeor the env var. Setting it drops.claudeskill sources (and their file watches) while.agentssources stay. v2 does not load aCLAUDE.mdprompt, so there is no prompt path to gate. Discovery stays infallible: absent, malformed, or provider-failing reads fall back tofalseinstead of leaking aConfigErrorinto the layer graph. The duplicatedclaude/agentsroot building is now a sharedoptionalRootshelper.Scope note: this restores the umbrella flag only. The granular
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS/OPENCODE_DISABLE_CLAUDE_CODE_PROMPTvariables are still unimplemented; since v2 only consumes.claudefor skill discovery,_SKILLSwould map to the same gate and_PROMPTwould be a no-op today.Review feedback from #44725 is included:
testLayerpins aConfigProvider(empty env by default) so discovery never reads the ambient environment, and a dedicated test covers the env path next to the option path.How did you verify your code works?
devhead, withOPENCODE_DISABLE_CLAUDE_CODEunset,1,yes,0, and malformed values.browser-idle.test.tsandserver/test/generate.test.tspass.Screenshots / recordings
N/A
Checklist