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,384 @@
1
+ # Cover Background — Advanced Cover Background Construction Rules
2
+
3
+ > Background is the canvas behind the canvas. It should be felt, not seen.
4
+
5
+ > **⚠️ V2.1 Note:** Since all covers are now rendered via HTML/Playwright, the canonical implementation is **CSS/HTML**. The ReportLab Python examples below are kept as **algorithmic reference** (coordinates, ratios, opacity values) — translate them to equivalent CSS `background`, `linear-gradient`, `radial-gradient`, `transform`, and `clip-path` properties when implementing. The design intent and constraints (opacity limits, Z-index rules, WCAG contrast) apply regardless of rendering engine.
6
+
7
+ ---
8
+
9
+ ## 🔴 Global Constraints
10
+
11
+ Before executing any specific background algorithm, these three iron rules must be obeyed — they are the baseline to ensure backgrounds remain subtle and never overwhelm:
12
+
13
+ ### 1. Ultra-Low Contrast Rule (Opacity/Alpha Control)
14
+
15
+ All background element colors are calculated based on the underlying canvas base color:
16
+
17
+ | Base Color Type | Background Element Color | Opacity Range |
18
+ |---------|-------------|-----------|
19
+ | Light/white base | `#000000` | **2% – 5%** |
20
+ | Dark base | `#FFFFFF` | **3% – 6%** |
21
+
22
+ **Absolutely forbidden** to exceed the above opacity ranges. Background elements must be at the "barely perceptible" threshold.
23
+
24
+ ### 2. Absolute Z-Axis Bottom Layer
25
+
26
+ All background drawing commands must be executed after the base solid color fill and before any text/layout content rendering.
27
+
28
+ Rendering order (bottom to top):
29
+ ```
30
+ 1. Page base color fill (solid rect)
31
+ 2. ▶ Background element layer (all content defined in this file)
32
+ 3. Foreground layout content (text, borders, geometric anchors, etc.)
33
+ ```
34
+
35
+ ### 3. Anti-Overflow Clipping (Clip Path)
36
+
37
+ Canvas Clip must be enabled to ensure any oversized shapes exceeding the page `(0, 0, W, H)` coordinate system do not cause abnormal PDF physical dimensions or rendering errors.
38
+
39
+ **Core principle: All calculations must be based on dynamic page dimensions (`W` = page width, `H` = page height). Hard-coding absolute pixel values is forbidden.**
40
+
41
+ ---
42
+
43
+ ## Module 1: Supergraphics
44
+
45
+ **Goal:** Use minimal curves or diagonal lines to break the rigidity of the rectangular frame.
46
+
47
+ ### Option 1.1: Arc (The Bleeding Circle)
48
+
49
+ **Shape type**: Solid-filled circle
50
+
51
+ **Calculation logic**:
52
+ - `Radius` = `W × 1.2` to `W × 1.5` (must be larger than page width to ensure arc curvature is gentle enough)
53
+ - `Center_X` = `W × 1.0` (center placed at the rightmost page edge, or even outside the right side)
54
+ - `Center_Y` = `H × 0.8` (center biased lower)
55
+
56
+ **Visual effect**: An extremely elegant, grand arc sweeps across the lower-left corner of the page, with most of the circle body outside the page.
57
+
58
+ **ReportLab implementation notes**:
59
+ ```python
60
+ c.saveState()
61
+ c.clipRect(0, 0, W, H) # Rule 3: anti-overflow
62
+ c.setFillColorRGB(0, 0, 0, 0.03) # Rule 1: ultra-low opacity
63
+ radius = W * 1.3
64
+ cx, cy = W * 1.0, H * 0.2 # ReportLab coordinate Y starts from bottom
65
+ c.circle(cx, cy, radius, fill=1, stroke=0)
66
+ c.restoreState()
67
+ ```
68
+
69
+ **Playwright/HTML implementation notes**:
70
+ ```html
71
+ <!-- Option 2.1: Side giant spine -->
72
+ <!-- Note: Must use JS to measure text width, dynamically adjust font-size to ensure full display -->
73
+ <div style="position:absolute; inset:0; overflow:hidden; z-index:0;">
74
+ <div id="spine-watermark" style="
75
+ position: absolute;
76
+ left: 3%;
77
+ top: 50%;
78
+ transform: translateY(-50%) rotate(-90deg);
79
+ transform-origin: center center;
80
+ font-size: min(calc(var(--W) * 0.45), 45vw);
81
+ font-family: 'Helvetica', 'Arial Black', sans-serif;
82
+ font-weight: 900;
83
+ color: rgba(0,0,0,0.04);
84
+ white-space: nowrap;
85
+ line-height: 1;
86
+ ">2026</div>
87
+ </div>
88
+ <script>
89
+ // Adaptive: ensure rotated text does not exceed 85% of page height
90
+ const el = document.getElementById('spine-watermark');
91
+ const maxH = window.innerHeight * 0.85;
92
+ if (el.offsetWidth > maxH) {
93
+ const scale = maxH / el.offsetWidth;
94
+ el.style.fontSize = (parseFloat(getComputedStyle(el).fontSize) * scale) + 'px';
95
+ }
96
+ </script>
97
+ ```
98
+
99
+ ---
100
+
101
+ ### Option 1.2: Sharp Angle Cut (The Angle Slash)
102
+
103
+ **Shape type**: Polygon/right trapezoid
104
+
105
+ **Calculation logic (define four vertices)**:
106
+ - `Point 1` = `(0, H × 0.7)`
107
+ - `Point 2` = `(W, H × 0.4)`
108
+ - `Point 3` = `(W, H)`
109
+ - `Point 4` = `(0, H)`
110
+
111
+ **Visual effect**: Forms a tilted geometric color block at the bottom of the page. This sharp linear cut has a strong IT/consulting/engineering industry feel.
112
+
113
+ **ReportLab implementation notes**:
114
+ ```python
115
+ c.saveState()
116
+ c.clipRect(0, 0, W, H)
117
+ c.setFillColorRGB(0, 0, 0, 0.04) # Rule 1
118
+ path = c.beginPath()
119
+ # ReportLab Y starts from bottom, needs flipping
120
+ path.moveTo(0, H * 0.3) # Corresponds to doc P1: (0, H*0.7) → flipped
121
+ path.lineTo(W, H * 0.6) # Corresponds to doc P2: (W, H*0.4) → flipped
122
+ path.lineTo(W, 0) # Corresponds to doc P3: (W, H) → flipped
123
+ path.lineTo(0, 0) # Corresponds to doc P4: (0, H) → flipped
124
+ path.close()
125
+ c.drawPath(path, fill=1, stroke=0)
126
+ c.restoreState()
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Module 2: Typographic Watermarks
132
+
133
+ **Goal:** Extract very short metadata text and transform it into an architectural watermark space.
134
+
135
+ ### Technical Requirements (Mandatory)
136
+
137
+ | Constraint | Rule |
138
+ |-------|------|
139
+ | **Font** | Must use sans-serif, weight must be extra-bold (Black / Heavy / Bold). Recommended: Helvetica Black, Arial Black, Noto Sans SC Heavy |
140
+ | **Font prohibition** | **Absolutely forbidden** to use thin or serif fonts for this type of watermark |
141
+ | **Character count** | Extracted string length `1–5` characters (e.g. year "2026", abbreviation "AI", "B2B") |
142
+ | **Opacity** | Follow global Rule 1 (light bg 2-5%, dark bg 3-6%) |
143
+
144
+ ### Option 2.1: Side Giant Spine (Vertical Spine)
145
+
146
+ **Calculation logic**:
147
+ - `Text` = Extract year (e.g. "2026")
148
+ - **🔴 Font Size Adaptive Algorithm (Full Text Display Iron Rule):**
149
+ 1. `Max_Font_Size` = `W × 0.45` (ideal maximum)
150
+ 2. Measure total text height after rotation: `Text_Width = measure(Text, Max_Font_Size)` (after 90° rotation, original width becomes vertical height)
151
+ 3. Available vertical space = `H × 0.85` (leaving `H × 0.075` safety margin top and bottom)
152
+ 4. If `Text_Width > available vertical space`, scale down proportionally: `Font_Size = Max_Font_Size × (available_vertical_space / Text_Width)`
153
+ 5. Final `Font_Size = min(Max_Font_Size, scaled_font_size)`
154
+ - `Rotation` = Counterclockwise 90° (`-90deg`)
155
+ - `Anchor_X` = `W × 0.03` (text fully within page, flush to left but not exceeding)
156
+ - `Anchor_Y` = Vertically centered = `(H - Text_Width) / 2` (text centered after rotation)
157
+
158
+ **⚠️ Full Display Iron Rule: Background watermark text must be 100% within the visible page area. Any clipping is strictly forbidden. Reduce font size rather than truncate.**
159
+
160
+ **Visual effect**: A complete bold number watermark appears on the left side, vertically centered, becoming the visual supporting pillar. Text is fully readable.
161
+
162
+ **ReportLab implementation notes**:
163
+ ```python
164
+ c.saveState()
165
+ c.clipRect(0, 0, W, H)
166
+ c.setFillColorRGB(0, 0, 0, 0.04)
167
+
168
+ # Adaptive font size: ensure full text display
169
+ max_font_size = W * 0.45
170
+ text = "2026"
171
+ text_width = c.stringWidth(text, "Helvetica-Bold", max_font_size)
172
+ available_height = H * 0.85
173
+ if text_width > available_height:
174
+ font_size = max_font_size * (available_height / text_width)
175
+ else:
176
+ font_size = max_font_size
177
+
178
+ # Recalculate actual width for centering
179
+ actual_text_width = c.stringWidth(text, "Helvetica-Bold", font_size)
180
+
181
+ c.setFont("Helvetica-Bold", font_size)
182
+ # Vertically centered, fully within page
183
+ center_y = (H - actual_text_width) / 2
184
+ c.translate(W * 0.03, center_y)
185
+ c.rotate(90) # ReportLab counter-clockwise is positive
186
+ c.drawString(0, 0, text)
187
+ c.restoreState()
188
+ ```
189
+
190
+ ---
191
+
192
+ ### Option 2.2: Bottom Full Text
193
+
194
+ **Calculation logic**:
195
+ - `Text` = Document type English initials (e.g. "REPORT")
196
+ - **🔴 Font Size Adaptive Algorithm (Full Text Display Iron Rule):**
197
+ 1. `Max_Font_Size` = `W × 0.3` (ideal maximum)
198
+ 2. Measure text rendering width: `Text_Width = measure(Text, Max_Font_Size)`
199
+ 3. Available horizontal space = `W × 0.90` (leaving `W × 0.05` safety margin left and right)
200
+ 4. If `Text_Width > available horizontal space`, scale down proportionally: `Font_Size = Max_Font_Size × (available_horizontal_space / Text_Width)`
201
+ 5. Final `Font_Size = min(Max_Font_Size, scaled_font_size)`
202
+ - `Rotation` = 0° (horizontal tiling)
203
+ - `Anchor_X` = `W × 0.05`
204
+ - `Anchor_Y` = Text baseline within the bottom safe zone of the page: `H × 0.92` (text fully displayed at page bottom, not truncated)
205
+
206
+ **⚠️ Full Display Iron Rule: Background watermark text must be 100% within the visible page area. Any clipping is strictly forbidden. Reduce font size rather than truncate.**
207
+
208
+ **Visual effect**: Text sits solidly at the bottom like a foundation, fully readable, extremely dignified. No more half-truncated text.
209
+
210
+ **ReportLab implementation notes**:
211
+ ```python
212
+ c.saveState()
213
+ c.clipRect(0, 0, W, H)
214
+ c.setFillColorRGB(0, 0, 0, 0.04)
215
+
216
+ # Adaptive font size: ensure full text display
217
+ max_font_size = W * 0.3
218
+ text = "REPORT"
219
+ text_width = c.stringWidth(text, "Helvetica-Bold", max_font_size)
220
+ available_width = W * 0.90
221
+ if text_width > available_width:
222
+ font_size = max_font_size * (available_width / text_width)
223
+ else:
224
+ font_size = max_font_size
225
+
226
+ c.setFont("Helvetica-Bold", font_size)
227
+ # Text fully within page, baseline placed in bottom safe zone
228
+ # ascent ≈ font_size * 0.75, ensure letter tops don't exceed page
229
+ c.drawString(W * 0.05, font_size * 0.3, text) # baseline slightly above bottom edge
230
+ c.restoreState()
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Module 3: Blueprint Hairlines
236
+
237
+ **Goal:** Use ultra-thin interlacing lines to enhance the "anchoring feel" and logical rigor of foreground text.
238
+
239
+ ### Technical Requirements
240
+
241
+ | Constraint | Rule |
242
+ |-------|------|
243
+ | **Line width** | `Stroke_Width = 0.5pt` (**must never exceed 1pt**) |
244
+ | **Line type** | Solid, or very closely spaced dotted line (Dotted, dash: `[1, 3]`) |
245
+ | **Opacity** | Follow global Rule 1 |
246
+
247
+ ### Option 3.1: Coordinate Cross
248
+
249
+ **Calculation logic (height bound to foreground layout anchor)**:
250
+ - **Vertical line (Y-axis)**: Read the left-alignment safe boundary of foreground layout (e.g. `X = W × 0.15`). Draw a vertical line from `Y = 0` to `Y = H`
251
+ - **Horizontal line (X-axis)**: Read the baseline or top boundary of the foreground main title (e.g. `Y = H × 0.32`). Draw a horizontal line from `X = 0` to `X = W`
252
+
253
+ **Visual effect**: The entire page is divided by implicit golden ratio lines, foreground text appears to grow precisely on these coordinate axes, extremely rigorous.
254
+
255
+ **ReportLab implementation notes**:
256
+ ```python
257
+ c.saveState()
258
+ c.setStrokeColorRGB(0, 0, 0, 0.04)
259
+ c.setLineWidth(0.5)
260
+ # Vertical line — align to foreground text left boundary
261
+ axis_x = W * 0.15
262
+ c.line(axis_x, 0, axis_x, H)
263
+ # Horizontal line — align to main title baseline
264
+ axis_y = H * 0.68 # ReportLab Y-flip: document H*0.32 → RL H*0.68
265
+ c.line(0, axis_y, W, axis_y)
266
+ c.restoreState()
267
+ ```
268
+
269
+ **Playwright/HTML implementation notes**:
270
+ ```html
271
+ <div style="position:absolute; inset:0; z-index:0; pointer-events:none;">
272
+ <!-- Vertical line -->
273
+ <div style="
274
+ position:absolute;
275
+ left: 15%;
276
+ top: 0;
277
+ width: 0.5px;
278
+ height: 100%;
279
+ background: rgba(0,0,0,0.04);
280
+ "></div>
281
+ <!-- Horizontal line -->
282
+ <div style="
283
+ position:absolute;
284
+ left: 0;
285
+ top: 32%;
286
+ width: 100%;
287
+ height: 0.5px;
288
+ background: rgba(0,0,0,0.04);
289
+ "></div>
290
+ </div>
291
+ ```
292
+
293
+ ---
294
+
295
+ ## 🛠️ Combination & Circuit Breaker (The Combination Matrix)
296
+
297
+ To ensure diversity in auto-generated backgrounds while preventing visual chaos, the system must implement a **"background combination state machine"**.
298
+
299
+ For each PDF generation, randomly select one of the following 3 legal Recipes, **cross-boundary combinations are strictly forbidden**:
300
+
301
+ ### ✅ Recipe A: Minimal Modern
302
+
303
+ **Combination**: `Option 1.1 (deep-space arc)` — **this one only, no other elements**
304
+
305
+ **Applicable scenes**: Safest, most whitespace, suitable for all types of corporate reports.
306
+
307
+ **Pairing suggestions with cover layouts**:
308
+ - Layout 1 (diagonal tension) — arc in the blank diagonal area, extremely harmonious
309
+ - Layout 2 (vertical gravity axis) — arc provides lower-left gravity
310
+ - Layout 4 (golden ratio) — arc adds breathing space to the lower whitespace area
311
+
312
+ ---
313
+
314
+ ### ✅ Recipe B: Engineering/Academic
315
+
316
+ **Combination**: `Option 3.1 (coordinate cross)` **+** `Option 2.1 (side giant spine)`
317
+
318
+ **Logic**: Vertical giant text interlaces with ultra-thin coordinate lines on the left, creating extreme thick-thin contrast, perfect for investment pitches and research reports.
319
+
320
+ **Line avoidance rule**: Option 3.1's ultra-thin lines should avoid crossing directly through Option 2.1 (giant text) strokes to prevent visual interference. Adjust line coordinates to avoid text areas:
321
+ - Vertical line `X` at `W × 0.15` (foreground text left-alignment line)
322
+ - Giant spine anchor `X` at `-W × 0.05` (left of vertical line, no crossing)
323
+
324
+ **Pairing suggestions with cover layouts**:
325
+ - Layout 7 (left-aligned matrix) — perfect match, left spine + coordinate lines + matrix text three-layer overlay
326
+ - Layout 2A (left-aligned vertical) — vertical line aligns with axis, doubled structural feel
327
+ - Layout 6A (side rotation decoration) — Note: 6A already has rotated year, if using Recipe B then **skip Option 2.1**, keep only Option 3.1
328
+
329
+ ---
330
+
331
+ ### ✅ Recipe C: Solid/Weighty
332
+
333
+ **Combination**: `Option 1.2 (sharp angle cut)` **+** `Option 2.2 (bottom full text)`
334
+
335
+ **Logic**: Bottom angular color block overlaid with fully displayed English word at the bottom, very low center of gravity, suitable for annual summaries and white papers.
336
+
337
+ **Stacking order**: Draw Option 1.2 angular color block first, then Option 2.2 bleed text (text on top of color block, but both below foreground content).
338
+
339
+ **Pairing suggestions with cover layouts**:
340
+ - Layout 4A (top suspended) — content on top, background pressed below, extreme top-bottom contrast
341
+ - Layout 1A (diagonal tension) — bottom gravity echoes lower-right text
342
+ - Layout 5A (stepped progression) — steps extend to lower-right, converging with bottom gravity
343
+
344
+ ---
345
+
346
+ ## 🚫 Circuit Breaker Rules (Hard Constraints)
347
+
348
+ The following combinations are **hard-forbidden**; violations are bugs:
349
+
350
+ | Forbidden Rule | Reason |
351
+ |---------|------|
352
+ | Option 2.1 + Option 2.2 together | **No dual text**. Only one giant text watermark allowed per page |
353
+ | Option 1.1 + Option 1.2 together | **No dual geometry**. Large circle + large diagonal = visual chaos |
354
+ | Option 3.1 lines crossing Option 2.x strokes | **Line isolation**. Ultra-thin lines must not cross giant text strokes; adjust coordinates to avoid |
355
+ | All three modules enabled | **Maximum two modules**. Three layers = overwhelms foreground |
356
+ | Any background element opacity > 6% | **Rule 1 violation**. Background must be subtle and barely visible |
357
+
358
+ ---
359
+
360
+ ## Recipe Selection Logic
361
+
362
+ When no specific recipe is specified, auto-select based on document type:
363
+
364
+ | Document Type | Recommended Recipe | Reason |
365
+ |---------|---------|------|
366
+ | Corporate reports, general docs | **A** | Safest, zero risk |
367
+ | Technical reports, investment pitches | **B** | Engineering feel, precision |
368
+ | Annual summaries, white papers | **C** | Solid, weighty |
369
+ | Creative, design | **A** | Maximum whitespace, no conflict with creative content |
370
+ | Academic papers | **B** | Structural feel matches academic tone |
371
+ | Uncertain / default | **A** | Minimal never goes wrong |
372
+
373
+ ---
374
+
375
+ ## Relationship with geometry.md
376
+
377
+ This file defines **page-level macro backgrounds** (Supergraphics / Watermarks / Hairlines), applied to the entire canvas.
378
+
379
+ `geometry.md` defines **local decorative anchors** (Offset Stacking / Scale Contrast / Grid Intersection), applied to specific areas.
380
+
381
+ Both can coexist, but note:
382
+ - Background layer (this file) is at the bottom
383
+ - Geometric anchors (geometry.md) are above the background layer but below foreground text
384
+ - If both are used, geometric anchors should be placed in "blank areas" of background elements to avoid visual overlap