zcode-app-cli 3.3.5-1

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 (169) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +642 -0
  3. package/bin/zcode.js +848 -0
  4. package/config.example.json +110 -0
  5. package/package.json +81 -0
  6. package/vendor/.node-bundle-meta.json +6 -0
  7. package/vendor/extraction.json +11 -0
  8. package/vendor/node_modules/@zcode/tui/dist/index.js +161875 -0
  9. package/vendor/node_modules/@zcode/tui/package.json +14 -0
  10. package/vendor/packages/android-emulator-plugin/.mcp.json +19 -0
  11. package/vendor/packages/android-emulator-plugin/.zcode-plugin/plugin.json +63 -0
  12. package/vendor/packages/android-emulator-plugin/README.md +134 -0
  13. package/vendor/packages/android-emulator-plugin/commands/android-dev.md +11 -0
  14. package/vendor/packages/android-emulator-plugin/dist/lib/path.d.ts +4 -0
  15. package/vendor/packages/android-emulator-plugin/dist/lib/path.js +17 -0
  16. package/vendor/packages/android-emulator-plugin/dist/lib/result.d.ts +5 -0
  17. package/vendor/packages/android-emulator-plugin/dist/lib/result.js +22 -0
  18. package/vendor/packages/android-emulator-plugin/dist/lib/run.d.ts +18 -0
  19. package/vendor/packages/android-emulator-plugin/dist/lib/run.js +99 -0
  20. package/vendor/packages/android-emulator-plugin/dist/mcp/server.d.ts +3 -0
  21. package/vendor/packages/android-emulator-plugin/dist/mcp/server.js +47607 -0
  22. package/vendor/packages/android-emulator-plugin/dist/providers/app.d.ts +39 -0
  23. package/vendor/packages/android-emulator-plugin/dist/providers/app.js +50 -0
  24. package/vendor/packages/android-emulator-plugin/dist/providers/avd.d.ts +37 -0
  25. package/vendor/packages/android-emulator-plugin/dist/providers/avd.js +185 -0
  26. package/vendor/packages/android-emulator-plugin/dist/providers/build.d.ts +68 -0
  27. package/vendor/packages/android-emulator-plugin/dist/providers/build.js +131 -0
  28. package/vendor/packages/android-emulator-plugin/dist/providers/config.d.ts +7 -0
  29. package/vendor/packages/android-emulator-plugin/dist/providers/config.js +29 -0
  30. package/vendor/packages/android-emulator-plugin/dist/providers/device.d.ts +20 -0
  31. package/vendor/packages/android-emulator-plugin/dist/providers/device.js +91 -0
  32. package/vendor/packages/android-emulator-plugin/dist/providers/logs.d.ts +15 -0
  33. package/vendor/packages/android-emulator-plugin/dist/providers/logs.js +31 -0
  34. package/vendor/packages/android-emulator-plugin/dist/providers/preflight.d.ts +15 -0
  35. package/vendor/packages/android-emulator-plugin/dist/providers/preflight.js +123 -0
  36. package/vendor/packages/android-emulator-plugin/dist/providers/project-template.d.ts +13 -0
  37. package/vendor/packages/android-emulator-plugin/dist/providers/project-template.js +211 -0
  38. package/vendor/packages/android-emulator-plugin/dist/providers/project.d.ts +33 -0
  39. package/vendor/packages/android-emulator-plugin/dist/providers/project.js +195 -0
  40. package/vendor/packages/android-emulator-plugin/dist/providers/screenshot.d.ts +14 -0
  41. package/vendor/packages/android-emulator-plugin/dist/providers/screenshot.js +73 -0
  42. package/vendor/packages/android-emulator-plugin/dist/providers/sdk.d.ts +14 -0
  43. package/vendor/packages/android-emulator-plugin/dist/providers/sdk.js +185 -0
  44. package/vendor/packages/android-emulator-plugin/dist/providers/ui.d.ts +92 -0
  45. package/vendor/packages/android-emulator-plugin/dist/providers/ui.js +146 -0
  46. package/vendor/packages/android-emulator-plugin/hooks/hooks.json +3 -0
  47. package/vendor/packages/android-emulator-plugin/package.json +35 -0
  48. package/vendor/packages/android-emulator-plugin/skills/android-dev/INSTALL_ENVIRONMENT.md +357 -0
  49. package/vendor/packages/android-emulator-plugin/skills/android-dev/SKILL.md +73 -0
  50. package/vendor/packages/android-emulator-plugin/templates/compose-app/README.md +5 -0
  51. package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +8 -0
  52. package/vendor/packages/document-skills-plugin/package.json +8 -0
  53. package/vendor/packages/document-skills-plugin/skills/docx/LICENSE.txt +13 -0
  54. package/vendor/packages/document-skills-plugin/skills/docx/SKILL.md +201 -0
  55. package/vendor/packages/document-skills-plugin/skills/docx/references/chart-templates.md +386 -0
  56. package/vendor/packages/document-skills-plugin/skills/docx/references/common-rules.md +419 -0
  57. package/vendor/packages/document-skills-plugin/skills/docx/references/decorations.md +537 -0
  58. package/vendor/packages/document-skills-plugin/skills/docx/references/design-system.md +1797 -0
  59. package/vendor/packages/document-skills-plugin/skills/docx/references/docx-js-advanced.md +257 -0
  60. package/vendor/packages/document-skills-plugin/skills/docx/references/docx-js-core.md +332 -0
  61. package/vendor/packages/document-skills-plugin/skills/docx/references/faq.md +323 -0
  62. package/vendor/packages/document-skills-plugin/skills/docx/references/math-formulas.md +276 -0
  63. package/vendor/packages/document-skills-plugin/skills/docx/references/ooxml.md +222 -0
  64. package/vendor/packages/document-skills-plugin/skills/docx/references/toc.md +264 -0
  65. package/vendor/packages/document-skills-plugin/skills/docx/routes/comment.md +88 -0
  66. package/vendor/packages/document-skills-plugin/skills/docx/routes/create.md +207 -0
  67. package/vendor/packages/document-skills-plugin/skills/docx/routes/edit.md +115 -0
  68. package/vendor/packages/document-skills-plugin/skills/docx/routes/format.md +120 -0
  69. package/vendor/packages/document-skills-plugin/skills/docx/routes/read.md +114 -0
  70. package/vendor/packages/document-skills-plugin/skills/docx/scenes/academic.md +783 -0
  71. package/vendor/packages/document-skills-plugin/skills/docx/scenes/contract.md +463 -0
  72. package/vendor/packages/document-skills-plugin/skills/docx/scenes/copywriting.md +139 -0
  73. package/vendor/packages/document-skills-plugin/skills/docx/scenes/exam.md +698 -0
  74. package/vendor/packages/document-skills-plugin/skills/docx/scenes/official-doc.md +411 -0
  75. package/vendor/packages/document-skills-plugin/skills/docx/scenes/report.md +340 -0
  76. package/vendor/packages/document-skills-plugin/skills/docx/scenes/resume.md +534 -0
  77. package/vendor/packages/document-skills-plugin/skills/docx/scripts/__init__.py +1 -0
  78. package/vendor/packages/document-skills-plugin/skills/docx/scripts/add_toc_placeholders.py +749 -0
  79. package/vendor/packages/document-skills-plugin/skills/docx/scripts/document.py +1333 -0
  80. package/vendor/packages/document-skills-plugin/skills/docx/scripts/postcheck.py +807 -0
  81. package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/comments.xml +3 -0
  82. package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  83. package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  84. package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/commentsIds.xml +3 -0
  85. package/vendor/packages/document-skills-plugin/skills/docx/scripts/templates/people.xml +3 -0
  86. package/vendor/packages/document-skills-plugin/skills/docx/scripts/utilities.py +374 -0
  87. package/vendor/packages/document-skills-plugin/skills/docx/setup.sh +177 -0
  88. package/vendor/packages/document-skills-plugin/skills/pdf/LICENSE.txt +13 -0
  89. package/vendor/packages/document-skills-plugin/skills/pdf/SKILL.md +919 -0
  90. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/academic.md +1058 -0
  91. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/creative.md +770 -0
  92. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/poster.md +702 -0
  93. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process-advanced.md +284 -0
  94. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/process.md +319 -0
  95. package/vendor/packages/document-skills-plugin/skills/pdf/briefs/report.md +1659 -0
  96. package/vendor/packages/document-skills-plugin/skills/pdf/configs/components.md +153 -0
  97. package/vendor/packages/document-skills-plugin/skills/pdf/configs/fonts.md +93 -0
  98. package/vendor/packages/document-skills-plugin/skills/pdf/configs/visual_framework.md +263 -0
  99. package/vendor/packages/document-skills-plugin/skills/pdf/references/resume-academic.tex +130 -0
  100. package/vendor/packages/document-skills-plugin/skills/pdf/references/resume-altacv.tex +190 -0
  101. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/cover_validate.js +367 -0
  102. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/design_engine.py +2816 -0
  103. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2pdf-next.js +754 -0
  104. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/html2poster.js +256 -0
  105. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf.py +2959 -0
  106. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/pdf_qa.py +901 -0
  107. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/poster_validate.py +1337 -0
  108. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/setup.sh +269 -0
  109. package/vendor/packages/document-skills-plugin/skills/pdf/scripts/toc_validate.py +2075 -0
  110. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/charts.md +320 -0
  111. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover-backgrounds.md +384 -0
  112. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/cover.md +1442 -0
  113. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/fill-engine.md +527 -0
  114. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/geometry.md +142 -0
  115. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/overflow.md +630 -0
  116. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/pagination.md +367 -0
  117. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/palette.md +217 -0
  118. package/vendor/packages/document-skills-plugin/skills/pdf/typesetting/typography.md +20 -0
  119. package/vendor/packages/ios-simulator-plugin/.mcp.json +15 -0
  120. package/vendor/packages/ios-simulator-plugin/.zcode-plugin/plugin.json +34 -0
  121. package/vendor/packages/ios-simulator-plugin/README.md +111 -0
  122. package/vendor/packages/ios-simulator-plugin/commands/ios-dev.md +11 -0
  123. package/vendor/packages/ios-simulator-plugin/dist/lib/path.d.ts +4 -0
  124. package/vendor/packages/ios-simulator-plugin/dist/lib/path.js +18 -0
  125. package/vendor/packages/ios-simulator-plugin/dist/lib/result.d.ts +5 -0
  126. package/vendor/packages/ios-simulator-plugin/dist/lib/result.js +20 -0
  127. package/vendor/packages/ios-simulator-plugin/dist/lib/run.d.ts +17 -0
  128. package/vendor/packages/ios-simulator-plugin/dist/lib/run.js +83 -0
  129. package/vendor/packages/ios-simulator-plugin/dist/mcp/server.d.ts +3 -0
  130. package/vendor/packages/ios-simulator-plugin/dist/mcp/server.js +46833 -0
  131. package/vendor/packages/ios-simulator-plugin/dist/providers/build.d.ts +112 -0
  132. package/vendor/packages/ios-simulator-plugin/dist/providers/build.js +99 -0
  133. package/vendor/packages/ios-simulator-plugin/dist/providers/logs.d.ts +21 -0
  134. package/vendor/packages/ios-simulator-plugin/dist/providers/logs.js +26 -0
  135. package/vendor/packages/ios-simulator-plugin/dist/providers/preflight.d.ts +12 -0
  136. package/vendor/packages/ios-simulator-plugin/dist/providers/preflight.js +62 -0
  137. package/vendor/packages/ios-simulator-plugin/dist/providers/project.d.ts +35 -0
  138. package/vendor/packages/ios-simulator-plugin/dist/providers/project.js +288 -0
  139. package/vendor/packages/ios-simulator-plugin/dist/providers/screenshot.d.ts +22 -0
  140. package/vendor/packages/ios-simulator-plugin/dist/providers/screenshot.js +30 -0
  141. package/vendor/packages/ios-simulator-plugin/dist/providers/sim.d.ts +60 -0
  142. package/vendor/packages/ios-simulator-plugin/dist/providers/sim.js +116 -0
  143. package/vendor/packages/ios-simulator-plugin/dist/providers/ui.d.ts +57 -0
  144. package/vendor/packages/ios-simulator-plugin/dist/providers/ui.js +67 -0
  145. package/vendor/packages/ios-simulator-plugin/hooks/hooks.json +3 -0
  146. package/vendor/packages/ios-simulator-plugin/package.json +35 -0
  147. package/vendor/packages/ios-simulator-plugin/skills/ios-dev/SKILL.md +45 -0
  148. package/vendor/packages/ios-simulator-plugin/templates/swiftui-app/README.md +5 -0
  149. package/vendor/packages/restore-legacy-sessions-plugin/.zcode-plugin/plugin.json +9 -0
  150. package/vendor/packages/restore-legacy-sessions-plugin/README.md +35 -0
  151. package/vendor/packages/restore-legacy-sessions-plugin/commands/restore-legacy-sessions.md +11 -0
  152. package/vendor/packages/restore-legacy-sessions-plugin/package.json +8 -0
  153. package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/SKILL.md +92 -0
  154. package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/scripts/restore-conversation.mjs +648 -0
  155. package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/scripts/scan-legacy-sessions.mjs +422 -0
  156. package/vendor/packages/skill-creator-plugin/.zcode-plugin/plugin.json +8 -0
  157. package/vendor/packages/skill-creator-plugin/package.json +8 -0
  158. package/vendor/packages/skill-creator-plugin/skills/skill-creator/SKILL.md +159 -0
  159. package/vendor/packages/zcode-guide-plugin/.zcode-plugin/plugin.json +8 -0
  160. package/vendor/packages/zcode-guide-plugin/README.md +22 -0
  161. package/vendor/packages/zcode-guide-plugin/package.json +8 -0
  162. package/vendor/packages/zcode-guide-plugin/skills/diagnosing-commands/SKILL.md +66 -0
  163. package/vendor/packages/zcode-guide-plugin/skills/diagnosing-hooks/SKILL.md +66 -0
  164. package/vendor/packages/zcode-guide-plugin/skills/diagnosing-mcp/SKILL.md +97 -0
  165. package/vendor/packages/zcode-guide-plugin/skills/diagnosing-plugins/SKILL.md +59 -0
  166. package/vendor/packages/zcode-guide-plugin/skills/diagnosing-skills/SKILL.md +61 -0
  167. package/vendor/packages/zcode-guide-plugin/skills/zcode-configuration-guide/SKILL.md +99 -0
  168. package/vendor/zcode.cjs +2926 -0
  169. package/zcode-runtime.lock.json +8 -0
