docrev 0.10.2 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -0
  3. package/dist/lib/anchor-match.d.ts +3 -1
  4. package/dist/lib/anchor-match.d.ts.map +1 -1
  5. package/dist/lib/anchor-match.js +5 -7
  6. package/dist/lib/anchor-match.js.map +1 -1
  7. package/dist/lib/annotations.d.ts +0 -6
  8. package/dist/lib/annotations.d.ts.map +1 -1
  9. package/dist/lib/annotations.js +26 -8
  10. package/dist/lib/annotations.js.map +1 -1
  11. package/dist/lib/build.d.ts +52 -0
  12. package/dist/lib/build.d.ts.map +1 -1
  13. package/dist/lib/build.js +135 -6
  14. package/dist/lib/build.js.map +1 -1
  15. package/dist/lib/commands/build.d.ts.map +1 -1
  16. package/dist/lib/commands/build.js +39 -12
  17. package/dist/lib/commands/build.js.map +1 -1
  18. package/dist/lib/commands/doi.d.ts.map +1 -1
  19. package/dist/lib/commands/doi.js +14 -2
  20. package/dist/lib/commands/doi.js.map +1 -1
  21. package/dist/lib/commands/sync.d.ts.map +1 -1
  22. package/dist/lib/commands/sync.js +24 -11
  23. package/dist/lib/commands/sync.js.map +1 -1
  24. package/dist/lib/comment-realign.d.ts +12 -21
  25. package/dist/lib/comment-realign.d.ts.map +1 -1
  26. package/dist/lib/comment-realign.js +40 -348
  27. package/dist/lib/comment-realign.js.map +1 -1
  28. package/dist/lib/dependencies.d.ts +10 -0
  29. package/dist/lib/dependencies.d.ts.map +1 -1
  30. package/dist/lib/dependencies.js +41 -9
  31. package/dist/lib/dependencies.js.map +1 -1
  32. package/dist/lib/doi.d.ts.map +1 -1
  33. package/dist/lib/doi.js +68 -80
  34. package/dist/lib/doi.js.map +1 -1
  35. package/dist/lib/errors.d.ts.map +1 -1
  36. package/dist/lib/errors.js +3 -1
  37. package/dist/lib/errors.js.map +1 -1
  38. package/dist/lib/import.d.ts +7 -4
  39. package/dist/lib/import.d.ts.map +1 -1
  40. package/dist/lib/import.js +58 -62
  41. package/dist/lib/import.js.map +1 -1
  42. package/dist/lib/ooxml.d.ts +207 -0
  43. package/dist/lib/ooxml.d.ts.map +1 -0
  44. package/dist/lib/ooxml.js +634 -0
  45. package/dist/lib/ooxml.js.map +1 -0
  46. package/dist/lib/rate-limiter.d.ts +8 -0
  47. package/dist/lib/rate-limiter.d.ts.map +1 -1
  48. package/dist/lib/rate-limiter.js +41 -4
  49. package/dist/lib/rate-limiter.js.map +1 -1
  50. package/dist/lib/trackchanges.d.ts +41 -25
  51. package/dist/lib/trackchanges.d.ts.map +1 -1
  52. package/dist/lib/trackchanges.js +90 -151
  53. package/dist/lib/trackchanges.js.map +1 -1
  54. package/dist/lib/types.d.ts +9 -8
  55. package/dist/lib/types.d.ts.map +1 -1
  56. package/dist/lib/word-extraction.d.ts.map +1 -1
  57. package/dist/lib/word-extraction.js +48 -307
  58. package/dist/lib/word-extraction.js.map +1 -1
  59. package/dist/lib/word.d.ts.map +1 -1
  60. package/dist/lib/word.js +80 -175
  61. package/dist/lib/word.js.map +1 -1
  62. package/dist/lib/wordcomments.d.ts.map +1 -1
  63. package/dist/lib/wordcomments.js +53 -92
  64. package/dist/lib/wordcomments.js.map +1 -1
  65. package/lib/anchor-match.ts +6 -7
  66. package/lib/annotations.ts +28 -8
  67. package/lib/build.ts +196 -6
  68. package/lib/commands/build.ts +42 -12
  69. package/lib/commands/doi.ts +17 -1
  70. package/lib/commands/sync.ts +26 -13
  71. package/lib/comment-realign.ts +46 -464
  72. package/lib/dependencies.ts +43 -9
  73. package/lib/doi.ts +76 -94
  74. package/lib/errors.ts +5 -1
  75. package/lib/import.ts +65 -70
  76. package/lib/ooxml.ts +768 -0
  77. package/lib/rate-limiter.ts +37 -4
  78. package/lib/trackchanges.ts +102 -183
  79. package/lib/types.ts +9 -13
  80. package/lib/word-extraction.ts +49 -330
  81. package/lib/word.ts +86 -203
  82. package/lib/wordcomments.ts +53 -104
  83. package/package.json +137 -137
  84. package/skill/REFERENCE.md +14 -3
  85. package/skill/SKILL.md +12 -5
  86. package/types/index.d.ts +16 -10
