Skip to content

feat(cli): accept native ipfs:// and ipns:// URIs#11375

Merged
lidel merged 8 commits into
masterfrom
feat/native-ipfs-uris
Jul 2, 2026
Merged

feat(cli): accept native ipfs:// and ipns:// URIs#11375
lidel merged 8 commits into
masterfrom
feat/native-ipfs-uris

Conversation

@lidel

@lidel lidel commented Jul 1, 2026

Copy link
Copy Markdown
Member

Commands now accept native IPFS URIs like ipfs://cid and ipns://name (and the schemeless ipfs:cid / ipns:name forms), so you can paste a link straight from a browser or another tool instead of rewriting it into an /ipfs/ path first.

This is backward-compatible: /ipfs/cid paths and bare CIDs still work exactly as they did before, and a URI is just one more accepted form. Each URI is normalized to the equivalent content path at the input boundary, so most commands need no change and the diff here is small.

Thus PR depends only on the boxo NewPathFromURI added in

Commands that take a content path or CID now also accept native IPFS
URIs (ipfs://cid, ipns://name, and the schemeless ipfs:/ipns: forms),
so a URI copied from a browser or another tool works as-is.

- cmdutils: PathOrCidPath parses via boxo NewPathFromURI; new
  CidFromArg for raw-CID commands takes the root CID and rejects
  sub-paths and mutable IPNS.
- files: cp/stat sources and getNodeFromPath accept URIs and content
  paths; chroot takes its CID via CidFromArg.
- resolve and name resolve normalize URIs before the namespace checks;
  name resolve stays IPNS-only.
- routing, provide, filestore, pin remote: raw-CID args via CidFromArg.

Depends on boxo NewPathFromURI (ipfs/boxo#1182); go.mod pins the PR
commit until it is released.
@gammazero gammazero marked this pull request as ready for review July 1, 2026 05:10
@gammazero gammazero requested a review from a team as a code owner July 1, 2026 05:10
lidel added 2 commits July 2, 2026 01:55
#11374 made telemetry opt-in and rewrote the explicit "off" mode to no
longer log "telemetry disabled via opt-out", but the opt-out subtests
still assert that string, so TestTelemetry is red on master. Assert the
"telemetry collection skipped: opted out" message the daemon emits
whenever telemetry is off.
@helia/interop v11.0.0+ ships without .aegir.js (ipfs/helia#1049), so
aegir test finds no specs and the interop job fails. Inject a minimal
config pointing at the prebuilt dist specs when it is missing.

Helia's own .aegir.js can't be reused as-is: it globs source .ts specs
that Node won't run from node_modules. The same omission regressed
before (ipfs/helia#1001, fixed by ipfs/helia#1003); see the comment.
Comment on lines +91 to +116
# Recurring @helia/interop regression: the package periodically ships
# without .aegir.js in its published "files", so `aegir test` has no config
# and discovers no spec files. It slipped in once around ipfs/helia#1001 and
# was fixed by ipfs/helia#1003 (titled "fix: restore aegir file in interop
# suite"), then regressed again in ipfs/helia#1049 ("feat!: make libp2p
# optional"), which dropped the file in the v11 major (first broken release
# 11.0.0 on 2026-06-29; 11.0.1 and 11.0.2 inherit it).
#
# We write a minimal config rather than fetching helia's own .aegir.js from
# the matching interop-v<version> tag: that file globs its tests at TypeScript
# sources (./src/*.spec.ts), which Node refuses to run from inside node_modules
# (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING, no tsconfig is shipped), and the
# rest of it is browser-only setup skipped under `-t node`. Pointing at the
# prebuilt ./dist/src is all the node run needs, and is what helia's own
# helia-interop bin runs. This keeps coming back, so it is the cheapest fix
# for now; it writes into node_modules and is fragile if helia's dist layout
# shifts. Drop it once helia ships .aegir.js in a published release again.
- name: Work around missing @helia/interop/.aegir.js (ipfs/helia#1049)
run: |
config=node_modules/@helia/interop/.aegir.js
if [ ! -f "$config" ]; then
echo "export default { test: { files: './dist/src/*.spec.js' } }" > "$config"
echo "injected minimal $config"
else
echo "$config already present, no workaround needed"
fi

@lidel lidel Jul 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@achingbrain I've added this workaround and it works but is there a chance for upstream fix in @helia/interop?

(original error without this was: https://github.com/ipfs/kubo/actions/runs/28540221250/job/84611955412)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oops, I've landed the upstream fix & shipped it, sorry for the disruption.

The node interop specs leave kubo daemon and libp2p handles open, so
mocha prints "N passing" and then hangs until the job timeout instead
of exiting. Pass --exit so mocha quits once the run completes.
achingbrain added a commit to ipfs/helia that referenced this pull request Jul 2, 2026
Fixes regression introduced in #1049 - this file should be part of
the published module.

Refs: ipfs/kubo#11375
@lidel lidel merged commit 4c227f0 into master Jul 2, 2026
24 checks passed
@lidel lidel deleted the feat/native-ipfs-uris branch July 2, 2026 08:33
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.

3 participants