Skip to content

feat(cli): add first-class digs alias binary for digstore - #16

Merged
MichaelTaylor3d merged 1 commit into
mainfrom
feat/digs-alias
Jul 12, 2026
Merged

feat(cli): add first-class digs alias binary for digstore#16
MichaelTaylor3d merged 1 commit into
mainfrom
feat/digs-alias

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

TLDR

digs <args> now behaves identically to digstore <args> — a first-class installed alias binary (not a shell alias), shipped alongside digstore everywhere. Closes DIG-Network/dig_ecosystem#434.

What changed

  • Second [[bin]] digs target in crates/digstore-cli/Cargo.toml, sharing ONE codepath: main()'s body was extracted into digstore_cli::run(); src/main.rs and the new src/bin/digs.rs are thin shims over it (DRY — no duplicated logic).
  • Invoked-name is first-class: run() parses argv with the invoked binary's name (arg0 file-stem, via the new invoked_bin_name()) as clap's program + bin name, so digs --help/--version/errors read digs — not a hardcoded digstore, and not the raw absolute arg0 path.
  • completion + --help-json emit the invoked name too: digs completion <shell> binds completions to digs, and digs --help-json reports "name":"digs".
  • release.yml (the tag-driven per-OS GitHub Release workflow the installer + apt consume) builds + publishes digs beside digstore in BOTH asset shapes: bare per-OS binaries (digs-<ver>-<os>-<arch> for dig-installer's RawBinary matcher) and the linux .tar.gz (now carrying both digstore + digs at root, for apt's .deb).
  • SPEC.md documents the alias; new integration suite tests/cli_digs_alias.rs proves parity.

Note on scope: human-facing example/hint text (after_help blocks, "next: digstore …" hints) intentionally keeps the canonical digstore name — those commands work verbatim under digs since the surface is identical, and rewriting every hint to be dynamic would thread the bin-name through the whole output layer for no behavioral gain. publish-binary.yml is untouched: it is the hub compile-worker S3 sync (needs only digstore compile), not the per-OS release-asset workflow.

How verified (this session, Windows + short CARGO_TARGET_DIR)

  • fmt cargo fmt -p digstore-cli -- --check clean; clippy cargo clippy -p digstore-cli --all-targets -- -D warnings clean.
  • Full suite green: cargo test -p digstore-cli — 271 lib unit tests + every integration suite pass, 0 failures (the mainrun() refactor is behavior-preserving).
  • New alias suite (6 tests) green: version parity (digs 0.13.0 vs digstore 0.13.0, same semver), Usage: digs, byte-identical --help-json command tree/globals/exit-codes (only name differs), digs completion bash contains zero digstore references, and digs --json status → identical NO_STORE/exit-3 envelope.
  • §3.5 installed-binary: cargo install --path crates/digstore-cli --force --locked produced BOTH ~/.cargo/bin/digstore.exe and digs.exe (identical 32,075,776 bytes); digs --version == digstore --version semver; and a real init → add → commit → log → status flow completed under the installed digs (produced a real capsule).

Blast radius (gitnexus)

impact on the touched entrypoint symbols is LOW: print_help_json is called only from the main flow; completion::run has no symbol-level upstream. detect_changes confirms the changed symbols are exactly main, completion::run, print_help_json + the two docs — the 9 "affected processes" are all the Main → X entry flows, unchanged in behavior (verified by the green suite).

Version bump

0.12.0 → 0.13.0 (minor): a new, backwards-compatible capability (a new binary), no change to existing digstore behavior.

`digs <args>` now behaves IDENTICALLY to `digstore <args>` — same
subcommands, flags, --json, help, and exit codes (issue #434).

- Add a second `[[bin]] digs` target sharing ONE codepath: `main()`
  is extracted into `digstore_cli::run()`, and both `src/main.rs`
  and `src/bin/digs.rs` are thin shims over it (no duplicated logic).
- Parse argv with the invoked binary's name (arg0 file-stem, via the
  new `invoked_bin_name()`) as clap's program + bin name, so
  `digs --help`/`--version`/errors read `digs`, not a hardcoded
  `digstore` (nor the raw absolute arg0 path).
- `completion` + `--help-json` emit the invoked name too, so
  `digs completion <shell>` binds to `digs` and `digs --help-json`
  reports `"name":"digs"`.
- release.yml builds + publishes `digs` alongside `digstore` in both
  asset shapes (bare per-OS binaries for the universal installer, and
  the linux .tar.gz for apt), so both ship everywhere digstore ships.
- SPEC.md documents the alias. New integration suite proves both bins
  build, share a byte-identical command surface, and each reflects its
  own invoked name.

Co-Authored-By: Claude <noreply@anthropic.com>
@MichaelTaylor3d
MichaelTaylor3d merged commit 409c9e3 into main Jul 12, 2026
10 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the feat/digs-alias branch July 12, 2026 16:39
MichaelTaylor3d added a commit to DIG-Network/docs.dig.net that referenced this pull request Jul 12, 2026
…#35)

digs ships as a real installed binary alongside digstore everywhere
digstore ships (cargo-install, the universal installer, the apt .deb).
digs <args> is identical to digstore <args> (same commands, flags, and
--json output). Notes this on the CLI install page and the command
reference intro.

Refs DIG-Network/dig_ecosystem#434, DIG-Network/digs#16

Co-authored-by: Claude <noreply@anthropic.com>
MichaelTaylor3d added a commit to DIG-Network/apt.dig.net that referenced this pull request Jul 12, 2026
digstore's release tarball will carry `digs` (a first-class alias binary,
`digs <args>` == `digstore <args>`, digstore#16) alongside `digstore` at the
archive root. stage_deb now accepts extra NAME:SRC pairs to install additional
binaries under /usr/bin, and config.sh declares PKG_digstore_EXTRA_BINS="digs"
so build-deb.sh extracts and packages it too.

Extraction of an extra binary is non-fatal (extract_binary now returns 1
instead of erroring when the archive-relative path is absent), matching the
existing "skip, don't fail" resilience contract for missing upstream assets —
so the pipeline stays green against releases that predate digstore#16 and
picks up `digs` automatically once it ships.

Refs #434 (DIG-Network/dig_ecosystem), DIG-Network/digs#16.

Co-authored-by: Claude <noreply@anthropic.com>
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