feat: add config-as-code schema and cli scaffold#88
Merged
Conversation
Add the flakemetry.yml contract to @flakemetry/contracts: a strict zod schema with defaults, precedence-aware layer merging (file < project settings < env), typed env variable mapping, and validation errors that name the offending key. Scaffold @flakemetry/cli on top: a plugin-ready command registry, filesystem config discovery walking up from the working directory, token resolution from env with redacted display, and a config command printing the fully resolved configuration. Document every option in docs/configuration.md. Closes #53. Closes #54.
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.
Combines two closely-coupled M0 tasks: the configuration contract and the CLI scaffold that consumes it.
flakemetry.yml — config as code (#53)
@flakemetry/contractswith defaults for every option (flaky,quarantine,ai,ignore,retention)flakemetry.yml< project settings < environment variables — deep merge per key, arrays replaceFLAKEMETRY_FLAKY_THRESHOLD,FLAKEMETRY_AI_RCA, …) with boolean/number coercionConfigValidationErrornames the offending key path; unknown keys are rejected (typos fail fast)docs/configuration.md@flakemetry/cli scaffold (#54)
CommandRegistry(duplicate names rejected) +buildProgramfactoryflakemetry.yml/.yaml), yaml parsing, layer resolution via contractsFLAKEMETRY_TOKENfrom env only (never the file), redacted displayflakemetry config [--json]prints resolved config + sources;--versionwiredbinentry built as a second tsup entry with preserved shebangVerification
threshold: 0.7+FLAKEMETRY_FLAKY_THRESHOLD=0.95→ resolved0.95with file'sminSamples: 12preserved; typoflakey:fails withUnrecognized key(s): 'flakey'build/lint/typecheck/test→ 32/32 green,format:checkcleanCloses #53. Closes #54.