Skip to content

feat(cli): add generic --config.<key>=<value> flags#447

Merged
jdx merged 2 commits intomainfrom
claude/jolly-dewdney-d16e58
May 1, 2026
Merged

feat(cli): add generic --config.<key>=<value> flags#447
jdx merged 2 commits intomainfrom
claude/jolly-dewdney-d16e58

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented May 1, 2026

Summary

  • Adds pnpm-style --config.<key> and --config.<key>=<value> flags so any setting in settings.toml is reachable from the CLI, even ones without a declared sources.cli alias (e.g. strictDepBuilds).
  • Argv is pre-parsed before clap; parsed pairs feed a new process-global slot in aube-settings that every *_from_cli helper consults after the per-callsite cli slice.
  • The matcher accepts the canonical setting name in kebab / camel / snake form, so --config.strict-dep-builds=true, --config.strictDepBuilds=true, and --config.STRICT_DEP_BUILDS=true all resolve.

Behavior notes

  • Per-callsite CLI args still beat --config.<key> (first-match-wins), so existing flags like --frozen-lockfile keep priority.
  • --config.<key> still beats env / .npmrc / workspace yaml — same precedence as any other CLI source.
  • Anything after a bare -- separator is left untouched, so aube exec -- node --config.foo=bar passes --config.foo=bar through to the child.
  • Bare --config.<key> with no = defaults to "true" (matches pnpm/commander). The --config.<key> <value> space form is intentionally NOT consumed to avoid eating positional args.

Test plan

  • cargo test -p aube-settings — covers canonical-name matching across kebab/camel/screaming-snake.
  • cargo test -p aube --bin aube — covers extract_config_overrides (=, bool, multiple, --, no-op).
  • cargo clippy --all-targets -- -D warnings clean.
  • mise run test:bats test/lifecycle_scripts.bats — new --config.strict-dep-builds=true test plus existing 21 pass.
  • Manual smoke: aube install --config.strict-dep-builds=true triggers the gate; --config.strict-dep-builds=false overrides .npmrc strictDepBuilds=true.

🤖 Generated with Claude Code


Note

Medium Risk
Modifies top-level argv handling and settings CLI resolution precedence, which could change how flags are parsed/overridden across commands if edge cases are missed.

Overview
Adds pnpm-compatible generic --config.<key> / --config.<key>=<value> support by stripping these flags from argv before clap parsing and registering them as process-wide setting overrides.

Updates aube-settings CLI resolvers to consult these global overrides (after command-specific CLI flags), including matching keys by canonical setting name across kebab/camel/snake forms and skipping unparseable values so earlier valid duplicates still win. Adds unit tests plus a bats regression test proving --config.strict-dep-builds=true can flip strictDepBuilds for a single aube install run.

Reviewed by Cursor Bugbot for commit 0d23eb9. Bugbot is set up for automated code reviews on this repo. Configure here.

pnpm-style `--config.<key>` and `--config.<key>=<value>` flags now reach
any setting in settings.toml, including those without a declared
sources.cli alias (e.g. strictDepBuilds). Argv is pre-parsed before
clap; parsed pairs feed a process-global slot in aube-settings that
every *_from_cli helper consults after the per-callsite cli slice. The
matcher also accepts the canonical setting name in kebab/camel/snake
form so `--config.strict-dep-builds=true`, `--config.strictDepBuilds=true`,
and `--config.STRICT_DEP_BUILDS=true` all work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR adds pnpm-style --config.<key>[=<value>] generic override flags by pre-parsing argv before clap, storing extracted pairs in a process-global OnceLock, and extending every *_from_cli resolver to consult that global slot after the per-callsite cli bag. The implementation is well-scoped, the precedence rules are clearly documented, and the unit/integration test coverage is thorough across all supported forms (=, bare-bool, multiple, -- separator).

Confidence Score: 4/5

Safe to merge; the one inline comment is purely stylistic and does not affect correctness

No new P0 or P1 findings from this review. The global-state approach via OnceLock is sound for a single-process CLI binary, the -- sentinel is handled correctly, and all documented behaviors are exercised by tests. Score is 4 rather than 5 because the feature touches process-global precedence logic that is inherently harder to audit exhaustively without running the full integration suite.

crates/aube-settings/src/values.rs — the to_kebab_case and cli_raw_for helpers carry acknowledged edge cases (consecutive-uppercase acronyms, silent fallthrough on bad values) worth keeping in mind when new settings are added

