@letterstory/cli 0.175.22 → 0.175.23
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 -2
- package/lib/parked.mjs +32 -0
- package/package.json +1 -1
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.
|
|
83
|
+
export const VERSION = "0.175.23";
|
|
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;
|
|
@@ -1294,6 +1295,8 @@ Seers (event-driven signals -> drafts):
|
|
|
1294
1295
|
seers export [--file <path>] Dump the org's seers as a manifest
|
|
1295
1296
|
seers apply --file <path> [--dry-run] Idempotent, name-keyed upsert from a manifest
|
|
1296
1297
|
(never deletes; --dry-run prints the plan)
|
|
1298
|
+
|
|
1299
|
+
Org (the account as one file, its integrations and billing):
|
|
1297
1300
|
org export [--sections <s>…] [--file <path>] The org's whole config as one JSON bundle
|
|
1298
1301
|
org export --split <dir> …as one file per record (for keeping config in git)
|
|
1299
1302
|
org join <dir> [--file <path>] Rebuild the bundle from a --split directory
|
|
@@ -1911,7 +1914,9 @@ export async function run(argv, io = defaultIo()) {
|
|
|
1911
1914
|
if (!command || command === "help" || flags.help) {
|
|
1912
1915
|
// `<command> … --help` shows that command's own lines, not the whole manual's first screen
|
|
1913
1916
|
// (billing agent pass AGENT-5: `org billing request --help` printed Auth and Collections).
|
|
1914
|
-
|
|
1917
|
+
// Which sections are parked is the server's to say (a real run only; a test never reaches out).
|
|
1918
|
+
const parked = io.updateCheck ? await fetchParkedSections(resolveConfig({ url: str(flags.url) }).url) : null;
|
|
1919
|
+
const help = withoutParked(buildHelp(bin), parked ?? undefined);
|
|
1915
1920
|
const own = command && command !== "help" ? helpFor(help, positionals) : null;
|
|
1916
1921
|
io.log(own ? `${own}\n\nRun \`${bin} help\` for every command.` : help);
|
|
1917
1922
|
return 0;
|
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
|
+
}
|