@letterstory/cli 0.177.146 → 0.177.147
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 +6 -2
- package/lib/commands/visits.mjs +21 -4
- 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.147";
|
|
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;
|
|
@@ -102,7 +102,7 @@ export const EXIT_PAYMENT_REQUIRED = 3;
|
|
|
102
102
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
|
103
103
|
// `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
|
|
104
104
|
export const BOOLEAN_FLAGS = new Set([
|
|
105
|
-
// visits transact add folder|page: leave it out of the set.
|
|
105
|
+
// visits transact add folder|page|connection: leave it out of the set (a connection: switch it off).
|
|
106
106
|
"uncheck",
|
|
107
107
|
"clear-choice",
|
|
108
108
|
"oauth",
|
|
@@ -2128,6 +2128,10 @@ Visits (Visitors: AI agents reading your site, and AI answers sending people to
|
|
|
2128
2128
|
visits connectors | disconnect <id> The site's host connectors
|
|
2129
2129
|
visits transact [on|off] [--site <id>|--host <h>] Transact: agents' questions answered from your sources, cited
|
|
2130
2130
|
visits transact add folder <path> [--uncheck] | page <url> [--uncheck] | site <host> | file <path> | text --title <t> --text <t>
|
|
2131
|
+
visits transact add connection code|events|database [--uncheck]
|
|
2132
|
+
Look into your product's code, events or database when the pages don't answer
|
|
2133
|
+
visits transact pr [--repo owner/name] [--base <branch>] [--site <id>|--host <h>]
|
|
2134
|
+
One pull request: the line for agents, and answers to what they asked
|
|
2131
2135
|
visits transact source <source-id>|--folder <path> | remove <id> | test "<question>"
|
|
2132
2136
|
visits transact asks [--since 7d] [--limit <n>] What agents asked, answered, and asks per agent visit
|
|
2133
2137
|
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
// letterstory visits transact [on|off] [--host acme.com] Transact: agents' questions answered from your sources, cited
|
|
25
25
|
// letterstory visits transact add folder /blog [--uncheck] | page <url> [--uncheck] | site docs.acme.com
|
|
26
26
|
// letterstory visits transact add file ./faq.pdf | text --title Support --text "…"
|
|
27
|
+
// letterstory visits transact add connection code|events|database [--uncheck] look into it when the pages don't answer
|
|
28
|
+
// letterstory visits transact pr [--repo owner/name] [--base branch] the line and the missed answers, as one pull request
|
|
27
29
|
// letterstory visits transact source <source-id> | --folder /docs
|
|
28
30
|
// letterstory visits transact remove <source-id>
|
|
29
31
|
// letterstory visits transact test "What does it cost?"
|
|
@@ -115,9 +117,12 @@ export const ARGS = {
|
|
|
115
117
|
site_id: "site",
|
|
116
118
|
kind: {
|
|
117
119
|
positional: 0,
|
|
118
|
-
label: "kind (folder | page | site | file | text)",
|
|
120
|
+
label: "kind (folder | page | site | file | text | connection)",
|
|
119
121
|
required: true,
|
|
120
|
-
enum: ["folder", "page", "site", "file", "text"],
|
|
122
|
+
enum: ["folder", "page", "site", "file", "text", "connection"],
|
|
123
|
+
},
|
|
124
|
+
connection: {
|
|
125
|
+
value: (flags, positionals) => (positionals[0] === "connection" ? positionals[1] : undefined),
|
|
121
126
|
},
|
|
122
127
|
path: {
|
|
123
128
|
value: (flags, positionals) =>
|
|
@@ -159,6 +164,7 @@ export const ARGS = {
|
|
|
159
164
|
site_id: "site",
|
|
160
165
|
source_id: { positional: 0, label: "source id", required: true },
|
|
161
166
|
},
|
|
167
|
+
visitors_open_transact_pr: { site_id: "site", host: "host", repo: "repo", base_branch: "base" },
|
|
162
168
|
visitors_list_transact_asks: { site_id: "site", days, limit: { flag: "limit", type: "num" } },
|
|
163
169
|
visitors_export: {
|
|
164
170
|
site_id: "site",
|
|
@@ -333,10 +339,17 @@ function transactLines(t) {
|
|
|
333
339
|
const what = s.snapshot ? `snapshot, ${s.chars} characters` : `${s.pages} ${s.pages === 1 ? "page" : "pages"}`;
|
|
334
340
|
lines.push(` ${s.id} ${s.kind} ${s.title} ${what} cited ${s.times_cited}`);
|
|
335
341
|
}
|
|
342
|
+
if (t.connections?.length) lines.push("", "Connections (looked into when the pages don't answer):");
|
|
343
|
+
for (const c of t.connections ?? [])
|
|
344
|
+
lines.push(
|
|
345
|
+
c.connected
|
|
346
|
+
? ` [${c.checked ? "x" : " "}] ${c.connection} ${c.title} cited ${c.times_cited}${c.source_id ? ` ${c.source_id}` : ""}`
|
|
347
|
+
: ` [-] ${c.connection} ${c.title} not connected`
|
|
348
|
+
);
|
|
336
349
|
return lines;
|
|
337
350
|
}
|
|
338
351
|
|
|
339
|
-
/** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `remove <id>`; `test "…"`; `asks`. */
|
|
352
|
+
/** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `remove <id>`; `test "…"`; `pr`; `asks`. */
|
|
340
353
|
async function visitsTransact(ctx) {
|
|
341
354
|
const { flags, io } = ctx;
|
|
342
355
|
const sub = ctx.positionals[0];
|
|
@@ -379,6 +392,10 @@ async function visitsTransact(ctx) {
|
|
|
379
392
|
);
|
|
380
393
|
return 0;
|
|
381
394
|
}
|
|
395
|
+
if (sub === "pr") {
|
|
396
|
+
printResult(io, flags, await call(rest, "visitors_open_transact_pr"));
|
|
397
|
+
return 0;
|
|
398
|
+
}
|
|
382
399
|
if (sub === "asks") {
|
|
383
400
|
const result = await call(rest, "visitors_list_transact_asks");
|
|
384
401
|
printResult(io, flags, result, (r) => {
|
|
@@ -394,7 +411,7 @@ async function visitsTransact(ctx) {
|
|
|
394
411
|
return 0;
|
|
395
412
|
}
|
|
396
413
|
if (sub !== undefined)
|
|
397
|
-
throw new CliError("Usage: visits transact [on|off|add <kind>|source <id>|remove <id>|test|asks]");
|
|
414
|
+
throw new CliError("Usage: visits transact [on|off|add <kind>|source <id>|remove <id>|test|pr|asks]");
|
|
398
415
|
const result = await call(ctx, "visitors_get_transact");
|
|
399
416
|
printResult(io, flags, result, (t) => transactLines(t).join("\n"));
|
|
400
417
|
return 0;
|