Friction (hit while implementing #488)
--project / -p (and --schemas) are declared on the top-level Cli struct without global = true, so they only parse before the subcommand:
- ✅
rivet --project /path validate
- ❌
rivet validate --project /path → clap error, and with --format json the run produces empty stdout (the error goes to stderr), which is a confusing failure mode for anything shelling out to rivet.
This cost me a debug cycle in the --new-since feature (#488): a subprocess rivet validate --format json --project <dir> returned empty JSON → EOF while parsing a value, with no hint that the arg position was the problem. Many users (and tools) reasonably expect rivet <subcommand> --project X to work, since --project reads as a global option.
Suggested fix
Mark the top-level path args global = true:
#[arg(short, long, default_value = ".", global = true)]
project: PathBuf,
#[arg(long, global = true)]
schemas_dir: Option<PathBuf>, // (or whatever the schemas arg is)
Then --project/--schemas work in any position. Low-risk (additive — the pre-subcommand form still works); worth a quick check that global args with a default_value behave as expected in clap derive.
(Workaround that finally helped: put --project before the subcommand.)
Found in the hourly dogfooding loop.
Friction (hit while implementing #488)
--project/-p(and--schemas) are declared on the top-levelClistruct withoutglobal = true, so they only parse before the subcommand:rivet --project /path validaterivet validate --project /path→ clap error, and with--format jsonthe run produces empty stdout (the error goes to stderr), which is a confusing failure mode for anything shelling out to rivet.This cost me a debug cycle in the
--new-sincefeature (#488): a subprocessrivet validate --format json --project <dir>returned empty JSON →EOF while parsing a value, with no hint that the arg position was the problem. Many users (and tools) reasonably expectrivet <subcommand> --project Xto work, since--projectreads as a global option.Suggested fix
Mark the top-level path args
global = true:Then
--project/--schemaswork in any position. Low-risk (additive — the pre-subcommand form still works); worth a quick check thatglobalargs with adefault_valuebehave as expected in clap derive.(Workaround that finally helped: put
--projectbefore the subcommand.)Found in the hourly dogfooding loop.