@letterstory/cli 0.177.159 → 0.177.161
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/visits.mjs +58 -7
- 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.161";
|
|
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;
|
|
@@ -2126,6 +2126,7 @@ Visits (Visitors: AI agents reading your site, and AI answers sending people to
|
|
|
2126
2126
|
visits citations [--since 30d] [--site <id>] Visits that clicked through from ChatGPT, Claude, Perplexity…
|
|
2127
2127
|
visits who [--icp|--not-icp] [--category <group>] [--path <p>] [--since 30d] [--limit <n>]
|
|
2128
2128
|
Who was identified, and who fits your ICP
|
|
2129
|
+
visits path <person-id> [--since 30d] [--site <id>] One person's visits, their pages in order, and each one's replay
|
|
2129
2130
|
visits compare <agent-a> <agent-b> [--since 7d] [--path '/docs/*'] [--purpose <p>]
|
|
2130
2131
|
Pages one agent read that the other didn't
|
|
2131
2132
|
visits export [--since 30d] [--format json|csv] [--table agent_visits|citations] [--include agents|people|companies] [--icp|--not-icp]
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// letterstory visits citations --since 30d
|
|
11
11
|
// letterstory visits people --since 30d [--path /pricing] people who read the site, and how many were identified
|
|
12
12
|
// letterstory visits who --icp [--category Investors] [--path /pricing] who was identified (--icp: who fits your ICP)
|
|
13
|
+
// letterstory visits path <person-id> [--since 30d] one person's visits, their pages in order, and each one's replay
|
|
13
14
|
// letterstory visits converts [--event signup] [--days 30] which pages lead to a conversion, by lift
|
|
14
15
|
// letterstory visits retention [--days 90] which features new people used early and came back
|
|
15
16
|
// letterstory visits export --since 30d --format csv
|
|
@@ -23,9 +24,10 @@
|
|
|
23
24
|
// letterstory visits shortcut [mod+e | default] your own key for Letter Edit's card (⌘L by default)
|
|
24
25
|
// letterstory visits transact [on|off] [--host acme.com] Transact: agents' questions answered from your sources, cited
|
|
25
26
|
// letterstory visits transact add folder /answers | page <url> | site https://docs.acme.com/answers
|
|
26
|
-
// letterstory visits transact add text --
|
|
27
|
+
// letterstory visits transact add text --text "Knowledge agents should know" [--title "Question?"] [--ask <id>]
|
|
27
28
|
// letterstory visits transact pr [--repo owner/name] [--base branch] the line and the missed answers, as one pull request
|
|
28
|
-
// letterstory visits transact source <source-id> | --folder /docs
|
|
29
|
+
// letterstory visits transact source <source-id> | --folder /docs | --section /blog
|
|
30
|
+
// letterstory visits transact search "sso" the knowledge base and the site's pages, as an ask searches them
|
|
29
31
|
// letterstory visits transact remove <source-id>
|
|
30
32
|
// letterstory visits transact test "What does it cost?"
|
|
31
33
|
// letterstory visits transact asks [--since 7d] [--limit 50]
|
|
@@ -79,6 +81,11 @@ export const ARGS = {
|
|
|
79
81
|
limit: { flag: "limit", type: "num" },
|
|
80
82
|
icp: { flag: "icp", type: "bool", negate: "not-icp" },
|
|
81
83
|
},
|
|
84
|
+
visitors_get_person_path: {
|
|
85
|
+
site_id: "site",
|
|
86
|
+
person_id: { positional: 0, label: "person id (from visits who --json)", required: true },
|
|
87
|
+
days,
|
|
88
|
+
},
|
|
82
89
|
visitors_admin_coverage: { site_id: "site" },
|
|
83
90
|
visitors_add_connector: {
|
|
84
91
|
site_id: "site",
|
|
@@ -147,6 +154,12 @@ export const ARGS = {
|
|
|
147
154
|
site_id: "site",
|
|
148
155
|
source_id: { positional: 0, label: "source id" },
|
|
149
156
|
folder: "folder",
|
|
157
|
+
section: "section",
|
|
158
|
+
limit: { flag: "limit", type: "num" },
|
|
159
|
+
},
|
|
160
|
+
visitors_search_transact_knowledge: {
|
|
161
|
+
site_id: "site",
|
|
162
|
+
query: { positional: 0, label: "query", required: true },
|
|
150
163
|
limit: { flag: "limit", type: "num" },
|
|
151
164
|
},
|
|
152
165
|
visitors_set_transact_ask_test: {
|
|
@@ -224,6 +237,8 @@ export async function cmdVisits(ctx) {
|
|
|
224
237
|
return visitsPeople(rest);
|
|
225
238
|
case "who":
|
|
226
239
|
return visitsWho(rest);
|
|
240
|
+
case "path":
|
|
241
|
+
return visitsPath(rest);
|
|
227
242
|
case "converts":
|
|
228
243
|
return visitsConverts(rest);
|
|
229
244
|
case "retention":
|
|
@@ -252,7 +267,7 @@ export async function cmdVisits(ctx) {
|
|
|
252
267
|
return visitsTransact(rest);
|
|
253
268
|
default:
|
|
254
269
|
throw new CliError(
|
|
255
|
-
"Usage: visits [list|requests|citations|people|who|compare|export|sites|domain|pages|health|connect|connectors|disconnect|shortcut|transact]"
|
|
270
|
+
"Usage: visits [list|requests|citations|people|who|path|compare|export|sites|domain|pages|health|connect|connectors|disconnect|shortcut|transact]"
|
|
256
271
|
);
|
|
257
272
|
}
|
|
258
273
|
}
|
|
@@ -352,7 +367,7 @@ function transactLines(t) {
|
|
|
352
367
|
return lines;
|
|
353
368
|
}
|
|
354
369
|
|
|
355
|
-
/** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `remove <id>`; `test "…"`; `pr`; `asks`; `learnings`. */
|
|
370
|
+
/** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `search "…"`; `remove <id>`; `test "…"`; `pr`; `asks`; `learnings`. */
|
|
356
371
|
async function visitsTransact(ctx) {
|
|
357
372
|
const { flags, io } = ctx;
|
|
358
373
|
const sub = ctx.positionals[0];
|
|
@@ -380,6 +395,18 @@ async function visitsTransact(ctx) {
|
|
|
380
395
|
);
|
|
381
396
|
return 0;
|
|
382
397
|
}
|
|
398
|
+
if (sub === "search") {
|
|
399
|
+
const result = await call(rest, "visitors_search_transact_knowledge");
|
|
400
|
+
printResult(io, flags, result, (r) => {
|
|
401
|
+
const hits = (label, rows) =>
|
|
402
|
+
rows.length
|
|
403
|
+
? [label, ...rows.map((h) => ` ${h.title}${h.url ? ` ${h.url}` : ""}\n ${h.snippet}`)]
|
|
404
|
+
: [];
|
|
405
|
+
const lines = [...hits("Structured", r.structured), ...hits("Unstructured", r.unstructured)];
|
|
406
|
+
return lines.length ? lines.join("\n") : "Nothing found";
|
|
407
|
+
});
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
383
410
|
if (sub === "remove") {
|
|
384
411
|
const result = await call(rest, "visitors_remove_transact_source");
|
|
385
412
|
printResult(io, flags, result, () => "Removed");
|
|
@@ -416,8 +443,12 @@ async function visitsTransact(ctx) {
|
|
|
416
443
|
}
|
|
417
444
|
if (sub === "learnings") {
|
|
418
445
|
const result = await call(rest, "visitors_get_transact_learnings");
|
|
419
|
-
printResult(
|
|
420
|
-
|
|
446
|
+
printResult(
|
|
447
|
+
io,
|
|
448
|
+
flags,
|
|
449
|
+
result,
|
|
450
|
+
(r) =>
|
|
451
|
+
r.refused ?? (r.learnings.length ? r.learnings.map((l) => `- ${l.text}`).join("\n") : "No themes yet")
|
|
421
452
|
);
|
|
422
453
|
return 0;
|
|
423
454
|
}
|
|
@@ -436,7 +467,9 @@ async function visitsTransact(ctx) {
|
|
|
436
467
|
return 0;
|
|
437
468
|
}
|
|
438
469
|
if (sub !== undefined)
|
|
439
|
-
throw new CliError(
|
|
470
|
+
throw new CliError(
|
|
471
|
+
"Usage: visits transact [on|off|add <kind>|source <id>|search <query>|remove <id>|test|pr|asks|learnings]"
|
|
472
|
+
);
|
|
440
473
|
const result = await call(ctx, "visitors_get_transact");
|
|
441
474
|
printResult(io, flags, result, (t) => transactLines(t).join("\n"));
|
|
442
475
|
return 0;
|
|
@@ -565,6 +598,24 @@ async function visitsWho(ctx) {
|
|
|
565
598
|
return 0;
|
|
566
599
|
}
|
|
567
600
|
|
|
601
|
+
async function visitsPath(ctx) {
|
|
602
|
+
const { flags, io } = ctx;
|
|
603
|
+
const result = await call(ctx, "visitors_get_person_path");
|
|
604
|
+
printResult(io, flags, result, (r) => {
|
|
605
|
+
const lines = [`${r.total} visits in the last ${r.days} days`];
|
|
606
|
+
for (const v of r.visits) {
|
|
607
|
+
const from = v.source ? ` from ${v.source}` : "";
|
|
608
|
+
const replay = v.replay
|
|
609
|
+
? ` replay ${v.replay.id}${v.replay.confidence === "likely" ? " (likely)" : ""}`
|
|
610
|
+
: "";
|
|
611
|
+
lines.push(` ${v.started_at.slice(0, 16).replace("T", " ")}${from}${replay}`);
|
|
612
|
+
lines.push(` ${v.pages.map((p) => p.path).join(" → ")}`);
|
|
613
|
+
}
|
|
614
|
+
return lines.join("\n");
|
|
615
|
+
});
|
|
616
|
+
return 0;
|
|
617
|
+
}
|
|
618
|
+
|
|
568
619
|
async function visitsConverts(ctx) {
|
|
569
620
|
const { flags, io } = ctx;
|
|
570
621
|
const result = await call(ctx, "visitors_get_conversions");
|