audit-e2w 1.11.2 → 1.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +152 -148
  2. package/dsh_plugins/audit-e2w/lib/index.js +9 -1
  3. package/dsh_plugins/audit-e2w/lib/skill.js +3 -2
  4. package/excel_word/README.md +45 -37
  5. package/excel_word/qoder_engine.py +10 -11
  6. package/excel_word/wesync/__init__.py +1 -1
  7. package/excel_word/wesync/ai/__init__.py +52 -0
  8. package/excel_word/wesync/ai/actions.py +369 -0
  9. package/excel_word/wesync/ai/client.py +340 -0
  10. package/excel_word/wesync/ai/config.py +291 -0
  11. package/excel_word/wesync/ai/docs.py +177 -0
  12. package/excel_word/wesync/ai/prompts.py +288 -0
  13. package/excel_word/wesync/ai/tasks/__init__.py +26 -0
  14. package/excel_word/wesync/ai/tasks/actions_task.py +97 -0
  15. package/excel_word/wesync/ai/tasks/combined.py +123 -0
  16. package/excel_word/wesync/ai/tasks/diff_note.py +61 -0
  17. package/excel_word/wesync/ai/tasks/headings.py +119 -0
  18. package/excel_word/wesync/ai/tasks/help_task.py +69 -0
  19. package/excel_word/wesync/ai/tasks/roles.py +128 -0
  20. package/excel_word/wesync/align.py +1 -0
  21. package/excel_word/wesync/api.py +544 -92
  22. package/excel_word/wesync/backup_history.py +44 -9
  23. package/excel_word/wesync/cli.py +19 -1
  24. package/excel_word/wesync/commands/blank_cmd.py +59 -30
  25. package/excel_word/wesync/commands/bookmark_cmd.py +41 -10
  26. package/excel_word/wesync/commands/clear_cmd.py +5 -3
  27. package/excel_word/wesync/commands/export_cmd.py +270 -220
  28. package/excel_word/wesync/commands/incremental_cmd.py +157 -0
  29. package/excel_word/wesync/commands/marks_cmd.py +24 -16
  30. package/excel_word/wesync/commands/placeholders_cmd.py +12 -7
  31. package/excel_word/wesync/commands/writeback_cmd.py +72 -116
  32. package/excel_word/wesync/config.py +3 -2
  33. package/excel_word/wesync/console.py +9 -2
  34. package/excel_word/wesync/docx_bookmarks.py +12 -5
  35. package/excel_word/wesync/docx_columns.py +1 -1
  36. package/excel_word/wesync/docx_marks.py +183 -75
  37. package/excel_word/wesync/docx_placeholders.py +65 -26
  38. package/excel_word/wesync/excel_blocks.py +144 -185
  39. package/excel_word/wesync/excel_export.py +15 -8
  40. package/excel_word/wesync/excel_marks.py +265 -193
  41. package/excel_word/wesync/fsops.py +11 -6
  42. package/excel_word/wesync/gui/__init__.py +21 -2
  43. package/excel_word/wesync/gui/app.py +243 -29
  44. package/excel_word/wesync/gui/manual.py +5 -3
  45. package/excel_word/wesync/gui/pages/__init__.py +53 -4
  46. package/excel_word/wesync/gui/pages/_page.py +129 -7
  47. package/excel_word/wesync/gui/pages/ai_page.py +854 -0
  48. package/excel_word/wesync/gui/pages/batch_page.py +64 -31
  49. package/excel_word/wesync/gui/pages/blank_page.py +529 -464
  50. package/excel_word/wesync/gui/pages/bookmark_page.py +97 -37
  51. package/excel_word/wesync/gui/pages/export_page.py +140 -87
  52. package/excel_word/wesync/gui/pages/feedback_page.py +196 -0
  53. package/excel_word/wesync/gui/pages/format_page.py +551 -429
  54. package/excel_word/wesync/gui/pages/help_page.py +73 -7
  55. package/excel_word/wesync/gui/pages/history_page.py +167 -144
  56. package/excel_word/wesync/gui/pages/marks_page.py +210 -177
  57. package/excel_word/wesync/gui/pages/settings_page.py +450 -0
  58. package/excel_word/wesync/gui/pages/writeback_page.py +167 -146
  59. package/excel_word/wesync/gui/runner.py +29 -13
  60. package/excel_word/wesync/gui/store.py +23 -7
  61. package/excel_word/wesync/gui/theme.py +220 -49
  62. package/excel_word/wesync/gui/widgets/ai_config.py +362 -0
  63. package/excel_word/wesync/gui/widgets/cards.py +124 -5
  64. package/excel_word/wesync/gui/widgets/chips.py +565 -0
  65. package/excel_word/wesync/gui/widgets/filebar.py +1 -1
  66. package/excel_word/wesync/gui/widgets/logpane.py +24 -8
  67. package/excel_word/wesync/gui/widgets/nav.py +267 -12
  68. package/excel_word/wesync/gui/widgets/theme_choice.py +93 -0
  69. package/excel_word/wesync/report_format.py +9 -1
  70. package/excel_word/wesync/settings.py +35 -0
  71. package/excel_word/wesync/sort_rules.py +75 -26
  72. package/excel_word/wesync/valuefmt.py +40 -17
  73. package/package.json +53 -51
  74. package/packaging//344/275/277/347/224/250/350/257/264/346/230/216.txt +247 -0
  75. package/qoder_plugins/audit-toolbox/README.md +159 -156
  76. package/qoder_plugins/audit-toolbox/catalog.mjs +13 -13
