Skip to content

Commit 9dc0097

Browse files
committed
Merge branch 'main' into stable
2 parents f5762b6 + ba74245 commit 9dc0097

1,143 files changed

Lines changed: 180130 additions & 27631 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.

.github/scripts/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/ci-mcp.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ jobs:
3131
- name: Install dependencies
3232
run: pnpm install --frozen-lockfile
3333

34+
- name: Generate SDK artifacts
35+
run: pnpm run generate:all
36+
3437
- name: Build superdoc (dependency)
3538
run: pnpm run build:superdoc
3639

40+
- name: Build SDK (dependency)
41+
run: pnpm --prefix packages/sdk/langs/node run build
42+
3743
- name: Build
3844
run: pnpm --prefix apps/mcp run build
3945

.github/workflows/ci-superdoc.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- uses: oven-sh/setup-bun@v2
3737
with:
38-
bun-version: 1.3.9
38+
bun-version: 1.3.10
3939

4040
- name: Install canvas system dependencies
4141
run: |
@@ -77,6 +77,9 @@ jobs:
7777
- name: Run slow tests
7878
run: pnpm test:slow
7979

80+
- name: Consumer typecheck (skipLibCheck off)
81+
run: bash packages/superdoc/tests/consumer-types/run.sh
82+
8083
- name: Install Playwright for UMD smoke test
8184
run: pnpm --filter @superdoc/umd-smoke-test exec playwright install --with-deps chromium
8285

@@ -98,7 +101,7 @@ jobs:
98101

99102
- uses: oven-sh/setup-bun@v2
100103
with:
101-
bun-version: 1.3.9
104+
bun-version: 1.3.10
102105

103106
- name: Install dependencies
104107
run: pnpm install

.github/workflows/release-mcp.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ jobs:
4848
- name: Install dependencies
4949
run: pnpm install
5050

51+
- name: Generate SDK artifacts
52+
run: pnpm run generate:all
53+
5154
- name: Build superdoc (dependency)
5255
run: pnpm run build:superdoc
5356

57+
- name: Build SDK (dependency)
58+
run: pnpm --prefix packages/sdk/langs/node run build
59+
5460
- name: Build MCP server
5561
run: pnpm --prefix apps/mcp run build
5662

.github/workflows/sync-patches.yml

Lines changed: 101 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
name: 🔄 Sync Patches [disabled]
1+
name: 🔄 Sync stable → main
22

33
on:
4-
# Disabled to stop automatic PRs syncing stable/*.x back to main.
4+
push:
5+
branches:
6+
- stable
57
workflow_dispatch:
68

79
permissions:
@@ -10,9 +12,9 @@ permissions:
1012

1113
jobs:
1214
sync-to-main:
13-
# Short-circuit to fully disable the workflow.
14-
if: ${{ false }}
1515
runs-on: ubuntu-latest
16+
# Skip release commits (chore(release): ... [skip ci]) to avoid noisy no-op PRs
17+
if: "!contains(github.event.head_commit.message, '[skip ci]') || github.event_name == 'workflow_dispatch'"
1618

1719
steps:
1820
- name: Generate token
@@ -27,31 +29,109 @@ jobs:
2729
fetch-depth: 0
2830
token: ${{ steps.generate_token.outputs.token }}
2931

