@letterstory/cli 0.29.1 → 0.29.2
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/lib/cli.mjs +8 -1
- package/lib/commands/feedback.mjs +57 -0
- package/lib/commands.mjs +1 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -40,10 +40,11 @@ import {
|
|
|
40
40
|
cmdLede,
|
|
41
41
|
cmdLandings,
|
|
42
42
|
cmdAdmin,
|
|
43
|
+
cmdFeedback,
|
|
43
44
|
} from "./commands.mjs";
|
|
44
45
|
|
|
45
46
|
// Keep in sync with cli/package.json.
|
|
46
|
-
export const VERSION = "0.29.
|
|
47
|
+
export const VERSION = "0.29.2";
|
|
47
48
|
|
|
48
49
|
// Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
|
|
49
50
|
// can't accidentally swallow the id as --json's value.
|
|
@@ -581,6 +582,11 @@ Insights:
|
|
|
581
582
|
insights post <article-id> [--period 14d|30d|90d]
|
|
582
583
|
insights top [--period 14d|30d|90d] [--collection <uuid>] [--limit <n>] [--sort clicks|impressions]
|
|
583
584
|
|
|
585
|
+
Feedback (tell us what's broken, missing, unclear, or wanted):
|
|
586
|
+
feedback submit --category bug|missing_feature|unclear|feature_request|praise|other
|
|
587
|
+
[--message <text>|--body <text>|--file <path>|--file -] [--rating 1-5]
|
|
588
|
+
[--context '<json>']
|
|
589
|
+
|
|
584
590
|
Anything else:
|
|
585
591
|
tools list List every tool this server exposes, by name
|
|
586
592
|
tools show <name> Show one tool's capability, argument schema, and return shape
|
|
@@ -645,6 +651,7 @@ const CLIENT_COMMANDS = {
|
|
|
645
651
|
lede: cmdLede,
|
|
646
652
|
ledes: cmdLede,
|
|
647
653
|
landings: cmdLandings,
|
|
654
|
+
feedback: cmdFeedback,
|
|
648
655
|
// Platform-scoped (staff key) — the only commands that act BEFORE an org exists.
|
|
649
656
|
admin: cmdAdmin,
|
|
650
657
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// `feedback` — submit product feedback about Letterstory itself: a bug, something
|
|
2
|
+
// missing, something unclear, a feature request, or praise. One subcommand, one tool
|
|
3
|
+
// (submit_feedback) — there is no read/list surface yet, staff triage this table directly.
|
|
4
|
+
|
|
5
|
+
import { CliError } from "../client.mjs";
|
|
6
|
+
import { flagStr, readBodyInput, printResult, ok, argsFromFlags } from "./shared.mjs";
|
|
7
|
+
|
|
8
|
+
function readJsonObjectFlag(flags, name) {
|
|
9
|
+
const inline = flagStr(flags[name]);
|
|
10
|
+
if (inline === undefined) return undefined;
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = JSON.parse(inline);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
throw new CliError(`--${name} is not valid JSON: ${err.message}`);
|
|
16
|
+
}
|
|
17
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
18
|
+
throw new CliError(`--${name} must be a JSON object`);
|
|
19
|
+
return parsed;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ARGS = {
|
|
23
|
+
submit_feedback: {
|
|
24
|
+
category: { flag: "category", required: true },
|
|
25
|
+
// --message, or the larger-blob trio --body/--file/stdin (same convention as
|
|
26
|
+
// `landings create`'s --context).
|
|
27
|
+
message: { value: (flags) => flagStr(flags.message) ?? readBodyInput(flags) },
|
|
28
|
+
rating: { flag: "rating", type: "num" },
|
|
29
|
+
context: { value: (flags) => readJsonObjectFlag(flags, "context") },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export async function cmdFeedback(ctx) {
|
|
34
|
+
const sub = ctx.positionals[0];
|
|
35
|
+
const rest = { ...ctx, positionals: ctx.positionals.slice(1) };
|
|
36
|
+
switch (sub) {
|
|
37
|
+
case "submit":
|
|
38
|
+
return feedbackSubmit(rest);
|
|
39
|
+
default:
|
|
40
|
+
throw new CliError(`Unknown feedback subcommand: ${sub ?? "(none)"}. Try: submit`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function feedbackSubmit(ctx) {
|
|
45
|
+
const { client, flags, io } = ctx;
|
|
46
|
+
// ARGS.category has required: true, so a missing --category throws before we get here.
|
|
47
|
+
const args = argsFromFlags(ARGS.submit_feedback, flags, ctx.positionals);
|
|
48
|
+
if (!args.message) {
|
|
49
|
+
throw new CliError("Missing feedback message — pass --message, --body, --file <path>, or pipe it on stdin.");
|
|
50
|
+
}
|
|
51
|
+
const result = await client.callTool("submit_feedback", args);
|
|
52
|
+
ok(ctx, `Submitted ${args.category} feedback.`);
|
|
53
|
+
printResult(io, flags, result);
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { ARGS };
|
package/lib/commands.mjs
CHANGED