konoha-mcp 2.1.12 → 2.1.14

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 (60) hide show
  1. package/.agents/skills/konoha/SKILL.md +25 -0
  2. package/.agents/skills/tokubetsu-jonin-skill/SKILL.md +48 -23
  3. package/.agents/skills/tokubetsu-jonin-skill/references/docx.md +25 -4
  4. package/.agents/skills/tokubetsu-jonin-skill/references/elite-powerpoint-designer.md +48 -23
  5. package/.agents/skills/tokubetsu-jonin-skill/references/pdf.md +78 -46
  6. package/.agents/skills/tokubetsu-jonin-skill/references/pptx-assets/scripts/office/soffice.py +15 -10
  7. package/.agents/skills/tokubetsu-jonin-skill/references/pptx.md +25 -3
  8. package/.agents/skills/tokubetsu-jonin-skill/references/xlsx-assets/scripts/office/soffice.py +15 -10
  9. package/.agents/skills/tokubetsu-jonin-skill/references/xlsx.md +60 -33
  10. package/.agents/skills/tokubetsu-jonin-skill/references/zero-ai-human-writing.md +34 -11
  11. package/.agents/skills.fingerprint +1 -1
  12. package/README.md +18 -6
  13. package/apps/web/build/adapter-node.js +1 -1
  14. package/apps/web/build/client/_app/version.json +1 -1
  15. package/apps/web/build/client/_app/version.json.br +0 -0
  16. package/apps/web/build/client/_app/version.json.gz +0 -0
  17. package/apps/web/build/server/chunks/instance.js +3 -3
  18. package/apps/web/build/server/chunks/internal.js +1 -1
  19. package/apps/web/package.json +1 -1
  20. package/bin/cli.js +11 -10
  21. package/docs/ALL-WORKFLOW-DIAGRAMS.md +642 -0
  22. package/docs/ARCHITECTURE.md +15 -5
  23. package/docs/SETUP-CLI.md +1 -1
  24. package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.13_2026-10-07.md +95 -0
  25. package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.14_2026-10-08.md +88 -0
  26. package/docs/diagrams/README.md +1 -1
  27. package/package.json +3 -2
  28. package/src/agent_manager.js +20 -4
  29. package/src/canonical_skills.js +381 -0
  30. package/src/cursor_manager.js +7 -11
  31. package/src/deploy_utils.js +3 -1
  32. package/src/file_tools_router.js +3 -1
  33. package/src/mcp/anti_slop.js +281 -0
  34. package/src/mcp/memory_reporting.js +21 -0
  35. package/src/mcp/skills.js +278 -0
  36. package/src/mcp/tool_dispatch.js +14 -1
  37. package/src/mcp/workflow.js +1 -1
  38. package/src/mcp_tool_manifest.json +59 -0
  39. package/src/migrate.js +23 -0
  40. package/src/templates/agents.yaml +21 -0
  41. package/src/templates/skills/konoha/SKILL.md +25 -0
  42. package/src/templates/skills/tokubetsu-jonin-skill/SKILL.md +48 -23
  43. package/src/templates/skills/tokubetsu-jonin-skill/references/docx.md +25 -4
  44. package/src/templates/skills/tokubetsu-jonin-skill/references/elite-powerpoint-designer.md +48 -23
  45. package/src/templates/skills/tokubetsu-jonin-skill/references/pdf.md +78 -46
  46. package/src/templates/skills/tokubetsu-jonin-skill/references/pptx-assets/scripts/office/soffice.py +15 -10
  47. package/src/templates/skills/tokubetsu-jonin-skill/references/pptx.md +25 -3
  48. package/src/templates/skills/tokubetsu-jonin-skill/references/xlsx-assets/scripts/office/soffice.py +15 -10
  49. package/src/templates/skills/tokubetsu-jonin-skill/references/xlsx.md +60 -33
  50. package/src/templates/skills/tokubetsu-jonin-skill/references/zero-ai-human-writing.md +34 -11
  51. package/src/vector_search.js +11 -6
  52. package/.agents/skills/helm-chart-scaffolding/SKILL.md +0 -71
  53. package/.agents/skills/helm-chart-scaffolding/assets/Chart.yaml.template +0 -42
  54. package/.agents/skills/helm-chart-scaffolding/assets/values.yaml.template +0 -185
  55. package/.agents/skills/helm-chart-scaffolding/references/chart-structure.md +0 -509
  56. package/.agents/skills/helm-chart-scaffolding/references/details.md +0 -497
  57. package/.agents/skills/helm-chart-scaffolding/scripts/validate-chart.sh +0 -244
  58. package/src/templates/skills/helm-chart-scaffolding/SKILL.md +0 -71
  59. package/src/templates/skills/helm-chart-scaffolding/references/chart-structure.md +0 -509
  60. package/src/templates/skills/helm-chart-scaffolding/references/details.md +0 -497
@@ -21,28 +21,52 @@ Use this reference whenever generating, styling, or auditing standalone PDF docu
21
21
  ## 1. Zero-AI Human Document Invariants
22
22
 
23
23
  When creating executive PDFs:
24
- - **Strict Light Mode Invariant (Zero Dark Style)**: PDFs must strictly use pure light mode. Never apply dark theme fills, dark covers, dark header blocks, or black/near-black backgrounds to any page. Page backgrounds must be pure white (`#FFFFFF`) or pearl (`#FAFAFA`).
25
- - **3-Color Minimum Gradient Invariant**: When decorative color is applied to headers, footers, cover accents, or callout ribbons, always use a smooth multi-stop gradient with a minimum of 3 colors (e.g., Sapphire `#1E3A8A` → Azure `#2563EB` → Sky `#60A5FA` or Teal `#0D9488` → Cyan `#06B6D4` → Mint `#6EE7B7`). Monotone dark bars or 2-color harsh transitions are strictly forbidden.
24
+ - **Strict Light Mode & Zero Black/Dark Invariant**: Under NO circumstances create, generate, or style PDF documents with black, dark gray, or dark blue anywhere (text, fills, lines, backgrounds). Strictly forbidden: `#000000`, `#000`, dark navy, dark slate (`#0F172A`, `#1E293B`, `#1E3A8A`), or dark blocks. All document backgrounds must be pure white (`#FFFFFF`) or pearl (`#FAFAFA`), with text strictly in **medium slate `#64748B`**.
25
+ - **20 Canonical 4-Base-Color Themes**: When decorative color is applied to headers, footers, cover accents, or callout ribbons, ALWAYS apply a smooth **4-base-color gradient**, randomly selecting ONE of the 20 canonical themes (T01–T20) per document and keeping it consistent throughout:
26
+ - **T01**: `linear-gradient(90deg,#8A4FD0,#E8453C,#F08A24,#F7C948)`
27
+ - **T02**: `linear-gradient(90deg,#17B3A3,#3A8DDE,#8A4FD0,#E85DA0)`
28
+ - **T03**: `linear-gradient(90deg,#34B38A,#F7C948,#F08A24,#E85DA0)`
29
+ - **T04**: `linear-gradient(90deg,#3A8DDE,#17B3A3,#6FCF7A,#F7C948)`
30
+ - **T05**: `linear-gradient(90deg,#8A4FD0,#D6459E,#E8453C,#F5A04A)`
31
+ - **T06**: `linear-gradient(90deg,#5CC46A,#F7C948,#F08A24,#E8453C)`
32
+ - **T07**: `linear-gradient(90deg,#4F8DF0,#8A4FD0,#E85DA0,#F5A04A)`
33
+ - **T08**: `linear-gradient(90deg,#17B3A3,#6FCF7A,#F7C948,#F2705F)`
34
+ - **T09**: `linear-gradient(90deg,#3AA6C9,#8A4FD0,#E85DA0,#F7C948)`
35
+ - **T10**: `linear-gradient(90deg,#3A8DDE,#52D1BC,#8BCB4A,#F5A623)`
36
+ - **T11**: `linear-gradient(90deg,#8A4FD0,#E85DA0,#F2705F,#F7C948)`
37
+ - **T12**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#E85D75)`
38
+ - **T13**: `linear-gradient(90deg,#4F8DF0,#D6459E,#E85D75,#F5A04A)`
39
+ - **T14**: `linear-gradient(90deg,#8A4FD0,#3A8DDE,#17B3A3,#8BCB4A)`
40
+ - **T15**: `linear-gradient(90deg,#E85DA0,#E8453C,#F08A24,#8BCB4A)`
41
+ - **T16**: `linear-gradient(90deg,#7C5CE0,#3A8DDE,#52D1BC,#6FCF7A)`
42
+ - **T17**: `linear-gradient(90deg,#E8453C,#F08A24,#F7C948,#8BCB4A)`
43
+ - **T18**: `linear-gradient(90deg,#3A8DDE,#8A4FD0,#D6459E,#F2705F)`
44
+ - **T19**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#F08A24)`
45
+ - **T20**: `linear-gradient(90deg,#E85DA0,#F08A24,#F7C948,#17B3A3)`
26
46
  - **Dynamic Two-Pass Pagination**: Every multi-page PDF must include running headers/footers with dynamic page numbering in the exact format: `Page X of Y`. Hardcoded single numbers (`Page 1`) signal naive generation.