package/package.json CHANGED
@@ -1,137 +1,137 @@
1
- {
2
- "name": "docrev",
3
- "version": "0.10.2",
4
- "description": "Academic paper revision workflow: Word ↔ Markdown round-trips, DOI validation, reviewer comments",
5
- "type": "module",
6
- "types": "dist/lib/types.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/lib/annotations.d.ts",
10
- "import": "./dist/lib/annotations.js"
11
- },
12
- "./annotations": {
13
- "types": "./dist/lib/annotations.d.ts",
14
- "import": "./dist/lib/annotations.js"
15
- },
16
- "./build": {
17
- "types": "./dist/lib/build.d.ts",
18
- "import": "./dist/lib/build.js"
19
- },
20
- "./citations": {
21
- "types": "./dist/lib/citations.d.ts",
22
- "import": "./dist/lib/citations.js"
23
- },
24
- "./crossref": {
25
- "types": "./dist/lib/crossref.d.ts",
26
- "import": "./dist/lib/crossref.js"
27
- },
28
- "./doi": {
29
- "types": "./dist/lib/doi.d.ts",
30
- "import": "./dist/lib/doi.js"
31
- },
32
- "./equations": {
33
- "types": "./dist/lib/equations.d.ts",
34
- "import": "./dist/lib/equations.js"
35
- },
36
- "./git": {
37
- "types": "./dist/lib/git.d.ts",
38
- "import": "./dist/lib/git.js"
39
- },
40
- "./journals": {
41
- "types": "./dist/lib/journals.d.ts",
42
- "import": "./dist/lib/journals.js"
43
- },
44
- "./merge": {
45
- "types": "./dist/lib/merge.d.ts",
46
- "import": "./dist/lib/merge.js"
47
- },
48
- "./sections": {
49
- "types": "./dist/lib/sections.d.ts",
50
- "import": "./dist/lib/sections.js"
51
- },
52
- "./word": {
53
- "types": "./dist/lib/word.d.ts",
54
- "import": "./dist/lib/word.js"
55
- },
56
- "./variables": {
57
- "types": "./dist/lib/variables.d.ts",
58
- "import": "./dist/lib/variables.js"
59
- },
60
- "./grammar": {
61
- "types": "./dist/lib/grammar.d.ts",
62
- "import": "./dist/lib/grammar.js"
63
- },
64
- "./trackchanges": {
65
- "types": "./dist/lib/trackchanges.d.ts",
66
- "import": "./dist/lib/trackchanges.js"
67
- },
68
- "./spelling": {
69
- "types": "./dist/lib/spelling.d.ts",
70
- "import": "./dist/lib/spelling.js"
71
- },
72
- "./wordcomments": {
73
- "types": "./dist/lib/wordcomments.d.ts",
74
- "import": "./dist/lib/wordcomments.js"
75
- }
76
- },
77
- "engines": {
78
- "node": ">=18.0.0"
79
- },
80
- "bin": {
81
- "rev": "bin/rev.js"
82
- },
83
- "scripts": {
84
- "build": "tsc && node scripts/postbuild.js",
85
- "build:watch": "tsc --watch",
86
- "dev": "tsx bin/rev.ts",
87
- "test": "tsx --test test/*.test.js",
88
- "test:ts": "tsx --test test/*.test.ts",
89
- "test:watch": "node --test --watch test/*.test.js",
90
- "test:coverage": "c8 --reporter=text --reporter=lcov node --test test/*.test.js",
91
- "typecheck": "tsc --noEmit",
92
- "prepublishOnly": "npm run build"
93
- },
94
- "repository": {
95
- "type": "git",
96
- "url": "git+https://github.com/gcol33/docrev.git"
97
- },
98
- "bugs": {
99
- "url": "https://github.com/gcol33/docrev/issues"
100
- },
101
- "homepage": "https://github.com/gcol33/docrev#readme",
102
- "keywords": [
103
- "markdown",
104
- "word",
105
- "docx",
106
- "track-changes",
107
- "comments",
108
- "academic",
109
- "writing",
110
- "pandoc",
111
- "criticmarkup"
112
- ],
113
- "author": "Gilles Colling",
114
- "license": "MIT",
115
- "dependencies": {
116
- "adm-zip": "^0.5.16",
117
- "chalk": "^5.3.0",
118
- "commander": "^12.0.0",
119
- "dictionary-en": "^4.0.0",
120
- "dictionary-en-gb": "^3.0.0",
121
- "diff": "^8.0.2",
122
- "mathml-to-latex": "^1.5.0",
123
- "nspell": "^2.1.5",
124
- "pdf-lib": "^1.17.1",
125
- "pdfjs-dist": "^5.4.530",
126
- "tsx": "^4.21.0",
127
- "xml2js": "^0.6.2",
128
- "yaml": "^2.8.2"
129
- },
130
- "devDependencies": {
131
- "@types/adm-zip": "^0.5.7",
132
- "@types/node": "^25.2.0",
133
- "@types/xml2js": "^0.4.14",
134
- "c8": "^10.1.2",
135
- "typescript": "^5.9.3"
136
- }
137
- }
1
+ {
2
+ "name": "docrev",
3
+ "version": "0.11.1",
4
+ "description": "Academic paper revision workflow: Word ↔ Markdown round-trips, DOI validation, reviewer comments",
5
+ "type": "module",
6
+ "types": "dist/lib/types.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/lib/annotations.d.ts",
10
+ "import": "./dist/lib/annotations.js"
11
+ },
12
+ "./annotations": {
13
+ "types": "./dist/lib/annotations.d.ts",
14
+ "import": "./dist/lib/annotations.js"
15
+ },
16
+ "./build": {
17
+ "types": "./dist/lib/build.d.ts",
18
+ "import": "./dist/lib/build.js"
19
+ },
20
+ "./citations": {
21
+ "types": "./dist/lib/citations.d.ts",
22
+ "import": "./dist/lib/citations.js"
23
+ },
24
+ "./crossref": {
25
+ "types": "./dist/lib/crossref.d.ts",
26
+ "import": "./dist/lib/crossref.js"
27
+ },
28
+ "./doi": {
29
+ "types": "./dist/lib/doi.d.ts",
30
+ "import": "./dist/lib/doi.js"
31
+ },
32
+ "./equations": {
33
+ "types": "./dist/lib/equations.d.ts",
34
+ "import": "./dist/lib/equations.js"
35
+ },
36
+ "./git": {
37
+ "types": "./dist/lib/git.d.ts",
38
+ "import": "./dist/lib/git.js"
39
+ },
40
+ "./journals": {
41
+ "types": "./dist/lib/journals.d.ts",
42
+ "import": "./dist/lib/journals.js"
43
+ },
44
+ "./merge": {
45
+ "types": "./dist/lib/merge.d.ts",
46
+ "import": "./dist/lib/merge.js"
47
+ },
48
+ "./sections": {
49
+ "types": "./dist/lib/sections.d.ts",
50
+ "import": "./dist/lib/sections.js"
51
+ },
52
+ "./word": {
53
+ "types": "./dist/lib/word.d.ts",
54
+ "import": "./dist/lib/word.js"
55
+ },
56
+ "./variables": {
57
+ "types": "./dist/lib/variables.d.ts",
58
+ "import": "./dist/lib/variables.js"
59
+ },
60
+ "./grammar": {
61
+ "types": "./dist/lib/grammar.d.ts",
62
+ "import": "./dist/lib/grammar.js"
63
+ },
64
+ "./trackchanges": {
65
+ "types": "./dist/lib/trackchanges.d.ts",
66
+ "import": "./dist/lib/trackchanges.js"
67
+ },
68
+ "./spelling": {
69
+ "types": "./dist/lib/spelling.d.ts",
70
+ "import": "./dist/lib/spelling.js"
71
+ },
72
+ "./wordcomments": {
73
+ "types": "./dist/lib/wordcomments.d.ts",
74
+ "import": "./dist/lib/wordcomments.js"
75
+ }
76
+ },
77
+ "engines": {
78
+ "node": ">=18.0.0"
79
+ },
80
+ "bin": {
81
+ "rev": "bin/rev.js"
82
+ },
83
+ "scripts": {
84
+ "build": "tsc && node scripts/postbuild.js",
85
+ "build:watch": "tsc --watch",
86
+ "dev": "tsx bin/rev.ts",
87
+ "test": "tsx --test test/*.test.js",
88
+ "test:ts": "tsx --test test/*.test.ts",
89
+ "test:watch": "node --test --watch test/*.test.js",
90
+ "test:coverage": "c8 --reporter=text --reporter=lcov node --test test/*.test.js",
91
+ "typecheck": "tsc --noEmit",
92
+ "prepublishOnly": "npm run build"
93
+ },
94
+ "repository": {
95
+ "type": "git",
96
+ "url": "git+https://github.com/gcol33/docrev.git"
97
+ },
98
+ "bugs": {
99
+ "url": "https://github.com/gcol33/docrev/issues"
100
+ },
101
+ "homepage": "https://github.com/gcol33/docrev#readme",
102
+ "keywords": [
103
+ "markdown",
104
+ "word",
105
+ "docx",
106
+ "track-changes",
107
+ "comments",
108
+ "academic",
109
+ "writing",
110
+ "pandoc",
111
+ "criticmarkup"
112
+ ],
113
+ "author": "Gilles Colling",
114
+ "license": "MIT",
115
+ "dependencies": {
116
+ "adm-zip": "^0.5.16",
117
+ "chalk": "^5.3.0",
118
+ "commander": "^12.0.0",
119
+ "dictionary-en": "^4.0.0",
120
+ "dictionary-en-gb": "^3.0.0",
121
+ "diff": "^8.0.2",
122
+ "mathml-to-latex": "^1.5.0",
123
+ "nspell": "^2.1.5",
124
+ "pdf-lib": "^1.17.1",
125
+ "pdfjs-dist": "^5.4.530",
126
+ "tsx": "^4.21.0",
127
+ "xml2js": "^0.6.2",
128
+ "yaml": "^2.8.2"
129
+ },
130
+ "devDependencies": {
131
+ "@types/adm-zip": "^0.5.7",
132
+ "@types/node": "^25.2.0",
133
+ "@types/xml2js": "^0.4.14",
134
+ "c8": "^10.1.2",
135
+ "typescript": "^5.9.3"
136
+ }
137
+ }
@@ -62,6 +62,7 @@ rev build docx # DOCX only
62
62
  rev build --toc # Include table of contents
