Skip to content

Commit 9a83fcd

Browse files
pugstrocursoragent
andcommitted
feat(forge): bridge Slack to full DocForge engine via DocumentRouter
Unify draft routing across the full template catalog, wire charts and engine telemetry into confirm/delivery surfaces, and add marketplace install, explicit document commands, postmortem routing, and layout repair for judges. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d69fb35 commit 9a83fcd

111 files changed

Lines changed: 5452 additions & 2106 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.

‎.env.sample‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
# Slack — socket mode (local: slack run or npm run slack)
22
SLACK_BOT_TOKEN=xoxb-your-bot-token
33
SLACK_APP_TOKEN=xapp-your-app-token
4+
# SLACK_LOG_LEVEL=info
45

56
# Slack — HTTP mode (deploy). Set SLACK_SOCKET_MODE=false and omit SLACK_APP_TOKEN.
67
# SLACK_SOCKET_MODE=false
78
# SLACK_SIGNING_SECRET=your-signing-secret
89
# PORT=3000
910

10-
# DocForge workspace (optional; defaults under .data/)
11+
# DocForge runtime (optional; defaults shown in README)
1112
# 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: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: [main]
88

9+
env:
10+
TYPST_VERSION: "0.14.2"
11+
TYPST_LINUX_X64_SHA256: "a6044cbad2a954deb921167e257e120ac0a16b20339ec01121194ff9d394996d"
12+
913
jobs:
1014
test:
1115
runs-on: ubuntu-latest
@@ -19,10 +23,18 @@ jobs:
1923

2024
- name: Install Typst
2125
run: |
22-
curl -fsSL https://github.com/typst/typst/releases/download/v0.14.2/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ
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
2329
sudo mv typst-x86_64-unknown-linux-musl/typst /usr/local/bin/typst
2430
typst --version
2531
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Dependency audit
36+
run: npm audit --audit-level=moderate
37+
2638
- name: Verify Typst version pin
2739
run: node scripts/check-typst-version.mjs
2840

@@ -32,12 +44,12 @@ jobs:
3244
- name: Vendored offline package check
3345
run: node scripts/check-vendored-packages.mjs
3446

35-
- name: Install dependencies
36-
run: npm ci
37-
3847
- name: Lint
3948
run: npm run lint
4049

50+
- name: Script syntax check
51+
run: npm run check:scripts
52+
4153
- name: Format check
4254
run: npm run format:check
4355

@@ -47,5 +59,14 @@ jobs:
4759
- name: Unit & integration tests
4860
run: npm test
4961

62+
- name: Forge smoke
63+
run: npm run forge:smoke
64+
5065
- name: Visual regression
5166
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ dist/
77
.cache/
88
.golden-build/
99
.visual-regression/
10+
tmp/
1011
*.log
1112
*.sqlite
1213

‎DELIVERY.md‎

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
Do **not** wire Slack until the headless pipeline works.
1313

1414
```text
15-
Step 0: src/forge/pipeline.ts + npm run forge:smoke (3 PDFs from existing helpers)
15+
Step 0: src/forge/pipeline.ts + npm run forge:smoke (5 PDFs from shipped workflows)
1616
Step 1: Slack scaffold + @forge help
1717
Step 2: incident_report workflow (history API only)
1818
Step 3: sales_proposal + pricing confirm
1919
Step 4: kpi_report + CSV upload
20-
Step 5: RTS on proposal workflow
21-
Step 6: Deploy HTTP + seed review workspace
22-
Step 7: Product walkthrough + review package
20+
Step 5: project_status + draft PDF workflows
21+
Step 6: RTS on proposal/status/incident enrichment paths
22+
Step 7: Deploy HTTP + seed review workspace
23+
Step 8: Product walkthrough + review package
2324
```
2425

