feat(config): add OPENCODE_NO_PARENT_CONFIG env var #10024
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add environment variable flag to prevent
findUpfrom walking up parent directories when loading project config. Only loads config from the current working directory.Fixes #10025
This is a logical continuation of #10013 (
OPENCODE_DISABLE_GLOBAL_CONFIG), providing more granular control over config loading.Use Case
Running opencode in a subdirectory that has its own
opencode.json, without inheriting/merging config from parent directories.Example structure:
Without flag (current behavior): Running from
~/project/agent/loads both configs, sees A, B, C, D.With flag: Running from
~/project/agent/only loads the local config, sees only D.What Gets Disabled
When
OPENCODE_NO_PARENT_CONFIG=true:opencode.json/opencode.jsoncfrom parent directories.opencode/directories from parent directoriesAGENTS.md/CLAUDE.md/CONTEXT.mdfrom parent directoriesNote: Global config (
~/.config/opencode/) is still loaded. UseOPENCODE_DISABLE_GLOBAL_CONFIG=true(from #10013) to disable that as well.Usage
Test Plan
OPENCODE_NO_PARENT_CONFIGOPENCODE_DISABLE_PROJECT_CONFIGtests still passRelated
OPENCODE_NO_PARENT_CONFIGto disable parent directory config inheritance #10025 - Issue for this featureOPENCODE_DISABLE_GLOBAL_CONFIG) #10021 - Issue forOPENCODE_DISABLE_GLOBAL_CONFIGOPENCODE_DISABLE_GLOBAL_CONFIG