27
- - **Professional Font Pairing**: Body copy set in crisp, readable sans-serif (Helvetica, Inter, Arial, Calibri) at 10–10.5pt with 14–15pt leading. Headlines in bold, authoritative hierarchy (H1: 22–26pt, H2: 15–18pt, H3: 12–14pt).
28
- - **Executive Data Tables**: Table headers use light executive fills (`#F1F5F9` or `#E2E8F0`) with dark typography (`#0F172A`). Subtle grid borders (`#E2E8F0`). Alternating rows use pearl shading (`#F8FAFC`).
29
- - **Executive Callout Boxes**: Light tinted fill (`#F0F9FF` or `#F8FAFC`) with a 3-color gradient accent bar along the left edge.
47
+ - **Strict Typography Contract**: PDF/digital deliverables strictly use **Inter (headings and body)** (fallback: Helvetica/Arial). Body copy at 10–10.5pt with 14–15pt leading in medium slate `#64748B`. Headlines in bold, authoritative hierarchy (H1: 22–26pt, H2: 15–18pt, H3: 12–14pt) in medium slate `#64748B`.
48
+ - **Executive Data Tables**: Table headers use light executive fills (`#F1F5F9`) with `#64748B` typography. Subtle grid borders (`#CBD5E1` / `#E2E8F0`). Alternating rows use pearl shading (`#F8FAFC`).
49
+ - **Executive Callout Boxes**: Light tinted fill (`#F8FAFC`) with a 4-color gradient accent bar along the left edge.
30
50
  - **Strict Zero Watermark Invariant**: Under NO circumstances should generated, styled, or compiled PDFs include watermarks, diagonal background stamps ("DRAFT", "CONFIDENTIAL", "SAMPLE"), translucent overlay text, or evaluation markings. All pages must be crisp, unblemished, executive-class documents.
31
51
  - **Metadata Scrubbing**: Author, Title, and Subject fields must be sanitized to human executive attributes; automated generator tags (e.g. `ReportLab PDF Library`, `WeasyPrint`) must be purged.
52
+ - **Mandatory Kage Review Gate**: Every generated PDF document must undergo Kage review before completion.
32
53
 
33
54
  ---
34
55
 
35
56
  ## 2. Professional Color Palettes (Pure Light Mode)
36
57
 
37
- | Element | Executive Slate & Sapphire (Default) | Forest & Mint Finance | Modern Azure Tech |
38
- |---|---|---|---|
39
- | **Page Background** | Pure White `#FFFFFF` | Pure White `#FFFFFF` | Pure White `#FFFFFF` |
40
- | **Body Typography** | Deep Slate `#1E293B` | Deep Slate `#1E293B` | Charcoal `#334155` |
41
- | **Headings** | Midnight Slate `#0F172A` | Deep Spruce `#064E3B` | Deep Navy `#0C4A6E` |
42
- | **3-Color Accent Gradient** | Sapphire `#1E3A8A` → Azure `#2563EB` → Sky `#60A5FA` | Pine `#047857` → Teal `#0D9488` → Mint `#34D399` | Cobalt `#1D4ED8` → Blue `#3B82F6` → Ice `#93C5FD` |
43
- | **Table Header Fill** | Executive Tint `#F1F5F9` | Sage Tint `#ECFDF5` | Azure Tint `#F0F9FF` |
44
- | **Table Header Text** | Bold Slate `#0F172A` | Bold Spruce `#064E3B` | Bold Navy `#0C4A6E` |
45
- | **Callout Background** | Soft Slate `#F8FAFC` | Soft Sage `#F0FDF4` | Soft Sky `#F0F9FF` |
58
+ Never use black, dark gray, dark blue, or dark theme fills. Use refined business-class light palettes with text in medium slate `#64748B`:
59
+
60
+ | Element | Specification & Values |
61
+ |---|---|
62
+ | **Page Background** | Pure White `#FFFFFF` or Soft Pearl `#FAFAFA` |
63
+ | **Typography (Headings & Body)** | Medium Slate `#64748B` (Inter font exclusively) |
64
+ | **4-Base-Color Accent Gradient** | 4-base-color gradient ribbon matching chosen theme (T01–T20) |
65
+ | **Table Header Fill** | Executive Light Tint `#F1F5F9` |
66
+ | **Table Header Text** | Medium Slate `#64748B` (Bold) |
67
+ | **Table Cell Borders** | Subtle Light Slate `#CBD5E1` / `#E2E8F0` |
68
+ | **Alternating Rows** | Soft Pearl `#F8FAFC` |
69
+ | **Callout Background** | Soft Slate `#F8FAFC` with 4-color left border accent |
46
70
 
47
71
  ---
48
72
 
@@ -88,22 +112,26 @@ class NumberedCanvas(canvas.Canvas):
88
112
  if self._pageNumber > 1:
89
113
  self.drawString(54, 11 * inch - 36, "Konoha Infrastructure Engineering · Architecture Audit")
90
114
  self.drawRightString(8.5 * inch - 54, 11 * inch - 36, "Q3 Production Performance")
