@tokenoftrust/cli 1.4.0-rc.5 → 1.4.0-rc.7
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/package.json +1 -1
- package/src/commands/grants.mjs +8 -3
- package/src/commands/link.mjs +11 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/cli",
|
|
3
|
-
"version": "1.4.0-rc.
|
|
3
|
+
"version": "1.4.0-rc.7",
|
|
4
4
|
"description": "Token of Trust developer CLI — check out a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Token of Trust",
|
package/src/commands/grants.mjs
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { defaultCredentialsPath, readCredentials } from "../token-store.mjs";
|
|
27
27
|
import { establishSession, AuthUnavailableError } from "../auth.mjs";
|
|
28
28
|
import { createMcpClient } from "../mcp.mjs";
|
|
29
|
-
import { storeListError } from "./checkout.mjs";
|
|
29
|
+
import { storeListError, noStoresGuidance } from "./checkout.mjs";
|
|
30
30
|
import { offerSignIn } from "./login.mjs";
|
|
31
31
|
import { recordServerPolicy } from "../update-check.mjs";
|
|
32
32
|
|
|
@@ -238,8 +238,13 @@ export async function run(argv, _ctx) {
|
|
|
238
238
|
return 1;
|
|
239
239
|
}
|
|
240
240
|
if (rows.length === 0) {
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
// Status-aware, like whoami/checkout (card c2): an UNLINKED identity is told to
|
|
242
|
+
// link, not given the "may still be propagating" copy — that's only the genuine
|
|
243
|
+
// linked-but-zero-grants case.
|
|
244
|
+
const g = noStoresGuidance(resp);
|
|
245
|
+
const line = g.headline.charAt(0).toUpperCase() + g.headline.slice(1);
|
|
246
|
+
console.log(`\n${line}.`);
|
|
247
|
+
console.log(`Next: ${g.next}`);
|
|
243
248
|
return 0;
|
|
244
249
|
}
|
|
245
250
|
|
package/src/commands/link.mjs
CHANGED
|
@@ -83,9 +83,17 @@ export function linkPollStatus(res) {
|
|
|
83
83
|
(typeof c.status === "string" && c.status) || (typeof c.state === "string" && c.state) || "";
|
|
84
84
|
const s = raw.toLowerCase();
|
|
85
85
|
if (!s) return "pending";
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
// The broker namespaces its poll status with a `link_` prefix (e.g. `link_pending`,
|
|
87
|
+
// `link_approved`, `link_denied`) — strip it before matching so a normal "still
|
|
88
|
+
// waiting" state isn't misread as an unknown/error status and doesn't abort the poll.
|
|
89
|
+
// (Regression: `link_pending` fell through to the error branch and killed `tot link`
|
|
90
|
+
// the instant the developer hadn't yet finished the browser step.)
|
|
91
|
+
const bare = s.replace(/^link[_-]/, "");
|
|
92
|
+
if (/^(linked|link|complete|completed|done|ok|success|succeeded|active|approved|granted)$/.test(bare))
|
|
93
|
+
return "linked";
|
|
94
|
+
if (/^(pending|waiting|in_?progress|processing|started|created|authorizing|polling)$/.test(bare))
|
|
95
|
+
return "pending";
|
|
96
|
+
return s; // a terminal error status (link_denied, link_expired, …) — surfaced to the caller
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
/** @param {string[]} argv @param {any} _ctx */
|