@tangle-network/sandbox-cli 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -1,88 +1,308 @@
1
- # Tangle Hub CLI
1
+ ---
2
+ name: tangle-cli
3
+ description: Use when interacting with Tangle sandboxes, executing hub tools, managing agent tasks, operating on sandbox filesystems, building workflows, connecting to external providers, or setting up integrations and automations from a terminal. Triggers include tangle, tangle sandbox, tangle hub, tangle agent, tangle exec, tangle fs, tangle snapshot, tangle secret, tangle workflows, tangle hub connect, github, slack, google, microsoft, external connections, provider integrations, hub tools, or any tangle command.
4
+ ---
2
5
 
3
- Use this skill when an agent needs to discover or run Tangle Hub tools from a sandbox or local terminal.
6
+ # Tangle CLI
4
7
 
5
- ## Purpose
8
+ ## Overview
6
9
 
7
- Tangle Hub lets agents use connected provider tools through Tangle, without seeing provider OAuth tokens. MVP focuses on personal GitHub connections and read-only GitHub issue/PR tools.
10
+ `tangle` is the CLI for Tangle Sandbox operations create sandboxes, run agents, execute hub tools, manage files, secrets, snapshots, git, and more. All commands support `--help` for inline reference.
8
11
 
9
12
  ## Auth
10
13
 
11
- Use one auth mode:
14
+ Generic command auth modes, resolved in order:
12
15
 
13
- - Existing CLI auth from `tangle auth login` or saved profile.
14
- - `TANGLE_API_KEY` for API-key auth.
15
- - `TANGLE_HUB_CAPABILITY_TOKEN` for scoped sandbox/runtime execution.
16
+ | Priority | Source | Set via |
17
+ |----------|--------|--------|
18
+ | 1 | CLI flag | `--api-key <key>` |
19
+ | 2 | Env var | `TANGLE_API_KEY` or `SANDBOX_API_KEY` |
20
+ | 3 | Profile store | `tangle auth login` (keychain or file) |
16
21
 
17
- Never print provider tokens, API keys, OAuth codes, refresh tokens, client secrets, or capability tokens.
22
+ Hub commands resolve auth in this order:
18
23
 
19
- ## Workflow
24
+ | Priority | Source | Set via |
25
+ |----------|--------|--------|
26
+ | 1 | CLI flag | `--api-key <key>` |
27
+ | 2 | Hub capability | `TANGLE_HUB_CAPABILITY_TOKEN` |
28
+ | 3 | Env var | `TANGLE_API_KEY` or `SANDBOX_API_KEY` |
29
+ | 4 | Profile store | `tangle auth login` (keychain or file) |
20
30
 
21
- 1. Check auth and provider readiness:
31
+ **Inside a sandbox:** `tangle` is automatically authenticated. No extra auth needed commands work out of the box.
22
32
 
23
33
  ```bash
24
- tangle hub status --json
34
+ # Browser login (preferred)
35
+ tangle auth login
36
+
37
+ # Device-code login (headless)
38
+ tangle auth login --no-browser
39
+
40
+ # API key directly
41
+ tangle auth login --api-key sk-tan-...
42
+
43
+ # Check auth state
44
+ tangle auth status --json
45
+
46
+ # Named profiles for multiple accounts
47
+ tangle auth login --profile work
48
+ tangle auth profiles use work
25
49
  ```
26
50
 
27
- 2. Connect GitHub when no connection exists:
51
+ For hub env auth, set **exactly one** of `TANGLE_API_KEY`/`SANDBOX_API_KEY` or `TANGLE_HUB_CAPABILITY_TOKEN`.
52
+
53
+ ## Sandbox Lifecycle
28
54
 
29
55
  ```bash
30
- tangle hub connect github
56
+ # Create sandboxes
57
+ tangle sandbox create --name my-project
58
+ tangle sandbox create --name demo --template node-ts
59
+ tangle sandbox list
60
+ tangle sandbox get <id>
61
+ tangle sandbox stop <id>
62
+ tangle sandbox resume <id>
63
+ tangle sandbox delete <id>
64
+
65
+ # Network
66
+ tangle sandbox expose <id> --port 3000
67
+ tangle sandbox urls <id>
31
68
  ```
