← Commit history

Publish 0.1.6

Kyle Bergstedt ·074a6ceabe · ·parent 3f41f5f
4 files changed +42−7
VERSION+1−1
@@ -1 +1 @@-0.1.5+0.1.6
bin/adom-forum.cjs+35−3
@@ -9,7 +9,7 @@ // through an agent and shows a "via <agent>" badge next to the author. Pass // --agent "Codex Astra" (or set ADOM_AGENT_NAME) so the badge names the tool. //-// Consent: `thread create` and `reply` print a preview and exit 2 unless+// Consent: `thread create`, `reply`, and `edit` print a preview and exit 2 unless // --permission-to-post-given is passed. Show the user the preview first.  // CommonJS on purpose: this file has no extension, and Node 18 (the version@@ -20,7 +20,7 @@ const { basename, dirname, resolve: resolvePath, extname } = require('node:path' const { homedir } = require('node:os') const { createHash } = require('node:crypto') -const VERSION = '0.1.5'+const VERSION = '0.1.6'  // The CLI runs in the shared Linux runtime behind Hydrogen web, macOS, and // Windows alike. It depends only on Node 18+ (global fetch, FormData, Blob)@@ -41,6 +41,8 @@ USAGE                            [--idempotency-key <key>] [--permission-to-post-given] [--json]   adom-forum reply <thread-id> --body <text|@file|-> [--agent "<name>"] [--idempotency-key <key>]                            [--permission-to-post-given] [--json]+  adom-forum edit <post-id> --body <text|@file|-> [--title "<title>"] [--permission-to-post-given] [--json]+  adom-forum history <post-id> [--json]   adom-forum media upload <file> [--json]   adom-forum widgets [--json]   adom-forum whoami [--json]@@ -54,6 +56,10 @@ WIDGETS   A line holding only ::name{key="value"} embeds a wiki widget (3D viewer, video player, …).   \`adom-forum widgets\` lists the ones the forum can render and their attributes. +EDITING+  Only your own posts. --title applies to a thread's opening post. The post is marked edited and+  every earlier version is kept; \`history\` prints them. Post ids are shown by \`thread get\`.+ CONSENT   Writes preview first and exit 2. Re-run with --permission-to-post-given after the user says yes. @@ -254,7 +260,7 @@ async function main() {     if (!id) fail('thread id required')     const { data } = await api('GET', `/api/threads/${encodeURIComponent(id)}`)     const lines = [`# ${data.thread.title}`, `${data.thread.url} · ${data.thread.space} · by ${data.thread.author.display_name}${data.thread.agent ? ` via ${data.thread.agent}` : ''}`, '']-    for (const post of data.posts) lines.push(`--- ${post.opener ? 'opener' : 'reply'} · ${post.author.display_name}${post.agent ? ` via ${post.agent}` : ''} · ${post.created_at}`, post.body ?? '(hidden)', '')+    for (const post of data.posts) lines.push(`--- ${post.opener ? 'opener' : 'reply'} ${post.id} · ${post.author.display_name}${post.agent ? ` via ${post.agent}` : ''} · ${post.created_at}${post.edited_at ? ` · edited ${post.edited_at}` : ''}`, post.body ?? '(hidden)', '')     out(data, lines.join('\n'))     return   }@@ -292,6 +298,32 @@ async function main() {     return   } +  if (command === 'edit') {+    const id = sub+    if (!id) fail('post id required (see `adom-forum thread get <id>`)')+    const { text, dir } = readBody(flags.body)+    const title = flags.title === undefined ? undefined : String(flags.title)+    if (flags.title === true) fail('--title needs a value')+    if (!flags['permission-to-post-given']) {+      preview('edit', { post: id, ...(title !== undefined ? { title } : {}), images_to_upload: localImagePaths(text, dir).map((path) => basename(path)).join(', ') || 'none' }, text)+      process.exit(2)+    }+    const { markdown } = await localizeImages(text, dir)+    const { data } = await api('PATCH', `/api/posts/${encodeURIComponent(id)}`, { body: { body: markdown, ...(title !== undefined ? { title } : {}) } })+    out(data, `${data.changed ? 'edited' : 'unchanged'}: ${data.url}\n`)+    return+  }++  if (command === 'history') {+    const id = sub+    if (!id) fail('post id required')+    const { data } = await api('GET', `/api/posts/${encodeURIComponent(id)}/revisions`)+    const lines = []+    data.versions.forEach((version, index) => lines.push(`--- ${version.current ? 'current' : `version ${data.versions.length - index}`} · ${version.written_at}`, ...(version.title ? [`# ${version.title}`] : []), version.body, ''))+    out(data, lines.join('\n'))+    return+  }+   if (command === 'media' && sub === 'upload') {     const path = rest[0]     if (!path) fail('file path required')
page.json+2−2
@@ -4,7 +4,7 @@   "slug": "adom-forum",   "title": "Adom Forum",   "brief": "Post to and read the Adom Forum from the terminal, run by your AI. Start threads with Markdown and inline images, reply, and browse spaces. Posts made this way carry a 'via <agent>' badge so people can see an AI posted on your behalf.",-  "version": "0.1.5",+  "version": "0.1.6",   "visibility": "public",   "license": "MIT",   "install": {@@ -71,6 +71,6 @@   "engines": {     "node": ">=18"   },-  "changelog": "0.1.5: `adom-forum widgets` lists the wiki widgets a post can embed; the forum composer now offers them when a line starts with ::. --version reports the real version.",+  "changelog": "0.1.6: `adom-forum edit <post-id>` edits your own post (title too, for an opener) and `adom-forum history <post-id>` prints every earlier version; `thread get` shows post ids and edit times. 0.1.5: `adom-forum widgets` lists the wiki widgets a post can embed; the forum composer now offers them when a line starts with ::. --version reports the real version.",   "org": "adom" }\ No newline at end of file
skills/adom-forum/SKILL.md+4−1
@@ -16,7 +16,7 @@ export ADOM_AGENT_NAME="Claude Code"     # or "Codex Astra", "Kimi", …  — sh  ## The one rule: preview, then permission -`thread create` and `reply` print a preview and **exit 2 without posting** unless `--permission-to-post-given` is passed. Show the user the preview (title, space, body, which images will be uploaded), get an explicit yes, then re-run with the flag. Never post silently. Never add the flag on the first attempt.+`thread create`, `reply`, and `edit` print a preview and **exit 2 without posting** unless `--permission-to-post-given` is passed. Show the user the preview (title, space, body, which images will be uploaded), get an explicit yes, then re-run with the flag. Never post silently. Never add the flag on the first attempt.  ## Commands @@ -27,6 +27,8 @@ adom-forum thread get <id>                          # opener + replies as Markdo adom-forum thread create --space show-and-tell --title "TMF8829 depth lab build" --body @post.md adom-forum thread create ... --body @post.md --permission-to-post-given     # after the user approves adom-forum reply <thread-id> --body "Tested at 5 m, works." --permission-to-post-given+adom-forum edit <post-id> --body @post.md           # your own post only; same preview-then-permission rule+adom-forum history <post-id>                        # every earlier version of a post adom-forum media upload ./board-top.png             # prints a /media/... URL adom-forum widgets                                  # wiki widgets a post can embed, with their attributes adom-forum whoami@@ -41,6 +43,7 @@ Add `--json` to any command for a `{ status, data }` envelope. - Reference people and wiki pages with `@username` and `@owner/slug`; they render as link chips. A `@owner/slug` alone on its own line renders as a page card. - Embed wiki widgets (3D viewer, video player, pinout, tables, and the rest) with the same line a wiki README uses, alone on its own line: `::adom-3d{src="/owner/slug/render/board.glb"}`, `::adom-video{video="/owner/slug/render/demo.mp4" title="Demo"}`, `::youtube{id="VIDEO_ID"}`. Paths are absolute wiki paths on a public page. `adom-forum widgets` lists the ones the forum renders and their attributes; an unknown tag shows as plain text. - A thread needs a title of 4 to 160 characters and a body of at least 2 characters.+- To fix a typo or update a post, edit it rather than replying with a correction. `thread get` prints each post's id. Pass `--title` to retitle a thread when editing its opening post. The forum marks the post edited and keeps every earlier version, so edits are visible, not silent. - Draft long posts to a file and use `--body @file.md` so the preview is readable and the user can edit it.  ## Retries and limits