@cargo-ai/cli 1.0.88 → 1.0.90

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
@@ -207,7 +207,7 @@ Other release verbs (`list`, `get <uuid>`, `get-deployed`, `get-draft`, `update-
207
207
  **Let your agent install everything.** Paste this into Claude Code, Codex, or Cursor and it handles the CLI, sign-in, and skills for its own platform:
208
208
 
209
209
  ```
210
- Install Cargo by following every step in https://api.getcargo.io/agent-install.txt
210
+ Install Cargo by following https://api.getcargo.io/INSTALL.md
211
211
  ```
212
212
 
213
213
  **Or install manually.** As a plugin (Claude Code, Codex, Cursor — bundles the skills plus approval and session hooks):
@@ -86,8 +86,8 @@ The user confirms each Bash, Write, Edit and NotebookEdit call, and can only ans
86
86
 
87
87
  Prefer minimal, focused diffs; match the existing code style; run the project's own checks when they exist. End each task with a short summary of what changed and how it was validated.`;
88
88
  const CDK_RAILS_INSTRUCTIONS = `This directory is a Cargo CDK project.
89
- - Never edit cargo.state.json, cargo.state.lock, or .cargo-ai/ by hand — they are generated.
90
- - Validate your changes before declaring them done: run \`npx tsc --noEmit\` and \`npx cargo-cdk plan\` (plan is offline and safe).
89
+ - Never edit cargo.state.json, cargo.state.lock, or .cargo-ai/ by hand — they are generated. Repoint this project's deploy state with \`cargo-cdk state bind\`.
90
+ - Validate your changes before declaring them done: run \`npx tsc --noEmit\` and \`npx cargo-cdk plan\` (plan only reads — it changes nothing).
91
91
  - Never run \`cargo-cdk deploy\`, \`destroy\`, \`import\`, or \`rollback\` unless the user explicitly asked.`;
92
92
  const LOCAL_CDK_RAILS_SKILL = {
93
93
  name: "cdk-rails",
@@ -25,7 +25,7 @@ export async function* streamMessageTextDeltas(input) {
25
25
  }
26
26
  const body = {
27
27
  chatUuid: input.chatUuid,
28
- chatTrigger: { type: "app" },
28
+ chatTrigger: { type: "cli" },
29
29
  uuid: input.messageUuid,
30
30
  parts: input.parts,
31
31
  };
@@ -121,7 +121,7 @@ async function ensureChat(input) {
121
121
  }
122
122
  await handleApiCall(() => input.api.ai.chat.create({
123
123
  uuid: input.chatUuid,
124
- trigger: { type: "app" },
124
+ trigger: { type: "cli" },
125
125
  agentUuid: input.agentUuid,
126
126
  }), { spinner: false });
127
127
  }
@@ -62,7 +62,7 @@ export async function resolveWorkspace(opts) {
62
62
  }
63
63
  const promptInput = openPromptInput();
64
64
  if (promptInput === undefined) {
65
- failWith("Multiple workspaces available and no interactive terminal; pass --workspace-uuid <uuid> (or set CARGO_WORKSPACE_UUID when using install.sh) to select one.", { code: ExitCodes.InvalidUsage });
65
+ failWith("Multiple workspaces available and no interactive terminal; pass --workspace-uuid <uuid> (or set CARGO_WORKSPACE_UUID) to select one.", { code: ExitCodes.InvalidUsage });
66
66
  }
67
67
  let selectedWorkspace;
68
68
  try {
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { Api } from "../../api.js";
3
+ export declare function registerEnvVarCommands(parent: Command, getApi: () => Api): void;
4
+ //# sourceMappingURL=envVar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envVar.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/envVar.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,CAmFN"}
@@ -0,0 +1,71 @@
1
+ import { handleApiCall, outputJson } from "../runHandler.js";
2
+ export function registerEnvVarCommands(parent, getApi) {
3
+ const envVar = parent
4
+ .command("envVar")
5
+ .description("Workspace environment variables, injected into every worker, app and agent");
6
+ envVar
7
+ .command("list")
8
+ .description("List all workspace environment variables")
9
+ .action(async () => {
10
+ const api = getApi();
11
+ const result = await handleApiCall(() => api.workspaceManagement.envVar.all());
12
+ outputJson(result);
13
+ });
14
+ envVar
15
+ .command("create")
16
+ .description("Create a workspace environment variable")
17
+ .requiredOption("--key <key>", "Environment variable name")
18
+ .option("--value <value>", "Value. Omit to read it from the environment variable of the same name")
19
+ .option("--secret", "Encrypt the value at rest and never return it")
20
+ .option("--description <description>", "What this variable is for")
21
+ .action(async (opts) => {
22
+ const api = getApi();
23
+ const value = resolveValue(opts.key, opts.value);
24
+ const result = await handleApiCall(() => api.workspaceManagement.envVar.create({
25
+ key: opts.key,
26
+ value,
27
+ isSecret: opts.secret === true,
28
+ description: opts.description === undefined ? null : opts.description,
29
+ }));
30
+ outputJson(result);
31
+ });
32
+ envVar
33
+ .command("update <uuid>")
34
+ .description("Update a workspace environment variable")
35
+ .option("--value <value>", "New value. Omit to keep the stored one")
36
+ .option("--secret", "Encrypt the value at rest and never return it")
37
+ .option("--no-secret", "Store the value in plain text")
38
+ .option("--description <description>", "What this variable is for")
39
+ .action(async (uuid, opts) => {
40
+ const api = getApi();
41
+ const result = await handleApiCall(() => api.workspaceManagement.envVar.update({
42
+ uuid,
43
+ value: opts.value,
44
+ isSecret: opts.secret,
45
+ description: opts.description,
46
+ }));
47
+ outputJson(result);
48
+ });
49
+ envVar
50
+ .command("remove <uuid>")
51
+ .description("Remove a workspace environment variable")
52
+ .action(async (uuid) => {
53
+ const api = getApi();
54
+ await handleApiCall(() => api.workspaceManagement.envVar.remove(uuid));
55
+ outputJson({ ok: true });
56
+ });
57
+ }
58
+ /**
59
+ * Falling back to the local environment keeps a secret out of argv (and out of
60
+ * the shell history), which is the whole point of `envVar create --secret`.
61
+ */
62
+ const resolveValue = (key, value) => {
63
+ if (value !== undefined) {
64
+ return value;
65
+ }
66
+ const fromEnvironment = process.env[key];
67
+ if (fromEnvironment === undefined) {
68
+ throw new Error(`no value given — pass --value, or export ${key} before running this command.`);
69
+ }
70
+ return fromEnvironment;
71
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAUxC,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAeN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAWxC,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAgBN"}
@@ -1,3 +1,4 @@
1
+ import { registerEnvVarCommands } from "./envVar.js";
1
2
  import { registerFileCommands } from "./file.js";
2
3
  import { registerFolderCommands } from "./folder.js";
3
4
  import { registerReportCommands } from "./report.js";
@@ -9,10 +10,11 @@ import { registerWorkspacesCommands } from "./workspaces.js";
9
10
  export function registerWorkspaceManagementCommands(parent, getApi) {
10
11
  const workspaceManagement = parent
11
12
  .command("workspaceManagement")
12
- .description("Workspaces, users, tokens, roles, folders, reports, sessions");
13
+ .description("Workspaces, users, tokens, environment variables, roles, folders, reports, sessions");
13
14
  registerWorkspacesCommands(workspaceManagement, getApi);
14
15
  registerUserCommands(workspaceManagement, getApi);
15
16
  registerTokenCommands(workspaceManagement, getApi);
17
+ registerEnvVarCommands(workspaceManagement, getApi);
16
18
  registerRoleCommands(workspaceManagement, getApi);
17
19
  registerFolderCommands(workspaceManagement, getApi);
18
20
  registerFileCommands(workspaceManagement, getApi);
@@ -1 +1 @@
1
- {"version":3,"file":"cdkState.d.ts","sourceRoot":"","sources":["../../src/utils/cdkState.ts"],"names":[],"mappings":"AAoBA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CASxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,CAyBtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOrD;AAaD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAuCT"}
1
+ {"version":3,"file":"cdkState.d.ts","sourceRoot":"","sources":["../../src/utils/cdkState.ts"],"names":[],"mappings":"AAoBA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CASxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,CAyBtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOrD;AAaD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CA2CT"}
@@ -3,11 +3,11 @@
3
3
  // test-run it against ALREADY-DEPLOYED resources. Both need the same two things:
4
4
  // peel the tsx interop layer off a module's default export, and resolve any
5
5
  // `@cargo-ai/cdk` handle tokens the module references to their real uuids from
6
- // the committed cargo.state.json — without deploying the module itself.
6
+ // this project's deploy state — without deploying the module itself.
7
7
  import { existsSync } from "node:fs";
8
8
  import { dirname, isAbsolute, join, resolve } from "node:path";
9
9
  import { pathToFileURL } from "node:url";
10
- import { dependenciesOf, readState, resolveTokens } from "@cargo-ai/cdk";
10
+ import { dependenciesOf, readStateOffline, resolveTokens } from "@cargo-ai/cdk";
11
11
  import { cdkProjectDir, cdkProjectRoot } from "@cargo-ai/cdk/cli";
12
12
  import { ExitCodes, failWith } from "../commands/runHandler.js";
13
13
  // Peel the extra interop layer tsx adds when a TS source is transpiled to CJS:
@@ -104,7 +104,11 @@ export function resolveTokensFromState(value, file, subject) {
104
104
  "`cargo-ai cdk deploy`, or reference them by literal uuid " +
105
105
  "(toolRef / agentRef / connectorRef).", { code: ExitCodes.NotFound });
106
106
  }
107
- const state = readState(stateRoot);
107
+ // A project whose state lives in the workspace has a pointer here, not a
108
+ // resource map, so the cache the last plan or deploy left behind is what
109
+ // answers this offline. Resolving a handle is a read of what is already
110
+ // deployed — worth a stale answer, not worth a round trip on every run.
111
+ const state = readStateOffline(stateRoot);
108
112
  const outputs = new Map();
109
113
  if (state !== undefined) {
110
114
  for (const [id, entry] of Object.entries(state.resources)) {
@@ -114,7 +118,7 @@ export function resolveTokensFromState(value, file, subject) {
114
118
  const missing = [...deps].filter((id) => !outputs.has(id));
115
119
  if (missing.length > 0) {
116
120
  failWith(`${String(missing.length)} resource(s) referenced by ${subject} ` +
117
- `aren't in cargo.state.json yet: ${missing.join(", ")}. A test run ` +
121
+ `aren't in this project's deploy state yet: ${missing.join(", ")}. A test run ` +
118
122
  "resolves existing (already-deployed) resources from state — it won't " +
119
123
  "create new ones. Deploy them first with `cargo-ai cdk deploy`, or " +
120
124
  "reference them by literal uuid (toolRef / agentRef / connectorRef).", { code: ExitCodes.NotFound });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.88",
3
+ "version": "1.0.90",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://getcargo.ai",
@@ -67,10 +67,10 @@
67
67
  "dependencies": {
68
68
  "@ai-sdk/harness": "^1.0.95",
69
69
  "@ai-sdk/harness-claude-code": "^1.0.99",
70
- "@cargo-ai/api": "^1.0.76",
70
+ "@cargo-ai/api": "^1.0.78",
71
71
  "@cargo-ai/app-sdk": "^1.0.10",
72
- "@cargo-ai/cdk": "^1.0.71",
73
- "@cargo-ai/types": "^1.0.73",
72
+ "@cargo-ai/cdk": "^1.0.73",
73
+ "@cargo-ai/types": "^1.0.75",
74
74
  "@cargo-ai/utils": "^1.0.28",
75
75
  "@cargo-ai/worker-sdk": "^1.0.17",
76
76
  "@modelcontextprotocol/sdk": "1.29.0",