@letterstory/cli 0.177.123 → 0.177.124
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 +2 -1
- package/lib/commands/strategy.mjs +38 -2
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
94
94
|
|
|
95
95
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
96
|
-
export const VERSION = "0.177.
|
|
96
|
+
export const VERSION = "0.177.124";
|
|
97
97
|
|
|
98
98
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
99
99
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -937,6 +937,7 @@ Offerings (context layered org → offering → collection; a layer sets only wh
|
|
|
937
937
|
probes edit <probe_id> <new question text> Fix/sharpen a generated probe
|
|
938
938
|
probes add <question> [--kind mention|citation] [--scope site|company|<blogId>] [--cluster <id>]
|
|
939
939
|
onboarding status Show the onboarding checklist
|
|
940
|
+
onboarding for <website|seo|geo|visitors|cmd_l> … What Letter is for: the onboarding's first question
|
|
940
941
|
onboarding step [--current <step>] [--complete <step>] [--skip <step>] [--status <status>]
|
|
941
942
|
series list The org's content series + coverage state
|
|
942
943
|
series create --name <n> [--description <d>] [--coverage a,b,c] [--collection <uuid>] [--template <key>]
|
|
@@ -90,6 +90,13 @@ export const ARGS = {
|
|
|
90
90
|
suggestion_id: "suggestion",
|
|
91
91
|
},
|
|
92
92
|
get_onboarding_status: {},
|
|
93
|
+
// The onboarding's first question: the answers are positionals (`onboarding for seo geo`).
|
|
94
|
+
set_signup_intents: {
|
|
95
|
+
intents: {
|
|
96
|
+
value: (_flags, positionals) =>
|
|
97
|
+
positionals.map((p) => p.toLowerCase().replace("⌘l", "cmd_l").replace("-", "_")),
|
|
98
|
+
},
|
|
99
|
+
},
|
|
93
100
|
// Step ids are the server's to define (the registry is the authority); forwarded as given.
|
|
94
101
|
set_onboarding_step: {
|
|
95
102
|
current_step: "current",
|
|
@@ -293,15 +300,44 @@ export async function cmdOnboarding(ctx) {
|
|
|
293
300
|
return onboardingStatus(rest);
|
|
294
301
|
case "step":
|
|
295
302
|
return onboardingStep(rest);
|
|
303
|
+
case "for":
|
|
304
|
+
return onboardingFor(rest);
|
|
296
305
|
default:
|
|
297
|
-
throw new CliError(`Unknown onboarding subcommand: ${sub ?? "(none)"}. Try: status, step`);
|
|
306
|
+
throw new CliError(`Unknown onboarding subcommand: ${sub ?? "(none)"}. Try: status, for, step`);
|
|
298
307
|
}
|
|
299
308
|
}
|
|
300
309
|
|
|
310
|
+
/** The onboarding's steps for its answer, the one it is on marked, and where it finishes. */
|
|
311
|
+
function signupPathLines(path) {
|
|
312
|
+
if (!path) return [];
|
|
313
|
+
const at = path.steps.findIndex((s) => s.id === path.step);
|
|
314
|
+
const lines = path.steps.map((s, i) => `${i === at ? ">" : i < at ? "✓" : " "} ${i + 1}. ${s.title}`);
|
|
315
|
+
return [...lines, ` Finishes in ${path.finish}`];
|
|
316
|
+
}
|
|
317
|
+
|
|
301
318
|
async function onboardingStatus(ctx) {
|
|
302
319
|
const { client, flags, io } = ctx;
|
|
303
320
|
const result = await client.callTool("get_onboarding_status", {});
|
|
304
|
-
printResult(io, flags, result)
|
|
321
|
+
printResult(io, flags, result, (r) =>
|
|
322
|
+
r.signup ? signupPathLines(r.signup).join("\n") : JSON.stringify(r, null, 2)
|
|
323
|
+
);
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const SIGNUP_INTENT_IDS = ["website", "seo", "geo", "visitors", "cmd_l"];
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* `onboarding for <answer…>`: the onboarding's first question (set_signup_intents), what the org wants Letter for:
|
|
331
|
+
* website, seo, geo, visitors, cmd_l. Prints the steps it now has and where it finishes.
|
|
332
|
+
*/
|
|
333
|
+
async function onboardingFor(ctx) {
|
|
334
|
+
const { client, flags, io, positionals } = ctx;
|
|
335
|
+
const args = argsFromFlags(ARGS.set_signup_intents, flags, positionals);
|
|
336
|
+
if (args.intents.length === 0 || args.intents.some((i) => !SIGNUP_INTENT_IDS.includes(i)))
|
|
337
|
+
throw new CliError(`Say what Letter is for: any of ${SIGNUP_INTENT_IDS.join(", ")}.`);
|
|
338
|
+
const result = await client.callTool("set_signup_intents", args);
|
|
339
|
+
ok(ctx, "Saved.");
|
|
340
|
+
printResult(io, flags, result, (r) => signupPathLines(r).join("\n"));
|
|
305
341
|
return 0;
|
|
306
342
|
}
|
|
307
343
|
|