63
63
  rev build docx --dual # Clean + annotated versions
64
64
  rev build docx --show-changes # DOCX with visible track changes (audit)
65
+ rev build docx --dual --show-changes # One DOCX: tracked changes + threaded comments
65
66
  rev build docx --pandoc-arg=--lua-filter=tofill.lua # Pass extra args to pandoc
66
67
  rev build -o Final_Report # Override output filename (extension auto-added)
67
68
  rev build pdf --verbose # Echo the pandoc invocation (useful for filter debugging)
@@ -138,9 +139,19 @@ The `--dual` flag produces:
138
139
  - `output/<title>_comments.docx` — includes comment threads as Word comments
139
140
 
140
141
  The `--show-changes` flag (DOCX only) produces a single audit document
141
- where every accepted/rejected revision and substitution is exported as a
142
- visible Word track change, attributed to the configured user. Useful when
143
- a co-author wants to see what changed since the last shared version.
142
+ (`output/<title>-changes.docx`) where every insertion/deletion/substitution is
143
+ exported as a visible Word track change, attributed to the configured user.
144
+ Useful when a co-author wants to see what changed since the last shared
145
+ version. The revisions are emitted by pandoc as native run-level `w:ins`/`w:del`
146
+ elements through the full filter chain (crossref, citeproc, reference-doc,
147
+ macros) — not post-processed markers.
148
+
149
+ Combine `--dual --show-changes` to get one `output/<title>-changes.docx` with
150
+ tracked changes AND threaded comments: your `{++..++}`/`{--..--}` edits as
151
+ track changes alongside the reviewer's `{>>..<<}` comments and your threaded
152
+ replies. This is the standard "return to senior author" artifact. Add
153
+ `--reference <docx>` to realign comment anchors against a reviewer's copy
154
+ before injecting.
144
155
 
