Skip to content

feat: hidden positronick post admin commands (create/update/list) - #28

Merged
nsollazzo merged 1 commit into
mainfrom
feat/post-admin-commands
Jul 8, 2026
Merged

feat: hidden positronick post admin commands (create/update/list)#28
nsollazzo merged 1 commit into
mainfrom
feat/post-admin-commands

Conversation

@nsollazzo

Copy link
Copy Markdown
Contributor

Hidden, server-enforced admin write commands for the blog — the agent write API — over /api/admin/posts, mirroring the existing hidden soul/listing/profile admin commands.

Stacked on feat/blog-read-commands (needs its Post types).

What's here

  • internal/api/admin.go: AdminPost{Post; Source} + client methods CreatePost / AdminPost(id) / AdminPosts (list) / UpdatePost. AdminPosts is named to avoid colliding with the public published-only Posts(ctx, kind) reader.
  • internal/cli/post.go: hidden post create/update/list via markAdmin.
    • create --file <md> — YAML frontmatter + markdown body (like soul create); field flags override frontmatter.
    • update <id-or-slug>--file / field flags / --status / --source; resolves a published slug to its id via the public blog detail endpoint; surfaces the feed→api ownership flip (tookOwnership, plus a stderr warning with the --source feed hand-back hint).
    • list — every post, any status, with its source.
    • Registered in registerAdminCommands.
  • mockapi: admin posts endpoints + fixtures (mirrored posts seeded feed-owned, native posts api-owned), goldens, agent-docs regen.

Safety / contract

  • Hidden + annotated; revealed only for a cached admin. The CLI enforces nothing — the server's isAdmin guard is the authority; 401/403 → exit 4 with the admin-login hint.
  • Create defaults status to draft — an agent post never self-publishes.
  • No DELETE verb: unpublish is --status draft.
  • --json contract pinned by goldens (golden diffs are contract changes — note the agent-docs intro line and the new post-* goldens).

Verification

go test -race ./..., go vet ./..., make fmt-check, make lint — all green. Binary smoke-tested: post reveals for a cached admin and is hidden when logged out, exactly like its siblings.

🤖 Generated with Claude Code

@nsollazzo
nsollazzo changed the base branch from feat/blog-read-commands to main July 8, 2026 13:44
Server-enforced admin write commands for the blog over /api/admin/posts,
mirroring the soul/listing/profile admin pattern: markAdmin + adminAPIError,
no delete verb, revealed only for cached admins — the server is always the
authority.

- AdminPost{Post; Source} + CreatePost / AdminPost(id) / AdminPosts(list) /
  UpdatePost in internal/api/admin.go.
- internal/cli/post.go: post create (--file markdown + frontmatter, field
  flags), update (--status/--source, slug->id resolution, feed->api ownership
  flip with a tookOwnership warning) and list (any status, source shown).
  Registered in registerAdminCommands.
- Create defaults status to draft so an agent post never self-publishes;
  unpublish is --status draft (no DELETE).
- mockapi admin posts endpoints + fixtures, goldens, agent-docs regen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nsollazzo
nsollazzo marked this pull request as ready for review July 8, 2026 13:55
@nsollazzo
nsollazzo force-pushed the feat/post-admin-commands branch from 35c8266 to 2de102b Compare July 8, 2026 13:55
@nsollazzo
nsollazzo merged commit 9eaafc4 into main Jul 8, 2026
9 checks passed
@nsollazzo
nsollazzo deleted the feat/post-admin-commands branch July 8, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant