@letterstory/cli 0.177.111 → 0.177.112
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 +1 -1
- package/lib/commands/usage.mjs +7 -0
- package/lib/commands/visits.mjs +50 -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.112";
|
|
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;
|
package/lib/commands/usage.mjs
CHANGED
|
@@ -438,6 +438,13 @@ export async function cmdUsage(ctx) {
|
|
|
438
438
|
const t = r.totals;
|
|
439
439
|
const lines = [
|
|
440
440
|
`${r.app.host ?? "Your app"}, last ${r.days} days: ${t.people} people, ${t.companies} companies, ${t.pages} pages`,
|
|
441
|
+
...(r.browsers
|
|
442
|
+
? [` of ${r.browsers.total} browsers since ${r.browsers.since}, ${r.browsers.signed_in} signed in`]
|
|
443
|
+
: []),
|
|
444
|
+
...r.sources.map(
|
|
445
|
+
(s) =>
|
|
446
|
+
` ${s.source === "letter" ? "Letter, tracked since" : "PostHog history from"} ${s.first_day}: ${s.people} people`
|
|
447
|
+
),
|
|
441
448
|
"",
|
|
442
449
|
"Features",
|
|
443
450
|
...r.features
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
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 converts [--event signup] [--days 30] which pages lead to a conversion, by lift
|
|
14
|
+
// letterstory visits retention [--days 90] which features new people used early and came back
|
|
13
15
|
// letterstory visits export --since 30d --format csv
|
|
14
16
|
// letterstory visits export --include people --icp > icp.csv the people who fit your ICP, as Humans shows them
|
|
15
17
|
// letterstory visits sites
|
|
@@ -62,6 +64,13 @@ export const ARGS = {
|
|
|
62
64
|
},
|
|
63
65
|
visitors_get_citations: { site_id: "site", days },
|
|
64
66
|
visitors_get_human_visits: { site_id: "site", days, path: "path" },
|
|
67
|
+
visitors_get_conversions: {
|
|
68
|
+
site_id: "site",
|
|
69
|
+
days,
|
|
70
|
+
event: { flag: "event" },
|
|
71
|
+
limit: { flag: "limit", type: "num" },
|
|
72
|
+
},
|
|
73
|
+
visitors_get_feature_retention: { site_id: "site", days },
|
|
65
74
|
visitors_get_people: {
|
|
66
75
|
site_id: "site",
|
|
67
76
|
days,
|
|
@@ -192,6 +201,10 @@ export async function cmdVisits(ctx) {
|
|
|
192
201
|
return visitsPeople(rest);
|
|
193
202
|
case "who":
|
|
194
203
|
return visitsWho(rest);
|
|
204
|
+
case "converts":
|
|
205
|
+
return visitsConverts(rest);
|
|
206
|
+
case "retention":
|
|
207
|
+
return visitsRetention(rest);
|
|
195
208
|
case "compare":
|
|
196
209
|
return visitsCompare(rest);
|
|
197
210
|
case "export":
|
|
@@ -510,6 +523,43 @@ async function visitsWho(ctx) {
|
|
|
510
523
|
return 0;
|
|
511
524
|
}
|
|
512
525
|
|
|
526
|
+
async function visitsConverts(ctx) {
|
|
527
|
+
const { flags, io } = ctx;
|
|
528
|
+
const result = await call(ctx, "visitors_get_conversions");
|
|
529
|
+
printResult(io, flags, result, (r) => {
|
|
530
|
+
if (!r.event) return 'No events tracked yet. Add lettervisit("track", "signup") where it happens.';
|
|
531
|
+
const pct = (v) => `${(v * 100).toFixed(1)}%`;
|
|
532
|
+
const lines = [
|
|
533
|
+
`${r.event}: ${r.browsers ? `${r.browsers.converted} of ${r.browsers.total} browsers (${pct(r.browsers.rate)})` : "no browsers"} since ${r.since}`,
|
|
534
|
+
`Events: ${r.events.map((e) => `${e.name} ${e.browsers}`).join(", ")}`,
|
|
535
|
+
"",
|
|
536
|
+
];
|
|
537
|
+
for (const p of r.pages)
|
|
538
|
+
lines.push(
|
|
539
|
+
` ${p.path.slice(0, 40).padEnd(42)} ${String(p.viewers).padStart(6)} viewers ${pct(p.rate).padStart(6)} ${p.lift === null ? "" : `${p.lift}x`}`
|
|
540
|
+
);
|
|
541
|
+
return lines.join("\n");
|
|
542
|
+
});
|
|
543
|
+
return 0;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
async function visitsRetention(ctx) {
|
|
547
|
+
const { flags, io } = ctx;
|
|
548
|
+
const result = await call(ctx, "visitors_get_feature_retention");
|
|
549
|
+
printResult(io, flags, result, (r) => {
|
|
550
|
+
if (!r.features.length) return "Not enough new people yet.";
|
|
551
|
+
const pct = (v) => `${(v * 100).toFixed(0)}%`;
|
|
552
|
+
return [
|
|
553
|
+
`New people since ${r.since}: used early (first ${r.early_days} days) vs not, back by week 3`,
|
|
554
|
+
...r.features.map(
|
|
555
|
+
(f) =>
|
|
556
|
+
` ${f.feature.slice(0, 36).padEnd(38)} ${String(f.users).padStart(5)} people ${pct(f.rate).padStart(4)} vs ${pct(f.rate_others).padStart(4)} ${f.lift === null ? "" : `${f.lift}x`}`
|
|
557
|
+
),
|
|
558
|
+
].join("\n");
|
|
559
|
+
});
|
|
560
|
+
return 0;
|
|
561
|
+
}
|
|
562
|
+
|
|
513
563
|
async function visitsCompare(ctx) {
|
|
514
564
|
const { flags, io } = ctx;
|
|
515
565
|
const result = await call(ctx, "visitors_compare_agents");
|