feat(cli): emit pnpm's verbatim error for empty --allow-build values#444
feat(cli): emit pnpm's verbatim error for empty --allow-build values#444
Conversation
Both `--allow-build=` (explicit empty) and bare `--allow-build` (no
value, no following arg) now error with pnpm's byte-identical line:
The --allow-build flag is missing a package name. Please specify
the package name(s) that are allowed to run installation scripts.
Wired via a `value_parser` that rejects the empty string. clap's
`default_missing_value = ""` plus `num_args = 0..=1` route the bare
form through the same validator, so users porting pnpm scripts that
grep stderr for the verbatim error line keep working after a swap to
aube.
Tightens the existing L164 port (was loosely asserting `--allow-build`
in clap's default error string) and adds a companion port for the
explicit-empty `--allow-build=` form.
Greptile SummaryThis PR aligns Confidence Score: 5/5Safe to merge — changes are limited to argument parsing and error messaging with no effect on install logic. Only P2 findings present (one stale test comment). Core implementation is correct: the clap attribute combination of No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(cli): require `=` syntax for --allow..." | Re-trigger Greptile |
…swallowing Greptile P2 follow-up: with `num_args = 0..=1` and no `require_equals`, `aube add --allow-build esbuild some-pkg` would let clap silently consume `esbuild` as the flag's value (since `num_args` allows 1 value), leaving the positional packages list short — no install. Forcing `=` syntax makes the boundary unambiguous and routes every bare-flag occurrence through `default_missing_value = ""`, which the validator rejects with pnpm's verbatim missing-package-name error. After the fix: --allow-build=foo → value "foo" (happy) --allow-build= → value "" → pnpm error --allow-build (bare) → default "" → pnpm error --allow-build foo → bare → pnpm error (no swallow) Adds a regression bats test pinning the space-form-no-swallow contract; also regenerates aube.usage.kdl + docs/cli/* to reflect the new help-string format clap emits with require_equals (`--allow-build[=<PKG>]`).
15cb6bf to
f3bbe5c
Compare
Benchmark changesVersions:
Public ratios: warm installs vs Bun 4x -> 11x; warm installs vs pnpm 5x -> 13x.
f3bbe5c vs 60ff453 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex. |
Summary
Both
--allow-build=(explicit empty equals) and bare--allow-build(no value, no following arg) now error with pnpm's byte-identical message:Previously, both forms exited non-zero — but with clap's default
a value is required for '--allow-build <PKG>'instead of pnpm's wording. Scripts that grep pnpm's stderr for the verbatim error line wouldn't survive a swap to aube.Implementation
A
value_parser = parse_allow_build_valuerejects the empty string with pnpm's exact text. clap'snum_args = 0..=1plusdefault_missing_value = ""route the bare form through the same validator, so a single source of truth covers both shapes.Test plan
--allow-buildsubstring in clap's default error) to assert pnpm's verbatim wording. Renamed to reflect the actual contract.--allow-build=form, asserting the same wording and that the manifest stays untouched.mise run test:bats test/lifecycle_scripts.bats— 31/31 greencargo test --workspace— 0 failurescargo clippy --all-targets -- -D warningscleanmise run render— regeneratedaube.usage.kdl+docs/cli/add.md+docs/cli/commands.jsonSanity
🤖 Generated with Claude Code
Note
Medium Risk
Changes
aube addCLI parsing for--allow-build, including enforcing--allow-build=<pkg>and emitting a new error message for missing values, which may affect existing scripts that relied on clap’s previous parsing/error output.Overview
Aligns
aube add --allow-buildwith pnpm by rejecting both bare--allow-buildand--allow-build=using pnpm’s byte-identical missing-package error.Updates clap arg configuration to force
--allow-build=<pkg>(viarequire_equals,num_args, anddefault_missing_value) and adds a dedicated validator, plus extends/adjusts Bats tests and regenerated CLI docs/usage artifacts to cover the new error behavior and prevent positional-arg swallowing.Reviewed by Cursor Bugbot for commit f3bbe5c. Bugbot is set up for automated code reviews on this repo. Configure here.