@adaptic/maestro 1.1.6 → 1.1.8
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/.claude/commands/init-maestro.md +225 -279
- package/README.md +19 -2
- package/docs/guides/email-setup.md +399 -0
- package/docs/guides/media-generation-setup.md +349 -0
- package/docs/guides/outbound-governance-setup.md +438 -0
- package/docs/guides/pdf-generation-setup.md +315 -0
- package/docs/guides/poller-daemon-setup.md +550 -0
- package/docs/guides/rag-context-setup.md +459 -0
- package/docs/guides/slack-setup.md +348 -0
- package/docs/guides/voice-sms-setup.md +698 -0
- package/docs/guides/whatsapp-setup.md +282 -0
- package/docs/runbooks/mac-mini-bootstrap.md +21 -0
- package/package.json +1 -1
- package/scaffold/config/caller-id-map.yaml +46 -0
- package/scripts/media-generation/README.md +2 -0
- package/scripts/pdf-generation/README.md +2 -0
- package/scripts/poller/slack-poller.mjs +22 -7
- package/scripts/poller/trigger.mjs +12 -1
- package/scripts/setup/boot-claude-session.sh +4 -8
- package/scripts/setup/configure-macos.sh +8 -4
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# PDF Generation Setup Guide
|
|
2
|
+
|
|
3
|
+
How to generate branded PDF documents from Markdown using Pandoc + XeLaTeX. Covers installation, template system, brand integration, npm script shortcuts, customisation for new agents, testing, and troubleshooting.
|
|
4
|
+
|
|
5
|
+
**Prerequisites**: Complete the [Mac Mini Bootstrap](../runbooks/mac-mini-bootstrap.md). Node.js 20+ must be installed.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Architecture Overview
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
13
|
+
│ Input: Markdown file (authored by agent or manually) │
|
|
14
|
+
│ │ │
|
|
15
|
+
│ ▼ │
|
|
16
|
+
│ build-document.mjs │
|
|
17
|
+
│ ├── Reads Markdown content │
|
|
18
|
+
│ ├── Selects LaTeX template based on --template flag │
|
|
19
|
+
│ ├── Injects metadata (title, author, date) │
|
|
20
|
+
│ └── Calls Pandoc │
|
|
21
|
+
│ │ │
|
|
22
|
+
│ ▼ │
|
|
23
|
+
│ Pandoc + XeLaTeX │
|
|
24
|
+
│ ├── Applies LaTeX template (margins, fonts, headers/footers) │
|
|
25
|
+
│ ├── Embeds brand assets (logo from public/assets/) │
|
|
26
|
+
│ ├── Renders typography (Georgia, Helvetica Neue) │
|
|
27
|
+
│ └── Produces PDF │
|
|
28
|
+
│ │ │
|
|
29
|
+
│ ▼ │
|
|
30
|
+
│ Output: Branded PDF alongside source or at --output path │
|
|
31
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 1. Installation
|
|
37
|
+
|
|
38
|
+
### 1.1 Install Pandoc
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
brew install pandoc
|
|
42
|
+
pandoc --version # Verify: should be 3.x+
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 1.2 Install XeLaTeX
|
|
46
|
+
|
|
47
|
+
Two options depending on disk space:
|
|
48
|
+
|
|
49
|
+
**Option A — TinyTeX (recommended, ~250MB)**:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install TinyTeX via Pandoc's helper
|
|
53
|
+
pandoc +RTS -M512M -RTS --pdf-engine=xelatex -o /dev/null <(echo "test") 2>&1 || true
|
|
54
|
+
|
|
55
|
+
# Or install directly
|
|
56
|
+
curl -sL "https://yihui.org/tinytex/install-bin-unix.sh" | sh
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
TinyTeX installs to `~/Library/TinyTeX/`. The `build-document.mjs` script looks for XeLaTeX at `~/Library/TinyTeX/bin/universal-darwin/xelatex` by default.
|
|
60
|
+
|
|
61
|
+
**Option B — Full MacTeX (~5GB)**:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
brew install --cask mactex-no-gui
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 1.3 Install Node.js Dependencies
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cd ~/agent-repo && npm install
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The generator uses `execa` for subprocess management (included in the project's `package.json`).
|
|
74
|
+
|
|
75
|
+
### 1.4 Verify Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Check Pandoc
|
|
79
|
+
pandoc --version
|
|
80
|
+
|
|
81
|
+
# Check XeLaTeX
|
|
82
|
+
xelatex --version 2>/dev/null || ~/Library/TinyTeX/bin/universal-darwin/xelatex --version
|
|
83
|
+
|
|
84
|
+
# Quick test: generate a PDF from a test Markdown
|
|
85
|
+
echo "# Test\nHello world" > /tmp/test.md
|
|
86
|
+
node scripts/pdf-generation/build-document.mjs --input /tmp/test.md --template memo --output /tmp/test.pdf
|
|
87
|
+
open /tmp/test.pdf
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 2. Usage
|
|
93
|
+
|
|
94
|
+
### 2.1 Direct Script
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
node scripts/pdf-generation/build-document.mjs \
|
|
98
|
+
--input <markdown-file> \
|
|
99
|
+
--template <template-name> \
|
|
100
|
+
[--output <pdf-path>] \
|
|
101
|
+
[--title "Document Title"] \
|
|
102
|
+
[--author "Author Name"] \
|
|
103
|
+
[--date "2026-04-09"]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 2.2 npm Script Shortcuts
|
|
107
|
+
|
|
108
|
+
Defined in `package.json`:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm run pdf:memo -- --input <file> # Internal memos and briefs
|
|
112
|
+
npm run pdf:board-pack -- --input <file> # Board materials with cover + TOC
|
|
113
|
+
npm run pdf:letter -- --input <file> # Corporate correspondence
|
|
114
|
+
npm run pdf:investor -- --input <file> # Investor communications
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 2.3 Arguments
|
|
118
|
+
|
|
119
|
+
| Argument | Required | Default | Description |
|
|
120
|
+
|---|---|---|---|
|
|
121
|
+
| `--input`, `-i` | Yes | — | Path to Markdown source file |
|
|
122
|
+
| `--template`, `-t` | No | `memo` | Template name (see section 3) |
|
|
123
|
+
| `--output`, `-o` | No | Same dir as input, `.pdf` extension | Output PDF path |
|
|
124
|
+
| `--title` | No | Extracted from Markdown `# heading` | Document title |
|
|
125
|
+
| `--author` | No | Agent name from config | Author name |
|
|
126
|
+
| `--date` | No | Today's date | Document date |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 3. Templates
|
|
131
|
+
|
|
132
|
+
Templates are LaTeX files in `scripts/pdf-generation/templates/`:
|
|
133
|
+
|
|
134
|
+
| Template | File | Page Size | Margins | Use Case |
|
|
135
|
+
|---|---|---|---|---|
|
|
136
|
+
| `memo` | `memo.latex` | A4 | 20mm | Internal briefs, memos, decision documents |
|
|
137
|
+
| `corporate-letter` | `corporate-letter.latex` | A4 | 25mm | Standard correspondence, regulatory submissions |
|
|
138
|
+
| `board-pack` | `board-pack.latex` | A4 | 20mm | Board packs with cover page, TOC, section headers |
|
|
139
|
+
| `investor-letter` | `corporate-letter.latex` | A4 | 30mm | Investor letters, LP updates (uses corporate-letter base) |
|
|
140
|
+
|
|
141
|
+
### 3.1 Template Features
|
|
142
|
+
|
|
143
|
+
**memo.latex**:
|
|
144
|
+
- Clean single-column layout
|
|
145
|
+
- Agent name and title in header
|
|
146
|
+
- Date in header
|
|
147
|
+
- Adaptic icon in header area
|
|
148
|
+
- No TOC
|
|
149
|
+
|
|
150
|
+
**corporate-letter.latex**:
|
|
151
|
+
- Formal letterhead layout
|
|
152
|
+
- Full Adaptic logo on first page
|
|
153
|
+
- Sender address block
|
|
154
|
+
- Confidentiality footer
|
|
155
|
+
- Wider margins for readability
|
|
156
|
+
|
|
157
|
+
**board-pack.latex**:
|
|
158
|
+
- Branded cover page with full logo
|
|
159
|
+
- Auto-generated table of contents
|
|
160
|
+
- Section headers with visual hierarchy
|
|
161
|
+
- Page numbers in footer
|
|
162
|
+
- Designed for 10-50+ page documents
|
|
163
|
+
|
|
164
|
+
### 3.2 Customising Templates
|
|
165
|
+
|
|
166
|
+
To create a new template:
|
|
167
|
+
|
|
168
|
+
1. Copy an existing template: `cp templates/memo.latex templates/proposal.latex`
|
|
169
|
+
2. Edit the LaTeX file (typography, margins, header/footer, logo placement)
|
|
170
|
+
3. Register it in `build-document.mjs` by adding to the `TEMPLATES` object:
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
const TEMPLATES = {
|
|
174
|
+
// ... existing templates
|
|
175
|
+
"proposal": {
|
|
176
|
+
file: "proposal.latex",
|
|
177
|
+
description: "Client proposals and pitch documents",
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 4. Brand Integration
|
|
185
|
+
|
|
186
|
+
### 4.1 Typography
|
|
187
|
+
|
|
188
|
+
| Font | Usage | Source |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| Georgia | Main body text, headings | System font (macOS built-in) |
|
|
191
|
+
| Helvetica Neue | Sans-serif elements, captions | System font (macOS built-in) |
|
|
192
|
+
|
|
193
|
+
Configured in `config/brand-assets.yaml` → `typography.pdf`.
|
|
194
|
+
|
|
195
|
+
### 4.2 Logo Placement
|
|
196
|
+
|
|
197
|
+
Templates reference brand assets from `public/assets/`:
|
|
198
|
+
|
|
199
|
+
| Asset | Template Usage |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `adaptic-logo-dark.svg` | Cover pages, letterheads (light backgrounds) |
|
|
202
|
+
| `adaptic-icon-dark.svg` | Page headers, footers (compact mark) |
|
|
203
|
+
|
|
204
|
+
### 4.3 Colour Scheme
|
|
205
|
+
|
|
206
|
+
Sourced from `config/brand-assets.yaml`:
|
|
207
|
+
|
|
208
|
+
- Primary dark: `#151919`
|
|
209
|
+
- Canvas background: `#f5f4f2` (light mode)
|
|
210
|
+
- Accent colours for headings and rules
|
|
211
|
+
|
|
212
|
+
### 4.4 Customising for a New Agent
|
|
213
|
+
|
|
214
|
+
When deploying a new agent:
|
|
215
|
+
|
|
216
|
+
1. Update author default in `build-document.mjs` (`config.author`)
|
|
217
|
+
2. Update logo paths in templates if using a different brand
|
|
218
|
+
3. Update font selections in templates if brand guidelines specify different fonts
|
|
219
|
+
4. Keep the Adaptic brand assets for Adaptic agents — only change for non-Adaptic entities
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 5. XeLaTeX Path Configuration
|
|
224
|
+
|
|
225
|
+
The generator looks for XeLaTeX in this order:
|
|
226
|
+
|
|
227
|
+
1. `XELATEX_PATH` environment variable (if set)
|
|
228
|
+
2. `~/Library/TinyTeX/bin/universal-darwin/xelatex` (TinyTeX default)
|
|
229
|
+
3. System PATH (for full MacTeX installation)
|
|
230
|
+
|
|
231
|
+
If XeLaTeX is installed elsewhere, set in `.env`:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
XELATEX_PATH=/usr/local/texlive/2024/bin/universal-darwin/xelatex
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## 6. Testing
|
|
240
|
+
|
|
241
|
+
| # | Test | How to Verify |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| 1 | Pandoc installed | `pandoc --version` |
|
|
244
|
+
| 2 | XeLaTeX installed | `xelatex --version` or check TinyTeX path |
|
|
245
|
+
| 3 | Memo generation | `npm run pdf:memo -- --input <test.md>` → opens clean PDF |
|
|
246
|
+
| 4 | Board pack generation | `npm run pdf:board-pack -- --input <test.md>` → has cover + TOC |
|
|
247
|
+
| 5 | Logo renders | Check generated PDF for Adaptic logo in header |
|
|
248
|
+
| 6 | Typography correct | Body text should be Georgia, sans elements Helvetica Neue |
|
|
249
|
+
| 7 | Custom output path | Use `--output /tmp/test.pdf` → PDF created at specified path |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 7. Troubleshooting
|
|
254
|
+
|
|
255
|
+
### "xelatex not found"
|
|
256
|
+
|
|
257
|
+
1. Check TinyTeX: `ls ~/Library/TinyTeX/bin/universal-darwin/xelatex`
|
|
258
|
+
2. Check MacTeX: `which xelatex`
|
|
259
|
+
3. Set explicit path: `XELATEX_PATH=/path/to/xelatex`
|
|
260
|
+
4. Install: see section 1.2
|
|
261
|
+
|
|
262
|
+
### "Missing LaTeX package"
|
|
263
|
+
|
|
264
|
+
TinyTeX installs minimal packages. If a template requires one that's missing:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Install a specific package
|
|
268
|
+
~/Library/TinyTeX/bin/universal-darwin/tlmgr install <package-name>
|
|
269
|
+
|
|
270
|
+
# Common packages needed
|
|
271
|
+
~/Library/TinyTeX/bin/universal-darwin/tlmgr install fontspec geometry fancyhdr graphicx
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### "Font not found"
|
|
275
|
+
|
|
276
|
+
1. Verify Georgia and Helvetica Neue are available: `fc-list | grep Georgia`
|
|
277
|
+
2. These are macOS system fonts — should be pre-installed
|
|
278
|
+
3. If missing, install via Font Book or use alternative fonts in the template
|
|
279
|
+
|
|
280
|
+
### PDF output is blank or malformed
|
|
281
|
+
|
|
282
|
+
1. Check Pandoc version: `pandoc --version` (need 3.x+)
|
|
283
|
+
2. Run with verbose output to see LaTeX errors:
|
|
284
|
+
```bash
|
|
285
|
+
pandoc --pdf-engine=xelatex --verbose -o output.pdf input.md
|
|
286
|
+
```
|
|
287
|
+
3. Check the LaTeX template for syntax errors
|
|
288
|
+
4. Verify Markdown input is valid (no unclosed tags, proper heading hierarchy)
|
|
289
|
+
|
|
290
|
+
### Logo not appearing in PDF
|
|
291
|
+
|
|
292
|
+
1. Check logo file exists: `ls public/assets/adaptic-logo-dark.svg`
|
|
293
|
+
2. SVG support requires the `svg` LaTeX package or convert to PDF first
|
|
294
|
+
3. Some templates use PDF versions of logos — check the template's `\includegraphics` paths
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Key Files
|
|
299
|
+
|
|
300
|
+
| File | Purpose |
|
|
301
|
+
|---|---|
|
|
302
|
+
| `scripts/pdf-generation/build-document.mjs` | Main generator script |
|
|
303
|
+
| `scripts/pdf-generation/templates/memo.latex` | Memo template |
|
|
304
|
+
| `scripts/pdf-generation/templates/corporate-letter.latex` | Correspondence template |
|
|
305
|
+
| `scripts/pdf-generation/templates/board-pack.latex` | Board pack template (cover + TOC) |
|
|
306
|
+
| `config/brand-assets.yaml` | Brand colours, typography, logo paths |
|
|
307
|
+
| `public/assets/` | SVG brand assets (logos, icons) |
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Related Documents
|
|
312
|
+
|
|
313
|
+
- [Agent Persona Setup](agent-persona-setup.md) — Author name configuration
|
|
314
|
+
- [Media Generation Setup](media-generation-setup.md) — Visual asset generation for documents
|
|
315
|
+
- [Mac Mini Bootstrap](../runbooks/mac-mini-bootstrap.md) — Pandoc/MacTeX installation
|