@letterstory/cli 0.85.0 → 0.86.1

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
@@ -57,7 +57,7 @@ import {
57
57
  } from "./commands.mjs";
58
58
 
59
59
  // Keep in sync with cli/package.json.
60
- export const VERSION = "0.85.0";
60
+ export const VERSION = "0.86.1";
61
61
 
62
62
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
63
63
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -818,6 +818,7 @@ Seers (event-driven signals -> drafts):
818
818
  org join <dir> [--file <path>] Rebuild the bundle from a --split directory
819
819
  org diff <file|dir> What applying a bundle would change (reads only)
820
820
  org apply <file|dir> [--dry-run] [--prune --yes] Make the org match a bundle (adds/updates; --prune deletes)
821
+ [--allow spends,sends,destroys,access --yes] Also apply gated changes (admins; without --yes it only previews)
821
822
 
822
823
  Content templates (compose structures seers bind via config.template_key):
823
824
  templates list Custom + built-in catalog
@@ -22,6 +22,8 @@ export const ARGS = {
22
22
  config: { value: (_flags, positionals) => readBundle(requirePositional(positionals, 0, "file|dir")) },
23
23
  dry_run: { flag: "dry-run", type: "bool" },
24
24
  prune: { flag: "prune", type: "bool" },
25
+ allow: { flag: "allow", type: "list" },
26
+ confirm: { flag: "confirm" },
25
27
  },
26
28
  get_org_config_source: {},
27
29
  connect_org_config_source: {
@@ -218,6 +220,10 @@ export function formatApply(result) {
218
220
  for (const a of result.skipped) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.reason}`);
219
221
  if (result.failed.length) lines.push("Failed:");
220
222
  for (const a of result.failed) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.error}`);
223
+ if (result.gated?.length) {
224
+ lines.push(`Gated (allow with --allow; confirm ${result.confirm}):`);
225
+ for (const a of result.gated) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.gate}`);
226
+ }
221
227
  for (const w of result.plan.warnings) lines.push(`warning: ${w}`);
222
228
  return lines.join("\n");
223
229
  }
@@ -227,10 +233,25 @@ async function orgApply(ctx) {
227
233
  refuseUnknownFlags(ctx, ARGS.apply_org_config, ["yes"]);
228
234
  if (flagBool(flags.prune) && !flagBool(flags["dry-run"]) && !flagBool(flags.yes))
229
235
  throw new CliError("--prune deletes records missing from the bundle. Review with --dry-run, then add --yes.");
230
- const { result } = await client.callTool(
231
- "apply_org_config",
232
- argsFromFlags(ARGS.apply_org_config, flags, ctx.positionals)
233
- );
236
+ const args = argsFromFlags(ARGS.apply_org_config, flags, ctx.positionals);
237
+ if (args.allow)
238
+ args.allow = args.allow
239
+ .flatMap((g) => g.split(","))
240
+ .map((g) => g.trim())
241
+ .filter(Boolean);
242
+ if (args.allow?.length && !args.dry_run && !args.confirm) {
243
+ // Gated changes need the plan's hash: dry-run to get it, show what it unlocks, then apply with it.
244
+ const { result: plan } = await client.callTool("apply_org_config", { ...args, dry_run: true });
245
+ const unlocked = (plan.gated ?? []).filter((g) => args.allow.includes(g.gate));
246
+ if (unlocked.length && !flagBool(flags.yes)) {
247
+ printResult(io, flags, plan, formatApply);
248
+ throw new CliError(
249
+ `--allow ${args.allow.join(",")} unlocks ${unlocked.length} gated change(s) above. Re-run with --yes to apply them.`
250
+ );
251
+ }
252
+ args.confirm = plan.confirm ?? undefined;
253
+ }
254
+ const { result } = await client.callTool("apply_org_config", args);
234
255
  printResult(io, flags, result, formatApply);
235
256
  return result.failed.length ? 1 : 0;
236
257
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.85.0",
3
+ "version": "0.86.1",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",