@letterstory/cli 0.177.73 → 0.177.74
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 -1
- package/lib/client.mjs +1 -0
- package/lib/commands/usage.mjs +35 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
91
91
|
|
|
92
92
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
93
|
-
export const VERSION = "0.177.
|
|
93
|
+
export const VERSION = "0.177.74";
|
|
94
94
|
|
|
95
95
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
96
96
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -2124,6 +2124,11 @@ Refs (Visual Refs: other companies' brands to design something new after, apart
|
|
|
2124
2124
|
refs brief-show <brief-id> The brief, once ready
|
|
2125
2125
|
|
|
2126
2126
|
Usage data (what signed-in people do in your own app):
|
|
2127
|
+
usage proofs [--id <id>] Read saved proof analysis
|
|
2128
|
+
usage find-proofs --since <ISO> --until <ISO> [--focus <text>] Analyze actions
|
|
2129
|
+
usage review-proof --analysis-id <id> --card-id <id> --decision approved|dismissed
|
|
2130
|
+
usage discover-actions --since <ISO> --until <ISO> Event inventory from connected PostHog
|
|
2131
|
+
usage evaluate-action --since <ISO> --until <ISO> --definition <file.json>
|
|
2127
2132
|
usage [--days 7|30|90] [--site <id>] [--limit <n>] People, companies and the features they use
|
|
2128
2133
|
usage --host <app host> What to add to the app before anyone signed in
|
|
2129
2134
|
usage posthog connect --project <id> --key <phx_…> [--posthog-host <h>] [--host <app host>]
|
package/lib/client.mjs
CHANGED
|
@@ -48,6 +48,7 @@ function timeoutFor(kind, toolName) {
|
|
|
48
48
|
const env = Number(process.env.LETTERSTORY_TIMEOUT_MS);
|
|
49
49
|
if (Number.isFinite(env) && env > 0) return env;
|
|
50
50
|
if (kind !== "tool") return REQUEST_TIMEOUT_MS;
|
|
51
|
+
if (["generate_proof_actions", "refresh_proof_actions"].includes(toolName)) return 660_000; // Bounded analysis plus its final source read
|
|
51
52
|
if (WAKE_TOOLS.has(toolName)) return WAKE_TOOL_TIMEOUT_MS;
|
|
52
53
|
return LONG_TOOLS.has(toolName) ? LONG_TOOL_TIMEOUT_MS : TOOL_TIMEOUT_MS;
|
|
53
54
|
}
|
package/lib/commands/usage.mjs
CHANGED
|
@@ -33,6 +33,22 @@ const repoPart = (i) => ({
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export const ARGS = {
|
|
36
|
+
generate_proof_actions: {
|
|
37
|
+
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
38
|
+
focus: { flag: "focus" },
|
|
39
|
+
},
|
|
40
|
+
refresh_proof_actions: {},
|
|
41
|
+
get_proof_actions: { id: { flag: "id" } },
|
|
42
|
+
decide_proof_action: {
|
|
43
|
+
analysis_id: { flag: "analysis-id" },
|
|
44
|
+
card_id: { flag: "card-id" },
|
|
45
|
+
decision: { flag: "decision" },
|
|
46
|
+
},
|
|
47
|
+
discover_action_events: { window: { value: (flags) => ({ since: flags.since, until: flags.until }) } },
|
|
48
|
+
evaluate_action: {
|
|
49
|
+
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
50
|
+
definition: { value: (flags) => JSON.parse(readFileSync(String(flags.definition), "utf8")) },
|
|
51
|
+
},
|
|
36
52
|
get_usage_data: {
|
|
37
53
|
days: {
|
|
38
54
|
value: (flags) => {
|
|
@@ -209,6 +225,25 @@ const STEP = {
|
|
|
209
225
|
|
|
210
226
|
export async function cmdUsage(ctx) {
|
|
211
227
|
const { client, flags, io } = ctx;
|
|
228
|
+
if (["proofs", "find-proofs", "review-proof", "refresh-proofs"].includes(ctx.positionals[0])) {
|
|
229
|
+
const tool = {
|
|
230
|
+
proofs: "get_proof_actions",
|
|
231
|
+
"refresh-proofs": "refresh_proof_actions",
|
|
232
|
+
"find-proofs": "generate_proof_actions",
|
|
233
|
+
"review-proof": "decide_proof_action",
|
|
234
|
+
}[ctx.positionals[0]];
|
|
235
|
+
if (tool === "generate_proof_actions" && (!flags.since || !flags.until))
|
|
236
|
+
throw new CliError("Use --since and --until with ISO timestamps.");
|
|
237
|
+
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
if (["discover-actions", "evaluate-action"].includes(ctx.positionals[0])) {
|
|
241
|
+
const tool = ctx.positionals[0] === "discover-actions" ? "discover_action_events" : "evaluate_action";
|
|
242
|
+
if (!flags.since || !flags.until) throw new CliError("Use --since and --until with ISO timestamps.");
|
|
243
|
+
if (tool === "evaluate_action" && !flags.definition) throw new CliError("Use --definition with a JSON file.");
|
|
244
|
+
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
245
|
+
return 0;
|
|
246
|
+
}
|
|
212
247
|
if (ctx.positionals[0] === "case-study") return cmdCaseStudy(ctx);
|
|
213
248
|
if (ctx.positionals[0] === "posthog") return cmdPostHog(ctx);
|
|
214
249
|
if (ctx.positionals[0] === "import-posthog") {
|