# tg `tg` is a command-line client for [Tangled](https://tangled.org), 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 ### Homebrew (stable, recommended, macOS+Linux) ```bash brew tap alyraffauf/tap brew trust alyraffauf/tap brew install alyraffauf/tap/tg ``` ### With Nix (latest dev release) ```bash nix profile add github:alyraffauf/tg ``` ### From source ```bash go install github.com/alyraffauf/tg/cmd/tg@latest ``` ## Quick start ```bash # 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 ``` `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: ```bash 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 ` to release blocked workflows, or `tg pipeline cancel ` to cancel them. To rerun a pipeline's stored specification, use `tg pipeline retry ` 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](internal/tangledlex/README.md#compatibility-review). ## MCP server The [tgmcp package](mcp/README.md) 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](SKILL.md) for using tg with a coding agent - Command reference — `tg --help`, the man pages installed by the Nix package (`man tg`, `man tg-issue-list`, ...), or the [website](https://tgcli.wisp.place/reference/commands/tg/) - [Authentication](https://tgcli.wisp.place/cookbooks/authentication/) — OAuth and app-password login, multiple accounts, keyring token storage - [Configuration](https://tgcli.wisp.place/cookbooks/configuration/) — config file, environment variables, and flags ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow and an overview of the codebase. ## License See [LICENSE](LICENSE.md).