Repository navigation
Description
Summary
Add a bundle subcommand namespace to decdn with two operations:
decdn bundle pull— fetch a directory tree from a bundle (local file or content-addressed hash)decdn bundle create -i <dir>/ -o bundle.json— walk a local tree, hash each file, emit a bundle file
Pure client-side; no protocol or ADR changes. Bundle files are the durable, shareable artifact that origins publish alongside (or instead of) raw hashes.
Motivation
ADR 002 keeps multi-file as an application concern, so bundles live above the protocol. But hand-authoring path → hash JSON is error-prone and a non-starter for any non-trivial origin. Pairing pull with create from day one means origins never have to hand-write bundles, and the format gets validated by its own generator.
A bundle file is just bytes, so it gets its own BLAKE3 hash like any other blob. That means origins can publish a single bundle hash and clients fetch the bundle blob first, then everything it references — no out-of-band file distribution, no separate channel for handing out the JSON. The deterministic-emit requirement (see Implementation notes) is what makes this work: same input dir → same bundle bytes → same hash, cacheable and dedupable across origins.
Bundle format (committed: JSON v1)
{
"version": 1,
"entries": [
{ "path": "index.html", "hash": "b3:abc…", "size": 4096 },
{ "path": "assets/app.js", "hash": "b3:def…", "size": 51234 },
{ "path": "img/logo.png", "hash": "b3:123…" }
]
}path: relative POSIX path;.., absolute paths, and symlink escapes rejected on both create and pullhash: BLAKE3 hex; transparently resolves to a raw blob or an ADR-012 chunked manifest (theDECDNMANmagic lives inside the blob)size: optional on the wire format, butbundle createalways emits it (used forpullprogress / pre-flight)
Future formats (YAML/TOML) can be added without breaking v1; sniff by extension if/when that happens.
CLI shape
decdn bundle create -i ./site/ -o ./site.bundle.json [--follow-symlinks] [--exclude <glob>]
decdn bundle pull -i ./site.bundle.json -o ./out/ [flags] # local bundle file
decdn bundle pull --hash b3:abc… -o ./out/ [flags] # fetch bundle blob, then pull contents
# pull flags: [--jobs N] [--verify] [--overwrite|--skip-existing] [--dry-run]
-i and --hash are mutually exclusive; exactly one is required. The --hash form is the same code path as -i plus one extra fetch up front (bundle blob → deserialize → continue).
bundle create is hash-only in v1 — it does not push blobs to an origin/cache. Publishing is a separate concern (cache backend selection, auth, etc.) and will get its own issue once the fetch/push primitives land.
Implementation notes
- Crate placement: new
crates/node/src/cli/bundle/module (mod.rs,pull.rs,create.rs). Spinning out acrates/clientis premature with two subcommands; revisit if the surface grows past ~4–5 commands or non-CLI consumers appear. - Atomicity (pull): write each file to
<path>.partial, BLAKE3-verify, then rename. Leave partials on failure so re-runs can resume. Verify default-on (--verifyis the toggle off, not on). - Determinism (create): sort
entriesbypath(byte-wise) and emit canonical JSON (no trailing whitespace, fixed key order per entry) so byte-identical inputs produce byte-identical bundles. This is what makes--hashdistribution viable — same dir always hashes the same. - Fetch primitive: depends on a future "client fetch" helper (no client-side fetch path exists today —
crates/nodeonly hasprobe). Both--hashand per-entry fetches use the same primitive;--hashis not extra work beyond-ionce the primitive exists.
Documentation
- New
adr/appendix-bundles.md(short, ~1 page): JSON schema, path-safety rules, determinism requirement, the bundle-as-blob property (origins publish a hash, not a file), and the explicit non-relationship to ADR 012's chunk manifest. No new numbered ADR — bundles are a client-side convenience above the protocol, not a design decision the network depends on. - The appendix is the source of truth; CLI
--helptext and any future SDK helpers reference it.
Non-goals (v1)
- No publishing/pushing in
bundle create - No bundle-of-bundles / nested bundles
- No signing, encryption, or access control on bundle files
- No relationship to ADR 012's chunk manifest (intra-file vs. inter-file — orthogonal layers)
Checklist
-
adr/appendix-bundles.md— format spec, path-safety rules, determinism, bundle-as-blob -
decdn bundle create— directory walk, BLAKE3 hashing, sorted canonical JSON emit (unblocked) -
decdn bundle pull -i <file>— depends on a client-side fetch primitive (separate issue/PR) -
decdn bundle pull --hash <b3>— same primitive, one extra fetch up front
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
thiras commentedon May 6, 2026
Blocked by #421 —
decdn bundle …subcommands need to land on the client binary, which doesn't exist yet. Either land #421 first, or fold the binary split into the same PR as the firstbundlecommand.thiras commentedon May 6, 2026
Unblocked by #421 (merged in #425, commit ea01130). The user CLI now lives in
crates/cli/;decdn bundle pull/decdn bundle createland ondecdndirectly. Seeadr/appendix-binaries.mdfor the binary layout.feat(cli): bundle create + appendix-bundles.md (#391) (#469)
thiras commentedon Jun 2, 2026
Label/status note (issue-labeling audit):
bundle createhas since shipped —crates/cli/src/commands/bundle.rs(directory walk, BLAKE3 hashing, sorted canonical JSON emit) with coverage incrates/cli/tests/bundle_create.rs. The first two checklist items (appendix-bundles.md+bundle create) are effectively done.The
blockedlabel is retained because the remaining work —bundle pull -iandbundle pull --hash— is still gated on a client-side fetch primitive that doesn't exist yet. Once that primitive lands, the pull half can proceed and the label can drop.thiras commentedon Jun 3, 2026
Status update (labeling audit):
bundle createhas shipped —crates/cli/src/commands/bundle.rs,crates/common/src/cli/bundle.rs, theBundle(BundleArgs)CLI dispatch,crates/cli/tests/bundle_create.rs, andadr/appendix-bundles.mdare all inmain. That covers the first two checklist items (the appendix andbundle create).The remaining scope —
bundle pull -iandbundle pull --hash— is still blocked on the client-side fetch primitive (no client fetch path exists incrates/clitoday; see thePulldeferral note incrates/cli/src/commands/bundle.rs:24). Theblockedlabel now applies only to that remaining pull work.refactor(node): extract cdn/client/v1 requester into decdn-client-pul…
feat(cli): add decdn fetch with config-sourced relays
refactor(node): extract cdn/client/v1 requester into decdn-client-pul…
feat(cli): add decdn fetch with config-sourced relays
feat(cli): standalone client fetch (decdn fetch) + config-sourced rel…
feat(cli): auto-open, track, and reuse payment channels in decdn fetch (
feat: auto-open/track/reuse payment channels for decdn fetch (#940) (#…
feat(cli): decdn bundle pull — fetch a bundle's blobs (#391) (#945)