91
- # 3-Color Gradient Running Header Accent Ribbon
92
- self.setFillColor(colors.HexColor("#1E3A8A"))
93
- self.rect(54, 11 * inch - 42, 170, 2, fill=True, stroke=False)
94
- self.setFillColor(colors.HexColor("#2563EB"))
95
- self.rect(224, 11 * inch - 42, 170, 2, fill=True, stroke=False)
96
- self.setFillColor(colors.HexColor("#60A5FA"))
97
- self.rect(394, 11 * inch - 42, 110, 2, fill=True, stroke=False)
115
+ # 4-Base-Color Gradient Running Header Accent Ribbon (Theme T01)
116
+ self.setFillColor(colors.HexColor("#8A4FD0"))
117
+ self.rect(54, 11 * inch - 42, 125, 2, fill=True, stroke=False)
118
+ self.setFillColor(colors.HexColor("#E8453C"))
119
+ self.rect(179, 11 * inch - 42, 125, 2, fill=True, stroke=False)
120
+ self.setFillColor(colors.HexColor("#F08A24"))
121
+ self.rect(304, 11 * inch - 42, 125, 2, fill=True, stroke=False)
122
+ self.setFillColor(colors.HexColor("#F7C948"))
123
+ self.rect(429, 11 * inch - 42, 75, 2, fill=True, stroke=False)
98
124
 
99
125
  # Footer (all pages)
100
- # 3-Color Gradient Running Footer Accent Ribbon
101
- self.setFillColor(colors.HexColor("#1E3A8A"))
102
- self.rect(54, 46, 170, 1.5, fill=True, stroke=False)
103
- self.setFillColor(colors.HexColor("#2563EB"))
104
- self.rect(224, 46, 170, 1.5, fill=True, stroke=False)
105
- self.setFillColor(colors.HexColor("#60A5FA"))
106
- self.rect(394, 46, 110, 1.5, fill=True, stroke=False)
126
+ # 4-Base-Color Gradient Running Footer Accent Ribbon (Theme T01)
127
+ self.setFillColor(colors.HexColor("#8A4FD0"))
128
+ self.rect(54, 46, 125, 1.5, fill=True, stroke=False)
129
+ self.setFillColor(colors.HexColor("#E8453C"))
130
+ self.rect(179, 46, 125, 1.5, fill=True, stroke=False)
131
+ self.setFillColor(colors.HexColor("#F08A24"))
132
+ self.rect(304, 46, 125, 1.5, fill=True, stroke=False)
133
+ self.setFillColor(colors.HexColor("#F7C948"))
134
+ self.rect(429, 46, 75, 1.5, fill=True, stroke=False)
107
135
 
108
136
  self.drawString(54, 32, "Confidential · Internal Executive Review Only")
109
137
  page_str = f"Page {self._pageNumber} of {page_count}"
@@ -129,7 +157,7 @@ def build_executive_pdf(output_path="executive_report.pdf"):
129
157
  fontName='Helvetica-Bold',
130
158
  fontSize=24,
131
159
  leading=30,
132
- textColor=colors.HexColor("#0F172A"),
160
+ textColor=colors.HexColor("#64748B"),
133
161
  spaceAfter=8
134
162
  )
135
163
  subtitle_style = ParagraphStyle(
@@ -138,7 +166,7 @@ def build_executive_pdf(output_path="executive_report.pdf"):
138
166
  fontName='Helvetica',
139
167
  fontSize=12,
140
168
  leading=16,
141
- textColor=colors.HexColor("#475569"),
169
+ textColor=colors.HexColor("#64748B"),
142
170
  spaceAfter=20
143
171
  )
144
172
  body_style = ParagraphStyle(
@@ -147,7 +175,7 @@ def build_executive_pdf(output_path="executive_report.pdf"):
147
175
  fontName='Helvetica',
148
176
  fontSize=10,
149
177
  leading=14,
150
- textColor=colors.HexColor("#1E293B"),
178
+ textColor=colors.HexColor("#64748B"),
151
179
  spaceAfter=10
152
180
  )
153
181
 
@@ -183,7 +211,7 @@ def build_executive_pdf(output_path="executive_report.pdf"):
183
211
  t = Table(table_data, colWidths=[150, 110, 110, 134])
184
212
  t.setStyle(TableStyle([
185
213
  ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor("#F1F5F9")),
186
- ('TEXTCOLOR', (0, 0), (-1, 0), colors.HexColor("#0F172A")),
214
+ ('TEXTCOLOR', (0, 0), (-1, 0), colors.HexColor("#64748B")),
187
215
  ('BOTTOMPADDING', (0, 0), (-1, -1), 6),
188
216
  ('TOPPADDING', (0, 0), (-1, -1), 6),
189
217
  ('GRID', (0, 0), (-1, -1), 0.5, colors.HexColor("#CBD5E1")),
@@ -227,32 +255,32 @@ For environments leveraging HTML-to-PDF compilation via `weasyprint`, use strict
227
255
  }
228
256
  @bottom-right {
229
257
  content: "Page " counter(page) " of " counter(pages);
230
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
258
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
231
259
  font-size: 8pt;
232
260
  font-weight: bold;
233
- color: #0F172A;
261
+ color: #64748B;
234
262
  }
235
263
  }
236
264
 
237
265
  body {
238
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
239
- color: #1E293B;
266
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
267
+ color: #64748B;
240
268
  background-color: #FFFFFF;
241
269
  line-height: 1.5;
242
270
  font-size: 10pt;
243
271
  }
244
272
 
