@cargo-ai/cli 1.0.27 → 1.0.29

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.
@@ -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":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AASxC,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAoMN"}
@@ -1,6 +1,10 @@
1
1
  import { promises as fs } from "node:fs";
2
2
  import path from "node:path";
3
+ import { HOSTING_GENERATED_DIRECTORIES } from "@cargo-ai/types";
3
4
  import { handleApiCall, outputJson } from "../runHandler.js";
5
+ // One source of truth with the hosting runtime's excludes; `.git` only
6
+ // applies to the CLI walk (the runtime working copy keeps its repo).
7
+ const DEFAULT_DEPLOY_IGNORES = [...HOSTING_GENERATED_DIRECTORIES, ".git"].join(",");
4
8
  export function registerDeploymentCommands(parent, getApi) {
5
9
  const deployment = parent
6
10
  .command("deployment")
@@ -57,7 +61,7 @@ export function registerDeploymentCommands(parent, getApi) {
57
61
  .option("--app-uuid <uuid>", "App UUID (mutually exclusive with --worker-uuid)")
58
62
  .option("--worker-uuid <uuid>", "Worker UUID (mutually exclusive with --app-uuid)")
59
63
  .requiredOption("--source <dir>", "Path to the source directory (typically the package root, not dist/)")
60
- .option("--ignore <list>", "Comma-separated names to ignore (default: node_modules,dist,build,.git,.next)", "node_modules,dist,build,.git,.next")
64
+ .option("--ignore <list>", `Comma-separated names to ignore (default: ${DEFAULT_DEPLOY_IGNORES})`, DEFAULT_DEPLOY_IGNORES)
61
65
  .action(async (opts) => {
62
66
  if ((opts.appUuid === undefined && opts.workerUuid === undefined) ||
63
67
  (opts.appUuid !== undefined && opts.workerUuid !== undefined)) {
@@ -89,6 +93,28 @@ export function registerDeploymentCommands(parent, getApi) {
89
93
  stats: { fileCount: files.length },
90
94
  });
91
95
  });
96
+ deployment
97
+ .command("export <uuid>")
98
+ .description("Download a deployment's uploaded source (the pre-build project tree, not the compiled bundle) as a tar.gz")
99
+ .option("--output <file>", "Path of the tar.gz to write (default: ./deployment-<uuid>-source.tar.gz)")
100
+ .action(async (uuid, opts) => {
101
+ const api = getApi();
102
+ const { url } = await handleApiCall(() => api.hosting.deployment.getSourceArchiveUrl({ uuid }));
103
+ // Pre-signed S3 URL: plain fetch, no Cargo auth headers.
104
+ const response = await fetch(url);
105
+ if (response.ok === false) {
106
+ console.error(JSON.stringify({
107
+ error: `Failed to download source archive: HTTP ${response.status}`,
108
+ }));
109
+ process.exit(1);
110
+ }
111
+ const outputFile = path.resolve(opts.output !== undefined
112
+ ? opts.output
113
+ : `deployment-${uuid}-source.tar.gz`);
114
+ await fs.mkdir(path.dirname(outputFile), { recursive: true });
115
+ await fs.writeFile(outputFile, Buffer.from(await response.arrayBuffer()));
116
+ outputJson({ outputFile });
117
+ });
92
118
  deployment
93
119
  .command("promote")
94
120
  .description("Promote a deployment to the live URL")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "description": "Command-line interface for the Cargo API",
@@ -29,7 +29,8 @@
29
29
  "format:check": "prettier --check ."
30
30
  },
31
31
  "dependencies": {
32
- "@cargo-ai/api": "^1.0.37",
32
+ "@cargo-ai/api": "^1.0.40",
33
+ "@cargo-ai/types": "*",
33
34
  "@cargo-ai/app-sdk": "^1.0.3",
34
35
  "@cargo-ai/cdk": "*",
35
36
  "@cargo-ai/worker-sdk": "^1.0.6",