feat(config): add OPENCODE_NO_PARENT_CONFIG env var#10024
Open
kynnyhsap wants to merge 3 commits intoanomalyco:devfrom
Open
feat(config): add OPENCODE_NO_PARENT_CONFIG env var#10024kynnyhsap wants to merge 3 commits intoanomalyco:devfrom
kynnyhsap wants to merge 3 commits intoanomalyco:devfrom
Conversation
Contributor
|
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. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
96fa51d to
65dae98
Compare
Add environment variable flag to prevent findUp from walking up parent directories when loading project config. Only loads config from the current working directory. When set, this prevents loading: - opencode.json from parent directories - .opencode/ directories from parent directories - AGENTS.md/CLAUDE.md from parent directories Useful for running opencode in a subdirectory that has its own config, without inheriting config from parent directories.
Convert GLOBAL_RULE_FILES from module-level constant to a function that evaluates at runtime. This ensures Flag.OPENCODE_CONFIG_DIR is read when the function is called, not when the module loads.
876daec to
17539f0
Compare
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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