@withone/cli 1.19.0 → 1.20.1

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
@@ -162,6 +162,21 @@ one list
162
162
 
163
163
  You need the connection key (rightmost column) when executing actions.
164
164
 
165
+ ### `one connection delete <connection-key>`
166
+
167
+ Remove a connection by its key.
168
+
169
+ ```bash
170
+ one connection delete live::gmail::default::abc123
171
+ one connection rm live::gmail::default::abc123 # alias
172
+ ```
173
+
174
+ Shows the connection details and asks for confirmation before deleting. Use `--force` to skip the confirmation prompt.
175
+
176
+ | Option | What it does |
177
+ |--------|-------------|
178
+ | `-f, --force` | Skip confirmation prompt |
179
+
165
180
  ### `one platforms`
166
181
 
167
182
  Browse all 200+ available platforms.
@@ -76,6 +76,9 @@ var OneApi = class {
76
76
  } while (page <= totalPages);
77
77
  return allConnections;
78
78
  }
79
+ async deleteConnection(id) {
80
+ await this.requestFull({ path: `/vault/connections/${id}`, method: "DELETE" });
81
+ }
79
82
  async listPlatforms() {
80
83
  const allPlatforms = [];
81
84
  let page = 1;
@@ -89,7 +92,7 @@ var OneApi = class {
89
92
  return allPlatforms;
90
93
  }
91
94
  async searchActions(platform, query, agentType) {
92
- const isKnowledgeAgent = !agentType || agentType === "knowledge";
95
+ const isKnowledgeAgent = agentType === "knowledge";
93
96
  const queryParams = {
94
97
  query,
95
98
  limit: "5"
@@ -184,7 +187,7 @@ var OneApi = class {
184
187
  return { data: knowledge, etag: result.etag, status: result.status };
185
188
  }
186
189
  async searchActionsWithMeta(platform, query, agentType, ifNoneMatch) {
187
- const isKnowledgeAgent = !agentType || agentType === "knowledge";
190
+ const isKnowledgeAgent = agentType === "knowledge";
188
191
  const queryParams = {
189
192
  query,
190
193
  limit: "5"
@@ -779,7 +782,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
779
782
  if (flowStack.includes(resolvedKey)) {
780
783
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
781
784
  }
782
- const { loadFlow: loadFlow2 } = await import("./flow-runner-SHV6JPE6.js");
785
+ const { loadFlow: loadFlow2 } = await import("./flow-runner-UWZL2FPJ.js");
783
786
  const subFlow = loadFlow2(resolvedKey);
784
787
  const subContext = await executeFlow(
785
788
  subFlow,
@@ -4,7 +4,7 @@ import {
4
4
  loadFlow,
5
5
  resolveFlowPath,
6
6
  saveFlow
7
- } from "./chunk-SIZK6EAM.js";
7
+ } from "./chunk-DPOG6BQ5.js";
8
8
  export {
9
9
  FlowRunner,
10
10
  listFlows,
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  loadFlow,
12
12
  resolveFlowPath,
13
13
  saveFlow
14
- } from "./chunk-SIZK6EAM.js";
14
+ } from "./chunk-DPOG6BQ5.js";
15
15
 
16
16
  // src/index.ts
17
17
  import { createRequire as createRequire2 } from "module";
@@ -1394,6 +1394,65 @@ Add one with: ${pc4.cyan("one connection add gmail")}`,
1394
1394
  error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
1395
1395
  }
1396
1396
  }
1397
+ async function connectionDeleteCommand(connectionKey, options) {
1398
+ const apiKey = getApiKey();
1399
+ if (!apiKey) {
1400
+ error("Not configured. Run `one init` first.");
1401
+ }
1402
+ const api = new OneApi(apiKey, getApiBase());
1403
+ const spinner5 = createSpinner();
1404
+ spinner5.start("Finding connection...");
1405
+ let allConnections;
1406
+ try {
1407
+ allConnections = await api.listConnections();
1408
+ } catch (error2) {
1409
+ spinner5.stop("Failed to load connections");
1410
+ error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
1411
+ return;
1412
+ }
1413
+ const ac = getAccessControlFromAllSources();
1414
+ const allowedKeys = ac.connectionKeys || ["*"];
1415
+ const connections = allowedKeys.includes("*") ? allConnections : allConnections.filter((conn) => allowedKeys.includes(conn.key));
1416
+ const match = connections.find((conn) => conn.key === connectionKey);
1417
+ if (!match) {
1418
+ spinner5.stop("Connection not found");
1419
+ error(`No connection found with key: ${connectionKey}`);
1420
+ return;
1421
+ }
1422
+ const connection2 = match;
1423
+ spinner5.stop(`Found ${connection2.platform} (${connection2.state})`);
1424
+ if (!isAgentMode() && !options?.force) {
1425
+ console.log();
1426
+ console.log(` ${getStatusIndicator(connection2.state)} ${connection2.platform} ${pc4.dim(connection2.key)}`);
1427
+ console.log();
1428
+ const confirmed = await p4.confirm({
1429
+ message: "Are you sure you want to delete this connection?",
1430
+ initialValue: false
1431
+ });
1432
+ if (p4.isCancel(confirmed) || !confirmed) {
1433
+ p4.cancel("Deletion cancelled.");
1434
+ process.exit(0);
1435
+ }
1436
+ }
1437
+ const deleteSpinner = createSpinner();
1438
+ deleteSpinner.start("Deleting connection...");
1439
+ try {
1440
+ await api.deleteConnection(connection2.id);
1441
+ deleteSpinner.stop("Connection deleted");
1442
+ if (isAgentMode()) {
1443
+ json({
1444
+ deleted: true,
1445
+ platform: connection2.platform,
1446
+ key: connection2.key
1447
+ });
1448
+ return;
1449
+ }
1450
+ p4.log.success(`${pc4.green("\u2713")} ${connection2.platform} connection removed.`);
1451
+ } catch (error2) {
1452
+ deleteSpinner.stop("Failed to delete connection");
1453
+ error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
1454
+ }
1455
+ }
1397
1456
  function getStatusIndicator(state) {
1398
1457
  switch (state) {
1399
1458
  case "operational":
@@ -1630,7 +1689,7 @@ async function actionsSearchCommand(platform, query, options) {
1630
1689
  const spinner5 = createSpinner();
1631
1690
  spinner5.start(`Searching actions on ${pc6.cyan(platform)} for "${query}"...`);
1632
1691
  try {
1633
- const agentType = knowledgeAgent ? "knowledge" : options.type;
1692
+ const agentType = knowledgeAgent ? "knowledge" : options.type || "execute";
1634
1693
  const useCache = options.cache !== false;
1635
1694
  const cachePath = searchCachePath(platform, query, agentType || "knowledge");
1636
1695
  const cached = useCache ? readCache(cachePath) : null;
@@ -3826,6 +3885,7 @@ Search for actions, read their docs, and execute them. This is the core workflow
3826
3885
  **Quick start:**
3827
3886
  \`\`\`bash
3828
3887
  one --agent connection list # See connected platforms
3888
+ one --agent connection delete <connection-key> # Remove a connection
3829
3889
  one --agent actions search <platform> "<query>" -t execute # Find an action
3830
3890
  one --agent actions knowledge <platform> <actionId> # Read docs (REQUIRED)
3831
3891
  one --agent actions execute <platform> <actionId> <key> -d '{}' # Execute it
@@ -3909,6 +3969,14 @@ one --agent connection list
3909
3969
 
3910
3970
  Returns platforms, status, connection keys, and tags.
3911
3971
 
3972
+ ### 1b. Delete a Connection
3973
+
3974
+ \`\`\`bash
3975
+ one --agent connection delete <connection-key>
3976
+ \`\`\`
3977
+
3978
+ Removes a connection by its key. In agent mode, returns \`{"deleted": true, "platform": "...", "key": "..."}\`. The connection key comes from \`one connection list\`.
3979
+
3912
3980
  ### 2. Search Actions
3913
3981
 
3914
3982
  \`\`\`bash
@@ -4610,6 +4678,7 @@ program.name("one").option("--agent", "Machine-readable JSON output (no colors,
4610
4678
  Setup:
4611
4679
  one init Set up API key and install MCP server
4612
4680
  one add <platform> Connect a platform via OAuth (e.g. gmail, slack, shopify)
4681
+ one connection delete <key> Remove a connection (alias: one connection rm)
4613
4682
  one config Configure access control (permissions, scoping)
4614
4683
 
4615
4684
  Workflow (use these in order):
@@ -4687,6 +4756,9 @@ connection.command("add [platform]").alias("a").description("Add a new connectio
4687
4756
  connection.command("list").alias("ls").description("List your connections").option("-s, --search <query>", "Filter connections by platform name").option("-l, --limit <n>", "Max connections to return (agent mode default: 20)").action(async (options) => {
4688
4757
  await connectionListCommand(options);
4689
4758
  });
4759
+ connection.command("delete <connection-key>").alias("rm").description("Delete a connection").option("-f, --force", "Skip confirmation prompt").action(async (connectionKey, options) => {
4760
+ await connectionDeleteCommand(connectionKey, options);
4761
+ });
4690
4762
  program.command("platforms").alias("p").description("List available platforms").option("-c, --category <category>", "Filter by category").option("--json", "Output as JSON").action(async (options) => {
4691
4763
  await platformsCommand(options);
4692
4764
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -36,4 +36,4 @@
36
36
  "engines": {
37
37
  "node": ">=18"
38
38
  }
39
- }
39
+ }
@@ -34,6 +34,14 @@ one --agent connection list
34
34
 
35
35
  Returns connected platforms with their connection keys (needed for execution) and platform names in kebab-case (needed for searching).
36
36
 
37
+ ### 1b. Delete a connection
38
+
39
+ ```bash
40
+ one --agent connection delete <connection-key>
41
+ ```
42
+
43
+ Removes a connection. Returns `{"deleted": true, "platform": "...", "key": "..."}` on success. Use the connection key from `one --agent connection list`.
44
+
37
45
  ### 2. Search for the right action
38
46
 
39
47
  ```bash
@@ -126,3 +134,11 @@ If the user needs a platform that isn't connected yet, tell them to run:
126
134
  one add <platform>
127
135
  ```
128
136
  This is interactive and opens the browser for OAuth. After connecting, the platform will appear in `one --agent connection list`.
137
+
138
+ ## Removing Connections
139
+
140
+ To delete a connection that is no longer needed:
141
+ ```bash
142
+ one --agent connection delete <connection-key>
143
+ ```
144
+ The connection key comes from `one --agent connection list`. Returns `{"deleted": true, "platform": "...", "key": "..."}` on success.