@great-arrow/cli 0.1.44 → 0.1.46
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/index.js +39 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9399,7 +9399,7 @@ function isNodeError(value) {
|
|
|
9399
9399
|
|
|
9400
9400
|
// src/lib/version.ts
|
|
9401
9401
|
var CLI_PACKAGE_NAME = "@great-arrow/cli";
|
|
9402
|
-
var CLI_VERSION = "0.1.
|
|
9402
|
+
var CLI_VERSION = "0.1.46";
|
|
9403
9403
|
var GAD_INSTALL_VERSION = "2026.08.08";
|
|
9404
9404
|
var GAD_INSTALL_MIN_VERSION = "2026.06.22";
|
|
9405
9405
|
var GAD_INSTALL_HEADER = "X-GAD-Install-Version";
|
|
@@ -9461,10 +9461,17 @@ async function setToken(token) {
|
|
|
9461
9461
|
if (entry) {
|
|
9462
9462
|
try {
|
|
9463
9463
|
await entry.setPassword(token);
|
|
9464
|
+
await removeFileFallback();
|
|
9464
9465
|
return true;
|
|
9465
9466
|
} catch (err) {
|
|
9466
9467
|
debugSwallow("keychain.setToken", err);
|
|
9467
9468
|
}
|
|
9469
|
+
try {
|
|
9470
|
+
await entry.deletePassword();
|
|
9471
|
+
} catch (err) {
|
|
9472
|
+
debugSwallow("keychain.setToken(delete stale)", err);
|
|
9473
|
+
return false;
|
|
9474
|
+
}
|
|
9468
9475
|
}
|
|
9469
9476
|
try {
|
|
9470
9477
|
const path10 = credentialFilePath();
|
|
@@ -9484,11 +9491,14 @@ async function deleteToken() {
|
|
|
9484
9491
|
debugSwallow("keychain.deleteToken", err);
|
|
9485
9492
|
}
|
|
9486
9493
|
}
|
|
9494
|
+
await removeFileFallback();
|
|
9495
|
+
}
|
|
9496
|
+
async function removeFileFallback() {
|
|
9487
9497
|
try {
|
|
9488
9498
|
await unlink(credentialFilePath());
|
|
9489
9499
|
} catch (err) {
|
|
9490
9500
|
if (err?.code !== "ENOENT") {
|
|
9491
|
-
debugSwallow("keychain.
|
|
9501
|
+
debugSwallow("keychain.removeFileFallback", err);
|
|
9492
9502
|
}
|
|
9493
9503
|
}
|
|
9494
9504
|
}
|
|
@@ -10907,6 +10917,10 @@ function globalOutputOpts(cmd) {
|
|
|
10907
10917
|
}
|
|
10908
10918
|
|
|
10909
10919
|
// src/commands/whoami.ts
|
|
10920
|
+
function firstThingsToTry(data) {
|
|
10921
|
+
const o = data.onboarding;
|
|
10922
|
+
return o?.state === "empty" && Array.isArray(o.firstThingsToTry) ? o.firstThingsToTry : [];
|
|
10923
|
+
}
|
|
10910
10924
|
function maskToken2(token) {
|
|
10911
10925
|
if (token.length <= 8) {
|
|
10912
10926
|
return token + "...";
|
|
@@ -10958,6 +10972,8 @@ function whoamiCommand() {
|
|
|
10958
10972
|
if (auth.tokenType === "oauth" && auth.expiresAt) {
|
|
10959
10973
|
data.expires = new Date(auth.expiresAt).toISOString();
|
|
10960
10974
|
}
|
|
10975
|
+
const tryThese = firstThingsToTry(introspect);
|
|
10976
|
+
if (tryThese.length > 0) data.firstThingsToTry = tryThese;
|
|
10961
10977
|
const fields = [
|
|
10962
10978
|
{ key: "email", header: "Email" },
|
|
10963
10979
|
{ key: "workspace", header: "Workspace" },
|
|
@@ -10966,6 +10982,12 @@ function whoamiCommand() {
|
|
|
10966
10982
|
{ key: "expires", header: "Access expires" }
|
|
10967
10983
|
];
|
|
10968
10984
|
fmt.detail(data, fields);
|
|
10985
|
+
if (tryThese.length > 0 && !g.json) {
|
|
10986
|
+
fmt.info(
|
|
10987
|
+
`Try saying to your AI:
|
|
10988
|
+
${tryThese.map((t) => ` \u2022 ${t}`).join("\n")}`
|
|
10989
|
+
);
|
|
10990
|
+
}
|
|
10969
10991
|
});
|
|
10970
10992
|
return cmd;
|
|
10971
10993
|
}
|
|
@@ -16548,6 +16570,18 @@ function firstCommand(argv) {
|
|
|
16548
16570
|
}
|
|
16549
16571
|
return null;
|
|
16550
16572
|
}
|
|
16573
|
+
var PRE_DISPATCH_REFUSALS = /* @__PURE__ */ new Set([
|
|
16574
|
+
"workspace_choice_required"
|
|
16575
|
+
]);
|
|
16576
|
+
function refusedBeforeTool(result) {
|
|
16577
|
+
if (typeof result !== "object" || result === null) return false;
|
|
16578
|
+
const r = result;
|
|
16579
|
+
if (r.isError !== true) return false;
|
|
16580
|
+
const body = parseMcpPayload(r.content);
|
|
16581
|
+
if (typeof body !== "object" || body === null) return false;
|
|
16582
|
+
const code = body.error;
|
|
16583
|
+
return typeof code === "string" && PRE_DISPATCH_REFUSALS.has(code);
|
|
16584
|
+
}
|
|
16551
16585
|
async function fetchGlance(apiUrl, token, includeTip) {
|
|
16552
16586
|
const controller = new AbortController();
|
|
16553
16587
|
const timer = setTimeout(() => controller.abort(), fetchBudgetMs(includeTip));
|
|
@@ -16578,6 +16612,9 @@ async function fetchGlance(apiUrl, token, includeTip) {
|
|
|
16578
16612
|
}
|
|
16579
16613
|
const data = await response.json();
|
|
16580
16614
|
if (data.error) return { payload: null, tipMaybeSpent };
|
|
16615
|
+
if (refusedBeforeTool(data.result)) {
|
|
16616
|
+
return { payload: null, tipMaybeSpent: false };
|
|
16617
|
+
}
|
|
16581
16618
|
return {
|
|
16582
16619
|
payload: normalizeGlance(
|
|
16583
16620
|
parseMcpPayload(data.result?.content ?? data.result)
|