Skip to main content

Authorized GraphQL CLI for Takt — full GraphQL surface from the shell, stdlib-only core

Project description

taktcli

Authorized GraphQL CLI for Takt — the full GraphQL surface from the shell, for agents and humans. Package and console-script are both named taktcli (bare takt is taken on PyPI).

The core is stdlib-only (urllib + argparse + json): argv → GraphQL-over-HTTP. It sidesteps the MCP client-serialization bug class entirely — argv strings can't be double-JSON-encoded. See PRD 002 in the Takt wiki (takt/dev/prd-002-taktcli).

Install

pip install taktcli            # stdlib-only core
pip install 'taktcli[watch]'   # + websockets, enables `taktcli watch`

From a checkout (monorepo subdir):

pip install -e cli/

Auth (PRD §6)

Resolution order, simplest-wins:

  • Token: TAKT_TOKEN env → ~/.takt/credentials.json → error Run: taktcli login (exit 3)
  • URL: TAKT_URL env → url in the credentials file → default https://api.takt.sh/graphql

~/.takt/credentials.json is plain JSON (no YAML dependency):

{ "token": "<jwt>", "url": "https://api.takt.sh/graphql" }

Login

taktcli login runs the OAuth 2.0 device-authorization grant: it prints a verification URL + user code, polls until you approve in the browser, then writes {token, url} to ~/.takt/credentials.json (mode 0600).

taktcli login                                       # default endpoint
taktcli login --url http://localhost:8454/graphql   # override the endpoint
taktcli logout                                      # remove the stored credential
taktcli whoami                                      # nickname + claims + active source

--url (highest) → TAKT_URL env → default decides where login authenticates. whoami reports which credential source is active (TAKT_TOKEN env vs the file).

Exit codes (PRD §4.3)

Code Meaning
0 success
1 GraphQL error (server reached; errors[] non-empty)
2 transport error (DNS/TCP/TLS/HTTP non-2xx/timeout)
3 config or usage error (no token, bad URL, unknown verb, missing flag)

extensions.code (e.g. LEASE_EXPIRED, ALREADY_CLAIMED) is preserved in error output so loops can branch on it.

Shared I/O flags (PRD §4)

  • --var KEY=VALUE (repeatable; value parsed as JSON when valid, else string)
  • --vars JSON / --vars-file PATH (- = stdin) — bulk variables
  • --field-file NAME=PATH (NAME=- = stdin) — inject a file's contents as a variable; the canonical path for large markdown
  • --raw — full envelope {data, errors, extensions}; default is pretty JSON of .data
  • --compact — single-line JSON

Variable precedence (lowest → highest): --vars-file < --vars < --var < --field-file.

Status

Implemented: A (foundation — package skeleton, transport, auth/URL resolution, shared I/O plumbing, CI/release), B (gql + schema passthrough), C (hot-path aliases + task …), D (wiki … + workspace …), G (login/logout/whoami), and H (label …, notif …, project …). Curated verbs each map to a GraphQL op via transport.execute; the wiki/workspace verbs take a global --wiki SLUG (default $TAKT_WIKI) and stream big markdown through --content-file/--old-file/--new-file (- = stdin).

label create is CLI-only (the MCP server never wrapped createLabel, but the GraphQL mutation exists). label update/delete are keyed by name and resolve the id client-side via the labels query, mirroring the MCP tools. project rename is name-only — slug changes are blocked on backend [[takt-304]]. Per the [[takt-83]] guardrail there is no claims/permission verb anywhere in the surface.

The remaining verb groups are stubs — running one exits 3 with a pointer to its implementing subtask (E media/file, F watch, J delete-result).

Release

Push a cli-v* tag (e.g. cli-v0.1.0) — .github/workflows/cli.yaml builds cli/ and OIDC trusted-publishes to PyPI. The tag must match the version in cli/pyproject.toml (CI asserts this).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taktcli-0.1.0.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taktcli-0.1.0-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file taktcli-0.1.0.tar.gz.

File metadata

  • Download URL: taktcli-0.1.0.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for taktcli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0dccdb1ad6cc8f7425216e19ea426b9d305e3da41218a99150d4521cdf4dfb82
MD5 7b3e86dfd9137d33d86a28460279a5a3
BLAKE2b-256 f59b7daa200c79c1c76c163fe4d5bf05c006d8e8274ab6326e65df2256fb76cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for taktcli-0.1.0.tar.gz:

Publisher: cli.yaml on muzhig/takt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file taktcli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: taktcli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for taktcli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bb7a79f72e78d36963e9bed92fe5eea28d37b33fc502144648978263eb0d284
MD5 ae630cc19f1aaf3c5f0485bd1b2cfafc
BLAKE2b-256 b0c1c4e7038d1ef1e9815a247b12dadda4f1d3c9bcef20c6f72f0fa3ec63aa00

See more details on using hashes here.

Provenance

The following attestation bundles were made for taktcli-0.1.0-py3-none-any.whl:

Publisher: cli.yaml on muzhig/takt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page