30-
- name: Create sync PR
32+
- name: Sync stable into main
3133
env:
3234
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
3335
run: |
3436
git config user.name "github-actions[bot]"
3537
git config user.email "github-actions[bot]@users.noreply.github.com"
3638
37-
# Create patch branch
38-
PATCH_BRANCH="sync-patch-${{ github.sha }}"
39-
git checkout -b "$PATCH_BRANCH" origin/main
39+
SYNC_BRANCH="sync/stable-to-main-$(date +%Y%m%d-%H%M%S)"
40+
git checkout -b "$SYNC_BRANCH" origin/main
41+
42+
# Merge stable into the branch
43+
if git merge origin/stable --no-edit -m "chore: merge stable into main"; then
44+
# Check if there are actually new commits to sync
45+
if git diff --quiet origin/main; then
46+
echo "No changes to sync — stable and main are already in sync."
47+
exit 0
48+
fi
49+
50+
git push origin "$SYNC_BRANCH"
51+
52+
# Check for existing open sync PR
53+
EXISTING=$(gh pr list --base main --head "$SYNC_BRANCH" --state open --json number -q '.[0].number' 2>/dev/null || true)
54+
if [ -n "$EXISTING" ]; then
55+
echo "Sync PR #$EXISTING already exists."
56+
exit 0
57+
fi
4058
41-
# Cherry-pick the commit
42-
if git cherry-pick "${{ github.sha }}"; then
43-
git push origin "$PATCH_BRANCH"
44-
45-
# Create PR
4659
gh pr create \
4760
--base main \
48-
--head "$PATCH_BRANCH" \
49-
--title "🔄 Sync: ${{ github.event.head_commit.message }}" \
50-
--body "Auto-sync patch from ${{ github.ref_name }}
51-
52-
Commit: ${{ github.sha }}
53-
54-
---
55-
_This PR was automatically created to sync a patch to main._" \
61+
--head "$SYNC_BRANCH" \
62+
--title "🔄 Sync stable → main" \
63+
--body "$(cat <<'EOF'
64+
## Summary
65+
Merges latest stable patches into main to keep branches in sync.
66+
67+
This ensures `@next` prereleases stay ahead of `@latest` releases.
68+
69+
---
70+
_Auto-created by sync-patches workflow._
71+
EOF
72+
)" \
5673
--label "patch-sync"
74+
75+
echo "✅ Created sync PR"
76+
else
77+
echo "Merge conflict — attempting auto-resolution of release artifacts..."
78+
79+
# Auto-resolve expected conflicts: package.json version and CHANGELOG.md.
80+
# For these files, keep main's version (semantic-release manages them per-branch).
81+
for f in packages/superdoc/package.json packages/superdoc/CHANGELOG.md; do
82+
if git diff --name-only --diff-filter=U | grep -qF "$f"; then
83+
echo " Auto-resolving $f (keeping main's version)"
84+
git checkout --ours "$f"
85+
git add "$f"
86+
fi
87+
done
88+
89+
# Check if all conflicts are resolved
90+
if [ -z "$(git diff --name-only --diff-filter=U)" ]; then
91+
git commit --no-edit
92+
git push origin "$SYNC_BRANCH"
93+
94+
gh pr create \
95+
--base main \
96+
--head "$SYNC_BRANCH" \
97+
--title "🔄 Sync stable → main" \
98+
--body "$(cat <<'EOF'
99+
## Summary
100+
Merges latest stable patches into main to keep branches in sync.
101+
102+
Release artifact conflicts (package.json version, CHANGELOG.md) were auto-resolved.
103+
104+
---
105+
_Auto-created by sync-patches workflow._
106+
EOF
107+
)" \
108+
--label "patch-sync"
109+
110+
echo "✅ Created sync PR (release conflicts auto-resolved)"
111+
else
112+
echo "⚠️ Unresolved conflicts remain — creating PR for manual resolution."
113+
114+
# Commit with conflict markers so the PR is reviewable
115+
git add -A
116+
git commit -m "chore: merge stable into main (conflicts need resolution)"
117+
git push origin "$SYNC_BRANCH"
118+
119+
gh pr create \
120+
--base main \
121+
--head "$SYNC_BRANCH" \
122+
--title "🔄 Sync stable → main (conflicts)" \
123+
--body "$(cat <<'EOF'
124+
## Summary
125+
Merges latest stable patches into main. **Has merge conflicts that need manual resolution.**
126+
127+
Release artifact conflicts were auto-resolved, but other conflicts remain.
128+
129+
---
130+
_Auto-created by sync-patches workflow._
131+
EOF
132+
)" \
133+
--label "patch-sync"
134+
135+
echo "⚠️ Created sync PR with conflicts"
136+
fi
57137
fi

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ perf-baseline-results.json
7171
.claude
7272
plans/
7373

74+
tests/layout-snapshots
7475
tests/layout/candidate/
7576
tests/layout/reference/
7677
tests/layout/reports/
@@ -84,6 +85,7 @@ devtools/visual-testing/pnpm-lock.yaml
8485
__pycache__/
8586
*.pyc
8687
*.pyo
88+
venv/
8789
# Generated platform companion build metadata (do not commit)
8890
packages/sdk/langs/python/platforms/**/*.egg-info/
8991
# Generated python packaging metadata (do not commit)

