Commit 9a02666
authored
feat: table context in document view + MCP registry metadata (#50)
* feat(docx-core): add table structure context to document view pipeline
- Add TableContext type with row/col coordinates, header text, grid-aware
column positions, and table dimension metadata
- Add isW() and getDirectChildrenByName() shared DOM helpers
- Add table-aware toon rendering: th(r,c)/td(r,c) styles, #TABLE/#END_TABLE
markers with dimensions-only format
- Derive table context via ancestor DOM walking in buildDocumentView()
- Add extractTables() module with header-keyed records and merged cell detection
- Preserve empty table cell paragraphs for structural completeness
- Maintain paragraph parity (same IDs in same order as before)
- Re-export tables module from barrel index
* feat(docx-mcp): add table markers to read_file output formats
- Update budget-aware toon renderer to emit #TABLE/#END_TABLE markers
and use formatToonDataLine() for table-aware th/td styles
- Add renderSimpleWithTableMarkers() for non-budget simple format
- Update renderSimpleWithBudget() to handle table boundary markers
- Table markers count toward token budget but not paragraphsReturned
- Balanced #END_TABLE emitted on mid-table budget truncation
* test(docx-core, docx-mcp): add BDD tests for table context and table markers
- Add 14 BDD tests for table context derivation: simple table, paragraph
parity, w:ins-wrapped rows, gridSpan, vMerge, multi-paragraph cells,
empty cells, multiple tables, mixed body content, nested tables,
renderToon markers, th/td styles, formatToonDataLine, collectTableMarkerInfo
- Add 4 pagination tests for table markers: toon output markers,
paragraphsReturned not inflated, simple format markers, JSON table_context
* docs(openspec): add change proposal for table context in document view
- Add proposal, delta specs (docx-primitives, mcp-server), and task
checklist for the add-table-context-to-document-view change
- Add E2E test script for visual inspection of table rendering
* docs(openspec): update spec to reflect header-dedup in #TABLE marker
The #TABLE marker no longer repeats column headers — they appear
exactly once in the th(0,N) data rows which carry editable _bk_* IDs.
* chore: add serial IDs to table context spec scenarios and fix spec-coverage
- Add SDX-TABLE-01..12 serial IDs to delta spec scenarios
- Update test .openspec() annotations to use serial IDs (DRY)
- Fix validators to resolve bare serial IDs in .openspec() calls
- Add TEST_FEATURE constants for spec-coverage discovery
* chore(openspec): archive table-context, inplace-cross-run, and mixed-status changes
Archive three completed changes into canonical specs:
- add-table-context-to-document-view → docx-primitives + mcp-server
- update-inplace-cross-run-recovery → docx-comparison
- fix-inplace-mixed-status-runs → archive only (no delta specs)
* test: add 13 coverage tests for table context edge cases and budget renderers
Covers getDirectChildrenByName, empty tables, gridSpan defaults,
multi-paragraph headers, consecutive tables, compact mode,
renderSimpleWithTableMarkers, and mid-table budget truncation paths.
* chore: retrigger CI
* Add MCP Registry metadata for SafeDocx discoverability
- Add server.json conforming to 2025-12-11 MCP Registry schema
- Add mcpName field, server.json to files array, and 8 new keywords in package.json
- Extend bump_version.mjs to sync server.json version in check and bump modes
- Add server.json version validation to release workflow preflight job
- Check off registry listing item in mcp-docs-checklist
* chore: add tables test, update README branding, and regenerate coverage baselines
* chore(release): bump workspace versions to 0.4.01 parent 982499f commit 9a02666
18 files changed
Lines changed: 548 additions & 42 deletions
File tree
- .github/workflows
- coverage
- docs/safe-docx
- packages
- allure-test-factory
- docx-core
- src/testing
- test-primitives
- docx-mcp
- safe-docx-mcpb
- safe-docx
- scripts
- site
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
136 | 143 | | |
137 | 144 | | |
138 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
0 commit comments