@cargo-ai/cli 1.0.5 → 1.0.6
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 +10 -1
- package/build/commands/ai/index.d.ts.map +1 -1
- package/build/commands/ai/index.js +1 -3
- package/build/commands/ai/message.d.ts.map +1 -1
- package/build/commands/ai/message.js +9 -5
- package/build/commands/ai/release.d.ts.map +1 -1
- package/build/commands/ai/release.js +0 -4
- package/build/commands/ai/template.js +1 -1
- package/build/commands/connection/connector.d.ts.map +1 -1
- package/build/commands/connection/connector.js +13 -2
- package/build/commands/connection/integration.d.ts.map +1 -1
- package/build/commands/connection/integration.js +29 -2
- package/build/commands/context/file.d.ts +4 -0
- package/build/commands/context/file.d.ts.map +1 -0
- package/build/commands/context/file.js +39 -0
- package/build/commands/context/index.d.ts +4 -0
- package/build/commands/context/index.d.ts.map +1 -0
- package/build/commands/context/index.js +11 -0
- package/build/commands/context/repository.d.ts +4 -0
- package/build/commands/context/repository.d.ts.map +1 -0
- package/build/commands/context/repository.js +33 -0
- package/build/commands/context/skill.d.ts.map +1 -0
- package/build/commands/context/skill.js +21 -0
- package/build/commands/orchestration/template.js +1 -1
- package/build/commands/runHandler.d.ts +1 -0
- package/build/commands/runHandler.d.ts.map +1 -1
- package/build/commands/runHandler.js +9 -0
- package/build/commands/storage/record.d.ts.map +1 -1
- package/build/commands/storage/record.js +32 -1
- package/build/commands/systemOfRecordIntegration/systemOfRecord.js +1 -1
- package/build/index.js +6 -1
- package/package.json +2 -2
- package/build/commands/ai/skill.d.ts.map +0 -1
- package/build/commands/ai/skill.js +0 -101
- /package/build/commands/{ai → context}/skill.d.ts +0 -0
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.
|
|
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/reference/cli/overview).
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -91,9 +91,18 @@ cargo-ai orchestration workflow --help
|
|
|
91
91
|
| **system-of-record** | System of record, client, logs | `cargo-ai system-of-record sor list`, `cargo-ai system-of-record log list --payload '{}'` |
|
|
92
92
|
| **user-management** | Current user (no workspace context) | `cargo-ai user-management user get-current` |
|
|
93
93
|
| **ai** | AI templates, agents, releases, chats, MCP, files | `cargo-ai ai template list`, `cargo-ai ai agent list`, `cargo-ai ai file list` |
|
|
94
|
+
| **context** | Context repository, files, and skills | `cargo-ai context skill list`, `cargo-ai context skill get --slug <slug>`, `cargo-ai context file list` |
|
|
94
95
|
|
|
95
96
|
Commands that accept complex payloads use a `--payload <json>` option (e.g. `cargo-ai orchestration play create --payload '{"name":"My Play",...}'`). Use `--help` on any subcommand for options.
|
|
96
97
|
|
|
98
|
+
## Agent Skills
|
|
99
|
+
|
|
100
|
+
[Cargo Skills](https://github.com/getcargohq/cargo-skills) teaches AI coding agents (Claude Code, Cursor, Windsurf, GitHub Copilot, etc.) how to use the Cargo CLI. Install the skill to let your agent build, run, and manage revenue automation workflows programmatically:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx skills add getcargohq/cargo-skills
|
|
104
|
+
```
|
|
105
|
+
|
|
97
106
|
## Development
|
|
98
107
|
|
|
99
108
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAexC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CAkB3E"}
|
|
@@ -8,14 +8,13 @@ import { registerMemoryCommands } from "./memory.js";
|
|
|
8
8
|
import { registerMessageCommands } from "./message.js";
|
|
9
9
|
import { registerPromptCommands } from "./prompt.js";
|
|
10
10
|
import { registerReleaseCommands } from "./release.js";
|
|
11
|
-
import { registerSkillCommands } from "./skill.js";
|
|
12
11
|
import { registerSuggestedActionCommands } from "./suggestedAction.js";
|
|
13
12
|
import { registerTemplateCommands } from "./template.js";
|
|
14
13
|
import { registerVoteCommands } from "./vote.js";
|
|
15
14
|
export function registerAiCommands(parent, getApi) {
|
|
16
15
|
const ai = parent
|
|
17
16
|
.command("ai")
|
|
18
|
-
.description("AI templates, agents, releases, chats, MCP, files
|
|
17
|
+
.description("AI templates, agents, releases, chats, MCP, files");
|
|
19
18
|
registerTemplateCommands(ai, getApi);
|
|
20
19
|
registerAgentCommands(ai, getApi);
|
|
21
20
|
registerReleaseCommands(ai, getApi);
|
|
@@ -29,5 +28,4 @@ export function registerAiCommands(parent, getApi) {
|
|
|
29
28
|
registerPromptCommands(ai, getApi);
|
|
30
29
|
registerMemoryCommands(ai, getApi);
|
|
31
30
|
registerSuggestedActionCommands(ai, getApi);
|
|
32
|
-
registerSkillCommands(ai, getApi);
|
|
33
31
|
}
|
|
@@ -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;
|
|
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,CA0JN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
1
|
+
import { handleApiCall, outputJson, parseJson, pollMessageUntilFinished, } from "../runHandler.js";
|
|
2
2
|
export function registerMessageCommands(parent, getApi) {
|
|
3
3
|
const message = parent.command("message").description("Message operations");
|
|
4
4
|
message
|
|
@@ -10,7 +10,6 @@ export function registerMessageCommands(parent, getApi) {
|
|
|
10
10
|
.option("--resources <json>", 'Resources (JSON array, e.g. [{"slug":"my-resource","kind":"model","modelUuid":"..."}])')
|
|
11
11
|
.option("--capabilities <json>", 'Capabilities (JSON array, e.g. [{"slug":"web-browsing"}])')
|
|
12
12
|
.option("--mcp-clients <json>", 'MCP clients (JSON array, e.g. [{"name":"my-mcp","url":"..."}])')
|
|
13
|
-
.option("--skill-uuids <uuids>", "Skill UUIDs (comma-separated)")
|
|
14
13
|
.option("--system-prompt <text>", "System prompt")
|
|
15
14
|
.option("--with-reasoning", "Enable reasoning")
|
|
16
15
|
.option("--temperature <n>", "Sampling temperature")
|
|
@@ -18,6 +17,8 @@ export function registerMessageCommands(parent, getApi) {
|
|
|
18
17
|
.option("--integration-slug <slug>", "Integration slug")
|
|
19
18
|
.option("--connector-uuid <uuid>", "Connector UUID")
|
|
20
19
|
.option("--language-model-slug <slug>", "Language model slug")
|
|
20
|
+
.option("--wait-until-finished", "Poll the assistant message until it reaches a terminal status before returning")
|
|
21
|
+
.option("--polling-interval <ms>", "Polling interval in milliseconds (used with --wait-until-finished)", "5000")
|
|
21
22
|
.action(async (opts) => {
|
|
22
23
|
const api = getApi();
|
|
23
24
|
const result = await handleApiCall(() => api.ai.message.create({
|
|
@@ -35,9 +36,6 @@ export function registerMessageCommands(parent, getApi) {
|
|
|
35
36
|
mcpClients: opts.mcpClients !== undefined
|
|
36
37
|
? parseJson(opts.mcpClients, "--mcp-clients")
|
|
37
38
|
: undefined,
|
|
38
|
-
skillUuids: opts.skillUuids !== undefined
|
|
39
|
-
? opts.skillUuids.split(",").map((s) => s.trim())
|
|
40
|
-
: undefined,
|
|
41
39
|
systemPrompt: opts.systemPrompt,
|
|
42
40
|
withReasoning: opts.withReasoning,
|
|
43
41
|
temperature: opts.temperature !== undefined
|
|
@@ -50,6 +48,12 @@ export function registerMessageCommands(parent, getApi) {
|
|
|
50
48
|
connectorUuid: opts.connectorUuid,
|
|
51
49
|
languageModelSlug: opts.languageModelSlug,
|
|
52
50
|
}));
|
|
51
|
+
if (opts.waitUntilFinished === true) {
|
|
52
|
+
const intervalMs = parseInt(opts.pollingInterval, 10);
|
|
53
|
+
const finalResult = await pollMessageUntilFinished(() => api.ai.message.get(result.assistantMessage.uuid), (r) => r.message.finishedAt, intervalMs);
|
|
54
|
+
outputJson(finalResult);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
53
57
|
outputJson(result);
|
|
54
58
|
});
|
|
55
59
|
message
|
|
@@ -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,CA8PN"}
|
|
@@ -114,7 +114,6 @@ export function registerReleaseCommands(parent, getApi) {
|
|
|
114
114
|
.option("--max-steps <n>", "Max steps")
|
|
115
115
|
.option("--connector-uuid <uuid>", "Connector UUID")
|
|
116
116
|
.option("--description <text>", "Release description")
|
|
117
|
-
.option("--skill-uuids <uuids>", "Skill UUIDs (comma-separated)")
|
|
118
117
|
.option("--options <json>", "Options (JSON)")
|
|
119
118
|
.action(async (opts) => {
|
|
120
119
|
const api = getApi();
|
|
@@ -128,9 +127,6 @@ export function registerReleaseCommands(parent, getApi) {
|
|
|
128
127
|
resources: parseJson(opts.resources, "--resources"),
|
|
129
128
|
capabilities: parseJson(opts.capabilities, "--capabilities"),
|
|
130
129
|
suggestedActions: parseJson(opts.suggestedActions, "--suggested-actions"),
|
|
131
|
-
skillUuids: opts.skillUuids !== undefined
|
|
132
|
-
? opts.skillUuids.split(",").map((uuid) => uuid.trim())
|
|
133
|
-
: [],
|
|
134
130
|
systemPrompt: opts.systemPrompt,
|
|
135
131
|
withReasoning: opts.withReasoning,
|
|
136
132
|
temperature: opts.temperature !== undefined
|
|
@@ -8,7 +8,7 @@ export function registerTemplateCommands(parent, getApi) {
|
|
|
8
8
|
.description("List all AI templates")
|
|
9
9
|
.action(async () => {
|
|
10
10
|
const api = getApi();
|
|
11
|
-
const result = await handleApiCall(() => api.ai.template.
|
|
11
|
+
const result = await handleApiCall(() => api.ai.template.list({}));
|
|
12
12
|
outputJson(result);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAkNN"}
|
|
@@ -6,9 +6,20 @@ export function registerConnectorCommands(parent, getApi) {
|
|
|
6
6
|
connector
|
|
7
7
|
.command("list")
|
|
8
8
|
.description("List all connectors")
|
|
9
|
-
.
|
|
9
|
+
.option("--integration-slug <slug>", "Filter connectors by integration slug")
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
const api = getApi();
|
|
12
|
+
const result = await handleApiCall(() => api.connection.connector.list({
|
|
13
|
+
integrationSlug: opts.integrationSlug,
|
|
14
|
+
}));
|
|
15
|
+
outputJson(result);
|
|
16
|
+
});
|
|
17
|
+
connector
|
|
18
|
+
.command("get <uuid>")
|
|
19
|
+
.description("Get a connector by UUID")
|
|
20
|
+
.action(async (uuid) => {
|
|
10
21
|
const api = getApi();
|
|
11
|
-
const result = await handleApiCall(() => api.connection.connector.
|
|
22
|
+
const result = await handleApiCall(() => api.connection.connector.get({ uuid }));
|
|
12
23
|
outputJson(result);
|
|
13
24
|
});
|
|
14
25
|
connector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/commands/connection/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAwFN"}
|
|
@@ -6,9 +6,36 @@ export function registerIntegrationCommands(parent, getApi) {
|
|
|
6
6
|
integration
|
|
7
7
|
.command("list")
|
|
8
8
|
.description("List all integrations")
|
|
9
|
-
.
|
|
9
|
+
.option("--category <category>", "Filter by category")
|
|
10
|
+
.option("--slug <slug>", "Filter by slug")
|
|
11
|
+
.option("--search <search>", "Search by name (case-insensitive)")
|
|
12
|
+
.option("--has-actions <bool>", "Filter by presence of actions (true/false)")
|
|
13
|
+
.option("--has-extractors <bool>", "Filter by presence of extractors (true/false)")
|
|
14
|
+
.action(async (opts) => {
|
|
15
|
+
const api = getApi();
|
|
16
|
+
const result = await handleApiCall(() => api.connection.integration.list({
|
|
17
|
+
category: opts.category,
|
|
18
|
+
slug: opts.slug,
|
|
19
|
+
search: opts.search,
|
|
20
|
+
hasActions: opts.hasActions === "true"
|
|
21
|
+
? true
|
|
22
|
+
: opts.hasActions === "false"
|
|
23
|
+
? false
|
|
24
|
+
: undefined,
|
|
25
|
+
hasExtractors: opts.hasExtractors === "true"
|
|
26
|
+
? true
|
|
27
|
+
: opts.hasExtractors === "false"
|
|
28
|
+
? false
|
|
29
|
+
: undefined,
|
|
30
|
+
}));
|
|
31
|
+
outputJson(result);
|
|
32
|
+
});
|
|
33
|
+
integration
|
|
34
|
+
.command("get <slug>")
|
|
35
|
+
.description("Get an integration by slug")
|
|
36
|
+
.action(async (slug) => {
|
|
10
37
|
const api = getApi();
|
|
11
|
-
const result = await handleApiCall(() => api.connection.integration.
|
|
38
|
+
const result = await handleApiCall(() => api.connection.integration.get({ slug }));
|
|
12
39
|
outputJson(result);
|
|
13
40
|
});
|
|
14
41
|
integration
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/commands/context/file.ts"],"names":[],"mappings":"AAAA,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,CAqD7E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerFileCommands(parent, getApi) {
|
|
3
|
+
const file = parent.command("file").description("Context file operations");
|
|
4
|
+
file
|
|
5
|
+
.command("browse")
|
|
6
|
+
.description("Browse files in the context repository")
|
|
7
|
+
.option("--path <path>", "Path to browse (omit for root)")
|
|
8
|
+
.action(async (opts) => {
|
|
9
|
+
const api = getApi();
|
|
10
|
+
const result = await handleApiCall(() => api.context.file.browse({ path: opts.path }));
|
|
11
|
+
outputJson(result);
|
|
12
|
+
});
|
|
13
|
+
file
|
|
14
|
+
.command("read")
|
|
15
|
+
.description("Read a file from the context repository")
|
|
16
|
+
.requiredOption("--path <path>", "Full path to the file")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const api = getApi();
|
|
19
|
+
const result = await handleApiCall(() => api.context.file.read({ path: opts.path }));
|
|
20
|
+
outputJson(result);
|
|
21
|
+
});
|
|
22
|
+
file
|
|
23
|
+
.command("write")
|
|
24
|
+
.description("Write a file to the context repository")
|
|
25
|
+
.requiredOption("--path <path>", "Full path to the file")
|
|
26
|
+
.requiredOption("--content <content>", "Content to write")
|
|
27
|
+
.option("--commit-message <message>", "Commit message")
|
|
28
|
+
.option("--sha <sha>", "SHA of the existing file to update")
|
|
29
|
+
.action(async (opts) => {
|
|
30
|
+
const api = getApi();
|
|
31
|
+
const result = await handleApiCall(() => api.context.file.write({
|
|
32
|
+
path: opts.path,
|
|
33
|
+
content: opts.content,
|
|
34
|
+
commitMessage: opts.commitMessage,
|
|
35
|
+
sha: opts.sha,
|
|
36
|
+
}));
|
|
37
|
+
outputJson(result);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKxC,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAQN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerFileCommands } from "./file.js";
|
|
2
|
+
import { registerRepositoryCommands } from "./repository.js";
|
|
3
|
+
import { registerSkillCommands } from "./skill.js";
|
|
4
|
+
export function registerContextCommands(parent, getApi) {
|
|
5
|
+
const context = parent
|
|
6
|
+
.command("context")
|
|
7
|
+
.description("Context repository, files, and skills");
|
|
8
|
+
registerRepositoryCommands(context, getApi);
|
|
9
|
+
registerFileCommands(context, getApi);
|
|
10
|
+
registerSkillCommands(context, getApi);
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/commands/context/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA8CN"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
2
|
+
export function registerRepositoryCommands(parent, getApi) {
|
|
3
|
+
const repository = parent
|
|
4
|
+
.command("repository")
|
|
5
|
+
.description("Context repository operations");
|
|
6
|
+
repository
|
|
7
|
+
.command("get")
|
|
8
|
+
.description("Get the context repository configuration")
|
|
9
|
+
.action(async () => {
|
|
10
|
+
const api = getApi();
|
|
11
|
+
const result = await handleApiCall(() => api.context.repository.get());
|
|
12
|
+
outputJson(result);
|
|
13
|
+
});
|
|
14
|
+
repository
|
|
15
|
+
.command("update")
|
|
16
|
+
.description("Update the context repository configuration")
|
|
17
|
+
.option("--source <json>", 'Repository source (JSON, e.g. {"kind":"managed"} or {"kind":"custom","connectorUuid":"..."})')
|
|
18
|
+
.option("--repository-owner <owner>", "GitHub owner (user or org)")
|
|
19
|
+
.option("--repository-name <name>", "GitHub repository name")
|
|
20
|
+
.option("--default-branch <branch>", "Default branch (e.g. main)")
|
|
21
|
+
.action(async (opts) => {
|
|
22
|
+
const api = getApi();
|
|
23
|
+
const result = await handleApiCall(() => api.context.repository.update({
|
|
24
|
+
source: opts.source !== undefined
|
|
25
|
+
? parseJson(opts.source, "--source")
|
|
26
|
+
: undefined,
|
|
27
|
+
repositoryOwner: opts.repositoryOwner,
|
|
28
|
+
repositoryName: opts.repositoryName,
|
|
29
|
+
defaultBranch: opts.defaultBranch,
|
|
30
|
+
}));
|
|
31
|
+
outputJson(result);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/commands/context/skill.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,CAuBN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
+
export function registerSkillCommands(parent, getApi) {
|
|
3
|
+
const skill = parent.command("skill").description("Context skill operations");
|
|
4
|
+
skill
|
|
5
|
+
.command("list")
|
|
6
|
+
.description("List all skills in the context repository")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
const api = getApi();
|
|
9
|
+
const result = await handleApiCall(() => api.context.skill.list());
|
|
10
|
+
outputJson(result);
|
|
11
|
+
});
|
|
12
|
+
skill
|
|
13
|
+
.command("get")
|
|
14
|
+
.description("Get a skill by slug")
|
|
15
|
+
.requiredOption("--slug <slug>", "Skill slug (path in the repository)")
|
|
16
|
+
.action(async (opts) => {
|
|
17
|
+
const api = getApi();
|
|
18
|
+
const result = await handleApiCall(() => api.context.skill.get({ slug: opts.slug }));
|
|
19
|
+
outputJson(result);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -8,7 +8,7 @@ export function registerTemplateCommands(parent, getApi) {
|
|
|
8
8
|
.description("List all templates")
|
|
9
9
|
.action(async () => {
|
|
10
10
|
const api = getApi();
|
|
11
|
-
const result = await handleApiCall(() => api.orchestration.template.
|
|
11
|
+
const result = await handleApiCall(() => api.orchestration.template.list({}));
|
|
12
12
|
outputJson(result);
|
|
13
13
|
});
|
|
14
14
|
template
|
|
@@ -3,4 +3,5 @@ export declare function parseJson(value: string, optionName: string): any;
|
|
|
3
3
|
export declare function handleApiCall<T>(fn: () => Promise<T>): Promise<T | never>;
|
|
4
4
|
export declare function pollRunUntilFinished<T>(getResult: () => Promise<T>, getStatus: (result: T) => string, intervalMs: number): Promise<T>;
|
|
5
5
|
export declare function pollBatchUntilFinished<T>(getResult: () => Promise<T>, getStatus: (result: T) => string, intervalMs: number): Promise<T>;
|
|
6
|
+
export declare function pollMessageUntilFinished<T>(getResult: () => Promise<T>, getFinishedAt: (result: T) => string | null | undefined, intervalMs: number): Promise<T>;
|
|
6
7
|
//# sourceMappingURL=runHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runHandler.d.ts","sourceRoot":"","sources":["../../src/commands/runHandler.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/C;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAWhE;AAED,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAiBpB;AAoBD,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CASZ"}
|
|
1
|
+
{"version":3,"file":"runHandler.d.ts","sourceRoot":"","sources":["../../src/commands/runHandler.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/C;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAWhE;AAED,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAiBpB;AAoBD,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,aAAa,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,EACvD,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CAWZ"}
|
|
@@ -62,3 +62,12 @@ export async function pollBatchUntilFinished(getResult, getStatus, intervalMs) {
|
|
|
62
62
|
}
|
|
63
63
|
return result;
|
|
64
64
|
}
|
|
65
|
+
export async function pollMessageUntilFinished(getResult, getFinishedAt, intervalMs) {
|
|
66
|
+
let result = await handleApiCall(getResult);
|
|
67
|
+
const finishedAt = getFinishedAt(result);
|
|
68
|
+
while (finishedAt === null || finishedAt === undefined) {
|
|
69
|
+
await sleep(intervalMs);
|
|
70
|
+
result = await handleApiCall(getResult);
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
@@ -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,CAiEN"}
|
|
@@ -3,13 +3,44 @@ export function registerRecordCommands(parent, getApi) {
|
|
|
3
3
|
const record = parent
|
|
4
4
|
.command("record")
|
|
5
5
|
.description("Storage record operations");
|
|
6
|
+
record
|
|
7
|
+
.command("get")
|
|
8
|
+
.description("Get a storage record")
|
|
9
|
+
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
10
|
+
.requiredOption("--id <id>", "Record ID")
|
|
11
|
+
.action(async (opts) => {
|
|
12
|
+
const api = getApi();
|
|
13
|
+
const result = await handleApiCall(() => api.storage.record.get({ modelUuid: opts.modelUuid, id: opts.id }));
|
|
14
|
+
outputJson(result);
|
|
15
|
+
});
|
|
6
16
|
record
|
|
7
17
|
.command("list")
|
|
8
18
|
.description("List storage records")
|
|
9
19
|
.requiredOption("--model-uuid <uuid>", "Model UUID")
|
|
20
|
+
.option("--limit <n>", "Limit")
|
|
21
|
+
.option("--offset <n>", "Offset")
|
|
22
|
+
.option("--sort-kind <kind>", "Sort direction (asc|desc)")
|
|
23
|
+
.option("--sort-column-slug <slug>", "Sort column (_id|_title|_emitted_at)")
|
|
10
24
|
.action(async (opts) => {
|
|
11
25
|
const api = getApi();
|
|
12
|
-
const
|
|
26
|
+
const limit = opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined;
|
|
27
|
+
const offset = opts.offset !== undefined ? parseInt(opts.offset, 10) : undefined;
|
|
28
|
+
const sort = opts.sortKind !== undefined || opts.sortColumnSlug !== undefined
|
|
29
|
+
? {
|
|
30
|
+
kind: opts.sortKind !== undefined
|
|
31
|
+
? opts.sortKind
|
|
32
|
+
: "asc",
|
|
33
|
+
columnSlug: opts.sortColumnSlug !== undefined
|
|
34
|
+
? opts.sortColumnSlug
|
|
35
|
+
: "_id",
|
|
36
|
+
}
|
|
37
|
+
: undefined;
|
|
38
|
+
const result = await handleApiCall(() => api.storage.record.list({
|
|
39
|
+
modelUuid: opts.modelUuid,
|
|
40
|
+
limit,
|
|
41
|
+
offset,
|
|
42
|
+
sort,
|
|
43
|
+
}));
|
|
13
44
|
outputJson(result);
|
|
14
45
|
});
|
|
15
46
|
}
|
|
@@ -3,7 +3,7 @@ export function registerSystemOfRecordCommands(parent, getApi) {
|
|
|
3
3
|
const sor = parent.command("sor").description("System of record operations");
|
|
4
4
|
sor
|
|
5
5
|
.command("list")
|
|
6
|
-
.description("List all
|
|
6
|
+
.description("List all systems of record")
|
|
7
7
|
.action(async () => {
|
|
8
8
|
const api = getApi();
|
|
9
9
|
const result = await handleApiCall(() => api.systemOfRecordIntegration.systemOfRecord.all());
|
package/build/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { Command } from "commander";
|
|
3
4
|
import { createApi } from "./api.js";
|
|
4
5
|
import { registerAiCommands } from "./commands/ai/index.js";
|
|
5
6
|
import { registerAuthCommands } from "./commands/auth.js";
|
|
6
7
|
import { registerBillingCommands } from "./commands/billing/index.js";
|
|
7
8
|
import { registerConnectionCommands } from "./commands/connection/index.js";
|
|
9
|
+
import { registerContextCommands } from "./commands/context/index.js";
|
|
8
10
|
import { registerExpressionCommands } from "./commands/expression/index.js";
|
|
9
11
|
import { registerInitCommand } from "./commands/init.js";
|
|
10
12
|
import { registerOrchestrationCommands } from "./commands/orchestration/index.js";
|
|
@@ -14,8 +16,10 @@ import { registerStorageCommands } from "./commands/storage/index.js";
|
|
|
14
16
|
import { registerSystemOfRecordIntegrationCommands } from "./commands/systemOfRecordIntegration/index.js";
|
|
15
17
|
import { registerUserManagementCommands } from "./commands/userManagement/index.js";
|
|
16
18
|
import { registerWorkspaceCommands } from "./commands/workspace/index.js";
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
const { version } = require("../package.json");
|
|
17
21
|
const program = new Command();
|
|
18
|
-
program.name("cargo-ai").description("Cargo API CLI").version(
|
|
22
|
+
program.name("cargo-ai").description("Cargo API CLI").version(version);
|
|
19
23
|
registerAuthCommands(program);
|
|
20
24
|
const getApi = () => createApi();
|
|
21
25
|
registerInitCommand(program, getApi);
|
|
@@ -23,6 +27,7 @@ registerOrchestrationCommands(program, getApi);
|
|
|
23
27
|
registerWorkspaceCommands(program, getApi);
|
|
24
28
|
registerStorageCommands(program, getApi);
|
|
25
29
|
registerConnectionCommands(program, getApi);
|
|
30
|
+
registerContextCommands(program, getApi);
|
|
26
31
|
registerBillingCommands(program, getApi);
|
|
27
32
|
registerSegmentationCommands(program, getApi);
|
|
28
33
|
registerRevenueOrganizationCommands(program, getApi);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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.13"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@cargo-ai/eslint-config": "*",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/commands/ai/skill.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,CAmJN"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { handleApiCall, outputJson } from "../runHandler.js";
|
|
2
|
-
export function registerSkillCommands(parent, getApi) {
|
|
3
|
-
const skill = parent
|
|
4
|
-
.command("skill")
|
|
5
|
-
.description("Skill operations (list, get, create, remove, existsBySlug)");
|
|
6
|
-
skill
|
|
7
|
-
.command("all")
|
|
8
|
-
.description("Get all workspace skills")
|
|
9
|
-
.action(async () => {
|
|
10
|
-
const api = getApi();
|
|
11
|
-
const result = await handleApiCall(() => api.ai.skill.all());
|
|
12
|
-
outputJson(result);
|
|
13
|
-
});
|
|
14
|
-
skill
|
|
15
|
-
.command("get <uuid>")
|
|
16
|
-
.description("Get skill metadata")
|
|
17
|
-
.action(async (uuid) => {
|
|
18
|
-
const api = getApi();
|
|
19
|
-
const result = await handleApiCall(() => api.ai.skill.get(uuid));
|
|
20
|
-
outputJson(result);
|
|
21
|
-
});
|
|
22
|
-
skill
|
|
23
|
-
.command("content <uuid>")
|
|
24
|
-
.description("Get skill with body content and files")
|
|
25
|
-
.action(async (uuid) => {
|
|
26
|
-
const api = getApi();
|
|
27
|
-
const result = await handleApiCall(() => api.ai.skill.getContent(uuid));
|
|
28
|
-
outputJson(result);
|
|
29
|
-
});
|
|
30
|
-
skill
|
|
31
|
-
.command("create")
|
|
32
|
-
.description("Create a skill (custom or from a GitHub community source)")
|
|
33
|
-
.requiredOption("--slug <slug>", "Skill slug (lowercase, underscores)")
|
|
34
|
-
.option("--name <name>", "Skill display name")
|
|
35
|
-
.option("--description <description>", "Skill description")
|
|
36
|
-
.option("--body <body>", "Skill body content")
|
|
37
|
-
.option("--source-owner <owner>", "GitHub repo owner (community source)")
|
|
38
|
-
.option("--source-repo <repo>", "GitHub repo name (community source)")
|
|
39
|
-
.option("--source-path <path>", "Path to skill within the repo (community source)")
|
|
40
|
-
.action(async (options) => {
|
|
41
|
-
const api = getApi();
|
|
42
|
-
const isCommunity = options.sourceOwner !== undefined && options.sourceRepo !== undefined;
|
|
43
|
-
const source = isCommunity === true
|
|
44
|
-
? {
|
|
45
|
-
kind: "community",
|
|
46
|
-
owner: options.sourceOwner,
|
|
47
|
-
repo: options.sourceRepo,
|
|
48
|
-
path: options.sourcePath,
|
|
49
|
-
}
|
|
50
|
-
: { kind: "custom" };
|
|
51
|
-
const result = await handleApiCall(() => api.ai.skill.create({
|
|
52
|
-
slug: options.slug,
|
|
53
|
-
name: options.name,
|
|
54
|
-
description: options.description,
|
|
55
|
-
body: options.body,
|
|
56
|
-
source,
|
|
57
|
-
}));
|
|
58
|
-
outputJson(result);
|
|
59
|
-
});
|
|
60
|
-
skill
|
|
61
|
-
.command("update <uuid>")
|
|
62
|
-
.description("Update a custom skill")
|
|
63
|
-
.option("--name <name>", "New display name")
|
|
64
|
-
.option("--description <description>", "New description")
|
|
65
|
-
.option("--body <body>", "New body content")
|
|
66
|
-
.option("--files <json>", "JSON array of {path, content} file entries")
|
|
67
|
-
.action(async (uuid, options) => {
|
|
68
|
-
const api = getApi();
|
|
69
|
-
const payload = { uuid };
|
|
70
|
-
if (options.name !== undefined) {
|
|
71
|
-
payload.name = options.name;
|
|
72
|
-
}
|
|
73
|
-
if (options.description !== undefined) {
|
|
74
|
-
payload.description = options.description;
|
|
75
|
-
}
|
|
76
|
-
if (options.body !== undefined) {
|
|
77
|
-
payload.body = options.body;
|
|
78
|
-
}
|
|
79
|
-
if (options.files !== undefined) {
|
|
80
|
-
payload.files = JSON.parse(options.files);
|
|
81
|
-
}
|
|
82
|
-
const result = await handleApiCall(() => api.ai.skill.update(payload));
|
|
83
|
-
outputJson(result);
|
|
84
|
-
});
|
|
85
|
-
skill
|
|
86
|
-
.command("exists-by-slug <slug>")
|
|
87
|
-
.description("Check if a skill with the given slug exists")
|
|
88
|
-
.action(async (slug) => {
|
|
89
|
-
const api = getApi();
|
|
90
|
-
const result = await handleApiCall(() => api.ai.skill.existsBySlug({ slug }));
|
|
91
|
-
outputJson(result);
|
|
92
|
-
});
|
|
93
|
-
skill
|
|
94
|
-
.command("remove <uuid>")
|
|
95
|
-
.description("Remove a skill")
|
|
96
|
-
.action(async (uuid) => {
|
|
97
|
-
const api = getApi();
|
|
98
|
-
await handleApiCall(() => api.ai.skill.remove(uuid));
|
|
99
|
-
outputJson({ outcome: "removed" });
|
|
100
|
-
});
|
|
101
|
-
}
|
|
File without changes
|