@letterstory/cli 0.177.208 → 0.177.210
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 +28 -3
- package/lib/commands/admin.mjs +161 -1
- package/lib/commands/repo.mjs +40 -1
- package/lib/commands/site.mjs +55 -1
- package/lib/commands/visits.mjs +19 -1
- 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.210";
|
|
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;
|
|
@@ -117,8 +117,9 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
117
117
|
// org overview: only what waits on someone (the More menu's closed read).
|
|
118
118
|
"needs-only",
|
|
119
119
|
"include-tests",
|
|
120
|
-
// visits agent-sites: test orgs too.
|
|
120
|
+
// visits agent-sites: test orgs too; also count what reached the sites in the window.
|
|
121
121
|
"include-test",
|
|
122
|
+
"figures",
|
|
122
123
|
// visits transact asks --before: page the team's tests instead of agents' asks.
|
|
123
124
|
"tests",
|
|
124
125
|
"as-test",
|
|
@@ -162,6 +163,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
162
163
|
"presses",
|
|
163
164
|
// admin lost-posts: held posts back to the rework with the draft unchanged.
|
|
164
165
|
"rework",
|
|
166
|
+
// admin studies <id> --export: the plan, the rules, one row per attempt and the totals.
|
|
167
|
+
"export",
|
|
165
168
|
// admin targets check: check every target again, checked or not.
|
|
166
169
|
"recheck",
|
|
167
170
|
// build list: also move the builds' open changes along while polling.
|
|
@@ -246,6 +249,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
246
249
|
"keys",
|
|
247
250
|
// login: one-link device sign-in instead of the loopback browser flow.
|
|
248
251
|
"device",
|
|
252
|
+
// site screenshot: the whole page, not the first screen.
|
|
253
|
+
"full-page",
|
|
249
254
|
"json",
|
|
250
255
|
// sim seed: make the new seed active; collections it doesn't cover start empty.
|
|
251
256
|
"activate",
|
|
@@ -1257,6 +1262,18 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
|
|
|
1257
1262
|
never published. Lists what it would requeue; --apply puts
|
|
1258
1263
|
them back to work. --code held_guard takes a held post
|
|
1259
1264
|
once its draft was edited. Staff.
|
|
1265
|
+
admin studies [<study-id>] [--export] [--limit <n>]
|
|
1266
|
+
Agent research studies: what ChatGPT, Claude and Google AI
|
|
1267
|
+
Mode did with a website task. No id lists them; an id shows
|
|
1268
|
+
its counts and the task-by-product matrix; --export is the
|
|
1269
|
+
plan, the rules, a row per attempt and the totals. Staff only.
|
|
1270
|
+
admin study-start (--preset acceptance|discovery|site_change | --site <address> --task "<task>" [--expect "<words>"]
|
|
1271
|
+
[--entry address|need] [--repeats <n>] [--products chatgpt,claude,google_ai_mode,gemini]
|
|
1272
|
+
| --manifest-file <plan.json>) [--preview]
|
|
1273
|
+
Start a study: a fresh session per trial on the product
|
|
1274
|
+
itself. --preview saves nothing and prints the estimate.
|
|
1275
|
+
Browser time is Letter's cost; product cost is unknown.
|
|
1276
|
+
admin study-stop <study-id> [--resume] Stop a running study, or take a stopped one up again.
|
|
1260
1277
|
admin targets check [--org <id>,…] [--recheck] [--limit 10]
|
|
1261
1278
|
Check ranking targets' phrases (buyer intent, self-named,
|
|
1262
1279
|
search demand, fit) and store each verdict: --org those
|
|
@@ -2067,6 +2084,10 @@ The Site (one model of your whole marketing site, keyed by host and path):
|
|
|
2067
2084
|
Staff: any company's site, no account: what Fix would list, each PR
|
|
2068
2085
|
site suggest <host> --idea <id> | --draft-id <id>... | --pattern <folder> | --item <id> --path <path>
|
|
2069
2086
|
Open PR on a suggestion the Site stores, as one job
|
|
2087
|
+
site screenshot [url] [--run <id>] [--path <p>] [--viewport desktop|phone] [--full-page]
|
|
2088
|
+
A screenshot of a page of your site or a build's preview
|
|
2089
|
+
site speed [url] [--run <id>] [--path <p>] [--viewport mobile|desktop]
|
|
2090
|
+
How fast a page loads now: LCP, CLS, INP, TTFB
|
|
2070
2091
|
|
|
2071
2092
|
Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App opens a PR):
|
|
2072
2093
|
repo repos [--gitlab [--search <text>] [--page n]] Repos the Letter GitHub App can reach (--gitlab: the GitLab
|
|
@@ -2093,6 +2114,7 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
|
|
|
2093
2114
|
automate add --template … --slack-channel <C…>
|
|
2094
2115
|
repo slack-targets Slack channels and people Send to Slack can use, with ids
|
|
2095
2116
|
repo slack-test Post a test into the Send to Slack channel
|
|
2117
|
+
repo slack-delete <Slack message link> Delete a message Letter posted (only Letter's own)
|
|
2096
2118
|
repo start --repo <owner/name> [--gitlab] --instructions <text>|--instructions-file <path|-> [--page <path>]...
|
|
2097
2119
|
[--branch <base>] [--attach <path>]... [--attach-url <name>=<https url>]...
|
|
2098
2120
|
[--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
|
|
@@ -2132,6 +2154,7 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
|
|
|
2132
2154
|
repo delete-secret --repo <owner/name> [--gitlab] --secret <KEY>
|
|
2133
2155
|
Delete one
|
|
2134
2156
|
repo status <run-id> Phase, spend, PR link and Claude's summary
|
|
2157
|
+
repo deploy <PR link | owner/repo#12> | --run <id> Whether a merged pull request is live on the site
|
|
2135
2158
|
repo activity <run-id> [--follow] [--since <iso>] What the sandbox is doing, line by line (--follow: until it stops)
|
|
2136
2159
|
repo say <run-id> <message…> Tell a running build something; it carries on with it
|
|
2137
2160
|
repo list [--status running|succeeded|no_changes|failed|cancelled] [--limit n] [--audit <id>]
|
|
@@ -2168,7 +2191,9 @@ Visits (Visitors: AI agents reading your site, and AI answers sending people to
|
|
|
2168
2191
|
visits pages [--since 28d] [--path '/docs/*'] [--agent <id>] [--limit <n>] [--site <id>]
|
|
2169
2192
|
People and AI agents per page
|
|
2170
2193
|
visits health --site <id> Staff: how far to trust a site's numbers, each check and its fix
|
|
2171
|
-
visits agent-sites [--include-test]
|
|
2194
|
+
visits agent-sites [--include-test] [--figures] [--from <ISO>] [--to <ISO>]
|
|
2195
|
+
Staff: every agent site by stage, waiting on a person first;
|
|
2196
|
+
--figures counts requests and Asks in the window (7 days)
|
|
2172
2197
|
visits connect vercel|cloudflare [--site <id>] Send the host's request logs (no code to deploy)
|
|
2173
2198
|
visits connectors | disconnect <id> The site's host connectors
|
|
2174
2199
|
visits transact [--site <id>|--host <h>] Transact: cited public corpus answers with website fallback
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -91,6 +91,32 @@ export const ARGS = {
|
|
|
91
91
|
limit: { flag: "limit", type: "num" },
|
|
92
92
|
presses: { flag: "presses", type: "bool" },
|
|
93
93
|
},
|
|
94
|
+
// `admin studies`: every study, one study, or one study's export.
|
|
95
|
+
agent_studies_get: {
|
|
96
|
+
study_id: { positional: 0, label: "study id" },
|
|
97
|
+
export: { flag: "export", type: "bool" },
|
|
98
|
+
limit: { flag: "limit", type: "num" },
|
|
99
|
+
},
|
|
100
|
+
// `admin study-start`: a preset, one task on one site, or a whole plan from a file.
|
|
101
|
+
agent_studies_start: {
|
|
102
|
+
quick: {
|
|
103
|
+
object: {
|
|
104
|
+
site: "site",
|
|
105
|
+
task: "task",
|
|
106
|
+
expect: "expect",
|
|
107
|
+
entry: { flag: "entry", enum: ["address", "need"] },
|
|
108
|
+
products: { value: (flags) => (flags.products ? flagCsv(flags.products) : undefined) },
|
|
109
|
+
repeats: { flag: "repeats", type: "num" },
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
preset: { flag: "preset", enum: ["acceptance", "discovery", "site_change"] },
|
|
113
|
+
manifest: { value: (flags) => jsonFile(flags, "manifest") },
|
|
114
|
+
preview: { flag: "preview", type: "bool" },
|
|
115
|
+
},
|
|
116
|
+
agent_studies_stop: {
|
|
117
|
+
study_id: { positional: 0, label: "study id", required: true },
|
|
118
|
+
resume: { flag: "resume", type: "bool" },
|
|
119
|
+
},
|
|
94
120
|
};
|
|
95
121
|
|
|
96
122
|
const INVARIANT_LIMIT = 30;
|
|
@@ -168,6 +194,138 @@ async function cmdAdminLostPosts(ctx) {
|
|
|
168
194
|
);
|
|
169
195
|
return 0;
|
|
170
196
|
}
|
|
197
|
+
const STUDIES_USAGE = `Usage: admin studies [<study-id>] [--export] [--limit <n>]
|
|
198
|
+
admin study-start (--preset acceptance|discovery|site_change | --site <address> --task "<task>" [--expect "<words>"]
|
|
199
|
+
[--entry address|need] [--repeats <n>] [--products chatgpt,claude,google_ai_mode,gemini]
|
|
200
|
+
| --manifest-file <plan.json>) [--preview]
|
|
201
|
+
admin study-stop <study-id> [--resume]`;
|
|
202
|
+
|
|
203
|
+
/** One run as one character, the same reading as the matrix on /superadmin/agent-sites. */
|
|
204
|
+
const STUDY_MARK = {
|
|
205
|
+
verified: "●",
|
|
206
|
+
partial: "◐",
|
|
207
|
+
not_met: "✕",
|
|
208
|
+
valid_other: "◇",
|
|
209
|
+
ungraded: "◌",
|
|
210
|
+
excluded: "⊘",
|
|
211
|
+
unavailable: "–",
|
|
212
|
+
failed: "!",
|
|
213
|
+
running: "…",
|
|
214
|
+
planned: "○",
|
|
215
|
+
};
|
|
216
|
+
const STUDY_MARK_KEY = Object.entries(STUDY_MARK)
|
|
217
|
+
.map(([mark, sign]) => `${sign} ${mark.replace("_", " ")}`)
|
|
218
|
+
.join(" ");
|
|
219
|
+
|
|
220
|
+
const studyCounts = (c) =>
|
|
221
|
+
`planned ${c.planned} · attempted ${c.attempted} · completed ${c.completed} · graded ${c.graded} · verified ${c.verified} · excluded ${c.excluded} · failed ${c.failed} · unavailable ${c.unavailable}`;
|
|
222
|
+
|
|
223
|
+
const studyEstimate = (e) =>
|
|
224
|
+
[
|
|
225
|
+
`${e.trials} trial(s): ${Object.entries(e.by_product)
|
|
226
|
+
.map(([product, n]) => `${product} ${n}`)
|
|
227
|
+
.join(", ")}`,
|
|
228
|
+
`About ${e.minutes} min, ${e.browser_minutes} browser min. Product cost is unknown.`,
|
|
229
|
+
...e.skipped.map((s) => `Skipped ${s.task}/${s.condition}: ${s.reason}`),
|
|
230
|
+
].join("\n");
|
|
231
|
+
|
|
232
|
+
/** One study: its counts, then the matrix a row per task and condition, each product's verified/graded and marks. */
|
|
233
|
+
function formatStudy(study) {
|
|
234
|
+
const lines = [
|
|
235
|
+
study.question,
|
|
236
|
+
`${study.status}${study.imported ? " · imported" : ""} · ${study.id}`,
|
|
237
|
+
studyCounts(study.counts),
|
|
238
|
+
];
|
|
239
|
+
if (study.finding) lines.push(`Finding: ${study.finding}`);
|
|
240
|
+
lines.push("");
|
|
241
|
+
for (const row of study.matrix) {
|
|
242
|
+
lines.push(`${row.label} (${row.site})`);
|
|
243
|
+
for (const cell of row.cells)
|
|
244
|
+
lines.push(
|
|
245
|
+
` ${cell.product.padEnd(15)} ${`${cell.verified}/${cell.graded}`.padEnd(5)} ${cell.runs.map((r) => STUDY_MARK[r.mark] ?? "?").join("")}`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
lines.push("", `verified/graded per cell. ${STUDY_MARK_KEY}`);
|
|
249
|
+
if (study.patterns.length) {
|
|
250
|
+
lines.push("", "Recurring:");
|
|
251
|
+
for (const p of study.patterns.slice(0, 8))
|
|
252
|
+
lines.push(` ${p.hits}/${p.of} ${p.kind} ${p.label} (${p.products.join(", ")}) e.g. ${p.example}`);
|
|
253
|
+
}
|
|
254
|
+
const e = study.efficiency;
|
|
255
|
+
lines.push(
|
|
256
|
+
"",
|
|
257
|
+
`Median ${e.median_secs ?? "?"}s a run · ${e.secs_per_verified ?? "?"}s per verified run · cost per verified run ${e.cost_per_verified === null ? "unknown" : `$${e.cost_per_verified.toFixed(4)}`}`
|
|
258
|
+
);
|
|
259
|
+
return lines.join("\n");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// `admin studies` / `admin study-start` / `admin study-stop`: agent research studies
|
|
263
|
+
// (docs/architecture/agent-research.md), the same functions Super Admin → Agent sites → Experiments calls.
|
|
264
|
+
// agent_studies_get, agent_studies_start, agent_studies_stop; staff only.
|
|
265
|
+
async function cmdAdminStudies(ctx, sub) {
|
|
266
|
+
const { client, flags, io, positionals } = ctx;
|
|
267
|
+
if (sub === "studies") {
|
|
268
|
+
const result = await client.callTool(
|
|
269
|
+
"agent_studies_get",
|
|
270
|
+
argsFromFlags(ARGS.agent_studies_get, flags, positionals)
|
|
271
|
+
);
|
|
272
|
+
printResult(io, flags, result, (r) => {
|
|
273
|
+
if (r.study) return formatStudy(r.study);
|
|
274
|
+
if (r.export) {
|
|
275
|
+
const a = r.export.aggregates;
|
|
276
|
+
return [
|
|
277
|
+
`${r.export.rows.length} attempt row(s), ${r.export.columns.length} column(s). --json prints the plan, the rules, the rows and the totals.`,
|
|
278
|
+
studyCounts(a.counts),
|
|
279
|
+
`Recomputed from the rows: planned ${a.recomputed.planned} · completed ${a.recomputed.completed} · graded ${a.recomputed.graded} · verified ${a.recomputed.verified} · excluded ${a.recomputed.excluded}`,
|
|
280
|
+
].join("\n");
|
|
281
|
+
}
|
|
282
|
+
const studies = r.studies ?? [];
|
|
283
|
+
return [
|
|
284
|
+
...(studies.length ? [] : ["No studies yet."]),
|
|
285
|
+
...studies.map(
|
|
286
|
+
(s) =>
|
|
287
|
+
`${s.status.padEnd(8)} ${`${s.counts.verified}/${s.counts.graded} verified`.padEnd(15)} ${`${s.counts.completed}/${s.counts.planned} done`.padEnd(12)} ${s.id} ${s.question}`
|
|
288
|
+
),
|
|
289
|
+
"",
|
|
290
|
+
...(r.products ?? []).map(
|
|
291
|
+
(p) => `${p.label.padEnd(15)} ${p.unavailable ? `unavailable: ${p.unavailable}` : p.mode}`
|
|
292
|
+
),
|
|
293
|
+
].join("\n");
|
|
294
|
+
});
|
|
295
|
+
return 0;
|
|
296
|
+
}
|
|
297
|
+
if (sub === "study-start") {
|
|
298
|
+
const args = argsFromFlags(ARGS.agent_studies_start, flags, positionals);
|
|
299
|
+
if ([args.quick, args.preset, args.manifest].filter((v) => v !== undefined).length !== 1)
|
|
300
|
+
throw new CliError(STUDIES_USAGE);
|
|
301
|
+
const result = await client.callTool("agent_studies_start", args);
|
|
302
|
+
printResult(io, flags, result, (r) =>
|
|
303
|
+
[
|
|
304
|
+
r.study_id ? `Study ${r.study_id} started.` : "Preview: nothing saved.",
|
|
305
|
+
studyEstimate(r.estimate),
|
|
306
|
+
...(r.study_id ? [`Read it with: admin studies ${r.study_id}`] : []),
|
|
307
|
+
].join("\n")
|
|
308
|
+
);
|
|
309
|
+
return 0;
|
|
310
|
+
}
|
|
311
|
+
if (sub === "study-stop") {
|
|
312
|
+
const result = await client.callTool(
|
|
313
|
+
"agent_studies_stop",
|
|
314
|
+
argsFromFlags(ARGS.agent_studies_stop, flags, positionals)
|
|
315
|
+
);
|
|
316
|
+
printResult(io, flags, result, (r) =>
|
|
317
|
+
"resumed" in r
|
|
318
|
+
? r.resumed
|
|
319
|
+
? "Resumed."
|
|
320
|
+
: "Not resumed: the study isn't stopped."
|
|
321
|
+
: r.stopped
|
|
322
|
+
? "Stopped. Planned attempts stay planned."
|
|
323
|
+
: "Not stopped: the study isn't running."
|
|
324
|
+
);
|
|
325
|
+
return 0;
|
|
326
|
+
}
|
|
327
|
+
throw new CliError(STUDIES_USAGE);
|
|
328
|
+
}
|
|
171
329
|
import { watchDomainJob } from "./onboard.mjs";
|
|
172
330
|
|
|
173
331
|
const SEER_MODES = ["suggest", "skip"];
|
|
@@ -7833,10 +7991,12 @@ export async function cmdAdmin(ctx) {
|
|
|
7833
7991
|
if (sub === "invariants") return cmdAdminInvariants({ ...ctx, positionals: ctx.positionals.slice(1) });
|
|
7834
7992
|
if (sub === "dropoff") return cmdAdminDropoff({ ...ctx, positionals: ctx.positionals.slice(1) });
|
|
7835
7993
|
if (sub === "lost-posts") return cmdAdminLostPosts({ ...ctx, positionals: ctx.positionals.slice(1) });
|
|
7994
|
+
if (sub === "studies" || sub === "study-start" || sub === "study-stop")
|
|
7995
|
+
return cmdAdminStudies({ ...ctx, positionals: ctx.positionals.slice(1) }, sub);
|
|
7836
7996
|
if (sub === "deployments" || sub === "deploys")
|
|
7837
7997
|
return cmdAdminDeployments({ ...ctx, positionals: ctx.positionals.slice(1) });
|
|
7838
7998
|
throw new CliError(
|
|
7839
|
-
'Usage: admin recipes … | admin letterpress … | admin demo … | admin targets … | admin invariants … | admin dropoff … | admin lost-posts … | admin deployments … | admin republish … | admin create-org --domain <bare-domain> [--onboard] … | admin ask "<question>" | admin patterns … | admin experiments … | admin fleet-experiments … | admin crm … | admin spend … | admin evals … | admin brand-detection … | admin tuning … | admin tuning-context | admin replays … (see --help)'
|
|
7999
|
+
'Usage: admin recipes … | admin letterpress … | admin demo … | admin targets … | admin invariants … | admin dropoff … | admin lost-posts … | admin studies … | admin deployments … | admin republish … | admin create-org --domain <bare-domain> [--onboard] … | admin ask "<question>" | admin patterns … | admin experiments … | admin fleet-experiments … | admin crm … | admin spend … | admin evals … | admin brand-detection … | admin tuning … | admin tuning-context | admin replays … (see --help)'
|
|
7840
8000
|
);
|
|
7841
8001
|
}
|
|
7842
8002
|
|
package/lib/commands/repo.mjs
CHANGED
|
@@ -76,6 +76,13 @@ function issueList(flags) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
const ARGS = {
|
|
79
|
+
get_deploy_status: {
|
|
80
|
+
pull_request: { positional: 0, label: "pull request link or owner/repo#12" },
|
|
81
|
+
run_id: "run",
|
|
82
|
+
},
|
|
83
|
+
delete_slack_message: {
|
|
84
|
+
message: { positional: 0, required: true, label: "Slack message link" },
|
|
85
|
+
},
|
|
79
86
|
start_repo_change: {
|
|
80
87
|
provider,
|
|
81
88
|
repo_owner: { value: (flags) => splitRepo(flags).owner },
|
|
@@ -455,9 +462,13 @@ export async function cmdRepo(ctx) {
|
|
|
455
462
|
return repoSlackTargets(rest);
|
|
456
463
|
case "slack-test":
|
|
457
464
|
return repoSlackTest(rest);
|
|
465
|
+
case "slack-delete":
|
|
466
|
+
return repoSlackDelete(rest);
|
|
467
|
+
case "deploy":
|
|
468
|
+
return repoDeploy(rest);
|
|
458
469
|
default:
|
|
459
470
|
throw new CliError(
|
|
460
|
-
`Unknown repo subcommand: ${sub ?? "(none)"}. Try: start, fix-audit, install-letterprove, install-visitors, sites, set-site, reset-site, secrets, set-secret, delete-secret, status, list, publish, merge, retry, revise, address-reviews, say, cancel, repos, branches, prs, settings, suggestions, slack-targets, slack-test, connect, disconnect`
|
|
471
|
+
`Unknown repo subcommand: ${sub ?? "(none)"}. Try: start, fix-audit, install-letterprove, install-visitors, sites, set-site, reset-site, secrets, set-secret, delete-secret, status, deploy, list, publish, merge, retry, revise, address-reviews, say, cancel, repos, branches, prs, settings, suggestions, slack-targets, slack-test, slack-delete, connect, disconnect`
|
|
461
472
|
);
|
|
462
473
|
}
|
|
463
474
|
}
|
|
@@ -722,6 +733,34 @@ async function repoStatus(ctx) {
|
|
|
722
733
|
return 0;
|
|
723
734
|
}
|
|
724
735
|
|
|
736
|
+
/** `repo deploy <pull request link | owner/repo#12> | --run <id>`: is the merge live on the site. */
|
|
737
|
+
async function repoDeploy(ctx) {
|
|
738
|
+
const { client, flags, io } = ctx;
|
|
739
|
+
refuseUnknownFlags(ctx, ARGS.get_deploy_status);
|
|
740
|
+
const result = await client.callTool(
|
|
741
|
+
"get_deploy_status",
|
|
742
|
+
argsFromFlags(ARGS.get_deploy_status, flags, ctx.positionals)
|
|
743
|
+
);
|
|
744
|
+
printResult(io, flags, result, (r) =>
|
|
745
|
+
[`${r.repo}#${r.pr_number}: ${r.state}`, ` ${r.message}`, r.deploy_url ? ` ${r.deploy_url}` : null]
|
|
746
|
+
.filter(Boolean)
|
|
747
|
+
.join("\n")
|
|
748
|
+
);
|
|
749
|
+
return 0;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/** `repo slack-delete <Slack message link>`: take down a message Letter posted. Only Letter's own. */
|
|
753
|
+
async function repoSlackDelete(ctx) {
|
|
754
|
+
const { client, flags, io } = ctx;
|
|
755
|
+
refuseUnknownFlags(ctx, ARGS.delete_slack_message);
|
|
756
|
+
const result = await client.callTool(
|
|
757
|
+
"delete_slack_message",
|
|
758
|
+
argsFromFlags(ARGS.delete_slack_message, flags, ctx.positionals)
|
|
759
|
+
);
|
|
760
|
+
printResult(io, flags, result, (r) => `Deleted: ${r.text}`);
|
|
761
|
+
return 0;
|
|
762
|
+
}
|
|
763
|
+
|
|
725
764
|
const ACTIVITY_MARK = { progress: "·", stage: "▸", say: "»", think: "◇", tool: "$", user: ">", error: "!" };
|
|
726
765
|
|
|
727
766
|
/** `repo activity <run-id> [--follow] [--since <iso>]`: the build's feed; --follow prints new lines until it stops. */
|
package/lib/commands/site.mjs
CHANGED
|
@@ -58,6 +58,19 @@ function proposalInput(flags) {
|
|
|
58
58
|
|
|
59
59
|
const ARGS = {
|
|
60
60
|
list_sites: {},
|
|
61
|
+
screenshot_page: {
|
|
62
|
+
url: { positional: 0, label: "url" },
|
|
63
|
+
run_id: "run",
|
|
64
|
+
path: "path",
|
|
65
|
+
device: { flag: "viewport", enum: ["desktop", "phone"] },
|
|
66
|
+
full_page: { flag: "full-page", type: "bool" },
|
|
67
|
+
},
|
|
68
|
+
test_page_speed: {
|
|
69
|
+
url: { positional: 0, label: "url" },
|
|
70
|
+
run_id: "run",
|
|
71
|
+
path: "path",
|
|
72
|
+
device: { flag: "viewport", enum: ["mobile", "desktop"] },
|
|
73
|
+
},
|
|
61
74
|
map_site: {
|
|
62
75
|
host: { positional: 0, label: "host" },
|
|
63
76
|
url: "url",
|
|
@@ -298,9 +311,13 @@ export async function cmdSite(ctx) {
|
|
|
298
311
|
return siteProspect(rest);
|
|
299
312
|
case "suggest":
|
|
300
313
|
return siteSuggest(rest);
|
|
314
|
+
case "screenshot":
|
|
315
|
+
return siteScreenshot(rest);
|
|
316
|
+
case "speed":
|
|
317
|
+
return siteSpeed(rest);
|
|
301
318
|
default:
|
|
302
319
|
throw new CliError(
|
|
303
|
-
`Unknown site subcommand: ${sub ?? "(none)"}. Try: list, map, refresh, unmap, tree, facts, builds, metrics, page, observations, observe, dismiss, families, decide-family, proposals, propose, decide, fix, competitors, watch-competitors, highlight, prospect, suggest`
|
|
320
|
+
`Unknown site subcommand: ${sub ?? "(none)"}. Try: list, map, refresh, unmap, tree, facts, builds, metrics, page, observations, observe, dismiss, families, decide-family, proposals, propose, decide, fix, competitors, watch-competitors, highlight, prospect, suggest, screenshot, speed`
|
|
304
321
|
);
|
|
305
322
|
}
|
|
306
323
|
}
|
|
@@ -489,6 +506,43 @@ async function siteUnmap(ctx) {
|
|
|
489
506
|
return 0;
|
|
490
507
|
}
|
|
491
508
|
|
|
509
|
+
/** `site screenshot [url] [--run <id>] [--path /p] [--viewport desktop|phone] [--full-page]`: a picture of the page, as a link. */
|
|
510
|
+
async function siteScreenshot(ctx) {
|
|
511
|
+
const { client, flags, io } = ctx;
|
|
512
|
+
refuseUnknownFlags(ctx, ARGS.screenshot_page);
|
|
513
|
+
const result = await client.callTool(
|
|
514
|
+
"screenshot_page",
|
|
515
|
+
argsFromFlags(ARGS.screenshot_page, flags, ctx.positionals)
|
|
516
|
+
);
|
|
517
|
+
printResult(
|
|
518
|
+
io,
|
|
519
|
+
flags,
|
|
520
|
+
result,
|
|
521
|
+
(r) => `${r.url} (${r.device})\n${r.image_url}\nThe link opens until ${r.expires_at}.`
|
|
522
|
+
);
|
|
523
|
+
return 0;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** `site speed [url] [--run <id>] [--path /p] [--viewport mobile|desktop]`: how fast the page loads now. */
|
|
527
|
+
async function siteSpeed(ctx) {
|
|
528
|
+
const { client, flags, io } = ctx;
|
|
529
|
+
refuseUnknownFlags(ctx, ARGS.test_page_speed);
|
|
530
|
+
const result = await client.callTool(
|
|
531
|
+
"test_page_speed",
|
|
532
|
+
argsFromFlags(ARGS.test_page_speed, flags, ctx.positionals)
|
|
533
|
+
);
|
|
534
|
+
const n = (v, unit = " ms") => (v === null ? "-" : `${v}${unit}`);
|
|
535
|
+
printResult(io, flags, result, (r) =>
|
|
536
|
+
[
|
|
537
|
+
`${r.url} (${r.device}): performance ${n(r.performance_score, "")}`,
|
|
538
|
+
` LCP ${n(r.lcp_ms)} CLS ${n(r.cls, "")} INP ${n(r.inp_ms)} TTFB ${n(r.ttfb_ms)}`,
|
|
539
|
+
` FCP ${n(r.fcp_ms)} TBT ${n(r.tbt_ms)} Speed Index ${n(r.speed_index_ms)}`,
|
|
540
|
+
...r.opportunities.map((o) => ` · ${o.title}${o.saving ? ` (${o.saving})` : ""}`),
|
|
541
|
+
].join("\n")
|
|
542
|
+
);
|
|
543
|
+
return 0;
|
|
544
|
+
}
|
|
545
|
+
|
|
492
546
|
async function siteFacts(ctx) {
|
|
493
547
|
const { client, flags, io } = ctx;
|
|
494
548
|
refuseUnknownFlags(ctx, ARGS.get_site_facts);
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
// letterstory visits domain composal.com [--site <id>] move the site to a new domain, keeping its key
|
|
20
20
|
// letterstory visits pages --since 28d [--path '/docs/*'] [--agent openai-crawler]
|
|
21
21
|
// letterstory visits health --site <id> staff: how far to trust a site's numbers, and what to fix
|
|
22
|
-
// letterstory visits agent-sites [--include-test]
|
|
22
|
+
// letterstory visits agent-sites [--include-test] [--figures] [--from <ISO>] [--to <ISO>]
|
|
23
|
+
// staff: every agent site by stage, waiting on a person first;
|
|
24
|
+
// --figures counts what reached them in the window (7 days)
|
|
23
25
|
// letterstory visits connect vercel|cloudflare send the host's request logs (no code to deploy)
|
|
24
26
|
// letterstory visits connectors | disconnect <id>
|
|
25
27
|
// letterstory visits shortcut [mod+e | default] your own key for Letter Edit's card (⌘L by default)
|
|
@@ -124,6 +126,9 @@ export const ARGS = {
|
|
|
124
126
|
visitors_admin_coverage: { site_id: "site" },
|
|
125
127
|
visitors_admin_agent_sites: {
|
|
126
128
|
include_test: { value: (flags) => (flagBool(flags["include-test"]) ? true : undefined) },
|
|
129
|
+
figures: { value: (flags) => (flagBool(flags.figures) ? true : undefined) },
|
|
130
|
+
from: "from",
|
|
131
|
+
to: "to",
|
|
127
132
|
},
|
|
128
133
|
visitors_add_connector: {
|
|
129
134
|
site_id: "site",
|
|
@@ -391,6 +396,19 @@ async function visitsAgentSites(ctx) {
|
|
|
391
396
|
lines.push(
|
|
392
397
|
` ${(AGENT_SITE_STAGE_WORDS[s.stage] ?? s.stage).padEnd(17)} ${s.org_name ?? s.org_id} ${s.address ?? ""}${s.since ? ` (since ${s.since.slice(0, 10)})` : ""}`
|
|
393
398
|
);
|
|
399
|
+
const a = r.activity;
|
|
400
|
+
if (a) {
|
|
401
|
+
const q = a.requests;
|
|
402
|
+
const k = a.asks;
|
|
403
|
+
lines.push(
|
|
404
|
+
"",
|
|
405
|
+
`${a.window.from} to ${a.window.to}${a.window.clamped ? " (the 90 days kept)" : ""}`,
|
|
406
|
+
` Requests ${q.total} on Agent Site hosts, ${q.sites} of ${a.population.sites} sites`,
|
|
407
|
+
` ${q.verified} verified · ${q.claimed} claimed · ${q.unnamed} unnamed · ${q.not_found} not found`,
|
|
408
|
+
` Asks ${k.counted} counted of ${k.rows} rows (HTTP ${k.http} · MCP ${k.mcp}), ${k.distinct} distinct`,
|
|
409
|
+
` ${k.corpus} corpus · ${k.website} website · ${k.misses} not in sources · ${k.reused} reused · ${k.cited} cited`
|
|
410
|
+
);
|
|
411
|
+
}
|
|
394
412
|
return lines.join("\n");
|
|
395
413
|
});
|
|
396
414
|
return 0;
|