@cargo-ai/cli 1.0.7 → 1.0.9
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/build/commands/ai/agent.d.ts.map +1 -1
- package/build/commands/ai/agent.js +24 -14
- package/build/commands/ai/chat.d.ts.map +1 -1
- package/build/commands/ai/chat.js +21 -11
- package/build/commands/ai/mcpClient.d.ts.map +1 -1
- package/build/commands/ai/mcpClient.js +12 -6
- package/build/commands/ai/mcpServer.d.ts.map +1 -1
- package/build/commands/ai/mcpServer.js +32 -11
- package/build/commands/ai/message.d.ts.map +1 -1
- package/build/commands/ai/message.js +43 -21
- package/build/commands/ai/prompt.d.ts.map +1 -1
- package/build/commands/ai/prompt.js +23 -9
- package/build/commands/ai/release.d.ts.map +1 -1
- package/build/commands/ai/release.js +42 -42
- package/build/commands/ai/suggestedAction.js +3 -3
- package/build/commands/auth.d.ts.map +1 -1
- package/build/commands/auth.js +14 -3
- package/build/commands/connection/connector.d.ts.map +1 -1
- package/build/commands/connection/connector.js +23 -18
- package/build/commands/connection/integration.d.ts.map +1 -1
- package/build/commands/connection/integration.js +9 -9
- package/build/commands/expression/expressionEval.d.ts.map +1 -1
- package/build/commands/expression/expressionEval.js +10 -7
- package/build/commands/orchestration/batch.d.ts.map +1 -1
- package/build/commands/orchestration/batch.js +31 -25
- package/build/commands/orchestration/index.d.ts.map +1 -1
- package/build/commands/orchestration/index.js +2 -0
- package/build/commands/orchestration/log.d.ts +4 -0
- package/build/commands/orchestration/log.d.ts.map +1 -0
- package/build/commands/orchestration/log.js +122 -0
- package/build/commands/orchestration/node.d.ts.map +1 -1
- package/build/commands/orchestration/node.js +16 -14
- package/build/commands/orchestration/play.d.ts.map +1 -1
- package/build/commands/orchestration/play.js +15 -7
- package/build/commands/orchestration/release.d.ts.map +1 -1
- package/build/commands/orchestration/release.js +6 -4
- package/build/commands/orchestration/run.d.ts.map +1 -1
- package/build/commands/orchestration/run.js +103 -82
- package/build/commands/segmentation/segment.d.ts.map +1 -1
- package/build/commands/segmentation/segment.js +33 -22
- package/build/commands/storage/model.d.ts.map +1 -1
- package/build/commands/storage/model.js +4 -0
- package/build/commands/storage/record.d.ts.map +1 -1
- package/build/commands/storage/record.js +15 -8
- package/build/commands/workspace/user.d.ts.map +1 -1
- package/build/commands/workspace/user.js +22 -13
- package/build/index.js +14 -1
- package/package.json +3 -3
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { handleApiCall, outputJson, parseJson, pollRunUntilFinished, } from "../runHandler.js";
|
|
2
2
|
export function registerRunCommands(parent, getApi) {
|
|
3
|
-
const run = parent
|
|
3
|
+
const run = parent
|
|
4
|
+
.command("run")
|
|
5
|
+
.description("Manage workflow runs (list, get, create, cancel, count, download)");
|
|
4
6
|
run
|
|
5
7
|
.command("list")
|
|
6
8
|
.description("List runs")
|
|
7
|
-
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
8
|
-
.option("--batch-uuid <uuid>", "
|
|
9
|
-
.option("--release-uuid <uuid>", "
|
|
10
|
-
.option("--statuses <list>", "
|
|
11
|
-
.option("--parent-batch-uuid <uuid>", "
|
|
12
|
-
.option("--parent-uuid <uuid>", "
|
|
13
|
-
.option("--parent-node-uuid <uuid>", "
|
|
14
|
-
.option("--is-group-parent", "Only group parents")
|
|
15
|
-
.option("--record-id <id>", "
|
|
16
|
-
.option("--record-title <title>", "
|
|
17
|
-
.option("--record-title-or-id <value>", "
|
|
18
|
-
.option("--is-finished", "Only finished runs")
|
|
19
|
-
.option("--executions-filter <json>", '
|
|
20
|
-
.option("--created-after <date>", "
|
|
21
|
-
.option("--created-before <date>", "
|
|
22
|
-
.option("--limit <n>", "
|
|
23
|
-
.option("--offset <n>", "
|
|
9
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
10
|
+
.option("--batch-uuid <uuid>", "Filter by batch UUID (string)")
|
|
11
|
+
.option("--release-uuid <uuid>", "Filter by release UUID (string)")
|
|
12
|
+
.option("--statuses <list>", "Filter by statuses (comma-separated: pending,running,finished,failed,cancelled)")
|
|
13
|
+
.option("--parent-batch-uuid <uuid>", "Filter by parent batch UUID (string)")
|
|
14
|
+
.option("--parent-uuid <uuid>", "Filter by parent run UUID (string)")
|
|
15
|
+
.option("--parent-node-uuid <uuid>", "Filter by parent node UUID (string)")
|
|
16
|
+
.option("--is-group-parent", "Only return group parents (boolean flag)")
|
|
17
|
+
.option("--record-id <id>", "Filter by record ID (string)")
|
|
18
|
+
.option("--record-title <title>", "Filter by record title (string)")
|
|
19
|
+
.option("--record-title-or-id <value>", "Filter by record title or ID (string)")
|
|
20
|
+
.option("--is-finished", "Only return finished runs (boolean flag)")
|
|
21
|
+
.option("--executions-filter <json>", 'Filter by node executions (JSON object). Example: \'{"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"my-node","operator":"isRunning"}]}]}\'')
|
|
22
|
+
.option("--created-after <date>", "Filter runs created after this date (ISO 8601 string)")
|
|
23
|
+
.option("--created-before <date>", "Filter runs created before this date (ISO 8601 string)")
|
|
24
|
+
.option("--limit <n>", "Max results to return (integer, default: 20)", "20")
|
|
25
|
+
.option("--offset <n>", "Number of results to skip (integer, default: 0)", "0")
|
|
26
|
+
.addHelpText("after", `
|
|
27
|
+
Examples:
|
|
28
|
+
$ cargo-ai orchestration run list --workflow-uuid 550e8400-...
|
|
29
|
+
$ cargo-ai orchestration run list --workflow-uuid 550e8400-... --statuses running,pending --limit 50
|
|
30
|
+
$ cargo-ai orchestration run list --workflow-uuid 550e8400-... --created-after 2025-01-01T00:00:00Z`)
|
|
24
31
|
.action(async (opts) => {
|
|
25
32
|
const api = getApi();
|
|
26
33
|
const result = await handleApiCall(() => api.orchestration.run.list({
|
|
@@ -59,12 +66,17 @@ export function registerRunCommands(parent, getApi) {
|
|
|
59
66
|
run
|
|
60
67
|
.command("create")
|
|
61
68
|
.description("Create a run")
|
|
62
|
-
.option("--workflow-uuid <uuid>", "Workflow UUID")
|
|
63
|
-
.requiredOption("--data <json>", "Run data (JSON,
|
|
64
|
-
.option("--release-uuid <uuid>", "Release UUID")
|
|
65
|
-
.option("--nodes <json>", 'Custom nodes to override the workflow definition (JSON array). Must include a start node (slug:"start") and an end node (slug:"end")
|
|
66
|
-
.option("--wait-until-finished", "Poll the run until it reaches a terminal status before returning")
|
|
67
|
-
.option("--polling-interval <ms>", "Polling interval in milliseconds
|
|
69
|
+
.option("--workflow-uuid <uuid>", "Workflow UUID (string)")
|
|
70
|
+
.requiredOption("--data <json>", "Run input data (JSON object, required). The shape depends on your workflow's start node configuration")
|
|
71
|
+
.option("--release-uuid <uuid>", "Release UUID to pin the run to (string)")
|
|
72
|
+
.option("--nodes <json>", 'Custom nodes to override the workflow definition (JSON array). Must include a start node (slug:"start") and an end node (slug:"end")')
|
|
73
|
+
.option("--wait-until-finished", "Poll the run until it reaches a terminal status before returning (boolean flag)")
|
|
74
|
+
.option("--polling-interval <ms>", "Polling interval in milliseconds, used with --wait-until-finished (integer, default: 5000)", "5000")
|
|
75
|
+
.addHelpText("after", `
|
|
76
|
+
Examples:
|
|
77
|
+
$ cargo-ai orchestration run create --data '{"email":"user@example.com"}'
|
|
78
|
+
$ cargo-ai orchestration run create --workflow-uuid 550e8400-... --data '{"id":"123"}' --wait-until-finished
|
|
79
|
+
$ cargo-ai orchestration run create --data '{"id":"123"}' --wait-until-finished --polling-interval 10000`)
|
|
68
80
|
.action(async (opts) => {
|
|
69
81
|
const data = parseJson(opts.data, "--data");
|
|
70
82
|
const api = getApi();
|
|
@@ -87,8 +99,12 @@ export function registerRunCommands(parent, getApi) {
|
|
|
87
99
|
run
|
|
88
100
|
.command("cancel")
|
|
89
101
|
.description("Cancel runs")
|
|
90
|
-
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
91
|
-
.option("--uuids <list>", "Run UUIDs (comma-separated)")
|
|
102
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
103
|
+
.option("--uuids <list>", "Run UUIDs to cancel (comma-separated strings). Omit to cancel all runs in the workflow")
|
|
104
|
+
.addHelpText("after", `
|
|
105
|
+
Examples:
|
|
106
|
+
$ cargo-ai orchestration run cancel --workflow-uuid 550e8400-...
|
|
107
|
+
$ cargo-ai orchestration run cancel --workflow-uuid 550e8400-... --uuids uuid1,uuid2`)
|
|
92
108
|
.action(async (opts) => {
|
|
93
109
|
const api = getApi();
|
|
94
110
|
const payload = opts.uuids !== undefined
|
|
@@ -102,22 +118,22 @@ export function registerRunCommands(parent, getApi) {
|
|
|
102
118
|
});
|
|
103
119
|
run
|
|
104
120
|
.command("count")
|
|
105
|
-
.description("Count runs")
|
|
106
|
-
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
107
|
-
.option("--batch-uuid <uuid>", "
|
|
108
|
-
.option("--release-uuid <uuid>", "
|
|
109
|
-
.option("--statuses <list>", "
|
|
110
|
-
.option("--parent-batch-uuid <uuid>", "
|
|
111
|
-
.option("--parent-uuid <uuid>", "
|
|
112
|
-
.option("--parent-node-uuid <uuid>", "
|
|
113
|
-
.option("--is-group-parent", "Only group parents")
|
|
114
|
-
.option("--record-id <id>", "
|
|
115
|
-
.option("--record-title <title>", "
|
|
116
|
-
.option("--record-title-or-id <value>", "
|
|
117
|
-
.option("--is-finished", "Only finished runs")
|
|
118
|
-
.option("--executions-filter <json>",
|
|
119
|
-
.option("--created-after <date>", "
|
|
120
|
-
.option("--created-before <date>", "
|
|
121
|
+
.description("Count runs matching the given filters")
|
|
122
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
123
|
+
.option("--batch-uuid <uuid>", "Filter by batch UUID (string)")
|
|
124
|
+
.option("--release-uuid <uuid>", "Filter by release UUID (string)")
|
|
125
|
+
.option("--statuses <list>", "Filter by statuses (comma-separated: pending,running,finished,failed,cancelled)")
|
|
126
|
+
.option("--parent-batch-uuid <uuid>", "Filter by parent batch UUID (string)")
|
|
127
|
+
.option("--parent-uuid <uuid>", "Filter by parent run UUID (string)")
|
|
128
|
+
.option("--parent-node-uuid <uuid>", "Filter by parent node UUID (string)")
|
|
129
|
+
.option("--is-group-parent", "Only count group parents (boolean flag)")
|
|
130
|
+
.option("--record-id <id>", "Filter by record ID (string)")
|
|
131
|
+
.option("--record-title <title>", "Filter by record title (string)")
|
|
132
|
+
.option("--record-title-or-id <value>", "Filter by record title or ID (string)")
|
|
133
|
+
.option("--is-finished", "Only count finished runs (boolean flag)")
|
|
134
|
+
.option("--executions-filter <json>", "Filter by node executions (JSON object, same format as 'run list')")
|
|
135
|
+
.option("--created-after <date>", "Filter runs created after this date (ISO 8601 string)")
|
|
136
|
+
.option("--created-before <date>", "Filter runs created before this date (ISO 8601 string)")
|
|
121
137
|
.action(async (opts) => {
|
|
122
138
|
const api = getApi();
|
|
123
139
|
const result = await handleApiCall(() => api.orchestration.run.count({
|
|
@@ -145,22 +161,22 @@ export function registerRunCommands(parent, getApi) {
|
|
|
145
161
|
});
|
|
146
162
|
run
|
|
147
163
|
.command("download")
|
|
148
|
-
.description("Download run results")
|
|
149
|
-
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
150
|
-
.option("--batch-uuid <uuid>", "
|
|
151
|
-
.option("--release-uuid <uuid>", "
|
|
152
|
-
.option("--statuses <list>", "
|
|
153
|
-
.option("--parent-batch-uuid <uuid>", "
|
|
154
|
-
.option("--parent-uuid <uuid>", "
|
|
155
|
-
.option("--parent-node-uuid <uuid>", "
|
|
156
|
-
.option("--is-group-parent", "Only group parents")
|
|
157
|
-
.option("--record-id <id>", "
|
|
158
|
-
.option("--record-title <title>", "
|
|
159
|
-
.option("--record-title-or-id <value>", "
|
|
160
|
-
.option("--is-finished", "Only finished runs")
|
|
161
|
-
.option("--executions-filter <json>",
|
|
162
|
-
.option("--created-after <date>", "
|
|
163
|
-
.option("--created-before <date>", "
|
|
164
|
+
.description("Download run results as JSON")
|
|
165
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
166
|
+
.option("--batch-uuid <uuid>", "Filter by batch UUID (string)")
|
|
167
|
+
.option("--release-uuid <uuid>", "Filter by release UUID (string)")
|
|
168
|
+
.option("--statuses <list>", "Filter by statuses (comma-separated: pending,running,finished,failed,cancelled)")
|
|
169
|
+
.option("--parent-batch-uuid <uuid>", "Filter by parent batch UUID (string)")
|
|
170
|
+
.option("--parent-uuid <uuid>", "Filter by parent run UUID (string)")
|
|
171
|
+
.option("--parent-node-uuid <uuid>", "Filter by parent node UUID (string)")
|
|
172
|
+
.option("--is-group-parent", "Only return group parents (boolean flag)")
|
|
173
|
+
.option("--record-id <id>", "Filter by record ID (string)")
|
|
174
|
+
.option("--record-title <title>", "Filter by record title (string)")
|
|
175
|
+
.option("--record-title-or-id <value>", "Filter by record title or ID (string)")
|
|
176
|
+
.option("--is-finished", "Only return finished runs (boolean flag)")
|
|
177
|
+
.option("--executions-filter <json>", "Filter by node executions (JSON object, same format as 'run list')")
|
|
178
|
+
.option("--created-after <date>", "Filter runs created after this date (ISO 8601 string)")
|
|
179
|
+
.option("--created-before <date>", "Filter runs created before this date (ISO 8601 string)")
|
|
164
180
|
.action(async (opts) => {
|
|
165
181
|
const api = getApi();
|
|
166
182
|
const result = await handleApiCall(() => api.orchestration.run.download({
|
|
@@ -188,24 +204,29 @@ export function registerRunCommands(parent, getApi) {
|
|
|
188
204
|
});
|
|
189
205
|
run
|
|
190
206
|
.command("download-outputs")
|
|
191
|
-
.description("Download
|
|
192
|
-
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
193
|
-
.requiredOption("--output-node-slug <slug>", "Output node slug")
|
|
194
|
-
.option("--format <format>", "Export format
|
|
195
|
-
.option("--batch-uuid <uuid>", "
|
|
196
|
-
.option("--release-uuid <uuid>", "
|
|
197
|
-
.option("--statuses <list>", "
|
|
198
|
-
.option("--parent-batch-uuid <uuid>", "
|
|
199
|
-
.option("--parent-uuid <uuid>", "
|
|
200
|
-
.option("--parent-node-uuid <uuid>", "
|
|
201
|
-
.option("--is-group-parent", "Only group parents")
|
|
202
|
-
.option("--record-id <id>", "
|
|
203
|
-
.option("--record-title <title>", "
|
|
204
|
-
.option("--record-title-or-id <value>", "
|
|
205
|
-
.option("--is-finished", "Only finished runs")
|
|
206
|
-
.option("--executions-filter <json>",
|
|
207
|
-
.option("--created-after <date>", "
|
|
208
|
-
.option("--created-before <date>", "
|
|
207
|
+
.description("Download outputs from a specific node in matching runs")
|
|
208
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
209
|
+
.requiredOption("--output-node-slug <slug>", "Output node slug to download from (string, required)")
|
|
210
|
+
.option("--format <format>", "Export format: csv | json (default: csv)", "csv")
|
|
211
|
+
.option("--batch-uuid <uuid>", "Filter by batch UUID (string)")
|
|
212
|
+
.option("--release-uuid <uuid>", "Filter by release UUID (string)")
|
|
213
|
+
.option("--statuses <list>", "Filter by statuses (comma-separated: pending,running,finished,failed,cancelled)")
|
|
214
|
+
.option("--parent-batch-uuid <uuid>", "Filter by parent batch UUID (string)")
|
|
215
|
+
.option("--parent-uuid <uuid>", "Filter by parent run UUID (string)")
|
|
216
|
+
.option("--parent-node-uuid <uuid>", "Filter by parent node UUID (string)")
|
|
217
|
+
.option("--is-group-parent", "Only return group parents (boolean flag)")
|
|
218
|
+
.option("--record-id <id>", "Filter by record ID (string)")
|
|
219
|
+
.option("--record-title <title>", "Filter by record title (string)")
|
|
220
|
+
.option("--record-title-or-id <value>", "Filter by record title or ID (string)")
|
|
221
|
+
.option("--is-finished", "Only return finished runs (boolean flag)")
|
|
222
|
+
.option("--executions-filter <json>", "Filter by node executions (JSON object, same format as 'run list')")
|
|
223
|
+
.option("--created-after <date>", "Filter runs created after this date (ISO 8601 string)")
|
|
224
|
+
.option("--created-before <date>", "Filter runs created before this date (ISO 8601 string)")
|
|
225
|
+
.addHelpText("after", `
|
|
226
|
+
Examples:
|
|
227
|
+
$ cargo-ai orchestration run download-outputs --workflow-uuid 550e8400-... --output-node-slug my-output
|
|
228
|
+
$ cargo-ai orchestration run download-outputs --workflow-uuid 550e8400-... --output-node-slug my-output --format json
|
|
229
|
+
$ cargo-ai orchestration run download-outputs --workflow-uuid 550e8400-... --output-node-slug my-output --statuses finished --is-finished`)
|
|
209
230
|
.action(async (opts) => {
|
|
210
231
|
const api = getApi();
|
|
211
232
|
const result = await handleApiCall(() => api.orchestration.run.downloadOutputs({
|
|
@@ -235,12 +256,12 @@ export function registerRunCommands(parent, getApi) {
|
|
|
235
256
|
});
|
|
236
257
|
run
|
|
237
258
|
.command("get-metrics")
|
|
238
|
-
.description("Get run metrics")
|
|
239
|
-
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
240
|
-
.option("--release-uuid <uuid>", "
|
|
241
|
-
.option("--batch-uuid <uuid>", "
|
|
242
|
-
.option("--created-after <date>", "
|
|
243
|
-
.option("--created-before <date>", "
|
|
259
|
+
.description("Get aggregated run metrics for a workflow")
|
|
260
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
261
|
+
.option("--release-uuid <uuid>", "Filter by release UUID (string)")
|
|
262
|
+
.option("--batch-uuid <uuid>", "Filter by batch UUID (string)")
|
|
263
|
+
.option("--created-after <date>", "Filter runs created after this date (ISO 8601 string)")
|
|
264
|
+
.option("--created-before <date>", "Filter runs created before this date (ISO 8601 string)")
|
|
244
265
|
.action(async (opts) => {
|
|
245
266
|
const api = getApi();
|
|
246
267
|
const result = await handleApiCall(() => api.orchestration.run.getMetrics({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/commands/segmentation/segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/commands/segmentation/segment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgPN"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
2
|
export function registerSegmentCommands(parent, getApi) {
|
|
3
|
-
const segment = parent
|
|
3
|
+
const segment = parent
|
|
4
|
+
.command("segment")
|
|
5
|
+
.description("Manage segments (list, get, create, update, remove, fetch, download)");
|
|
4
6
|
segment
|
|
5
7
|
.command("list")
|
|
6
8
|
.description("List all segments")
|
|
@@ -20,12 +22,21 @@ export function registerSegmentCommands(parent, getApi) {
|
|
|
20
22
|
segment
|
|
21
23
|
.command("create")
|
|
22
24
|
.description("Create a segment")
|
|
23
|
-
.requiredOption("--name <name>", "Segment name")
|
|
24
|
-
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
25
|
-
.requiredOption("--filter <json>",
|
|
26
|
-
.option("--sort <json>", 'Sort (JSON
|
|
27
|
-
.option("--limit <n>", "
|
|
28
|
-
.option("--tracking-column-slugs <slugs>", "
|
|
25
|
+
.requiredOption("--name <name>", "Segment name (string, required)")
|
|
26
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
27
|
+
.requiredOption("--filter <json>", "Filter definition (JSON object, required)")
|
|
28
|
+
.option("--sort <json>", 'Sort definition (JSON object). Shape: {"slug": string, "order": "asc" | "desc"}')
|
|
29
|
+
.option("--limit <n>", "Max records in segment (integer)")
|
|
30
|
+
.option("--tracking-column-slugs <slugs>", "Column slugs to track changes on (comma-separated strings)")
|
|
31
|
+
.addHelpText("after", `
|
|
32
|
+
Examples:
|
|
33
|
+
$ cargo-ai segmentation segment create --name "Active Users" --model-uuid 550e8400-... \\
|
|
34
|
+
--filter '{"conjonction":"and","groups":[{"conjonction":"and","conditions":[]}]}'
|
|
35
|
+
$ cargo-ai segmentation segment create --name "Recent" --model-uuid 550e8400-... \\
|
|
36
|
+
--filter '{"conjonction":"and","groups":[]}' --sort '{"slug":"created_at","order":"desc"}' --limit 100
|
|
37
|
+
|
|
38
|
+
Filter object shape:
|
|
39
|
+
{ "conjonction": "and" | "or", "groups": [{ "conjonction": "and" | "or", "conditions": [...] }] }`)
|
|
29
40
|
.action(async (opts) => {
|
|
30
41
|
const api = getApi();
|
|
31
42
|
const result = await handleApiCall(() => api.segmentation.segment.create({
|
|
@@ -63,15 +74,15 @@ export function registerSegmentCommands(parent, getApi) {
|
|
|
63
74
|
});
|
|
64
75
|
segment
|
|
65
76
|
.command("fetch")
|
|
66
|
-
.description("Fetch segment
|
|
67
|
-
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
68
|
-
.requiredOption("--filter <json>",
|
|
69
|
-
.option("--sort <json>", 'Sort (JSON
|
|
70
|
-
.option("--limit <n>", "
|
|
71
|
-
.option("--fetching-limit <n>", "
|
|
72
|
-
.option("--fetching-offset <n>", "
|
|
73
|
-
.option("--enrich", "Enrich records")
|
|
74
|
-
.option("--sync", "Sync before fetching")
|
|
77
|
+
.description("Fetch segment records with optional enrichment")
|
|
78
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
79
|
+
.requiredOption("--filter <json>", "Filter definition (JSON object, required, same format as 'segment create')")
|
|
80
|
+
.option("--sort <json>", 'Sort definition (JSON object). Shape: {"slug": string, "order": "asc" | "desc"}')
|
|
81
|
+
.option("--limit <n>", "Max records in segment (integer)")
|
|
82
|
+
.option("--fetching-limit <n>", "Max records to fetch per page (integer)")
|
|
83
|
+
.option("--fetching-offset <n>", "Number of records to skip (integer)")
|
|
84
|
+
.option("--enrich", "Enrich records with additional data (boolean flag)")
|
|
85
|
+
.option("--sync", "Sync data sources before fetching (boolean flag)")
|
|
75
86
|
.action(async (opts) => {
|
|
76
87
|
const api = getApi();
|
|
77
88
|
const result = await handleApiCall(() => api.segmentation.segment.fetch({
|
|
@@ -103,12 +114,12 @@ export function registerSegmentCommands(parent, getApi) {
|
|
|
103
114
|
segment
|
|
104
115
|
.command("update")
|
|
105
116
|
.description("Update a segment")
|
|
106
|
-
.requiredOption("--uuid <uuid>", "Segment UUID")
|
|
107
|
-
.option("--name <name>", "Segment name")
|
|
108
|
-
.option("--filter <json>",
|
|
109
|
-
.option("--sort <json>", 'Sort (JSON
|
|
110
|
-
.option("--limit <n>", "
|
|
111
|
-
.option("--tracking-column-slugs <slugs>", "
|
|
117
|
+
.requiredOption("--uuid <uuid>", "Segment UUID (string, required)")
|
|
118
|
+
.option("--name <name>", "Segment name (string)")
|
|
119
|
+
.option("--filter <json>", "Filter definition (JSON object, same format as 'segment create')")
|
|
120
|
+
.option("--sort <json>", 'Sort definition (JSON object). Shape: {"slug": string, "order": "asc" | "desc"}')
|
|
121
|
+
.option("--limit <n>", "Max records in segment (integer)")
|
|
122
|
+
.option("--tracking-column-slugs <slugs>", "Column slugs to track changes on (comma-separated strings)")
|
|
112
123
|
.action(async (opts) => {
|
|
113
124
|
const api = getApi();
|
|
114
125
|
const result = await handleApiCall(() => api.segmentation.segment.update({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/commands/storage/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/commands/storage/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA6MN"}
|
|
@@ -22,6 +22,7 @@ export function registerModelCommands(parent, getApi) {
|
|
|
22
22
|
.description("Create a model")
|
|
23
23
|
.requiredOption("--slug <slug>", "Model slug")
|
|
24
24
|
.requiredOption("--name <name>", "Model name")
|
|
25
|
+
.option("--description <description>", "Model description")
|
|
25
26
|
.requiredOption("--dataset-uuid <uuid>", "Dataset UUID")
|
|
26
27
|
.requiredOption("--extractor-slug <slug>", "Extractor slug")
|
|
27
28
|
.requiredOption("--config <json>", "Extractor configuration (JSON object)")
|
|
@@ -31,6 +32,7 @@ export function registerModelCommands(parent, getApi) {
|
|
|
31
32
|
const result = await handleApiCall(() => api.storage.model.create({
|
|
32
33
|
slug: opts.slug,
|
|
33
34
|
name: opts.name,
|
|
35
|
+
description: opts.description,
|
|
34
36
|
datasetUuid: opts.datasetUuid,
|
|
35
37
|
extractorSlug: opts.extractorSlug,
|
|
36
38
|
config: parseJson(opts.config, "--config"),
|
|
@@ -61,6 +63,7 @@ export function registerModelCommands(parent, getApi) {
|
|
|
61
63
|
.description("Update a model")
|
|
62
64
|
.requiredOption("--uuid <uuid>", "Model UUID")
|
|
63
65
|
.option("--name <name>", "Model name")
|
|
66
|
+
.option("--description <description>", "Model description (or 'null' to clear)")
|
|
64
67
|
.option("--extractor-slug <slug>", "Extractor slug")
|
|
65
68
|
.option("--config <json>", "Extractor configuration (JSON object)")
|
|
66
69
|
.option("--position <json>", 'Position (JSON, e.g. {"x":0,"y":0})')
|
|
@@ -71,6 +74,7 @@ export function registerModelCommands(parent, getApi) {
|
|
|
71
74
|
const result = await handleApiCall(() => api.storage.model.update({
|
|
72
75
|
uuid: opts.uuid,
|
|
73
76
|
name: opts.name,
|
|
77
|
+
description: opts.description === "null" ? null : opts.description,
|
|
74
78
|
extractorSlug: opts.extractorSlug,
|
|
75
79
|
config: opts.config !== undefined
|
|
76
80
|
? parseJson(opts.config, "--config")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/commands/storage/record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/commands/storage/record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAiFN"}
|
|
@@ -5,9 +5,12 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
5
5
|
.description("Storage record operations");
|
|
6
6
|
record
|
|
7
7
|
.command("get")
|
|
8
|
-
.description("Get a storage record")
|
|
9
|
-
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
10
|
-
.requiredOption("--id <id>", "Record ID")
|
|
8
|
+
.description("Get a storage record by ID")
|
|
9
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
10
|
+
.requiredOption("--id <id>", "Record ID (string, required)")
|
|
11
|
+
.addHelpText("after", `
|
|
12
|
+
Example:
|
|
13
|
+
$ cargo-ai storage record get --model-uuid 550e8400-... --id rec_abc123`)
|
|
11
14
|
.action(async (opts) => {
|
|
12
15
|
const api = getApi();
|
|
13
16
|
const result = await handleApiCall(() => api.storage.record.get({ modelUuid: opts.modelUuid, id: opts.id }));
|
|
@@ -16,11 +19,15 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
16
19
|
record
|
|
17
20
|
.command("list")
|
|
18
21
|
.description("List storage records")
|
|
19
|
-
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
20
|
-
.option("--limit <n>", "
|
|
21
|
-
.option("--offset <n>", "
|
|
22
|
-
.option("--sort-kind <kind>", "Sort direction
|
|
23
|
-
.option("--sort-column-slug <slug>", "
|
|
22
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
23
|
+
.option("--limit <n>", "Max results to return (integer)")
|
|
24
|
+
.option("--offset <n>", "Number of results to skip (integer)")
|
|
25
|
+
.option("--sort-kind <kind>", "Sort direction. Allowed values: asc, desc")
|
|
26
|
+
.option("--sort-column-slug <slug>", "Column to sort by. Allowed values: _id, _title, _emitted_at")
|
|
27
|
+
.addHelpText("after", `
|
|
28
|
+
Examples:
|
|
29
|
+
$ cargo-ai storage record list --model-uuid 550e8400-...
|
|
30
|
+
$ cargo-ai storage record list --model-uuid 550e8400-... --limit 100 --sort-kind desc --sort-column-slug _emitted_at`)
|
|
24
31
|
.action(async (opts) => {
|
|
25
32
|
const api = getApi();
|
|
26
33
|
const limit = opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA0L7E"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getConfig } from "../../config.js";
|
|
2
2
|
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
3
3
|
export function registerUserCommands(parent, getApi) {
|
|
4
|
-
const user = parent
|
|
4
|
+
const user = parent
|
|
5
|
+
.command("user")
|
|
6
|
+
.description("Manage workspace users and permissions");
|
|
5
7
|
user
|
|
6
8
|
.command("list")
|
|
7
9
|
.description("List workspace users")
|
|
@@ -28,9 +30,12 @@ export function registerUserCommands(parent, getApi) {
|
|
|
28
30
|
});
|
|
29
31
|
user
|
|
30
32
|
.command("create")
|
|
31
|
-
.description("
|
|
32
|
-
.requiredOption("--user-email <email>", "User email")
|
|
33
|
-
.requiredOption("--role-slug <slug>", "Role slug")
|
|
33
|
+
.description("Invite a user to the workspace")
|
|
34
|
+
.requiredOption("--user-email <email>", "User email address (string, required)")
|
|
35
|
+
.requiredOption("--role-slug <slug>", "Role slug to assign (string, required)")
|
|
36
|
+
.addHelpText("after", `
|
|
37
|
+
Example:
|
|
38
|
+
$ cargo-ai workspace user create --user-email alice@example.com --role-slug admin`)
|
|
34
39
|
.action(async (opts) => {
|
|
35
40
|
const api = getApi();
|
|
36
41
|
const result = await handleApiCall(() => api.workspaceManagement.user.create({
|
|
@@ -63,12 +68,16 @@ export function registerUserCommands(parent, getApi) {
|
|
|
63
68
|
});
|
|
64
69
|
user
|
|
65
70
|
.command("upsert-permission")
|
|
66
|
-
.description("
|
|
67
|
-
.option("--user-uuids <uuids>", "
|
|
68
|
-
.option("--emails <emails>", "
|
|
69
|
-
.requiredOption("--action <action>", "Permission action")
|
|
70
|
-
.requiredOption("--resource-uuid <uuid>", "Resource UUID")
|
|
71
|
-
.requiredOption("--effect <effect>", "Permission effect
|
|
71
|
+
.description("Create or update a user permission")
|
|
72
|
+
.option("--user-uuids <uuids>", "Target user UUIDs (comma-separated strings). At least one of --user-uuids or --emails is required")
|
|
73
|
+
.option("--emails <emails>", "Target user emails (comma-separated strings). At least one of --user-uuids or --emails is required")
|
|
74
|
+
.requiredOption("--action <action>", "Permission action (string, required)")
|
|
75
|
+
.requiredOption("--resource-uuid <uuid>", "Resource UUID to grant/deny access to (string, required)")
|
|
76
|
+
.requiredOption("--effect <effect>", "Permission effect. Allowed values: allow, deny")
|
|
77
|
+
.addHelpText("after", `
|
|
78
|
+
Examples:
|
|
79
|
+
$ cargo-ai workspace user upsert-permission --emails alice@example.com --action read --resource-uuid 550e8400-... --effect allow
|
|
80
|
+
$ cargo-ai workspace user upsert-permission --user-uuids uuid1,uuid2 --action write --resource-uuid 550e8400-... --effect deny`)
|
|
72
81
|
.action(async (opts) => {
|
|
73
82
|
if (opts.userUuids === undefined && opts.emails === undefined) {
|
|
74
83
|
throw new Error("--user-uuids or --emails is required");
|
|
@@ -90,9 +99,9 @@ export function registerUserCommands(parent, getApi) {
|
|
|
90
99
|
user
|
|
91
100
|
.command("remove-permission")
|
|
92
101
|
.description("Remove a user permission")
|
|
93
|
-
.requiredOption("--user-uuid <uuid>", "User UUID")
|
|
94
|
-
.requiredOption("--resource-uuid <uuid>", "Resource UUID")
|
|
95
|
-
.requiredOption("--effect <effect>", "Permission effect
|
|
102
|
+
.requiredOption("--user-uuid <uuid>", "User UUID (string, required)")
|
|
103
|
+
.requiredOption("--resource-uuid <uuid>", "Resource UUID (string, required)")
|
|
104
|
+
.requiredOption("--effect <effect>", "Permission effect to remove. Allowed values: allow, deny")
|
|
96
105
|
.action(async (opts) => {
|
|
97
106
|
const api = getApi();
|
|
98
107
|
await handleApiCall(() => api.workspaceManagement.user.removePermission({
|
package/build/index.js
CHANGED
|
@@ -19,7 +19,20 @@ import { registerWorkspaceCommands } from "./commands/workspace/index.js";
|
|
|
19
19
|
const require = createRequire(import.meta.url);
|
|
20
20
|
const { version } = require("../package.json");
|
|
21
21
|
const program = new Command();
|
|
22
|
-
program
|
|
22
|
+
program
|
|
23
|
+
.name("cargo-ai")
|
|
24
|
+
.description("Cargo API CLI")
|
|
25
|
+
.version(version)
|
|
26
|
+
.addHelpText("after", `
|
|
27
|
+
Authentication:
|
|
28
|
+
Save credentials: cargo-ai login --token <your-token>
|
|
29
|
+
Use env variables: CARGO_API_TOKEN, CARGO_WORKSPACE_UUID, CARGO_BASE_URL
|
|
30
|
+
Check status: cargo-ai whoami
|
|
31
|
+
|
|
32
|
+
All commands output JSON to stdout. Errors exit with code 1.
|
|
33
|
+
|
|
34
|
+
Run "cargo-ai <command> --help" for details on a specific command group.
|
|
35
|
+
Run "cargo-ai <command> <subcommand> --help" for details on a subcommand.`);
|
|
23
36
|
const getApi = () => createApi();
|
|
24
37
|
registerAuthCommands(program, getApi);
|
|
25
38
|
registerInitCommand(program, getApi);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Command-line interface for the Cargo API",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22"
|
|
8
8
|
},
|
|
9
9
|
"volta": {
|
|
10
|
-
"node": "22.
|
|
10
|
+
"node": "22.22.2"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
13
|
"bin": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
|
-
"@cargo-ai/api": "^1.0.
|
|
32
|
+
"@cargo-ai/api": "^1.0.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@cargo-ai/eslint-config": "*",
|