@letterstory/cli 0.177.152 → 0.177.154
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 +7 -5
- package/lib/commands/shared.mjs +2 -0
- package/lib/commands/targets.mjs +2 -1
- package/lib/commands/visits.mjs +18 -40
- 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.154";
|
|
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;
|
|
@@ -171,6 +171,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
171
171
|
// replicate forms: read the site's forms key (admins) instead of its submissions.
|
|
172
172
|
"show-key",
|
|
173
173
|
"searched",
|
|
174
|
+
// targets suggest: buyer questions to track instead of phrases.
|
|
175
|
+
"prompts",
|
|
174
176
|
// sim create / resample / sample-key: keep the customer's sample key, or delete it now.
|
|
175
177
|
"keep-key",
|
|
176
178
|
"delete-key",
|
|
@@ -2132,10 +2134,10 @@ Visits (Visitors: AI agents reading your site, and AI answers sending people to
|
|
|
2132
2134
|
visits health --site <id> Staff: how far to trust a site's numbers, each check and its fix
|
|
2133
2135
|
visits connect vercel|cloudflare [--site <id>] Send the host's request logs (no code to deploy)
|
|
2134
2136
|
visits connectors | disconnect <id> The site's host connectors
|
|
2135
|
-
visits transact [on|off] [--site <id>|--host <h>] Transact:
|
|
2136
|
-
visits transact add folder <path>
|
|
2137
|
-
visits transact add
|
|
2138
|
-
|
|
2137
|
+
visits transact [on|off] [--site <id>|--host <h>] Transact: cited public corpus answers with website fallback
|
|
2138
|
+
visits transact add folder <path> | page <url> | site <url>
|
|
2139
|
+
visits transact add text --title "Question?" --text "Public answer" [--ask <id>]
|
|
2140
|
+
Publish a reviewed public answer
|
|
2139
2141
|
visits transact pr [--repo owner/name] [--base <branch>] [--site <id>|--host <h>]
|
|
2140
2142
|
One pull request: the line for agents, and answers to what they asked
|
|
2141
2143
|
visits transact source <source-id>|--folder <path> | remove <id> | tests | test "<question>" [--discover]
|
package/lib/commands/shared.mjs
CHANGED
|
@@ -238,6 +238,8 @@ function readArgSource(key, source, flags, positionals, extra) {
|
|
|
238
238
|
if (v === undefined && source.required) {
|
|
239
239
|
throw new CliError(`Missing required <${source.label ?? key}>`);
|
|
240
240
|
}
|
|
241
|
+
if (v !== undefined && source.enum && !source.enum.includes(v))
|
|
242
|
+
throw new CliError(`${source.label ?? key} must be one of: ${source.enum.join(", ")}`);
|
|
241
243
|
return v;
|
|
242
244
|
}
|
|
243
245
|
const raw = flags[source.flag];
|
package/lib/commands/targets.mjs
CHANGED
|
@@ -102,6 +102,7 @@ export const ARGS = {
|
|
|
102
102
|
suggest_ranking_targets: {
|
|
103
103
|
offering_id: offering,
|
|
104
104
|
searched: { value: (flags) => (flags.searched === undefined ? undefined : flagBool(flags.searched)) },
|
|
105
|
+
prompts: { value: (flags) => (flags.prompts === undefined ? undefined : flagBool(flags.prompts)) },
|
|
105
106
|
},
|
|
106
107
|
list_question_candidates: { limit: { flag: "limit", type: "num" } },
|
|
107
108
|
list_ranking_subqueries: {
|
|
@@ -142,7 +143,7 @@ const USAGE = `Usage: targets <list|add|update|activate|deactivate|cap|suggest|c
|
|
|
142
143
|
targets activate <target-id>
|
|
143
144
|
targets deactivate <target-id>
|
|
144
145
|
targets cap <offering-id|company> <n|default>
|
|
145
|
-
targets suggest [--offering <offering-id|company>] [--searched]
|
|
146
|
+
targets suggest [--offering <offering-id|company>] [--searched] [--prompts]
|
|
146
147
|
targets candidates [--limit <n>] new questions the market asks, checked and deduped
|
|
147
148
|
targets subqueries [<target-id>] [--retired] the phrasings asked under each target
|
|
148
149
|
targets subquery add <target-id> <phrasing>
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -22,17 +22,14 @@
|
|
|
22
22
|
// letterstory visits connectors | disconnect <id>
|
|
23
23
|
// letterstory visits shortcut [mod+e | default] your own key for Letter Edit's card (⌘L by default)
|
|
24
24
|
// letterstory visits transact [on|off] [--host acme.com] Transact: agents' questions answered from your sources, cited
|
|
25
|
-
// letterstory visits transact add folder /
|
|
26
|
-
// letterstory visits transact add
|
|
27
|
-
// letterstory visits transact add connection code|events|database [--uncheck] look into it when the pages don't answer
|
|
25
|
+
// letterstory visits transact add folder /answers | page <url> | site https://docs.acme.com/answers
|
|
26
|
+
// letterstory visits transact add text --title "Question?" --text "Reviewed public answer" [--ask <id>]
|
|
28
27
|
// letterstory visits transact pr [--repo owner/name] [--base branch] the line and the missed answers, as one pull request
|
|
29
28
|
// letterstory visits transact source <source-id> | --folder /docs
|
|
30
29
|
// letterstory visits transact remove <source-id>
|
|
31
30
|
// letterstory visits transact test "What does it cost?"
|
|
32
31
|
// letterstory visits transact asks [--since 7d] [--limit 50]
|
|
33
32
|
|
|
34
|
-
import { readFileSync } from "node:fs";
|
|
35
|
-
import { basename } from "node:path";
|
|
36
33
|
import { CliError } from "../client.mjs";
|
|
37
34
|
import { flagStr, printResult, argsFromFlags } from "./shared.mjs";
|
|
38
35
|
|
|
@@ -117,38 +114,33 @@ export const ARGS = {
|
|
|
117
114
|
site_id: "site",
|
|
118
115
|
kind: {
|
|
119
116
|
positional: 0,
|
|
120
|
-
label: "kind (folder | page | site |
|
|
117
|
+
label: "kind (folder | page | site | text)",
|
|
121
118
|
required: true,
|
|
122
|
-
enum: ["folder", "page", "site", "
|
|
123
|
-
},
|
|
124
|
-
connection: {
|
|
125
|
-
value: (flags, positionals) => (positionals[0] === "connection" ? positionals[1] : undefined),
|
|
119
|
+
enum: ["folder", "page", "site", "text"],
|
|
126
120
|
},
|
|
121
|
+
ask_id: "ask",
|
|
122
|
+
source_id: "source",
|
|
127
123
|
path: {
|
|
128
124
|
value: (flags, positionals) =>
|
|
129
|
-
|
|
125
|
+
["folder", "page"].includes(positionals[0]) && !/^https?:/i.test(positionals[1] ?? "")
|
|
130
126
|
? positionals[1]
|
|
131
127
|
: undefined,
|
|
132
128
|
},
|
|
133
129
|
url: {
|
|
134
130
|
value: (flags, positionals) =>
|
|
135
|
-
|
|
131
|
+
["page", "site", "folder"].includes(positionals[0]) && /^https?:/i.test(positionals[1] ?? "")
|
|
132
|
+
? positionals[1]
|
|
133
|
+
: undefined,
|
|
136
134
|
},
|
|
137
135
|
host: {
|
|
138
|
-
value: (flags, positionals) =>
|
|
136
|
+
value: (flags, positionals) =>
|
|
137
|
+
positionals[0] === "site" && !/^https?:/i.test(positionals[1] ?? "")
|
|
138
|
+
? positionals[1]
|
|
139
|
+
: flagStr(flags.host),
|
|
139
140
|
},
|
|
140
141
|
checked: { flag: "uncheck", type: "bool", invert: true },
|
|
141
142
|
title: "title",
|
|
142
143
|
text: "text",
|
|
143
|
-
file_name: {
|
|
144
|
-
value: (flags, positionals) => (positionals[0] === "file" ? basename(positionals[1] ?? "") : undefined),
|
|
145
|
-
},
|
|
146
|
-
content_base64: {
|
|
147
|
-
value: (flags, positionals) =>
|
|
148
|
-
positionals[0] === "file" && positionals[1]
|
|
149
|
-
? readFileSync(positionals[1]).toString("base64")
|
|
150
|
-
: undefined,
|
|
151
|
-
},
|
|
152
144
|
},
|
|
153
145
|
visitors_get_transact_source: {
|
|
154
146
|
site_id: "site",
|
|
@@ -344,24 +336,10 @@ function transactLines(t) {
|
|
|
344
336
|
const state = { off: "off", unproven: "on, served once the site is proven", on: "on" }[t.state] ?? t.state;
|
|
345
337
|
const lines = [`Transact: ${state}`];
|
|
346
338
|
if (t.url) lines.push(` ${t.url}`, ` MCP ${t.mcp_url}`);
|
|
347
|
-
lines.push("",
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
` [${f.checked ? "x" : " "}] ${f.path === "/" ? "/ (home)" : f.path} ${f.pages} ${f.pages === 1 ? "page" : "pages"} cited ${f.times_cited}${f.failed ? ` ${f.failed} failed` : ""}${f.by_default ? "" : " (yours)"}${f.id ? ` ${f.id}` : ""}`
|
|
352
|
-
);
|
|
353
|
-
if (t.sources.length) lines.push("", "Added:");
|
|
354
|
-
for (const s of t.sources) {
|
|
355
|
-
const what = s.snapshot ? `snapshot, ${s.chars} characters` : `${s.pages} ${s.pages === 1 ? "page" : "pages"}`;
|
|
356
|
-
lines.push(` ${s.id} ${s.kind} ${s.title} ${what} cited ${s.times_cited}`);
|
|
357
|
-
}
|
|
358
|
-
if (t.connections?.length) lines.push("", "Connections (looked into when the pages don't answer):");
|
|
359
|
-
for (const c of t.connections ?? [])
|
|
360
|
-
lines.push(
|
|
361
|
-
c.connected
|
|
362
|
-
? ` [${c.checked ? "x" : " "}] ${c.connection} ${c.title} cited ${c.times_cited}${c.source_id ? ` ${c.source_id}` : ""}`
|
|
363
|
-
: ` [-] ${c.connection} ${c.title} not connected`
|
|
364
|
-
);
|
|
339
|
+
lines.push("", `Public website fallback: ${t.website?.read ?? t.read} pages read`, "", "Answer corpus:");
|
|
340
|
+
for (const c of t.corpus ?? [])
|
|
341
|
+
lines.push(` ${c.id} ${c.url ?? c.title} ${c.entries} entries ${c.vector_ready} indexed`);
|
|
342
|
+
if (!t.corpus?.length) lines.push(" No public corpus indexed");
|
|
365
343
|
return lines;
|
|
366
344
|
}
|
|
367
345
|
|