@mutagent/cli 0.1.397 → 0.1.398
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/dist/bin/cli.js +832 -738
- package/dist/index.js +16 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -634,7 +634,7 @@ ${String(data.length)} result(s)`));
|
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
function createSpinner(text, isJson) {
|
|
637
|
-
if (isJson) {
|
|
637
|
+
if (isJson || !process.stderr.isTTY || process.env.CI === "true") {
|
|
638
638
|
const noop = () => {
|
|
639
639
|
return;
|
|
640
640
|
};
|
|
@@ -763,7 +763,7 @@ var init_errors = __esm(() => {
|
|
|
763
763
|
notSignedInOrNoWorkspace: 3
|
|
764
764
|
};
|
|
765
765
|
KEY_REJECTED_CODES = new Set(["AUTH_EXPIRED", "INVALID_API_KEY", "FOREIGN_API_KEY", "API_401", "SANDBOX_TOKEN_REFUSED"]);
|
|
766
|
-
NOT_SIGNED_IN_CODES = new Set(["AUTH_REQUIRED", "WORKSPACE_REQUIRED"
|
|
766
|
+
NOT_SIGNED_IN_CODES = new Set(["AUTH_REQUIRED", "WORKSPACE_REQUIRED"]);
|
|
767
767
|
MutagentError = class MutagentError extends Error {
|
|
768
768
|
code;
|
|
769
769
|
suggestion;
|
|
@@ -853,8 +853,8 @@ var init_errors = __esm(() => {
|
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
855
|
NotFoundError = class NotFoundError extends MutagentError {
|
|
856
|
-
constructor(resource, id) {
|
|
857
|
-
super("NOT_FOUND", `${resource} not found: ${id}`, `Check the ID and try again. List available ${resource.toLowerCase()}s with the appropriate list command.`);
|
|
856
|
+
constructor(resource, id, listCommand) {
|
|
857
|
+
super("NOT_FOUND", `${resource} not found: ${id}`, listCommand === undefined ? `Check the ID and try again. List available ${resource.toLowerCase()}s with the appropriate list command.` : `Run: ${listCommand}`);
|
|
858
858
|
}
|
|
859
859
|
};
|
|
860
860
|
});
|
|
@@ -1059,6 +1059,7 @@ var init_key_check = __esm(() => {
|
|
|
1059
1059
|
// src/lib/organization-scope.ts
|
|
1060
1060
|
var exports_organization_scope = {};
|
|
1061
1061
|
__export(exports_organization_scope, {
|
|
1062
|
+
workspaceDenied: () => workspaceDenied,
|
|
1062
1063
|
unreachableServerError: () => unreachableServerError,
|
|
1063
1064
|
tenancyHeaders: () => tenancyHeaders,
|
|
1064
1065
|
tenancyFailure: () => tenancyFailure,
|
|
@@ -1118,18 +1119,20 @@ function parseBody(body) {
|
|
|
1118
1119
|
function deadKeyError() {
|
|
1119
1120
|
return new TenancyError("AUTH_EXPIRED", "Your CLI key expired or was revoked.", "Run: mutagent login");
|
|
1120
1121
|
}
|
|
1122
|
+
function workspaceDenied(ctx) {
|
|
1123
|
+
const shown = ctx.workspaceName ?? ctx.workspaceId ?? "workspace";
|
|
1124
|
+
if (ctx.workspaceOrigin === "selection") {
|
|
1125
|
+
return new TenancyError(TENANCY_DENIED, `Your saved workspace ${shown} is no longer available to you.`, "Run: mutagent workspaces use <name>");
|
|
1126
|
+
}
|
|
1127
|
+
const where = ctx.organizationName ? ` in ${ctx.organizationName}` : "";
|
|
1128
|
+
return new TenancyError(TENANCY_DENIED, `No workspace "${shown}" among your workspaces${where}.`, "See: mutagent workspaces list");
|
|
1129
|
+
}
|
|
1121
1130
|
function tenancyFailure(status, body, ctx) {
|
|
1122
1131
|
const parsed = parseBody(body);
|
|
1123
1132
|
if (status === 401)
|
|
1124
1133
|
return deadKeyError();
|
|
1125
|
-
if (status === 403 && parsed.code === TENANCY_DENIED)
|
|
1126
|
-
|
|
1127
|
-
if (ctx.workspaceOrigin === "selection") {
|
|
1128
|
-
return new TenancyError(TENANCY_DENIED, `Your saved workspace ${shown} is no longer available to you.`, "Run: mutagent workspaces use <name>");
|
|
1129
|
-
}
|
|
1130
|
-
const where = ctx.organizationName ? ` in ${ctx.organizationName}` : "";
|
|
1131
|
-
return new TenancyError(TENANCY_DENIED, `No workspace "${shown}" among your workspaces${where}.`, "See: mutagent workspaces list");
|
|
1132
|
-
}
|
|
1134
|
+
if (status === 403 && parsed.code === TENANCY_DENIED)
|
|
1135
|
+
return workspaceDenied(ctx);
|
|
1133
1136
|
if (status === 403 && ctx.keyScope === "workspace" && ctx.workspaceOrigin === "override") {
|
|
1134
1137
|
return new TenancyError("WORKSPACE_KEY_MISMATCH", "This API key only works in its own workspace.", "Run: mutagent login (for a key that can switch workspaces)");
|
|
1135
1138
|
}
|
|
@@ -1961,4 +1964,4 @@ export {
|
|
|
1961
1964
|
ApiError
|
|
1962
1965
|
};
|
|
1963
1966
|
|
|
1964
|
-
//# debugId=
|
|
1967
|
+
//# debugId=0397F8E1C872BF7364756E2164756E21
|
package/package.json
CHANGED