feat: per-surface operations across CLI, HTTP API, and MCP#165
Closed
benvinegar wants to merge 2 commits into
Closed
feat: per-surface operations across CLI, HTTP API, and MCP#165benvinegar wants to merge 2 commits into
benvinegar wants to merge 2 commits into
Conversation
Surfaces now carry stable server-assigned ids, enabling targeted operations (append, edit, remove, reorder) on individual surfaces within a post — across all three integration tiers. CLI: - publish honors flag order instead of a fixed if-ladder (#158) - update --surface N targets a surface in multi-surface posts - new surface subcommand: add, remove, edit, move HTTP API: - POST /api/posts/:id/surfaces (append) - PATCH /api/posts/:id/surfaces/:target (replace/content-only) - DELETE /api/posts/:id/surfaces/:target (remove) - PATCH /api/posts/:id/surfaces (reorder) - PATCH /api/posts/:id extended with surface param MCP: - new tools: add_surface, edit_surface, remove_surface, reorder_surfaces Viewer: - surfaces keyed by stable id (For + reconcile key=id) Data model: - Surface.id assigned server-side via normalizeSurfaceIds - one-time migration for existing data in both stores
…tml replacement - surface add: add --layout flag and propagate layout:'split' to diff surfaces (matches publish behavior) - replaceSurface: merge kits into a full html surface replacement so edit_surface no longer silently drops kits
Member
Author
|
Closing — these changes landed on main via #166 (which was branched from this PR and merged first). Nothing lost; main has all of this PR's commits plus the get_post/show additions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Surfaces now carry stable server-assigned ids, enabling targeted operations (append, edit, remove, reorder) on individual surfaces within a post — across all three integration tiers (CLI, HTTP, MCP). Also fixes #158 (CLI publish flag order).
Why
Issue #158 flagged that
sideshow publishignored flag order, but the investigation revealed a broader gap: every tier treated a post'ssurfacesas an opaque whole-array blob. There was no surface identity, no index targeting, and no per-surface operation primitive anywhere — CLI, HTTP, or MCP. Any per-surface operation required a client-side read-modify-write (GETthe post, mutate locally,PUTthe whole thing back). The server's own comment atapp.ts:924flagged"multi-surface needs --surface N"as never-built future work.Changes
Phase 1 — Fix #158: CLI flag order
publishwalksparseArgstokens to honor flag appearance order instead of a hardcoded if-ladderPhase 2a — Surface identity
Surfacetype includesid?: string, assigned server-side vianormalizeSurfaceIds()Phase 2b — HTTP API per-surface endpoints
POST /api/posts/:id/surfaces— append (optional before/after for position)PATCH /api/posts/:id/surfaces/:target— replace (full or content-only)DELETE /api/posts/:id/surfaces/:target— remove (400 if last)PATCH /api/posts/:id/surfaces— reorderPATCH /api/posts/:idextended withsurfaceparam for multi-surface targetingPhase 2c — MCP per-surface tools
add_surface,edit_surface,remove_surface,reorder_surfaces(both stdio and HTTP transports)Phase 3a — CLI surface subcommand
sideshow surface add|remove|edit|movesideshow update --surface NPhase 3b — Viewer key-by-id
<Index>→<For>keyed by surface identity;reconcile({ key: "id" })Validation
Back-compat
/api/surfaces,/api/snippets) and keys (parts) unchangedupdate_postfull-replace stays; new MCP tools are additivesideshow updatewithout--surfacekeeps single-surface behaviorJsonFileStoreandSqlStorePlan
Full design plan in
docs/plans/per-surface-operations.md.