Summary
Fold the standalone moq-token binary into moq token, so there is one binary and one command surface instead of two build artifacts sharing a library.
Where we are
moq-token-cli is a lib+bin. The command surface lives in moq_token_cli::Args, which the standalone moq-token binary wraps in its own Root spec root and moq-cli nests under moq token. The implementation is genuinely shared, so this is not about duplicated logic. What is duplicated is the surface: two spec roots, two help renderings, two completion trees, two release artifacts, and two places for a flag to drift.
Why now
If #3030 lands, Usage has the mechanism for exactly this: an executable view. A view is argv0 dispatch against a single binary's own spec, so one binary can present a different root depending on the name it was invoked under. moq-token generate ... and moq token generate ... become one spec with two surfaces, and help renders the right prefix for each (page_view / render_failure_view already exist for this).
The blocker today is not the CLI plumbing, it is that they are separate build artifacts. Views cannot span two binaries.
Sketch
moq-cli declares #[usage(view("moq-token", bin = "moq-token", root = "token"))].
- Ship
moq-token as a symlink, hardlink, or a thin renamed copy of moq, rather than as its own compiled binary.
- Drop
moq-token-cli's Root struct; the crate keeps exporting Args for moq-cli to nest.
moq-token (the library) is unaffected -- it stays free of CLI concerns either way.
Things to decide
- Packaging.
moq-token is currently released as its own artifact with its own version. A symlink changes what the release workflow produces and what a package manager installs. This is the bulk of the work.
- Binary size.
moq-token today is a small binary; making it an alias of moq means anyone who wants only token tooling pulls the full media router.
- Whether the standalone name survives at all, or whether
moq token simply becomes the only spelling after a deprecation period. That is the simpler end state if nobody depends on the separate binary.
The second point may be the one that kills it. Worth measuring moq vs moq-token stripped sizes before committing.
Depends on
#3030 (Usage migration). Without it there is no view mechanism, and the shared-Args arrangement we have is about as good as clap allows.
(Written by Claude Opus 5)
Summary
Fold the standalone
moq-tokenbinary intomoq token, so there is one binary and one command surface instead of two build artifacts sharing a library.Where we are
moq-token-cliis a lib+bin. The command surface lives inmoq_token_cli::Args, which the standalonemoq-tokenbinary wraps in its ownRootspec root andmoq-clinests undermoq token. The implementation is genuinely shared, so this is not about duplicated logic. What is duplicated is the surface: two spec roots, two help renderings, two completion trees, two release artifacts, and two places for a flag to drift.Why now
If #3030 lands, Usage has the mechanism for exactly this: an executable view. A view is argv0 dispatch against a single binary's own spec, so one binary can present a different root depending on the name it was invoked under.
moq-token generate ...andmoq token generate ...become one spec with two surfaces, and help renders the right prefix for each (page_view/render_failure_viewalready exist for this).The blocker today is not the CLI plumbing, it is that they are separate build artifacts. Views cannot span two binaries.
Sketch
moq-clideclares#[usage(view("moq-token", bin = "moq-token", root = "token"))].moq-tokenas a symlink, hardlink, or a thin renamed copy ofmoq, rather than as its own compiled binary.moq-token-cli'sRootstruct; the crate keeps exportingArgsformoq-clito nest.moq-token(the library) is unaffected -- it stays free of CLI concerns either way.Things to decide
moq-tokenis currently released as its own artifact with its own version. A symlink changes what the release workflow produces and what a package manager installs. This is the bulk of the work.moq-tokentoday is a small binary; making it an alias ofmoqmeans anyone who wants only token tooling pulls the full media router.moq tokensimply becomes the only spelling after a deprecation period. That is the simpler end state if nobody depends on the separate binary.The second point may be the one that kills it. Worth measuring
moqvsmoq-tokenstripped sizes before committing.Depends on
#3030 (Usage migration). Without it there is no view mechanism, and the shared-
Argsarrangement we have is about as good as clap allows.(Written by Claude Opus 5)