@withone/cli 1.12.2

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 ADDED
@@ -0,0 +1,380 @@
1
+ # One CLI
2
+
3
+ One CLI to connect AI agents to every API on the internet.
4
+
5
+ One gives your AI agent authenticated access to 200+ platforms — Gmail, Slack, Shopify, HubSpot, Stripe, Notion, and everything else — through a single interface. No API keys to juggle, no OAuth flows to build, no request formats to memorize. Connect a platform once, and your agent can search for actions, read the docs, and execute API calls in seconds.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npx @picahq/cli@latest init
11
+ ```
12
+
13
+ Or install globally:
14
+
15
+ ```bash
16
+ npm install -g @picahq/cli
17
+ one init
18
+ ```
19
+
20
+ `one init` walks you through setup: enter your [API key](https://app.withone.ai/settings/api-keys), pick your AI agents, and you're done. The MCP server gets installed automatically.
21
+
22
+ Requires Node.js 18+.
23
+
24
+ ## Quick start
25
+
26
+ ```bash
27
+ # Connect a platform
28
+ one add gmail
29
+
30
+ # See what you're connected to
31
+ one list
32
+
33
+ # Search for actions you can take
34
+ one actions search gmail "send email" -t execute
35
+
36
+ # Read the docs for an action
37
+ one actions knowledge gmail <actionId>
38
+
39
+ # Execute it
40
+ one actions execute gmail <actionId> <connectionKey> \
41
+ -d '{"to": "jane@example.com", "subject": "Hello", "body": "Sent from my AI agent"}'
42
+ ```
43
+
44
+ That's it. Five commands to go from zero to sending an email through Gmail's API — fully authenticated, correctly formatted, without touching a single OAuth token.
45
+
46
+ ### Multi-step flows
47
+
48
+ Chain actions across platforms into reusable workflows:
49
+
50
+ ```bash
51
+ # Create a flow that looks up a Stripe customer and sends a Gmail welcome email
52
+ one flow create welcome-customer --definition '{
53
+ "key": "welcome-customer",
54
+ "name": "Welcome New Customer",
55
+ "version": "1",
56
+ "inputs": {
57
+ "stripeKey": { "type": "string", "required": true, "connection": { "platform": "stripe" } },
58
+ "gmailKey": { "type": "string", "required": true, "connection": { "platform": "gmail" } },
59
+ "email": { "type": "string", "required": true }
60
+ },
61
+ "steps": [
62
+ { "id": "find", "name": "Find customer", "type": "action",
63
+ "action": { "platform": "stripe", "actionId": "<actionId>", "connectionKey": "$.input.stripeKey",
64
+ "data": { "query": "email:'\''{{$.input.email}}'\''" } } },
65
+ { "id": "send", "name": "Send email", "type": "action",
66
+ "if": "$.steps.find.response.data.length > 0",
67
+ "action": { "platform": "gmail", "actionId": "<actionId>", "connectionKey": "$.input.gmailKey",
68
+ "data": { "to": "{{$.input.email}}", "subject": "Welcome!", "body": "Thanks for joining." } } }
69
+ ]
70
+ }'
71
+
72
+ # Validate it
73
+ one flow validate welcome-customer
74
+
75
+ # Run it — connection keys auto-resolve if you have one connection per platform
76
+ one flow execute welcome-customer -i email=jane@example.com
77
+ ```
78
+
79
+ Workflows are stored as JSON at `.one/flows/<key>.flow.json` and support conditions, loops, parallel steps, transforms, and more. Run `one guide flows` for the full reference.
80
+
81
+ ## How it works
82
+
83
+ ```
84
+ Your AI Agent
85
+
86
+ One CLI
87
+
88
+ One API (api.withone.ai/v1/passthrough)
89
+
90
+ Gmail / Slack / Shopify / HubSpot / Stripe / ...
91
+ ```
92
+
93
+ Every API call routes through One's passthrough proxy. One injects the right credentials, handles rate limiting, and normalizes responses. You never see or manage raw OAuth tokens — your connection key is all you need.
94
+
95
+ ## Commands
96
+
97
+ ### `one init`
98
+
99
+ Set up your API key and install the MCP server into your AI agents.
100
+
101
+ ```bash
102
+ one init
103
+ ```
104
+
105
+ Supports Claude Code, Claude Desktop, Cursor, Windsurf, Codex, and Kiro. Installs globally by default, or per-project with `-p` so your team can share configs (each person uses their own API key).
106
+
107
+ If you've already set up, `one init` shows your current status and lets you update your key, install to more agents, or reconfigure.
108
+
109
+ | Flag | What it does |
110
+ |------|-------------|
111
+ | `-y` | Skip confirmations |
112
+ | `-g` | Install globally (default) |
113
+ | `-p` | Install for current project only |
114
+
115
+ ### `one add <platform>`
116
+
117
+ Connect a new platform via OAuth.
118
+
119
+ ```bash
120
+ one add shopify
121
+ one add hub-spot
122
+ one add gmail
123
+ ```
124
+
125
+ Opens your browser, you authorize, done. The CLI polls until the connection is live. Platform names are kebab-case — run `one platforms` to see them all.
126
+
127
+ ### `one list`
128
+
129
+ List your active connections with their status and connection keys.
130
+
131
+ ```bash
132
+ one list
133
+ ```
134
+
135
+ ```
136
+ ● gmail operational live::gmail::default::abc123
137
+ ● slack operational live::slack::default::def456
138
+ ● shopify operational live::shopify::default::ghi789
139
+ ```
140
+
141
+ You need the connection key (rightmost column) when executing actions.
142
+
143
+ ### `one platforms`
144
+
145
+ Browse all 200+ available platforms.
146
+
147
+ ```bash
148
+ one platforms # all platforms
149
+ one platforms -c "CRM" # filter by category
150
+ one platforms --json # machine-readable output
151
+ ```
152
+
153
+ ### `one actions search <platform> <query>`
154
+
155
+ Search for API actions on a connected platform using natural language.
156
+
157
+ ```bash
158
+ one actions search shopify "list products"
159
+ one actions search hub-spot "create contact" -t execute
160
+ one actions search gmail "send email"
161
+ ```
162
+
163
+ Returns the top 5 matching actions with their action IDs, HTTP methods, and paths. Use `-t execute` when you intend to run the action, or `-t knowledge` (default) when you want to learn about it or write code against it.
164
+
165
+ ### `one actions knowledge <platform> <actionId>`
166
+
167
+ Get the full documentation for an action — parameters, validation rules, request/response structure, examples, and the exact API request format.
168
+
169
+ ```bash
170
+ one actions knowledge shopify 67890abcdef
171
+ ```
172
+
173
+ Always read the knowledge before executing. It tells you exactly what parameters are required, what format they need, and any platform-specific quirks.
174
+
175
+ ### `one actions execute <platform> <actionId> <connectionKey>`
176
+
177
+ Execute an API action on a connected platform.
178
+
179
+ ```bash
180
+ # Simple GET
181
+ one actions execute shopify <actionId> <connectionKey>
182
+
183
+ # POST with data
184
+ one actions execute hub-spot <actionId> <connectionKey> \
185
+ -d '{"properties": {"email": "jane@example.com", "firstname": "Jane"}}'
186
+
187
+ # With path variables
188
+ one actions execute shopify <actionId> <connectionKey> \
189
+ --path-vars '{"order_id": "12345"}'
190
+
191
+ # With query params
192
+ one actions execute stripe <actionId> <connectionKey> \
193
+ --query-params '{"limit": "10"}'
194
+ ```
195
+
196
+ | Option | What it does |
197
+ |--------|-------------|
198
+ | `-d, --data <json>` | Request body (POST, PUT, PATCH) |
199
+ | `--path-vars <json>` | Replace `{variables}` in the URL path |
200
+ | `--query-params <json>` | Query string parameters |
201
+ | `--headers <json>` | Additional request headers |
202
+ | `--form-data` | Send as multipart/form-data |
203
+ | `--form-url-encoded` | Send as application/x-www-form-urlencoded |
204
+ | `--dry-run` | Show the request without executing it |
205
+
206
+ ### `one guide [topic]`
207
+
208
+ Get the full CLI usage guide, designed for AI agents that only have the binary (no MCP, no IDE skills).
209
+
210
+ ```bash
211
+ one guide # full guide (all topics)
212
+ one guide overview # setup, --agent flag, discovery workflow
213
+ one guide actions # search, knowledge, execute workflow
214
+ one guide flows # multi-step API workflows
215
+
216
+ one --agent guide # full guide as structured JSON
217
+ one --agent guide flows # single topic as JSON
218
+ ```
219
+
220
+ Topics: `overview`, `actions`, `flows`, `all` (default).
221
+
222
+ In agent mode (`--agent`), the JSON response includes the guide content and an `availableTopics` array so agents can discover what sections exist.
223
+
224
+ ### `one flow create [key]`
225
+
226
+ Create a workflow from a JSON definition. Workflows are saved to `.one/flows/<key>.flow.json`.
227
+
228
+ ```bash
229
+ # From a --definition flag
230
+ one flow create welcome-customer --definition '{"key":"welcome-customer","name":"Welcome","version":"1","inputs":{},"steps":[]}'
231
+
232
+ # From stdin
233
+ cat flow.json | one flow create
234
+
235
+ # Custom output path
236
+ one flow create my-flow --definition '...' -o ./custom/path.json
237
+ ```
238
+
239
+ | Option | What it does |
240
+ |--------|-------------|
241
+ | `--definition <json>` | Workflow definition as a JSON string |
242
+ | `-o, --output <path>` | Custom output path (default: `.one/flows/<key>.flow.json`) |
243
+
244
+ ### `one flow execute <key>`
245
+
246
+ Execute a workflow by key or file path. Pass inputs with repeatable `-i` flags.
247
+
248
+ ```bash
249
+ # Execute with inputs
250
+ one flow execute welcome-customer \
251
+ -i customerEmail=jane@example.com
252
+
253
+ # Dry run — validate and show plan without executing
254
+ one flow execute welcome-customer --dry-run -i customerEmail=jane@example.com
255
+
256
+ # Verbose — show each step as it runs
257
+ one flow execute welcome-customer -v -i customerEmail=jane@example.com
258
+ ```
259
+
260
+ Connection inputs with a `connection` field in the workflow definition are auto-resolved when the user has exactly one connection for that platform.
261
+
262
+ Press Ctrl+C during execution to pause — the run can be resumed later with `one flow resume <runId>`.
263
+
264
+ | Option | What it does |
265
+ |--------|-------------|
266
+ | `-i, --input <name=value>` | Input parameter (repeatable) |
267
+ | `--dry-run` | Validate and show execution plan without running |
268
+ | `-v, --verbose` | Show full request/response for each step |
269
+
270
+ ### `one flow list`
271
+
272
+ List all workflows saved in `.one/flows/`.
273
+
274
+ ```bash
275
+ one flow list
276
+ ```
277
+
278
+ ### `one flow validate <key>`
279
+
280
+ Validate a workflow JSON file against the schema.
281
+
282
+ ```bash
283
+ one flow validate welcome-customer
284
+ ```
285
+
286
+ ### `one flow resume <runId>`
287
+
288
+ Resume a paused or failed workflow run from where it left off.
289
+
290
+ ```bash
291
+ one flow resume abc123
292
+ ```
293
+
294
+ ### `one flow runs [flowKey]`
295
+
296
+ List workflow runs, optionally filtered by workflow key.
297
+
298
+ ```bash
299
+ one flow runs # all runs
300
+ one flow runs welcome-customer # runs for a specific workflow
301
+ ```
302
+
303
+ ### `one config`
304
+
305
+ Configure access control for the MCP server. Optional — full access is the default.
306
+
307
+ ```bash
308
+ one config
309
+ ```
310
+
311
+ | Setting | Options | Default |
312
+ |---------|---------|---------|
313
+ | Permission level | `admin` / `write` / `read` | `admin` |
314
+ | Connection scope | All or specific connections | All |
315
+ | Action scope | All or specific action IDs | All |
316
+ | Knowledge-only mode | Enable/disable execution | Off |
317
+
318
+ Settings propagate automatically to all installed agent configs.
319
+
320
+ ## The workflow
321
+
322
+ The power of One is in the workflow. Every interaction follows the same pattern:
323
+
324
+ ```
325
+ one list → What am I connected to?
326
+ one actions search → What can I do?
327
+ one actions knowledge → How do I do it?
328
+ one actions execute → Do it.
329
+ ```
330
+
331
+ This is the same workflow whether you're sending emails, creating CRM contacts, processing payments, managing inventory, or posting to Slack. One pattern, any platform.
332
+
333
+ For multi-step workflows that chain actions across platforms:
334
+
335
+ ```
336
+ one actions knowledge → Learn each action's schema
337
+ one flow create → Define the workflow as JSON
338
+ one flow validate → Check it
339
+ one flow execute → Run it
340
+ ```
341
+
342
+ Workflows support conditions, loops, parallel execution, transforms, code steps, and file I/O. Run `one guide flows` for the full schema reference and examples.
343
+
344
+ ## For AI agents
345
+
346
+ If you're an AI agent with only the `one` binary (no MCP server or IDE skills), start with `one --agent guide` to get the full usage guide as structured JSON. This teaches you the complete workflow, JSON schemas, selector syntax, and more — everything you need to bootstrap yourself.
347
+
348
+ If you're an AI agent using the One MCP server, the tools map directly:
349
+
350
+ | MCP Tool | CLI Command |
351
+ |----------|------------|
352
+ | `list_one_integrations` | `one list` + `one platforms` |
353
+ | `search_one_platform_actions` | `one actions search` |
354
+ | `get_one_action_knowledge` | `one actions knowledge` |
355
+ | `execute_one_action` | `one actions execute` |
356
+
357
+ The workflow is the same: list → search → knowledge → execute. Never skip the knowledge step — it contains required parameter info and platform-specific details that are critical for building correct requests.
358
+
359
+ ## MCP server installation
360
+
361
+ `one init` handles this automatically. Here's where configs go:
362
+
363
+ | Agent | Global | Project |
364
+ |-------|--------|---------|
365
+ | Claude Code | `~/.claude.json` | `.mcp.json` |
366
+ | Claude Desktop | Platform-specific app support dir | — |
367
+ | Cursor | `~/.cursor/mcp.json` | `.cursor/mcp.json` |
368
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` | — |
369
+ | Codex | `~/.codex/config.toml` | `.codex/config.toml` |
370
+ | Kiro | `~/.kiro/settings/mcp.json` | `.kiro/settings/mcp.json` |
371
+
372
+ Project configs can be committed to your repo. Each team member runs `one init` with their own API key.
373
+
374
+ ## Development
375
+
376
+ ```bash
377
+ npm run dev # watch mode
378
+ npm run build # production build
379
+ npm run typecheck # type check
380
+ ```
package/bin/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import '../dist/index.js';
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node