Skip to content

feat(docx-mcp): CLI subcommands with full MCP tool parity#28

Open
stevenobiajulu wants to merge 1 commit intomainfrom
worktree-cli-syntax-proposal
Open

feat(docx-mcp): CLI subcommands with full MCP tool parity#28
stevenobiajulu wants to merge 1 commit intomainfrom
worktree-cli-syntax-proposal

Conversation

@stevenobiajulu
Copy link
Copy Markdown
Member

Summary

  • Adds an OpenSpec proposal (add-cli-tool-subcommands) for full CLI parity with MCP tools
  • Every MCP tool becomes a safe-docx <tool-name> CLI subcommand with --flag value syntax
  • Batched edit command as the primary editing interface: safe-docx edit file.docx --replace _bk_a "old" "new" --replace _bk_b "old2" "new2" -o out.docx
  • Session persistence across CLI invocations via filesystem session store
  • Schema-driven flag generation from existing Zod tool catalog (single source of truth)

Context

Inspired by the ergonomic --set key=value CLI syntax in open-agreements. Safe-docx currently requires raw JSON-RPC over MCP stdio for all operations beyond serve and compare, which is impractical for terminal usage, scripting, and debugging.

Files

File Purpose
openspec/changes/add-cli-tool-subcommands/proposal.md Why, what, impact
openspec/changes/add-cli-tool-subcommands/design.md Technical decisions, alternatives, risks
openspec/changes/add-cli-tool-subcommands/tasks.md Implementation checklist (6 phases, 28 tasks)
openspec/changes/add-cli-tool-subcommands/specs/mcp-server/spec.md Spec delta: 5 new requirements, 16 scenarios

Test plan

  • openspec validate add-cli-tool-subcommands --strict passes
  • Review proposal for completeness and feasibility
  • Approve before implementation begins

Safe-docx is advertised as both an MCP server and a CLI tool, but
currently only exposes `serve` and `compare` as CLI commands. This
proposal adds CLI subcommands for all 20+ MCP tools with ergonomic
`--flag value` syntax, a batched `edit` command for multi-operation
workflows, and session persistence across sequential CLI invocations.

Key design decisions (informed by user preferences):
- Full CLI parity: every MCP tool maps to a kebab-case subcommand
- Session-aware: filesystem-based session store persists across commands
- Batched `edit` as primary interface (avoids concurrent race issues)
- Schema-driven flag generation from existing Zod tool catalog
- Bookmark IDs only for paragraph targeting (consistent with MCP)
- JSON output to stdout (consistent with existing `compare` command)

Includes proposal.md, design.md, tasks.md, and spec delta for mcp-server.
Validated with `openspec validate add-cli-tool-subcommands --strict`.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
site Ready Ready Preview, Comment Mar 4, 2026 4:06am

Request Review

@github-actions github-actions bot added the feat label Mar 4, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant