fix: authoritative env detection (config import, not regex) (#17) - #19
Merged
Merged
Conversation
The env picker showed only (source) for real projects: the regex parse missed
config shapes it didn't anticipate. Import the project's chant.config.ts and read
the actual config object instead — behold runs under tsx, so .ts transpiles, and
this handles export default {…}, defineConfig(…), and `satisfies ChantConfig`.
Regex parse stays as a fallback when the import can't run; empty otherwise.
Also log the detected environments/lexicons on boot so an empty picker is
diagnosable at a glance.
Verified: example → [prod]/[aws]; example-writes (typed temporal config) →
[prod]/[aws,temporal]. tsc clean; 32 tests (+1 wrapper-shape case).
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.
Follow-up to #17. The env picker showed only
(source)for real projects — the regex parse ofchant.config.tsmissed shapes it didn't anticipate.Fix
Detect by importing the project's
chant.config.tsand reading the actual config object (behold runs under tsx, so.tstranspiles). Handlesexport default { … },defineConfig(…), and… satisfies ChantConfig. The text parse stays as a fallback when the import can't run; empty otherwise.Also logs the detected environments/lexicons on boot, so an empty picker is diagnosable:
Verified live
example→ environments[prod], lexicons[aws]example-writes(typed config:import type … satisfies TemporalChantConfig) →[prod],[aws, temporal]tsc --noEmitclean; 32 tests pass (added a wrapper/satisfies-shape case).If a picker is still
(source)-only after this, the boot log will show(none declared)— that means the project's config has no literalenvironments, not a behold bug.