Skip to content

feat(cli): add decdn get <decdn: URI> over fetch and bundle pull - #2460

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/get-first-fetch-layer-3df574
Oct 14, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/get-first-fetch-layer-3df574

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2449. This is the first step: decdn get is a thin routing layer over the existing commands. A follow-up PR deletes decdn fetch and decdn bundle pull and moves their callers to get.

What it does

decdn get <URI> -o <OUT> parses the URI with decdn_client::uri::DecdnUri (#2455) and builds the arguments of an existing command:

URI Runs
decdn:<hash> decdn fetch (-o is a file, or - for stdout)
decdn:<hash>/ decdn bundle pull over every entry
decdn:<hash>/<path> decdn bundle pull with one --include glob that matches exactly <path>
any of the above with ?ns=N the same, with namespace N
  • get flattens the shared ClientFetchArgs, so the discovery, chain, pool and capability flags work as they do today.
  • The entry path is escaped with globset::escape (plus \ on Unix, where it is the glob escape), so a filename with *, ?, [, ], {, } pulls exactly that entry.
  • Flag rules: the bundle flags (--include, --exclude, --select, --jobs, --max-lane-streams, --overwrite, --dry-run, --json) are an error on a blob URI. --include, --exclude and --select are an error on an entry URI. -o - is accepted only for a blob URI.
  • --jobs and --max-lane-streams are Option on get so a blob URI can tell they were given. Their defaults move to DEFAULT_JOBS / DEFAULT_MAX_LANE_STREAMS in decdn_common::cli::bundle, which bundle pull also uses.

ADR

adr/appendix-bundles.md gains a decdn: URIs section: the grammar, the hash, path and ns rules, and why the URI has no // and marks a bundle with a trailing /.

Left for the cleanup PR

  • Delete fetch, bundle pull, FetchArgs, BundlePullArgs and the bundle group; move the e2e tests, CLI tests and docs to get. That includes the ADRs that name the old commands: 012, 039, appendix-bundles.md and appendix-binaries.md.
  • The drop-the-trailing-/ hint when decdn:<hash>/ names a non-manifest blob.

Tests

  • cargo nextest run -p decdn-cli -p decdn-common: 1230 passed, including 10 new commands::get::tests (routing for each URI kind, namespace pass-through, shared-flag carry-over, every flag rule, glob metacharacter paths).
  • cargo clippy --workspace --all-targets --all-features, cargo fmt --check and cargo doc are clean.

🤖 Generated with Claude Code

…2449)

`get` parses a `decdn:` URI and routes it to the existing commands:
a blob URI runs `decdn fetch`, `decdn:<hash>/` runs `decdn bundle pull`,
and `decdn:<hash>/<path>` runs the bundle pull with one escaped
`--include` glob that matches exactly that path. The URI's `ns` is the
namespace hint. Bundle-only flags are rejected on a blob URI, entry
filters on an entry URI, and `-o -` on anything but a blob URI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is an additive, well-tested CLI routing layer whose integration points (struct fields, function signatures, exports, hash format, and flag rules) all verify correctly, with no protocol, on-chain, or storage impact.

0 open findings

What changed in this PR

This PR adds a new decdn get <decdn: URI> command as a thin routing layer over the existing decdn fetch and decdn bundle pull commands, implementing the first step of #2449. It parses a decdn: URI (via the decdn_client::uri::DecdnUri parser from #2455) and dispatches to the blob fetch (decdn:<hash>), a whole-bundle pull (decdn:<hash>/), or a single-entry pull (decdn:<hash>/<path>), carrying the optional ?ns= namespace hint and the shared retrieval flags. The underlying fetch and bundle pull commands are left intact for a follow-up cleanup PR.

Changes:

  • Adds GetArgs (decdn-common) and the get command (decdn-cli) that parses the URI, enforces per-target flag rules (bundle flags rejected on blob URIs, entry filters rejected on entry URIs, -o - only for blobs), and builds a FetchArgs or BundlePullArgs.
  • Extracts the bundle-pull defaults into DEFAULT_JOBS/DEFAULT_MAX_LANE_STREAMS constants so both bundle pull and get share one source; get makes --jobs/--max-lane-streams Option to detect whether they were supplied on a blob URI.
  • Escapes entry paths with globset::escape (plus Unix backslash handling) so a filename with glob metacharacters matches exactly one entry; adds 10 unit tests and updates the CLAUDE.md command list.
File Description
crates/​common/​src/​cli/​get.rs New GetArgs struct: the URI, destination, bundle/entry flags, and flattened ClientFetchArgs.
crates/​common/​src/​cli/​mod.rs Registers the get module, re-exports GetArgs, and adds the Command::Get variant with help text.
crates/​common/​src/​cli/​bundle.rs Extracts DEFAULT_JOBS/DEFAULT_MAX_LANE_STREAMS constants and uses them as the bundle pull defaults.
crates/​cli/​src/​commands/​get.rs New routing logic: parse the URI, enforce flag rules, and build FetchArgs/BundlePullArgs, including literal_glob escaping.
crates/​cli/​src/​commands/​get/​tests.rs Unit tests for every URI kind, namespace pass-through, shared-flag carry-over, flag rules, and glob metacharacter paths.
crates/​cli/​src/​commands/​mod.rs Registers the get command module.
crates/​cli/​src/​main.rs Dispatches Command::Get to commands::get::get.
CLAUDE.md Adds get to the decdn binary command list in the Status note.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-code-quality

github-code-quality Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit da76e97 in the claude/get-first-fet... branch remains at 75%, unchanged from commit c50a62e in the main branch.

Show a line coverage summary of the most impacted files.
File main c50a62e claude/get-first-fet... da76e97 +/-
crates/node/src/dht/publish.rs 80% 78% -2%
crates/cli/src/main.rs 78% 77% -1%
crates/client/src/lib.rs 88% 88% 0%
crates/client/s...undle/engine.rs 61% 61% 0%
crates/cache/src/engine.rs 91% 91% 0%
crates/protocol/src/framing.rs 93% 93% 0%
crates/client/src/streamer.rs 83% 84% +1%
crates/client/src/sink.rs 93% 95% +2%
crates/client/src/uri.rs 91% 94% +3%
crates/cli/src/commands/get.rs 0% 91% +91%

Updated October 14, 2026 11:42 UTC

@alpergundogdu
alpergundogdu merged commit 76d14e8 into main Oct 14, 2026
31 checks passed
@alpergundogdu
alpergundogdu deleted the claude/get-first-fetch-layer-3df574 branch October 14, 2026 12:20
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.

2 participants