Skip to content

feat: add config-as-code schema and cli scaffold#88

Merged
AKogut merged 1 commit into
mainfrom
feat/53-54-config-and-cli
Jul 16, 2026
Merged

feat: add config-as-code schema and cli scaffold#88
AKogut merged 1 commit into
mainfrom
feat/53-54-config-and-cli

Conversation

@AKogut

@AKogut AKogut commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Combines two closely-coupled M0 tasks: the configuration contract and the CLI scaffold that consumes it.

flakemetry.yml — config as code (#53)

  • Strict zod schema in @flakemetry/contracts with defaults for every option (flaky, quarantine, ai, ignore, retention)
  • Precedence: flakemetry.yml < project settings < environment variables — deep merge per key, arrays replace
  • Typed env mapping (FLAKEMETRY_FLAKY_THRESHOLD, FLAKEMETRY_AI_RCA, …) with boolean/number coercion
  • ConfigValidationError names the offending key path; unknown keys are rejected (typos fail fast)
  • Every option documented in docs/configuration.md

@flakemetry/cli scaffold (#54)

  • Plugin-ready CommandRegistry (duplicate names rejected) + buildProgram factory
  • Config discovery walking up from cwd (flakemetry.yml / .yaml), yaml parsing, layer resolution via contracts
  • Token handling: FLAKEMETRY_TOKEN from env only (never the file), redacted display
  • flakemetry config [--json] prints resolved config + sources; --version wired
  • bin entry built as a second tsup entry with preserved shebang

Verification

  • 21 unit tests green (16 contracts + 5 cli): defaults, precedence, env coercion, offending-key errors, config discovery, token redaction, registry duplicates
  • Live check: file threshold: 0.7 + FLAKEMETRY_FLAKY_THRESHOLD=0.95 → resolved 0.95 with file's minSamples: 12 preserved; typo flakey: fails with Unrecognized key(s): 'flakey'
  • build / lint / typecheck / test → 32/32 green, format:check clean

Closes #53. Closes #54.

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.
@AKogut AKogut self-assigned this Jul 16, 2026
@AKogut
AKogut merged commit 0ea63a6 into main Jul 16, 2026
2 checks passed
@AKogut
AKogut deleted the feat/53-54-config-and-cli branch July 16, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

packages/cli — @flakemetry/cli scaffold flakemetry.yml — config-as-code schema + loader

1 participant