@letterstory/cli 0.29.0 → 0.29.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/README.md CHANGED
@@ -142,9 +142,10 @@ letterstory phantom domain connect <phantom-id> myblog.com # attach one you
142
142
  ```bash
143
143
  letterstory posts list [--limit <n>] [--collection <uuid>]
144
144
  letterstory posts show <article-id>
145
- letterstory posts new --title "…" --collection <uuid> --body "…" # or --file <path|->
145
+ letterstory posts new --title "…" --collection <uuid> --body "…" [--article-id <uuid>] # or --file <path|->; --article-id updates that article instead of creating one
146
146
  letterstory posts publish <article-id>
147
147
  letterstory posts unpublish <article-id>
148
+ letterstory posts delete --id <uuid> [--id <uuid> ...] # permanent; content, history, and any published copy are all removed
148
149
 
149
150
  letterstory published list [--limit <n>] [--collection <uuid>] [--format html|md]
150
151
  letterstory published show --slug my-post-slug [--format html|md] # or --id <uuid>
package/lib/cli.mjs CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  } from "./commands.mjs";
44
44
 
45
45
  // Keep in sync with cli/package.json.
46
- export const VERSION = "0.29.0";
46
+ export const VERSION = "0.29.1";
47
47
 
48
48
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
49
49
  // can't accidentally swallow the id as --json's value.
@@ -205,9 +205,10 @@ Phantomstory (a collection Letterstory hosts as an independent publication):
205
205
  Content:
206
206
  posts list [--limit <n>] [--collection <uuid>] List your articles
207
207
  posts show <article-id> Show one article
208
- posts new --title <t> --collection <uuid> (--body <text> | --file <path|->)
208
+ posts new --title <t> --collection <uuid> (--body <text> | --file <path|->) [--article-id <uuid>]
209
209
  posts publish <article-id> Publish an article
210
210
  posts unpublish <article-id> Unpublish an article
211
+ posts delete --id <uuid> [--id <uuid> ...] Permanently delete article(s)
211
212
  published list [--limit <n>] [--collection <uuid>] [--format html|md]
212
213
  published show (--id <uuid> | --slug <slug>) [--format html|md]
213
214
 
@@ -20,6 +20,9 @@ export const ARGS = {
20
20
  publish_article: {
21
21
  article_id: { positional: 0, label: "article-id", required: true },
22
22
  },
23
+ delete_article: {
24
+ article_ids: { flag: "id", type: "list", required: true, label: "id" },
25
+ },
23
26
  };
24
27
 
25
28
  export async function cmdPosts(ctx) {
@@ -37,9 +40,12 @@ export async function cmdPosts(ctx) {
37
40
  return postsPublish(rest);
38
41
  case "unpublish":
39
42
  return postsUnpublish(rest);
43
+ case "delete":
44
+ case "rm":
45
+ return postsDelete(rest);
40
46
  default:
41
47
  throw new CliError(
42
- `Unknown posts subcommand: ${sub ?? "(none)"}. Try: list, show, new, publish, unpublish`
48
+ `Unknown posts subcommand: ${sub ?? "(none)"}. Try: list, show, new, publish, unpublish, delete`
43
49
  );
44
50
  }
45
51
  }
@@ -66,8 +72,10 @@ async function postsNew(ctx) {
66
72
  const collection = requireFlag(flags, "collection");
67
73
  const body = readBodyInput(flags);
68
74
  if (!body) throw new CliError("Provide --body or --file <path>.");
69
- const result = await client.callTool("ingest_article", { title, body, collection_id: collection });
70
- ok(ctx, `Created draft "${title}".`);
75
+ const articleId = flagStr(flags["article-id"]);
76
+ const args = compact({ title, body, collection_id: collection, article_id: articleId });
77
+ const result = await client.callTool("ingest_article", args);
78
+ ok(ctx, articleId ? `Updated "${title}".` : `Created draft "${title}".`);
71
79
  printResult(io, flags, result);
72
80
  return 0;
73
81
  }
@@ -89,6 +97,17 @@ async function postsUnpublish(ctx) {
89
97
  return 0;
90
98
  }
91
99
 
100
+ // Permanent: no confirmation prompt here — the CLI is a scripting surface, and the
101
+ // tool result reports exactly which ids were deleted vs not found.
102
+ async function postsDelete(ctx) {
103
+ const { client, flags, io, positionals } = ctx;
104
+ const args = argsFromFlags(ARGS.delete_article, flags, positionals);
105
+ const result = await client.callTool("delete_article", args);
106
+ ok(ctx, `Deleted ${result?.deleted_ids?.length ?? 0} article(s).`);
107
+ printResult(io, flags, result);
108
+ return 0;
109
+ }
110
+
92
111
  // --- published (frozen public view) -----------------------------------------
93
112
 
94
113
  export async function cmdPublished(ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",