fix: token substitution in OPENCODE_CONFIG_CONTENT (alternate take)#14047
Open
ariane-emory wants to merge 6 commits intoanomalyco:devfrom
Open
fix: token substitution in OPENCODE_CONFIG_CONTENT (alternate take)#14047ariane-emory wants to merge 6 commits intoanomalyco:devfrom
ariane-emory wants to merge 6 commits intoanomalyco:devfrom
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
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicates FoundPR #13484: fix: token substitution in OPENCODE_CONFIG_CONTENT (redo) Why it's related: This PR addresses the same issue (token substitution in OPENCODE_CONFIG_CONTENT). According to the current PR description, PR #13384 was merged and reverted due to a regression. PR #13484 appears to be another attempt at fixing this same issue. The current PR (#14047) is explicitly described as "an alternate take" on the same problem, with a different approach to refactoring the |
- 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 #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 #13219
How did you verify your code works?
Extensive manual testing,
bun typecheck,bun test.You may manually test by running commands akin to the following (assuming bash):