32
69
 
33
- 3. List sources and search tools:
70
+ ## Hub Full Workflow
71
+
72
+ Hub lets agents use connected provider tools (GitHub, etc.) through Tangle without seeing provider OAuth tokens.
73
+
74
+ ### Auth Check & Connection
34
75
 
35
76
  ```bash
36
- tangle hub tools sources --json
37
- tangle hub tools search github issues --provider github --json
77
+ # Check status first
78
+ tangle hub status --json
79
+
80
+ # Connect GitHub when no connection exists
81
+ tangle hub connect github
82
+ tangle hub connect github --no-browser # print URL instead of opening
83
+
84
+ # List connections
85
+ tangle hub connections --json
86
+ tangle hub connections revoke conn_xxx --force
38
87
  ```
39
88
 
40
- 4. Describe a tool before calling it:
89
+ ### Tool Discovery
90
+
91
+ Always follow: **sources → search → describe → call**
41
92
 
42
93
  ```bash
94
+ # List available tool sources (providers)
95
+ tangle hub tools sources --json
96
+
97
+ # Search for tools
98
+ tangle hub tools search "github issues" --provider github --json
99
+
100
+ # Describe a tool to see input/output schemas
43
101
  tangle hub tools describe github.issues.listIssues --json
44
102
  ```
45
103
 
46
- 5. Call tools with JSON input:
104
+ ### Tool Execution
105
+
106
+ Two equivalent commands — `call` and `exec`:
47
107
 
48
108
  ```bash
109
+ # Basic call: <path tokens...> <json-input>
49
110
  tangle hub call github issues listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}'
50
111
  tangle hub exec github.issues.listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}'
112
+
113
+ # With explicit connection
114
+ tangle hub call github issues createIssue '{"owner":"foo","repo":"bar","title":"Fix bug"}' --connection conn_xxx
51
115
  ```
52
116
 
53
- For policy-gated tools, approve and retry in one command:
117
+ ### Policy & Approvals
118
+
119
+ Tools default to `ask` policy — they pause and require approval on first use.
54
120
 
55
121
  ```bash
56
- tangle hub exec github.issues.create '{"owner":"tangle-network","repo":"agent-dev-container","title":"Bug"}' --approve
122
+ # List pending approvals
123
+ tangle hub approvals list
124
+ tangle hub approvals approve <approval-id>
125
+ tangle hub approvals deny <approval-id>
126
+
127
+ # Set policy to always allow (skip future approvals)
128
+ tangle hub permissions set --connection conn_xxx --action github.issues.listIssues --decision allow
129
+
130
+ # Set policy to always deny (block tool)
131
+ tangle hub permissions set --connection conn_xxx --action github.issues.deleteIssue --decision deny
132
+
133
+ # View current policies
134
+ tangle hub permissions list --connection conn_xxx
57
135
  ```
58
136
 
59
- Prefer `--json` for machine parsing where commands support it.
137
+ ### Auto-Approve Execution
60
138
 
61
- ## Connections
139
+ When you expect `HUB_APPROVAL_REQUIRED`, approve and retry in one command:
62
140
 
63
- List and revoke connections:
141
+ ```bash
142
+ tangle hub exec github.issues.create '{"owner":"foo","repo":"bar","title":"Bug"}' --approve
143
+ ```
144
+
145
+ ### Resume a Paused Execution
146
+
147
+ When an execution is paused by approval (inside a sandbox), resolve it:
64
148
 
