Back to home

GongYuanCaiJi

dsh-extension-workbook

Excel / 工作簿读写 - @firstpick/pi-extension-workbook 的 dsh 移植

Stars
0
Language
TypeScript
Created
Aug 14, 2026
Updated
Aug 15, 2026

Introduction

📗 dsh-extension-workbook

高保真、fail-closed 的 Excel XLSX/XLSM 工作簿检视、读取、渲染、编辑、比对与验证工具 —— 移植自 @firstpick/pi-extension-workbook

中文 · English

license node dsh format


中文

在 DeepSeek Harness 里安全地检视、渲染、编辑与验证 Excel 工作簿:不执行宏、不刷新外部链接、所有写入都有 SHA-256 冲突保护与 dry-run 先行,任何不支持或可能有损的操作一律 fail-closed。

功能

  • 检视 .xlsx.xlsm 工作簿而不改动它(工作表、区域、OOXML 部件、链接、受保护的宏内容、哈希、校验状态)。
  • 渲染工作表与指定区域为确定性 PNG,便于视觉检查格式与布局。
  • 通过受保护的提交流程(dry-run 规划 → expectedSha256 冲突检查 → 原子写入 → 提交后校验)编辑选中单元格与工作簿内容。
  • 对比两个工作簿的结构与内容,并在接受结果前校验其完整性。
  • 保留上游 workbook-editor skill(原样、未翻译),内置六把 workbook_* 工具与 workbook-doctor 诊断命令。

效果

  • Fail-closed:任何无法以字节级保真处理的包(ZIP64、加密、共享/数组/数据表/溢流公式区域、不可变受保护部件)都会明确拒绝,而不是静默降级。
  • 可验证:每次提交都要求 expectedSha256,写入后立即校验并支持与基线比对;就地编辑会先留恢复副本。
  • 不碰宏:只清点、保留与校验 VBA 等受保护内容,从不执行或修改。
  • 可审计:模型可见输出有上限,超出时完整 JSON 落到临时文件并给出路径,不截断信息。

安装

从本地目录安装(需要先自行构建):

git clone https://github.com/GongYuanCaiJi/dsh-extension-workbook.git
cd dsh-extension-workbook && npm install        # 触发 prepare,产出 dist/
dsh plugin --profile <profile> add ../dsh-extension-workbook

或直接通过 GitHub 安装:

dsh plugin --profile <profile> add github:GongYuanCaiJi/dsh-extension-workbook

安装时会通过 prepare 脚本自动构建 dist/。若 pnpm 拦下构建步骤,在 profile 的 pnpm-workspace.yaml 里把本包加进 allowBuilds

本包尚未发布到 npm;需要 Node.js 24 或更新版本。安装后重启 dsh 让插件生效。

使用

引用或给出 .xlsx / .xlsm 文件路径,然后描述你要的结果:

检视这个工作簿,修正 Summary 表中的合计,保持格式不变,并展示校验结果。

建议先 workbook_inspectworkbook_render 熟悉文件,审阅建议的单元格改动,最后比对与校验满意后再保留编辑后的文件。

移植说明

本插件是 @firstpick/pi-extension-workbook(MIT)的 dsh 移植(port),上游代码按「100% 原样复制、只做必要适配」的规则保留;每一处适配都记录在 THIRD_PARTY_NOTICES.md。上游的文字(skill 与 docs)是英文而本项目受众以中文为主,按原样复制规则未翻译,保留原文。如果上游对你有帮助,也给上游一个 star

License

MIT。上游 @firstpick/pi-extension-workbook Copyright (c) 2026 Firstpick,本移植 Copyright (c) 2026 GongYuanCaiJi。见 LICENSE


English

Inspect, render, edit, diff, and validate Excel workbooks in DeepSeek Harness with a fail-closed, hash-guarded workflow: no macro execution, no external-data refresh, dry-run first, and every commit protected by SHA-256 conflict checks.

This is a dsh port of the Pi extension @firstpick/pi-extension-workbook (MIT) — see THIRD_PARTY_NOTICES.md for the pinned upstream artifact and every adaptation. Please star the upstream repo too. The upstream skill and docs remain verbatim English (the port rule forbids translating them).

Features

  • Inspects .xlsx and .xlsm workbooks without changing them.
  • Renders sheets and focused ranges to deterministic PNGs so formatting can be checked visually.
  • Edits selected cells and workbook content through a guarded workflow: dry-run planning, expectedSha256 conflict protection, atomic writes, post-commit validation.
  • Diffs two workbooks by sheets, values, formulas, styles, part hashes, and protected content; validates structure before the result is accepted.
  • Ships the upstream workbook-editor skill, six workbook_* tools, and a workbook-doctor diagnostic command.

What you get

  • Fail-closed: packages the engine cannot process with byte-level fidelity (ZIP64, encrypted, shared/array/data-table/spill formula regions, immutable protected parts) are rejected loudly, never silently downgraded.
  • Verifiable: every commit requires expectedSha256; outputs are validated immediately and against an optional baseline; in-place edits keep a recovery copy.
  • Macro-safe: protected active content is inventoried, preserved, and verified — never executed or edited.
  • Bounded output: model-visible results are capped; oversized JSON is written to a temp artifact whose path is returned.

Install

From a local directory (build first):

git clone https://github.com/GongYuanCaiJi/dsh-extension-workbook.git
cd dsh-extension-workbook && npm install        # runs prepare, produces dist/
dsh plugin --profile <profile> add ../dsh-extension-workbook

Or directly from GitHub:

dsh plugin --profile <profile> add github:GongYuanCaiJi/dsh-extension-workbook

The prepare script builds dist/ during install. If pnpm blocks the build step, add the package to allowBuilds in the profile's pnpm-workspace.yaml.

Not published to npm yet; requires Node.js 24+. Restart dsh after installing so the plugin loads.

Usage

Attach or reference the .xlsx / .xlsm file, then describe the result you want:

Inspect this workbook, correct the totals in the Summary sheet, preserve the formatting, and show me the validation result.

Start with inspection or rendering, review the proposed cell changes, and keep the edited file only after the final comparison and validation are satisfactory.

License

MIT. Upstream @firstpick/pi-extension-workbook Copyright (c) 2026 Firstpick; this port Copyright (c) 2026 GongYuanCaiJi. See LICENSE.