@letterstory/cli 0.177.48 → 0.177.50
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 +15 -4
- package/lib/commands/repo.mjs +2 -0
- package/lib/commands/site.mjs +2 -1
- package/lib/commands/usage.mjs +80 -0
- package/lib/commands.mjs +1 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -85,11 +85,12 @@ import {
|
|
|
85
85
|
cmdDeploy,
|
|
86
86
|
cmdRefs,
|
|
87
87
|
cmdModels,
|
|
88
|
+
cmdUsage,
|
|
88
89
|
} from "./commands.mjs";
|
|
89
90
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
90
91
|
|
|
91
92
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
92
|
-
export const VERSION = "0.177.
|
|
93
|
+
export const VERSION = "0.177.50";
|
|
93
94
|
|
|
94
95
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
95
96
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -226,6 +227,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
226
227
|
"no-host",
|
|
227
228
|
// site metrics: skip the previous window (no deltas, no revamp indicator).
|
|
228
229
|
"no-compare",
|
|
230
|
+
// site metrics: the last reading kept, at once.
|
|
231
|
+
"stored",
|
|
229
232
|
// site refresh / observe: the loop's switches.
|
|
230
233
|
"force-map",
|
|
231
234
|
"force-audit",
|
|
@@ -260,6 +263,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
260
263
|
"dry-run",
|
|
261
264
|
// domains buy --no-spend: only when it buys nothing.
|
|
262
265
|
"no-spend",
|
|
266
|
+
// repo install-letterprove --identify-only: the identify line alone (Usage data's identify step).
|
|
267
|
+
"identify-only",
|
|
263
268
|
// admin demo list --enrollable, show --moves, set --enroll|--unenroll
|
|
264
269
|
"enrollable",
|
|
265
270
|
"moves",
|
|
@@ -1976,10 +1981,11 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
|
|
|
1976
1981
|
repo fix-audit --issue <issue-type>... [--audit <id>] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1977
1982
|
One PR fixing site-audit issues (repeat --issue to bundle) on every affected page,
|
|
1978
1983
|
in the repo verified to build the site
|
|
1979
|
-
repo install-letterprove --repo <owner/name> [--gitlab] [--host <domain>] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1980
|
-
One PR adding
|
|
1984
|
+
repo install-letterprove --repo <owner/name> [--gitlab] [--host <domain>] [--identify-only] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1985
|
+
One PR adding Letter to your app: the script on signed-in
|
|
1981
1986
|
pages (identification off) and the identify call
|
|
1982
|
-
(pick the repo where users sign in; --host: where they do
|
|
1987
|
+
(pick the repo where users sign in; --host: where they do;
|
|
1988
|
+
--identify-only: the call alone, the script already there)
|
|
1983
1989
|
repo install-visitors [--site <id> | --host <domain>] [--repo <owner/name> [--gitlab]] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1984
1990
|
One PR adding the Visitors script tag and server snippet to the repo that
|
|
1985
1991
|
builds the site (--repo: another repo)
|
|
@@ -2102,6 +2108,10 @@ Refs (Visual Refs: other companies' brands to design something new after, apart
|
|
|
2102
2108
|
Every brand's direction for it, as one file
|
|
2103
2109
|
refs brief-show <brief-id> The brief, once ready
|
|
2104
2110
|
|
|
2111
|
+
Usage data (what signed-in people do in your own app):
|
|
2112
|
+
usage [--days 7|30|90] [--site <id>] [--limit <n>] People, companies and the features they use
|
|
2113
|
+
usage --host <app host> What to add to the app before anyone signed in
|
|
2114
|
+
|
|
2105
2115
|
Models (your own writing models, each trained on writing you give it so it writes in your voice):
|
|
2106
2116
|
models [list] [--archived] Your models: where each stands, its links, its version
|
|
2107
2117
|
models create "<name>" [--budget <usd>] [--description <d>]
|
|
@@ -2275,6 +2285,7 @@ const CLIENT_COMMANDS = {
|
|
|
2275
2285
|
deploy: cmdDeploy,
|
|
2276
2286
|
refs: cmdRefs,
|
|
2277
2287
|
models: cmdModels,
|
|
2288
|
+
usage: cmdUsage,
|
|
2278
2289
|
// Platform-scoped (staff key) — the only commands that act BEFORE an org exists.
|
|
2279
2290
|
admin: cmdAdmin,
|
|
2280
2291
|
};
|
package/lib/commands/repo.mjs
CHANGED
|
@@ -182,6 +182,8 @@ const ARGS = {
|
|
|
182
182
|
letterprove_open_install_pr: {
|
|
183
183
|
provider,
|
|
184
184
|
host: "host",
|
|
185
|
+
// --identify-only: the identify line alone, when the script is already on the app (usage's identify step).
|
|
186
|
+
identify_only: { flag: "identify-only", type: "bool" },
|
|
185
187
|
repo_owner: { value: (flags) => splitRepo(flags).owner },
|
|
186
188
|
repo_name: { value: (flags) => splitRepo(flags).name },
|
|
187
189
|
base_branch: "branch",
|
package/lib/commands/site.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// site builds <host> → list_build_suggestions (--limit n)
|
|
7
7
|
// site research-builds <host> → research_builds (Build's suggestion pass: propose, check, Jev, store)
|
|
8
8
|
// site research-fixes <host> → research_fixes (Fix's suggestion pass: exact edits on pages that exist)
|
|
9
|
-
// site metrics <host> [path] → get_site_metrics (--window 1d|7d|28d|90d, --page <path>…, --no-compare)
|
|
9
|
+
// site metrics <host> [path] → get_site_metrics (--window 1d|7d|28d|90d, --page <path>…, --no-compare, --stored)
|
|
10
10
|
// site observations <host> → list_site_observations site observe <host> → observe_site
|
|
11
11
|
// site dismiss <host> <id> → dismiss_site_observation
|
|
12
12
|
// site families <host> → list_site_families site decide-family <id> → decide_site_family
|
|
@@ -113,6 +113,7 @@ const ARGS = {
|
|
|
113
113
|
paths: { flag: "page", type: "list" },
|
|
114
114
|
window: { flag: "window", enum: ["1d", "7d", "28d", "90d"] },
|
|
115
115
|
compare: { flag: "no-compare", type: "bool", invert: true },
|
|
116
|
+
stored: { flag: "stored", type: "bool" },
|
|
116
117
|
},
|
|
117
118
|
list_competitor_sites: {
|
|
118
119
|
// --since <iso>, or --days <n> as shorthand for "the last n days" (--days 1 is the last 24 hours).
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// `usage` — Usage data from a terminal (docs/architecture/usage-data.md): what Letter's script counts on your own
|
|
2
|
+
// app where it says who is signed in. A thin wrapper over get_usage_data, the function the app's Usage data calls.
|
|
3
|
+
//
|
|
4
|
+
// letterstory usage [--days 7|30|90] [--site <id>] [--limit <n>] people, companies, features
|
|
5
|
+
// letterstory usage --host app.acme.com what to add to the app before anyone signed in
|
|
6
|
+
|
|
7
|
+
import { CliError } from "../client.mjs";
|
|
8
|
+
import { argsFromFlags, printResult } from "./shared.mjs";
|
|
9
|
+
|
|
10
|
+
export const ARGS = {
|
|
11
|
+
get_usage_data: {
|
|
12
|
+
days: {
|
|
13
|
+
value: (flags) => {
|
|
14
|
+
if (flags.days === undefined) return undefined;
|
|
15
|
+
const n = Number(flags.days);
|
|
16
|
+
if (![7, 30, 90].includes(n)) throw new CliError("--days takes 7, 30 or 90.");
|
|
17
|
+
return n;
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
site_id: { flag: "site" },
|
|
21
|
+
host: { flag: "host" },
|
|
22
|
+
limit: { flag: "limit", type: "num" },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const STEP = {
|
|
27
|
+
identify: "Letter's script is on the app. Add the identify line to signed-in pages:",
|
|
28
|
+
add_app: "Put this tag and the identify line on the app:",
|
|
29
|
+
install: "Put this tag and the identify line on the app:",
|
|
30
|
+
pick_app: "Name your app's host: letterstory usage --host app.example.com",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export async function cmdUsage(ctx) {
|
|
34
|
+
const { client, flags, io } = ctx;
|
|
35
|
+
const result = await client.callTool("get_usage_data", argsFromFlags(ARGS.get_usage_data, flags, ctx.positionals));
|
|
36
|
+
printResult(io, flags, result, (r) => {
|
|
37
|
+
if (r.step !== "collecting") {
|
|
38
|
+
const lines = [`${r.app.host ?? "Your app"}: nobody signed in yet.`, STEP[r.step]];
|
|
39
|
+
if (r.install?.tag) lines.push("", r.install.tag);
|
|
40
|
+
if (r.install) lines.push("", r.install.identify);
|
|
41
|
+
if (r.step !== "pick_app")
|
|
42
|
+
lines.push(
|
|
43
|
+
"",
|
|
44
|
+
`Or open a PR: letterstory repo install-letterprove --repo <owner/name> --host ${r.app.host}${r.step === "identify" ? " --identify-only" : ""}`
|
|
45
|
+
);
|
|
46
|
+
return lines.join("\n");
|
|
47
|
+
}
|
|
48
|
+
const t = r.totals;
|
|
49
|
+
const lines = [
|
|
50
|
+
`${r.app.host ?? "Your app"}, last ${r.days} days: ${t.people} people, ${t.companies} companies, ${t.pages} pages`,
|
|
51
|
+
"",
|
|
52
|
+
"Features",
|
|
53
|
+
...r.features
|
|
54
|
+
.slice(0, 20)
|
|
55
|
+
.map(
|
|
56
|
+
(f) =>
|
|
57
|
+
` ${f.label.slice(0, 40).padEnd(42)} ${String(f.people).padStart(5)} people ${String(f.companies).padStart(4)} companies`
|
|
58
|
+
),
|
|
59
|
+
"",
|
|
60
|
+
"Companies",
|
|
61
|
+
...r.companies
|
|
62
|
+
.slice(0, 20)
|
|
63
|
+
.map(
|
|
64
|
+
(c) =>
|
|
65
|
+
` ${c.domain.padEnd(32)} ${String(c.people).padStart(4)} people ${String(c.features).padStart(4)} features ${c.last_seen ?? ""}`
|
|
66
|
+
),
|
|
67
|
+
"",
|
|
68
|
+
"People",
|
|
69
|
+
...r.people
|
|
70
|
+
.slice(0, 20)
|
|
71
|
+
.map(
|
|
72
|
+
(p) =>
|
|
73
|
+
` ${p.id} ${(p.company ?? "").padEnd(28)} ${String(p.features).padStart(4)} features ${String(p.pages).padStart(4)} pages ${p.last_seen ?? ""}`
|
|
74
|
+
),
|
|
75
|
+
];
|
|
76
|
+
if (r.left_out.length) lines.push("", `Left out: ${r.left_out.join(", ")}`);
|
|
77
|
+
return lines.join("\n");
|
|
78
|
+
});
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
package/lib/commands.mjs
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./commands/visits.mjs";
|
|
|
55
55
|
export * from "./commands/sim.mjs";
|
|
56
56
|
export * from "./commands/vary.mjs";
|
|
57
57
|
export * from "./commands/domains.mjs";
|
|
58
|
+
export * from "./commands/usage.mjs";
|
|
58
59
|
export * from "./commands/proofs.mjs";
|
|
59
60
|
export * from "./commands/bench.mjs";
|
|
60
61
|
export * from "./commands/replicate.mjs";
|