Important Files Changed

Filename Overview
crates/aube/src/main.rs Adds extract_config_overrides pre-parse step that strips --config.<key>[=<value>] from argv before clap, registers them as process-global overrides, and includes thorough unit tests covering all documented forms and edge cases including -- separator
crates/aube-settings/src/values.rs Adds GLOBAL_CLI_OVERRIDES OnceLock, cli_raw_for helper with accept-predicate scanning, and to_kebab_case normalizer; u64_from_cli now parses the integer string twice (once in the accept predicate, once in the final .and_then), and to_kebab_case collapses consecutive uppercase runs rather than splitting them (acknowledged in doc comment)
crates/aube-settings/src/lib.rs Re-exports set_global_cli_overrides — minimal, mechanical change
test/lifecycle_scripts.bats New bats integration test verifying --config.strict-dep-builds=true triggers the strictDepBuilds gate; follows existing test patterns with shared setup/teardown

Fix All in Claude Code

Reviews (2): Last reviewed commit: "fix(cli): preserve parse-fall-through fo..." | Re-trigger Greptile

Comment thread crates/aube-settings/src/values.rs Outdated
Comment thread crates/aube-settings/src/values.rs
Comment thread crates/aube-settings/src/values.rs Outdated
Restore the original loop semantics in `bool_from_cli` / `u64_from_cli`:
when a key matches but its value won't parse, keep scanning earlier
entries rather than returning the first match unconditionally. This
matters now that raw user strings flow through the global slot — a
typo'd `--config.strictDepBuilds=garbage` no longer masks an earlier
valid duplicate. Mirrors how `bool_from_npmrc` / `u64_from_npmrc`
behave on the same input.

Also tighten the `to_kebab_case` doc to describe what the function
actually does (consecutive uppercase runs collapse to a single token,
matching `aube-settings/build.rs`'s alias generator), since no current
pnpm setting contains an internal acronym to expose the imperfection.

Addresses greptile P2 review feedback on PR #447.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx
Copy link
Copy Markdown
Contributor Author

jdx commented May 1, 2026

Thanks for the review. Pushed 0d23eb9 to address the parse-fall-through regression in bool_from_cli / u64_from_cli — they now keep scanning past unparseable values so an earlier valid duplicate still wins, matching the bool_from_npmrc / u64_from_npmrc behavior. Added a regression test for the same.

For the typo-warning concern (--config.strictDepBuilds=notabool silently dropping): leaving as-is for this PR. Emitting a per-call tracing::warn! from inside the resolver would fire repeatedly across the install pipeline; the cleaner fix is to validate --config.<key>=<value> against aube_settings::find() at argv-strip time in extract_config_overrides, so a bad key/type errors out before the install starts. Worth a follow-up since it touches main.rs and needs a settings.toml-driven validator.

For to_kebab_case and consecutive uppercase: tightened the doc to describe actual behavior (consecutive uppercase runs collapse to a single lowercase token, matching aube-settings/build.rs's alias generator). Greptile's suggested fix produces strict-d-e-p-builds for strictDEPBuilds, which is also wrong — proper acronym handling needs lookahead, and no current pnpm setting contains one to motivate the churn.

This comment was generated by Claude.

@jdx jdx merged commit 4326926 into main May 1, 2026
18 checks passed
@jdx jdx deleted the claude/jolly-dewdney-d16e58 branch May 1, 2026 02:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Benchmark changes

Versions:

  • aube: 1.5.1 -> 1.5.2
  • pnpm: 11.0.2 -> 11.0.3

Public ratios: warm installs vs Bun 4x -> 5x; warm installs vs pnpm 5x -> 12x.

Benchmark aube bun pnpm
Fresh install (warm cache) 1021ms -> 428ms (-58%) 4134ms -> 2025ms (-51%) 4717ms -> 5258ms (+11%)
CI install (warm cache, GVS disabled) 2920ms -> 2743ms (-6%) 3396ms -> 2793ms (-18%) 4864ms -> 5612ms (+15%)
CI install (cold cache, GVS disabled) 10801ms -> 10040ms (-7%) 10012ms -> 10684ms (+7%) 9722ms -> 9171ms (-6%)

0d23eb9 vs 60ff453 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

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.

1 participant