@tokenoftrust/cli 7.6.4 → 7.6.5
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/cli",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.5",
|
|
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",
|
|
@@ -48,12 +48,24 @@ const USAGE = `tot feedback — send a note to Token of Trust (with your recent
|
|
|
48
48
|
--severity <critical|high|medium|low> default: medium
|
|
49
49
|
--category <doc-gap|api-ambiguity|setup-confusion|platform-bug|
|
|
50
50
|
ai-agent-confusion|product-ux|scenario-instruction-gap> default: product-ux
|
|
51
|
+
--tenant <appDomain> tag the store this note is about
|
|
51
52
|
--no-activity don't attach the activity log
|
|
52
53
|
--yes, -y send without the confirmation prompt (required non-interactively)
|
|
53
54
|
--mcp <url> MCP base URL (default: env MCP_BASE_URL / TOT_MCP_URL)
|
|
54
55
|
|
|
55
56
|
Requires a signed-in session — run \`tot login\` first if needed.`;
|
|
56
57
|
|
|
58
|
+
/** `feedback_submit` caps `sensitive` at 4000 chars. */
|
|
59
|
+
export const MAX_SENSITIVE_CHARS = 4000;
|
|
60
|
+
|
|
61
|
+
function tailWithinBudget(header, body, budget) {
|
|
62
|
+
const full = `${header}\n${body}`;
|
|
63
|
+
if (full.length <= budget) return full;
|
|
64
|
+
const marker = "…(earlier entries truncated)\n";
|
|
65
|
+
const keep = Math.max(0, budget - header.length - 1 - marker.length);
|
|
66
|
+
return `${header}\n${marker}${body.slice(body.length - keep)}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
57
69
|
/**
|
|
58
70
|
* Assemble the `feedback_submit` payload. Pure + exported so the wire shape
|
|
59
71
|
* (including the additive `sensitive` activity attachment and the invite→problem
|
|
@@ -61,23 +73,41 @@ Requires a signed-in session — run \`tot login\` first if needed.`;
|
|
|
61
73
|
* are OMITTED when their source is absent — never sent as null/empty.
|
|
62
74
|
* @param {{ type: string, category: string, severity: string, title: string,
|
|
63
75
|
* description: string, activityText?: string|null, diagnosticsText?: string|null,
|
|
64
|
-
* traceId?: string|null }} f
|
|
76
|
+
* traceId?: string|null, tenant?: string|null }} f
|
|
65
77
|
*/
|
|
66
|
-
export function buildFeedbackPayload({ type, category, severity, title, description, activityText, diagnosticsText, traceId }) {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]
|
|
78
|
+
export function buildFeedbackPayload({ type, category, severity, title, description, activityText, diagnosticsText, traceId, tenant }) {
|
|
79
|
+
const activityHeader = "tot CLI activity (most recent last):";
|
|
80
|
+
const diagHeader = "tot CLI diagnostics (redacted, most recent last):";
|
|
81
|
+
/** @type {Array<{ header: string, body: string }>} */
|
|
82
|
+
const rawParts = [];
|
|
83
|
+
if (activityText) rawParts.push({ header: activityHeader, body: activityText });
|
|
84
|
+
if (diagnosticsText) rawParts.push({ header: diagHeader, body: diagnosticsText });
|
|
85
|
+
let sensitive = rawParts.map((p) => `${p.header}\n${p.body}`).join("\n\n");
|
|
86
|
+
if (sensitive.length > MAX_SENSITIVE_CHARS) {
|
|
87
|
+
if (rawParts.length === 1) {
|
|
88
|
+
sensitive = tailWithinBudget(rawParts[0].header, rawParts[0].body, MAX_SENSITIVE_CHARS);
|
|
89
|
+
} else if (rawParts.length >= 2) {
|
|
90
|
+
const half = Math.floor((MAX_SENSITIVE_CHARS - 2) / 2);
|
|
91
|
+
sensitive = [
|
|
92
|
+
tailWithinBudget(rawParts[0].header, rawParts[0].body, half),
|
|
93
|
+
tailWithinBudget(rawParts[1].header, rawParts[1].body, MAX_SENSITIVE_CHARS - 2 - half),
|
|
94
|
+
].join("\n\n");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const cleanTenant = typeof tenant === "string" ? tenant.trim() : "";
|
|
98
|
+
const fullDescription = cleanTenant && !description.includes(cleanTenant)
|
|
99
|
+
? `[tenant: ${cleanTenant}] ${description}`
|
|
100
|
+
: description;
|
|
71
101
|
return {
|
|
72
102
|
type,
|
|
73
103
|
category,
|
|
74
104
|
severity,
|
|
75
105
|
title,
|
|
76
|
-
description,
|
|
106
|
+
description: fullDescription,
|
|
77
107
|
scenario: "tot-cli",
|
|
78
108
|
// CLI context → `sensitive` (ToT-admins-only, never clustered/shared). It is
|
|
79
109
|
// redacted before attachment; `sensitive` is the belt-and-suspenders home for it.
|
|
80
|
-
...(
|
|
110
|
+
...(rawParts.length ? { sensitive } : {}),
|
|
81
111
|
// Invite→terminal→problem trace link (omitted when this wasn't an invite login).
|
|
82
112
|
...(traceId ? { traceId } : {}),
|
|
83
113
|
};
|
|
@@ -94,23 +124,32 @@ export function feedbackReportId(result) {
|
|
|
94
124
|
return typeof value === "string" && FEEDBACK_ID.test(value) ? value : null;
|
|
95
125
|
}
|
|
96
126
|
|
|
97
|
-
function parseArgs(argv) {
|
|
127
|
+
export function parseArgs(argv) {
|
|
128
|
+
/** @type {{ mcp: string|null, type: string, category: string, severity: string, tenant: string|null, activity: boolean, yes: boolean, help: boolean, unknown: string[], message?: string|null }} */
|
|
98
129
|
const a = {
|
|
99
130
|
mcp: null, type: "improvement", category: "product-ux", severity: "medium",
|
|
100
|
-
activity: true, yes: false, help: false,
|
|
131
|
+
tenant: null, activity: true, yes: false, help: false, unknown: [],
|
|
101
132
|
};
|
|
102
133
|
const words = [];
|
|
134
|
+
const takeValue = (i, t) => {
|
|
135
|
+
const eq = t.indexOf("=");
|
|
136
|
+
if (eq >= 0) return { value: t.slice(eq + 1), next: i };
|
|
137
|
+
return { value: argv[i + 1], next: i + 1 };
|
|
138
|
+
};
|
|
103
139
|
for (let i = 0; i < argv.length; i++) {
|
|
104
140
|
const t = argv[i];
|
|
105
|
-
|
|
106
|
-
|
|
141
|
+
const flag = t.startsWith("--") && t.includes("=") ? t.slice(0, t.indexOf("=")) : t;
|
|
142
|
+
if (flag === "--mcp") { const { value, next } = takeValue(i, t); a.mcp = value; i = next; }
|
|
143
|
+
else if (flag === "--type") { const { value, next } = takeValue(i, t); a.type = value; i = next; }
|
|
107
144
|
else if (t === "--bug") a.type = "bug";
|
|
108
145
|
else if (t === "--feature") a.type = "feature";
|
|
109
|
-
else if (
|
|
110
|
-
else if (
|
|
146
|
+
else if (flag === "--category") { const { value, next } = takeValue(i, t); a.category = value; i = next; }
|
|
147
|
+
else if (flag === "--severity") { const { value, next } = takeValue(i, t); a.severity = value; i = next; }
|
|
148
|
+
else if (flag === "--tenant") { const { value, next } = takeValue(i, t); a.tenant = value; i = next; }
|
|
111
149
|
else if (t === "--no-activity") a.activity = false;
|
|
112
150
|
else if (t === "--yes" || t === "-y") a.yes = true;
|
|
113
151
|
else if (t === "--help" || t === "-h") a.help = true;
|
|
152
|
+
else if (t.startsWith("--")) a.unknown.push(t);
|
|
114
153
|
else words.push(t);
|
|
115
154
|
}
|
|
116
155
|
a.message = words.join(" ").trim() || null;
|
|
@@ -129,6 +168,10 @@ export async function run(argv, deps = {}) {
|
|
|
129
168
|
console.log(USAGE);
|
|
130
169
|
return 0;
|
|
131
170
|
}
|
|
171
|
+
if (args.unknown.length) {
|
|
172
|
+
console.error(fail(`unknown option ${args.unknown[0]}.`, "run `tot feedback --help`."));
|
|
173
|
+
return 2;
|
|
174
|
+
}
|
|
132
175
|
if (!TYPES.has(args.type)) {
|
|
133
176
|
console.error(fail(`--type must be one of: ${[...TYPES].join(", ")}.`, "e.g. --bug"));
|
|
134
177
|
return 2;
|
|
@@ -221,6 +264,7 @@ export async function run(argv, deps = {}) {
|
|
|
221
264
|
activityText,
|
|
222
265
|
diagnosticsText,
|
|
223
266
|
traceId,
|
|
267
|
+
tenant: args.tenant,
|
|
224
268
|
});
|
|
225
269
|
const res = await client.callTool("feedback_submit", payload);
|
|
226
270
|
const id = feedbackReportId(res);
|
|
@@ -238,6 +238,7 @@ export const MANIFEST_SCOPES = [
|
|
|
238
238
|
"inventory:write",
|
|
239
239
|
"purchasing:read",
|
|
240
240
|
"purchasing:write",
|
|
241
|
+
"proposal-events:read",
|
|
241
242
|
"reports:read",
|
|
242
243
|
"attribution:write",
|
|
243
244
|
"widgets:launch",
|
|
@@ -265,6 +266,10 @@ export const MANIFEST_WEBHOOK_TOPICS = [
|
|
|
265
266
|
"fulfillment.assignment.created",
|
|
266
267
|
"fulfillment.assignment.updated",
|
|
267
268
|
"fulfillment.label.voided",
|
|
269
|
+
"proposal.filed",
|
|
270
|
+
"proposal.applied",
|
|
271
|
+
"proposal.rejected",
|
|
272
|
+
"proposal.expired",
|
|
268
273
|
];
|
|
269
274
|
|
|
270
275
|
export const MANIFEST_WIDGET_PLACEMENTS = ["product.aside", "home.section", "global.footer"];
|