@cargo-ai/cli 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,7 +45,7 @@ cargo-ai logout
45
45
 
46
46
  ### Browser sign-in (`--oauth`)
47
47
 
48
- `cargo-ai login --oauth` runs the standard [OAuth 2.0 Device Authorization Flow](https://datatracker.ietf.org/doc/html/rfc8628) (similar UX to `gh auth login`) against the Cargo OAuth provider, prints a verification URL and user code, opens your default browser, and polls until you complete sign-in. On success the access token is written to `~/.config/cargo-ai/credentials.json`.
48
+ `cargo-ai login --oauth` runs the standard [OAuth 2.0 Device Authorization Flow](https://datatracker.ietf.org/doc/html/rfc8628) against the Cargo OAuth provider, prints a verification URL and user code, opens your default browser, and polls until you complete sign-in. On success the access token is written to `~/.config/cargo-ai/credentials.json`.
49
49
 
50
50
  The CLI ships with a built-in OAuth client, so no setup is required. Advanced users can override the provider via `--client-id`, `--domain`, and `--audience`.
51
51
 
@@ -32,7 +32,7 @@ export function registerAppCommands(parent, getApi) {
32
32
  .command("create")
33
33
  .description("Create a new app slot")
34
34
  .requiredOption("--name <name>", "Display name for the app")
35
- .requiredOption("--slug <slug>", "URL slug (must be globally unique within the hosting domain)")
35
+ .requiredOption("--slug <slug>", "URL slug (must be unique within your workspace; the public host is suffixed with your workspace UUID prefix)")
36
36
  .option("--folder-uuid <uuid>", "Optional folder UUID")
37
37
  .action(async (opts) => {
38
38
  const api = getApi();
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/commands/hosting/deployment.ts"],"names":[],"mappings":"AAGA,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,CA6JN"}
1
+ {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/commands/hosting/deployment.ts"],"names":[],"mappings":"AAGA,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,CAoMN"}
@@ -89,6 +89,28 @@ export function registerDeploymentCommands(parent, getApi) {
89
89
  stats: { fileCount: files.length },
90
90
  });
91
91
  });
92
+ deployment
93
+ .command("export <uuid>")
94
+ .description("Download a deployment's uploaded source (the pre-build project tree, not the compiled bundle) as a tar.gz")
95
+ .option("--output <file>", "Path of the tar.gz to write (default: ./deployment-<uuid>-source.tar.gz)")
96
+ .action(async (uuid, opts) => {
97
+ const api = getApi();
98
+ const { url } = await handleApiCall(() => api.hosting.deployment.getSourceArchiveUrl({ uuid }));
99
+ // Pre-signed S3 URL: plain fetch, no Cargo auth headers.
100
+ const response = await fetch(url);
101
+ if (response.ok === false) {
102
+ console.error(JSON.stringify({
103
+ error: `Failed to download source archive: HTTP ${response.status}`,
104
+ }));
105
+ process.exit(1);
106
+ }
107
+ const outputFile = path.resolve(opts.output !== undefined
108
+ ? opts.output
109
+ : `deployment-${uuid}-source.tar.gz`);
110
+ await fs.mkdir(path.dirname(outputFile), { recursive: true });
111
+ await fs.writeFile(outputFile, Buffer.from(await response.arrayBuffer()));
112
+ outputJson({ outputFile });
113
+ });
92
114
  deployment
93
115
  .command("promote")
94
116
  .description("Promote a deployment to the live URL")
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/commands/hosting/worker.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAMxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CA8MN"}
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/commands/hosting/worker.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAMxC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAuON"}
@@ -2,7 +2,7 @@ import { existsSync, promises as fs } from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
- import { handleApiCall, outputJson } from "../runHandler.js";
5
+ import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
6
6
  import { copyDirectory, listTemplates } from "../templateUtils.js";
7
7
  const require = createRequire(import.meta.url);
8
8
  export function registerWorkerCommands(parent, getApi) {
@@ -32,29 +32,37 @@ export function registerWorkerCommands(parent, getApi) {
32
32
  .command("create")
33
33
  .description("Create a new worker slot")
34
34
  .requiredOption("--name <name>", "Display name for the worker")
35
- .requiredOption("--slug <slug>", "URL slug (must be globally unique within the hosting domain)")
35
+ .requiredOption("--slug <slug>", "URL slug (must be unique within your workspace; the public host is suffixed with your workspace UUID prefix)")
36
36
  .option("--folder-uuid <uuid>", "Optional folder UUID")
37
+ .option("--triggers <json>", 'Cron triggers, e.g. \'[{"type":"cron","name":"Sync","cron":"@every 1h","path":"/cron/sync","method":"POST"}]\'')
37
38
  .action(async (opts) => {
38
39
  const api = getApi();
39
40
  const result = await handleApiCall(() => api.hosting.worker.create({
40
41
  name: opts.name,
41
42
  slug: opts.slug,
42
43
  folderUuid: opts.folderUuid,
44
+ triggers: opts.triggers !== undefined
45
+ ? parseJson(opts.triggers, "--triggers")
46
+ : undefined,
43
47
  }));
44
48
  outputJson(result);
45
49
  });
46
50
  worker
47
51
  .command("update")
48
- .description("Update an existing worker (name, folder)")
52
+ .description("Update an existing worker (name, folder, triggers)")
49
53
  .requiredOption("--uuid <uuid>", "Worker UUID")
50
54
  .option("--name <name>", "New display name")
51
55
  .option("--folder-uuid <uuid>", "New folder UUID (pass 'null' to move to the workspace root)")
56
+ .option("--triggers <json>", "Full replacement list of cron triggers (pass '[]' to remove all)")
52
57
  .action(async (opts) => {
53
58
  const api = getApi();
54
59
  const result = await handleApiCall(() => api.hosting.worker.update({
55
60
  uuid: opts.uuid,
56
61
  name: opts.name,
57
62
  folderUuid: opts.folderUuid === "null" ? null : opts.folderUuid,
63
+ triggers: opts.triggers !== undefined
64
+ ? parseJson(opts.triggers, "--triggers")
65
+ : undefined,
58
66
  }));
59
67
  outputJson(result);
60
68
  });
@@ -128,8 +136,7 @@ export function registerWorkerCommands(parent, getApi) {
128
136
  `cd ${path.relative(process.cwd(), targetDir)}`,
129
137
  "npm install",
130
138
  `cargo-ai hosting worker create --name '${workerName}' --slug '<your-slug>'`,
131
- "npm run build",
132
- "cargo-ai hosting deployment create --worker-uuid <workerUuid> --source ./dist",
139
+ "cargo-ai hosting deployment create --worker-uuid <workerUuid> --source ./",
133
140
  "cargo-ai hosting deployment promote --uuid <deploymentUuid>",
134
141
  ];
135
142
  if (opts.template === "custom-integration") {
package/build/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
+ import { registerCommands as registerCdkCommands } from "@cargo-ai/cdk/cli";
3
4
  import { Command } from "commander";
4
5
  import { createApi } from "./api.js";
5
6
  import { registerAiCommands } from "./commands/ai/index.js";
6
7
  import { registerAuthCommands } from "./commands/auth/index.js";
7
8
  import { registerBillingCommands } from "./commands/billing/index.js";
8
- import { registerCdkCommands } from "./commands/cdk/index.js";
9
9
  import { registerConnectionCommands } from "./commands/connection/index.js";
10
10
  import { registerContentCommands } from "./commands/content/index.js";
11
11
  import { registerContextCommands } from "./commands/context/index.js";
@@ -73,7 +73,9 @@ registerSystemOfRecordIntegrationCommands(program, getApi);
73
73
  registerUserManagementCommands(program, getApi);
74
74
  registerAiCommands(program, getApi);
75
75
  registerHostingCommands(program, getApi);
76
- registerCdkCommands(program, getApi);
76
+ registerCdkCommands(program
77
+ .command("cdk")
78
+ .description("Cargo CDK — define resources in code and deploy them (plan/deploy)"), getApi);
77
79
  program
78
80
  .parseAsync()
79
81
  .then(() => maybeNotifyUpdate(version))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "description": "Command-line interface for the Cargo API",
@@ -29,10 +29,10 @@
29
29
  "format:check": "prettier --check ."
30
30
  },
31
31
  "dependencies": {
32
- "@cargo-ai/api": "^1.0.31",
33
- "@cargo-ai/app-sdk": "^1.0.2",
32
+ "@cargo-ai/api": "^1.0.39",
33
+ "@cargo-ai/app-sdk": "^1.0.3",
34
34
  "@cargo-ai/cdk": "*",
35
- "@cargo-ai/worker-sdk": "^1.0.3",
35
+ "@cargo-ai/worker-sdk": "^1.0.6",
36
36
  "commander": "^12.1.0",
37
37
  "http-proxy-agent": "^9.1.0",
38
38
  "https-proxy-agent": "^9.1.0",
@@ -1,4 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { Api } from "../../api.js";
3
- export declare function registerCdkCommands(program: Command, getApi: () => Api): void;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cdk/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAkBxC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CAqpB7E"}