fix: token substitution in OPENCODE_CONFIG_CONTENT#184
Open
ariane-emory wants to merge 7 commits intodevfrom
Open
fix: token substitution in OPENCODE_CONFIG_CONTENT#184ariane-emory wants to merge 7 commits intodevfrom
ariane-emory wants to merge 7 commits intodevfrom
Conversation
- Refactor load() to accept { configDir, configPath? } object for clarity
- Route inline config through load() to enable {env:} and {file:} token substitution
- Inline config uses configDir for file resolution without needing a synthetic path
- Access process.env directly for runtime env var access
- Add tests for {env:} and {file:} token substitution in OPENCODE_CONFIG_CONTENT
Fixes anomalyco#13219
…terpolation-alternate
- Refactor load() to use union type: { path } for files or { dir, source } for named sources
- Eliminate unclear "?? <inline>" fallback - source is now always explicit
- Error messages now show actual source: "OPENCODE_CONFIG_CONTENT" instead of "<inline>"
- Update all call sites: loadFile uses { path }, remote config and OPENCODE_CONFIG_CONTENT use { dir, source }
- Fix indentation issue in remote config handling
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.
What does this PR do?
NOTE: This PR is an alternate take on this issue. Unlike PR anomalyco#13384 (which was merged and subsequently reverted as it introduced a regression but about which I am thoroughly embarrassed). This alternate version changes one of the parameters of the
loadfunction inpackages/opencode/src/config/config.tsto an object. While a slightly more complex change, this provides a more robust solution to the issue and avoids the possibility of passing{}as the environment variable's value creating an unwanted extra file in the project's root,Fixes anomalyco#13219
How did you verify your code works?
Manual testing,
bun typecheck,bun test.You may manually test by running commands akin to the following (assuming bash):