@cargo-ai/cli 1.0.118 → 1.0.119
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/build/commands/auth/session.d.ts.map +1 -1
- package/build/commands/auth/session.js +2 -16
- package/build/commands/auth/workspace.js +1 -1
- package/build/commands/workspaceManagement/workspaces.d.ts.map +1 -1
- package/build/commands/workspaceManagement/workspaces.js +2 -7
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/session.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/session.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,KAAK,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AAE1E,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMnE;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,cAAc,CAAC;IACvB,6EAA6E;IAC7E,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA4B7B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { saveCredentials } from "../../credentials.js";
|
|
2
2
|
import { getOAuthConfig } from "../../oauthConfig.js";
|
|
3
3
|
import { failWith } from "../runHandler.js";
|
|
4
|
-
import { refreshAccessToken } from "./passwordless.js";
|
|
5
4
|
import { resolveWorkspace } from "./workspace.js";
|
|
6
5
|
export const DEFAULT_BASE_URL = "https://api.getcargo.io";
|
|
7
6
|
export function resolveBaseUrl(override) {
|
|
@@ -21,29 +20,16 @@ export function resolveBaseUrl(override) {
|
|
|
21
20
|
*/
|
|
22
21
|
export async function establishSession(opts) {
|
|
23
22
|
const baseUrl = resolveBaseUrl(opts.baseUrlOverride);
|
|
24
|
-
const { workspace
|
|
23
|
+
const { workspace } = await resolveWorkspace({
|
|
25
24
|
baseUrl,
|
|
26
25
|
accessToken: opts.tokens.accessToken,
|
|
27
26
|
explicitUuid: opts.workspaceUuid,
|
|
28
27
|
explicitName: opts.workspaceName,
|
|
29
28
|
});
|
|
30
|
-
|
|
29
|
+
const { accessToken, refreshToken, expiresAt } = opts.tokens;
|
|
31
30
|
if (refreshToken === undefined) {
|
|
32
31
|
failWith("The identity provider issued no refresh token, so the CLI cannot keep this session alive. Enable the Refresh Token grant for the CLI application in Auth0, then sign in again.");
|
|
33
32
|
}
|
|
34
|
-
if (wasCreated === true) {
|
|
35
|
-
// The workspace list is a claim on the access token, so a workspace created
|
|
36
|
-
// moments ago is absent from the one we are holding and every request for
|
|
37
|
-
// it would be rejected. Only reissuing the token picks it up.
|
|
38
|
-
const refreshed = await refreshAccessToken({ refreshToken });
|
|
39
|
-
accessToken = refreshed.accessToken;
|
|
40
|
-
expiresAt = refreshed.expiresAt;
|
|
41
|
-
// Only a tenant that rotates refresh tokens returns a new one; keep the
|
|
42
|
-
// existing one otherwise, since it is still the valid one.
|
|
43
|
-
if (refreshed.refreshToken !== undefined) {
|
|
44
|
-
refreshToken = refreshed.refreshToken;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
33
|
const { domain, clientId } = getOAuthConfig();
|
|
48
34
|
saveCredentials({
|
|
49
35
|
accessToken,
|
|
@@ -16,7 +16,7 @@ export async function resolveWorkspace(opts) {
|
|
|
16
16
|
getAccessToken: () => Promise.resolve(accessToken),
|
|
17
17
|
workspaceUuid: undefined,
|
|
18
18
|
});
|
|
19
|
-
const { workspaces } = await handleApiCall(() => api.workspaceManagement.workspace.all(
|
|
19
|
+
const { workspaces } = await handleApiCall(() => api.workspaceManagement.workspace.all(), { spinner: "Loading workspaces..." });
|
|
20
20
|
if (opts.explicitName !== undefined && opts.explicitName.length > 0) {
|
|
21
21
|
// Reuse a same-named workspace rather than creating a duplicate, so that
|
|
22
22
|
// re-running a non-interactive sign-in is idempotent as documented.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/workspaces.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":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/workspaces.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,CA0KN"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { parseBooleanOption } from "../../utils/booleanOption.js";
|
|
2
1
|
import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
|
|
3
2
|
export function registerWorkspacesCommands(parent, getApi) {
|
|
4
3
|
const workspaces = parent
|
|
@@ -7,17 +6,13 @@ export function registerWorkspacesCommands(parent, getApi) {
|
|
|
7
6
|
workspaces
|
|
8
7
|
.command("list")
|
|
9
8
|
.description("List all workspaces accessible to the current user")
|
|
10
|
-
.option("--refresh [true|false]", "Bypass any token cache and re-fetch from the server (useful after permission changes)", parseBooleanOption)
|
|
11
9
|
.addHelpText("after", `
|
|
12
10
|
Examples:
|
|
13
11
|
$ cargo-ai workspaceManagement workspaces list
|
|
14
|
-
$ cargo-ai workspaceManagement workspaces list --refresh
|
|
15
12
|
$ cargo-ai workspaceManagement workspaces list | jq -r '.workspaces[].uuid'`)
|
|
16
|
-
.action(async (
|
|
13
|
+
.action(async () => {
|
|
17
14
|
const api = getApi();
|
|
18
|
-
const result = await handleApiCall(() => api.workspaceManagement.workspace.all(
|
|
19
|
-
refresh: opts.refresh === true,
|
|
20
|
-
}));
|
|
15
|
+
const result = await handleApiCall(() => api.workspaceManagement.workspace.all());
|
|
21
16
|
outputJson(result);
|
|
22
17
|
});
|
|
23
18
|
workspaces
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.119",
|
|
4
4
|
"mcpName": "io.github.getcargohq/cargo",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@ai-sdk/harness": "^1.0.144",
|
|
76
76
|
"@ai-sdk/harness-claude-code": "^1.0.148",
|
|
77
|
-
"@cargo-ai/api": "^1.0.
|
|
77
|
+
"@cargo-ai/api": "^1.0.98",
|
|
78
78
|
"@cargo-ai/app-sdk": "^1.0.11",
|
|
79
79
|
"@cargo-ai/cdk": "^1.0.116",
|
|
80
|
-
"@cargo-ai/types": "^1.0.
|
|
81
|
-
"@cargo-ai/utils": "^1.0.
|
|
80
|
+
"@cargo-ai/types": "^1.0.98",
|
|
81
|
+
"@cargo-ai/utils": "^1.0.33",
|
|
82
82
|
"@cargo-ai/worker-sdk": "^1.0.21",
|
|
83
83
|
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
84
84
|
"ai": "^7.0.133",
|