pi-maestro-flow 0.2.0

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 (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: scholar-review
3
+ description: "Systematic academic paper review workflow covering self-review before submission and rebuttal writing after receiving reviewer feedback. Triggers on \"review paper\", \"self-review\", \"write rebuttal\", \"respond to reviewers\", \"analyze review comments\", \"paper review\"."
4
+ allowed-tools: Read Write Edit Bash Glob Grep WebFetch WebSearch AskUserQuestion TodoWrite
5
+ ---
6
+
7
+ # Scholar Review
8
+
9
+ A structured workflow for academic paper review and rebuttal. Covers two modes: (1) pre-submission self-review to identify and fix weaknesses before submitting, and (2) post-review rebuttal writing to respond professionally to reviewer feedback.
10
+
11
+ ## Pre-load (before execution)
12
+
13
+ 1. **Codebase docs**: If `.workflow/codebase/ARCHITECTURE.md` exists, read for project context
14
+ 2. **Specs**: `maestro load --type spec --category coding` — load coding conventions
15
+ 3. **Wiki knowledge**: `maestro search "academic writing research paper" --json` — top 5 entries as prior context
16
+ 4. All optional — proceed without if unavailable
17
+
18
+ ## Architecture Overview
19
+
20
+ ```
21
+ scholar-review
22
+ |
23
+ [Preference Collection]
24
+ / \
25
+ Pre-Submission Post-Review
26
+ | / | \
27
+ +-----------+ +--------+--------+---------+
28
+ | Phase 1 | | Phase 2| Phase 3| Phase 4 |
29
+ | Self- | | Review | Response| Rebuttal|
30
+ | Review | | Analysis| Strategy| Writing|
31
+ +-----------+ +--------+--------+---------+
32
+ | \ | /
33
+ v v v v
34
+ self-review- rebuttal-response.md
35
+ report.md |
36
+ v
37
+ +-----------+
38
+ | Phase 5 |
39
+ | Revision |
40
+ +-----------+
41
+ |
42
+ v
43
+ revised-paper
44
+ ```
45
+
46
+ ## Key Design Principles
47
+
48
+ 1. **Mode-driven execution**: Pre-submission triggers Phase 1 only; post-review triggers Phases 2-5 sequentially
49
+ 2. **Evidence-based review**: Every finding must reference specific sections, pages, or line numbers
50
+ 3. **Professional tone**: All rebuttal output follows academic tone guidelines (grateful, respectful, evidence-based)
51
+ 4. **Completeness**: Every reviewer comment must receive a response; no comment is skipped
52
+ 5. **Actionable output**: Each phase produces concrete artifacts, not abstract advice
53
+
54
+ ## Interactive Preference Collection
55
+
56
+ Collect workflow preferences before dispatching to phases:
57
+
58
+ ```
59
+ Ask the user:
60
+
61
+ 1. Review Stage:
62
+ - "Pre-submission self-review" → Execute Phase 1 only
63
+ - "Post-review rebuttal" → Execute Phases 2-5
64
+
65
+ 2. Paper Location:
66
+ - Path to paper file(s) or directory
67
+
68
+ 3. (If post-review) Reviewer Comments Location:
69
+ - Path to reviewer comments file(s)
70
+
71
+ 4. (If post-review) Target Venue:
72
+ - Conference/journal name (e.g., NeurIPS, ICML, ICLR, CVPR, ACL)
73
+ - "Other" with custom venue name
74
+
75
+ 5. Auto Mode:
76
+ - "Interactive (Recommended)" → Confirm at each phase transition
77
+ - "Auto" → Execute all applicable phases without confirmation
78
+
79
+ Store as workflowPreferences:
80
+ - mode: "pre-submission" | "post-review"
81
+ - paperPath: string
82
+ - reviewCommentsPath: string (post-review only)
83
+ - targetVenue: string
84
+ - autoYes: boolean
85
+ ```
86
+
87
+ ## Execution Flow
88
+
89
+ > **COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status.
90
+ > The phase currently marked `in_progress` is the active execution phase -- preserve its FULL content.
91
+ > Only compress phases marked `completed` or `pending`.
92
+
93
+ ### Pre-Submission Mode
94
+
95
+ ```
96
+ Phase 1: Self-Review
97
+ Ref: phases/01-self-review.md
98
+ Input: paperPath, targetVenue
99
+ Output: self-review-report.md
100
+ TodoWrite: Mark Phase 1 in_progress → completed
101
+ ```
102
+
103
+ ### Post-Review Mode
104
+
105
+ ```
106
+ Phase 2: Review Analysis
107
+ Ref: phases/02-review-analysis.md
108
+ Input: reviewCommentsPath, paperPath
109
+ Output: review-analysis.md (classified comments with priorities)
110
+ TodoWrite: Mark Phase 2 in_progress → completed
111
+
112
+ Phase 3: Response Strategy
113
+ Ref: phases/03-response-strategy.md
114
+ Input: review-analysis.md, paperPath
115
+ Output: response-strategy.md (strategy per comment)
116
+ TodoWrite: Mark Phase 3 in_progress → completed
117
+
118
+ Phase 4: Rebuttal Writing
119
+ Ref: phases/04-rebuttal-writing.md
120
+ Input: response-strategy.md, paperPath, targetVenue
121
+ Output: rebuttal-response.md
122
+ TodoWrite: Mark Phase 4 in_progress → completed
123
+
124
+ Phase 5: Revision
125
+ Ref: phases/05-revision.md
126
+ Input: rebuttal-response.md, paperPath
127
+ Output: revision-plan.md, tracked changes list
128
+ TodoWrite: Mark Phase 5 in_progress → completed
129
+ ```
130
+
131
+ **Phase Reference Documents** (read on-demand when phase executes):
132
+
133
+ | Phase | Document | Purpose | Compact |
134
+ |-------|----------|---------|---------|
135
+ | 1 | [phases/01-self-review.md](phases/01-self-review.md) | Pre-submission quality check | TodoWrite driven |
136
+ | 2 | [phases/02-review-analysis.md](phases/02-review-analysis.md) | Parse and classify reviewer comments | TodoWrite driven |
137
+ | 3 | [phases/03-response-strategy.md](phases/03-response-strategy.md) | Plan rebuttal strategy per comment | TodoWrite driven + sentinel |
138
+ | 4 | [phases/04-rebuttal-writing.md](phases/04-rebuttal-writing.md) | Write structured rebuttal document | TodoWrite driven + sentinel |
139
+ | 5 | [phases/05-revision.md](phases/05-revision.md) | Plan and track paper revisions | TodoWrite driven |
140
+
141
+ **Compact Rules**:
142
+ 1. **TodoWrite `in_progress`** -> Preserve full content, do not compress
143
+ 2. **TodoWrite `completed`** -> May compress to summary
144
+ 3. **Sentinel fallback** -> Phases marked with sentinel contain compact sentinels; if only sentinel remains without full Step protocol, immediately `Read()` to recover
145
+
146
+ ## Core Rules
147
+
148
+ 1. **Read paper first**: Always read the full paper before any review or analysis
149
+ 2. **Classify before responding**: Never write rebuttals without completing review analysis and strategy
150
+ 3. **No skipped comments**: Every reviewer comment must have a response entry
151
+ 4. **Venue-aware tone**: Adjust strategy and emphasis based on target venue conventions
152
+ 5. **Preserve reviewer numbering**: Maintain original reviewer IDs and comment numbering throughout
153
+
154
+ ## Input Processing
155
+
156
+ ```
157
+ User input → Structured format:
158
+
159
+ PAPER: [path to paper files]
160
+ MODE: [pre-submission | post-review]
161
+ REVIEWS: [path to reviewer comments] (post-review only)
162
+ VENUE: [target conference/journal]
163
+ OUTPUT_DIR: [directory for generated documents]
164
+ ```
165
+
166
+ ## Data Flow
167
+
168
+ ```
169
+ paperPath ──────────────────────────────────────────────────┐
170
+ │ │
171
+ v │
172
+ Phase 1: self-review-report.md │
173
+ (Pre-submission mode ends here) │
174
+
175
+ reviewCommentsPath ─── Phase 2: review-analysis.md ──────────┤
176
+ │ │
177
+ v │
178
+ Phase 3: response-strategy.md ───────────┤
179
+ │ │
180
+ v │
181
+ Phase 4: rebuttal-response.md ───────────┤
182
+ │ │
183
+ v │
184
+ Phase 5: revision-plan.md ────── paperPath
185
+ ```
186
+
187
+ ## TodoWrite Pattern
188
+
189
+ ### Phase Attachment (entering phase)
190
+ ```
191
+ TodoWrite([
192
+ { id: "phase-N", task: "Phase N: [name]", status: "in_progress" },
193
+ { id: "phase-N-step-1", task: " Step N.1: [name]", status: "pending" },
194
+ { id: "phase-N-step-2", task: " Step N.2: [name]", status: "pending" }
195
+ ])
196
+ ```
197
+
198
+ ### Phase Collapse (exiting phase)
199
+ ```
200
+ TodoWrite([
201
+ { id: "phase-N", task: "Phase N: [name] -- Done", status: "completed" },
202
+ { id: "phase-N+1", task: "Phase N+1: [name]", status: "in_progress" }
203
+ ])
204
+ ```
205
+
206
+ ## Error Handling
207
+
208
+ 1. **Paper not found**: Ask user to confirm paper path, retry once
209
+ 2. **Reviews not parseable**: Ask user to reformat or paste reviews directly
210
+ 3. **Phase failure**: Log error, ask user whether to retry or skip to next phase
211
+ 4. **Venue unknown**: Fall back to generic academic review conventions
212
+
213
+ ## Coordinator Checklist
214
+
215
+ ### Before Each Phase
216
+ - [ ] Confirm input files exist and are readable
217
+ - [ ] TodoWrite updated: current phase `in_progress`
218
+ - [ ] Read phase document via `Ref:` marker
219
+
220
+ ### After Each Phase
221
+ - [ ] Output file generated and saved
222
+ - [ ] TodoWrite updated: current phase `completed`
223
+ - [ ] If not autoYes, confirm with user before next phase
224
+
225
+ ### Post-Workflow
226
+ - [ ] All output files listed for user
227
+ - [ ] Summary of findings/actions presented
@@ -0,0 +1,111 @@
1
+ # thesis-docx.skill
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-16a34a)](./LICENSE)
4
+ [![Word](https://img.shields.io/badge/Microsoft_Word-Recommended-185ABD)](#运行前提)
5
+ [![Mermaid](https://img.shields.io/badge/Mermaid-Supported-0ea5e9)](#功能)
6
+
7
+ **语言 / Language**:**中文** | [English](./README_EN.md)
8
+
9
+ `thesis-docx` 是一个面向毕业论文 / 学位论文场景的 skill。
10
+
11
+ 它的重点不是“批量改 Word”,而是让 AI 在论文文档上按更稳的顺序工作:
12
+
13
+ 1. 先检查 Word 自动化环境
14
+ 2. 先审计,再决定怎么改
15
+ 3. 学校明确规定的格式严格执行
16
+ 4. 学校没规定的格式默认保留现状
17
+ 5. 最后导出 PDF 逐页复核
18
+
19
+ ## 功能
20
+
21
+ - 修订 thesis / dissertation Word 文档
22
+ - 统一正文、标题、图题注、表题注、参考文献等样式
23
+ - 修复目录、页码、分节、交叉引用、图表编号
24
+ - 生成基于真实材料的 Mermaid 图
25
+ - 生成适合论文使用的代码片段或伪代码,LaTeX排版
26
+ - 审计 OOXML 隐藏问题,例如:
27
+ - `styleId`
28
+ - `firstLineChars`
29
+ - `titlePg`
30
+ - REF 域显示值
31
+ - section 级页眉页脚引用
32
+
33
+ ## 运行前提
34
+
35
+ - Windows 下建议安装桌面版 Microsoft Word
36
+ - Python 脚本建议环境具备:
37
+ - `python-docx`
38
+ - `lxml`
39
+ - Mermaid 渲染建议具备:
40
+ - Node.js
41
+ - `mmdc` 或可用的 `npx`
42
+
43
+ ## 快速开始
44
+
45
+ ```powershell
46
+ # 1) 检查 Word COM/DOM 是否可用
47
+ powershell -ExecutionPolicy Bypass -File scripts/check_word_com.ps1 -Json
48
+
49
+ # 2) 先做 OOXML 审计
50
+ python scripts/audit_docx_ooxml.py .\draft.docx --output_json .\draft.audit.json --output_txt .\draft.audit.txt
51
+
52
+ # 3) 如有需要,先 dry-run 审计样式归一化
53
+ powershell -ExecutionPolicy Bypass -File scripts/normalize_word_styles.ps1 -InputPath .\draft.docx -AuditOnly
54
+
55
+ # 4) 真正修完后导出 PDF,逐页复核
56
+ powershell -ExecutionPolicy Bypass -File scripts/export_word_pdf.ps1 -DocPath .\draft.docx -PdfPath .\draft.audit.pdf
57
+ ```
58
+
59
+ ## 使用原则
60
+
61
+ - 先审计,再修复
62
+ - 先修学校明确要求,再处理用户自定义要求
63
+ - 不对未规定区域做“全局统一美化”
64
+ - 图、代码、架构、流程都必须基于真实材料
65
+ - 没做 PDF 逐页复核时,不应直接说“格式已全部完成”
66
+
67
+ ## 仓库结构
68
+
69
+ ```text
70
+ .
71
+ ├── agents/
72
+ ├── SKILL.md
73
+ ├── scripts/
74
+ ├── references/
75
+ ├── examples/
76
+ ├── README.md
77
+ ├── README_EN.md
78
+ └── LICENSE
79
+ ```
80
+
81
+ ## 关键文件
82
+
83
+ - `SKILL.md`:主说明
84
+ - `agents/openai.yaml`:界面集成元数据
85
+ - `scripts/check_word_com.ps1`:检查 Word COM/DOM
86
+ - `scripts/audit_docx_ooxml.py`:审计 DOCX / OOXML 隐藏问题
87
+ - `scripts/normalize_word_styles.ps1`:批量样式归一化
88
+ - `scripts/export_word_pdf.ps1`:导出 PDF 做逐页审计
89
+ - `scripts/render_mermaid_figure.ps1`:渲染 Mermaid 图
90
+ - `references/paper-format-workflow.md`:论文格式工作流
91
+ - `references/failure-patterns-and-quality-gates.md`:高风险坑与质量门槛
92
+ - `references/script-usage.md`:脚本使用说明
93
+
94
+ ## 安装
95
+
96
+ ```powershell
97
+ git clone https://github.com/the-shy123456/thesis-docx.git
98
+ ```
99
+
100
+ 保持仓库目录完整即可,不需要拆文件。
101
+
102
+ ## Star 趋势
103
+
104
+ [![Star History Chart](https://api.star-history.com/svg?repos=the-shy123456/thesis-docx&type=Date)](https://www.star-history.com/#the-shy123456/thesis-docx&Date)
105
+
106
+ ## License
107
+
108
+ MIT
109
+ ## 社区
110
+
111
+ - [LINUX DO 社区](https://linux.do)
@@ -0,0 +1,108 @@
1
+ # thesis-docx
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-16a34a)](./LICENSE)
4
+ [![Word](https://img.shields.io/badge/Microsoft_Word-Recommended-185ABD)](#runtime-requirements)
5
+ [![Mermaid](https://img.shields.io/badge/Mermaid-Supported-0ea5e9)](#features)
6
+
7
+ **Language**: [中文](./README.md) | **English**
8
+
9
+ `thesis-docx` is a skill for thesis and dissertation Word workflows.
10
+
11
+ Its purpose is not merely bulk formatting. The intended workflow is:
12
+
13
+ 1. check Word automation first
14
+ 2. audit before editing
15
+ 3. strictly enforce school-defined rules
16
+ 4. preserve formatting that the school guide does not define
17
+ 5. export to PDF and review page by page
18
+
19
+ ## Features
20
+
21
+ - revise thesis / dissertation Word documents
22
+ - normalize body text, headings, figure captions, table captions, and references
23
+ - fix TOC, page numbers, sections, cross-references, and caption numbering
24
+ - generate Mermaid figures from real source material
25
+ - prepare thesis-friendly code excerpts or pseudocode
26
+ - audit hidden OOXML issues such as:
27
+ - `styleId`
28
+ - `firstLineChars`
29
+ - `titlePg`
30
+ - REF field display text
31
+ - section-level header/footer references
32
+
33
+ ## Runtime Requirements
34
+
35
+ - desktop Microsoft Word is strongly recommended on Windows
36
+ - Python scripts typically expect:
37
+ - `python-docx`
38
+ - `lxml`
39
+ - Mermaid rendering typically expects:
40
+ - Node.js
41
+ - `mmdc` or a usable `npx`
42
+
43
+ ## Quick Start
44
+
45
+ ```powershell
46
+ # 1) Check Word COM/DOM availability
47
+ powershell -ExecutionPolicy Bypass -File scripts/check_word_com.ps1 -Json
48
+
49
+ # 2) Audit DOCX / OOXML first
50
+ python scripts/audit_docx_ooxml.py .\draft.docx --output_json .\draft.audit.json --output_txt .\draft.audit.txt
51
+
52
+ # 3) Dry-run style normalization first
53
+ powershell -ExecutionPolicy Bypass -File scripts/normalize_word_styles.ps1 -InputPath .\draft.docx -AuditOnly
54
+
55
+ # 4) Export to PDF for page-by-page review
56
+ powershell -ExecutionPolicy Bypass -File scripts/export_word_pdf.ps1 -DocPath .\draft.docx -PdfPath .\draft.audit.pdf
57
+ ```
58
+
59
+ ## Working Rules
60
+
61
+ - audit first, fix second
62
+ - prioritize school rules over local preferences
63
+ - do not globally normalize unspecified formatting
64
+ - keep figures, architecture, and code grounded in real materials
65
+ - do not claim completion before PDF-level review
66
+
67
+ ## Repository Layout
68
+
69
+ ```text
70
+ .
71
+ ├── agents/
72
+ ├── SKILL.md
73
+ ├── scripts/
74
+ ├── references/
75
+ ├── examples/
76
+ ├── README.md
77
+ ├── README_EN.md
78
+ └── LICENSE
79
+ ```
80
+
81
+ ## Key Files
82
+
83
+ - `SKILL.md`: main instructions
84
+ - `agents/openai.yaml`: UI-facing metadata
85
+ - `scripts/check_word_com.ps1`: check Word COM/DOM availability
86
+ - `scripts/audit_docx_ooxml.py`: audit hidden DOCX / OOXML issues
87
+ - `scripts/normalize_word_styles.ps1`: batch style normalization
88
+ - `scripts/export_word_pdf.ps1`: export PDF for page review
89
+ - `scripts/render_mermaid_figure.ps1`: render Mermaid figures
90
+ - `references/paper-format-workflow.md`: thesis formatting workflow
91
+ - `references/failure-patterns-and-quality-gates.md`: common failure modes and quality gates
92
+ - `references/script-usage.md`: script examples and usage notes
93
+
94
+ ## Installation
95
+
96
+ ```powershell
97
+ git clone https://github.com/the-shy123456/thesis-docx.git
98
+ ```
99
+
100
+ Keep the repository structure intact.
101
+
102
+ ## Star History
103
+
104
+ [![Star History Chart](https://api.star-history.com/svg?repos=the-shy123456/thesis-docx&type=Date)](https://www.star-history.com/#the-shy123456/thesis-docx&Date)
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: thesis-docx
3
+ description: "Create, revise, and format thesis or dissertation Word documents with strict academic formatting control. Use when an AI agent needs to generate or revise thesis content, normalize Word styles, follow a school template, fix captions or page numbers or section levels, or produce evidence-based Mermaid figures and LaTeX-formatted code listings for a thesis document."
4
+ ---
5
+
6
+ # Thesis DOCX
7
+
8
+ ## Overview
9
+
10
+ Use this skill for thesis-oriented `.docx` work where content quality and
11
+ format fidelity both matter. Prefer Microsoft Word desktop automation over
12
+ WPS-like alternatives whenever the task involves batch formatting, styles,
13
+ captions, pagination, tables of contents, or cross-references.
14
+
15
+ This skill is designed to avoid the most common thesis-editing failure mode:
16
+ the agent makes broad formatting changes too early, introduces new layout
17
+ problems, and then forces the user to catch them one by one. The default
18
+ behavior should therefore be:
19
+
20
+ 1. audit first,
21
+ 2. separate explicit school requirements from unspecified formatting,
22
+ 3. fix only what is justified,
23
+ 4. re-check page by page before claiming completion.
24
+
25
+ ## Pre-load (before execution)
26
+
27
+ 1. **Codebase docs**: If `.workflow/codebase/ARCHITECTURE.md` exists, read for project context
28
+ 2. **Specs**: `maestro load --type spec --category coding` — load coding conventions
29
+ 3. **Wiki knowledge**: `maestro search "thesis academic writing docx formatting" --json` — top 5 entries as prior context
30
+ 4. All optional — proceed without if unavailable
31
+
32
+ ## Workflow
33
+
34
+ 1. Check Microsoft Word and COM/DOM automation first.
35
+ - On Windows, run:
36
+ ```powershell
37
+ powershell -ExecutionPolicy Bypass -File scripts/check_word_com.ps1 -Json
38
+ ```
39
+ - If Word is missing, COM is unavailable, or DOM access fails:
40
+ - Stop the automation-heavy plan.
41
+ - Tell the user to install desktop Microsoft Word.
42
+ - Explain briefly that WPS or similar tools are likely to degrade layout
43
+ fidelity for thesis formatting.
44
+ 2. Read the user's real constraints before editing.
45
+ - Collect the thesis template, school formatting guide, screenshots,
46
+ existing document, sample pages, and any explicit chapter rules.
47
+ - If the user gave formal requirements, follow them strictly.
48
+ - If the user did not give requirements, do not invent school-specific
49
+ standards. Use conservative academic defaults and say that they are
50
+ defaults.
51
+ - Explicitly classify requirements into two buckets before editing:
52
+ - `must enforce`: school guide, template, user-confirmed style rules
53
+ - `preserve current state`: anything the school guide does not define
54
+ 3. Audit the DOCX / OOXML before risky bulk edits.
55
+ - Prefer `scripts/audit_docx_ooxml.py` before large-scale formatting.
56
+ - Use it to detect hidden indentation, section drift, stale REF display
57
+ text, and style-ID mismatches before deciding on a repair strategy.
58
+ 4. Standardize with styles, not scattered direct formatting.
59
+ - Reuse and repair existing styles whenever possible.
60
+ - Create missing styles only when no matching style exists.
61
+ - Keep body text, headings, figure captions, table captions, references,
62
+ abstract, and appendix styles separate and consistent.
63
+ - Before changing any style globally, inspect whether the document contains
64
+ direct paragraph formatting or OOXML overrides that will survive the style
65
+ change.
66
+ 5. Edit content only from user-provided facts.
67
+ - Expand, polish, or reorganize thesis text only within the user's topic,
68
+ evidence, codebase, notes, or source material.
69
+ - Do not invent experimental data, system structure, entities, or results.
70
+ 6. Generate figures only when the source material is sufficient.
71
+ - Use Mermaid for architecture diagrams, E-R diagrams, flow charts, state
72
+ diagrams, and similar thesis figures.
73
+ - Base every node, field, relation, and dependency on real materials from
74
+ the user, such as code, SQL schema, API docs, project docs, or the thesis
75
+ draft itself.
76
+ - If the materials are insufficient, refuse to fabricate the figure and ask
77
+ for the missing source information.
78
+ 7. Typeset code with LaTeX conventions when thesis code excerpts are needed.
79
+ - Keep only the code relevant to the argument.
80
+ - Preserve real identifiers from the user's code or design.
81
+ - Avoid synthetic filler code written only to look complete.
82
+ 8. Audit before you claim completion.
83
+ - Run a structure audit first: styles, sections, captions, references,
84
+ page number scheme, cross-references, hidden paragraph overrides.
85
+ - Then export the document to PDF from Word and review page by page.
86
+ - Only say the task is complete after the PDF-level audit passes or after
87
+ you clearly state the remaining manual visual checks.
88
+
89
+ ## Style Strategy
90
+
91
+ - Treat styles as the single source of truth for formatting.
92
+ - Prefer these logical style buckets:
93
+ - `Body Text`
94
+ - `Heading 1` / `Heading 2` / `Heading 3`
95
+ - `Figure Caption`
96
+ - `Table Caption`
97
+ - `References`
98
+ - `Abstract`
99
+ - `Keywords`
100
+ - `Appendix Title`
101
+ - If the document already has equivalent styles, map to them and normalize
102
+ their font, spacing, indentation, and numbering behavior.
103
+ - If direct formatting conflicts with styles, reduce the direct formatting and
104
+ bring the document back under style control.
105
+ - Do not globally normalize sections that the school guide does not specify.
106
+ Examples of high-risk overreach:
107
+ - page header/footer redesign when the user only asked for headings
108
+ - changing code box appearance when the task is only about references
109
+ - normalizing table internals when the school guide does not regulate them
110
+ - When a visual issue remains after style normalization, inspect hidden OOXML
111
+ state such as `firstLineChars`, numbering indentation, `titlePg`,
112
+ `differentFirstPageHeaderFooter`, REF field display text, and direct run
113
+ formatting.
114
+
115
+ ## Audit-First Discipline
116
+
117
+ Before bulk editing, produce and internally follow a checklist like this:
118
+
119
+ 1. Which parts are explicitly regulated by the school guide?
120
+ 2. Which parts are user-defined house rules?
121
+ 3. Which parts are currently acceptable and must be preserved?
122
+ 4. Which problems are structural vs. visual-only?
123
+ 5. Which fixes can be done safely through styles?
124
+ 6. Which fixes require Word COM or OOXML-level patching?
125
+
126
+ Do not say "finished" merely because a structural audit looks good. For thesis
127
+ work, pagination and page-level rendering are part of correctness.
128
+
129
+ ## High-Risk Pitfalls
130
+
131
+ Read `references/failure-patterns-and-quality-gates.md` before large-scale
132
+ formatting work. In particular, guard against:
133
+
134
+ - style names that look correct but map to the wrong style IDs
135
+ - paragraph-level direct formatting that overrides the intended style
136
+ - `firstLineChars` or numbering indentation creating invisible extra indents
137
+ - TOC fields or cross-reference fields showing stale display text
138
+ - section-level first-page settings causing missing headers or page numbers
139
+ - Word vs. WPS differences for table row height, vertical alignment, and code
140
+ box title clipping
141
+ - punctuation normalization that accidentally rewrites DOI, URLs, code, or
142
+ English references
143
+
144
+ ## Visual Review Rule
145
+
146
+ For school-format-sensitive thesis work, final verification should prefer this
147
+ order:
148
+
149
+ 1. Word COM/DOM structural checks
150
+ 2. Word export to PDF
151
+ 3. page-by-page PDF review
152
+ 4. only then final delivery language
153
+
154
+ If page rendering cannot be verified, say so explicitly instead of implying the
155
+ formatting is fully validated.
156
+
157
+ ## Figure Rules
158
+
159
+ - Use Mermaid when a thesis figure is needed and the structure can be traced to
160
+ real source material.
161
+ - Keep the diagram academically neutral and concise.
162
+ - Avoid decorative labels, chatty callouts, and speculative entities.
163
+ - Match the user's terminology unless it conflicts with the real materials.
164
+ - Read `references/figure-and-code-rules.md` before generating diagrams.
165
+
166
+ ## Code Listing Rules
167
+
168
+ - Prefer LaTeX-oriented code presentation when the thesis includes code
169
+ listings.
170
+ - Keep the listing faithful to the actual code.
171
+ - Trim non-essential boilerplate when it does not support the thesis argument.
172
+ - If the user requests a specific LaTeX package or listing style, follow it.
173
+
174
+ ## Resource Guide
175
+
176
+ - `scripts/check_word_com.ps1`
177
+ - Detect whether Microsoft Word desktop and COM/DOM automation are available.
178
+ - `scripts/audit_docx_ooxml.py`
179
+ - Audit DOCX styles, direct indentation, section settings, numbering, and REF
180
+ field behavior before making risky formatting changes.
181
+ - `scripts/normalize_word_styles.ps1`
182
+ - Batch-normalize thesis body text, Heading 1-3, figure captions, and table
183
+ captions through Word COM automation.
184
+ - `scripts/export_word_pdf.ps1`
185
+ - Export the current thesis document to PDF through Word COM for page-level
186
+ review.
187
+ - `scripts/render_mermaid_figure.ps1`
188
+ - Render Mermaid source into thesis-ready SVG, PNG, or PDF figure assets.
189
+ - `references/paper-format-workflow.md`
190
+ - Read for the standard Word thesis formatting workflow.
191
+ - `references/figure-and-code-rules.md`
192
+ - Read before generating Mermaid figures or LaTeX code listings.
193
+ - `references/failure-patterns-and-quality-gates.md`
194
+ - Read before large-scale formatting or before claiming the thesis is fully
195
+ checked.
196
+ - `references/script-usage.md`
197
+ - Read for command examples and config file conventions.
198
+
199
+ ## Final Checks
200
+
201
+ - Confirm the document is still style-driven after edits.
202
+ - Confirm captions, numbering, page breaks, and table of contents are coherent.
203
+ - Confirm cross-references display the current target labels, not stale field
204
+ text.
205
+ - Confirm section settings do not silently remove page headers or page numbers
206
+ from first pages.
207
+ - Confirm references are formatted according to the school rules and that
208
+ punctuation normalization did not damage DOI or English references.
209
+ - Confirm every diagram and code block is grounded in user-provided material.
210
+ - Export to PDF and inspect every page before saying the format is complete.
211
+ - If Word automation or PDF verification was unavailable, explicitly warn that
212
+ layout fidelity was not guaranteed.