@cargo-ai/cli 1.0.56 → 1.0.58
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
|
@@ -42,7 +42,7 @@ cargo-ai login --token <your-api-token>
|
|
|
42
42
|
|
|
43
43
|
`--email` and `--oauth` save the signed-in session — a short-lived access token plus the refresh token that renews it — to `~/.config/cargo-ai/credentials.json` (file mode `0600`). The CLI renews it in the background as it expires, so you stay signed in and no API token is created per machine. `--token` saves the API token you supplied instead. The same file backs `cargo-cdk`, so one login serves both.
|
|
44
44
|
|
|
45
|
-
`cargo-ai logout` revokes the session at the identity provider, so signing out is final. A token you supplied yourself with `--token` is only forgotten locally, since it may be in use elsewhere; pass `--keep-token` to force that behaviour for a session too.
|
|
45
|
+
`cargo-ai logout` revokes the session at the identity provider, so signing out is final. A token you supplied yourself with `--token` is only forgotten locally, since it may be in use elsewhere; pass `--keep-token` to force that behaviour for a session too. If a credentials file cannot be deleted — a read-only config directory, or one owned by another user — `logout` fails and names the file rather than reporting a sign-out the next command would contradict.
|
|
46
46
|
|
|
47
47
|
Treat the file as you would a password. A saved session acts as you across **every** workspace you belong to — unlike an API token, which is limited to one workspace and to the permissions it was created with — and it stays valid until you run `cargo-ai logout` or the identity provider expires it. On a shared or long-lived machine (CI, a build box), prefer an API token created under **Settings → API** and passed via `CARGO_API_TOKEN`, which you can scope down and revoke from the dashboard.
|
|
48
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAyBxD,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,GAChB,IAAI,CAyGN;AAiGD,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,GAAG,SAAS,EACpC,IAAI,EAAE,aAAa,GAClB,cAAc,CAchB"}
|
|
@@ -2,7 +2,7 @@ import { revokeSession } from "@cargo-ai/cdk/cli";
|
|
|
2
2
|
import { Option } from "commander";
|
|
3
3
|
import { AGENT_SKILLS_NEXT_STEP } from "../../agentSkills.js";
|
|
4
4
|
import { getConfig } from "../../config.js";
|
|
5
|
-
import { clearCredentials, getCredentialsPath, loadCredentials, saveCredentials, } from "../../credentials.js";
|
|
5
|
+
import { clearCredentials, CredentialsNotClearedError, getCredentialsPath, loadCredentials, saveCredentials, } from "../../credentials.js";
|
|
6
6
|
import { ExitCodes, failWith, handleApiCall, info, outputJson, success, } from "../runHandler.js";
|
|
7
7
|
import { runEmailLogin } from "./email.js";
|
|
8
8
|
import { selectLoginChannel } from "./loginChannel.js";
|
|
@@ -40,8 +40,11 @@ that name when one exists, so this is safe to re-run.
|
|
|
40
40
|
|
|
41
41
|
--email and --oauth save the signed-in session to
|
|
42
42
|
~/.config/cargo-ai/credentials.json and renew it automatically, so you stay
|
|
43
|
-
signed in without a token being created for each machine.
|
|
44
|
-
|
|
43
|
+
signed in without a token being created for each machine. CARGO_CONFIG_DIR
|
|
44
|
+
(or XDG_CONFIG_HOME) moves that file; where the home directory is not writable
|
|
45
|
+
— agent sandboxes usually run that way — the session is saved under the system
|
|
46
|
+
temp directory instead, which lasts only as long as the sandbox. Switch
|
|
47
|
+
workspace at any time with CARGO_WORKSPACE_UUID or by signing in again with
|
|
45
48
|
--workspace-uuid <uuid>. An API token passed with --token stays pinned to its
|
|
46
49
|
own workspace, so the override does not apply to it.
|
|
47
50
|
|
|
@@ -59,7 +62,11 @@ Environment variables (CARGO_API_TOKEN, CARGO_WORKSPACE_UUID, CARGO_BASE_URL) ta
|
|
|
59
62
|
.addHelpText("after", `
|
|
60
63
|
A session from "cargo-ai login --email" or "--oauth" is revoked at the identity
|
|
61
64
|
provider, so signing out is final. Tokens you supplied yourself with --token are
|
|
62
|
-
only forgotten locally, since they may be in use elsewhere
|
|
65
|
+
only forgotten locally, since they may be in use elsewhere.
|
|
66
|
+
|
|
67
|
+
Signing out fails, naming the file, when a credentials file cannot be deleted —
|
|
68
|
+
a read-only config directory, or one owned by another user — because the next
|
|
69
|
+
command would otherwise read it and still be signed in.`)
|
|
63
70
|
.action(async (opts) => {
|
|
64
71
|
await runLogout(opts);
|
|
65
72
|
});
|
|
@@ -123,7 +130,20 @@ async function runLogout(opts) {
|
|
|
123
130
|
const credentials = loadCredentials();
|
|
124
131
|
const plan = planRevocation(credentials, opts);
|
|
125
132
|
const revoked = await applyRevocation(plan, credentials);
|
|
126
|
-
|
|
133
|
+
let removed;
|
|
134
|
+
try {
|
|
135
|
+
removed = clearCredentials();
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (error instanceof CredentialsNotClearedError) {
|
|
139
|
+
// Revocation already happened, so say so: re-running logout will not
|
|
140
|
+
// revoke a second time, and the file is all that is left to deal with.
|
|
141
|
+
failWith(error.message, {
|
|
142
|
+
extra: { revoked, credentialsFiles: error.paths },
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
127
147
|
if (removed === true) {
|
|
128
148
|
success(revoked === true ? "Signed out and revoked access." : "Signed out.");
|
|
129
149
|
}
|
package/build/credentials.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { clearCredentials, type StoredCredentials as Credentials, getConfigDir, getCredentialsPath, loadCredentials, type RefreshableSession, saveCredentials, } from "@cargo-ai/cdk/cli";
|
|
1
|
+
export { clearCredentials, type StoredCredentials as Credentials, CredentialsNotClearedError, getConfigDir, getCredentialsPath, loadCredentials, type RefreshableSession, saveCredentials, } from "@cargo-ai/cdk/cli";
|
|
2
2
|
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB,KAAK,iBAAiB,IAAI,WAAW,EACrC,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,KAAK,kBAAkB,EACvB,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB,KAAK,iBAAiB,IAAI,WAAW,EACrC,0BAA0B,EAC1B,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,KAAK,kBAAkB,EACvB,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
|
package/build/credentials.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// The credentials file is shared with `cargo-cdk`, so its format and access
|
|
2
2
|
// live in @cargo-ai/cdk/cli — one login serves both binaries and neither can
|
|
3
3
|
// drift from the other's idea of what is on disk.
|
|
4
|
-
export { clearCredentials, getConfigDir, getCredentialsPath, loadCredentials, saveCredentials, } from "@cargo-ai/cdk/cli";
|
|
4
|
+
export { clearCredentials, CredentialsNotClearedError, getConfigDir, getCredentialsPath, loadCredentials, saveCredentials, } from "@cargo-ai/cdk/cli";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.58",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://getcargo.ai",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"format:check": "prettier --check ."
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cargo-ai/api": "^1.0.
|
|
62
|
+
"@cargo-ai/api": "^1.0.62",
|
|
63
63
|
"@cargo-ai/app-sdk": "^1.0.6",
|
|
64
|
-
"@cargo-ai/cdk": "^1.0.
|
|
65
|
-
"@cargo-ai/types": "^1.0.
|
|
64
|
+
"@cargo-ai/cdk": "^1.0.47",
|
|
65
|
+
"@cargo-ai/types": "^1.0.60",
|
|
66
66
|
"@cargo-ai/worker-sdk": "^1.0.12",
|
|
67
67
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
68
68
|
"commander": "^12.1.0",
|