@nexus-cortex/server 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cortex/agents/AGENT_PROFILE_GUIDE.md +307 -0
- package/.cortex/agents/README.md +268 -0
- package/.cortex/agents/a-frontend-landing-page-designer.md +41 -0
- package/.cortex/agents/autoresearch-agent.md +49 -0
- package/.cortex/agents/code-reviewer.md +63 -0
- package/.cortex/agents/context-research.md +26 -0
- package/.cortex/agents/doc-writer.md +92 -0
- package/.cortex/agents/explore.md +63 -0
- package/.cortex/agents/new-model-api-integrator-analyst.md +41 -0
- package/.cortex/agents/plan.md +109 -0
- package/.cortex/agents/pr-architecture-reviewer.md +77 -0
- package/.cortex/agents/pr-code-quality.md +78 -0
- package/.cortex/agents/pr-implementer.md +50 -0
- package/.cortex/agents/pr-security-auditor.md +62 -0
- package/.cortex/agents/pr-test-writer.md +67 -0
- package/.cortex/agents/refactor.md +118 -0
- package/.cortex/agents/test-writer.md +72 -0
- package/.cortex/agents/web-researcher.md +72 -0
- package/.cortex/bench/tasks/sample-tasks.json +20 -0
- package/.cortex/commands/compare.md +14 -0
- package/.cortex/commands/deps.md +16 -0
- package/.cortex/commands/diff.md +14 -0
- package/.cortex/commands/explain.md +16 -0
- package/.cortex/commands/find-bug.md +13 -0
- package/.cortex/commands/profile.md +15 -0
- package/.cortex/commands/review.md +18 -0
- package/.cortex/commands/search.md +16 -0
- package/.cortex/commands/test.md +15 -0
- package/.cortex/permissions.dev.json +20 -0
- package/.cortex/permissions.example.json +71 -0
- package/.cortex/permissions.prod.json +63 -0
- package/.cortex/permissions.test.json +19 -0
- package/.cortex/skills/autoresearch/SKILL.md +77 -0
- package/.cortex/skills/autoresearch/personas/README.md +45 -0
- package/.cortex/skills/autoresearch/personas/aggressive-refactor.md +25 -0
- package/.cortex/skills/autoresearch/personas/creative.md +29 -0
- package/.cortex/skills/autoresearch/personas/perf-hunter.md +27 -0
- package/.cortex/skills/autoresearch/personas/precise.md +23 -0
- package/.cortex/skills/autoresearch/personas/root-cause.md +26 -0
- package/.cortex/skills/autoresearch/personas/security-auditor.md +29 -0
- package/.cortex/skills/autoresearch/personas/skeptic-reviewer.md +31 -0
- package/.cortex/skills/autoresearch/personas/test-first.md +25 -0
- package/.cortex/skills/best-of-n/SKILL.md +76 -0
- package/.cortex/skills/cortex/SKILL.md +834 -0
- package/.cortex/skills/cortex-bench/SKILL.md +354 -0
- package/.cortex/skills/docx/SKILL.md +83 -0
- package/.cortex/skills/pdf-documents/SKILL.md +297 -0
- package/.cortex/skills/pdf-documents/sections/01-image-acquisition.md +132 -0
- package/.cortex/skills/pdf-documents/sections/02-ai-image-generation.md +274 -0
- package/.cortex/skills/pdf-documents/sections/03-paper-sizes.md +89 -0
- package/.cortex/skills/pdf-documents/sections/04-design-system.md +549 -0
- package/.cortex/skills/pdf-documents/sections/05-css-print-rules.md +135 -0
- package/.cortex/skills/pdf-documents/sections/06-svg-charts.md +100 -0
- package/.cortex/skills/pdf-documents/sections/07-templates.md +224 -0
- package/.cortex/skills/pdf-documents/sections/08-scaled-output.md +164 -0
- package/.cortex/skills/pdf-documents/sections/09-preview-qa.md +66 -0
- package/.cortex/skills/pdf-documents/sections/10-reading-pdfs.md +499 -0
- package/.cortex/skills/pdf-documents/sections/11-form-filling.md +241 -0
- package/.cortex/skills/pptx/SKILL.md +90 -0
- package/.cortex/skills/resume-analyst/SKILL.md +373 -0
- package/.cortex/skills/verify-work/SKILL.md +74 -0
- package/.cortex/skills/xlsx/SKILL.md +101 -0
- package/.cortex/system-messages/messages/WORK_QUALITY.md +159 -0
- package/.cortex/system-messages/registry.json +18 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +13 -0
- package/bin/cortex-daemon.js +47 -0
- package/bin/cortex-server.js +15 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +513 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/cors.d.ts +10 -0
- package/dist/middleware/cors.d.ts.map +1 -0
- package/dist/middleware/cors.js +11 -0
- package/dist/middleware/cors.js.map +1 -0
- package/dist/middleware/errorHandler.d.ts +10 -0
- package/dist/middleware/errorHandler.d.ts.map +1 -0
- package/dist/middleware/errorHandler.js +15 -0
- package/dist/middleware/errorHandler.js.map +1 -0
- package/dist/routes/approval.d.ts +2 -0
- package/dist/routes/approval.d.ts.map +1 -0
- package/dist/routes/approval.js +96 -0
- package/dist/routes/approval.js.map +1 -0
- package/dist/routes/config.d.ts +2 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +70 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/health.d.ts +2 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +1031 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/mcp.d.ts +2 -0
- package/dist/routes/mcp.d.ts.map +1 -0
- package/dist/routes/mcp.js +251 -0
- package/dist/routes/mcp.js.map +1 -0
- package/dist/routes/messages.d.ts +5 -0
- package/dist/routes/messages.d.ts.map +1 -0
- package/dist/routes/messages.js +136 -0
- package/dist/routes/messages.js.map +1 -0
- package/dist/routes/middleware.d.ts +2 -0
- package/dist/routes/middleware.d.ts.map +1 -0
- package/dist/routes/middleware.js +146 -0
- package/dist/routes/middleware.js.map +1 -0
- package/dist/routes/models.d.ts +2 -0
- package/dist/routes/models.d.ts.map +1 -0
- package/dist/routes/models.js +29 -0
- package/dist/routes/models.js.map +1 -0
- package/dist/routes/permissions.d.ts +2 -0
- package/dist/routes/permissions.d.ts.map +1 -0
- package/dist/routes/permissions.js +253 -0
- package/dist/routes/permissions.js.map +1 -0
- package/dist/routes/pr.d.ts +2 -0
- package/dist/routes/pr.d.ts.map +1 -0
- package/dist/routes/pr.js +222 -0
- package/dist/routes/pr.js.map +1 -0
- package/dist/routes/sessions.d.ts +2 -0
- package/dist/routes/sessions.d.ts.map +1 -0
- package/dist/routes/sessions.js +628 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/system-messages.d.ts +2 -0
- package/dist/routes/system-messages.d.ts.map +1 -0
- package/dist/routes/system-messages.js +146 -0
- package/dist/routes/system-messages.js.map +1 -0
- package/dist/routes/tools.d.ts +2 -0
- package/dist/routes/tools.d.ts.map +1 -0
- package/dist/routes/tools.js +79 -0
- package/dist/routes/tools.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# SVG Charts and Diagrams (Inline)
|
|
2
|
+
|
|
3
|
+
Always use **inline SVG** for charts — no external dependencies, scales perfectly in print.
|
|
4
|
+
|
|
5
|
+
## Bar Chart Pattern
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<div class="chart-container">
|
|
9
|
+
<p class="chart-title">Monthly Revenue</p>
|
|
10
|
+
<svg viewBox="0 0 600 300" xmlns="http://www.w3.org/2000/svg" style="width:100%;height:auto;">
|
|
11
|
+
<!-- Y-axis -->
|
|
12
|
+
<line x1="50" y1="20" x2="50" y2="250" stroke="#333" stroke-width="1"/>
|
|
13
|
+
<!-- X-axis -->
|
|
14
|
+
<line x1="50" y1="250" x2="580" y2="250" stroke="#333" stroke-width="1.5"/>
|
|
15
|
+
<!-- Grid lines (light, behind bars) -->
|
|
16
|
+
<line x1="50" y1="150" x2="580" y2="150" stroke="#eee" stroke-width="1"/>
|
|
17
|
+
<!-- Bars: x = 60 + (i * barSpacing), height = value * scale -->
|
|
18
|
+
<rect x="70" y="100" width="35" height="150" rx="3" fill="#2563eb"/>
|
|
19
|
+
<text x="87" y="270" text-anchor="middle" font-size="10">Jan</text>
|
|
20
|
+
<text x="87" y="95" text-anchor="middle" font-size="9" fill="#333">$15K</text>
|
|
21
|
+
<!-- ... more bars ... -->
|
|
22
|
+
</svg>
|
|
23
|
+
</div>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Key SVG print rules:**
|
|
27
|
+
- Use `viewBox` + `style="width:100%;height:auto;"` for responsive scaling
|
|
28
|
+
- Font sizes in SVG are independent of CSS — use `font-size="10"` (unitless = px in SVG)
|
|
29
|
+
- Colors: use `fill` and `stroke`, not CSS `color`
|
|
30
|
+
- For print, avoid very thin strokes (`stroke-width` < 0.5) — they may vanish
|
|
31
|
+
- Prefer `font-family="sans-serif"` in SVG for cross-platform rendering
|
|
32
|
+
|
|
33
|
+
## Pie Chart Pattern (Path-based)
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<!-- Pie slice: M center, L start-point, A rx,ry rotation large-arc-flag sweep-flag end-point Z -->
|
|
37
|
+
<!-- 25% slice (90 degrees) starting at 12 o'clock -->
|
|
38
|
+
<path d="M150,150 L150,50 A100,100 0 0,1 250,150 Z" fill="#2563eb"/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Calculating pie slices:**
|
|
42
|
+
```
|
|
43
|
+
For a pie centered at (cx, cy) with radius r:
|
|
44
|
+
Start angle (radians) = (startPercent / 100) * 2 * PI - PI/2
|
|
45
|
+
End angle (radians) = (endPercent / 100) * 2 * PI - PI/2
|
|
46
|
+
Start point: (cx + r * cos(startAngle), cy + r * sin(startAngle))
|
|
47
|
+
End point: (cx + r * cos(endAngle), cy + r * sin(endAngle))
|
|
48
|
+
Large arc flag: 1 if slice > 50%, else 0
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Line Chart Pattern
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<svg viewBox="0 0 600 300" style="width:100%;height:auto;">
|
|
55
|
+
<!-- Data line -->
|
|
56
|
+
<polyline
|
|
57
|
+
points="60,200 120,180 180,120 240,140 300,80 360,60 420,90"
|
|
58
|
+
fill="none" stroke="#2563eb" stroke-width="2.5" stroke-linejoin="round"/>
|
|
59
|
+
<!-- Area fill (optional) -->
|
|
60
|
+
<polygon
|
|
61
|
+
points="60,200 120,180 180,120 240,140 300,80 360,60 420,90 420,250 60,250"
|
|
62
|
+
fill="#2563eb" fill-opacity="0.1"/>
|
|
63
|
+
<!-- Data points -->
|
|
64
|
+
<circle cx="60" cy="200" r="4" fill="#2563eb"/>
|
|
65
|
+
<!-- ... more circles ... -->
|
|
66
|
+
</svg>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Map / Diagram Pattern
|
|
70
|
+
|
|
71
|
+
Use simplified SVG `<path>` for geographic outlines. For complex maps, trace from a reference SVG and simplify to essential boundaries. Keep path data minimal — agents don't need cartographic precision, just recognisable shapes with labelled regions.
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<svg viewBox="0 0 400 300" style="width:100%;height:auto;">
|
|
75
|
+
<!-- Simplified coastline/boundary -->
|
|
76
|
+
<path d="M50,150 C80,100 120,80 160,90 S240,120 280,100 S360,130 380,160"
|
|
77
|
+
fill="none" stroke="#333" stroke-width="1.5"/>
|
|
78
|
+
<!-- Region labels -->
|
|
79
|
+
<text x="200" y="80" text-anchor="middle" font-size="12" font-weight="bold">Region A</text>
|
|
80
|
+
<!-- Route line -->
|
|
81
|
+
<path d="M80,180 Q200,220 350,140" fill="none" stroke="#e53e3e"
|
|
82
|
+
stroke-width="2" stroke-dasharray="5,3"/>
|
|
83
|
+
<!-- Location markers -->
|
|
84
|
+
<circle cx="80" cy="180" r="5" fill="#e53e3e"/>
|
|
85
|
+
<circle cx="350" cy="140" r="5" fill="#e53e3e"/>
|
|
86
|
+
</svg>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Print-Specific Chart Considerations
|
|
90
|
+
|
|
91
|
+
- Wrap ALL charts in `.chart-container { break-inside: avoid; }` to prevent page splits
|
|
92
|
+
- Use `fill-opacity` instead of RGBA for better print rendering
|
|
93
|
+
- Minimum `stroke-width="0.5"` for lines that must be visible in print
|
|
94
|
+
- For color-blind accessibility, add patterns or labels to distinguish series:
|
|
95
|
+
```html
|
|
96
|
+
<pattern id="stripe" patternUnits="userSpaceOnUse" width="4" height="4">
|
|
97
|
+
<path d="M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2" stroke="#333" stroke-width="0.5"/>
|
|
98
|
+
</pattern>
|
|
99
|
+
<rect ... fill="url(#stripe)"/>
|
|
100
|
+
```
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Document Layout Templates and External Template Sources
|
|
2
|
+
|
|
3
|
+
## Built-In CSS Layout Snippets
|
|
4
|
+
|
|
5
|
+
### Research Report (A4/Letter)
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
body { font-family: Georgia, 'Times New Roman', serif; font-size: 11pt; line-height: 1.6; }
|
|
9
|
+
@page { size: A4; margin: 25mm 20mm 30mm 20mm; }
|
|
10
|
+
h1 { font-size: 22pt; } h2 { font-size: 16pt; } h3 { font-size: 13pt; }
|
|
11
|
+
table { font-size: 9.5pt; }
|
|
12
|
+
figcaption { font-size: 9pt; }
|
|
13
|
+
.cover { text-align: center; padding-top: 80mm; break-after: page; }
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Technical Specification (A4 two-column)
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
body { font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 9.5pt; }
|
|
20
|
+
@page { size: A4; margin: 15mm 12mm 20mm 12mm; }
|
|
21
|
+
.content { column-count: 2; column-gap: 8mm; }
|
|
22
|
+
.content h2 { column-span: all; } /* headers span full width */
|
|
23
|
+
table { font-size: 8.5pt; break-inside: avoid; }
|
|
24
|
+
code { font-size: 8pt; }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Presentation / Slide Deck (Landscape)
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
@page { size: A4 landscape; margin: 10mm; }
|
|
31
|
+
.slide {
|
|
32
|
+
height: 170mm; /* A4 landscape height minus margins */
|
|
33
|
+
break-after: page;
|
|
34
|
+
display: flex; flex-direction: column; justify-content: center;
|
|
35
|
+
padding: 15mm;
|
|
36
|
+
}
|
|
37
|
+
.slide h1 { font-size: 28pt; text-align: center; }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Book / Booklet (Facing Pages)
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
@page { size: B5; margin: 20mm 15mm 25mm 20mm; }
|
|
44
|
+
@page :left { margin-left: 25mm; margin-right: 15mm; } /* gutter on left */
|
|
45
|
+
@page :right { margin-left: 15mm; margin-right: 25mm; } /* gutter on right */
|
|
46
|
+
@page :first { margin-top: 50mm; } /* extra space on title page */
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Using Existing Document Templates
|
|
52
|
+
|
|
53
|
+
Thousands of professionally designed templates already exist. Use them as **conversion targets** (direct HTML extraction) or **design references** (extract the tokens, rebuild in clean HTML).
|
|
54
|
+
|
|
55
|
+
### Template Sources by Format
|
|
56
|
+
|
|
57
|
+
| Source | Formats | Cost | Best For |
|
|
58
|
+
|--------|---------|------|----------|
|
|
59
|
+
| **Microsoft Office Templates** | `.docx`, `.pptx` | Free (with Office) | Business reports, letters, proposals, invoices |
|
|
60
|
+
| **Google Docs/Slides Templates** | Google Docs (export `.docx`) | Free | Quick collaborative drafts |
|
|
61
|
+
| **LaTeX Document Classes** | `.cls`, `.sty`, `.tex` | Free | Academic papers, theses, CVs, books |
|
|
62
|
+
| **Canva** | Export as PDF | Free tier + Pro | Marketing, social media, presentations |
|
|
63
|
+
| **Adobe InDesign** | `.indd`, export PDF/IDML | Paid | Magazines, brochures, print-heavy layouts |
|
|
64
|
+
| **Figma** | Export PDF/SVG | Free tier | Modern UI-influenced layouts, cards |
|
|
65
|
+
| **HTML Template Libraries** | HTML/CSS | Free-Paid | Direct drop-in — already HTML |
|
|
66
|
+
| **Typst** | `.typ` | Free | Modern LaTeX alternative, cleaner syntax |
|
|
67
|
+
|
|
68
|
+
### Direct Conversion: Template → HTML
|
|
69
|
+
|
|
70
|
+
**DOCX → HTML (Best fidelity for Word templates)**
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Mammoth.js — semantic conversion (recommended for clean HTML)
|
|
74
|
+
npx mammoth input.docx --output=output.html --style-map="p[style-name='Title'] => h1:fresh"
|
|
75
|
+
|
|
76
|
+
# LibreOffice headless — preserves visual layout more closely
|
|
77
|
+
libreoffice --headless --convert-to html input.docx
|
|
78
|
+
|
|
79
|
+
# Pandoc — universal converter (good for body text, loses complex layout)
|
|
80
|
+
pandoc input.docx -o output.html --standalone --embed-resources
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Mammoth produces the cleanest HTML. LibreOffice preserves visual layout but generates messy markup. **Always Mammoth first**, fall back to LibreOffice when layout fidelity matters more than clean code.
|
|
84
|
+
|
|
85
|
+
**PPTX → HTML**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
libreoffice --headless --convert-to html input.pptx
|
|
89
|
+
pandoc input.pptx -o output.html --standalone
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
PowerPoint templates are better treated as **design references** — the absolute-positioned HTML from converters is unusable for responsive print CSS.
|
|
93
|
+
|
|
94
|
+
**LaTeX → HTML**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# make4ht — best LaTeX→HTML (preserves math as MathML or SVG)
|
|
98
|
+
make4ht input.tex "html5,mathml" "" "" "--output-dir=out"
|
|
99
|
+
|
|
100
|
+
# Pandoc — simpler, handles most LaTeX well
|
|
101
|
+
pandoc input.tex -o output.html --standalone --mathjax --embed-resources
|
|
102
|
+
|
|
103
|
+
# LaTeXML — highest fidelity for complex documents
|
|
104
|
+
latexml input.tex | latexmlpost --dest=output.html
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**LaTeX class → CSS equivalents:**
|
|
108
|
+
|
|
109
|
+
| LaTeX Class | CSS Equivalent |
|
|
110
|
+
|-------------|---------------|
|
|
111
|
+
| `\documentclass[twocolumn]{article}` | `column-count: 2; column-gap: 8mm;` |
|
|
112
|
+
| `\geometry{margin=1in}` | `@page { margin: 25.4mm; }` |
|
|
113
|
+
| `\setmainfont{Palatino}` | `body { font-family: 'Palatino Linotype', Palatino, serif; }` |
|
|
114
|
+
| `\linespread{1.25}` | `body { line-height: 1.25; }` |
|
|
115
|
+
| `\parindent 1.5em` | `p + p { text-indent: 1.5em; }` |
|
|
116
|
+
|
|
117
|
+
**Typst → HTML/PDF**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
typst compile input.typ output.pdf
|
|
121
|
+
pandoc -f typst input.typ -o output.html --standalone # experimental
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Canva / Figma → HTML**: No reliable direct conversion. Use the design reference workflow below.
|
|
125
|
+
|
|
126
|
+
**HTML Template Libraries (Direct Use)**
|
|
127
|
+
|
|
128
|
+
| Library | License | Templates |
|
|
129
|
+
|---------|---------|-----------|
|
|
130
|
+
| **HTML5 UP** | CC BY 3.0 (free) | 40+ responsive templates |
|
|
131
|
+
| **Tailwind UI** | Paid | Component library — cards, heroes, pricing |
|
|
132
|
+
| **Bootstrap Examples** | MIT | 20+ example layouts |
|
|
133
|
+
| **Paged.js Templates** | MIT | Print-specific — book, report, thesis (built for `@page`) |
|
|
134
|
+
|
|
135
|
+
Paged.js templates are the best starting point — built specifically for `@page` rules, `break-*` properties, and running headers/footers.
|
|
136
|
+
|
|
137
|
+
### The Design Reference Workflow
|
|
138
|
+
|
|
139
|
+
When direct conversion produces messy HTML (most of the time), treat the template as a **visual specification**:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
1. BROWSE the template (open in viewer/browser/renderer)
|
|
143
|
+
→ Screenshot key pages (cover, body, table page, chart page)
|
|
144
|
+
|
|
145
|
+
2. EXTRACT design tokens: fonts, colors, spacing, column layout, decorative elements
|
|
146
|
+
|
|
147
|
+
3. BUILD a CSS custom properties block:
|
|
148
|
+
:root {
|
|
149
|
+
--font-heading: 'Playfair Display', Georgia, serif;
|
|
150
|
+
--font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
|
|
151
|
+
--color-bg: oklch(0.99 0.005 240);
|
|
152
|
+
--color-text: oklch(0.20 0.02 240);
|
|
153
|
+
--color-accent: oklch(0.55 0.18 250);
|
|
154
|
+
--margin-page: 20mm 18mm 25mm 18mm;
|
|
155
|
+
--font-size-body: 10.5pt;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
4. WRITE the HTML using your token system (normal pipeline from SKILL.md onward)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This produces **cleaner, more maintainable HTML** than any automated converter.
|
|
162
|
+
|
|
163
|
+
### Ready-to-Use Template Recipes
|
|
164
|
+
|
|
165
|
+
**Academic Paper (from LaTeX `article` class)**
|
|
166
|
+
|
|
167
|
+
```css
|
|
168
|
+
@page { size: letter; margin: 1in; }
|
|
169
|
+
body { font-family: 'Computer Modern Serif', 'Latin Modern Roman', Georgia, serif;
|
|
170
|
+
font-size: 10pt; line-height: 1.4; }
|
|
171
|
+
h1 { font-size: 17pt; text-align: center; margin-bottom: 6pt; }
|
|
172
|
+
h2 { font-size: 12pt; font-style: italic; }
|
|
173
|
+
.abstract { font-size: 9pt; margin: 0 15mm; font-style: italic; }
|
|
174
|
+
.two-col { column-count: 2; column-gap: 6mm; }
|
|
175
|
+
p + p { text-indent: 1.5em; margin-top: 0; }
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Corporate Report (from Word "Facet" template)**
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
@page { size: A4; margin: 20mm 18mm 25mm 18mm; }
|
|
182
|
+
body { font-family: 'Source Sans 3', 'Segoe UI', sans-serif;
|
|
183
|
+
font-size: 10.5pt; line-height: 1.5; color: oklch(0.25 0.02 250); }
|
|
184
|
+
h1 { font-size: 26pt; font-weight: 300; color: oklch(0.35 0.15 250);
|
|
185
|
+
border-bottom: 3px solid oklch(0.55 0.20 250); padding-bottom: 8pt; }
|
|
186
|
+
h2 { font-size: 14pt; font-weight: 600; color: oklch(0.35 0.15 250); }
|
|
187
|
+
.cover { break-after: page; display: flex; flex-direction: column;
|
|
188
|
+
justify-content: center; height: 100vh;
|
|
189
|
+
background: linear-gradient(135deg, oklch(0.30 0.12 250), oklch(0.20 0.08 250)); color: white; }
|
|
190
|
+
table thead { background: oklch(0.35 0.12 250); color: white; }
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Magazine / Newsletter (from InDesign layout)**
|
|
194
|
+
|
|
195
|
+
```css
|
|
196
|
+
@page { size: A4; margin: 12mm 10mm 15mm 10mm; }
|
|
197
|
+
body { font-family: 'Libre Franklin', 'Helvetica Neue', sans-serif;
|
|
198
|
+
font-size: 9.5pt; line-height: 1.45; }
|
|
199
|
+
.spread { column-count: 3; column-gap: 5mm; }
|
|
200
|
+
.pullquote { font-size: 18pt; font-family: 'Playfair Display', Georgia, serif;
|
|
201
|
+
font-style: italic; color: oklch(0.50 0.20 30);
|
|
202
|
+
border-left: 4px solid oklch(0.50 0.20 30); padding-left: 12pt;
|
|
203
|
+
column-span: all; margin: 16pt 0; }
|
|
204
|
+
.caption { font-size: 7.5pt; color: oklch(0.45 0.02 250); }
|
|
205
|
+
figure { break-inside: avoid; margin: 0 0 8pt 0; }
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Invoice / Receipt (from Google Docs template)**
|
|
209
|
+
|
|
210
|
+
```css
|
|
211
|
+
@page { size: letter; margin: 15mm; }
|
|
212
|
+
body { font-family: 'Inter', system-ui, sans-serif;
|
|
213
|
+
font-size: 9pt; line-height: 1.4; color: oklch(0.25 0 0); }
|
|
214
|
+
.header { display: flex; justify-content: space-between; align-items: flex-start;
|
|
215
|
+
border-bottom: 2px solid oklch(0.85 0 0); padding-bottom: 12pt; margin-bottom: 16pt; }
|
|
216
|
+
.company { font-size: 18pt; font-weight: 700; }
|
|
217
|
+
.invoice-number { font-size: 14pt; color: oklch(0.45 0 0); text-align: right; }
|
|
218
|
+
table { width: 100%; border-collapse: collapse; }
|
|
219
|
+
table th { text-align: left; border-bottom: 1px solid oklch(0.80 0 0);
|
|
220
|
+
font-size: 8pt; text-transform: uppercase; letter-spacing: 0.05em;
|
|
221
|
+
padding: 6pt 8pt; color: oklch(0.45 0 0); }
|
|
222
|
+
table td { padding: 8pt; border-bottom: 1px solid oklch(0.92 0 0); }
|
|
223
|
+
.total-row td { font-weight: 700; font-size: 11pt; border-top: 2px solid oklch(0.25 0 0); }
|
|
224
|
+
```
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Scaled / Blueprint / Poster Output
|
|
2
|
+
|
|
3
|
+
## Principles of 1:1 Scaled Output
|
|
4
|
+
|
|
5
|
+
For blueprints, engineering drawings, and physical-dimension-accurate output, the PDF must print at **exact real-world measurements**. This means:
|
|
6
|
+
|
|
7
|
+
1. **CSS dimensions in physical units** (`mm`, `cm`, `in`) — never `px` or `%`
|
|
8
|
+
2. **No browser scaling** — `@page` margins + content must exactly fill the paper
|
|
9
|
+
3. **User must print at 100% scale** (no "Fit to page") — include a scale verification bar
|
|
10
|
+
|
|
11
|
+
## Scale Verification Bar (ALWAYS include)
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<!-- Place this on every blueprint page -->
|
|
15
|
+
<div class="scale-bar" style="break-inside:avoid; margin:5mm 0;">
|
|
16
|
+
<svg width="100mm" height="8mm" viewBox="0 0 100 8" xmlns="http://www.w3.org/2000/svg">
|
|
17
|
+
<rect x="0" y="2" width="100" height="4" fill="none" stroke="black" stroke-width="0.5"/>
|
|
18
|
+
<rect x="0" y="2" width="10" height="4" fill="black"/>
|
|
19
|
+
<rect x="20" y="2" width="10" height="4" fill="black"/>
|
|
20
|
+
<rect x="40" y="2" width="10" height="4" fill="black"/>
|
|
21
|
+
<rect x="60" y="2" width="10" height="4" fill="black"/>
|
|
22
|
+
<rect x="80" y="2" width="10" height="4" fill="black"/>
|
|
23
|
+
<text x="0" y="1.5" font-size="2" font-family="sans-serif">0</text>
|
|
24
|
+
<text x="50" y="1.5" font-size="2" font-family="sans-serif" text-anchor="middle">50mm</text>
|
|
25
|
+
<text x="100" y="1.5" font-size="2" font-family="sans-serif" text-anchor="end">100mm</text>
|
|
26
|
+
</svg>
|
|
27
|
+
<p style="font-size:7pt;color:#666;margin:1mm 0 0;">
|
|
28
|
+
VERIFY: This bar should measure exactly 100mm when printed at 100% scale.
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Common Scaled Formats
|
|
34
|
+
|
|
35
|
+
### Architectural Blueprint (ANSI D — 22" x 34")
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
@page {
|
|
39
|
+
size: 558.8mm 863.6mm; /* ANSI D */
|
|
40
|
+
margin: 10mm;
|
|
41
|
+
}
|
|
42
|
+
body {
|
|
43
|
+
font-family: 'Courier New', monospace; /* traditional blueprint font */
|
|
44
|
+
font-size: 10pt;
|
|
45
|
+
}
|
|
46
|
+
/* Title block: bottom-right corner, standard 150mm x 50mm */
|
|
47
|
+
.title-block {
|
|
48
|
+
position: fixed;
|
|
49
|
+
bottom: 10mm;
|
|
50
|
+
right: 10mm;
|
|
51
|
+
width: 150mm;
|
|
52
|
+
height: 50mm;
|
|
53
|
+
border: 0.5mm solid black;
|
|
54
|
+
}
|
|
55
|
+
/* Drawing area uses remaining space */
|
|
56
|
+
.drawing-area {
|
|
57
|
+
width: 833.6mm;
|
|
58
|
+
height: 508.8mm;
|
|
59
|
+
}
|
|
60
|
+
/* Grid: 10mm squares */
|
|
61
|
+
.grid-overlay {
|
|
62
|
+
background-image:
|
|
63
|
+
linear-gradient(rgba(0,0,0,0.1) 0.3mm, transparent 0.3mm),
|
|
64
|
+
linear-gradient(90deg, rgba(0,0,0,0.1) 0.3mm, transparent 0.3mm);
|
|
65
|
+
background-size: 10mm 10mm;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Scale Ratios for Blueprints
|
|
70
|
+
|
|
71
|
+
| Scale | Meaning | CSS Factor | Use Case |
|
|
72
|
+
|-------|---------|-----------|----------|
|
|
73
|
+
| **1:1** | Full size | `1mm = 1mm` | Small parts, PCBs, jewelry |
|
|
74
|
+
| **1:2** | Half size | `1mm = 0.5mm` on paper | Mechanical parts |
|
|
75
|
+
| **1:5** | Fifth size | `1mm = 0.2mm` on paper | Furniture, cabinets |
|
|
76
|
+
| **1:10** | Tenth size | `1mm = 0.1mm` on paper | Room layouts |
|
|
77
|
+
| **1:20** | | `1mm = 0.05mm` | Floor plans |
|
|
78
|
+
| **1:50** | | `1m = 20mm` on paper | Building floor plans |
|
|
79
|
+
| **1:100** | | `1m = 10mm` on paper | Site plans |
|
|
80
|
+
| **1:200** | | `1m = 5mm` on paper | Large site plans |
|
|
81
|
+
| **1:500** | | `1m = 2mm` on paper | Master plans, neighborhoods |
|
|
82
|
+
| **1:1000** | | `1m = 1mm` on paper | City blocks, terrain |
|
|
83
|
+
|
|
84
|
+
**CSS scale helper:**
|
|
85
|
+
```css
|
|
86
|
+
/* 1:50 scale — every 1mm CSS = 50mm real world */
|
|
87
|
+
.scale-1-50 {
|
|
88
|
+
/* A room 5m x 4m = 5000mm x 4000mm real
|
|
89
|
+
At 1:50: 100mm x 80mm on paper */
|
|
90
|
+
}
|
|
91
|
+
.scale-label::after { content: "Scale 1:50"; font-size: 8pt; }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Poster (A1 Portrait — Conference Poster)
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
@page {
|
|
98
|
+
size: 594mm 841mm; /* A1 */
|
|
99
|
+
margin: 15mm;
|
|
100
|
+
}
|
|
101
|
+
body { font-family: 'Helvetica Neue', Arial, sans-serif; }
|
|
102
|
+
/* Poster text must be readable from 1-2 metres */
|
|
103
|
+
h1 { font-size: 72pt; } /* title: readable from 3m */
|
|
104
|
+
h2 { font-size: 36pt; } /* section heads */
|
|
105
|
+
p, li { font-size: 24pt; } /* body: readable from 1.5m */
|
|
106
|
+
figcaption { font-size: 18pt; } /* captions */
|
|
107
|
+
/* Three-column layout */
|
|
108
|
+
.poster-body {
|
|
109
|
+
display: grid;
|
|
110
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
111
|
+
gap: 10mm;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Banner (Custom — e.g. 300mm x 1500mm)
|
|
116
|
+
|
|
117
|
+
```css
|
|
118
|
+
@page {
|
|
119
|
+
size: 300mm 1500mm; /* tall/narrow banner */
|
|
120
|
+
margin: 5mm;
|
|
121
|
+
}
|
|
122
|
+
body {
|
|
123
|
+
font-family: Impact, 'Arial Black', sans-serif;
|
|
124
|
+
text-align: center;
|
|
125
|
+
}
|
|
126
|
+
h1 { font-size: 96pt; letter-spacing: 2mm; }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Chromium custom size:**
|
|
130
|
+
```bash
|
|
131
|
+
# Chromium --paper-width and --paper-height are in INCHES
|
|
132
|
+
# 300mm = 11.81in, 1500mm = 59.06in
|
|
133
|
+
chromium --headless --no-sandbox --disable-gpu \
|
|
134
|
+
--print-to-pdf=banner.pdf \
|
|
135
|
+
--print-to-pdf-no-header \
|
|
136
|
+
--paper-width=11.81 --paper-height=59.06 \
|
|
137
|
+
banner.html
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Puppeteer for Exact Control (Recommended for Scaled Work)
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
const puppeteer = require('puppeteer');
|
|
144
|
+
|
|
145
|
+
async function printBlueprint(htmlPath, outputPath, widthMM, heightMM) {
|
|
146
|
+
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] });
|
|
147
|
+
const page = await browser.newPage();
|
|
148
|
+
await page.goto(`file://${htmlPath}`, { waitUntil: 'networkidle0' });
|
|
149
|
+
|
|
150
|
+
await page.pdf({
|
|
151
|
+
path: outputPath,
|
|
152
|
+
width: `${widthMM}mm`,
|
|
153
|
+
height: `${heightMM}mm`,
|
|
154
|
+
printBackground: true,
|
|
155
|
+
margin: { top: '0mm', bottom: '0mm', left: '0mm', right: '0mm' },
|
|
156
|
+
preferCSSPageSize: true, // CRITICAL: respect @page CSS, don't override
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
await browser.close();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Usage:
|
|
163
|
+
// printBlueprint('/path/to/blueprint.html', 'output.pdf', 558.8, 863.6); // ANSI D
|
|
164
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Preview and QA Loop
|
|
2
|
+
|
|
3
|
+
> **Delivery model note (see SKILL.md).** The print-to-pdf QA loop below is
|
|
4
|
+
> **Model B only** — it needs a real `chromium`. In **Model A (Nexus)** you
|
|
5
|
+
> cannot print-to-pdf to inspect your own output; QA by re-reading your
|
|
6
|
+
> generated HTML for the checklist issues (structure, page-break CSS, image
|
|
7
|
+
> embedding correctness, overflow), then deliver the `.html` to the VFS and
|
|
8
|
+
> tell the user to print it from their browser. The user's browser print *is*
|
|
9
|
+
> the final render — get the print CSS right by reading, you won't see the
|
|
10
|
+
> rendered pages yourself.
|
|
11
|
+
|
|
12
|
+
## Strategy: Print-to-PDF then Review (Cheapest)
|
|
13
|
+
|
|
14
|
+
The most token-efficient QA loop is:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
1. Write HTML
|
|
18
|
+
2. chromium --print-to-pdf (fast, headless, no browser session cost)
|
|
19
|
+
3. Read the PDF (agent reads pages via PDF reader tool)
|
|
20
|
+
4. Check: blank pages, orphaned headings, cut tables, chart overflow
|
|
21
|
+
5. Fix CSS and repeat
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This costs fewer tokens than maintaining a browser session because:
|
|
25
|
+
- No browser startup / scan / screenshot overhead
|
|
26
|
+
- PDF reader gives structured text extraction (faster to parse than screenshots)
|
|
27
|
+
- One command generates the PDF — no interactive steps
|
|
28
|
+
|
|
29
|
+
## When to Use Browser Preview Instead
|
|
30
|
+
|
|
31
|
+
Use nexus-browser or a headless browser session when:
|
|
32
|
+
- The document has **interactive elements** (forms, expandable sections) to verify before flattening
|
|
33
|
+
- You need **visual diff comparison** between two versions (screenshot comparison)
|
|
34
|
+
- The document uses **web fonts** that may not load in headless file:// mode
|
|
35
|
+
- You need to verify **responsive layout** at specific viewport sizes before print
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
# Browser preview workflow:
|
|
39
|
+
1. browse({ url: "file:///path/to/document.html" })
|
|
40
|
+
2. screenshot() — verify screen layout
|
|
41
|
+
3. Ctrl+P / print preview (not automatable in headless — use print-to-pdf instead)
|
|
42
|
+
4. close_session()
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Automated QA Checklist
|
|
46
|
+
|
|
47
|
+
After generating the PDF, check for these common issues:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
[ ] No blank pages (caused by break-inside:avoid on tall elements)
|
|
51
|
+
[ ] No orphaned headings (heading alone at page bottom, content on next page)
|
|
52
|
+
[ ] Tables not split mid-row (thead repeats on new pages)
|
|
53
|
+
[ ] SVG charts fully visible (not cut at page boundary)
|
|
54
|
+
[ ] Images not overflowing margins
|
|
55
|
+
[ ] Page numbers correct (if using running footers)
|
|
56
|
+
[ ] Cover page breaks correctly to its own page
|
|
57
|
+
[ ] Fonts readable at intended print size (11pt+ body, 8pt+ captions)
|
|
58
|
+
[ ] Scale bar accurate (for blueprints/scaled output)
|
|
59
|
+
[ ] Dark backgrounds removed or inverted for print (save ink)
|
|
60
|
+
[ ] Links show URLs in parentheses (for print readability)
|
|
61
|
+
[ ] No screen-only UI elements visible (navigation, toolbars)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## QA by PDF Page Count
|
|
65
|
+
|
|
66
|
+
A useful quick check: if the task is a ~5 page report and you get 7 pages, there are probably 2 blank pages from the break-inside bug. Read the PDF and look for pages with no content.
|