feat(config): add {import:...} syntax for importing JSON objects#150
Open
ariane-emory wants to merge 15 commits intodevfrom
Open
feat(config): add {import:...} syntax for importing JSON objects#150ariane-emory wants to merge 15 commits intodevfrom
ariane-emory wants to merge 15 commits intodevfrom
Conversation
Add support for importing entire JSON objects from external files using
the {import:path/to/file.json} syntax. This allows modular configuration
by extracting complex objects (providers, agents, etc.) into separate files.
Features:
- Import JSON objects with {import:./file.json} syntax
- Support for nested imports (imports within imported files)
- Circular import detection with proper error handling
- Same path resolution as {file:...} (relative, absolute, ~/)
- Imported files can also use {env:...} and {file:...} syntax
Changes:
- Add resolveImportsInObject() function to recursively resolve imports
- Add 5 new tests for import functionality
- Update documentation with import syntax examples and usage
All 59 config tests pass.
The {import:...} syntax now works like {env:...} and {file:...},
performing text substitution BEFORE JSON parsing. This allows
the unquoted syntax:
"provider": {import:./providers.json}
Instead of requiring quotes around the import placeholder.
Now supports flexible spacing like { import: providers.json }
Instead of rewriting the entire config documentation, just add
a small section explaining the {import:...} syntax after the
existing {file:...} section.
…e into feat/config-imports
4efbfcd to
8ad5262
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.
What does this PR do?
Add support for importing entire JSON objects from external files using the {import:path/to/file.json} syntax. This allows modular configuration by extracting complex objects (providers, agents, etc.) into separate files.
Features:
Changes:
All 59 config tests pass.
How did you verify your code works?