@letterstory/cli 0.176.0 → 0.176.1
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/visits.mjs +26 -2
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
81
81
|
|
|
82
82
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
83
|
-
export const VERSION = "0.176.
|
|
83
|
+
export const VERSION = "0.176.1";
|
|
84
84
|
|
|
85
85
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
86
86
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// `visits` — Visitors from a terminal: which AI agents read your site, why they
|
|
2
2
|
// came, which AI answers sent people to you, and two agents side by side. Thin
|
|
3
3
|
// wrappers over the visitors_* tools (visitors_get_agent_visits,
|
|
4
|
-
// visitors_get_citations, visitors_compare_agents, visitors_export, …), the same
|
|
4
|
+
// visitors_get_citations, visitors_get_human_visits, visitors_compare_agents, visitors_export, …), the same
|
|
5
5
|
// lib functions the app and lettervisit.com/mcp call.
|
|
6
6
|
//
|
|
7
7
|
// letterstory visits --agent claude --since 7d
|
|
8
8
|
// letterstory visits --kind agent_file --paths 100 --since 7d
|
|
9
9
|
// letterstory visits compare chatgpt claude --path '/docs/*' --since 7d
|
|
10
10
|
// letterstory visits citations --since 30d
|
|
11
|
+
// letterstory visits people --since 30d people who read the site, and how many were identified
|
|
11
12
|
// letterstory visits export --since 30d --format csv
|
|
12
13
|
// letterstory visits sites
|
|
13
14
|
// letterstory visits pages --since 28d [--path '/docs/*'] [--agent openai-crawler]
|
|
@@ -35,6 +36,7 @@ export const ARGS = {
|
|
|
35
36
|
paths_limit: { flag: "paths", type: "num" },
|
|
36
37
|
},
|
|
37
38
|
visitors_get_citations: { site_id: "site", days },
|
|
39
|
+
visitors_get_human_visits: { site_id: "site", days },
|
|
38
40
|
visitors_admin_coverage: { site_id: "site" },
|
|
39
41
|
visitors_add_connector: {
|
|
40
42
|
site_id: "site",
|
|
@@ -89,6 +91,8 @@ export async function cmdVisits(ctx) {
|
|
|
89
91
|
return visitsList(sub === undefined ? ctx : rest);
|
|
90
92
|
case "citations":
|
|
91
93
|
return visitsCitations(rest);
|
|
94
|
+
case "people":
|
|
95
|
+
return visitsPeople(rest);
|
|
92
96
|
case "compare":
|
|
93
97
|
return visitsCompare(rest);
|
|
94
98
|
case "export":
|
|
@@ -107,7 +111,7 @@ export async function cmdVisits(ctx) {
|
|
|
107
111
|
return visitsDisconnect(rest);
|
|
108
112
|
default:
|
|
109
113
|
throw new CliError(
|
|
110
|
-
"Usage: visits [list|citations|compare|export|sites|pages|health|connect|connectors|disconnect]"
|
|
114
|
+
"Usage: visits [list|citations|people|compare|export|sites|pages|health|connect|connectors|disconnect]"
|
|
111
115
|
);
|
|
112
116
|
}
|
|
113
117
|
}
|
|
@@ -279,6 +283,26 @@ async function visitsCitations(ctx) {
|
|
|
279
283
|
return 0;
|
|
280
284
|
}
|
|
281
285
|
|
|
286
|
+
async function visitsPeople(ctx) {
|
|
287
|
+
const { flags, io } = ctx;
|
|
288
|
+
const result = await call(ctx, "visitors_get_human_visits");
|
|
289
|
+
printResult(io, flags, result, (r) => {
|
|
290
|
+
if (!r.people_counted) return r.message ?? "People aren't counted for this site.";
|
|
291
|
+
const lines = [`${r.humans} page views by people, ${r.since} to ${r.until}`];
|
|
292
|
+
if (r.unique_visitors !== null)
|
|
293
|
+
lines.push(` ${r.unique_visitors} unique visitors${r.uniques_exact ? "" : " (a floor)"}`);
|
|
294
|
+
if (r.identified_people !== null) {
|
|
295
|
+
const share =
|
|
296
|
+
r.identified_share === null ? "" : ` (${(r.identified_share * 100).toFixed(1)}% of unique visitors)`;
|
|
297
|
+
lines.push(` ${r.identified_people} identified${share}`);
|
|
298
|
+
}
|
|
299
|
+
lines.push("", "Per day:");
|
|
300
|
+
for (const d of r.daily) lines.push(` ${d.day} ${String(d.humans).padStart(6)}`);
|
|
301
|
+
return lines.join("\n");
|
|
302
|
+
});
|
|
303
|
+
return 0;
|
|
304
|
+
}
|
|
305
|
+
|
|
282
306
|
async function visitsCompare(ctx) {
|
|
283
307
|
const { flags, io } = ctx;
|
|
284
308
|
const result = await call(ctx, "visitors_compare_agents");
|