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,367 @@
1
+ # Pagination & Flow Control
2
+
3
+ > Core rules for multi-page document layout quality. Must be followed every time a multi-page PDF is generated.
4
+ >
5
+ > Related:
6
+ > - `typesetting/overflow.md` — the comprehensive overflow prevention system covering all three routes (ReportLab, LaTeX, Playwright).
7
+ > - `typesetting/fill-engine.md` — the **anti-void** adaptive engine (handles pages with too little content: font floor, fill ratio, paragraph inflation, Y-axis golden-ratio anchoring).
8
+
9
+ ---
10
+
11
+ ## 1. Last Page Blank Control (Anti-Orphan Page)
12
+
13
+ **Problem**: The last page has only one or two lines of content with large blank areas — looks terrible.
14
+
15
+ **Mandatory Rules**:
16
+
17
+ - After generating multi-page content, **you must check the content fill ratio of the last page**
18
+ - When last page content ratio < 25%, **you must backtrack and adjust**
19
+ - Adjustment strategies (by priority):
20
+ 1. **Compress preceding page spacing**: Reduce margin-bottom between sections (decrease 2-4px each)
21
+ 2. **Tighten line height**: Body line-height from 1.7 → 1.55 (no lower than 1.5)
22
+ 3. **Reduce font size**: Body from 16px → 15px (no lower than 14px)
23
+ 4. **Trim content**: Remove dispensable descriptive text without affecting core information
24
+ 5. **Merge small sections**: Combine adjacent sections with little content
25
+
26
+ **Checking Method (Playwright HTML route)**:
27
+ ```css
28
+ /* Check min-content on the last .page element */
29
+ /* If content is less than 25% of page, backtracking is needed */
30
+ ```
31
+
32
+ **Practical Standards**:
33
+ - Last page content ratio >= 40% → ✅ Pass
34
+ - Last page content ratio 25%-40% → ⚠️ Acceptable but optimization recommended
35
+ - Last page content ratio < 25% → ❌ Must adjust
36
+
37
+ ---
38
+
39
+ ## 2. Table Cross-Page Integrity
40
+
41
+ **Problem**: Table header and first data row split across two pages; table cut in the middle.
42
+
43
+ **Mandatory Rules**:
44
+
45
+ ### Playwright HTML Route
46
+ ```css
47
+ /* Prevent table splitting */
48
+ table, .table-wrapper {
49
+ break-inside: avoid; /* Preferred: keep entire table together */
50
+ page-break-inside: avoid;
51
+ }
52
+
53
+ /* If table is too long and must split, ensure header repeats */
54
+ thead {
55
+ display: table-header-group; /* Repeat header on each page */
56
+ }
57
+
58
+ /* Don't cut table rows in the middle */
59
+ tr {
60
+ break-inside: avoid;
61
+ page-break-inside: avoid;
62
+ }
63
+
64
+ /* Bind header + at least 2 data rows together */
65
+ thead + tbody tr:first-child,
66
+ thead + tbody tr:nth-child(2) {
67
+ break-before: avoid;
68
+ page-break-before: avoid;
69
+ }
70
+ ```
71
+
72
+ ### ReportLab Route
73
+ ```python
74
+ # Use Table's repeatRows parameter
75
+ table = Table(data, repeatRows=1) # Repeat header on each page
76
+
77
+ # Or use KeepTogether to wrap small tables
78
+ from reportlab.platypus import KeepTogether
79
+ elements.append(KeepTogether([table_title, table]))
80
+ ```
81
+
82
+ **Additional Rules**:
83
+ - Table rows ≤ 8: Entire table `break-inside: avoid`, no page splitting allowed
84
+ - Table rows > 8: Splitting allowed, but must use `thead { display: table-header-group }` to repeat header on each page
85
+ - All card-grid / flex-grid layouts follow the same rule: `break-inside: avoid`
86
+
87
+ ---
88
+
89
+ ## 3. CJK Punctuation Placement Rules
90
+
91
+ **Problem**: Commas, periods, enumeration commas, etc. appearing at line start, violating CJK typesetting standards.
92
+
93
+ **Mandatory Rules**:
94
+
95
+ ### Playwright HTML Route (Recommended)
96
+ ```css
97
+ /* Global CJK punctuation rules */
98
+ body {
99
+ line-break: strict; /* Strict line-break rules */
100
+ word-break: normal; /* Don't force word breaks */
101
+ overflow-wrap: break-word; /* Allow long words to break */
102
+ hanging-punctuation: allow-end; /* Allow punctuation to hang past line end */
103
+ }
104
+
105
+ /* For body paragraphs */
106
+ p, .body-text, td, li {
107
+ line-break: strict;
108
+ text-align: justify; /* Justify to reduce line-end gaps */
109
+ }
110
+ ```
111
+
112
+ **Effect of `line-break: strict`**:
113
+ - Prevents line-start: ,。、;:!?)】》…—
114
+ - Prevents line-end: (【《
115
+ - Natively supported by Chromium engine, no extra JS needed
116
+
117
+ ### ReportLab Route
118
+ ```python
119
+ # Set in ReportLab Paragraph style
120
+ from reportlab.lib.enums import TA_JUSTIFY
121
+ style = ParagraphStyle(
122
+ 'Body',
123
+ alignment=TA_JUSTIFY,
124
+ wordWrap='CJK', # CJK line-break mode
125
+ )
126
+ ```
127
+
128
+ **Verification Checklist**:
129
+ - [ ] No comma/period appears as the first character of any line
130
+ - [ ] Left parenthesis / left quotation mark does not appear at line end
131
+ - [ ] Ellipsis is not broken in the middle
132
+
133
+ ---
134
+
135
+ ## 4. Major Section Page-Break Rule (3/4 Threshold)
136
+
137
+ **Problem**: A major section (H1/一级标题) ends at ~75% of the page, and the next major section’s title gets squeezed into the remaining 25%. This looks cramped and ugly — the new section deserves a fresh page.
138
+
139
+ **Iron Rule**: When a major section (H1-level heading, e.g., “一、”“二、” or “Chapter 1”) is about to start, check remaining page space:
140
+
141
+ | Remaining space | Action |
142
+ |----------------|--------|
143
+ | **≥ 25% of page height** | Continue on same page — enough room for heading + meaningful content |
144
+ | **< 25% of page height** | Force page break — start the new section on a fresh page |
145
+
146
+ **Why 25% (not 50%)?** A major heading needs at least its title + 2-3 lines of body text to look intentional. If there’s only enough room for a title and a line or two, it looks like an accident.
147
+
148
+ ### ReportLab Implementation
149
+ ```python
150
+ from reportlab.platypus import CondPageBreak
151
+
152
+ # Before every H1-level heading, insert a conditional page break.
153
+ # CondPageBreak(height) breaks to next page if remaining space < height.
154
+ # Use 75% of available page height as threshold.
155
+ available_height = page_height - top_margin - bottom_margin
156
+ threshold = available_height * 0.25 # break if less than 25% remains
157
+
158
+ # In story building:
159
+ story.append(CondPageBreak(threshold)) # ← goes before H1 heading
160
+ story.append(h1_paragraph)
161
+ ```
162
+
163
+ ### Playwright / CSS @page Implementation
164
+ ```css
165
+ /* H1-level headings always prefer starting on a new page
166
+ unless there's substantial room remaining */
167
+ h1, .major-section-title {
168
+ break-before: auto; /* Default: don't force */
169
+ page-break-before: auto;
170
+ }
171
+ ```
172
+
173
+ ```javascript
174
+ // Post-render check: if an H1 starts in the bottom 25% of the viewport,
175
+ // force a page-break-before to avoid orphan headings
176
+ document.querySelectorAll('h1, .major-section-title').forEach(h => {
177
+ const rect = h.getBoundingClientRect();
178
+ // In print context, check if heading is too far down the page
179
+ // This can be verified after Playwright render via page.evaluate()
180
+ const pageHeight = window.innerHeight;
181
+ const relativeY = rect.top / pageHeight;
182
+ if (relativeY > 0.75) {
183
+ h.style.breakBefore = 'page';
184
+ }
185
+ });
186
+ ```
187
+ ```
188
+
189
+ ### LaTeX Implementation
190
+ ```latex
191
+ % Before each \section{} (H1-level), check remaining space
192
+ \needspace{0.25\textheight} % requires needspace package
193
+ \section{New Major Section}
194
+ ```
195
+
196
+ **Scope**: This rule applies to **H1-level headings only** (major sections, chapters, top-level numbered items like “一、”“二、”). Sub-sections (H2, H3) follow the standard heading-body binding rule (no orphan headings at page bottom) but do NOT force page breaks.
197
+
198
+ ---
199
+
200
+ ## 5. Other Anti-Split Rules
201
+
202
+ ### Heading–Body Binding
203
+ ```css
204
+ h1, h2, h3, h4, .section-title {
205
+ break-after: avoid; /* Don't page-break after heading */
206
+ page-break-after: avoid;
207
+ }
208
+ ```
209
+
210
+ ### Image / Card Protection
211
+ ```css
212
+ figure, .card, .kpi-card, .project-card {
213
+ break-inside: avoid;
214
+ page-break-inside: avoid;
215
+ }
216
+ ```
217
+
218
+ > **⚠️ Image `max-height` is critical.** `break-inside: avoid` alone can cause images to occupy an entire page when the image is tall. Always pair with `max-height` from overflow.md (`img { max-height: 45vh }`) to prevent single images from consuming a full page.
219
+
220
+ ### List Item Binding
221
+ ```css
222
+ li {
223
+ break-inside: avoid;
224
+ }
225
+ /* Keep at least 2 list items on the same page */
226
+ li:last-child {
227
+ break-before: avoid;
228
+ }
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Quick Checklist (After every multi-page PDF generation)
234
+
235
+ ```
236
+ □ Last page content ≥ 40%?
237
+ □ Major sections (H1) not starting in bottom 25% of a page?
238
+ □ Table header and data rows not separated?
239
+ □ No punctuation appearing at line start?
240
+ □ No heading orphaned at page bottom?
241
+ □ No card/image cut in half?
242
+ □ Page numbering follows the standard scheme (see Section 6)?
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 6. Standard Page Numbering Scheme
248
+
249
+ All multi-page documents MUST follow this five-zone page numbering convention unless the user explicitly requests otherwise.
250
+
251
+ ### Zone Definitions
252
+
253
+ | Zone | Section | Numbering Style | Starts At | Visibility |
254
+ |------|---------|----------------|-----------|------------|
255
+ | **1. Cover** | Title page | — | Logical page 1 | **Hidden** (no visible page number, but counts as page 1 internally) |
256
+ | **2. Front Matter** | Table of Contents, Preface, Abstract, Acknowledgments | **Lowercase Roman** (i, ii, iii, iv, v…) | i | Visible, centered footer |
257
+ | **3. Body** | Main content chapters/sections | **Arabic** (1, 2, 3…) | **Resets to 1** | Visible, centered or outer-edge footer |
258
+ | **4. Appendix** | Appendices (A, B, C…) | **Arabic, continues** from body | Continues | Visible |
259
+ | **5. References / Bibliography** | Works cited, bibliography | **Arabic, continues** from body/appendix | Continues | Visible |
260
+
261
+ ### Key Rules
262
+
263
+ 0. **NEVER use "Page X of Y" format (denominator is FORBIDDEN).** Footer must show only the page number itself (e.g., `1`, `2`, `iii`). Do NOT display total page count. No `Page 3 of 12`, no `第3页/共12页`, no `3 / 12`. Just the bare number.
264
+
265
+ 1. **Cover page is ALWAYS page 1 internally** but the page number is **never displayed**. This is achieved by suppressing the footer/header on the first page, not by excluding it from the page count.
266
+
267
+ 2. **Front matter uses a separate Roman numeral sequence.** When front matter exists (TOC, abstract, preface), it forms its own numbering sequence starting at `i`. This sequence is independent of the body numbering.
268
+
269
+ 3. **Body numbering resets to Arabic 1.** The first page of actual content (Chapter 1, Introduction, etc.) is always page `1` regardless of how many front matter pages precede it.
270
+
271
+ 4. **Appendix and references continue the body sequence.** There is NO reset between body → appendix → references. If the body ends on page 42, Appendix A starts on page 43.
272
+
273
+ 5. **Documents without front matter** skip zone 2 entirely. Cover = hidden page 1, body starts at visible page 1.
274
+
275
+ 6. **Documents without a cover** start the body (or front matter if present) at page 1 directly.
276
+
277
+ ### ReportLab Implementation
278
+
279
+ ```python
280
+ from reportlab.platypus import SimpleDocTemplate, PageBreak, NextPageTemplate, PageTemplate
281
+ from reportlab.lib.units import inch
282
+ from reportlab.platypus.frames import Frame
283
+
284
+ def footer_with_arabic(canvas, doc):
285
+ """Standard Arabic page number in footer."""
286
+ canvas.saveState()
287
+ canvas.setFont('Helvetica', 9)
288
+ canvas.drawCentredString(doc.pagesize[0] / 2, 0.5 * inch,
289
+ str(doc.page))
290
+ canvas.restoreState()
291
+
292
+ def footer_with_roman(canvas, doc):
293
+ """Roman numeral page number for front matter."""
294
+ roman_map = {1:'i',2:'ii',3:'iii',4:'iv',5:'v',6:'vi',7:'vii',8:'viii',9:'ix',10:'x'}
295
+ page_num = roman_map.get(doc.page, str(doc.page))
296
+ canvas.saveState()
297
+ canvas.setFont('Helvetica', 9)
298
+ canvas.drawCentredString(doc.pagesize[0] / 2, 0.5 * inch, page_num)
299
+ canvas.restoreState()
300
+
301
+ def no_footer(canvas, doc):
302
+ """Cover page — no visible page number."""
303
+ pass
304
+
305
+ # Define page templates:
306
+ # - 'cover': no footer
307
+ # - 'frontmatter': Roman numeral footer
308
+ # - 'body': Arabic footer (page counter resets)
309
+ ```
310
+
311
+ ### Playwright / HTML + CSS Implementation
312
+
313
+ ```css
314
+ /* Zone 1: Cover — suppress page number */
315
+ .page-cover {
316
+ /* No footer content */
317
+ }
318
+
319
+ /* Zone 2: Front matter — Roman numerals via CSS counter */
320
+ @page :nth(2) { /* Adjust range based on front matter pages */ }
321
+
322
+ /* For Playwright, page numbers are typically added via:
323
+ 1. A footer element on each .page div, or
324
+ 2. Post-processing with pypdf after PDF generation */
325
+ ```
326
+
327
+ **Practical approach for Playwright route**: Since CSS `@page` counters with Roman/Arabic switching are poorly supported, the recommended pattern is:
328
+ 1. Generate the PDF without page numbers
329
+ 2. Use pypdf to stamp page numbers in post-processing:
330
+ - Skip page 1 (cover)
331
+ - Roman numerals for front matter pages
332
+ - Arabic starting from 1 for body pages
333
+
334
+ ### LaTeX Implementation
335
+
336
+ ```latex
337
+ % Cover: no page number displayed
338
+ \begin{titlepage}
339
+ \thispagestyle{empty} % Suppress page number
340
+ % ... cover content ...
341
+ \end{titlepage}
342
+
343
+ % Front matter: Roman numerals
344
+ \pagenumbering{roman} % Switches to i, ii, iii...
345
+ \tableofcontents
346
+ \newpage
347
+
348
+ % Body: Arabic, reset to 1
349
+ \pagenumbering{arabic} % Switches to 1, 2, 3... (auto-resets counter)
350
+ \section{Introduction}
351
+ % ...
352
+
353
+ % Appendix: continues Arabic numbering (no reset)
354
+ \appendix
355
+ \section{Appendix A} % Page number continues from body
356
+
357
+ % References: continues Arabic numbering (no reset)
358
+ \bibliographystyle{plain}
359
+ \bibliography{refs}
360
+ ```
361
+
362
+ ### When to Deviate
363
+
364
+ - **Single-page documents** (certificates, letters, posters): No page numbering at all.
365
+ - **Short documents (≤3 pages)**: Simple Arabic `1, 2, 3` throughout, no cover/frontmatter distinction.
366
+ - **User explicitly requests a different scheme**: Follow the user's instructions.
367
+ - **Exam papers**: Sequential Arabic numbering on every page, including page 1.
@@ -0,0 +1,217 @@
1
+ # Color Palette System
2
+
3
+ > Color is the skeleton of design. Unified, restrained, systematic. Garish = amateur.
4
+
5
+ ---
6
+
7
+ ## Cascade Palette System (V2 — Preferred)
8
+
9
+ The cascade palette enforces one iron law: **Area ∝ 1/Saturation**.
10
+ The larger the colored area, the lower its saturation must be.
11
+
12
+ ### Tier System
13
+
14
+ | Tier | Area % | S Cap | Roles |
15
+ |------|--------|-------|-------|
16
+ | **XL** | >50% | ≤ 0.08 | `page_bg`, `section_bg` |
17
+ | **L** | 20-50% | ≤ 0.15 | `card_bg`, `table_stripe` |
18
+ | **M** | 5-20% | ≤ 0.30 | `header_fill`, `cover_block` |
19
+ | **S** | 1-5% | ≤ 0.50 | `border`, `icon` |
20
+ | **XS** | <1% | ≤ 0.75 | `accent`, `accent_secondary` |
21
+
22
+ ### How It Works
23
+
24
+ One base hue → 12 roles + 4 semantic colors. Cover, body, and charts all pull from the same palette:
25
+
26
+ ```
27
+ palette.cascade
28
+ ├── cover subset (page_bg, header_fill, cover_block, accent, text_primary...)
29
+ ├── body subset (page_bg, section_bg, card_bg, table_stripe, border...)
30
+ ├── chart subset (accent as series_1, accent_secondary as series_2, ...)
31
+ └── semantic (success, warning, error, info — all low-sat)
32
+ ```
33
+
34
+ No orphan colors. No "cover finished, now pick new colors for body" drift.
35
+
36
+ ### Usage
37
+
38
+ ```bash
39
+ # Via design_engine.py
40
+ python3 "$PDF_SKILL_DIR/scripts/design_engine.py" palette-cascade --intent cold --mode minimal
41
+
42
+ # Via pdf.py (auto-derives intent from title)
43
+ python3 "$PDF_SKILL_DIR/scripts/pdf.py" palette.cascade --title "2025年度报告" --format reportlab
44
+
45
+ # Formats: summary (default) | json | css | reportlab
46
+ ```
47
+
48
+ ### Output Formats
49
+
50
+ - **summary**: Human-readable table with tier/role/hex/saturation
51
+ - **json**: Full structured data (roles, cover, body, charts, semantic, meta)
52
+ - **css**: CSS custom properties ready for HTML/Playwright
53
+ - **reportlab**: Python code ready to paste into ReportLab scripts
54
+
55
+ ---
56
+
57
+ ## Core Iron Rules
58
+
59
+ ### 1. One Document, One Color Family
60
+
61
+ **Not one color — one color family.**
62
+
63
+ - After choosing the primary color, all secondary, accent, and background colors must be derived from it
64
+ - Derivation methods: lightness shift, saturation shift, micro hue adjustment (within ±15°)
65
+ - **Forbidden** to have unrelated colors in the same document
66
+
67
+ ```
68
+ Primary → Headings, key data, primary buttons
69
+ Secondary → Primary lightness ±15-25%
70
+ Accent → Primary hue ±10-15°, for highlights/warnings
71
+ Neutral → Gray series for body text, not conflicting with primary
72
+ Background → Pure white / primary at opacity 3-8%
73
+ ```
74
+
75
+ ### 2. Color Count Limits
76
+
77
+ | Element Type | Max Colors | Notes |
78
+ |-------------|-----------|-------|
79
+ | Entire document | 4-5 | Primary + secondary + accent + neutral + background |
80
+ | Single component (card/table) | 2-3 | Don't give each card a different color |
81
+ | Charts / data visualization | Same-family gradient | Differentiate by opacity/lightness, not different hues |
82
+ | Tags / badges | 1 color + text color | No rainbow tags |
83
+
84
+ ### 3. Absolutely Forbidden Color Fills
85
+
86
+ The following are automatic failures:
87
+
88
+ - ❌ 4 cards using 4 completely different colors (red/blue/green/purple)
89
+ - ❌ Alternating table rows in different colors (blue row/pink row)
90
+ - ❌ Rainbow-colored pie charts/bar charts
91
+ - ❌ Each section with a different theme color
92
+ - ❌ Gradient transitioning from warm to cool tones (red → blue)
93
+
94
+ ---
95
+
96
+ ## Color Generation Rules
97
+
98
+ ### Deriving a Full Palette from Primary
99
+
100
+ ```
101
+ Given primary H(hue) S(saturation) L(lightness):
102
+
103
+ Primary: hsl(H, S, L) — Headings, key elements
104
+ Dark variant: hsl(H, S, L-15%) — Hover, borders, icons
105
+ Light variant: hsl(H, S-10%, L+25%) — Tag backgrounds, light fills
106
+ Ultra-light bg: hsl(H, S-20%, 96%) — Section backgrounds, card base
107
+ Accent: hsl(H+15, S, L) — Warnings, highlights (micro hue shift)
108
+ ```
109
+
110
+ ### Example: Deriving from a primary color
111
+
112
+ > ⚠️ The hex values below are **examples only**. In production, use `palette.cascade` or `palette.generate` to compute the full palette from intent.
113
+
114
+ ```css
115
+ :root {
116
+ --c-primary: #2d5a87; /* Primary (from palette.cascade) */
117
+ --c-primary-d: #1e3d5c; /* Dark variant */
118
+ --c-primary-l: #5a8ab8; /* Light variant */
119
+ --c-primary-bg: #f0f4f8; /* Ultra-light background */
120
+ --c-accent: #2d6a87; /* Accent (hue +10°) */
121
+ --c-text: #333; /* Body text */
122
+ --c-text-muted: #888; /* Secondary text */
123
+ --c-border: #e0e4e8; /* Border lines */
124
+ }
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Multi-Element Differentiation Strategies
130
+
131
+ When distinguishing multiple sibling elements (e.g., multiple cards, categories), **don't use different colors — use these approaches instead**:
132
+
133
+ ### Strategy A: Same Hue, Different Lightness
134
+ ```css
135
+ .card-1 { background: hsl(220, 40%, 95%); } /* Lightest */
136
+ .card-2 { background: hsl(220, 40%, 90%); }
137
+ .card-3 { background: hsl(220, 40%, 85%); }
138
+ .card-4 { background: hsl(220, 40%, 80%); } /* Darkest */
139
+ ```
140
+
141
+ ### Strategy B: Same Color, Different Opacity
142
+ ```css
143
+ .item-1 { background: rgba(30, 58, 95, 0.06); }
144
+ .item-2 { background: rgba(30, 58, 95, 0.12); }
145
+ .item-3 { background: rgba(30, 58, 95, 0.18); }
146
+ .item-4 { background: rgba(30, 58, 95, 0.24); }
147
+ ```
148
+
149
+ ### Strategy C: Primary + Whitespace + Lines
150
+ ```css
151
+ /* Differentiate by border color/weight/style, uniform white background */
152
+ .card-1 { border-left: 3px solid var(--primary); }
153
+ .card-2 { border-left: 3px solid var(--primary-l); }
154
+ .card-3 { border-left: 3px solid var(--primary-d); }
155
+ ```
156
+
157
+ ### Strategy D: Icons / Numbering (Not Color)
158
+ ```css
159
+ /* All cards same color, differentiated by icons, numbers, or layout variation */
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Gradient Usage Rules
165
+
166
+ ### Allowed Gradients
167
+ - **Same-family gradient**: `linear-gradient(135deg, var(--c-primary), var(--c-primary-l))` — hue difference < 20°
168
+ - **Lightness gradient**: `linear-gradient(180deg, #fff, #f5f5f5)` — pure lightness change
169
+ - **Primary to transparent**: `linear-gradient(90deg, var(--c-primary), transparent)` — for decorative lines
170
+
171
+ ### Forbidden Gradients
172
+ - ❌ Warm-to-cool crossover: `linear-gradient(#ff6b6b, #4ecdc4)`
173
+ - ❌ More than 3 colors: `linear-gradient(red, yellow, green, blue)`
174
+ - ❌ Neon gradients: Any high-saturation gradient
175
+ - ❌ Gratuitous gradients: Gradients added purely for "looks nice" without purpose
176
+
177
+ ---
178
+
179
+ ## Preset Palettes (Ready to Use)
180
+
181
+ ### Business Blue
182
+ ```
183
+ #1a365d → #2a5298 → #4a7ac7 → #dce6f5 → #f5f8fc
184
+ ```
185
+
186
+ ### Warm Gray
187
+ ```
188
+ #2d2d2d → #5a5a5a → #8a8a8a → #e8e8e8 → #f9f9f9
189
+ ```
190
+
191
+ ### Forest Green
192
+ ```
193
+ #1a3c2a → #2d6b4a → #4a9a6a → #d5ead8 → #f2f8f4
194
+ ```
195
+
196
+ ### Terracotta Red
197
+ ```
198
+ #5c2018 → #8a3828 → #b85a48 → #f0d8d0 → #faf4f2
199
+ ```
200
+
201
+ ### Indigo Purple
202
+ ```
203
+ #2d1b4e → #4a2d7a → #6a4aaa → #ddd0f0 → #f5f2fa
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Quick Check
209
+
210
+ ```
211
+ □ How many colors does the entire document use? (Target ≤ 5)
212
+ □ Can every color be traced back to the primary?
213
+ □ Are there any colors that "suddenly appear" without derivation?
214
+ □ Are sibling elements rainbow-colored?
215
+ □ Gradient endpoint hue difference < 20°?
216
+ □ If you remove all color and look at grayscale only, is the hierarchy still clear?
217
+ ```
@@ -0,0 +1,20 @@
1
+
2
+ ---
3
+
4
+ ## CJK Typography Supplement
5
+
6
+ > See `pagination.md` Section 3 for detailed rules.
7
+
8
+ ```css
9
+ /* CJK punctuation placement rules (always include) */
10
+ body {
11
+ line-break: strict;
12
+ word-break: normal;
13
+ overflow-wrap: break-word;
14
+ }
15
+
16
+ p, td, li {
17
+ line-break: strict;
18
+ text-align: justify;
19
+ }
20
+ ```
@@ -0,0 +1,15 @@
1
+ {
2
+ "mcpServers": {
3
+ "ios-simulator": {
4
+ "command": "node",
5
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/mcp/server.js"],
6
+ "cwd": "${CLAUDE_PROJECT_DIR}",
7
+ "env": {
8
+ "IOS_SIM_PACKAGE_ROOT": "${CLAUDE_PLUGIN_ROOT}",
9
+ "IOS_SIM_PLUGIN_DATA": "${CLAUDE_PLUGIN_DATA}",
10
+ "IOS_SIM_DEFAULT_DEVICE": "${user_config.default_device}",
11
+ "IOS_SIM_UI_BACKEND": "${user_config.ui_backend}"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "ios-simulator",
3
+ "version": "0.1.0",
4
+ "description": "Provides iOS development workflows and simulator automation for ZCode.",
5
+ "author": { "name": "Z.ai" },
6
+ "license": "MIT",
7
+ "skills": "skills",
8
+ "commands": "commands",
9
+ "mcpServers": {
10
+ "ios-simulator": {
11
+ "command": "node",
12
+ "args": ["${ZCODE_PLUGIN_ROOT}/dist/mcp/server.js"],
13
+ "cwd": "${ZCODE_PROJECT_DIR}",
14
+ "env": {
15
+ "IOS_SIM_PACKAGE_ROOT": "${ZCODE_PLUGIN_ROOT}",
16
+ "IOS_SIM_PLUGIN_DATA": "${ZCODE_PLUGIN_DATA}",
17
+ "IOS_SIM_DEFAULT_DEVICE": "${user_config.default_device}",
18
+ "IOS_SIM_UI_BACKEND": "${user_config.ui_backend}"
19
+ }
20
+ }
21
+ },
22
+ "userConfig": {
23
+ "default_device": {
24
+ "type": "string",
25
+ "default": "iPhone 16",
26
+ "description": "Preferred simulator device name."
27
+ },
28
+ "ui_backend": {
29
+ "type": "string",
30
+ "default": "auto",
31
+ "description": "UI interaction backend: auto, idb, xcodebuildmcp, or none."
32
+ }
33
+ }
34
+ }