CLAUDE.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ tests/visual/ Visual regression tests (Playwright + R2 baselines)
5959
|------|----------|
6060
| React integration | `packages/react/src/SuperDocEditor.tsx` |
6161
| Editing features | `super-editor/src/extensions/` |
62-
| Presentation mode visuals | `layout-engine/painters/dom/src/renderer.ts` |
62+
| Presentation mode visuals | `layout-engine/painters/dom/src/features/feature-registry.ts` → feature module |
63+
| Rendering orchestration | `layout-engine/painters/dom/src/renderer.ts` |
6364
| DOCX import/export | `super-editor/src/core/super-converter/` |
6465
| Style resolution | `layout-engine/style-engine/` |
6566
| Main entry point (Vue) | `superdoc/src/SuperDoc.vue` |
@@ -79,7 +80,7 @@ tests/visual/ Visual regression tests (Playwright + R2 baselines)
7980

8081
## When to Modify Which System
8182

82-
- **Visual rendering**: Modify `pm-adapter/` (to feed data) and/or `painters/dom/` (to render it)
83+
- **Visual rendering**: Check `painters/dom/src/features/feature-registry.ts` to find the feature module, then modify it. If no module exists yet, create one (see layout-engine CLAUDE.md). Feed data via `pm-adapter/`
8384
- **Style resolution**: Modify `style-engine/` — called by pm-adapter during conversion
8485
- **Editing commands/behavior**: Modify `super-editor/src/extensions/`
8586
- **State bridging**: Modify `PresentationEditor.ts`
@@ -111,13 +112,31 @@ Many packages use `.js` files with JSDoc `@typedef` for type definitions (e.g.,
111112
- `pnpm dev` - Start dev server (from examples/)
112113
- `pnpm run generate:all` - Generate all derived artifacts (schemas, SDK clients, tool catalogs, reference docs)
113114

115+
## AI Eval Suite
116+
117+
The `evals/` directory contains a Promptfoo-based evaluation suite for validating AI tool call quality.
118+
119+
| Command | What it does | Cost |
120+
|---------|-------------|------|
121+
| `pnpm --filter @superdoc-testing/evals run eval` | Run deterministic evals (reading + argument tests) | ~$0.30 |
122+
| `pnpm --filter @superdoc-testing/evals run eval:reading` | Run reading tool tests only | ~$0.15 |
123+
| `pnpm --filter @superdoc-testing/evals run eval:gdpval` | Run GDPval benchmark (Model+SuperDoc vs Model-Only) | ~$1-2 |
124+
| `pnpm --filter @superdoc-testing/evals run eval:view` | Open Promptfoo web UI with results | Free |
125+
| `pnpm --filter @superdoc-testing/evals run baseline:save <label>` | Save versioned results snapshot | Free |
126+
127+
Tool definitions are extracted from `packages/sdk/tools/` via `evals/tools/extract.mjs`. Run `pnpm run generate:all` first if SDK artifacts are missing.
128+
129+
Test files are YAML in `evals/tests/`. Each test has a `vars.task` prompt and JavaScript assertions that check tool call structure (Level 1: tool selection + argument accuracy, not execution).
130+
131+
The system prompt at `evals/prompts/agent.txt` is a copy of the proven prompt from `examples/eval-demo/lib/agent.ts`. Update both when changing the prompt.
132+
114133
## Generated Artifacts
115134

116135
These directories are produced by `pnpm run generate:all`:
117136

118137
| Directory | In git? | What it contains |
119138
|-----------|---------|-----------------|
120-
| `packages/document-api/generated/` | No (gitignored) | Agent tool schemas, JSON schemas, manifest |
139+
| `packages/document-api/generated/` | No (gitignored) | Agent artifacts, JSON schemas |
121140
| `apps/cli/generated/` | No (gitignored) | SDK contract JSON exported from CLI metadata |
122141
| `packages/sdk/langs/node/src/generated/` | No (gitignored) | Node SDK generated client code |
123142
| `packages/sdk/langs/python/superdoc/generated/` | No (gitignored) | Python SDK generated client code |

TESTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ The command automatically:
105105
- Runs pixel-level comparison against the same reference version
106106
- Generates an interactive HTML report in `devtools/visual-testing/results/`
107107

108+
## Uploading Test Documents
109+
110+
Upload a `.docx` file to the shared test corpus (used by layout, visual, and behavior tests):
111+
112+
```bash
113+
pnpm corpus:upload ~/Downloads/my-file.docx
114+
# Prompts for: Linear issue ID, short description
115+
# → uploads as rendering/sd-1741-paragraph-between-borders.docx
116+
```
117+
118+
After uploading, pull it locally with `pnpm corpus:pull` so it's available for all test suites.
119+
108120
## When to Run What
109121

110122
| I changed... | Run |

0 commit comments

Comments
 (0)