@@ -1,156 +1,159 @@
1
- # 审计工具箱
2
-
3
- 在 Qoder Desktop 中处理 Word 与 Excel 的本地审计办公插件。当前版本:**v1.11.2**。
4
-
5
- 插件把桌面版的核心能力集中在一个界面中,包括创建 Excel、同步 Word、差异比对、链接标注、正文占位符、书签维护、空白表删除与恢复、批量同步、模板批量生成以及备份回滚。
6
-
7
- ## 运行环境
8
-
9
- - Qoder Desktop,Windows 10/11 64 位。
10
- - 内置 Windows 本地引擎,**不支持 macOS**。
11
- - 不需要另外安装 Python 或 Node.js;MCP 服务使用 Qoder 自带 Node.js 运行。
12
- - 打开和编辑生成的 Word/Excel 文件需要 Microsoft Office。
13
- - 支持 `.docx` / `.docm`、`.xlsx` / `.xlsm`;写回 `.xlsm` 时保留 VBA。
14
-
15
- ## 安装
16
-
17
- ### 本地 ZIP 安装
18
-
19
- 1. 打开 Qoder Desktop 左侧 **扩展**。
20
- 2. 进入 **插件 → 添加插件 → 导入插件 / 上传 Plugin**。
21
- 3. 选择 `Audit_E2W_qoder_v1.11.2.zip`。
22
- 4. 安装后在 **已安装** 中启用“审计工具箱”。
23
-
24
- 本地安装只在当前设备生效,不会自动发布到公共市场。
25
-
26
- ### 公共市场安装
27
-
28
- 如果公共市场对你所在账号和地区可用,可在 **扩展 → 插件** 中搜索“审计工具箱”,核对发布者和权限后安装。市场是否可见、是否允许发布,以当前客户端和发布中心页面为准。
29
-
30
- ## 打开与首次检查
31
-
32
- 1. 从插件的全局或会话入口打开“审计工具箱”。
33
- 2. 右上角应显示 **本地引擎 1.11.2 已就绪**。
34
- 3. 如提示找不到引擎或版本不一致,请重新安装完整的插件 ZIP,不要只复制 `server.mjs`。
35
- 4. 选择左侧任务,按“选择文件 → 操作选项 → 预演 → 确认执行”的顺序操作。
36
-
37
- ## 典型流程
38
-
39
- ### 1. 从 Word 创建 Excel
40
-
41
- 1. 选择 **创建 Excel**。
42
- 2. 选择 Word 报告;Excel 路径默认按同名报告生成,也可以手选。
43
- 3. 建议先勾选 **仅预演**,确认没有警告。
44
- 4. 正式创建后,工作簿固定包含“表格汇总”“链接标注”“正文信息”三个工作表。
45
- 5. 后续用 Excel 界面修改明细、增删行列或填写标注和占位符,保存并关闭 Excel。
46
-
47
- ### 2. 同步回 Word
48
-
49
- 1. 选择 **同步到 Word**,再次选择同一份 Word 和工作簿。
50
- 2. 选择同步内容:表格、链接标注、正文占位符可以任意组合。
51
- 3. 先 **仅预演** 或使用 **差异比对** 核对。
52
- 4. 正式执行前确认文件列表和备份选项,再点 **确认并执行**。
53
- 5. 同步后检查右侧日志和结果;失败时先关闭 Word/Excel,再按日志或备份恢复。
54
-
55
- ### 3. 标注与占位符
56
-
57
- - **导出 / 刷新标注**:把 Word 高亮位置写入“链接标注”表。
58
- - **同步标注到 Word**:把新内容和可选链接写回高亮位置。
59
- - **补齐占位符工作表**:扫描 `{字段名}`,生成或补齐“正文信息”表。
60
- - **同步占位符到 Word**:按填写值替换占位符,保留字体和版式。
61
-
62
- ## 让 Agent 帮你干活
63
-
64
- 插件内置 `audit-word-excel` Skill。启用插件后,可以直接在对话里交代任务,不必先打开操作页面。Agent 会按“检查文件和引擎 → 读取能力目录 → 预演或差异检查 → 说明改动并确认 → 正式执行 → 核验结果”的顺序处理。
65
-
66
- 也可以聊天输入 `/`,选择以下快捷命令,再补充本次文件或需求。斜杠命令只是预设提示词,不会跳过 Skill 的安全流程,也不等于同意写盘。
67
-
68
- | 命令 | 适用场景 | 默认流程 |
69
- | --- | --- | --- |
70
- | `/audit-toolbox:export` | Word 导出 Excel | 先预演,确认后生成工作簿 |
71
- | `/audit-toolbox:sync` | Excel 改动同步回 Word | 先查差异,确认同步范围后写回 |
72
- | `/audit-toolbox:format` | 按样板或方案调整格式 | 候选确认、格式预演、生成新副本 |
73
- | `/audit-toolbox:batch` | 批量同步或模板生成 | 先确认文件清单,逐份汇报结果 |
74
- | `/audit-toolbox:check` | 差异、空白表、模板字段或格式候选 | 全程只读,不修改文件 |
75
-
76
- `audit_capabilities` 提供 31 项操作(28 项界面操作、3 项对话专用格式操作)的必填参数、默认值、预演支持和示例;任务完成后,`audit_task_status.summary` 会汇总输出文件、改动数量、备份、警告及批量成功/跳过/失败情况。批量任务即使总状态为 `succeeded`,Agent 也会检查 `outcome=partial` 和失败清单。
77
-
78
- 对话专用格式操作为 `format-scan`(格式预演)、`format-heading-candidates`(候选标题、表格前段落角色和附注边界)和 `format-apply`(应用格式)。识别疑难角色时只发送本地筛出的候选及有限上下文,不上传整篇报告或表格单元格;Agent 必须展示建议、置信度和边界变化并取得用户确认,正式应用还须传 `confirmed=true`。结果只改直接排版和本次处理范围,不写标题样式、不改大纲级别、不更新目录。生成结果的 `visual_review` 提供 Word 目视验收清单,结构核验不代表排版已通过。
79
-
80
- 可以直接这样说:
81
-
82
- - “把 `E:\报告\审计报告.docx` 导出成 Excel,先预演。”
83
- - “Excel 改好了,只把表格同步回 Word,先告诉我有什么差异。”
84
- - “把表格、标注和正文占位符全部同步回 Word。”
85
- - “用 `E:\报告\模板.docx` 和 `E:\报告\底稿.xlsx` 生成一份新 Word,不要覆盖原件。”
86
- - “批量同步 `E:\报告\待处理` 里的 Word 和同名 Excel,失败的单列出来。”
87
-
88
- 安全约定:
89
-
90
- - Agent 先预演或只读检查,不会把“先看看”当成写盘指令。
91
- - 删除、覆盖和恢复备份前会说明范围并等待确认。
92
- - 单模板生成只创建新 Word,不覆盖模板原件和源 Excel。
93
- - 文件被占用时先提示关闭文件,不默认强制保存。
94
- - 完成后汇报输出文件、改动数量、警告、备份位置和建议复核项。
95
-
96
- 如果 Agent 看不到 `audit_*` 工具,先确认插件已安装并启用,再重新加载插件或新建会话。插件服务显示“已连接”但工具数为 0 时,通常是工具可见性或插件版本加载问题。
97
-
98
- ## Qoder 使用边界
99
-
100
- 插件优先通过内置 MCP 工具完成操作;只有 MCP 工具不可用时,才使用包内 Skill 的本地脚本备用通道。
101
-
102
- Qoder 插件包已包含 Windows 引擎,不需要额外安装 Python 或 Node.js,也不需要把包内文件复制到其他平台。
103
-
104
- ## 功能清单
105
-
106
- | 分组 | 功能 |
107
- | --- | --- |
108
- | 常用 | 创建 Excel、同步到 Word、差异比对、导出差异清单、重新判定 ✓/✕ |
109
- | 内容 | 导出/刷新标注、同步标注、补齐占位符、同步占位符、检查模板字段 |
110
- | 维护 | 重建/迁移书签、清理书签、查看表块、追加新表块、查看/设置/清除排序、扫描/删除/恢复空白表 |
111
- | 批量 | 多报告批量同步、批量扫描/删除空白表、多模板批量生成、生成正文信息填写表 |
112
- | 备份 | 查看历史备份、恢复历史备份 |
113
-
114
- ## 数据与安全
115
-
116
- - 报告内容只在本机处理,**插件不联网、不上传整篇报告**;格式疑难识别只向当前宿主 Agent 返回本地筛选的候选和有限上下文。
117
- - 只处理用户主动选择的本地文件;查询任务只读,写盘任务显示确认。
118
- - 默认在写盘前备份到原文件旁的 `_backup` 文件夹。
119
- - 执行前请关闭对应 Word/Excel 文件;文件被占用时会提示,不要随意跳过占用检查。
120
- - 公式单元格按 Excel 显示结果写回。如果公式没有缓存结果,请先在 Excel 中重算并保存。
121
- - 不要在插件包、市场介绍或截图里放真实报告、客户名称、账号、密码或 API Key。
122
-
123
- ## 常见问题
124
-
125
- ### 右上角提示引擎不可用
126
-
127
- 确认安装的是完整 ZIP,且 `engine/审计工具箱引擎.exe` 与 `engine/_internal` 均存在。重新安装与当前插件版本一致的包。
128
-
129
- ### 文件选择器不可用
130
-
131
- 直接粘贴完整的 Windows 绝对路径,例如 `E:\报告\审计报告.docx`。相对路径不会被接受。
132
-
133
- ### 同步后公式显示为公式文本或没有结果
134
-
135
- 公式单元格应写回计算结果。若 Excel 尚未计算,先在 Excel 中打开工作簿、完成重算并保存,再重新同步。
136
-
137
- ### 表格被删除或定位错位
138
-
139
- 先查看日志和 `_backup`,不要直接重新导出覆盖已编辑工作簿。可用“查看可恢复表格”或“重建/迁移书签”处理。
140
-
141
- ### 如何更新或卸载
142
-
143
- - **更新**:安装版本号更高的新 ZIP;审核中的市场版本不会自动替换当前线上版本。
144
- - **卸载**:在 Qoder 的 **扩展 → 插件 → 已安装** 中管理“审计工具箱”。卸载前自行保存需要保留的报告和工作簿。
145
-
146
- ## 目录说明
147
-
148
- ```text
149
- .qoder-plugin/plugin.json 插件清单
150
- .mcp.json 本地 MCP 服务声明
151
- server.mjs 插件服务与本地引擎桥接
152
- commands/ 5 个 Agent 快捷斜杠指令
153
- app.html / app.js 操作界面
154
- engine/ 打包后的 Windows 引擎及运行库
155
- assets/icon.png 市场展示图标
156
- ```
1
+ # 审计工具箱
2
+
3
+ 在 Qoder Desktop 中处理 Word 与 Excel 的本地审计办公插件。当前版本:**v1.11.7**。
4
+
5
+ 插件把桌面版的核心能力集中在一个界面中,包括创建 Excel、同步 Word、差异比对、链接标注、正文占位符、书签维护、空白表删除与恢复、批量同步、模板批量生成以及备份回滚。
6
+
7
+ ## 运行环境
8
+
9
+ - Qoder Desktop,Windows 10/11 64 位。
10
+ - 内置 Windows 本地引擎,**不支持 macOS**。
11
+ - 不需要另外安装 Python 或 Node.js;MCP 服务使用 Qoder 自带 Node.js 运行。
12
+ - 打开和编辑生成的 Word/Excel 文件需要 Microsoft Office。
13
+ - 支持 `.docx` / `.docm`、`.xlsx` / `.xlsm`;写回 `.xlsm` 时保留 VBA。
14
+
15
+ ## 安装
16
+
17
+ ### 本地 ZIP 安装
18
+
19
+ 1. 打开 Qoder Desktop 左侧 **扩展**。
20
+ 2. 进入 **插件 → 添加插件 → 导入插件 / 上传 Plugin**。
21
+ 3. 选择 `Audit_E2W_qoder_v1.11.7.zip`。
22
+ 4. 安装后在 **已安装** 中启用“审计工具箱”。
23
+
24
+ 本地安装只在当前设备生效,不会自动发布到公共市场。
25
+
26
+ ### 公共市场安装
27
+
28
+ 如果公共市场对你所在账号和地区可用,可在 **扩展 → 插件** 中搜索“审计工具箱”,核对发布者和权限后安装。市场是否可见、是否允许发布,以当前客户端和发布中心页面为准。
29
+
30
+ ## 打开与首次检查
31
+
32
+ 1. 从插件的全局或会话入口打开“审计工具箱”。
33
+ 2. 右上角应显示 **本地引擎 1.11.5 已就绪**。
34
+ 3. 如提示找不到引擎或版本不一致,请重新安装完整的插件 ZIP,不要只复制 `server.mjs`。
35
+ 4. 选择左侧任务,按“选择文件 → 操作选项 → 预演 → 确认执行”的顺序操作。
36
+
37
+ ## 典型流程
38
+
39
+ ### 1. 从 Word 创建 Excel
40
+
41
+ 1. 选择 **创建 Excel**。
42
+ 2. 选择 Word 报告;Excel 路径默认按同名报告生成,也可以手选。
43
+ 3. 建议先勾选 **仅预演**,确认没有警告。
44
+ 4. 正式创建后,工作簿固定包含“表格汇总”“链接标注”“正文信息”三个工作表。Word 后续新增内容用“增量导出”只追加:新表进入“新增表格”(XT01…),新标注用 XM01…,新占位符追加“正文信息”;既有行和公式位置不变。
45
+ 5. 后续用 Excel 界面修改明细、增删行列或填写标注和占位符,保存并关闭 Excel。
46
+
47
+ ### 2. 同步回 Word
48
+
49
+ 1. 选择 **同步到 Word**,再次选择同一份 Word 和工作簿。
50
+ 2. 选择同步内容:表格、链接标注、正文占位符可以任意组合。
51
+ 3. 先 **仅预演** 或使用 **差异比对** 核对。
52
+ 4. 正式执行前确认文件列表和备份选项,再点 **确认并执行**。
53
+ 5. 同步后检查右侧日志和结果;失败时先关闭 Word/Excel,再按日志或备份恢复。
54
+
55
+ ### 3. 标注与占位符
56
+
57
+ - **导出 / 刷新标注**:把 Word 高亮位置写入“链接标注”表。
58
+ - **同步标注到 Word**:把新内容和可选链接写回高亮位置。
59
+ - **补齐占位符工作表**:扫描 `{字段名}`,生成或补齐“正文信息”表。
60
+ - **同步占位符到 Word**:按填写值替换占位符,保留字体和版式。
61
+
62
+ ## 让 Agent 帮你干活
63
+
64
+ 插件内置 `audit-word-excel` Skill。启用插件后,可以直接在对话里交代任务,不必先打开操作页面。Agent 会按“检查文件和引擎 → 读取能力目录 → 预演或差异检查 → 说明改动并确认 → 正式执行 → 核验结果”的顺序处理。
65
+
66
+ 也可以聊天输入 `/`,选择以下快捷命令,再补充本次文件或需求。斜杠命令只是预设提示词,不会跳过 Skill 的安全流程,也不等于同意写盘。
67
+
68
+ | 命令 | 适用场景 | 默认流程 |
69
+ | --- | --- | --- |
70
+ | `/audit-toolbox:export` | Word 导出 Excel | 先预演,确认后生成工作簿 |
71
+ | `/audit-toolbox:sync` | Excel 改动同步回 Word | 先查差异,确认同步范围后写回 |
72
+ | `/audit-toolbox:format` | 按样板或方案调整格式 | 候选确认、格式预演、生成新副本 |
73
+ | `/audit-toolbox:batch` | 批量同步或模板生成 | 先确认文件清单,逐份汇报结果 |
74
+ | `/audit-toolbox:check` | 差异、空白表、模板字段或格式候选 | 全程只读,不修改文件 |
75
+
76
+ `audit_capabilities` 提供 31 项操作(28 项界面操作、3 项对话专用格式操作)的必填参数、默认值、预演支持和示例;任务完成后,`audit_task_status.summary` 会汇总输出文件、改动数量、备份、警告及批量成功/跳过/失败情况。批量任务即使总状态为 `succeeded`,Agent 也会检查 `outcome=partial` 和失败清单。
77
+
78
+ 对话专用格式操作为 `format-scan`(格式预演)、`format-heading-candidates`(候选标题、表格前段落角色和附注边界)和 `format-apply`(应用格式)。识别疑难角色时只发送本地筛出的候选及有限上下文,不上传整篇报告或表格单元格;Agent 必须展示建议、置信度和边界变化并取得用户确认,正式应用还须传 `confirmed=true`。结果只改直接排版和本次处理范围,不写标题样式、不改大纲级别、不更新目录。生成结果的 `visual_review` 提供 Word 目视验收清单,结构核验不代表排版已通过。
79
+
80
+ 可以直接这样说:
81
+
82
+ - “把 `E:\报告\审计报告.docx` 导出成 Excel,先预演。”
83
+ - “Excel 改好了,只把表格同步回 Word,先告诉我有什么差异。”
84
+ - “把表格、标注和正文占位符全部同步回 Word。”
85
+ - “用 `E:\报告\模板.docx` 和 `E:\报告\底稿.xlsx` 生成一份新 Word,不要覆盖原件。”
86
+ - “批量同步 `E:\报告\待处理` 里的 Word 和同名 Excel,失败的单列出来。”
87
+
88
+ 安全约定:
89
+
90
+ - Agent 先预演或只读检查,不会把“先看看”当成写盘指令。
91
+ - 所有正式写操作都必须同时传 `dryRun=false`、`confirmed=true`;服务端会拒绝缺少确认的请求。
92
+ - 删除、覆盖和恢复备份前会说明范围并等待确认。
93
+ - 单模板生成只创建新 Word,不覆盖模板原件和源 Excel。
94
+ - 文件被占用时先提示关闭文件,不默认强制保存。
95
+ - 完成后汇报输出文件、改动数量、警告、备份位置和建议复核项。
96
+
97
+ 如果 Agent 看不到 `audit_*` 工具,先确认插件已安装并启用,再重新加载插件或新建会话。插件服务显示“已连接”但工具数为 0 时,通常是工具可见性或插件版本加载问题。
98
+
99
+ ## Qoder 使用边界
100
+
101
+ 插件优先通过内置 MCP 工具完成操作;只有 MCP 工具不可用时,才使用包内 Skill 的本地脚本备用通道。
102
+
103
+ MCP 和本地引擎都不可用时,Agent 会停止审计预演和写盘,但可用同一脚本执行 `capabilities`、`inspect`、`baseline`、`verify`:核对操作目录、检查 Office 包完整性和结构计数、登记 SHA-256 基线、复查文件变化。该降级只提供文件层面证据,不输出正文或单元格内容,不声称业务差异为零或报告已经完成;证据 JSON 保存在项目根 `.tmp/`。
104
+
105
+ Qoder 插件包已包含 Windows 引擎,不需要额外安装 Python 或 Node.js,也不需要把包内文件复制到其他平台。
106
+
107
+ ## 功能清单
108
+
109
+ | 分组 | 功能 |
110
+ | --- | --- |
111
+ | 常用 | 创建 Excel、同步到 Word、差异比对、导出差异清单、重新判定 ✓/✕ |
112
+ | 内容 | 导出/刷新标注、同步标注、补齐占位符、同步占位符、检查模板字段 |
113
+ | 维护 | 重建/迁移书签、清理书签、增量导出、查看表块、查看/设置/清除排序、扫描/删除/恢复空白表 |
114
+ | 批量 | 多报告批量同步、批量扫描/删除空白表、多模板批量生成、生成正文信息填写表 |
115
+ | 备份 | 查看历史备份、恢复历史备份 |
116
+
117
+ ## 数据与安全
118
+
119
+ - 报告内容只在本机处理,**插件不联网、不上传整篇报告**;格式疑难识别只向当前宿主 Agent 返回本地筛选的候选和有限上下文。
120
+ - 只处理用户主动选择的本地文件;查询任务只读,写盘任务显示确认。
121
+ - 默认在写盘前备份到原文件旁的 `_backup` 文件夹。
122
+ - 执行前请关闭对应 Word/Excel 文件;文件被占用时会提示,不要随意跳过占用检查。
123
+ - 公式单元格按 Excel 显示结果写回。如果公式没有缓存结果,请先在 Excel 中重算并保存。
124
+ - 不要在插件包、市场介绍或截图里放真实报告、客户名称、账号、密码或 API Key。
125
+
126
+ ## 常见问题
127
+
128
+ ### 右上角提示引擎不可用
129
+
130
+ 确认安装的是完整 ZIP,且 `engine/审计工具箱引擎.exe` 与 `engine/_internal` 均存在。重新安装与当前插件版本一致的包。
131
+
132
+ ### 文件选择器不可用
133
+
134
+ 直接粘贴完整的 Windows 绝对路径,例如 `E:\报告\审计报告.docx`。相对路径不会被接受。
135
+
136
+ ### 同步后公式显示为公式文本或没有结果
137
+
138
+ 公式单元格应写回计算结果。若 Excel 尚未计算,先在 Excel 中打开工作簿、完成重算并保存,再重新同步。
139
+
140
+ ### 表格被删除或定位错位
141
+
142
+ 先查看日志和 `_backup`,不要直接重新导出覆盖已编辑工作簿。可用“查看可恢复表格”或“重建/迁移书签”处理。
143
+
144
+ ### 如何更新或卸载
145
+
146
+ - **更新**:安装版本号更高的新 ZIP;审核中的市场版本不会自动替换当前线上版本。
147
+ - **卸载**:在 Qoder 的 **扩展 → 插件 → 已安装** 中管理“审计工具箱”。卸载前自行保存需要保留的报告和工作簿。
148
+
149
+ ## 目录说明
150
+
151
+ ```text
152
+ .qoder-plugin/plugin.json 插件清单
153
+ .mcp.json 本地 MCP 服务声明
154
+ server.mjs 插件服务与本地引擎桥接
155
+ commands/ 5 个 Agent 快捷斜杠指令
156
+ app.html / app.js 操作界面
157
+ engine/ 打包后的 Windows 引擎及运行库
158
+ assets/icon.png 市场展示图标
159
+ ```
@@ -3,7 +3,7 @@ import path from "node:path"
3
3
  export const emptySchema = { type: "object", properties: {}, additionalProperties: false }
