An unofficial terminal client for Tangled, optimized for humans and agents. tgcli.wisp.place
cli atproto go tangled
Go 89%
Python 9%
Nix <1%
JavaScript <1%
Astro <1%
Just <1%
Shell <1%
MDX <1%
TypeScript <1%

README.md

tg #

tg is a command-line client for Tangled, the git forge built on atproto. It is an analogue to the GitHub CLI (gh), using Bobbin for reads and authenticated PDS/knot writes.

Installation #

brew tap alyraffauf/tap
brew trust alyraffauf/tap
brew install alyraffauf/tap/tg

With Nix (latest dev release) #

nix profile add github:alyraffauf/tg

From source #

go install github.com/alyraffauf/tg/cmd/tg@latest

Quick start #

# Log in (OAuth, or pass an app password for headless use)
tg auth login alice.example.com

# Clone a repository
tg repo clone microcosm.blue/microcosm-rs

# Clone by repository DID
tg repo clone did:plc:example

# Work with issues and pull requests
tg issue list
tg issue create --body "Details" "Bug report"
git push origin HEAD
tg pr create --title "Add feature" --base origin/main
tg pr merge <rkey>

tg auto-detects the repository from Git remotes when run inside a cloned Tangled repo, checking origin first. It recognizes remotes that identify a repository by handle/repo or by repository DID. Hosted Tangled remotes support SSH, Git, HTTP, and HTTPS URLs. Custom Knot remotes support SSH and HTTPS URLs. tg verifies a custom Knot against the repository record before it accepts the remote.

When a repository record contains a repository DID, tg uses the DID in new Git remotes. Automatically selected Knots use the tangled.org proxy. An explicitly configured Knot uses a direct remote and the configured SSH port. These remotes remain valid after handle changes, repository renames, and transfers. If tg cannot resolve the repository record for an SSH clone, it creates a handle/repo remote and prints the resolution error as a warning.

New Tangled stack #

This checkout targets Tangled's next-dev protocols, pinned to upstream d7837a98aaf8cb9c7013b2b06319b64014943b29. It does not support the old appview. Set TG_APPVIEW or --appview to the new Bobbin endpoint during rollout. The default stays https://api.tangled.org until the launch endpoint is confirmed.

Issues and PRs are repository-owned tickets on their origin knot. Use --repo for edits outside a checkout. Existing OAuth accounts may need tg auth login again to grant the new record and RPC permissions.

PR creation and updates require a published source branch. Push the commits first. For a fork, set --repo to the target, --source-repo to the source, and --base to the target's local remote-tracking branch. Tg never pushes as part of a PR command.

Knots without social-write support remain read-only for ticket and comment operations. The pinned Bobbin parser does not ingest legacy PDS issue, state, or comment collections directly. Upstream has removed the web client's legacy fallback. Tg keeps legacy social writes disabled. Failed capability probes do not switch storage backends.

Issue and PR views expose uri and cid in JSON. Existing edit, close, and reopen commands accept --expected-cid to reject stale edits. Fork results include importStatus and importReason when available. Forking queries status once and returns immediately; pending, partial, and failed imports preserve the created repository and report warnings.

Upstream Knot defaults new repositories to SHA-256. An existing SHA-1 repository cannot push into a fresh SHA-256 repository, which limits repo create --push. The create API has no object-format option. Forks preserve the source format.

A saved knot change can succeed while its PDS attestation or Bobbin indexing is delayed. Check the result's warnings before repeating a mutation. Retry queued attestations without repeating the original operation:

tg auth attestations list --json
tg auth attestations retry --json

Queues are private to the selected account under $XDG_STATE_HOME/tg/attestations, or ~/.local/state/tg/attestations when the variable is unset. They contain record receipts, not credentials.

Repository JSON URIs identify manifests. Ticket URIs identify the repository account; the author field identifies the human author. PR completed states remain merged in tg output. Issues can also have a distinct completed state.

CI workflows can wait for approval. Use tg pipeline approve <id> to release blocked workflows, or tg pipeline cancel <id> to cancel them. To rerun a pipeline's stored specification, use tg pipeline retry <id> and optionally --workflow. Scheduled runs appear as schedule in pipeline listings. Manual triggers accept full 40- or 64-character commit hashes outside a checkout. Trigger results include every scheduled ID in pipelines and the server's message. The existing pipeline field contains the first ID, or an empty string when none were scheduled.

Log control events expose each step's outcome in JSON. Current upstream Spindle closes log streams without confirming completion. Tg preserves received events and reports that the logs may be incomplete. See the compatibility review.

MCP server #

The tgmcp package exposes Tangled tools to MCP clients. Run it from this checkout with nix run .#tgmcp. It uses tg from the same checkout.

Documentation #

  • Agent skill for using tg with a coding agent
  • Command reference — tg <command> --help, the man pages installed by the Nix package (man tg, man tg-issue-list, ...), or the website
  • Authentication — OAuth and app-password login, multiple accounts, keyring token storage
  • Configuration — config file, environment variables, and flags

Contributing #

See CONTRIBUTING.md for the development workflow and an overview of the codebase.

License #

See LICENSE.