@letterstory/cli 0.177.144 → 0.177.145

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.145";
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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.144",
3
+ "version": "0.177.145",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",