4
4
 
5
5
  export const queryOperations = ["blank-scan", "deleted-list", "blank-batch-scan", "diff", "table-list", "sort-list", "template-scan", "backup-list", "format-scan", "format-heading-candidates"]
6
- export const runOperations = ["export", "writeback", "bookmark", "rejudge", "clear-bookmarks", "marks", "marks-sync", "placeholders", "placeholders-sync", "blank-delete", "restore-tables", "blank-batch-delete", "diff-export", "append-table", "sort-set", "sort-clear", "batch-writeback", "template-batch", "fill-placeholders", "backup-restore", "format-apply"]
6
+ export const runOperations = ["export", "writeback", "bookmark", "rejudge", "clear-bookmarks", "marks", "marks-sync", "placeholders", "placeholders-sync", "blank-delete", "restore-tables", "blank-batch-delete", "diff-export", "incremental-export", "sort-set", "sort-clear", "batch-writeback", "template-batch", "fill-placeholders", "backup-restore", "format-apply"]
7
7
  export const pathProperties = {
8
8
  docx: { type: "string", description: "Word 文件绝对路径(.docx/.docm)" },
9
9
  excel: { type: "string", description: "Excel 工作簿绝对路径(.xlsx/.xlsm);留空使用默认同名工作簿" },
@@ -74,14 +74,10 @@ export const runProperties = {
74
74
  keepCaption: { type: "boolean", description: "只删表格并保留标题" },
75
75
  keepCaptionFor: { type: "string", description: "保留标题的候选编号" },
76
76
  reversible: { type: "boolean", description: "可逆删除并保留 Excel 表块" },
77
- name: { type: "string", description: "新表名称" },
78
- nrows: { type: "integer", minimum: 1, maximum: 200 },
79
- ncols: { type: "integer", minimum: 1, maximum: 30 },
80
- after: { type: "string", description: "在指定表块后插入" },
81
77
  code: { type: "string", description: "表块编号" },
82
78
  column: { type: "string", description: "排序依据的列名" },
83
79
  descending: { type: "boolean", description: "降序;false 为升序" },
84
- confirmed: { type: "boolean", description: "format-apply 正式写盘前必须为 true,表示用户已确认预演范围、标题级别、疑难角色和边界" },
80
+ confirmed: { type: "boolean", description: "正式写盘前必须为 true,表示用户已确认本次操作、预演结果和受影响文件" },
85
81
  }
86
82
  export const operationSpecs = {
87
83
  "blank-scan": { title: "扫描空白表", tool: "audit_query", required: ["docx"], optional: ["docx"], defaults: {}, dryRun: false, writes: false, example: { operation: "blank-scan", docx: "D:\\审计项目\\报告.docx" } },
@@ -106,17 +102,21 @@ export const operationSpecs = {
106
102
  "blank-delete": { title: "删除空白表格", tool: "audit_run", required: ["docx", "pick"], optional: ["docx", "excel", "dryRun", "force", "pick", "keepCaption", "keepCaptionFor", "reversible"], defaults: { reversible: true, keepCaption: false, force: false }, dryRun: true, writes: true, example: { operation: "blank-delete", docx: "D:\\审计项目\\报告.docx", pick: "1", dryRun: true } },
107
103
  "restore-tables": { title: "恢复已删表格", tool: "audit_run", required: ["docx", "pick"], optional: ["docx", "excel", "dryRun", "force", "pick"], defaults: { excel: "同名_表格数据.xlsx", force: false }, dryRun: true, writes: true, example: { operation: "restore-tables", docx: "D:\\审计项目\\报告.docx", pick: "1", dryRun: true } },
108
104
  "blank-batch-delete": { title: "批量删除空白表", tool: "audit_run", required: ["items"], optional: ["items", "dryRun", "force"], defaults: { force: false }, dryRun: true, writes: true, example: { operation: "blank-batch-delete", items: [{ docx: "D:\\审计项目\\报告.docx", pick: "1", reversible: true }], dryRun: true } },
109
- "diff-export": { title: "导出差异清单", tool: "audit_run", required: ["docx"], optional: ["docx", "excel"], defaults: { excel: "同名_表格数据.xlsx" }, dryRun: false, writes: true, example: { operation: "diff-export", docx: "D:\\审计项目\\报告.docx" } },
110
- "append-table": { title: "追加新表块", tool: "audit_run", required: ["docx", "name", "nrows", "ncols"], optional: ["docx", "excel", "name", "nrows", "ncols", "after"], defaults: { excel: "同名_表格数据.xlsx" }, dryRun: false, writes: true, example: { operation: "append-table", docx: "D:\\审计项目\\报告.docx", name: "审计发现问题汇总", nrows: 3, ncols: 3 } },
111
- "sort-set": { title: "设置表格排序", tool: "audit_run", required: ["docx", "code", "column"], optional: ["docx", "excel", "code", "column", "descending"], defaults: { excel: "同名_表格数据.xlsx", descending: true }, dryRun: false, writes: true, example: { operation: "sort-set", docx: "D:\\审计项目\\报告.docx", code: "T02", column: "金额", descending: true } },
112
- "sort-clear": { title: "清除表格排序", tool: "audit_run", required: ["docx", "code"], optional: ["docx", "excel", "code"], defaults: { excel: "同名_表格数据.xlsx" }, dryRun: false, writes: true, example: { operation: "sort-clear", docx: "D:\\审计项目\\报告.docx", code: "T02" } },
105
+ "diff-export": { title: "导出差异清单", tool: "audit_run", required: ["docx"], optional: ["docx", "excel"], defaults: { excel: "同名_表格数据.xlsx" }, dryRun: false, writes: true, example: { operation: "diff-export", docx: "D:\\审计项目\\报告.docx", confirmed: true } },
106
+ "incremental-export": { title: "增量导出", tool: "audit_run", required: ["docx", "excel"], optional: ["docx", "excel", "dryRun", "force", "backup", "withExcelLinks", "totalsFormula"], defaults: { backup: true, withExcelLinks: true, totalsFormula: true, force: false }, dryRun: true, writes: true, example: { operation: "incremental-export", docx: "D:\\审计项目\\报告.docx", excel: "D:\\审计项目\\报告_表格数据.xlsx", dryRun: true } },
107
+ "sort-set": { title: "设置表格排序", tool: "audit_run", required: ["docx", "code", "column"], optional: ["docx", "excel", "code", "column", "descending"], defaults: { excel: "同名_表格数据.xlsx", descending: true }, dryRun: false, writes: true, example: { operation: "sort-set", docx: "D:\\审计项目\\报告.docx", code: "T02", column: "金额", descending: true, confirmed: true } },
108
+ "sort-clear": { title: "清除表格排序", tool: "audit_run", required: ["docx", "code"], optional: ["docx", "excel", "code"], defaults: { excel: "同名_表格数据.xlsx" }, dryRun: false, writes: true, example: { operation: "sort-clear", docx: "D:\\审计项目\\报告.docx", code: "T02", confirmed: true } },
113
109
  "batch-writeback": { title: "多报告批量同步", tool: "audit_run", required: ["paths"], optional: ["paths", "dryRun", "force", "backup", "noBackup", "contents", "keepHighlight"], defaults: { contents: { tables: true, marks: false, placeholders: false }, keepHighlight: true, backup: true, force: false }, dryRun: true, writes: true, example: { operation: "batch-writeback", paths: ["D:\\审计项目\\报告一.docx"], contents: { tables: true }, dryRun: true } },
114
110
  "template-batch": { title: "模板批量生成", tool: "audit_run", required: ["templates", "items", "outDir"], optional: ["templates", "items", "outDir", "dryRun", "contents", "keepHighlight"], defaults: { contents: { tables: true, marks: false, placeholders: true }, keepHighlight: true }, dryRun: true, writes: true, example: { operation: "template-batch", templates: ["D:\\审计项目\\模板.docx"], items: [{ excel: "D:\\审计项目\\底稿.xlsx", template: 1 }], outDir: "D:\\审计项目\\输出", dryRun: true } },
115
- "fill-placeholders": { title: "生成正文信息填写表", tool: "audit_run", required: ["docx", "paths"], optional: ["docx", "paths"], defaults: {}, dryRun: false, writes: true, example: { operation: "fill-placeholders", docx: "D:\\审计项目\\模板.docx", paths: ["D:\\审计项目\\底稿.xlsx"] } },
116
- "backup-restore": { title: "恢复历史备份", tool: "audit_run", required: ["backupPath", "target"], optional: ["backupPath", "target"], defaults: {}, dryRun: false, writes: true, example: { operation: "backup-restore", backupPath: "D:\\审计项目\\_backup\\报告.bak.docx", target: "D:\\审计项目\\报告.docx" } },
111
+ "fill-placeholders": { title: "生成正文信息填写表", tool: "audit_run", required: ["docx", "paths"], optional: ["docx", "paths"], defaults: {}, dryRun: false, writes: true, example: { operation: "fill-placeholders", docx: "D:\\审计项目\\模板.docx", paths: ["D:\\审计项目\\底稿.xlsx"], confirmed: true } },
112
+ "backup-restore": { title: "恢复历史备份", tool: "audit_run", required: ["backupPath", "target"], optional: ["backupPath", "target"], defaults: {}, dryRun: false, writes: true, example: { operation: "backup-restore", backupPath: "D:\\审计项目\\_backup\\报告.bak.docx", target: "D:\\审计项目\\报告.docx", confirmed: true } },
117
113
  "format-apply": { title: "应用报告格式", tool: "audit_run", required: ["docx"], optional: ["docx", "template", "profileName", "output", "scope", "headingBatchId", "headingLevels", "roleBatchId", "roleOverrides", "regionStartId", "dryRun", "confirmed"], defaults: {}, dryRun: true, writes: true, agentOnly: true, example: { operation: "format-apply", docx: "D:\\审计项目\\报告.docx", template: "D:\\审计项目\\样板.docx", output: "D:\\审计项目\\报告_调整格式.docx", dryRun: true } },
118
114
  }
119
115
 
116
+ for (const spec of Object.values(operationSpecs)) {
117
+ if (spec.writes) spec.optional.push("confirmed")
118
+ }
119
+
120
120
  const isObject = value => Boolean(value) && typeof value === "object" && !Array.isArray(value)
121
121
 
122
122
  function validatePath(value, label, suffixes = []) {
@@ -135,11 +135,11 @@ export function validateRunArgs(args, allowedOperations) {
135
135
  const spec = operationSpecs[args.operation]
136
136
  if (!spec) throw new Error("该操作缺少能力定义")
137
137
  if (args.dryRun !== undefined && !spec.dryRun) throw new Error(`${spec.title}不支持预演,请先用相关只读查询检查。`)
138
- if (args.operation === "format-apply" && args.dryRun !== true && args.confirmed !== true) throw new Error("正式应用格式前必须取得用户确认,并传 confirmed=true。")
139
138
  const allowedKeys = new Set(["operation", ...spec.required, ...spec.optional])
140
139
  for (const key of Object.keys(args)) {
141
140
  if (!allowedKeys.has(key)) throw new Error(`${spec.title}不支持参数:${key}`)
142
141
  }
142
+ if (spec.writes && args.dryRun !== true && args.confirmed !== true) throw new Error("正式写盘前必须取得用户确认,并传 confirmed=true。")
143
143
  const labels = { docx: "Word 文件", excel: "Excel 工作簿", paths: "文件清单", templates: "模板清单", items: "任务清单", outDir: "输出目录", pick: "候选编号", name: "新表名称", nrows: "行数", ncols: "列数", code: "表块编号", column: "排序列名", backupPath: "历史备份文件", target: "恢复目标文件", template: "样板 Word", output: "输出 Word" }
144
144
  for (const key of spec.required) {
145
145
  const value = args[key]