Skip to content

Commit dc167c8

Browse files
committed
DocForge 0.7.1 — agent-grade document production MCP server (Typst) + Forge Slack agent
0 parents  commit dc167c8

522 files changed

Lines changed: 53121 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.cursor/skills/docforge/SKILL.md‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
name: docforge
3+
description: Agent workflow for DocForge MCP — schema-first PDF generation. Use when producing business PDFs via DocForge tools.
4+
---
5+
6+
# DocForge Agent Skill
7+
8+
## Rules
9+
10+
1. **Never generate raw Typst** unless the user explicitly requests advanced mode.
11+
2. **Always** follow: `docforge_list_templates` → `docforge_get_template_schema` → `docforge_create_document`.
12+
3. Treat JSON data as the contract; validate against schema before calling create.
13+
4. Use LaTeX only for math fragments in designated schema fields (`equations[].latex` in research_report).
14+
5. **Always** `docforge_preview_document` before final delivery.
15+
6. **Always** `docforge_lint_document` before `docforge_export_document`.
16+
7. On compile failure: read `agent_action` and `suggested_repairs`, call `docforge_repair_document`, then recompile. Do not freestyle Typst fixes.
17+
8. After compile, call `docforge_visual_qa_document` for layout issues lint may miss.
18+
9. Use `docforge_generate_template_scaffold` + `docforge_register_custom_template` for custom templates.
19+
8. When data is incomplete, ask for missing required fields — do not invent summary/risks without labeling assumptions.
20+
21+
## Workflow
22+
23+
```
24+
list_templates → get_template_schema → create_document → compile_document
25+
→ repair_document (if suggested_repairs) → compile_document
26+
→ save_document_version (before major edits) → lint_document → preview_document
27+
→ export_document → destroy_document (optional cleanup)
28+
```
29+
30+
## Templates
31+
32+
| Template | Use case |
33+
|----------|----------|
34+
| `executive_memo` | Leadership/board memo |
35+
| `sales_proposal` | Client proposal from discovery |
36+
| `research_report` | Analytical report with citations appendix |
37+
| `incident_report` | Post-incident from transcript |
38+
| `kpi_report` | Board KPI update from CSV + notes |
39+
| `postmortem` | Blameless incident review |
40+
| `project_status` | Weekly status with RAG indicators |
41+
| `decision_record` | ADR-style decision documentation |
42+
| `meeting_brief` | Pre-meeting context doc |
43+
| `invoice` | Line-item invoice with computed totals |
44+
| `contract_summary` | Contract clause summary |
45+
46+
## MCP resources
47+
48+
- `docforge://templates` — catalog (built-in + marketplace)
49+
- `docforge://marketplace` — community templates only
50+
- `docforge://templates/{id}/readme` — agent README
51+
- `docforge://templates/{id}/sample` — sample JSON
52+
53+
## PDF compliance
54+
55+
Use `options.pdf_standard: "ua-1"` with `accessibility: true` (default) for PDF/UA.
56+
Use `options.pdf_standard: "a-2a"` with `options.accessibility: false` for PDF/A — **never both standards in one export**.
57+
58+
Use `options.typst_snippets.footer_note` for constrained custom footer text only (plain text, no `#` commands).
59+
60+
## MCP server
61+
62+
```bash
63+
npm run build && npm start
64+
```
65+
66+
Requires `typst` CLI (0.14+) on PATH.

‎.dockerignore‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
node_modules
2+
dist
3+
.data
4+
.git
5+
.github
6+
.env
7+
.env.local
8+
.slack
9+
.residual-sessions
10+
*.sqlite
11+
*.log
12+
.golden-build
13+
.visual-regression
14+
.cache
15+
.DS_Store
16+
tests
17+
*.md

