Skip to content

feat: sci-illu CLI front end + cross-agent skills (v1.6.0) - #9

Open
wuxiangru915 wants to merge 4 commits into
icebird1998:mainfrom
wuxiangru915:feat/sci-illu-cli
Open

feat: sci-illu CLI front end + cross-agent skills (v1.6.0)#9
wuxiangru915 wants to merge 4 commits into
icebird1998:mainfrom
wuxiangru915:feat/sci-illu-cli

Conversation

@wuxiangru915

Copy link
Copy Markdown

概要

为 Scientific Illustrator 新增纯 CLI 前端 sci-illu,让不使用 MCP 的环境(pi、Claude Code、Cursor、Windsurf、纯命令行)也能完整使用插件能力;同时让 Linux 平台可用(draw.io 全功能 + PPT OOXML 可编辑 PPTX)。

MCP 路径完全保留,Codex 用户不受任何影响——CLI 与 MCP 通过相同的 JSON-RPC stdio 协议调用同一批服务端逻辑,行为零漂移。

变更内容

新增

  • plugins/scientific-illustrator/scripts/cli.mjssci-illu <group> <tool> --json '<args>',与 MCP 工具一一对应:
    • file → draw.io 文件工具(创建/校验/审计/导出)
    • live → draw.io 实时画布(CDP,一次性进程重连已运行的 draw.io)
    • ppt → PowerPoint/WPS(COM / Office.js / OOXML)
  • scripts/cli-smoke-test.mjs:CLI 冒烟测试(用法、退出码、工具映射、错误传播、图片落盘、守护进程生命周期;draw.io / python-pptx 缺失时优雅 skip),已接入 npm test 与 CI。
  • skill sci-illu-cli(完整命令参考)+ 根级 AGENTS.md(给不读 skills 目录的 agent)。
  • install.sh / install.ps1:安装时把 sci-illu 加入 PATH。

修改

  • powerpoint-server.mjs:新增可选 HTTP JSON-RPC 监听(SCI_ILLU_HTTP=host:port),复用 handleMessage;stdio MCP 路径零改动。Office.js 守护进程需要常驻桥,因此提供 sci-illu ppt serve / stop--backend officejs 时自动拉起)。
  • 7 个既有 skill 顶部新增 "Execution backends" 映射说明(MCP 工具名 ↔ sci-illu 命令)。
  • 输出契约:stdout 始终是 JSON(ok/tool/result/images),退出码 0/1/2;截图与幻灯片图片写入文件并报告路径。
  • 稳定状态目录(默认 ~/.local/state/sci-illu)让一次性进程间的 OOXML 工作副本与守护进程状态可跨调用持久化。
  • 版本统一升至 1.6.0(plugin.json、package.json、四个 server、Office.js manifest、validate-repo、bridge smoke 断言)。

安全

  • 守护进程 HTTP 端点要求 Authorization: Bearer <token>(与 Office.js 桥同等的本地安全姿态),token 由 CLI 生成并存入状态文件;/health 保持无鉴权仅作存活探测。

测试

npm test 全绿(MCP 回归 + officejs 桥 + 焦点策略 + 平台兼容 + WPS 可靠性 + CLI 冒烟)。CI 三平台(ubuntu/macos/windows)已接线。

平台说明

  • Linux:draw.io file/live 全功能;PPT OOXML 需 python-pptx(install.sh 会处理),可生成可编辑 PPTX;COM/Office.js 明确报错不可用。
  • Windows:draw.io + PowerPoint COM(推荐)+ WPS OOXML。
  • macOS:draw.io + PowerPoint Office.js 实时绘制(守护进程)+ OOXML 回退。

- sci-illu <group> <tool> --json '<args>' maps 1:1 to the existing MCP
  tools (file -> server.mjs, live -> live-server.mjs, ppt ->
  powerpoint-server.mjs) over the same JSON-RPC stdio protocol, so CLI
  behavior is identical to the MCP path with no server refactoring.
- Output contract: JSON to stdout (ok/tool/result/images), exit codes
  0/1/2; screenshots and slide images are written to files (--output or
  a temp dir) and reported by path.
- ppt group adds an Office.js HTTP daemon (serve/stop) because the Mac
  live backend needs a persistent bridge the PowerPoint task pane
  long-polls; the daemon is auto-started for --backend officejs calls.
- powerpoint-server.mjs gains an optional HTTP JSON-RPC listener
  (SCI_ILLU_HTTP=host:port) reusing handleMessage; the stdio MCP path is
  unchanged.
- Stable state dir (--state-dir, default ~/.local/state/sci-illu) keeps
  OOXML working copies and daemon state across one-shot CLI invocations.
…nd agent docs

- New sci-illu-cli skill: full command reference (groups, tool mapping,
  flags, output contract, Office.js daemon lifecycle, platform notes).
- All seven orchestration skills carry an Execution backends note mapping
  MCP tool names to sci-illu CLI commands with the same --json arguments.
- Root AGENTS.md documents the two execution backends for agents that do
  not read skills directories (Cursor, Windsurf, pi).
- scripts/cli-smoke-test.mjs: spawns the real CLI and asserts usage,
  exit codes, tool mapping, error propagation, image-to-file saving
  (stub server via the SCI_ILLU_SERVER_* testing seam), and the ppt
  daemon lifecycle; draw.io/python-pptx-gated sections skip gracefully.
- package.json: cli.mjs and cli-smoke-test.mjs join the check script,
  cli:test script added, and npm test now runs the CLI smoke tests.
- CLI output contract: tool-level failures now expose a flattened
  top-level error string in addition to the full tool result.
- install.sh and install.ps1 now also place the sci-illu CLI on PATH
  (symlink on POSIX, sci-illu.cmd shim on Windows).
- README gains a '纯 CLI 使用(sci-illu)' section with install,
  usage examples for draw.io live/file and PowerPoint OOXML, the output
  contract, and the Office.js daemon note; version table updated.
- CHANGELOG adds the 1.6.0 entry summarizing the CLI front end,
  HTTP JSON-RPC mode, daemon lifecycle, skill mapping notes, and tests.
- Release version synced to 1.6.0 across plugin.json, package.json,
  the four servers, the Office.js manifest, validate-repo, and the
  officejs-bridge smoke assertion.
The Office.js daemon's HTTP JSON-RPC endpoint was loopback-only but
unauthenticated, so any local web page could POST tools/call to it and
drive the presentation session (the Office.js bridge already guards its
own endpoints with a session token for the same reason). The daemon now
requires Authorization: Bearer <SCI_ILLU_HTTP_TOKEN> for POST /; the
health endpoint stays open for liveness probes. sci-illu generates a
random token when starting the daemon, stores it in the daemon state
file, and attaches it to every routed call. The CLI also honors
SCIENTIFIC_ILLUSTRATOR_STATE_DIR for its own daemon state so one state
directory covers daemon state and OOXML working copies. cli-smoke-test
adds a negative case asserting unauthenticated calls return 401.
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