65
149
  ```bash
66
- tangle hub connections --json
67
- tangle hub connections revoke conn_example --force
150
+ tangle hub resume <approval-id> --accept # approve and mint capability token
151
+ tangle hub resume <approval-id> --decline # deny
152
+ #Then rerun original exec with --approve
153
+ ```
154
+
155
+ ### GitHub App (repo-scoped token mint)
156
+
157
+ ```bash
158
+ # Mint a short-lived repo-scoped installation token (via hub)
159
+ tangle hub github-app mint-installation-token --repo-url https://github.com/owner/repo
68
160
  ```
69
161
 
70
- ## Approvals And Resume
162
+ ## Secrets
71
163
 
72
- `HUB_APPROVAL_REQUIRED` pauses an executor call and returns an approval object in the response details. Use approvals commands to inspect or resolve it:
164
+ Secrets are scoped to your account (or team). Use `--reveal` to see values.
73
165
 
74
166
  ```bash
75
- tangle hub approvals list
76
- tangle hub approvals approve <approval-id>
77
- tangle hub approvals deny <approval-id>
167
+ tangle secret create DATABASE_URL "postgres://..."
168
+ tangle secret create API_KEY # prompts interactively
169
+ tangle secret list
170
+ tangle secret show DATABASE_URL --reveal
171
+ tangle secret update DATABASE_URL "new-value"
172
+ tangle secret delete DATABASE_URL
173
+ ```
174
+
175
+ ## Snapshots & Checkpoints
176
+
177
+ ```bash
178
+ # Snapshots (point-in-time for cloning/restoring)
179
+ tangle snapshot create <sandbox-id>
180
+ tangle snapshot list <sandbox-id>
181
+ tangle snapshot restore <sandbox-id> <snapshot-id> # creates new sandbox
182
+ tangle snapshot revert <sandbox-id> <snapshot-id> # reverts in-place
183
+ tangle snapshot delete <sandbox-id> <snapshot-id>
184
+
185
+ # Checkpoints (lightweight, local)
186
+ tangle checkpoint create <id>
187
+ tangle checkpoint list|ls <id>
188
+ tangle checkpoint delete|rm <id> <checkpoint-id>
78
189
  ```
79
190
 
