Open-source, in-browser repair for damaged Microsoft Office files (.docx, .xlsx, .pptx and their macro-enabled versions). Plain JavaScript ES modules, no build step, no framework. Files are processed on the device and never uploaded.
Commercial repair tools (for example Stellar Repair, Kernel, Recovery Toolbox) also handle the old binary formats (.doc/.xls/.ppt) and use proprietary heuristics. Seam does not try to match them on breadth. It focuses on the damage that actually happens to modern Office files: interrupted downloads and copies, broken ZIP structure, malformed XML, and broken internal links. For those cases it uses transparent, open methods and tells you exactly what changed.
All phases P0 to P7 are built. The full test suite passes (see "Tests"). The app is deployed at https://seam-pink.vercel.app.
Manual verification in Office: pending owner (checklist at the end of this file).
- Drop or choose up to 50 files (200 MB each). Two are processed at a time in module Web Workers.
- Identifies the real type from the bytes: ZIP-based Office files are repaired; password-protected, older binary, PDF, RTF, web page, image, empty and unknown files are detected and explained, not repaired.
- Repairs: truncated files, a missing or broken ZIP directory, data in front of the file, damaged entries (CRC and inflate errors), malformed XML (invalid characters, unclosed or mismatched elements, duplicate attributes, UTF-16 parts), content types, relationships, and the format rules for Word, Excel and PowerPoint.
- Verifies every output with structural checks. An output that fails verification is discarded and the outcome drops a level.
- Salvages text into a new file when the structure cannot be rebuilt.
- Reports every change as a finding, grouped as Lost, Repaired and Noted, with the part it concerns. Reports can be copied or saved as .txt.
- Light, dark and system themes. The theme control is a custom menu in the header. System is the default and follows the operating system setting.
- No browser-native controls are shown: no select element, no title tooltips (a styled tooltip is used), thin token-coloured scrollbars. The only native UI is the operating system file picker, which opens when you choose files and cannot be replaced by a web page.
Outcomes: No problems found, Repaired, Partially repaired, Salvaged text, Could not repair, Not supported, Not processed.
Any static file server works. The page uses ES modules and module workers, so it cannot be opened from file://.
python3 -m http.server 8000
Open http://localhost:8000/ for the app. Add ?demo=1 to see three sample results without loading files.
Open http://localhost:8000/tests/ in a browser. The runner prints PASS and FAIL lines and a final RESULT pass=N fail=M line to the page and the console. Add ?only=zip,xml to run files whose name contains one of the words.
| File | Covers |
|---|---|
copy.test.js |
Copy lint (no exclamation marks, emoji or banned words), a template and severity for every finding code |
static.test.js |
No network APIs in js/, CSP text, no inline script or style, verbatim tokens, fonts and vendor files |
identify.test.js |
Type detection, C13 (zero-filled), C14 (encrypted) |
fixtures.test.js |
Fixtures pass the structural checks |
zip.test.js |
Strict read, recovery, data descriptors, C1 flags, C2, C3, C16, C17, path rules |
xml.test.js |
49 cases for the tokenizer, cleaning, decoding, trees and every-position truncation |
package.test.js |
Content types, relationships and the Word, Excel and PowerPoint rules, output compression and times |
salvage.test.js |
Text scanners, built files, zeroed main parts |
pipeline.test.js |
The corruption matrix C1 to C12 and C15 to C18 across docx, xlsx and pptx |
queue.test.js |
Time budget, worker replacement, concurrency, order, duplicates and limits |
report.test.js |
Report layout, grouping, sentences |
theme.test.js |
Contrast (WCAG AA) in light and dark, theme resolution |
ui.test.js |
The real page in an iframe: drop, workers, rows, reports, downloads, Download all, limits, Clear, theme, live region |
The tests were run in Chromium (Playwright). Firefox and Safari were not run.
index.html
css/ tokens.css (verbatim copy of brand/tokens.css), themes.css, fonts.css, app.css
js/ main.js, ui.js, queue.js, worker.js, copy.js, theme.js, theme-init.js
js/core/ identify, crc32, zip-read, zip-recover, zip-write, xml-clean, xml-repair,
package, verify, salvage, report, constants, pipeline
js/core/formats/ docx.js, xlsx.js, pptx.js
vendor/ fflate.module.js and its licence
fonts/ Instrument Sans (3 weights), JetBrains Mono (1 weight), OFL.txt
brand/ icon, favicon, tokens and identity board (unchanged)
tests/ see above
Every user-facing string lives in js/copy.js.
- 1. No network calls (checked by
static.test.js). - 2. Nothing is loaded from a third-party origin. Fonts and fflate are files in the repo.
- 3. The CSP meta matches the specified text (checked by
static.test.js). - 4. No file contents are stored. The only stored value is the theme choice (see Deviations).
- 5. No database.
- 6. The original file is never changed. Output is a new Blob.
- 7. Output names follow the specified patterns.
- 8. Non-XML parts pass through byte for byte (checked by
pipeline.test.js). - 9. Repaired is only reported after the output passes the structural checks.
- 10. The only content added is structural: relationships, content types, a body element. Each is reported.
- 11. Every change is a finding.
- 12. Loss is reported (truncation, CRC mismatches kept, removed sheets, slides, images, links).
- 13. Copy lint passes.
- 14. The approved phrase is "Passed structural checks."
- 15 and 16. No framework, no build step. fflate is the only third-party code.
- 17. DOMParser decides well-formedness. The tolerant tokenizer is used for repair. Regex is only used for character cleaning, the salvage scanners and read-only checks.
- 18. Heavy work runs in module workers.
- 19. Layout works on mobile widths.
- 23. This file does not claim Office testing.
- 24. Deployed at https://seam-pink.vercel.app.
Departures from PLAN.md, with the reason for each.
- Light, dark and system themes (owner request). Added
css/themes.css,js/theme.jsandjs/theme-init.js.tokens.cssstays verbatim. Dark colours are overrides under:root[data-theme="dark"], written in the same OKLCH style as the tokens.theme-init.jsis a small classic script in the head so the page does not flash the wrong theme; it is a second script besides the one module.<meta name="color-scheme" content="light dark">was added. The theme control is a custom menu button with arrow-key, Home, End, Escape and outside-press handling, not a select element. - Storage. The theme choice (
light,darkorsystem) is kept in localStorage underseam-theme. No file data is stored. - No code comments (owner request). None in code written for this project.
css/tokens.cssandvendor/are copied unchanged and keep their own comments. - DOMParser runs on the main thread. Web Workers do not have DOMParser. The worker sends each part's text to the page, which checks it with DOMParser and replies. Parsing and repair still run in the worker. Before asking, the worker runs a light scan of its own; text it already knows is ill-formed is not sent, because Chrome builds an inline-styled error document for ill-formed input and the strict CSP reports that as a violation. DOMParser remains the only authority for "well-formed".
- Progress line. The CSP blocks inline style changes in Chromium, including through the CSSOM. The progress line is driven by a
data-pattribute in 5% steps and plain CSS rules. - Calc chain and shared string counts. The plan says to always remove
xl/calcChain.xmland normalise shared string counts. That conflicts with C16 (an untouched file must report No problems found) and C2 (all parts byte-identical). Both are applied only when the content of the workbook is already being changed. - Extension-only correction. A valid file with a wrong extension is returned with its original bytes and the corrected name, not re-zipped.
- fflate and fonts source. The CDN named in the plan was not reachable from the build environment.
[email protected]esm/browser.jsand the Latin woff2 subsets of Instrument Sans (400, 500, 600) and JetBrains Mono (400) were taken from the npm packages. Each font is over 10 KB.OFL.txtholds both licences. - Extra files.
core/pipeline.js(orchestration), and undertests/:harness.js,fixtures.js,corrupt.js,queue.test.js,ui.test.js. - Extra finding codes.
ZIP_ENDS_EARLY,ZIP_UNSUPPORTED_METHOD,ZIP_PATH_DROPPED,CT_DEFAULT_ADDED,CT_MAIN_FIXED,ROOT_RELS_FIXED,REL_ID_RENAMED,REL_DUPLICATE_DROPPED,PPTX_MASTER_REMOVED. Each has copy, a severity and a test. - Extra copy.
link.scopeShort("What it can repair", used on narrow screens), the theme labels,btn.close, notice and live-region strings, and the extension-corrected text for a file with no extension. - Drag-over border. Painted with a two-layer background (
padding-boxandborder-box) instead ofborder-image, so the rounded corners are kept. - Contrast override.
--ink-3on--paper-2measures 4.39:1 in the light theme. Report labels and part paths usecolor-mix(in oklch, var(--ink-3), var(--ink) 18%)inapp.css. Tokens are unchanged. - Report file name. The plan does not name it. It is
<original base name> (repair report).txt. - Tools. The plan names TodoWrite, WriteFileFromUrl and Playwright tools that were not available. npm, bash and Playwright were used instead.
- A truncation that falls exactly on a part boundary with no directory left is indistinguishable from a removed directory (C2). It is reported as Repaired with the directory rebuilt.
- A file cut inside its ZIP directory is reported as Partially repaired with a finding that data after the cut may be missing, even when every part is complete.
- Shared string checks use the double-quoted
t="s"form that Excel writes. - Dangling references are removed for images, hyperlinks, headers and footers (Word), drawings (Excel) and pictures (PowerPoint). Other relationship-based references, such as table parts or pictures in slide layouts, are not rewritten.
- A slide with more than one layout relationship is left as it is.
- A file that is valid and has a Content_Types entry that is not first in the ZIP is reported as No problems found; the order is only enforced on output.
- Very large XML parts are checked by DOMParser on the main thread, which can pause the page briefly.
- Tested in Chromium only. A 100 MB damaged document with a 4 MB main part repaired in about 5 seconds.
- Manual verification in Office (below).
- Run the suite in Firefox and Safari.
Pending owner (PLAN.md section 14):
- Open 3 repaired files of each type in Microsoft Office (Windows or Mac) and in LibreOffice.
- Confirm no "We found a problem with some content" prompt appears for files marked Repaired.
- Report any file where Office still complains, with the Seam report attached.
File contents: none. Only the theme preference is stored in localStorage.
MIT. fflate is MIT (see vendor/fflate.LICENSE). The fonts are under the SIL Open Font License (see fonts/OFL.txt).