145
156
  ### rev preview
146
157
  Build and open document in default app.
package/skill/SKILL.md CHANGED
@@ -84,17 +84,24 @@ rev resolve methods.md -n 1 # Mark comment #1 as resolved
84
84
  ### 7. Rebuild with comment threads
85
85
 
86
86
  ```bash
87
- rev build docx --dual # Produces clean + annotated versions
88
- rev build docx --show-changes # Single DOCX with visible track changes
87
+ rev build docx --dual # Produces clean + annotated versions
88
+ rev build docx --show-changes # Single DOCX with visible track changes
89
+ rev build docx --dual --show-changes # One DOCX: tracked changes + threaded comments
89
90
  ```
90
91
 
91
92
  `--dual` produces:
92
93
  - `output/<title>.docx` — clean, for submission
93
94
  - `output/<title>_comments.docx` — comment threads as Word comments
94
95
 
95
- `--show-changes` produces a single audit DOCX where every accepted/rejected
96
- revision is rendered as a visible Word track change. Useful when a co-author
97
- wants to see what changed since the last shared version.
96
+ `--show-changes` produces a single audit DOCX (`<title>-changes.docx`) where
97
+ every accepted/rejected revision is rendered as a visible Word track change.
98
+ Useful when a co-author wants to see what changed since the last shared version.
99
+
100
+ `--dual --show-changes` combines both into one `<title>-changes.docx`: my
101
+ `{++..++}`/`{--..--}` edits as tracked changes *and* the reviewer's `{>>..<<}`
102
+ comments with my threaded replies. This is the file a supervisor opens,
103
+ reviews next to each other, and hands back. Add `--reference <docx>` to
104
+ realign comment anchors against a reviewer's copy first.
98
105
 