80
- `tangle hub resume <approval-id> --accept` is the approval-backed resume path for paused Hub executions. It resolves the approval and mints a short-lived capability token. It does not replay unknown input by itself; rerun the original `hub exec` with `--approve` for approve-and-retry automation.
191
+ ## Templates
192
+
193
+ ```bash
194
+ tangle template list
195
+ tangle template get <id-or-slug>
196
+ tangle template versions <id-or-slug>
197
+ tangle template publish <name> <snapshot-id> <sandbox-id>
198
+ tangle template publish-version <id-or-slug> <snapshot-id> <sandbox-id>
199
+ ```
200
+
201
+ ## Teams
202
+
203
+ ```bash
204
+ tangle team list
205
+ tangle team create my-team
206
+ tangle team switch my-team
207
+ tangle team current
208
+ tangle team clear
209
+ tangle team members
210
+ tangle team update-member <member-id>
211
+ tangle team invite user@example.com
212
+ tangle team leave [team]
213
+ tangle team transfer <new-owner-customer-id> [team]
214
+ tangle team accept <invitation-token>
215
+ tangle team revoke-invitation <invitation-id>
216
+ tangle team remove-member <member-id>
217
+ tangle team secret # Manage team secrets
218
+ tangle team templates # Manage team templates
219
+ tangle team invitations [team] # List pending/historical invitations
220
+ ```
221
+
222
+ ## Workflows
223
+
224
+ ```bash
225
+ tangle workflows validate workflow.yml
226
+ tangle workflows schema # print JSON Schema
227
+ tangle workflows create workflow.yml
228
+ tangle workflows list
229
+ tangle workflows get <id>
230
+ tangle workflows update <id> workflow.yml
231
+ tangle workflows delete <id>
232
+ ```
233
+
234
+ ## Other Commands
235
+
236
+ ```bash
237
+ # Usage & billing
238
+ tangle usage --json
239
+
240
+ # API key management (id.tangle.tools)
241
+ tangle keys list
242
+ tangle keys create "my-key"
243
+ tangle keys revoke <keyId>
244
+
245
+ # Backend agent management
246
+ tangle backend status <sandboxId>
247
+ tangle backend configure <sandboxId>
248
+ tangle backend restart <sandboxId>
249
+
250
+ # Environments
251
+ tangle env ls
252
+ tangle env get <id>
253
+
254
+ # Tools (mise)
255
+ tangle tools ls <id>
256
+ tangle tools install <id> python 3.12
257
+
258
+ # Batch tasks across sandboxes
259
+ tangle batch run --tasks tasks.json
260
+
261
+ # Intelligence reports
262
+ tangle intelligence sandbox <id>
263
+ tangle intelligence fleet <id>
264
+ tangle intelligence list
265
+ tangle intelligence get <job-id>
266
+
267
+ # Traces
268
+ tangle traces list
269
+ tangle traces get <traceId> --ndjson
270
+ tangle traces runs
271
+
272
+ # MCP bridge
273
+ tangle mcp serve <id>
274
+
275
+ # Preview links
276
+ tangle preview ls <id>
277
+ tangle preview create <id> 3000
278
+ tangle preview rm <id> <preview-id>
279
+
280
+ # Sandbox user permissions
281
+ tangle permissions list <sandboxId>
282
+ tangle permissions add <sandboxId> --userId <userId> --role editor
283
+ ```
284
+
285
+ ## Common Workflows
286
+
287
+ | Goal | Commands |
288
+ |------|----------|
289
+ | Spin up sandbox, run agent | `tangle sandbox create --name X` → `tangle agent task <id> "..."` |
290
+ | Connect GitHub, read issues | `tangle hub connect github` → `tangle hub tools search "issues" --provider github` → `tangle hub call github issues listIssues '{"owner":"X","repo":"Y"}'` |
291
+ | Push code from sandbox to GitHub | `tangle hub connect github` → `tangle git add <id> files` → `tangle git commit <id> -m "msg"` → `tangle git push <id>` |
292
+ | Save and restore state | `tangle snapshot create <id>` → ...work... → `tangle snapshot revert <id> <snap-id>` |
293
+ | Set secret for agent use | `tangle secret create GITHUB_TOKEN "..."` → agent reads via `process.env.GITHUB_TOKEN` |
294
+ | Set hub permissions | `tangle hub permissions set --connection conn_xxx --action github.issues.createIssue --decision allow` |
295
+ | Batch parallel agent tasks | `tangle batch run --tasks tasks.json` (array of `{sandboxId, message}`) |
296
+
297
+ ## Common Mistakes
298
+
299
+ - **Forgetting `--reveal` on `secret show`** — values are hidden by default for safety.
300
+ - **Using API-key env and `TANGLE_HUB_CAPABILITY_TOKEN` together for hub** — set exactly one env auth source, or use `--api-key` to override both.
301
+ - **Calling hub tools without `--approve` on first use** — use `--approve` or set policy to `allow` first.
302
+ - **Missing `--json` flag when piping output** — many commands need explicit `--json` for machine-readable output.
303
+ - **`tangle hub exec` vs `tangle exec`** — `hub exec` runs hub tools; `exec` runs shell commands in a sandbox.
304
+ - **`hub resume` doesn't replay** — after `hub resume --accept`, rerun original `hub exec` with `--approve`.
81
305
 
82
- ## Safety
306
+ ## Token Safety
83
307
 
84
- - Use `tools search`, then `tools describe`, then `call`.
85
- - Do not call unknown tools without inspecting schema.
86
- - Do not pass raw provider tokens to commands or env.
87
- - Treat `HUB_APPROVAL_REQUIRED` as approval-backed resume. Use `--approve` or `hub resume <approval-id> --accept`.
88
- - On `HUB_CONNECTION_MISSING`, run `tangle hub connect github`.
308
+ Never print or log these in output: provider tokens, API keys, OAuth codes, refresh tokens, client secrets, capability tokens. Use `--json` for redacted machine output where supported.