@tangle-network/sandbox-cli 0.2.8 → 0.2.10

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