99
106
  Outputs land in `output/` by default; set `outputDir: null` in `rev.yaml`
100
107
  to keep them alongside `paper.md` (legacy layout). The basename is derived
package/types/index.d.ts CHANGED
@@ -482,16 +482,22 @@ export function isWordDocument(filePath: string): boolean;
482
482
  // TrackChanges (lib/trackchanges.js)
483
483
  // ============================================
484
484
 
485
- export interface TrackChangeMarker {
486
- type: 'insert' | 'delete';
487
- start: number;
488
- end: number;
489
- content: string;
490
- }
491
-
492
- export function prepareForTrackChanges(text: string): { text: string; markers: TrackChangeMarker[] };
493
- export function applyTrackChangesToDocx(docxPath: string, markers: TrackChangeMarker[], author?: string): Promise<void>;
494
- export function buildWithTrackChanges(markdownPath: string, outputPath: string, options?: object): Promise<{ success: boolean; message: string }>;
485
+ export interface NativeTrackChangeStats {
486
+ insertions: number;
487
+ deletions: number;
488
+ substitutions: number;
489
+ }
490
+
491
+ export function criticToNativeTrackChanges(
492
+ text: string,
493
+ options?: { author?: string; date?: string }
494
+ ): { text: string; stats: NativeTrackChangeStats };
495
+ export function enableTrackRevisions(docxPath: string): void;
496
+ export function buildWithTrackChanges(
497
+ markdownPath: string,
498
+ outputPath: string,
499
+ options?: { author?: string; date?: string }
500
+ ): Promise<{ success: boolean; message: string; stats?: NativeTrackChangeStats }>;
495
501
 
496
502
  // ============================================
497
503
  // Spelling (lib/spelling.js)