Add Tangled forge support#120
Conversation
# Conflicts: # internal/cli/auth.go # internal/config/config.go
There was a problem hiding this comment.
Pull request overview
Adds initial Tangled.org support as a new forge backend, integrating it into detection, resolution, configuration, and the CLI so the project can interact with Tangled repositories through the existing normalized interfaces.
Changes:
- Introduce new
tangledforge type and wire it into client registration, resolver defaults, CLI flags/help, and docs. - Add Tangled API detection via
/xrpc/sh.tangled.knot.versionplusTANGLED_TOKENenvironment variable support. - Implement read-only Tangled adapter capabilities for repo metadata, branches, tags, and tree listing, with accompanying tests.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| types.go | Adds the Tangled forge type constant. |
| detect.go | Adds Tangled API probing via the XRPC version endpoint. |
| forge.go | Extends ForgeBuilders and domain registration to support Tangled. |
| forges_test.go | Adds detection test coverage for Tangled’s XRPC endpoint. |
| internal/resolve/resolve.go | Wires Tangled into resolver builders, defaults, and forge-type dispatch. |
| internal/resolve/resolve_test.go | Adds tests for Tangled token lookup and default domain mapping. |
| internal/config/config.go | Updates config type documentation to include tangled. |
| internal/config/config_test.go | Skips token-cmd execution tests on Windows (where unsupported). |
| internal/cli/root.go | Updates CLI help text to include Tangled. |
| internal/cli/auth.go | Adds Tangled to auth CLI help and known-domain env token checks. |
| internal/cli/repo_test.go | Adds Tangled to forge-type → domain mapping tests. |
| README.md | Documents Tangled support, builder registration, and TANGLED_TOKEN. |
| tangled/tangled.go | Implements core Tangled forge client: XRPC helpers + HTML metadata parsing. |
| tangled/repos.go | Implements Tangled repo metadata retrieval and tag listing. |
| tangled/branches.go | Implements Tangled branch listing via XRPC. |
| tangled/files.go | Implements Tangled tree listing via XRPC. |
| tangled/url.go | Adds Tangled URL path parsing into ResourceRef. |
| tangled/unsupported.go | Provides ErrNotSupported stubs for unsupported services. |
| tangled/tangled_test.go | Adds tests for metadata parsing and XRPC-backed branches/tags/tree behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
andrew
left a comment
There was a problem hiding this comment.
Thanks for this — the adapter follows the gitea/gerrit shape nicely and the Copilot fixes (DID reuse, io.LimitReader) look good.
A few things before merging:
Unrelated changes (same as #119):
internal/config/config_test.goadds Windows skips toTestLoadFileTokenCommandandTestLoadFileTokenCommandForgeDomain. Main runs both on Windows since #131 — please drop those 8 lines.internal/cli/auth.go:87adds "(Unix only)" to the--token-cmdhelp text; same #131 regression, please drop.- The branch now conflicts with main in exactly those two files, so rebasing will surface both.
Adapter:
tangled/branches.go:28(andrepos.go:81,files.go:30) — the XRPCrepoparam is set to just the owner DID; the repo name/rkey is never sent.parseRepoMetamatchesat://<did>/sh.tangled.repo/<rkey>but only captures the DID. For an owner with more than one repo, which repo doeslistBranches?repo=<did>return? If the endpoint needs the rkey or repo name,repoDIDshould return/thread that through.tangled/repos.go:41—DefaultBranchisbranches[0].Namefrom aLimit: 1call. Nothing guarantees the first branch is the default; the entries carry aDefaultbool that isn't checked. Either scan forDefault, or drop this and leaveDefaultBranchempty for now.
Minor: WikiURL/ReleasesURL build /wiki and /releases paths Tangled doesn't have — returning repoHTMLURL would match what we did for Gerrit. Not blocking.
|
Done, thanks.
|
closes #13
Summary
Adds initial Tangled.org support as a forge backend.
This includes:
tangledforge type/xrpc/sh.tangled.knot.versionTANGLED_TOKENenvironment variable supportTesting
env GOCACHE=/private/tmp/forge-gocache go test ./... git diff --checkNote: Operations that cannot be safely represented by the current interfaces, especially issue/PR APIs that require numeric IDs, return
ErrNotSupported.