@cargo-ai/cli 1.0.6 → 1.0.8
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 +1 -1
- package/build/commands/ai/message.d.ts.map +1 -1
- package/build/commands/ai/message.js +10 -0
- package/build/commands/auth.d.ts +2 -1
- package/build/commands/auth.d.ts.map +1 -1
- package/build/commands/auth.js +39 -19
- package/build/commands/orchestration/record.d.ts.map +1 -1
- package/build/commands/orchestration/record.js +47 -0
- package/build/commands/orchestration/run.d.ts.map +1 -1
- package/build/commands/orchestration/run.js +47 -0
- package/build/index.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Cargo CLI
|
|
2
2
|
|
|
3
|
-
Command-line interface for the [Cargo API](https://docs.getcargo.ai/api-reference/introduction). Manage workspaces, storage, orchestration, connections, billing, and more from the terminal; for a complete feature overview, see the [Cargo CLI Overview](https://docs.getcargo.ai/
|
|
3
|
+
Command-line interface for the [Cargo API](https://docs.getcargo.ai/api-reference/introduction). Manage workspaces, storage, orchestration, connections, billing, and more from the terminal; for a complete feature overview, see the [Cargo CLI Overview](https://docs.getcargo.ai/cli/overview).
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAwKN"}
|
|
@@ -79,6 +79,16 @@ export function registerMessageCommands(parent, getApi) {
|
|
|
79
79
|
}));
|
|
80
80
|
outputJson(result);
|
|
81
81
|
});
|
|
82
|
+
message
|
|
83
|
+
.command("cancel")
|
|
84
|
+
.description("Cancel one or more messages by UUID")
|
|
85
|
+
.requiredOption("--uuids <uuids>", "Comma-separated message UUIDs to cancel")
|
|
86
|
+
.action(async (opts) => {
|
|
87
|
+
const api = getApi();
|
|
88
|
+
const uuids = opts.uuids.split(",").map((u) => u.trim());
|
|
89
|
+
await handleApiCall(() => api.ai.message.cancel({ uuids }));
|
|
90
|
+
outputJson({ ok: true });
|
|
91
|
+
});
|
|
82
92
|
message
|
|
83
93
|
.command("remove <uuid>")
|
|
84
94
|
.description("Remove a message")
|
package/build/commands/auth.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
|
-
|
|
2
|
+
import type { Api } from "../api.js";
|
|
3
|
+
export declare function registerAuthCommands(program: Command, getApi: () => Api): void;
|
|
3
4
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAWrC,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgHN"}
|
package/build/commands/auth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clearCredentials, getCredentialsPath, loadCredentials, saveCredentials, } from "../credentials.js";
|
|
2
|
-
import { outputJson } from "./runHandler.js";
|
|
2
|
+
import { handleApiCall, outputJson } from "./runHandler.js";
|
|
3
3
|
const DEFAULT_BASE_URL = "https://api.getcargo.io";
|
|
4
|
-
export function registerAuthCommands(program) {
|
|
4
|
+
export function registerAuthCommands(program, getApi) {
|
|
5
5
|
program
|
|
6
6
|
.command("login")
|
|
7
7
|
.description("Save API credentials for future use")
|
|
@@ -34,17 +34,14 @@ export function registerAuthCommands(program) {
|
|
|
34
34
|
});
|
|
35
35
|
program
|
|
36
36
|
.command("whoami")
|
|
37
|
-
.description("Show current
|
|
38
|
-
.action(() => {
|
|
37
|
+
.description("Show current user and workspace")
|
|
38
|
+
.action(async () => {
|
|
39
39
|
const envToken = process.env["CARGO_API_TOKEN"];
|
|
40
40
|
const envBaseUrl = process.env["CARGO_BASE_URL"];
|
|
41
41
|
const envWorkspace = process.env["CARGO_WORKSPACE_UUID"];
|
|
42
42
|
const creds = loadCredentials();
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
: creds !== undefined
|
|
46
|
-
? creds.accessToken
|
|
47
|
-
: undefined;
|
|
43
|
+
const hasToken = envToken !== undefined ||
|
|
44
|
+
(creds !== undefined && creds.accessToken !== undefined);
|
|
48
45
|
const baseUrl = envBaseUrl !== undefined
|
|
49
46
|
? envBaseUrl
|
|
50
47
|
: creds !== undefined && creds.baseUrl !== undefined
|
|
@@ -55,19 +52,42 @@ export function registerAuthCommands(program) {
|
|
|
55
52
|
: creds !== undefined
|
|
56
53
|
? creds.workspaceUuid
|
|
57
54
|
: undefined;
|
|
55
|
+
if (hasToken === false) {
|
|
56
|
+
outputJson({
|
|
57
|
+
user: null,
|
|
58
|
+
workspace: null,
|
|
59
|
+
source: "none",
|
|
60
|
+
baseUrl,
|
|
61
|
+
credentialsFile: getCredentialsPath(),
|
|
62
|
+
warnings: [
|
|
63
|
+
'Not authenticated. Run "cargo-ai login --token <token>" or set CARGO_API_TOKEN.',
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const source = envToken !== undefined ? "environment" : "credentials-file";
|
|
69
|
+
const api = getApi();
|
|
70
|
+
const { user } = await handleApiCall(() => api.userManagement.user.getCurrent());
|
|
71
|
+
const { workspaces } = await handleApiCall(() => api.workspaceManagement.workspace.all({ refresh: false }));
|
|
72
|
+
const matchedWorkspace = workspaceUuid !== undefined
|
|
73
|
+
? workspaces.find((workspace) => {
|
|
74
|
+
return workspace.uuid === workspaceUuid;
|
|
75
|
+
})
|
|
76
|
+
: workspaces[0];
|
|
77
|
+
const workspace = matchedWorkspace !== undefined
|
|
78
|
+
? { uuid: matchedWorkspace.uuid, name: matchedWorkspace.name }
|
|
79
|
+
: null;
|
|
58
80
|
outputJson({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
:
|
|
63
|
-
|
|
64
|
-
|
|
81
|
+
user: {
|
|
82
|
+
uuid: user.uuid,
|
|
83
|
+
email: user.email,
|
|
84
|
+
firstName: user.firstName,
|
|
85
|
+
lastName: user.lastName,
|
|
86
|
+
},
|
|
87
|
+
workspace,
|
|
88
|
+
source,
|
|
65
89
|
baseUrl,
|
|
66
|
-
workspaceUuid: workspaceUuid !== undefined ? workspaceUuid : null,
|
|
67
90
|
credentialsFile: getCredentialsPath(),
|
|
68
|
-
tokenPreview: token !== undefined
|
|
69
|
-
? `${token.slice(0, 8)}...${token.slice(-4)}`
|
|
70
|
-
: null,
|
|
71
91
|
});
|
|
72
92
|
});
|
|
73
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/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/orchestration/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,CAoYN"}
|
|
@@ -134,6 +134,53 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
134
134
|
}));
|
|
135
135
|
outputJson(result);
|
|
136
136
|
});
|
|
137
|
+
record
|
|
138
|
+
.command("download-outputs")
|
|
139
|
+
.description("Download record outputs")
|
|
140
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
141
|
+
.requiredOption("--output-node-slug <slug>", "Output node slug")
|
|
142
|
+
.option("--format <format>", "Export format (csv or json)", "csv")
|
|
143
|
+
.option("--ids <list>", "Record IDs (comma-separated)")
|
|
144
|
+
.option("--title <title>", "Record title")
|
|
145
|
+
.option("--title-or-id <value>", "Record title or ID")
|
|
146
|
+
.option("--release-uuid <uuid>", "Release UUID")
|
|
147
|
+
.option("--batch-uuid <uuid>", "Batch UUID")
|
|
148
|
+
.option("--statuses <list>", "Statuses (comma-separated)")
|
|
149
|
+
.option("--parent-batch-uuid <uuid>", "Parent batch UUID")
|
|
150
|
+
.option("--parent-run-uuid <uuid>", "Parent run UUID")
|
|
151
|
+
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
152
|
+
.option("--is-group-parent", "Only group parents")
|
|
153
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","operator":"isRunning"}]}]})')
|
|
154
|
+
.option("--created-after <date>", "Created after date")
|
|
155
|
+
.option("--created-before <date>", "Created before date")
|
|
156
|
+
.action(async (opts) => {
|
|
157
|
+
const api = getApi();
|
|
158
|
+
const result = await handleApiCall(() => api.orchestration.record.downloadOutputs({
|
|
159
|
+
workflowUuid: opts.workflowUuid,
|
|
160
|
+
outputNodeSlug: opts.outputNodeSlug,
|
|
161
|
+
format: opts.format,
|
|
162
|
+
ids: opts.ids !== undefined
|
|
163
|
+
? opts.ids.split(",").map((s) => s.trim())
|
|
164
|
+
: undefined,
|
|
165
|
+
title: opts.title,
|
|
166
|
+
titleOrId: opts.titleOrId,
|
|
167
|
+
releaseUuid: opts.releaseUuid,
|
|
168
|
+
batchUuid: opts.batchUuid,
|
|
169
|
+
statuses: opts.statuses !== undefined
|
|
170
|
+
? opts.statuses.split(",").map((s) => s.trim())
|
|
171
|
+
: undefined,
|
|
172
|
+
parentBatchUuid: opts.parentBatchUuid,
|
|
173
|
+
parentRunUuid: opts.parentRunUuid,
|
|
174
|
+
parentNodeUuid: opts.parentNodeUuid,
|
|
175
|
+
isGroupParent: opts.isGroupParent,
|
|
176
|
+
executionsFilter: opts.executionsFilter !== undefined
|
|
177
|
+
? parseJson(opts.executionsFilter, "--executions-filter")
|
|
178
|
+
: undefined,
|
|
179
|
+
createdAfter: opts.createdAfter,
|
|
180
|
+
createdBefore: opts.createdBefore,
|
|
181
|
+
}));
|
|
182
|
+
outputJson(result);
|
|
183
|
+
});
|
|
137
184
|
record
|
|
138
185
|
.command("get-metrics")
|
|
139
186
|
.description("Get record metrics")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA8Z5E"}
|
|
@@ -186,6 +186,53 @@ export function registerRunCommands(parent, getApi) {
|
|
|
186
186
|
}));
|
|
187
187
|
outputJson(result);
|
|
188
188
|
});
|
|
189
|
+
run
|
|
190
|
+
.command("download-outputs")
|
|
191
|
+
.description("Download run outputs")
|
|
192
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID")
|
|
193
|
+
.requiredOption("--output-node-slug <slug>", "Output node slug")
|
|
194
|
+
.option("--format <format>", "Export format (csv or json)", "csv")
|
|
195
|
+
.option("--batch-uuid <uuid>", "Batch UUID")
|
|
196
|
+
.option("--release-uuid <uuid>", "Release UUID")
|
|
197
|
+
.option("--statuses <list>", "Statuses (comma-separated)")
|
|
198
|
+
.option("--parent-batch-uuid <uuid>", "Parent batch UUID")
|
|
199
|
+
.option("--parent-uuid <uuid>", "Parent run UUID")
|
|
200
|
+
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
201
|
+
.option("--is-group-parent", "Only group parents")
|
|
202
|
+
.option("--record-id <id>", "Record ID")
|
|
203
|
+
.option("--record-title <title>", "Record title")
|
|
204
|
+
.option("--record-title-or-id <value>", "Record title or ID")
|
|
205
|
+
.option("--is-finished", "Only finished runs")
|
|
206
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","operator":"isRunning"}]}]})')
|
|
207
|
+
.option("--created-after <date>", "Created after date")
|
|
208
|
+
.option("--created-before <date>", "Created before date")
|
|
209
|
+
.action(async (opts) => {
|
|
210
|
+
const api = getApi();
|
|
211
|
+
const result = await handleApiCall(() => api.orchestration.run.downloadOutputs({
|
|
212
|
+
workflowUuid: opts.workflowUuid,
|
|
213
|
+
outputNodeSlug: opts.outputNodeSlug,
|
|
214
|
+
format: opts.format,
|
|
215
|
+
batchUuid: opts.batchUuid,
|
|
216
|
+
releaseUuid: opts.releaseUuid,
|
|
217
|
+
statuses: opts.statuses !== undefined
|
|
218
|
+
? opts.statuses.split(",").map((s) => s.trim())
|
|
219
|
+
: undefined,
|
|
220
|
+
parentBatchUuid: opts.parentBatchUuid,
|
|
221
|
+
parentUuid: opts.parentUuid,
|
|
222
|
+
parentNodeUuid: opts.parentNodeUuid,
|
|
223
|
+
isGroupParent: opts.isGroupParent,
|
|
224
|
+
recordId: opts.recordId,
|
|
225
|
+
recordTitle: opts.recordTitle,
|
|
226
|
+
recordTitleOrId: opts.recordTitleOrId,
|
|
227
|
+
isFinished: opts.isFinished,
|
|
228
|
+
executionsFilter: opts.executionsFilter !== undefined
|
|
229
|
+
? parseJson(opts.executionsFilter, "--executions-filter")
|
|
230
|
+
: undefined,
|
|
231
|
+
createdAfter: opts.createdAfter,
|
|
232
|
+
createdBefore: opts.createdBefore,
|
|
233
|
+
}));
|
|
234
|
+
outputJson(result);
|
|
235
|
+
});
|
|
189
236
|
run
|
|
190
237
|
.command("get-metrics")
|
|
191
238
|
.description("Get run metrics")
|
package/build/index.js
CHANGED
|
@@ -20,8 +20,8 @@ const require = createRequire(import.meta.url);
|
|
|
20
20
|
const { version } = require("../package.json");
|
|
21
21
|
const program = new Command();
|
|
22
22
|
program.name("cargo-ai").description("Cargo API CLI").version(version);
|
|
23
|
-
registerAuthCommands(program);
|
|
24
23
|
const getApi = () => createApi();
|
|
24
|
+
registerAuthCommands(program, getApi);
|
|
25
25
|
registerInitCommand(program, getApi);
|
|
26
26
|
registerOrchestrationCommands(program, getApi);
|
|
27
27
|
registerWorkspaceCommands(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.8",
|
|
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.15"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@cargo-ai/eslint-config": "*",
|