‎.env.sample‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Slack — socket mode (local: slack run or npm run slack)
2+
SLACK_BOT_TOKEN=xoxb-your-bot-token
3+
SLACK_APP_TOKEN=xapp-your-app-token
4+
# SLACK_LOG_LEVEL=info
5+
6+
# Slack — HTTP mode (deploy). Set SLACK_SOCKET_MODE=false and omit SLACK_APP_TOKEN.
7+
# SLACK_SOCKET_MODE=false
8+
# SLACK_SIGNING_SECRET=your-signing-secret
9+
# PORT=3000
10+
11+
# DocForge runtime (optional; defaults shown in README)
12+
# DOCFORGE_DATA_ROOT=/var/forge/data
13+
# DOCFORGE_TYPST_PATH=typst
14+
# DOCFORGE_TYPST_PACKAGE_PATH=/absolute/path/to/vendor/typst-packages
15+
# DOCFORGE_TYPST_PACKAGE_CACHE_PATH=/tmp/typst-package-cache
16+
# DOCFORGE_COMPILE_TIMEOUT_MS=30000
17+
# DOCFORGE_DOCUMENT_TTL_MS=86400000
18+
# DOCFORGE_TEMPLATE_SOURCE_DIRS=/absolute/path/to/custom/templates
19+
20+
# Runtime limits
21+
# DOCFORGE_MAX_DATA_BYTES=5242880
22+
# DOCFORGE_MAX_CSV_BYTES=1048576
23+
# DOCFORGE_MAX_ASSET_BYTES=10485760
24+
25+
# Forge MCP bridge
26+
# FORGE_MCP=on
27+
# FORGE_MCP_SERVER_ENTRY=/absolute/path/to/dist/index.js
28+
29+
# QA / local scripts
30+
# DOCFORGE_VISUAL_THRESHOLD=0.02
31+
# TYPST_VERSION_PIN=0.14.2
32+
# POLL_MESSAGE_LIMIT=30
33+
# POLL_OUTPUT=/tmp/forge-slack-poll.txt
34+
# SEED_DELAY_MS=400
35+
# SEED_INCIDENT_CHANNEL=incident-api-gateway
36+
# SEED_SALES_CHANNEL=sales-northstar
37+
# SEED_STATUS_CHANNEL=team-eng
38+
# SEED_GENERAL_CHANNEL=general

‎.github/workflows/ci.yml‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
TYPST_VERSION: "0.14.2"
11+
TYPST_LINUX_X64_SHA256: "a6044cbad2a954deb921167e257e120ac0a16b20339ec01121194ff9d394996d"
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: "22"
22+
cache: npm
23+
24+
- name: Install Typst
25+
run: |
26+
curl -fsSL -o typst.tar.xz "https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-x86_64-unknown-linux-musl.tar.xz"
27+
echo "${TYPST_LINUX_X64_SHA256} typst.tar.xz" | sha256sum -c -
28+
tar -xJf typst.tar.xz
29+
sudo mv typst-x86_64-unknown-linux-musl/typst /usr/local/bin/typst
30+
typst --version
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Dependency audit
36+
run: npm audit --audit-level=moderate
37+
38+
- name: Verify Typst version pin
39+
run: node scripts/check-typst-version.mjs
40+
41+
- name: Template schema/sample sync
42+
run: node scripts/check-template-sync.mjs
43+
44+
- name: Vendored offline package check
45+
run: node scripts/check-vendored-packages.mjs
46+
47+
- name: Lint
48+
run: npm run lint
49+
50+
- name: Script syntax check
51+
run: npm run check:scripts
52+
53+
- name: Format check
54+
run: npm run format:check
55+
56+
- name: Build
57+
run: npm run build
58+
59+
- name: Unit & integration tests
60+
run: npm test
61+
62+
- name: Forge smoke
63+
run: npm run forge:smoke
64+
65+
- name: Visual regression
66+
run: npm run test:visual
67+
68+
- name: Package contents check
69+
run: npm run pack:check
70+
71+
- name: Docker build
72+
run: docker build --build-arg TYPST_SHA256="${TYPST_LINUX_X64_SHA256}" -t forge-ci .

‎.gitignore‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# dependencies / build output
2+
node_modules/
3+
dist/
4+
5+
# runtime state & data
6+
.data/
7+
.cache/
8+
.golden-build/
9+
.visual-regression/
10+
tmp/
11+
*.log
12+
*.sqlite
13+
14+
# per-template sample PDFs are a build artifact, not a baseline — visual
15+
# regression diffs golden-page1.png, and these churn non-deterministically.
16+
templates/*/sample.pdf
17+
marketplace/*/sample.pdf
18+
19+
# secrets & local env
20+
.env
21+
.env.local
22+
23+
# Slack CLI / session state (never commit — may hold tokens)
24+
.slack/
25+
.residual-sessions/
26+
27+
# editor / assistant local config (keep tracked agent skills under .cursor/skills)
28+
.claude/
29+
.cursor/*
30+
!.cursor/skills/
31+
.vscode/
32+
.idea/
33+
34+
# personal files that must never ship with the repo
35+
/CV*.pdf
36+
37+
# OS cruft
38+
.DS_Store
39+
**/.DS_Store

‎.prettierignore‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dist
2+
node_modules
3+
vendor
4+
templates
5+
packages
6+
marketplace
7+
brand_kits
8+
package-lock.json
9+
*.pdf
10+
*.png

‎.prettierrc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": false,
4+
"trailingComma": "all",
5+
"semi": true
6+
}

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CLAUDE.md

0 commit comments

Comments
 (0)