@@ -0,0 +1,698 @@
1
+ # Scene: Exam Paper
2
+
3
+ ## Overview
4
+
5
+ Exam papers are among the most critical document types in education. Unlike general documents, they require high precision in layout, print compatibility, and subject-specific formatting. This specification covers the complete workflow from page framework to subject-specific features.
6
+
7
+ → Universal prohibitions — see `references/common-rules.md`
8
+ → **Note:** Exam papers use their OWN font/layout specs (not Profile A defaults). All text is pure black/white/grey for photocopy clarity.
9
+
10
+ ---
11
+
12
+ ## 1. Page Setup & Framework
13
+
14
+ ### Paper Specifications
15
+
16
+ | Type | Paper | Orientation | Use Case |
17
+ |------|-------|-------------|----------|
18
+ | Practice / Unit quiz | A4 | Portrait | Daily practice, homework, quizzes |
19
+ | Formal exam | A3 | Landscape + 2-column | Midterm / final / standardized (requires OOXML) |
20
+ | Answer sheet | A4 | Portrait | Standalone answer card |
21
+
22
+ ### Margins
23
+
24
+ ```js
25
+ // A4 portrait — no seal line
26
+ page: { size: { width: 11906, height: 16838 },
27
+ margin: { top: 850, bottom: 850, left: 1200, right: 1200 } }
28
+
29
+ // A4 portrait — with seal line (left binding area reserved)
30
+ page: { size: { width: 11906, height: 16838 },
31
+ margin: { top: 850, bottom: 850, left: 2200, right: 850 } }
32
+
33
+ // A3 landscape dual-column (requires OOXML)
34
+ // ⚠️ A3 dual-column may render slightly differently in WPS vs Word. Test in both before batch printing.
35
+ page: { size: { width: 23812, height: 16838, orientation: PageOrientation.LANDSCAPE },
36
+ margin: { top: 850, bottom: 850, left: 2200, right: 850 } }
37
+ ```
38
+
39
+ ### Section Handling
40
+
41
+ Different parts should use section breaks (`SectionType.NEXT_PAGE`):
42
+ - **Header area (full-width):** Title, instructions, score table (no columns)
43
+ - **Content area:** Questions (may use columns)
44
+ - **Composition / answer sheet:** Independent section, independent format
45
+ - **Attachment pages:** Large maps/diagrams for geography/biology can be separate pages
46
+
47
+ ```js
48
+ sections: [
49
+ { properties: { /* Header section — no columns */ }, children: [...] },
50
+ { properties: { type: SectionType.CONTINUOUS, column: { count: 2, space: 720 } }, children: [...] },
51
+ { properties: { type: SectionType.NEXT_PAGE }, children: [...] }, // Composition
52
+ ]
53
+ ```
54
+
55
+ ### Template-First Principle
56
+
57
+ ⚠️ **Build framework first, fill content second.** Before writing questions, determine:
58
+ 1. Paper size + margins
59
+ 2. Whether seal line is needed
60
+ 3. Whether columns are used
61
+ 4. Question type structure and point allocation
62
+ 5. Whether composition grid / answer sheet is needed
63
+
64
+ ---
65
+
66
+ ## 2. Seal Line & Student Information Area
67
+
68
+ ### When to Use Seal Line
69
+
70
+ | Scenario | Seal Line | Student Info Position |
71
+ |----------|-----------|---------------------|
72
+ | Formal standardized exam | ✅ Required | Left vertical info column |
73
+ | Midterm / Final | ✅ Recommended | Left vertical info column |
74
+ | Unit quiz | ❌ Optional | Header horizontal info row |
75
+ | Daily practice | ❌ Skip | Header horizontal info row |
76
+
77
+ ### Seal Line Implementation
78
+
79
+ #### Method 1: Header horizontal prompt (simple)
80
+ ```js
81
+ headers: { default: new Header({ children: [
82
+ new Paragraph({ alignment: AlignmentType.CENTER,
83
+ children: [new TextRun({
84
+ text: ".............. Seal ...... Line ...... Do ...... Not ...... Answer ...... Inside ..............",
85
+ size: 16, color: "999999", font: "SimSun" })] })
86
+ ] }) }
87
+ ```
88
+
89
+ #### Method 2: Vertical text box (OOXML advanced)
90
+ ```xml
91
+ <w:txbxContent>
92
+ <w:p><w:pPr><w:jc w:val="center"/></w:pPr>
93
+ <w:r><w:rPr><w:sz w:val="18"/><w:color w:val="999999"/></w:rPr>
94
+ <w:t>Name:________ Class:________ ID:________</w:t></w:r>
95
+ </w:p>
96
+ <w:p><w:r><w:rPr><w:sz w:val="16"/><w:color w:val="CCCCCC"/></w:rPr>
97
+ <w:t>- - - - - - - - - Seal Line - - - - - - - - -</w:t></w:r>
98
+ </w:p>
99
+ </w:txbxContent>
100
+ ```
101
+
102
+ ### Student Info Row
103
+
104
+ ```js
105
+ // Horizontal info row (when no seal line) — borderless 3-column table
106
+ new Table({
107
+ alignment: AlignmentType.CENTER, columnWidths: [2800, 2800, 2800],
108
+ rows: [new TableRow({ children: [
109
+ cell("Name: ______________"),
110
+ cell("Class: ______________", AlignmentType.CENTER),
111
+ cell("ID: ______________", AlignmentType.RIGHT),
112
+ ] })]
113
+ })
114
+ ```
115
+
116
+ Fill lines should be moderate length (10–14 underscore chars). Label order: Name → Class → Student ID.
117
+
118
+ ---
119
+
120
+ ## 3. Paper Header & Title Area
121
+
122
+ ### Structure
123
+
124
+ ```
125
+ School name (16pt SimHei, centered)
126
+ Exam title (14pt SimHei, centered) — e.g., "2025–2026 Academic Year Second Semester Midterm"
127
+ Subject title (14pt SimHei, centered) — e.g., "Grade 7 Mathematics"
128
+ Student info row
129
+ Instructions (10pt SimSun, centered, grey)
130
+ Score table (as needed)
131
+ ```
132
+
133
+ ### Font Specifications
134
+
135
+ | Element | Font | Size | Style |
136
+ |---------|------|------|-------|
137
+ | School name | SimHei | 16pt (size:32) | Bold, centered |
138
+ | Exam title | SimHei | 14pt (size:28) | Bold, centered |
139
+ | Subject title | SimHei | 14pt (size:28) | Bold, centered |
140
+ | Instructions | SimSun | 10pt (size:20) | Grey 333333, centered |
141
+ | Student info | SimSun | 10.5pt (size:21) | Normal |
142
+
143
+ ### Instructions Content
144
+
145
+ Should include: total score, exam duration, answer method, special requirements (e.g., calculator allowed).
146
+
147
+ ### Score Table
148
+ - Header row: light grey background F0F0F0, centered
149
+ - Columns: Question type | Section names... | Total
150
+ - Rows: Points | Section points... | Total points
151
+ - Row: Score | blank... | blank
152
+ - Table centered, 80% page width
153
+
154
+ ⚠️ **Header area should not be too full** — title + info + instructions + score table should not exceed 1/3 of the page.
155
+
156
+ ---
157
+
158
+ ## 4. Content Layout Rules
159
+
160
+ ### Color Palette
161
+
162
+ ```js
163
+ // Exam papers use only black/white/grey for clear photocopying
164
+ const C = {
165
+ title: "000000", body: "000000", section: "333333",
166
+ seal: "999999", answerLine: "CCCCCC", headerBg: "F0F0F0", gridLine: "DDDDDD",
167
+ };
168
+ ```
169
+
170
+ ### Column Usage
171
+
172
+ | Subject / Question Type | Recommendation |
173
+ |------------------------|----------------|
174
+ | Math multiple choice + fill-in | ✅ Suitable for columns |
175
+ | Physics multiple choice | ✅ Suitable for columns |
176
+ | Chinese reading / composition | ❌ Not suitable |
177
+ | English cloze / reading | ❌ Not suitable |
178
+ | History source-based | ❌ Not suitable |
179
+ | Geography map reading | ❌ Not suitable |
180
+
181
+ ### Question Numbering
182
+
183
+ Entire paper uses consistent three-level numbering:
184
+ - **Major sections:** I, II, III, IV... (Chinese: 一、二、三、四…)
185
+ - **Questions:** 1. 2. 3. ... (Arabic + period)
186
+ - **Sub-questions:** (1) (2) (3) ... (parenthesized)
187
+
188
+ ⚠️ **No extra symbols before question numbers** (no `•`, `▸`, `▪`, `-`, `*`). The number itself is the only marker. **Never use docx numbering/bullet list styles** for question numbers — must use plain TextRun manual numbering.
189
+
190
+ ```js
191
+ // ✅ Correct — plain TextRun manual numbering
192
+ new Paragraph({ spacing: { before: 120, after: 60, line: 360 },
193
+ children: [new TextRun({ text: `${i+1}. ${question}`, size: 21, font: { eastAsia: "SimSun" } })] })
194
+
195
+ // ❌ Wrong — numbering causes Word to add bullets
196
+ new Paragraph({ numbering: { reference: "xxx", level: 0 }, // ← Forbidden!
197
+ children: [new TextRun({ text: question })] })
198
+ ```
199
+
200
+ ### Question Spacing
201
+
202
+ ```js
203
+ sectionTitle: { before: 300, after: 150 } // Major section headers
204
+ question: { before: 120, after: 80 } // Between questions
205
+ subQuestion: { before: 60, after: 40 } // Between sub-questions
206
+ ```
207
+
208
+ ### Page Break Control
209
+
210
+ ⚠️ Key principles:
211
+ - **Question stem and answer area must not split** across pages
212
+ - **Source material and questions on same page**
213
+ - **Figures adjacent to their questions**
214
+ - **Avoid orphan lines** — question stem, options, answer area appear as a group
215
+
216
+ ```js
217
+ new Paragraph({ keepNext: true, keepLines: true, children: [...] })
218
+ ```
219
+
220
+ ⚠️ **Answer question page break rule (mandatory):**
221
+
222
+ Complete combination (stem + figure + answer lines) must be considered as a unit. If remaining space cannot fit stem + figure + at least 3 answer lines, push entire question to next page.
223
+
224
+ Use `keepNext: true` to chain: stem → figure → first 3 answer lines.
225
+
226
+ ---
227
+
228
+ ## 5. Font & Paragraph Standards
229
+
230
+ ### Underline Formatting for "Underlined Parts" (Mandatory)
231
+
232
+ When a question references "underlined part" (划线部分), the relevant text MUST use actual underline formatting (`underline: { type: UnderlineType.SINGLE }`). **Never** show "划线部分为 XXX" as plain text annotation — the underline must be visually rendered.
233
+
234
+ ```js
235
+ // ✅ Correct — actual underline on the referenced text
236
+ new Paragraph({ children: [
237
+ new TextRun({ text: "1. It is ", size: 21, font: { ascii: "Times New Roman" } }),
238
+ new TextRun({ text: "a butterfly", size: 21, font: { ascii: "Times New Roman" },
239
+ underline: { type: UnderlineType.SINGLE, color: "000000" } }),
240
+ new TextRun({ text: ". (Ask about the underlined part)", size: 21, font: { ascii: "Times New Roman" } }),
241
+ ]})
242
+
243
+ // ❌ Wrong — underlined part described as annotation text
244
+ new TextRun({ text: "1. It is a butterfly. (对划线部分提问) 注:划线部分为 a butterfly" })
245
+ ```
246
+
247
+ ### Font Hierarchy
248
+
249
+ | Element | Font | Size | Style |
250
+ |---------|------|------|-------|
251
+ | Section title | SimHei | 11pt (size:22) | Bold |
252
+ | Question content | SimSun | 10.5pt (size:21) | Normal |
253
+ | Points annotation | SimSun | 10pt (size:20) | In parentheses |
254
+ | Reading material | KaiTi/SimSun | 10.5pt (size:21) | KaiTi to differentiate |
255
+ | Notes/source | SimSun | 9pt (size:18) | Grey 666666 |
256
+ | Seal line | SimSun | 8pt (size:16) | Grey 999999 |
257
+ | Page number | SimSun | 9pt (size:18) | Centered |
258
+
259
+ ### Line Spacing
260
+ ```js
261
+ line: 360 // ~1.5x for readability
262
+ answerLine: 500 // Answer line spacing for writing room
263
+ ```
264
+
265
+ ### Paragraph Rules
266
+ - ⚠️ **Never use consecutive returns for whitespace** — use `spacing.before/after`
267
+ - Chinese questions use Chinese punctuation; English materials use English punctuation
268
+ - Mixed CN/EN: use Times New Roman or Calibri for English text
269
+
270
+ ---
271
+
272
+ ## 6. Multiple Choice Layout
273
+
274
+ ### Core Rule
275
+
276
+ ⚠️ **Options must NEVER be aligned with spaces!** Must use borderless tables.
277
+
278
+ ### Option Layout — Borderless Table
279
+
280
+ ```js
281
+ // Short options: 4 columns in 1 row
282
+ new Table({
283
+ columnWidths: [2200, 2200, 2200, 2200],
284
+ rows: [new TableRow({ children: ["A","B","C","D"].map((label, i) =>
285
+ new TableCell({ borders: NBs, width: { size: 2200, type: WidthType.DXA },
286
+ margins: { top: 0, bottom: 0, left: 60, right: 60 },
287
+ children: [new Paragraph({ spacing: { before: 0, after: 0 },
288
+ children: [new TextRun({ text: `${label}. ${options[i]}`, size: 21, font: "SimSun" })] })]
289
+ })
290
+ ) })]
291
+ })
292
+ // Medium options: 2 columns, 2 rows
293
+ // Long options: 1 column, 4 rows
294
+ ```
295
+
296
+ ### Option Length Detection
297
+ ```js
298
+ function getOptionLayout(options) {
299
+ const maxLen = Math.max(...options.map(o => o.length));
300
+ if (maxLen <= 6) return "4col";
301
+ if (maxLen <= 15) return "2col";
302
+ return "1col";
303
+ }
304
+ ```
305
+
306
+ ---
307
+
308
+ ## 7. Fill-in-the-Blank Layout
309
+
310
+ ```js
311
+ // Blank line length matches expected answer:
312
+ // Short answer (number/word): 8 underscores
313
+ // Medium (phrase): 14 underscores
314
+ // Long (sentence): 20 underscores
315
+ new Paragraph({ spacing: { before: 140, after: 80, line: 400 },
316
+ children: [new TextRun({ text: `${num}. Question text ________________.`, size: 21, font: "SimSun" })] })
317
+ ```
318
+
319
+ ⚠️ Fill-in lines must not break across lines — if line is too long, put the blank on the next line.
320
+
321
+ ---
322
+
323
+ ## 8. Short Answer / Problem-Solving Layout
324
+
325
+ ### Question + Points
326
+ ```js
327
+ new Paragraph({ spacing: { before: 200, after: 60, line: 360 }, keepNext: true,
328
+ children: [new TextRun({ text: `${num}. (${points} pts) ${question}`, size: 21, font: "SimSun" })] })
329
+ ```
330
+
331
+ ### Answer Lines
332
+ ```js
333
+ // Light grey answer lines (CCCCCC), NOT black
334
+ // ⚠️ Answer lines are ONLY for writing space within each question — never as dividers between questions
335
+ function answerLines(count) {
336
+ return Array(count).fill(null).map(() =>
337
+ new Paragraph({ spacing: { before: 0, after: 0, line: 500 },
338
+ borders: { bottom: { style: BorderStyle.SINGLE, size: 1, color: "CCCCCC" } },
339
+ children: [new TextRun({ text: " ", size: 21 })] })
340
+ );
341
+ }
342
+ ```
343
+
344
+ ⚠️ **Separation between questions:**
345
+
346
+ Use **only spacing** (`spacing.before: 200`) for visual separation between questions. **Forbidden:**
347
+ - ❌ Grey horizontal lines (borders)
348
+ - ❌ Color block dividers (Table-simulated separators)
349
+ - ❌ Symbol dividers (e.g., `───────`)
350
+ - ❌ Any visual separator decoration
351
+
352
+ ### Answer Space vs. Points
353
+
354
+ | Points | Suggested Lines | Description |
355
+ |--------|----------------|-------------|
356
+ | 2–4 | 3–4 lines | Simple calculation / short answer |
357
+ | 5–8 | 6–8 lines | Medium problem |
358
+ | 10–12 | 8–10 lines | Complex problem |
359
+ | 14–20 | 10–14 lines | Comprehensive / essay question |
360
+
361
+ ---
362
+
363
+ ## 9. Source-Based / Reading Question Layout
364
+
365
+ ### Material vs. Question Separation
366
+
367
+ ```js
368
+ // Material area — indented + KaiTi to differentiate
369
+ new Paragraph({ indent: { left: 420, right: 420 }, spacing: { before: 100, after: 100, line: 380 },
370
+ children: [new TextRun({ text: materialText, size: 21, font: "KaiTi" })] })
371
+ // Source attribution
372
+ new Paragraph({ alignment: AlignmentType.RIGHT, indent: { right: 420 },
373
+ children: [new TextRun({ text: "— from \"XXX\"", size: 18, color: "666666", font: "SimSun" })] })
374
+ ```
375
+
376
+ ### Key Principles
377
+ - Material title, source, body, and notes use different fonts
378
+ - Long materials: increase line spacing (line: 380–400)
379
+ - Material and corresponding questions on same page
380
+ - Sub-question numbers (1)(2)(3) clearly correspond to material
381
+ - **Data tables in materials MUST use proper docx `Table` objects** — never render tabular data as Markdown plain text (`| col | col |`). This includes statistics tables, climate data tables, comparison tables, and any structured data within question materials. Use bordered tables (see § 13 Table Usage Standards) with appropriate header row styling.
382
+
383
+ ---
384
+
385
+ ## 10. Composition / Writing Area
386
+
387
+ ### Grid Count Calculation
388
+
389
+ ⚠️ **Grid count must exceed required word count by 20–30%** (for title, paragraph indents, line breaks).
390
+
391
+ | Required Words | Min Grid Count | Recommended Layout |
392
+ |---------------|---------------|-------------------|
393
+ | 400 | 500 | 25 rows × 20 cols |
394
+ | 600 | 750 | 38 rows × 20 cols |
395
+ | 800 | 1000 | 50 rows × 20 cols |
396
+ | 1000 | 1250 | 63 rows × 20 cols |
397
+
398
+ ```js
399
+ function calcGridSize(requiredWords, colsPerRow = 20) {
400
+ const totalCells = Math.ceil(requiredWords * 1.25);
401
+ const rows = Math.ceil(totalCells / colsPerRow);
402
+ return { rows, colsPerRow, totalCells: rows * colsPerRow };
403
+ }
404
+ ```
405
+
406
+ ### Chinese Composition Grid
407
+
408
+ ```js
409
+ function compositionGrid(rows, colsPerRow) {
410
+ const cellSize = Math.floor(8800 / colsPerRow);
411
+ return new Table({
412
+ columnWidths: Array(colsPerRow).fill(cellSize),
413
+ rows: Array(rows).fill(null).map(() =>
414
+ new TableRow({
415
+ height: { value: cellSize, rule: HeightRule.EXACT },
416
+ children: Array(colsPerRow).fill(null).map(() =>
417
+ new TableCell({ borders: thinBs("DDDDDD"), width: { size: cellSize, type: WidthType.DXA },
418
+ children: [new Paragraph({ children: [] })] })
419
+ )
420
+ })
421
+ )
422
+ });
423
+ }
424
+ ```
425
+
426
+ ### English Writing Area (Horizontal Lines) — MANDATORY for English Writing Questions
427
+
428
+ ⚠️ **Every English writing/composition question MUST include ruled horizontal lines.** A blank area without lines is FORBIDDEN — students need lines to write on.
429
+
430
+ ```js
431
+ function writingLines(count) {
432
+ return Array(count).fill(null).map(() =>
433
+ new Paragraph({ spacing: { before: 0, after: 0, line: 560 },
434
+ borders: { bottom: { style: BorderStyle.SINGLE, size: 1, color: "CCCCCC" } },
435
+ children: [new TextRun({ text: " ", size: 21 })] })
436
+ );
437
+ }
438
+ ```
439
+
440
+ **Line count by word requirement:**
441
+ | Required Words | Lines |
442
+ |---------------|-------|
443
+ | ≤50 | 8 |
444
+ | 50–80 | 10 |
445
+ | 80–120 | 12 |
446
+ | 120+ | 15 |
447
+
448
+ **Rules:**
449
+ 1. Lines must appear immediately after the writing prompt paragraph
450
+ 2. Line color: light grey `CCCCCC` (print-friendly, not visually heavy)
451
+ 3. Line spacing: `line: 560` (provides adequate writing room)
452
+ 4. Chinese composition uses grid (`compositionGrid`), English uses lines (`writingLines`) — never mix them up
453
+ ```
454
+
455
+ ### Composition Area Requirements
456
+ - Independent section or clear separation
457
+ - Title space reserved (for self-chosen topics)
458
+ - Word count prompt visible ("No fewer than 800 words" / "About 120 words")
459
+ - Grid/line colors light — must not interfere with writing
460
+ - Pages continuous, not split
461
+
462
+ ---
463
+
464
+ ## 11. Answer Key (参考答案)
465
+
466
+ ### Output Rules
467
+
468
+ 1. **Default (user does not request answers in the same file):** Generate the answer key as a **separate .docx file** (e.g., `exam.docx` + `exam_answers.docx`). This prevents students from accidentally seeing answers.
469
+ 2. **User explicitly requests answers in the same file:** Place the answer key on an **independent page** using `SectionType.NEXT_PAGE`. Answer key MUST NOT appear on the same page as any exam question.
470
+
471
+ ### Separate File Format (Default)
472
+
473
+ The answer key file should include:
474
+ - Title: "《{exam title}》参考答案" (SimHei, 14pt/size:28, bold, centered)
475
+ - Same question numbering as the exam
476
+ - Concise answers (letter choices, key words, short solutions)
477
+ - Font: SimSun 10.5pt (size: 21)
478
+
479
+ ### Same File Format (When User Requests)
480
+
481
+ ```js
482
+ // Answer key as a separate section — MUST use SectionType.NEXT_PAGE
483
+ {
484
+ properties: { type: SectionType.NEXT_PAGE,
485
+ page: { margin: { top: 850, bottom: 850, left: 1200, right: 1200 } } },
486
+ children: [
487
+ new Paragraph({
488
+ alignment: AlignmentType.CENTER, spacing: { after: 300 },
489
+ children: [new TextRun({ text: "参考答案", size: 28, bold: true,
490
+ font: { eastAsia: "SimHei" } })],
491
+ }),
492
+ // ... answer content paragraphs
493
+ ],
494
+ }
495
+ ```
496
+
497
+ ### Rules
498
+ 1. ⚠️ **Never place answer content directly after the last question without a page/section break**
499
+ 2. Answer content should be concise — no answer lines, no grid, plain text only
500
+ 3. Calculation/proof questions: show key steps, not just final answer
501
+ 4. If the exam has figures, answers may reference "see Figure X" without re-embedding
502
+
503
+ ---
504
+
505
+ ## 12. Figures & Illustrations
506
+
507
+ ### Image Insertion
508
+ ```js
509
+ new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 100, after: 60 },
510
+ children: [new ImageRun({ data: imageBuffer, transformation: { width: 300, height: 200 }, type: "png" })] })
511
+ new Paragraph({ alignment: AlignmentType.CENTER, spacing: { after: 100 },
512
+ children: [new TextRun({ text: "(Figure 1)", size: 18, color: "666666", font: "SimSun" })] })
513
+ ```
514
+
515
+ ### Key Principles
516
+ - Images set as inline (default) to prevent floating
517
+ - Resolution sufficient for print clarity
518
+ - **B&W print compatible:** images must remain distinguishable when printed in grayscale
519
+ - Figure numbers and captions complete
520
+ - Figures adjacent to corresponding questions
521
+ - Maps must have: scale bar, north arrow, legend
522
+ - Coordinate graphs must have: axis labels, tick marks, units
523
+
524
+ ### ⚠️ Figure-Text Order (Strictly Enforced)
525
+
526
+ **For questions with figures, element order must be:**
527
+ ```
528
+ 1. Question stem (keepNext: true)
529
+ 2. Figure (centered, keepNext: true)
530
+ 3. Answer lines / answer area
531
+ ```
532
+
533
+ **Forbidden:** answer lines between stem and figure, or figure after answer lines.
534
+
535
+ ### Figure Content Matching
536
+ - **Figures must be semantically consistent with question stem:** if question says "triangle ABC", figure must label vertices A, B, C
537
+ - Geometry annotations must match described angles, side lengths
538
+ - Function graphs must mark key points mentioned in the question
539
+ - Physics experiment diagrams must match described apparatus
540
+ - Figure width: geometry ≤ 50% page width, data/experiment ≤ 70%
541
+
542
+ ### ⚠️ Figure Diversity Rule (Mandatory)
543
+
544
+ **No duplicate figures in the entire paper.** Even if two questions involve the same type (e.g., both triangles), each must have a distinct figure:
545
+ 1. Different labels (different vertex letters, angles, side lengths)
546
+ 2. Different shapes (acute vs. right vs. obtuse triangle)
547
+ 3. Different styling (if applicable)
548
+
549
+ If using matplotlib, each call must use **different parameters and data** — never copy the same generation code.
550
+
551
+ ### Subject-Specific Figure Requirements
552
+
553
+ | Subject | Common Types | Special Requirements |
554
+ |---------|-------------|---------------------|
555
+ | Math | Geometry, functions, coordinates | No distortion, clear labels |
556
+ | Physics | Circuits, mechanics, apparatus | Standard symbols, correct arrows |
557
+ | Chemistry | Apparatus, molecular structures | Reagent names labeled |
558
+ | Biology | Cell, organ, ecosystem diagrams | Labels not too small |
559
+ | Geography | Maps, contour lines, statistics | Legend + scale + north arrow |
560
+
561
+ ---
562
+
563
+ ## 13. Formulas & Special Symbols
564
+
565
+ ### Formulas
566
+ Math/physics/chemistry formulas use **LaTeX → docx-js Math mapping** (see `references/math-formulas.md`):
567
+ - Basic (fractions, sub/superscript, roots) → docx-js Math components
568
+ - Complex (3+ nesting, matrices) → matplotlib PNG fallback
569
+ - Never hand-type Unicode formula approximations
570
+
571
+ ### Common Unicode Math Symbols
572
+ ```
573
+ × ÷ ± ∓ ≠ ≈ ≤ ≥ ∞ √ ∑ ∏ ∫ ∂ ∆ ∇
574
+ α β γ δ ε θ λ μ π σ φ ω
575
+ ⊂ ⊃ ∈ ∉ ∪ ∩ ∅ ∀ ∃
576
+ → ← ↑ ↓ ⇒ ⇔ ° ′ ″ ‰ ² ³ ⁴ ⁿ ₁ ₂ ₃
577
+ ```
578
+
579
+ ### Chemical Formulas
580
+ Subscripts/superscripts must be correct: H₂O, CO₂, Fe₂O₃, Ca(OH)₂
581
+ Reaction arrows: → ⇌ ↑ ↓
582
+
583
+ ---
584
+
585
+ ## 14. Table Usage Standards
586
+
587
+ ### Borderless Tables (for alignment)
588
+ For: option alignment, info rows, question number + points alignment
589
+ ```js
590
+ const NB = { style: BorderStyle.NONE, size: 0, color: "FFFFFF" };
591
+ const NBs = { top: NB, bottom: NB, left: NB, right: NB };
592
+ ```
593
+
594
+ ### Bordered Tables (for data display)
595
+ For: score tables, data tables, statistics
596
+ ```js
597
+ const thinB = (c="000000") => ({ style: BorderStyle.SINGLE, size: 1, color: c });
598
+ const thinBs = (c="000000") => ({ top: thinB(c), bottom: thinB(c), left: thinB(c), right: thinB(c) });
599
+ ```
600
+
601
+ ### Table Standards
602
+ - Cell padding moderate (margins: top/bottom 40–60, left/right 60–80)
603
+ - Consistent border thickness
604
+ - Header row: light grey F0F0F0 background
605
+ - Avoid cross-page tables
606
+ - Tables centered (`alignment: AlignmentType.CENTER`)
607
+
608
+ ---
609
+
610
+ ## 15. Headers & Footers
611
+
612
+ ### Page Numbers
613
+ ```js
614
+ footers: { default: new Footer({ children: [
615
+ new Paragraph({ alignment: AlignmentType.CENTER,
616
+ children: [
617
+ new TextRun({ children: [PageNumber.CURRENT], size: 18, font: "SimSun" }),
618
+ ] })
619
+ ] }) }
620
+ ```
621
+
622
+ ⚠️ **Denominator FORBIDDEN** — never use `PageNumber.TOTAL_PAGES` or "Page X of Y". Show only current page number.
623
+
624
+ ### Headers
625
+ - May contain seal line prompt or subject name
626
+ - Small font (8–9pt), grey color (999999)
627
+ - Should not be visually heavy — must not compete with content
628
+
629
+ ---
630
+
631
+ ## 16. Subject-Specific Standards
632
+
633
+ ### Chinese Language
634
+ - Reading, classical poetry, composition: **no columns**
635
+ - Poetry preserves original line breaks
636
+ - Classical text needs annotation area (smaller font, indented)
637
+ - Composition grid in independent section, grid count via `calcGridSize` (800 words → 50×20 = 1000 cells)
638
+ - Dictation questions: horizontal lines, moderate length
639
+ - Reading materials: use KaiTi to differentiate
640
+
641
+ ### Mathematics
642
+ - Multiple choice, fill-in: suitable for neat layout
643
+ - Formulas: Unicode symbols or OOXML
644
+ - Geometry/function graphs must be clear, undistorted
645
+ - Problem-solving: sufficient working space
646
+ - Coordinate graphs: labeled axes, tick marks
647
+
648
+ ### English
649
+ - English font: Times New Roman, moderate character spacing
650
+ - Cloze: numbers in text, options after passage
651
+ - Reading comprehension: material + questions as groups
652
+ - Writing area: horizontal lines, not grid
653
+ - Listening (if any): numbers aligned with options
654
+
655
+ ### Physics / Chemistry / Biology
656
+ - Experiment/apparatus diagrams must be clear and accurate
657
+ - Unit symbols standardized (m/s, kg, mol/L, etc.)
658
+ - Chemical formula subscripts correct
659
+ - Calculation and experiment analysis: sufficient answer space
660
+ - Biology structure diagrams: labels not too small
661
+
662
+ ### History / Politics
663
+ - Source-based questions are lengthy — **no columns**
664
+ - Dates, figures, events clearly labeled
665
+ - Essay questions: more whitespace than multiple choice
666
+ - Historical sources cite provenance
667
+ - Chart materials in logical order
668
+
669
+ ### Geography
670
+ - Maps are the focus — must be clear
671
+ - Legend, scale bar, north arrow required
672
+ - Map and question close together — avoid page turns
673
+ - Map reading questions: balance figure and text space
674
+ - Contour line values clearly labeled
675
+
676
+ ---
677
+
678
+ ## Final Review Checklist
679
+
680
+ After generating an exam paper, check every item:
681
+
682
+ - [ ] Question numbers sequential, points correct, total correct
683
+ - [ ] Question stems match options / materials / illustrations one-to-one
684
+ - [ ] **Figures come after stem, before answer area** (strict order)
685
+ - [ ] **Figure content matches question semantics** (labels, symbols match)
686
+ - [ ] **Composition grid count ≥ required words × 1.25** (800 words → at least 1000 cells)
687
+ - [ ] Options aligned with borderless tables (not spaces)
688
+ - [ ] No wrong pages, missing pages, **no extra blank pages**
689
+ - [ ] Images / tables / formulas positioned correctly
690
+ - [ ] **No Markdown table syntax in document** — all data tables use proper docx Table objects
691
+ - [ ] Fonts, sizes, line spacing consistent
692
+ - [ ] Answer space matches difficulty and point value
693
+ - [ ] Clear when printed in B&W
694
+ - [ ] Subject-specific layout handled properly
695
+ - [ ] Seal line / page numbers / headers formatted correctly
696
+ - [ ] Header info complete (school, subject, duration, total score)
697
+ - [ ] **No extra PageBreak at end of last section**
698
+ - [ ] **Answer key is either a separate file (default) or on a separate page (if user requested in same file)** — never on the same page as questions