@letterstory/cli 0.175.22 → 0.175.24

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
@@ -77,9 +77,10 @@ import {
77
77
  cmdVary,
78
78
  cmdBench,
79
79
  } from "./commands.mjs";
80
+ import { fetchParkedSections, withoutParked } from "./parked.mjs";
80
81
 
81
82
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
82
- export const VERSION = "0.175.22";
83
+ export const VERSION = "0.175.24";
83
84
 
84
85
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
85
86
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -282,6 +283,8 @@ export const BOOLEAN_FLAGS = new Set([
282
283
  "resume",
283
284
  // `collection add "<headline>" --collection <id> --queue`.
284
285
  "queue",
286
+ // `collection add ... --queue --own`: a draft you write yourself.
287
+ "own",
285
288
  // Bool flags from command ARGS maps that were missing here.
286
289
  "apply-rules",
287
290
  "async",
@@ -1294,6 +1297,8 @@ Seers (event-driven signals -> drafts):
1294
1297
  seers export [--file <path>] Dump the org's seers as a manifest
1295
1298
  seers apply --file <path> [--dry-run] Idempotent, name-keyed upsert from a manifest
1296
1299
  (never deletes; --dry-run prints the plan)
1300
+
1301
+ Org (the account as one file, its integrations and billing):
1297
1302
  org export [--sections <s>…] [--file <path>] The org's whole config as one JSON bundle
1298
1303
  org export --split <dir> …as one file per record (for keeping config in git)
1299
1304
  org join <dir> [--file <path>] Rebuild the bundle from a --split directory
@@ -1911,7 +1916,9 @@ export async function run(argv, io = defaultIo()) {
1911
1916
  if (!command || command === "help" || flags.help) {
1912
1917
  // `<command> … --help` shows that command's own lines, not the whole manual's first screen
1913
1918
  // (billing agent pass AGENT-5: `org billing request --help` printed Auth and Collections).
1914
- const help = buildHelp(bin);
1919
+ // Which sections are parked is the server's to say (a real run only; a test never reaches out).
1920
+ const parked = io.updateCheck ? await fetchParkedSections(resolveConfig({ url: str(flags.url) }).url) : null;
1921
+ const help = withoutParked(buildHelp(bin), parked ?? undefined);
1915
1922
  const own = command && command !== "help" ? helpFor(help, positionals) : null;
1916
1923
  io.log(own ? `${own}\n\nRun \`${bin} help\` for every command.` : help);
1917
1924
  return 0;
@@ -96,6 +96,7 @@ export const ARGS = {
96
96
  headline: { positional: 0, label: "headline", required: true },
97
97
  context: { flag: "notes" },
98
98
  queue: { flag: "queue", type: "bool" },
99
+ own: { flag: "own", type: "bool" },
99
100
  },
100
101
  update_suggestion: {
101
102
  suggestion_id: { positional: 0, label: "suggestion-id", required: true },
package/lib/parked.mjs ADDED
@@ -0,0 +1,32 @@
1
+ // The help sections of primitives the app has parked (src/config/parked.ts): the commands still run,
2
+ // but `help` doesn't list them, so neither a person nor their agent is pointed at a product we have
3
+ // parked. Which are parked is decided on the server (Super Admin → Parked), so `help` asks it
4
+ // (GET /api/parked, `cli_sections`). This list is only what it falls back to when the server can't
5
+ // be reached: the state when this version shipped.
6
+ export const PARKED_HELP_SECTIONS = ["Seers", "Shredder", "Ledes"];
7
+
8
+ /** The parked help sections the server names now, or null when it can't say in time. */
9
+ export async function fetchParkedSections(url, { fetchImpl = globalThis.fetch, timeoutMs = 1500 } = {}) {
10
+ try {
11
+ const res = await fetchImpl(`${String(url).replace(/\/$/, "")}/api/parked`, {
12
+ signal: AbortSignal.timeout(timeoutMs),
13
+ });
14
+ if (!res.ok) return null;
15
+ const body = await res.json();
16
+ return Array.isArray(body?.cli_sections) ? body.cli_sections.filter((s) => typeof s === "string") : null;
17
+ } catch {
18
+ return null;
19
+ }
20
+ }
21
+
22
+ /** The manual less every parked section: a section is a line at column 0 and the lines under it. */
23
+ export function withoutParked(help, sections = PARKED_HELP_SECTIONS) {
24
+ const out = [];
25
+ let skipping = false;
26
+ for (const line of help.split("\n")) {
27
+ const heading = line !== "" && !/^\s/.test(line);
28
+ if (heading) skipping = sections.some((s) => line === `${s}:` || line.startsWith(`${s} (`));
29
+ if (!skipping) out.push(line);
30
+ }
31
+ return out.join("\n");
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.175.22",
3
+ "version": "0.175.24",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",