@letterstory/cli 0.177.112 → 0.177.114
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/org.mjs +32 -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.114";
|
|
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;
|
|
@@ -1589,6 +1589,7 @@ Org (the account as one file, its integrations and billing):
|
|
|
1589
1589
|
org export --split <dir> …as one file per record (for keeping config in git)
|
|
1590
1590
|
org join <dir> [--file <path>] Rebuild the bundle from a --split directory
|
|
1591
1591
|
org integrations Every integration and whether it's connected
|
|
1592
|
+
org overview What needs you, what the org holds, and recent sequences
|
|
1592
1593
|
org billing [cap <dollars|off> [--why "…"] | card | request [--note "…"] | cancel [--why "…"] --yes | keep]
|
|
1593
1594
|
Usage billing: plan, this period against the
|
|
1594
1595
|
allowance and spend cap, failed payments; set
|
package/lib/commands/org.mjs
CHANGED
|
@@ -51,6 +51,7 @@ export const ARGS = {
|
|
|
51
51
|
undo_billing_plan_cancel: {},
|
|
52
52
|
update_billing_card: {},
|
|
53
53
|
list_integrations: {},
|
|
54
|
+
get_workspace_overview: {},
|
|
54
55
|
get_linear_connection: {},
|
|
55
56
|
list_linear_targets: { team_id: { flag: "team" } },
|
|
56
57
|
set_linear_target: {
|
|
@@ -108,6 +109,8 @@ export async function cmdOrg(ctx) {
|
|
|
108
109
|
return orgGit(rest);
|
|
109
110
|
case "integrations":
|
|
110
111
|
return orgIntegrations(rest);
|
|
112
|
+
case "overview":
|
|
113
|
+
return orgOverview(rest);
|
|
111
114
|
case "fields":
|
|
112
115
|
return orgFields(rest);
|
|
113
116
|
case "linear":
|
|
@@ -118,7 +121,7 @@ export async function cmdOrg(ctx) {
|
|
|
118
121
|
return orgBilling(rest);
|
|
119
122
|
default:
|
|
120
123
|
throw new CliError(
|
|
121
|
-
`Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, linear, mcp, fields, billing`
|
|
124
|
+
`Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, overview, linear, mcp, fields, billing`
|
|
122
125
|
);
|
|
123
126
|
}
|
|
124
127
|
}
|
|
@@ -135,6 +138,34 @@ async function orgIntegrations(ctx) {
|
|
|
135
138
|
return 0;
|
|
136
139
|
}
|
|
137
140
|
|
|
141
|
+
const NEED_WORDS = {
|
|
142
|
+
approve: (n) => `${n} ${n === 1 ? "email" : "emails"} to approve`,
|
|
143
|
+
replies: (n) => `${n} ${n === 1 ? "reply" : "replies"} to answer`,
|
|
144
|
+
paused: (n) => `${n} ${n === 1 ? "sequence" : "sequences"} paused`,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* `org overview`: what the org holds and what waits on a person (get_workspace_overview), the read behind the
|
|
149
|
+
* app's More menu: what needs you, a count per feature, and the sequences and lists changed lately.
|
|
150
|
+
*/
|
|
151
|
+
async function orgOverview(ctx) {
|
|
152
|
+
const { client, flags, io } = ctx;
|
|
153
|
+
refuseUnknownFlags(ctx, {}, []);
|
|
154
|
+
const result = await client.callTool("get_workspace_overview", {});
|
|
155
|
+
ok(ctx, result.message);
|
|
156
|
+
printResult(io, flags, result, (r) => {
|
|
157
|
+
const needs = r.needs.length
|
|
158
|
+
? r.needs.map((n) => `! ${NEED_WORDS[n.key]?.(n.count) ?? `${n.count} ${n.key}`}`)
|
|
159
|
+
: ["Nothing waits on you."];
|
|
160
|
+
const counts = Object.entries(r.counts)
|
|
161
|
+
.filter(([, n]) => n > 0)
|
|
162
|
+
.map(([key, n]) => ` ${key.replace(/^\//, "")}: ${formatCount(n)}`);
|
|
163
|
+
const recent = r.recent.map((x) => ` ${x.name} (${x.kind === "sequence" ? "sequence" : "list"})`);
|
|
164
|
+
return [...needs, "", "Holds:", ...counts, ...(recent.length ? ["", "Recent:", ...recent] : [])].join("\n");
|
|
165
|
+
});
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
138
169
|
/** A cap from the command line: dollars, or `off` (no cap). */
|
|
139
170
|
function capFrom(value) {
|
|
140
171
|
if (["off", "none", "null"].includes(String(value).toLowerCase())) return null;
|
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",
|