$npx -y skills add superdesigndev/tools-registry --skill webHow to use the treg CLI (tools-registry) — call shared team tools without holding their credentials, and turn your local skills into shareable tools. Use when working with the treg command, or when you need to hit an upstream API (PostHog, GSC, Google Ads, Intercom, Stripe, …)
| 1 | # tools-registry — call shared tools, share your own |
| 2 | |
| 3 | A remote registry + **credential-injecting proxy**. You make the *real* upstream API call; it is |
| 4 | routed through the proxy, which injects the auth **server-side**. You never hold the secret. |
| 5 | |
| 6 | - **Endpoint:** `{BASE}` · **CLI:** `treg` · the CLI is a thin client over the API. |
| 7 | - **Auth:** every call sends `X-Treg-Token: <your token>`. |
| 8 | - **Core idea:** a **tool** = an upstream base URL + a list of credential **bindings**. A **skill/bundle** |
| 9 | = a recipe (SKILL.md) + its secrets + its tool(s). The proxy *relays, never models* the upstream. |
| 10 | |
| 11 | ## First: install + sign in |
| 12 | ```bash |
| 13 | curl -fsSL {BASE}/install.sh | sh # installs the CLI + points it here |
| 14 | treg login # browser sign-in (GitHub / Google / email code) — first login registers you |
| 15 | treg login --email you@company.com # terminal-only alternative (emailed 6-digit code) |
| 16 | treg login --token <per-org-token> # non-interactive (agents/CI) |
| 17 | ``` |
| 18 | Everything runs in your **active org** (first login creates a personal one). Team invites arrive by |
| 19 | email — see them with `treg invites`, accept with `treg accept` (or `treg org join <code>`). Switch |
| 20 | teams: `treg org switch <slug>`. |
| 21 | |
| 22 | ## Persona 1 — CONSUMER (call a tool you don't own the key for) |
| 23 | **You already know the upstream API. Just build the real request and prefix it.** No treg |
| 24 | vocabulary, no special params — use the API exactly as its own docs say: |
| 25 | ``` |
| 26 | <the real request>: GET https://api.intercom.io/conversations?per_page=5 |
| 27 | through treg: GET {BASE}/call/https://api.intercom.io/conversations?per_page=5 |
| 28 | + header: X-Treg-Token: <your token> |
| 29 | ``` |
| 30 | treg resolves the tool by the upstream host, injects the credential server-side, and relays |
| 31 | **everything faithfully** (method, all query params, your headers, cookies, body). Your |
| 32 | `X-Treg-Token` is stripped before the upstream sees it. Works for GET/POST/PUT/PATCH/DELETE. |
| 33 | |
| 34 | Discover what's registered: `treg tool ls` · `treg skill ls`. (CLI shorthand also exists: |
| 35 | `treg call <tool> <path>`, but the URL-passthrough above is the agent-native way.) |
| 36 | |
| 37 | **Run a registered CLI tool** — the command-line complement to `treg call` (which proxies HTTP |
| 38 | APIs). `treg run <tool> -- <cli args>` runs a vendor CLI (stripe, gh, vercel, gcloud…) with the key |
| 39 | injected, so you never hold or log into it. Two tiers: `--local` (default, runs on this machine) · |
| 40 | `--server` (runs on the registry server, key never reaches here). `treg runs` is the run audit log. |
| 41 | ``` |
| 42 | treg run stripe -- get /v1/balance # local |
| 43 | treg run --server agentmail-cli inboxes list # server-side |
| 44 | ``` |
| 45 | |
| 46 | ## Persona 2 — CREATOR (turn keys + local skills into shared tools) |
| 47 | **Bulk (the fast path):** point treg at a directory — it detects provider keys in the `.env` AND |
| 48 | scans skill subdirs, then registers what you pick: |
| 49 | ```bash |
| 50 | treg upload # both sides of the cwd; `treg upload env|skills --dir <d>` to restrict |
| 51 | ``` |
| 52 | **Default: wrap new keys in a skill.** When registering a new key/endpoint/CLI, pair it with |
| 53 | a skill so credential, tool, and recipe land together (and it gets a shareable page). If no |
| 54 | skill exists, create a basic one — a proper SKILL.md (frontmatter matters: agents discover |
| 55 | skills by it) + one example call: |
| 56 | ```bash |
| 57 | mkdir -p ./posthog && cat > ./posthog/SKILL.md <<'MD' |
| 58 | --- |
| 59 | name: posthog |
| 60 | description: Query the PostHog analytics API through treg — the key is injected server-side. Use for events, insights, and project queries. |
| 61 | --- |
| 62 | Call it: `treg call posthog api/projects/@current` (upstream: https://us.posthog.com) |
| 63 | MD |
| 64 | treg skill init --dir ./posthog # drafts treg.json: base_url from the catalog (folder name) or URLs in SKILL.md; review it + add the key |
| 65 | treg skill add --dir ./posthog # registers recipe + secret + tool atomically |
| 66 | ``` |
| 67 | **Never orphan a secret:** a stored key nothing binds is dead weight — if you use `secret add` |
| 68 | directly, bind it to a tool (endpoint/CLI) in the same breath. |
| 69 | **Bare endpoint, no recipe (only when a skill adds nothing):** |
| 70 | ```bash |
| 71 | treg secret add posthog-key --value "$POSTHOG_API_KEY" # or --file ./.secret/token.json |
| 72 | treg tool add posthog --base-url https://us.posthog.com --secret posthog-key |
| 73 | # query-key API instead of a bearer header: |
| 74 | treg tool add serpapi --base-url https://serpapi.com --secret <name-or-id> \ |
| 75 | --auth-in query --auth-name api_key --auth-format '{secret}' |
| 76 | ``` |
| 77 | **A whole skill (recipe + secrets + tool, possibly multi-credentia |