@letterstory/cli 0.177.144 → 0.177.146

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 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.144";
96
+ export const VERSION = "0.177.146";
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;
@@ -705,7 +705,7 @@ Content:
705
705
  [--paper-trail '<json>'] [--metadata-json '<json>']
706
706
  Edit a post; only what you pass changes
707
707
  posts edit <article-id> --instruction "<what to change>"
708
- posts remediate <article-id> [--instruction "<what to change>"] [--line "<sentence>" ...] [--apply] [--allow-edited]
708
+ posts remediate <article-id> [--instruction "<what to change>"] [--line "<sentence>" ...] [--edits-json '[{"before":"...","after":"..."}]'] [--apply] [--allow-edited]
709
709
  change only the named sentences, never the rest; a dry run unless --apply
710
710
  Rewrite the post with AI from an instruction
711
711
  posts mentions <article-id> Re-apply the brand-mention & competitor policy
@@ -20,6 +20,20 @@ import {
20
20
  const ARTICLE = { positional: 0, label: "article-id", required: true };
21
21
  const COMMENT = { positional: 1, label: "comment-id", required: true };
22
22
 
23
+ /** `--<name> '<json>'` → a JSON list, or undefined when the flag is not set. */
24
+ function jsonListFlag(flags, name) {
25
+ const raw = flagStr(flags[name]);
26
+ if (raw === undefined) return undefined;
27
+ let parsed;
28
+ try {
29
+ parsed = JSON.parse(raw);
30
+ } catch (err) {
31
+ throw new CliError(`--${name} is not valid JSON: ${err.message}`);
32
+ }
33
+ if (!Array.isArray(parsed)) throw new CliError(`--${name} must be a JSON list`);
34
+ return parsed;
35
+ }
36
+
23
37
  /** `--<name> '<json>'` → a JSON object, or undefined when the flag is not set. */
24
38
  function jsonObjectFlag(flags, name) {
25
39
  const raw = flagStr(flags[name]);
@@ -92,6 +106,8 @@ export const ARGS = {
92
106
  article_id: ARTICLE,
93
107
  instruction: "instruction",
94
108
  lines: { flag: "line", type: "list", label: "line" },
109
+ // A JSON list of {before, after} from an earlier dry run: applied as reviewed, no model call.
110
+ edits: { value: (flags) => jsonListFlag(flags, "edits-json") },
95
111
  apply: { flag: "apply", type: "bool" },
96
112
  allow_edited: { flag: "allow-edited", type: "bool" },
97
113
  },
@@ -11,7 +11,7 @@
11
11
  // letterstory usage posthog [status]|sync [--days 7]|disconnect the connection (never its key), sync now, remove it
12
12
  // letterstory usage database connect (--project <ref> --key <sbp_…> | --url postgres://… | --existing)
13
13
  // --host app.acme.com --schemas public --since … --until … Supabase or any Postgres
14
- // letterstory usage shown statistics shown to agents, and what agents get
14
+ // letterstory usage shown [--days 1-90] statistics shown to agents, what agents get, who read them
15
15
  // letterstory usage shown show|hide <choice_id> show a tracked action to agents, or take it off
16
16
  // letterstory usage shown pr [--repo <owner/name>] [--base <branch>] put them on the website: one build, one pull request
17
17
  // letterstory usage shown check [--url <page>] check a page serves them as the data says
@@ -86,7 +86,7 @@ export const ARGS = {
86
86
  engines: { value: (flags) => (flags.engines ? flagCsv(flags.engines) : undefined) },
87
87
  },
88
88
  stop_agent_test: { test_id: { positional: 0, required: true, label: "test_id" } },
89
- get_shown_statistics: {},
89
+ get_shown_statistics: { days: { flag: "days", type: "num" } },
90
90
  set_shown_statistic: {
91
91
  choice_id: { positional: 0, required: true, label: "choice_id" },
92
92
  shown: { value: (_flags, _positionals, extra) => extra.shown === true },
@@ -368,7 +368,11 @@ export async function cmdUsage(ctx) {
368
368
  const sub = ctx.positionals[1] ?? "status";
369
369
  const rest = ctx.positionals.slice(2);
370
370
  if (sub === "status") {
371
- printResult(io, flags, await client.callTool("get_shown_statistics", {}));
371
+ printResult(
372
+ io,
373
+ flags,
374
+ await client.callTool("get_shown_statistics", argsFromFlags(ARGS.get_shown_statistics, flags, rest))
375
+ );
372
376
  return 0;
373
377
  }
374
378
  if (sub === "show" || sub === "hide") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.144",
3
+ "version": "0.177.146",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",