@letterstory/cli 0.177.112 → 0.177.113
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 +1 -1
- package/lib/commands/usage.mjs +35 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
92
92
|
|
|
93
93
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
94
|
-
export const VERSION = "0.177.
|
|
94
|
+
export const VERSION = "0.177.113";
|
|
95
95
|
|
|
96
96
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
97
97
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
package/lib/commands/usage.mjs
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
// letterstory usage posthog [status]|sync [--days 7]|disconnect the connection (never its key), sync now, remove it
|
|
12
12
|
// letterstory usage database connect (--project <ref> --key <sbp_…> | --url postgres://… | --existing)
|
|
13
13
|
// --host app.acme.com --schemas public --since … --until … Supabase or any Postgres
|
|
14
|
+
// letterstory usage shown statistics shown to agents, and what agents get
|
|
15
|
+
// letterstory usage shown show|hide <choice_id> show a tracked action to agents, or take it off
|
|
16
|
+
// letterstory usage shown pr [--repo <owner/name>] [--base <branch>] put them on the website: one build, one pull request
|
|
17
|
+
// letterstory usage shown check [--url <page>] check a page serves them as the data says
|
|
14
18
|
// letterstory usage case-study [--days 7|30|90] the patterns and the latest case study
|
|
15
19
|
// letterstory usage case-study generate [--days] [--patterns a,b] [--named [--companies x.com,y.com]]
|
|
16
20
|
// letterstory usage case-study publish|unpublish <id>
|
|
@@ -71,6 +75,13 @@ export const ARGS = {
|
|
|
71
75
|
},
|
|
72
76
|
set_usage_payment_scope: paymentScopeArgs,
|
|
73
77
|
preview_usage_payment_scope: paymentScopeArgs,
|
|
78
|
+
get_shown_statistics: {},
|
|
79
|
+
set_shown_statistic: {
|
|
80
|
+
choice_id: { positional: 0, required: true, label: "choice_id" },
|
|
81
|
+
shown: { value: (_flags, _positionals, extra) => extra.shown === true },
|
|
82
|
+
},
|
|
83
|
+
open_shown_statistics_pr: { repo: { flag: "repo" }, base_branch: { flag: "base" } },
|
|
84
|
+
check_shown_statistics_on_site: { url: { flag: "url" } },
|
|
74
85
|
disconnect_usage_payments: {},
|
|
75
86
|
get_usage_sources: { host: { flag: "host" }, site_id: { flag: "site" } },
|
|
76
87
|
choose_product_repo: {
|
|
@@ -342,6 +353,30 @@ export async function cmdUsage(ctx) {
|
|
|
342
353
|
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
343
354
|
return 0;
|
|
344
355
|
}
|
|
356
|
+
if (ctx.positionals[0] === "shown") {
|
|
357
|
+
const sub = ctx.positionals[1] ?? "status";
|
|
358
|
+
const rest = ctx.positionals.slice(2);
|
|
359
|
+
if (sub === "status") {
|
|
360
|
+
printResult(io, flags, await client.callTool("get_shown_statistics", {}));
|
|
361
|
+
return 0;
|
|
362
|
+
}
|
|
363
|
+
if (sub === "show" || sub === "hide") {
|
|
364
|
+
const args = argsFromFlags(ARGS.set_shown_statistic, flags, rest, { shown: sub === "show" });
|
|
365
|
+
printResult(io, flags, await client.callTool("set_shown_statistic", args));
|
|
366
|
+
return 0;
|
|
367
|
+
}
|
|
368
|
+
if (sub === "pr") {
|
|
369
|
+
const args = argsFromFlags(ARGS.open_shown_statistics_pr, flags, rest);
|
|
370
|
+
printResult(io, flags, await client.callTool("open_shown_statistics_pr", args));
|
|
371
|
+
return 0;
|
|
372
|
+
}
|
|
373
|
+
if (sub === "check") {
|
|
374
|
+
const args = argsFromFlags(ARGS.check_shown_statistics_on_site, flags, rest);
|
|
375
|
+
printResult(io, flags, await client.callTool("check_shown_statistics_on_site", args));
|
|
376
|
+
return 0;
|
|
377
|
+
}
|
|
378
|
+
throw new CliError("Use shown, shown show|hide <choice_id>, shown pr or shown check");
|
|
379
|
+
}
|
|
345
380
|
if (ctx.positionals[0] === "payments") {
|
|
346
381
|
const tool = {
|
|
347
382
|
connect: "connect_usage_payments",
|