245
- /* 3-Color Minimum Gradient Accent Ribbon */
273
+ /* 4-Base-Color Theme Gradient Accent Ribbon (Theme T01) */
246
274
  .gradient-bar {
247
275
  height: 4px;
248
- background: linear-gradient(90deg, #1E3A8A 0%, #2563EB 50%, #60A5FA 100%);
276
+ background: linear-gradient(90deg, #8A4FD0 0%, #E8453C 33%, #F08A24 66%, #F7C948 100%);
249
277
  margin-bottom: 24px;
250
278
  border-radius: 2px;
251
279
  }
252
280
 
253
281
  h1 {
254
282
  font-size: 22pt;
255
- color: #0F172A;
283
+ color: #64748B;
256
284
  margin: 0 0 6px 0;
257
285
  font-weight: 700;
258
286
  }
@@ -271,7 +299,7 @@ table {
271
299
 
272
300
  th {
273
301
  background-color: #F1F5F9;
274
- color: #0F172A;
302
+ color: #64748B;
275
303
  font-weight: 600;
276
304
  text-align: left;
277
305
  padding: 8px 12px;
@@ -282,6 +310,7 @@ th {
282
310
  td {
283
311
  padding: 8px 12px;
284
312
  border: 1px solid #E2E8F0;
313
+ color: #64748B;
285
314
  font-size: 9pt;
286
315
  }
287
316
 
@@ -304,9 +333,12 @@ tr:nth-child(even) td {
304
333
  ## 5. Delivery & Verification Checklist
305
334
 
306
335
  Before releasing any executive PDF document:
307
- 1. **Zero Dark Theme Invariant**: Every page must have a pure white (`#FFFFFF`) or pearl (`#FAFAFA`) background. Zero dark covers, headers, or fills.
308
- 2. **3-Color Minimum Gradient Invariant**: Running header/footer ribbons, cover accents, or decorative dividers must use at least 3 gradient stops (e.g. Sapphire `#1E3A8A` → Azure `#2563EB` → Sky `#60A5FA`).
309
- 3. **Table Header Fills**: Executive light tint (`#F1F5F9` or `#E2E8F0`) with crisp high-contrast dark text (`#0F172A`).
310
- 4. **Dynamic Pagination**: Footers must display dynamic `Page X of Y` computed over the actual document length.
311
- 5. **No Overflow / Clipping**: Verify tables and text blocks fit within page margins without trailing orphans or text clipping.
312
- 6. **Metadata Sanitization**: Check PDF properties with `pdfinfo` or Adobe Reader to ensure generator tags (`ReportLab`, `WeasyPrint`) are replaced with professional author and organization names.
336
+ 1. **Strict Light Mode & Zero Black/Dark Invariant**: Every page must have a pure white (`#FFFFFF`) or pearl (`#FAFAFA`) background. Zero black, dark gray, or dark blue anywhere (text, fills, lines, backgrounds).
337
+ 2. **Medium Slate `#64748B` Typography**: All typography strictly in `#64748B`.
338
+ 3. **Inter Typography Contract**: Inter font strictly used for headings and body.
339
+ 4. **4-Base-Color Theme Gradient**: Running header/footer ribbons, cover accents, or decorative dividers must use a 4-base-color gradient matching one of the 20 canonical themes (T01–T20) consistently.
340
+ 5. **Table Header Fills**: Executive light tint (`#F1F5F9`) with medium slate `#64748B` text and subtle `#CBD5E1` borders.
341
+ 6. **Dynamic Pagination**: Footers must display dynamic `Page X of Y` computed over the actual document length.
342
+ 7. **No Overflow / Clipping**: Verify tables and text blocks fit within page margins without trailing orphans or text clipping.
343
+ 8. **Metadata Sanitization**: Check PDF properties with `pdfinfo` or Adobe Reader to ensure generator tags (`ReportLab`, `WeasyPrint`) are replaced with professional author and organization names.
344
+ 9. **Mandatory Kage Review Gate**: Always run Kage review to verify zero-slop compliance, visual hierarchy, and 0% AI detection before delivery.
@@ -47,10 +47,9 @@ def run_soffice(args: Iterable[str], **kwargs) -> subprocess.CompletedProcess:
47
47
 
48
48
 
49
49
 
50
- _SHIM_SO = Path(tempfile.gettempdir()) / "lo_socket_shim.so"
51
-
52
-
53
50
  def _needs_shim() -> bool:
51
+ if os.environ.get("ENABLE_SOFFICE_SOCKET_SHIM") != "1":
52
+ return False
54
53
  try:
55
54
  s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
56
55
  s.close()
@@ -60,18 +59,24 @@ def _needs_shim() -> bool:
60
59
 
61
60
 
62
61
  def _ensure_shim() -> Path:
63
- if _SHIM_SO.exists():
64
- return _SHIM_SO
65
-
66
- src = Path(tempfile.gettempdir()) / "lo_socket_shim.c"
62
+ # Use a secure, user-private directory (mode 0700) to avoid shared temp attacks
63
+ uid = getattr(os, "getuid", lambda: "safe")()
64
+ shim_dir = Path(tempfile.gettempdir()) / f"lo_shim_uid_{uid}"
65
+ shim_dir.mkdir(mode=0o700, parents=True, exist_ok=True)
66
+ shim_so = shim_dir / "lo_socket_shim.so"
67
+ if shim_so.exists():
68
+ return shim_so
69
+
70
+ src = shim_dir / "lo_socket_shim.c"
67
71
  src.write_text(_SHIM_SOURCE)
68
72
  subprocess.run(
69
- ["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"],
73
+ ["gcc", "-shared", "-fPIC", "-o", str(shim_so), str(src), "-ldl"],
70
74
  check=True,
71
75
  capture_output=True,
72
76
  )
73
- src.unlink()
74
- return _SHIM_SO
77
+ if src.exists():
78
+ src.unlink()
79
+ return shim_so
75
80
 
76
81
 
77
82
 
@@ -21,8 +21,29 @@ Use this reference whenever building, modifying, or styling presentations and sl
21
21
  ## 1. Zero-AI Slide Design Invariants
22
22
 
23
23
  When creating slide presentations:
24
- - **Strict Light Mode Invariant (Zero Dark Theme Style)**: Under NO circumstances generate, style, or refine slides with dark theme style. Dark slide backgrounds, black title slides, dark hero covers, dark header bars, and near-black card fills are STRICTLY FORBIDDEN. All slides must use pure white (`#FFFFFF`) or soft pearl white (`#F8FAFC`).
25
- - **3-Color Minimum Gradient for Covers, Headers, & Footers**: When visual color or decorative emphasis is needed for title slide covers, header bands, footer accents, or card divider rules, ALWAYS create a smooth multi-stop gradient with a MINIMUM of 3 colors (e.g. Executive Sapphire `#1E3A8A` → `#2563EB` → `#60A5FA`, Teal-to-Cyan-to-Mint `#0D9488` → `#06B6D4` → `#6EE7B7`, or Sunrise Amber `#9A3412` → `#F59E0B` → `#FDE68A`). Never use dark gradients or single flat dark blocks.
24
+ - **Strict Light Mode & Zero Black/Dark Invariant**: Under NO circumstances generate, style, or refine slides with black, dark gray, or dark blue anywhere (text, fills, lines, backgrounds). Strictly forbidden: `#000000`, `#000`, dark navy, dark slate (`#0F172A`, `#1E293B`, `#1E3A8A`), or dark blocks. All slides must use pure white (`#FFFFFF`) or pearl (`#F8FAFC`), with text strictly in **medium slate `#64748B`**.
25
+ - **20 Canonical 4-Base-Color Themes**: When decorative color or visual emphasis is needed for title covers, headers, footers, card accent strips, or divider rules, ALWAYS apply a smooth **4-base-color gradient**, randomly selecting ONE of the 20 canonical themes (T01–T20) per deck and keeping it consistent throughout:
26
+ - **T01**: `linear-gradient(90deg,#8A4FD0,#E8453C,#F08A24,#F7C948)`
27
+ - **T02**: `linear-gradient(90deg,#17B3A3,#3A8DDE,#8A4FD0,#E85DA0)`
28
+ - **T03**: `linear-gradient(90deg,#34B38A,#F7C948,#F08A24,#E85DA0)`
29
+ - **T04**: `linear-gradient(90deg,#3A8DDE,#17B3A3,#6FCF7A,#F7C948)`
30
+ - **T05**: `linear-gradient(90deg,#8A4FD0,#D6459E,#E8453C,#F5A04A)`
31
+ - **T06**: `linear-gradient(90deg,#5CC46A,#F7C948,#F08A24,#E8453C)`
32
+ - **T07**: `linear-gradient(90deg,#4F8DF0,#8A4FD0,#E85DA0,#F5A04A)`
33
+ - **T08**: `linear-gradient(90deg,#17B3A3,#6FCF7A,#F7C948,#F2705F)`
34
+ - **T09**: `linear-gradient(90deg,#3AA6C9,#8A4FD0,#E85DA0,#F7C948)`
35
+ - **T10**: `linear-gradient(90deg,#3A8DDE,#52D1BC,#8BCB4A,#F5A623)`
36
+ - **T11**: `linear-gradient(90deg,#8A4FD0,#E85DA0,#F2705F,#F7C948)`
37
+ - **T12**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#E85D75)`
38
+ - **T13**: `linear-gradient(90deg,#4F8DF0,#D6459E,#E85D75,#F5A04A)`
39
+ - **T14**: `linear-gradient(90deg,#8A4FD0,#3A8DDE,#17B3A3,#8BCB4A)`
40
+ - **T15**: `linear-gradient(90deg,#E85DA0,#E8453C,#F08A24,#8BCB4A)`
41
+ - **T16**: `linear-gradient(90deg,#7C5CE0,#3A8DDE,#52D1BC,#6FCF7A)`
42
+ - **T17**: `linear-gradient(90deg,#E8453C,#F08A24,#F7C948,#8BCB4A)`
43
+ - **T18**: `linear-gradient(90deg,#3A8DDE,#8A4FD0,#D6459E,#F2705F)`
44
+ - **T19**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#F08A24)`
45
+ - **T20**: `linear-gradient(90deg,#E85DA0,#F08A24,#F7C948,#17B3A3)`
46
+ - **Strict Typography Contract**: PowerPoint strictly uses **Segoe UI Semibold or Georgia (headings) + Segoe UI or Calibri (body)** with consistent spacing, alignment, and visual hierarchy.
26
47
  - **The "Rule of One"**: Exactly 1 central thesis or key takeaway per slide.
27
48
  - **Strict Ban on AI Bullet Walls**: Never write slides with 4–6 generic bullet points of identical sentence length.
28
49
  - *Bad (AI)*: 5 bullets each starting with "Ensures that...", "Facilitates...", "Helps to optimize..."
@@ -30,8 +51,9 @@ When creating slide presentations:
30
51
  - **Stat Callouts as Visuals**: When presenting performance, savings, or metrics, render the number in massive 44–60pt bold font with a concise 12pt label below it.
31
52
  - **Asymmetric 2-Column Layouts**: Use 60/40 or 70/30 split layouts (e.g. left side big takeaway and key metrics, right side data table or architectural diagram).
32
53
  - **16:9 Widescreen Standard**: Always format for 16:9 widescreen (`layout: 'LAYOUT_16x9'` in pptxgenjs; `slide_width = Inches(13.333)`, `slide_height = Inches(7.5)` in python-pptx).
33
- - **Strict Zero Watermark Invariant**: Under NO circumstances should presentation slide decks contain watermarks, translucent "CONFIDENTIAL" / "DRAFT" diagonal stamps, or background evaluation watermarks.
54
+ - **Strict Zero Watermark Invariant**: Under NO circumstances should presentation slide decks contain watermarks, translucent stamps, or background evaluation watermarks.
34
55
  - **Metadata Scrubbing**: Set core presentation properties (`creator`, `lastModifiedBy`, `title`) to the human author or project name; remove `python-pptx` and `pptxgenjs` tags.
56
+ - **Mandatory Kage Review Gate**: Always use Kage review on every generated PPTX presentation.
35
57
 
36
58
  ---
37
59
 
@@ -47,10 +47,9 @@ def run_soffice(args: Iterable[str], **kwargs) -> subprocess.CompletedProcess:
47
47
 
48
48
 
49
49
 
50
- _SHIM_SO = Path(tempfile.gettempdir()) / "lo_socket_shim.so"
51
-
52
-
53
50
  def _needs_shim() -> bool:
51
+ if os.environ.get("ENABLE_SOFFICE_SOCKET_SHIM") != "1":
52
+ return False
54
53
  try:
55
54
  s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
56
55
  s.close()
@@ -60,18 +59,24 @@ def _needs_shim() -> bool:
60
59
 
61
60
 
62
61
  def _ensure_shim() -> Path:
63
- if _SHIM_SO.exists():
64
- return _SHIM_SO
65
-
66
- src = Path(tempfile.gettempdir()) / "lo_socket_shim.c"
62
+ # Use a secure, user-private directory (mode 0700) to avoid shared temp attacks
63
+ uid = getattr(os, "getuid", lambda: "safe")()
64
+ shim_dir = Path(tempfile.gettempdir()) / f"lo_shim_uid_{uid}"
65
+ shim_dir.mkdir(mode=0o700, parents=True, exist_ok=True)
66
+ shim_so = shim_dir / "lo_socket_shim.so"
67
+ if shim_so.exists():
68
+ return shim_so
69
+
70
+ src = shim_dir / "lo_socket_shim.c"
67
71
  src.write_text(_SHIM_SOURCE)
68
72
  subprocess.run(
69
- ["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"],
73
+ ["gcc", "-shared", "-fPIC", "-o", str(shim_so), str(src), "-ldl"],
70
74
  check=True,
71
75
  capture_output=True,
72
76
  )
73
- src.unlink()
74
- return _SHIM_SO
77
+ if src.exists():
78
+ src.unlink()
79
+ return shim_so
75
80
 
76
81
 
77
82
 
@@ -20,8 +20,29 @@ Use this reference whenever generating, editing, or auditing Microsoft Excel (.x
20
20
  ## 1. Zero-AI Human Data Presentation Invariants
21
21
 
22
22
  When creating spreadsheets:
23
- - **Strict Light Mode Invariant (Zero Dark Style)**: Spreadsheets must strictly use pure light mode. Never apply dark theme fills, dark covers, dark header blocks, or black/near-black fills to cells, sheets, or tables. Backgrounds must be pure white (`#FFFFFF`) or soft pearl (`#F8FAFC`).
24
- - **3-Color Minimum Gradient Invariant**: When decorative accent styling is applied (such as top accent ribbons on table headers, summary cards, or KPI divider rows), use a smooth multi-stop gradient with a minimum of 3 colors (e.g., Sapphire `#1E3A8A` → Azure `#2563EB` → Sky `#60A5FA` or Emerald `#047857` → Teal `#0D9488` → Mint `#34D399`), never dark monotone fills.
23
+ - **Strict Light Mode & Zero Black/Dark Invariant**: Under NO circumstances create, generate, or style Excel workbooks with black, dark gray, or dark blue anywhere (text, fills, lines, backgrounds). Strictly forbidden: `#000000`, `#000`, dark navy, dark slate (`#0F172A`, `#1E293B`, `#1E3A8A`), or dark blocks. All sheet backgrounds must be pure white (`#FFFFFF`) or pearl (`#F8FAFC`), with text strictly in **medium slate `#64748B`**.
24
+ - **20 Canonical 4-Base-Color Themes**: When decorative accent styling is applied (such as top accent ribbons on table headers, summary cards, or KPI divider rows), ALWAYS apply a smooth **4-base-color gradient**, randomly selecting ONE of the 20 canonical themes (T01–T20) per document and keeping it consistent throughout:
25
+ - **T01**: `linear-gradient(90deg,#8A4FD0,#E8453C,#F08A24,#F7C948)`
26
+ - **T02**: `linear-gradient(90deg,#17B3A3,#3A8DDE,#8A4FD0,#E85DA0)`
27
+ - **T03**: `linear-gradient(90deg,#34B38A,#F7C948,#F08A24,#E85DA0)`
28
+ - **T04**: `linear-gradient(90deg,#3A8DDE,#17B3A3,#6FCF7A,#F7C948)`
29
+ - **T05**: `linear-gradient(90deg,#8A4FD0,#D6459E,#E8453C,#F5A04A)`
30
+ - **T06**: `linear-gradient(90deg,#5CC46A,#F7C948,#F08A24,#E8453C)`
31
+ - **T07**: `linear-gradient(90deg,#4F8DF0,#8A4FD0,#E85DA0,#F5A04A)`
32
+ - **T08**: `linear-gradient(90deg,#17B3A3,#6FCF7A,#F7C948,#F2705F)`
33
+ - **T09**: `linear-gradient(90deg,#3AA6C9,#8A4FD0,#E85DA0,#F7C948)`
34
+ - **T10**: `linear-gradient(90deg,#3A8DDE,#52D1BC,#8BCB4A,#F5A623)`
35
+ - **T11**: `linear-gradient(90deg,#8A4FD0,#E85DA0,#F2705F,#F7C948)`
36
+ - **T12**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#E85D75)`
37
+ - **T13**: `linear-gradient(90deg,#4F8DF0,#D6459E,#E85D75,#F5A04A)`
38
+ - **T14**: `linear-gradient(90deg,#8A4FD0,#3A8DDE,#17B3A3,#8BCB4A)`
39
+ - **T15**: `linear-gradient(90deg,#E85DA0,#E8453C,#F08A24,#8BCB4A)`
40
+ - **T16**: `linear-gradient(90deg,#7C5CE0,#3A8DDE,#52D1BC,#6FCF7A)`
41
+ - **T17**: `linear-gradient(90deg,#E8453C,#F08A24,#F7C948,#8BCB4A)`
42
+ - **T18**: `linear-gradient(90deg,#3A8DDE,#8A4FD0,#D6459E,#F2705F)`
43
+ - **T19**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#F08A24)`
44
+ - **T20**: `linear-gradient(90deg,#E85DA0,#F08A24,#F7C948,#17B3A3)`
45
+ - **Strict Typography Contract**: Excel spreadsheets strictly use **Calibri for both headings and body**, with crisp point sizing (Title: 16pt, Subtitle: 10pt, Headers/Data: 11pt, Totals: 11pt bold).
25
46
  - **Zero Raw Numbers**: Never leave bare floats (`0.3333333333`). Format currency as `$#,##0` or `$#,##0.00`, percentages as `0.0%` or `0%`, counts as `#,##0`.
26
47
  - **Formulas Over Hardcoded Values**: If a number is derived from other cells, calculate it via an Excel formula (`=SUM(C4:C12)`, `=C13-D13`), never paste pre-calculated static values into summary rows.
27
48
  - **Formula Casing**: Always write formula names in ALL CAPS (`SUM`, `AVERAGE`, `IF`, `XLOOKUP`, `INDEX`, `MATCH`). Lowercase formula names (`=sum(...)`) signal hasty robotic generation.
@@ -29,21 +50,23 @@ When creating spreadsheets:
29
50
  - **Visual Grid & Freeze Panes**: Explicitly enable `ws.views.sheetView[0].showGridLines = True` and freeze header rows (`ws.freeze_panes = 'A5'`).
30
51
  - **Strict Zero Watermark Invariant**: Under NO circumstances should generated, styled, or edited Excel workbooks contain watermarks, diagonal background stamps, sheet header watermark graphics, or evaluation marks.
31
52
  - **Metadata Scrubbing**: Set workbook author and properties to the human analyst / organization; remove `openpyxl` / `pandas` application tags.
53
+ - **Mandatory Kage Review Gate**: Every generated Excel workbook must undergo Kage review before completion.
32
54
 
33
55
  ---
34
56
 
35
57
  ## 2. Professional Enterprise Color Palettes (Pure Light Mode)
36
58
 
37
- Never use dark theme fills, harsh bright primary colors, or black header bars. Use refined business-class light palettes:
59
+ Never use black, dark gray, dark blue, or dark theme fills. Use refined business-class light palettes with text in medium slate `#64748B`:
38
60
 
39
- | Element | Executive Slate (Default) | Mint Sage Finance | Modern Azure Tech |
40
- |---|---|---|---|
41
- | **Header Background** | Executive Slate Tint `#F1F5F9` | Sage Mint Tint `#ECFDF5` | Ice Azure Tint `#F0F9FF` |
42
- | **Header Text** | Deep Slate `#0F172A` (Bold) | Deep Forest `#064E3B` (Bold) | Deep Navy `#0C4A6E` (Bold) |
43
- | **Header Accent Ribbon** | Sapphire `#1E3A8A` → Azure `#2563EB` → Sky `#60A5FA` | Pine `#047857` → Teal `#0D9488` → Mint `#34D399` | Cobalt `#1D4ED8` → Blue `#3B82F6` → Ice `#93C5FD` |
44
- | **Zebra Row Shading** | Pearl `#F8FAFC` | Mint Pearl `#F0FDF4` | Sky Pearl `#F8FAFC` |
45
- | **Total / Summary Row** | Top thin border `#CBD5E1`, double bottom `#0F172A` | Top thin border `#A7F3D0`, double bottom `#064E3B` | Top thin border `#BAE6FD`, double bottom `#0C4A6E` |
46
- | **Accent / KPI Highlight** | Indigo `#4F46E5` | Emerald `#10B981` | Cyan `#06B6D4` |
61
+ | Element | Specification & Values |
62
+ |---|---|
63
+ | **Sheet Background** | Pure White `#FFFFFF` or Pearl `#F8FAFC` |
64
+ | **Typography (Headings & Body)** | Medium Slate `#64748B` (Calibri font exclusively) |
65
+ | **Header Background** | Executive Slate Tint `#F1F5F9` |
66
+ | **Header Accent Ribbon** | 4-base-color gradient ribbon matching the chosen theme (T01–T20) |
67
+ | **Zebra Row Shading** | Pearl `#F8FAFC` |
68
+ | **Total / Summary Row** | Top thin border `#CBD5E1`, double bottom `#64748B`, text in `#64748B` (bold) |
69
+ | **Cell Borders** | Subtle light slate `#E2E8F0` / `#CBD5E1` |
47
70
 
48
71
  ---
49
72
 
@@ -63,20 +86,21 @@ ws.title = "Q3 Infrastructure ROI"
63
86
  # Enforce explicit gridlines
64
87
  ws.views.sheetView[0].showGridLines = True
65
88
 
66
- # Styling definitions (Pure Light Executive Class)
67
- font_title = Font(name="Calibri", size=16, bold=True, color="0F172A")
89
+ # Styling definitions (Pure Light Executive Class - Text strictly in #64748B, Zero dark colors)
90
+ font_title = Font(name="Calibri", size=16, bold=True, color="64748B")
68
91
  font_subtitle = Font(name="Calibri", size=10, italic=True, color="64748B")
69
- font_header = Font(name="Calibri", size=11, bold=True, color="0F172A")
70
- font_body = Font(name="Calibri", size=11, color="1E293B")
71
- font_total = Font(name="Calibri", size=11, bold=True, color="0F172A")
92
+ font_header = Font(name="Calibri", size=11, bold=True, color="64748B")
93
+ font_body = Font(name="Calibri", size=11, color="64748B")
94
+ font_total = Font(name="Calibri", size=11, bold=True, color="64748B")
72
95
 
73
96
  fill_header = PatternFill(start_color="F1F5F9", end_color="F1F5F9", fill_type="solid")
74
97
  fill_zebra = PatternFill(start_color="F8FAFC", end_color="F8FAFC", fill_type="solid")
75
98
 
76
- # 3-Color Minimum Gradient Accent Bar (Row 3)
77
- fill_accent_1 = PatternFill(start_color="1E3A8A", end_color="1E3A8A", fill_type="solid") # Sapphire
78
- fill_accent_2 = PatternFill(start_color="2563EB", end_color="2563EB", fill_type="solid") # Azure
79
- fill_accent_3 = PatternFill(start_color="60A5FA", end_color="60A5FA", fill_type="solid") # Sky
99
+ # 4-Base-Color Gradient Accent Ribbon (Theme T01 example: #8A4FD0, #E8453C, #F08A24, #F7C948)
100
+ fill_accent_1 = PatternFill(start_color="8A4FD0", end_color="8A4FD0", fill_type="solid")
101
+ fill_accent_2 = PatternFill(start_color="E8453C", end_color="E8453C", fill_type="solid")
102
+ fill_accent_3 = PatternFill(start_color="F08A24", end_color="F08A24", fill_type="solid")
103
+ fill_accent_4 = PatternFill(start_color="F7C948", end_color="F7C948", fill_type="solid")
80
104
 
81
105
  align_left = Alignment(horizontal="left", vertical="center")
82
106
  align_right = Alignment(horizontal="right", vertical="center")
@@ -84,7 +108,7 @@ align_center = Alignment(horizontal="center", vertical="center")
84
108
 
85
109
  border_thin = Side(style="thin", color="E2E8F0")
86
110
  border_header = Side(style="medium", color="CBD5E1")
87
- border_double = Side(style="double", color="0F172A")
111
+ border_double = Side(style="double", color="64748B")
88
112
  border_total = Border(top=border_thin, bottom=border_double)
89
113
  border_cell = Border(left=border_thin, right=border_thin, top=border_thin, bottom=border_thin)
90
114
 
@@ -94,14 +118,14 @@ ws["A1"].font = font_title
94
118
  ws["A2"] = "Prepared by Infrastructure SRE Team | Target Savings: $450,000/yr"
95
119
  ws["A2"].font = font_subtitle
96
120
 
97
- # 3-Color Gradient Accent Ribbon above table header
121
+ # 4-Color Gradient Accent Ribbon above table header (Theme T01)
98
122
  ws.row_dimensions[3].height = 4
99
123
  ws["A3"].fill = fill_accent_1
100
124
  ws["B3"].fill = fill_accent_1
101
125
  ws["C3"].fill = fill_accent_2
102
- ws["D3"].fill = fill_accent_2
103
- ws["E3"].fill = fill_accent_3
104
- ws["F3"].fill = fill_accent_3
126
+ ws["D3"].fill = fill_accent_3
127
+ ws["E3"].fill = fill_accent_4
128
+ ws["F3"].fill = fill_accent_4
105
129
 
106
130
  # Table Headers (Light Executive Tint)
107
131
  headers = ["Service Component", "Cluster Tier", "Old Monthly Cost", "New Monthly Cost", "Net Savings", "Delta %"]
@@ -206,11 +230,14 @@ wb.save("infrastructure_roi.xlsx")
206
230
  ## 4. Delivery & Verification Checklist
207
231
 
208
232
  Before shipping any spreadsheet:
209
- 1. **Zero Dark Theme Invariant**: Pure light mode strictly enforced. Background is pure white (`#FFFFFF`) or soft pearl (`#F8FAFC`). Zero dark header blocks or dark cells.
210
- 2. **3-Color Minimum Gradient Invariant**: Any decorative accent bars, top ribbons, or KPI highlights must use at least 3 gradient stops (e.g. Sapphire `#1E3A8A` → Azure `#2563EB` → Sky `#60A5FA`).
211
- 3. **Table Header Fills**: Executive light tint (`#F1F5F9` / `#ECFDF5`) with bold dark high-contrast typography (`#0F172A`).
212
- 4. **Formula Accuracy**: Verify workbook opens in Excel/LibreOffice with 0 formula repair warnings (`#NAME?`, `#VALUE!`, `#REF!`).
213
- 5. **Formatting**: Verify all numbers have explicit number formatting (`$#,##0`, `0.0%`, `#,##0`).
214
- 6. **Freeze Panes & Gridlines**: Confirm freeze panes are set on the header row and gridlines are explicitly turned on (`showGridLines = True`).
215
- 7. **Auto-Fit**: Check column widths: no text is clipped and no numbers appear as `###`.
216
- 8. **Metadata**: Confirm metadata properties have been sanitized.
233
+ 1. **Strict Light Mode & Zero Black/Dark Invariant**: Pure light mode strictly enforced. Background is pure white (`#FFFFFF`) or soft pearl (`#F8FAFC`). Zero dark headers, black cells, dark blue, or dark gray anywhere.
234
+ 2. **Medium Slate `#64748B` Typography**: All text (titles, headers, body, numbers, totals) strictly set in `#64748B`.
235
+ 3. **Calibri Typography Contract**: Calibri font strictly used for both headings and body text.
236
+ 4. **4-Base-Color Theme Gradient**: Decorative accent ribbons or KPI highlights strictly use a smooth 4-base-color gradient matching one of the 20 canonical themes (T01–T20) consistently.
237
+ 5. **Table Header Fills**: Executive light tint (`#F1F5F9`) with bold `#64748B` typography and subtle `#CBD5E1` borders.
238
+ 6. **Formula Accuracy**: Verify workbook opens in Excel/LibreOffice with 0 formula repair warnings (`#NAME?`, `#VALUE!`, `#REF!`). Formulas use UPPERCASE names (`SUM`, `AVERAGE`).
239
+ 7. **Formatting**: Verify all numbers have explicit number formatting (`$#,##0`, `0.0%`, `#,##0`).
240
+ 8. **Freeze Panes & Gridlines**: Confirm freeze panes are set on the header row and gridlines are explicitly turned on (`showGridLines = True`).
241
+ 9. **Auto-Fit**: Check column widths: no text is clipped and no numbers appear as `###`.
242
+ 10. **Metadata**: Confirm metadata properties have been sanitized.
243
+ 11. **Mandatory Kage Review Gate**: Always run Kage review to verify zero-slop compliance, visual hierarchy, and 0% AI detection before delivery.
@@ -209,17 +209,40 @@ def sanitize_pdf(document, pdf):
209
209
  Across all generated and refined documents (DOCX, PPTX, XLSX, PDF), adhere strictly to executive enterprise design standards:
210
210
 
211
211
  ### Global Visual Invariants
212
- 1. **Strict Zero Dark Theme Invariant**:
213
- - NEVER create, generate, or refine documents using dark theme style.
214
- - Strictly forbidden: dark covers, dark page backgrounds, dark headers, dark footers, black or near-black fills.
215
- - All document canvases and slide backgrounds must be pure white (`#FFFFFF`) or soft pearl (`#F8FAFC` / `#FAFAFA`).
216
- 2. **3-Color Minimum Gradient Invariant**:
217
- - Whenever color is required for headers, footers, covers, accent ribbons, or decorative dividing rules, create a smooth multi-stop gradient with a **MINIMUM of 3 colors**.
218
- - Two-color harsh bands or single-color dark blocks are strictly prohibited.
219
- - Approved Enterprise 3-Color Gradients:
220
- - **Crimson Executive**: `#B91C1C` (Crimson) → `#D97706` (Amber) → `#FDE68A` (Warm Gold)
221
- - **Sapphire Corporate**: `#1E3A8A` (Deep Sapphire) → `#2563EB` (Azure) → `#60A5FA` (Sky Blue)
222
- - **Teal Innovation**: `#0D9488` (Deep Teal) → `#06B6D4` (Cyan) → `#6EE7B7` (Mint)
212
+ 1. **Strict Zero Black/Dark Invariant (Zero Dark Style)**:
213
+ - NEVER create, generate, or refine documents using black, dark gray, or dark blue anywhere (text, fills, lines, backgrounds).
214
+ - Strictly forbidden: `#000000`, `#000`, dark navy, dark slate (`#0F172A`, `#1E293B`, `#1E3A8A`), charcoal, dark fills, or dark borders.
215
+ - All canvases and backgrounds must be pure white (`#FFFFFF`) or soft pearl (`#F8FAFC`). Text must strictly be in **medium slate `#64748B`**.
216
+ 2. **20 Canonical 4-Base-Color Gradient Themes**:
217
+ - Whenever color is applied to covers, headers, footers, accent ribbons, or dividing rules, use a smooth **4-base-color gradient**.
218
+ - Randomly pick ONE of these 20 themes per document and keep it consistent throughout:
219
+ - **T01**: `linear-gradient(90deg,#8A4FD0,#E8453C,#F08A24,#F7C948)`
220
+ - **T02**: `linear-gradient(90deg,#17B3A3,#3A8DDE,#8A4FD0,#E85DA0)`
221
+ - **T03**: `linear-gradient(90deg,#34B38A,#F7C948,#F08A24,#E85DA0)`
222
+ - **T04**: `linear-gradient(90deg,#3A8DDE,#17B3A3,#6FCF7A,#F7C948)`
223
+ - **T05**: `linear-gradient(90deg,#8A4FD0,#D6459E,#E8453C,#F5A04A)`
224
+ - **T06**: `linear-gradient(90deg,#5CC46A,#F7C948,#F08A24,#E8453C)`
225
+ - **T07**: `linear-gradient(90deg,#4F8DF0,#8A4FD0,#E85DA0,#F5A04A)`
226
+ - **T08**: `linear-gradient(90deg,#17B3A3,#6FCF7A,#F7C948,#F2705F)`
227
+ - **T09**: `linear-gradient(90deg,#3AA6C9,#8A4FD0,#E85DA0,#F7C948)`
228
+ - **T10**: `linear-gradient(90deg,#3A8DDE,#52D1BC,#8BCB4A,#F5A623)`
229
+ - **T11**: `linear-gradient(90deg,#8A4FD0,#E85DA0,#F2705F,#F7C948)`
230
+ - **T12**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#E85D75)`
231
+ - **T13**: `linear-gradient(90deg,#4F8DF0,#D6459E,#E85D75,#F5A04A)`
232
+ - **T14**: `linear-gradient(90deg,#8A4FD0,#3A8DDE,#17B3A3,#8BCB4A)`
233
+ - **T15**: `linear-gradient(90deg,#E85DA0,#E8453C,#F08A24,#8BCB4A)`
234
+ - **T16**: `linear-gradient(90deg,#7C5CE0,#3A8DDE,#52D1BC,#6FCF7A)`
235
+ - **T17**: `linear-gradient(90deg,#E8453C,#F08A24,#F7C948,#8BCB4A)`
236
+ - **T18**: `linear-gradient(90deg,#3A8DDE,#8A4FD0,#D6459E,#F2705F)`
237
+ - **T19**: `linear-gradient(90deg,#17B3A3,#8BCB4A,#F7C948,#F08A24)`
238
+ - **T20**: `linear-gradient(90deg,#E85DA0,#F08A24,#F7C948,#17B3A3)`
239
+ 3. **Typography Contract**:
240
+ - **Word/reports (DOCX)**: Georgia (headings) + Calibri (body)
241
+ - **PowerPoint (PPTX)**: Segoe UI Semibold or Georgia (headings) + Segoe UI or Calibri (body)
242
+ - **Excel (XLSX)**: Calibri (headings and body)
243
+ - **PDF/digital (PDF)**: Inter (headings and body)
244
+ 4. **Mandatory Kage Review Gate**:
245
+ - Every generated document (DOCX, PPTX, XLSX, PDF) must be verified by Kage review before completion.
223
246
 
224
247
  ---
225
248
 
@@ -578,15 +578,20 @@ function findSkillSemantic(conn, query, topK = 5, candidateK = 25) {
578
578
  'the', 'a', 'an', 'and', 'or', 'in', 'on', 'at', 'to', 'for', 'of', 'with', 'by', 'is', 'are', 'was', 'were'
579
579
  ]);
580
580
  const MULTILINGUAL_SYNONYMS = {
581
- 'arsitektur': ['architecture', 'architect'],
582
- 'keamanan': ['security', 'audit'],
583
- 'keputusan': ['decision'],
581
+ 'arsitektur': ['architecture', 'architect', 'kage-skill'],
582
+ 'keamanan': ['security', 'audit', 'kage-skill'],
583
+ 'keputusan': ['decision', 'kage-skill'],
584
584
  'antarmuka': ['frontend', 'ui', 'jonin-skill'],
585
585
  'styling': ['styling', 'tailwind', 'jonin-skill'],
586
- 'perbaikan': ['bug', 'fix'],
587
- 'pemetaan': ['mapping'],
586
+ 'perbaikan': ['bug', 'fix', 'anbu-skill'],
587
+ 'infrastruktur': ['infrastructure', 'anbu-skill'],
588
+ 'backend': ['backend', 'anbu-skill'],
589
+ 'pemetaan': ['mapping', 'genin-skill'],
590
+ 'struktur': ['structure', 'genin-skill'],
591
+ 'dependensi': ['dependency', 'dependencies', 'genin-skill'],
588
592
  'berkas': ['file'],
589
- 'panduan': ['guide']
593
+ 'dokumentasi': ['documentation', 'tokubetsu-jonin-skill'],
594
+ 'panduan': ['guide', 'tokubetsu-jonin-skill']
590
595
  };
591
596
 
592
597
  const rawTokens = cleanQ.split(/\s+/).filter(Boolean).map(t => t.toLowerCase());