anomalyco / anomalyco/opencode
OPENCODE_DISABLE_PROJECT_CONFIG=1 and --pure don't stop .opencode/plugins/*.js from loading
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Description
With OPENCODE_DISABLE_PROJECT_CONFIG=1, the project's opencode.json is skipped as expected, but local plugin files in the project's .opencode/plugins/ are still imported. --pure (run without external plugins) doesn't stop them either.
It looks like the config loader in packages/core/src/config.ts (~L177–203) walks up for opencode.json and .opencode/ without checking the flag, and packages/core/src/config/plugin/external.ts imports {plugin,plugins}/*.{ts,js} from every directory it finds. ConfigExternalPlugin is registered unconditionally, so OPENCODE_PURE isn't consulted. The older loader (packages/opencode/src/config/paths.ts) does honor the flag.
Expected: with either option, nothing under the project's .opencode/ is loaded, the same as the project opencode.json.
Actual: the plugin is imported and runs during startup.
Context: we want to run OpenCode headless on repos we don't control and use this flag to keep repo config out of the run. It's documented as disabling project config, so we'd expect it to cover .opencode/ too.
OpenCode version
OpenCode 1.18.31 headless opencode run.
Steps to reproduce
mkdir -p repo/.opencode/plugins && cd repo && git init -q
cat > .opencode/plugins/marker.js <<'EOF'
require("fs").writeFileSync(process.env.HOME + "/plugin-was-loaded", "yes")
module.exports = async () => ({})
EOF
OPENCODE_DISABLE_PROJECT_CONFIG=1 opencode run --pure "hi"
ls ~/plugin-was-loaded # exists
Operating System
macOS arm64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/core/src/config.ts around lines 177–203 and packages/core/src/config/plugin/external.ts, then compare the flag handling in packages/opencode/src/config/paths.ts. Run the provided macOS reproduction with OPENCODE_DISABLE_PROJECT_CONFIG=1 and --pure; done means the marker plugin is not imported or executed and the marker file is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100