2526
Details in [FORGE.md §11](./FORGE.md#11-implementation-order-with-test-gates).
@@ -32,8 +33,8 @@ Details in [FORGE.md §11](./FORGE.md#11-implementation-order-with-test-gates).
3233
| -------------------------------- | ---------------------------------------------------------------------- |
3334
| Slack **agent** | `@forge` in workspace — not MCP-only |
3435
| **MCP integration** | DocForge MCP (`npm start`); agent uses same `service.ts` logic |
35-
| **RTS API** | `assistant.search.context` on proposal workflow (+ history fallback) |
36-
| Product walkthrough video ~3 min | 3 workflows, all in Slack |
36+
| **RTS API** | `assistant.search.context` on proposal + enrichment paths (+ fallback) |
37+
| Product walkthrough video ~3 min | Five workflows, all in Slack |
3738
| Architecture diagram | See §6 |
3839
| Review access | Dedicated Slack workspace with seeded channels and pinned instructions |
3940

@@ -49,7 +50,7 @@ Details in [FORGE.md §11](./FORGE.md#11-implementation-order-with-test-gates).
4950

5051
### Tagline
5152

52-
`Finish proposal, incident, and board-pack workflows in Slack — schema-validated PDFs via DocForge MCP and Real-Time Search.`
53+
`Finish draft, proposal, incident, board-pack, and status PDFs in Slack — schema-validated through DocForge MCP and Real-Time Search.`
5354

5455
### Track
5556

@@ -60,29 +61,31 @@ Details in [FORGE.md §11](./FORGE.md#11-implementation-order-with-test-gates).
6061
```markdown
6162
## Problem
6263

63-
Discovery, incidents, and board prep happen in Slack. The deliverable — client proposal, incident report, board KPI pack — is usually rebuilt manually elsewhere.
64+
Discovery, incidents, status updates, draft notes, and board prep happen in Slack. The deliverable — client proposal, incident report, weekly status, memo, or board KPI pack — is usually rebuilt manually elsewhere.
6465

6566
## Solution
6667

67-
**Forge** completes three document workflows inside Slack:
68+
**Forge** completes five document workflows inside Slack:
6869

6970
| Command | Deliverable |
7071
| --------------------------------------------------- | ------------------- |
7172
| `@forge proposal for Northstar` | Sales proposal PDF |
7273
| `@forge incident report from #incident-api-gateway` | Incident report PDF |
7374
| `@forge board pack for Q3 operating review` + CSV | KPI board pack PDF |
75+
| `@forge status for #team-eng` | RAG status PDF |
76+
| `@forge draft <notes>` | Inferred draft PDF |
7477

75-
Forge gathers context (Real-Time Search + channel history), maps to validated JSON via workflow helpers, runs DocForge (schema → compile → lint → export), and uploads the PDF after you confirm.
78+
Forge gathers context (Real-Time Search + channel history where useful), maps to validated JSON via workflow helpers, runs DocForge through MCP (schema → compile → lint → export), and uploads the PDF after you confirm.
7679

7780
## Technologies
7881

79-
- **Slack Agent** — Bolt for JavaScript, assistant status streaming, Block Kit confirm
82+
- **Slack Agent** — Bolt for JavaScript, App Home, assistant prompts/status streaming, Block Kit confirm
8083
- **Real-Time Search API** — `assistant.search.context` with `action_token`
8184
- **MCP** — DocForge custom MCP server (Typst-backed document production)
8285

8386
## Differentiation
8487

85-
Agents that summarize chat are common. Forge ships **outbound documents** with lint gates — not chat pasted into a template. Pricing and KPIs come from user input, not hallucination.
88+
Agents that summarize chat are common. Forge ships **outbound documents** with lint gates — not chat pasted into a template. Pricing, KPIs, RAG status, and severities come from Slack/user data, not hallucination.
8689

8790
## Repository
8891

@@ -124,15 +127,17 @@ Monorepo: Slack agent + DocForge engine.
124127

125128
---
126129

127-
## 5. Product walkthrough video script (~2:50)
130+
## 5. Product walkthrough video script (~3:00)
128131

129132
| Time | Action |
130133
| --------- | ------------------------------------------------------------------------------------ |
131-
| 0:00–0:20 | Hook: "The proposal already exists in Slack — Forge finishes it." |
132-
| 0:20–1:05 | `#sales-northstar` → `@forge proposal for Northstar` → paste pricing → confirm → PDF |
133-
| 1:05–1:45 | `#incident-api-gateway` → `@forge incident report` → confirm → PDF |
134-
| 1:45–2:25 | DM + CSV attach → `@forge board pack for Q3 operating review` → PDF |
135-
| 2:25–2:50 | Architecture: Slack → Forge → DocForge → PDF; mention MCP + RTS |
134+
| 0:00–0:18 | Hook: "The proposal already exists in Slack — Forge finishes it." |
135+
| 0:18–0:58 | `#sales-northstar` → `@forge proposal for Northstar` → paste pricing → confirm → PDF |
136+
| 0:58–1:28 | `#incident-api-gateway` → `@forge incident report` → confirm → PDF |
137+
| 1:28–1:52 | `#team-eng` → `@forge status for #team-eng` → preview/confirm → PDF |
138+
| 1:52–2:18 | DM + CSV attach → `@forge board pack for Q3 operating review` → PDF |
139+
| 2:18–2:38 | Paste notes → `@forge draft ...` → inferred template confirm → PDF |
140+
| 2:38–3:00 | Architecture: Slack → Forge → DocForge MCP → PDF; mention RTS + history fallback |
136141

137142
**Rules:** Slack UI only in recording. Show status text during compile wait. Open PDF briefly.
138143

@@ -197,6 +202,10 @@ Chronological incident (use the incident workflow fixture from `tests/workflow-e
197202

198203
Add impact discussion (12% sessions, ~47 min). Final message from lead confirming root cause.
199204

205+
### `#team-eng`
206+
207+
7–10 messages: weekly platform progress with mixed RAG signal. Include one shipped/on-track item, one explicit blocker, one critical failing test, and one explicit next step. The seed script posts this by default.
208+
200209
### Board pack CSV
201210

202211
```csv
@@ -211,16 +220,20 @@ Gross margin,72,70,up,percent
211220

212221
```text
213222
Forge workflow commands
223+
• @forge draft Weekly update: pipeline improved, onboarding risk remains, recommendation is a setup wizard.
214224
• @forge proposal for Northstar — see #sales-northstar, paste pricing when asked
215225
• @forge incident report from #incident-api-gateway
216226
• DM @forge with CSV attached: board pack for Q3 operating review
227+
• @forge status for #team-eng
217228
```
218229

219230
### Reviewer commands (exact)
220231

221232
1. `@forge proposal for Northstar` → paste pricing from FORGE.md W1 when prompted
222233
2. `@forge incident report from #incident-api-gateway`
223234
3. DM: attach CSV + `@forge board pack for Q3 operating review`
235+
4. `@forge status for #team-eng`
236+
5. `@forge draft Weekly update: pipeline improved, onboarding risk remains, recommendation is a setup wizard.`
224237

225238
---
226239

@@ -230,7 +243,7 @@ Run as someone other than the author. **All must pass.**
230243

231244
### Global
232245

233-
- [ ] `@forge help` lists 3 workflows + example commands
246+
- [ ] `@forge help` lists Draft PDF plus proposal, incident, board, and status examples
234247
- [ ] `@forge summarize this thread` → text only, **no PDF**
235248
- [ ] Status updates visible during compile (not silent >30s)
236249
- [ ] Cancel on confirm → no upload
@@ -254,9 +267,21 @@ Run as someone other than the author. **All must pass.**
254267
- [ ] KPI names/values match uploaded CSV
255268
- [ ] No invented metrics
256269

270+
### Status report
271+
272+
- [ ] `@forge status for #team-eng` reads channel history
273+
- [ ] Workstreams, blockers, and next steps are grounded in messages
274+
- [ ] Status confirm card offers Preview, Generate PDF, and Cancel
275+
276+
### Draft PDF
277+
278+
- [ ] `@forge draft <notes>` infers a safe template
279+
- [ ] Ambiguous notes ask the user to pick a document shape
280+
- [ ] Bot command / `@forge` text does not leak into the PDF
281+
257282
### Headless (before Slack)
258283

259-
- [ ] `npm run forge:smoke` → 3 PDF files on disk
284+
- [ ] `npm run forge:smoke` → 5 non-empty PDF files on disk
260285

261286
---
262287

@@ -306,7 +331,7 @@ Reviewers test **Jul 14 – Aug 6**. Laptop `slack run` is insufficient.
306331
### Agent / Assistant
307332

308333
- Agents & AI Apps enabled
309-
- Assistant overview (≤25 words): `Ship proposal, incident, and board PDFs from Slack context.`
334+
- Assistant overview (≤25 words): `Ship draft, proposal, incident, board, and status PDFs from Slack context.`
310335
- MCP toggle on if using Slack MCP later (optional for v1)
311336

312337
### RTS
@@ -318,14 +343,14 @@ Reviewers test **Jul 14 – Aug 6**. Laptop `slack run` is insufficient.
318343

319344
## 11. Timeline
320345

321-
| When | Milestone |
322-
| ------------------ | -------------------------------------------- |
323-
| Week 1 | Step 0–2: pipeline smoke + incident in Slack |
324-
| Week 2 | Step 3–4: proposal + board pack |
325-
| Week 3 | Step 5–6: RTS + deploy + seed + QA |
326-
| Jul 5 | Record video |
327-
| Jul 10 | Freeze workspace, send invites |
328-
| **Jul 13 5pm PDT** | **Release review package** |
346+
| When | Milestone |
347+
| ------------------ | --------------------------------------------- |
348+
| Week 1 | Step 0–2: pipeline smoke + incident in Slack |
349+
| Week 2 | Step 3–5: proposal, board pack, status, draft |
350+
| Week 3 | Step 6–7: RTS + deploy + seed + QA |
351+
| Jul 5 | Record video |
352+
| Jul 10 | Freeze workspace, send invites |
353+
| **Jul 13 5pm PDT** | **Release review package** |
329354

330355
---
331356

‎Dockerfile‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ ENV NODE_ENV=production
2828

2929
# Pinned Typst (same version/asset as CI).
3030
ARG TYPST_VERSION=0.14.2
31+
ARG TYPST_SHA256=a6044cbad2a954deb921167e257e120ac0a16b20339ec01121194ff9d394996d
3132
RUN apt-get update \
3233
&& apt-get install -y --no-install-recommends curl xz-utils ca-certificates \
33-
&& curl -fsSL "https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-x86_64-unknown-linux-musl.tar.xz" \
34-
| tar -xJ -C /tmp \
34+
&& curl -fsSL -o /tmp/typst.tar.xz "https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-x86_64-unknown-linux-musl.tar.xz" \
35+
&& echo "${TYPST_SHA256} /tmp/typst.tar.xz" | sha256sum -c - \
36+
&& tar -xJf /tmp/typst.tar.xz -C /tmp \
3537
&& mv /tmp/typst-x86_64-unknown-linux-musl/typst /usr/local/bin/typst \
3638
&& chmod +x /usr/local/bin/typst \
3739
&& apt-get purge -y curl xz-utils && apt-get autoremove -y \
38-
&& rm -rf /var/lib/apt/lists/* /tmp/typst-* \
40+
&& rm -rf /var/lib/apt/lists/* /tmp/typst-* /tmp/typst.tar.xz \
3941
&& typst --version
4042

4143
# Production dependencies only.

0 commit comments

Comments
 (0)