@cargo-ai/cli 1.0.10 → 1.0.12
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/api.d.ts.map +1 -1
- package/build/api.js +4 -0
- package/build/commands/ai/release.d.ts.map +1 -1
- package/build/commands/ai/release.js +10 -1
- package/build/commands/orchestration/play.d.ts.map +1 -1
- package/build/commands/orchestration/play.js +110 -5
- package/build/commands/orchestration/record.js +5 -5
- package/build/commands/orchestration/release.d.ts.map +1 -1
- package/build/commands/orchestration/release.js +12 -1
- package/build/commands/orchestration/run.js +1 -1
- package/build/commands/storage/record.d.ts.map +1 -1
- package/build/commands/storage/record.js +51 -1
- package/package.json +2 -2
package/build/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,eAAe,CAAC;AAInD,YAAY,EAAE,GAAG,EAAE,CAAC;AAMpB,wBAAgB,SAAS,IAAI,GAAG,CAQ/B"}
|
package/build/api.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { buildApi } from "@cargo-ai/api";
|
|
2
3
|
import { getConfig } from "./config.js";
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const { version } = require("../package.json");
|
|
3
6
|
export function createApi() {
|
|
4
7
|
const { baseUrl, accessToken, workspaceUuid } = getConfig();
|
|
5
8
|
return buildApi({
|
|
6
9
|
baseUrl,
|
|
7
10
|
workspaceUuid,
|
|
8
11
|
getAccessToken: async () => accessToken,
|
|
12
|
+
origin: { name: "cli", version },
|
|
9
13
|
});
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/release.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":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/release.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,CAwRN"}
|
|
@@ -2,7 +2,7 @@ import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
|
2
2
|
export function registerReleaseCommands(parent, getApi) {
|
|
3
3
|
const release = parent
|
|
4
4
|
.command("release")
|
|
5
|
-
.description("Manage AI agent releases (list, get, draft, deploy)");
|
|
5
|
+
.description("Manage AI agent releases (list, get, get-deployed, draft, deploy)");
|
|
6
6
|
release
|
|
7
7
|
.command("list")
|
|
8
8
|
.description("List AI releases")
|
|
@@ -41,6 +41,15 @@ export function registerReleaseCommands(parent, getApi) {
|
|
|
41
41
|
const result = await handleApiCall(() => api.ai.release.getDraft({ agentUuid: opts.agentUuid }));
|
|
42
42
|
outputJson(result);
|
|
43
43
|
});
|
|
44
|
+
release
|
|
45
|
+
.command("get-deployed")
|
|
46
|
+
.description("Get the deployed AI release for an agent")
|
|
47
|
+
.requiredOption("--agent-uuid <uuid>", "Agent UUID (string, required)")
|
|
48
|
+
.action(async (opts) => {
|
|
49
|
+
const api = getApi();
|
|
50
|
+
const result = await handleApiCall(() => api.ai.release.getDeployed({ agentUuid: opts.agentUuid }));
|
|
51
|
+
outputJson(result);
|
|
52
|
+
});
|
|
44
53
|
release
|
|
45
54
|
.command("update-draft")
|
|
46
55
|
.description("Update draft AI release configuration")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/play.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/play.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA0R7E"}
|
|
@@ -1,14 +1,49 @@
|
|
|
1
|
-
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
2
|
export function registerPlayCommands(parent, getApi) {
|
|
3
3
|
const play = parent
|
|
4
4
|
.command("play")
|
|
5
5
|
.description("Manage plays (list, create, update, remove)");
|
|
6
6
|
play
|
|
7
7
|
.command("list")
|
|
8
|
-
.description("List
|
|
9
|
-
.
|
|
8
|
+
.description("List plays (optional filters match GET /orchestration/plays/list)")
|
|
9
|
+
.option("--model-uuid <uuid>", "Only plays for this model UUID")
|
|
10
|
+
.option("--segment-uuid <uuid>", "Only plays for this segment UUID")
|
|
11
|
+
.option("--schedule-type <type>", "Only plays with this schedule type: dbt | cron | realtime | dependency | watch")
|
|
12
|
+
.option("--is-enabled", "Only enabled plays (boolean flag)")
|
|
13
|
+
.option("--is-disabled", "Only disabled plays (boolean flag)")
|
|
14
|
+
.action(async (opts) => {
|
|
10
15
|
const api = getApi();
|
|
11
|
-
|
|
16
|
+
if (opts.isEnabled === true && opts.isDisabled === true) {
|
|
17
|
+
throw new Error("Use only one of --is-enabled or --is-disabled");
|
|
18
|
+
}
|
|
19
|
+
const scheduleTypes = [
|
|
20
|
+
"dbt",
|
|
21
|
+
"cron",
|
|
22
|
+
"realtime",
|
|
23
|
+
"dependency",
|
|
24
|
+
"watch",
|
|
25
|
+
];
|
|
26
|
+
let scheduleType;
|
|
27
|
+
if (opts.scheduleType !== undefined) {
|
|
28
|
+
if (scheduleTypes.includes(opts.scheduleType) ===
|
|
29
|
+
false) {
|
|
30
|
+
throw new Error(`--schedule-type must be one of: ${scheduleTypes.join(", ")}`);
|
|
31
|
+
}
|
|
32
|
+
scheduleType = opts.scheduleType;
|
|
33
|
+
}
|
|
34
|
+
let isEnabledFilter;
|
|
35
|
+
if (opts.isEnabled === true) {
|
|
36
|
+
isEnabledFilter = true;
|
|
37
|
+
}
|
|
38
|
+
if (opts.isDisabled === true) {
|
|
39
|
+
isEnabledFilter = false;
|
|
40
|
+
}
|
|
41
|
+
const result = await handleApiCall(() => api.orchestration.play.list({
|
|
42
|
+
modelUuid: opts.modelUuid,
|
|
43
|
+
segmentUuid: opts.segmentUuid,
|
|
44
|
+
scheduleType,
|
|
45
|
+
isEnabled: isEnabledFilter,
|
|
46
|
+
}));
|
|
12
47
|
outputJson(result);
|
|
13
48
|
});
|
|
14
49
|
play
|
|
@@ -55,9 +90,79 @@ Examples:
|
|
|
55
90
|
.description("Update a play")
|
|
56
91
|
.option("--name <name>", "Play name")
|
|
57
92
|
.option("--description <description>", "Description")
|
|
93
|
+
.option("--is-enabled", "Enable the play")
|
|
94
|
+
.option("--is-disabled", "Disable the play")
|
|
95
|
+
.option("--change-kinds <kinds>", "Change kinds to trigger on (comma-separated strings)")
|
|
96
|
+
.option("--run-creation-rule <rule>", "Run creation rule. Allowed values: always, once, noConcurrency")
|
|
97
|
+
.option("--folder-uuid <uuid>", "Folder UUID")
|
|
98
|
+
.option("--filter <json>", "Filter definition (JSON object, same format as segmentation segment update)")
|
|
99
|
+
.option("--sort <json>", 'Sort definition (JSON object). Shape: {"slug": string, "order": "asc" | "desc"}')
|
|
100
|
+
.option("--limit <n>", "Maximum number of records (integer)")
|
|
101
|
+
.option("--tracking-column-slugs <slugs>", "Column slugs to track changes on (comma-separated strings)")
|
|
102
|
+
.option("--schedule <json>", "Schedule definition (JSON object matching the play update API payload)")
|
|
103
|
+
.option("--health-threshold <n>", "Health threshold (number)")
|
|
104
|
+
.option("--health-alert-actions <json>", "Health alert actions (JSON array matching the play update API payload)")
|
|
105
|
+
.option("--template <json>", 'Template settings (JSON object, e.g. {"isAvailable":true,"scope":"private"})')
|
|
58
106
|
.action(async (uuid, opts) => {
|
|
59
107
|
const api = getApi();
|
|
60
|
-
|
|
108
|
+
if (opts.isEnabled === true && opts.isDisabled === true) {
|
|
109
|
+
throw new Error("Use only one of --is-enabled or --is-disabled");
|
|
110
|
+
}
|
|
111
|
+
let isEnabled;
|
|
112
|
+
if (opts.isEnabled === true) {
|
|
113
|
+
isEnabled = true;
|
|
114
|
+
}
|
|
115
|
+
if (opts.isDisabled === true) {
|
|
116
|
+
isEnabled = false;
|
|
117
|
+
}
|
|
118
|
+
let runCreationRule;
|
|
119
|
+
if (opts.runCreationRule !== undefined) {
|
|
120
|
+
const validRules = [
|
|
121
|
+
"always",
|
|
122
|
+
"once",
|
|
123
|
+
"noConcurrency",
|
|
124
|
+
];
|
|
125
|
+
const parsedRule = opts.runCreationRule;
|
|
126
|
+
if (validRules.includes(parsedRule) === false) {
|
|
127
|
+
throw new Error(`--run-creation-rule must be one of: ${validRules.join(", ")}`);
|
|
128
|
+
}
|
|
129
|
+
runCreationRule = parsedRule;
|
|
130
|
+
}
|
|
131
|
+
const result = await handleApiCall(() => api.orchestration.play.update({
|
|
132
|
+
uuid,
|
|
133
|
+
name: opts.name,
|
|
134
|
+
description: opts.description,
|
|
135
|
+
isEnabled,
|
|
136
|
+
changeKinds: opts.changeKinds !== undefined
|
|
137
|
+
? opts.changeKinds
|
|
138
|
+
.split(",")
|
|
139
|
+
.map((s) => s.trim())
|
|
140
|
+
: undefined,
|
|
141
|
+
runCreationRule,
|
|
142
|
+
folderUuid: opts.folderUuid,
|
|
143
|
+
filter: opts.filter !== undefined
|
|
144
|
+
? parseJson(opts.filter, "--filter")
|
|
145
|
+
: undefined,
|
|
146
|
+
sort: opts.sort !== undefined
|
|
147
|
+
? parseJson(opts.sort, "--sort")
|
|
148
|
+
: undefined,
|
|
149
|
+
limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
|
|
150
|
+
trackingColumnSlugs: opts.trackingColumnSlugs !== undefined
|
|
151
|
+
? opts.trackingColumnSlugs.split(",").map((s) => s.trim())
|
|
152
|
+
: undefined,
|
|
153
|
+
schedule: opts.schedule !== undefined
|
|
154
|
+
? parseJson(opts.schedule, "--schedule")
|
|
155
|
+
: undefined,
|
|
156
|
+
healthThreshold: opts.healthThreshold !== undefined
|
|
157
|
+
? parseInt(opts.healthThreshold, 10)
|
|
158
|
+
: undefined,
|
|
159
|
+
healthAlertActions: opts.healthAlertActions !== undefined
|
|
160
|
+
? parseJson(opts.healthAlertActions, "--health-alert-actions")
|
|
161
|
+
: undefined,
|
|
162
|
+
template: opts.template !== undefined
|
|
163
|
+
? parseJson(opts.template, "--template")
|
|
164
|
+
: undefined,
|
|
165
|
+
}));
|
|
61
166
|
outputJson(result);
|
|
62
167
|
});
|
|
63
168
|
play
|
|
@@ -15,7 +15,7 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
15
15
|
.option("--parent-run-uuid <uuid>", "Parent run UUID")
|
|
16
16
|
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
17
17
|
.option("--is-group-parent", "Only group parents")
|
|
18
|
-
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","
|
|
18
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","status":"pending"}]}]})')
|
|
19
19
|
.option("--created-after <date>", "Created after date")
|
|
20
20
|
.option("--created-before <date>", "Created before date")
|
|
21
21
|
.option("--limit <n>", "Limit", "20")
|
|
@@ -62,7 +62,7 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
62
62
|
.option("--parent-run-uuid <uuid>", "Parent run UUID")
|
|
63
63
|
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
64
64
|
.option("--is-group-parent", "Only group parents")
|
|
65
|
-
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","
|
|
65
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","status":"pending"}]}]})')
|
|
66
66
|
.option("--created-after <date>", "Created after date")
|
|
67
67
|
.option("--created-before <date>", "Created before date")
|
|
68
68
|
.action(async (opts) => {
|
|
@@ -105,7 +105,7 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
105
105
|
.option("--parent-run-uuid <uuid>", "Parent run UUID")
|
|
106
106
|
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
107
107
|
.option("--is-group-parent", "Only group parents")
|
|
108
|
-
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","
|
|
108
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","status":"pending"}]}]})')
|
|
109
109
|
.option("--created-after <date>", "Created after date")
|
|
110
110
|
.option("--created-before <date>", "Created before date")
|
|
111
111
|
.action(async (opts) => {
|
|
@@ -150,7 +150,7 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
150
150
|
.option("--parent-run-uuid <uuid>", "Parent run UUID")
|
|
151
151
|
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
152
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":"...","
|
|
153
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","status":"pending"}]}]})')
|
|
154
154
|
.option("--created-after <date>", "Created after date")
|
|
155
155
|
.option("--created-before <date>", "Created before date")
|
|
156
156
|
.action(async (opts) => {
|
|
@@ -213,7 +213,7 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
213
213
|
.option("--parent-run-uuid <uuid>", "Parent run UUID")
|
|
214
214
|
.option("--parent-node-uuid <uuid>", "Parent node UUID")
|
|
215
215
|
.option("--is-group-parent", "Only group parents")
|
|
216
|
-
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","
|
|
216
|
+
.option("--executions-filter <json>", 'Executions filter (JSON, e.g. {"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"...","status":"pending"}]}]})')
|
|
217
217
|
.action(async (opts) => {
|
|
218
218
|
const payload = opts.ids !== undefined
|
|
219
219
|
? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/release.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":"release.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/release.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,CA8DN"}
|
|
@@ -2,7 +2,7 @@ import { handleApiCall, outputJson } from "../runHandler.js";
|
|
|
2
2
|
export function registerReleaseCommands(parent, getApi) {
|
|
3
3
|
const release = parent
|
|
4
4
|
.command("release")
|
|
5
|
-
.description("Manage workflow releases (list, get)");
|
|
5
|
+
.description("Manage workflow releases (list, get, get-deployed)");
|
|
6
6
|
release
|
|
7
7
|
.command("list")
|
|
8
8
|
.description("List releases")
|
|
@@ -26,4 +26,15 @@ export function registerReleaseCommands(parent, getApi) {
|
|
|
26
26
|
const result = await handleApiCall(() => api.orchestration.release.get(uuid));
|
|
27
27
|
outputJson(result);
|
|
28
28
|
});
|
|
29
|
+
release
|
|
30
|
+
.command("get-deployed")
|
|
31
|
+
.description("Get the deployed release for a workflow")
|
|
32
|
+
.requiredOption("--workflow-uuid <uuid>", "Workflow UUID (string, required)")
|
|
33
|
+
.action(async (opts) => {
|
|
34
|
+
const api = getApi();
|
|
35
|
+
const result = await handleApiCall(() => api.orchestration.release.getDeployed({
|
|
36
|
+
workflowUuid: opts.workflowUuid,
|
|
37
|
+
}));
|
|
38
|
+
outputJson(result);
|
|
39
|
+
});
|
|
29
40
|
}
|
|
@@ -18,7 +18,7 @@ export function registerRunCommands(parent, getApi) {
|
|
|
18
18
|
.option("--record-title <title>", "Filter by record title (string)")
|
|
19
19
|
.option("--record-title-or-id <value>", "Filter by record title or ID (string)")
|
|
20
20
|
.option("--is-finished", "Only return finished runs (boolean flag)")
|
|
21
|
-
.option("--executions-filter <json>", 'Filter by node executions (JSON
|
|
21
|
+
.option("--executions-filter <json>", 'Filter by node executions (JSON). Example: \'{"conjonction":"and","groups":[{"conjonction":"and","conditions":[{"kind":"node","nodeSlug":"my-node","status":"pending"}]}]}\'')
|
|
22
22
|
.option("--created-after <date>", "Filter runs created after this date (ISO 8601 string)")
|
|
23
23
|
.option("--created-before <date>", "Filter runs created before this date (ISO 8601 string)")
|
|
24
24
|
.option("--limit <n>", "Max results to return (integer, default: 20)", "20")
|
|
@@ -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,CAwJN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
2
|
export function registerRecordCommands(parent, getApi) {
|
|
3
3
|
const record = parent
|
|
4
4
|
.command("record")
|
|
@@ -50,4 +50,54 @@ Examples:
|
|
|
50
50
|
}));
|
|
51
51
|
outputJson(result);
|
|
52
52
|
});
|
|
53
|
+
record
|
|
54
|
+
.command("create")
|
|
55
|
+
.description("Create a single storage record")
|
|
56
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
57
|
+
.requiredOption("--data <json>", "Record fields as a JSON object (merged into the row)")
|
|
58
|
+
.addHelpText("after", `
|
|
59
|
+
Example:
|
|
60
|
+
$ cargo-ai storage record create --model-uuid 550e8400-... --data '{"name":"Ada"}'`)
|
|
61
|
+
.action(async (opts) => {
|
|
62
|
+
const api = getApi();
|
|
63
|
+
const result = await handleApiCall(() => api.storage.record.create({
|
|
64
|
+
modelUuid: opts.modelUuid,
|
|
65
|
+
data: parseJson(opts.data, "--data"),
|
|
66
|
+
}));
|
|
67
|
+
outputJson(result);
|
|
68
|
+
});
|
|
69
|
+
record
|
|
70
|
+
.command("update")
|
|
71
|
+
.description("Update a single storage record")
|
|
72
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
73
|
+
.requiredOption("--id <id>", "Record ID (string, required)")
|
|
74
|
+
.requiredOption("--data <json>", "Fields to update as a JSON object")
|
|
75
|
+
.addHelpText("after", `
|
|
76
|
+
Example:
|
|
77
|
+
$ cargo-ai storage record update --model-uuid 550e8400-... --id rec_1 --data '{"status":"done"}'`)
|
|
78
|
+
.action(async (opts) => {
|
|
79
|
+
const api = getApi();
|
|
80
|
+
const result = await handleApiCall(() => api.storage.record.update({
|
|
81
|
+
modelUuid: opts.modelUuid,
|
|
82
|
+
id: opts.id,
|
|
83
|
+
data: parseJson(opts.data, "--data"),
|
|
84
|
+
}));
|
|
85
|
+
outputJson(result);
|
|
86
|
+
});
|
|
87
|
+
record
|
|
88
|
+
.command("remove")
|
|
89
|
+
.description("Remove a single storage record")
|
|
90
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID (string, required)")
|
|
91
|
+
.requiredOption("--id <id>", "Record ID (string, required)")
|
|
92
|
+
.addHelpText("after", `
|
|
93
|
+
Example:
|
|
94
|
+
$ cargo-ai storage record remove --model-uuid 550e8400-... --id rec_1`)
|
|
95
|
+
.action(async (opts) => {
|
|
96
|
+
const api = getApi();
|
|
97
|
+
await handleApiCall(() => api.storage.record.remove({
|
|
98
|
+
modelUuid: opts.modelUuid,
|
|
99
|
+
id: opts.id,
|
|
100
|
+
}));
|
|
101
|
+
outputJson({ ok: true });
|
|
102
|
+
});
|
|
53
103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Command-line interface for the Cargo API",
|
|
6
6
|
"engines": {
|
|
@@ -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.20"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@cargo-ai/eslint-config": "*",
|