@letterstory/cli 0.177.49 → 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 +13 -4
- package/lib/commands/repo.mjs +2 -0
- 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;
|
|
@@ -262,6 +263,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
262
263
|
"dry-run",
|
|
263
264
|
// domains buy --no-spend: only when it buys nothing.
|
|
264
265
|
"no-spend",
|
|
266
|
+
// repo install-letterprove --identify-only: the identify line alone (Usage data's identify step).
|
|
267
|
+
"identify-only",
|
|
265
268
|
// admin demo list --enrollable, show --moves, set --enroll|--unenroll
|
|
266
269
|
"enrollable",
|
|
267
270
|
"moves",
|
|
@@ -1978,10 +1981,11 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
|
|
|
1978
1981
|
repo fix-audit --issue <issue-type>... [--audit <id>] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1979
1982
|
One PR fixing site-audit issues (repeat --issue to bundle) on every affected page,
|
|
1980
1983
|
in the repo verified to build the site
|
|
1981
|
-
repo install-letterprove --repo <owner/name> [--gitlab] [--host <domain>] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1982
|
-
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
|
|
1983
1986
|
pages (identification off) and the identify call
|
|
1984
|
-
(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)
|
|
1985
1989
|
repo install-visitors [--site <id> | --host <domain>] [--repo <owner/name> [--gitlab]] [--branch <base>] [--action build|build_pr|build_merge|slack|linear] [--wait]
|
|
1986
1990
|
One PR adding the Visitors script tag and server snippet to the repo that
|
|
1987
1991
|
builds the site (--repo: another repo)
|
|
@@ -2104,6 +2108,10 @@ Refs (Visual Refs: other companies' brands to design something new after, apart
|
|
|
2104
2108
|
Every brand's direction for it, as one file
|
|
2105
2109
|
refs brief-show <brief-id> The brief, once ready
|
|
2106
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
|
+
|
|
2107
2115
|
Models (your own writing models, each trained on writing you give it so it writes in your voice):
|
|
2108
2116
|
models [list] [--archived] Your models: where each stands, its links, its version
|
|
2109
2117
|
models create "<name>" [--budget <usd>] [--description <d>]
|
|
@@ -2277,6 +2285,7 @@ const CLIENT_COMMANDS = {
|
|
|
2277
2285
|
deploy: cmdDeploy,
|
|
2278
2286
|
refs: cmdRefs,
|
|
2279
2287
|
models: cmdModels,
|
|
2288
|
+
usage: cmdUsage,
|
|
2280
2289
|
// Platform-scoped (staff key) — the only commands that act BEFORE an org exists.
|
|
2281
2290
|
admin: cmdAdmin,
|
|
2282
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",
|
|
@@ -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";
|