feat(cli): dign first-class alias binary for dig-node (mirror digs #434)#36
Merged
Conversation
Ship `dign` as a first-class alias binary for `dig-node`, exactly mirroring how `digs` aliases `digstore` (#434): a real installed binary (not a shell alias) whose `dign <args>` behaves byte-for-byte identically to `dig-node <args>` — same subcommands, flags, `--json`, and exit codes. Mechanism (matching digstore's bin-target approach, not a release-time copy): - Lift the CLI entrypoint out of `main.rs` into `dig_node_service::run()` (new `entrypoint` module) so BOTH binaries share ONE codepath — no duplicated logic. The displayed program name is derived from arg0, so `dign --help`/ `--version` report `dign` while `dig-node` reports `dig-node`. - Add a second `[[bin]] name = "dign"` (`src/bin/dign.rs`), a thin shim over `run()`. `main.rs` becomes the same thin shim. - release.yml builds `--bin dig-node --bin dign` and publishes the alias under its own stem `dign-<ver>-<os_arch>[.exe]` (same shape as `dig-node-*`). Tests: alias-identity integration tests (same version/dispatch, own name in usage) + a release-workflow guard asserting the `dign` build+asset steps + unit tests for the arg0 program-name rule. The installer half (dig-installer `Repo::dign()` + install-alongside, #548 step 3) is a SEPARATE follow-up gated on this release publishing the asset. Version: minor bump 0.30.0 -> 0.31.0 (new capability, backwards-compatible). Refs #548 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5SZfddeasRAZhzs97Xjvu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ship
dignas a first-class alias binary fordig-node, exactly mirroring howdigsaliasesdigstore(#434).dign <args>behaves byte-for-byte identically todig-node <args>— same subcommands, flags,--jsonenvelopes, and exit codes — and each binary reports its own name in--help/--version.Superproject tracking: DIG-Network/dig_ecosystem#548.
Mechanism (mirrors digstore — a
[[bin]]alias target, NOT a release-time copy)digstore ships
digsas a second[[bin]]sharing the lib entrypointdigstore_cli::run(); the release workflow builds both bins and stages the alias by string-substituting the stem. This PR replicates that exactly:main.rsintodig_node_service::run()(newentrypointmodule). Bothsrc/main.rsand the newsrc/bin/dign.rsare thin shims over it — zero duplicated logic. The displayed program name is derived from arg0 (a pure, unit-testedbin_name_from_arg0helper), sodignreportsdignanddig-nodereportsdig-node. Theserviceidentity string stays"dig-node"(the alias renames only the invoked binary).[[bin]] name = "dign"→src/bin/dign.rs.release.ymlnow builds--bin dig-node --bin dignand publishes the alias under its own stemdign-<ver>-<os_arch>[.exe](identical shape todig-node-<ver>-<os_arch>), alongside the existingdig-node-*+ legacydig-companion-*assets.Blast radius (gitnexus + read-through)
The moved code (
Cli/Command/PairCommand, therender_*helpers, the runtime builders) was all private tomain.rs— no external consumers, confirmed by search. The change ADDSdig_node_service::run+ theentrypointmodule;serve/service/Config/VERSIONare unchanged. No public API removed. Contained todig-node-service.Tests
tests/cli_dign_alias.rs— alias-identity against the REAL built binaries: same--versionsemver (each leading with its own name),dign --helpusage readsdign(notdig-node),dign status --jsonproduces the identical NOT_SERVING (exit 1) envelope withservice:"dig-node", and an unknown subcommand fails identically under both.tests/release_workflow_dign_guard.rs— guard thatrelease.ymlbuilds--bin dignand stages thedign-<ver>-<os_arch>asset (protects the published-asset contract; producer-side counterpart to the installer's futureRepo::dign()).entrypointunit tests — the arg0 → program-name rule (stem,.exestrip, empty/absent fallback todig-node) +Cli::command().debug_assert().Verified locally:
cargo fmt --allclean,cargo clippy --all-targets --locked -- -D warningsclean, the new + existing CLI tests green.Version
Minor bump 0.30.0 → 0.31.0 (
feat: new backwards-compatible capability; no existing behaviour changed). RootCargo.toml+Cargo.locksynced for--locked.Out of scope (follow-up, gated on this release)
Repo::dign()+ install-alongside (#548 step 3).dign ≡ dig-nodeentry (orchestrator-owned) + docs.dig.net dign mention (mirroring the existingdigsentries).Refs #548
🤖 Generated with Claude Code