@tokenoftrust/cli 2.0.16 → 2.0.17
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/clone.mjs +31 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "Token of Trust developer CLI — clone 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/clone.mjs
CHANGED
|
@@ -287,7 +287,22 @@ export async function run(argv, ctx) {
|
|
|
287
287
|
* cloned: boolean, dir: string|null, head: string|null }>}
|
|
288
288
|
*/
|
|
289
289
|
export async function checkoutTenant(client, { tenant, tag = "main", cloneDir = null, redact = (s) => s }) {
|
|
290
|
-
|
|
290
|
+
// The switch is LOAD-BEARING, so its refusal is the error the developer must see. When
|
|
291
|
+
// the tenant is not one of this session's clients the server refuses here with the real
|
|
292
|
+
// cause (no grant / a grant issued to a client this identity is not bound to / a grant
|
|
293
|
+
// issued after sign-in that needs a re-auth) — far more specific than the tenant_checkout
|
|
294
|
+
// refusal that follows it. Surfacing the switch's own words, with the server's nextAction,
|
|
295
|
+
// stops a genuinely-unentitled tenant from being reported as a scope-selection slip.
|
|
296
|
+
try {
|
|
297
|
+
await client.callTool("client_switch", { tenant });
|
|
298
|
+
} catch (e) {
|
|
299
|
+
throw new CliError(redact(String(e?.message || e)), {
|
|
300
|
+
next:
|
|
301
|
+
"confirm you're entitled to this store — `tot grants` lists what your session can " +
|
|
302
|
+
"act on, and `tot login` refreshes a grant issued after you signed in",
|
|
303
|
+
cause: e,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
291
306
|
// vc-app-binding safety-net (08-18, §5): ensure THIS developer is bound to the
|
|
292
307
|
// storefront version-control app BEFORE checkout, so tenant_checkout can resolve
|
|
293
308
|
// `appForCaller` for them instead of 403-ing "No version-control app is bound." The
|
|
@@ -541,6 +556,21 @@ export function checkoutError(checkout) {
|
|
|
541
556
|
(c && (c.message || (typeof c.error === "string" ? c.error : c.error?.message))) ||
|
|
542
557
|
(c && typeof c.raw === "string" && c.raw.trim() ? c.raw.trim() : null) ||
|
|
543
558
|
null;
|
|
559
|
+
// Not entitled: the session resolved NO grant or client context for the asserted tenant.
|
|
560
|
+
// Distinct from both not-provisioned (the store is fine) and over-scope (you hold it but
|
|
561
|
+
// haven't switched) — and the one case where the remedy is upstream of this checkout.
|
|
562
|
+
if (
|
|
563
|
+
typeof msg === "string" &&
|
|
564
|
+
/not among the tenants your session holds|^Not entitled/i.test(msg)
|
|
565
|
+
) {
|
|
566
|
+
return {
|
|
567
|
+
message: msg,
|
|
568
|
+
next:
|
|
569
|
+
"`tot grants` lists what your session can actually act on — a grant whose grantee " +
|
|
570
|
+
"your identity doesn't resolve to never becomes visible here; if it was issued after " +
|
|
571
|
+
"you signed in, run `tot login` to refresh, then retry",
|
|
572
|
+
};
|
|
573
|
+
}
|
|
544
574
|
// The store's repo isn't provisioned yet — it isn't set up for this developer.
|
|
545
575
|
if (typeof msg === "string" && /not provisioned/i.test(msg)) {
|
|
546
576
|
return {
|