docrev 0.9.13 → 0.9.15

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 (126) hide show
  1. package/.claude/settings.local.json +9 -9
  2. package/.gitattributes +1 -1
  3. package/CHANGELOG.md +149 -149
  4. package/PLAN-tables-and-postprocess.md +850 -850
  5. package/README.md +411 -391
  6. package/bin/rev.js +11 -11
  7. package/bin/rev.ts +145 -145
  8. package/completions/rev.bash +127 -127
  9. package/completions/rev.ps1 +210 -210
  10. package/completions/rev.zsh +207 -207
  11. package/dev_notes/stress2/build_adversarial.ts +186 -186
  12. package/dev_notes/stress2/drift_matcher.ts +62 -62
  13. package/dev_notes/stress2/probe_anchors.ts +35 -35
  14. package/dev_notes/stress2/project/discussion.before.md +3 -3
  15. package/dev_notes/stress2/project/discussion.md +3 -3
  16. package/dev_notes/stress2/project/methods.before.md +20 -20
  17. package/dev_notes/stress2/project/methods.md +20 -20
  18. package/dev_notes/stress2/project/rev.yaml +5 -5
  19. package/dev_notes/stress2/project/sections.yaml +4 -4
  20. package/dev_notes/stress2/sections.yaml +5 -5
  21. package/dev_notes/stress2/trace_placement.ts +50 -50
  22. package/dev_notes/stresstest_boundaries.ts +27 -27
  23. package/dev_notes/stresstest_drift_apply.ts +43 -43
  24. package/dev_notes/stresstest_drift_compare.ts +43 -43
  25. package/dev_notes/stresstest_drift_v2.ts +54 -54
  26. package/dev_notes/stresstest_inspect.ts +54 -54
  27. package/dev_notes/stresstest_pstyle.ts +55 -55
  28. package/dev_notes/stresstest_section_debug.ts +23 -23
  29. package/dev_notes/stresstest_split.ts +70 -70
  30. package/dev_notes/stresstest_trace.ts +19 -19
  31. package/dev_notes/stresstest_verify_no_overwrite.ts +40 -40
  32. package/dist/lib/build.d.ts +38 -1
  33. package/dist/lib/build.d.ts.map +1 -1
  34. package/dist/lib/build.js +68 -30
  35. package/dist/lib/build.js.map +1 -1
  36. package/dist/lib/commands/build.d.ts.map +1 -1
  37. package/dist/lib/commands/build.js +38 -5
  38. package/dist/lib/commands/build.js.map +1 -1
  39. package/dist/lib/commands/utilities.js +164 -164
  40. package/dist/lib/commands/word-tools.js +8 -8
  41. package/dist/lib/grammar.js +3 -3
  42. package/dist/lib/pdf-comments.js +44 -44
  43. package/dist/lib/plugins.js +57 -57
  44. package/dist/lib/pptx-themes.js +115 -115
  45. package/dist/lib/spelling.js +2 -2
  46. package/dist/lib/templates.js +387 -387
  47. package/dist/lib/themes.js +51 -51
  48. package/eslint.config.js +27 -27
  49. package/lib/anchor-match.ts +276 -276
  50. package/lib/annotations.ts +644 -644
  51. package/lib/build.ts +1300 -1251
  52. package/lib/citations.ts +160 -160
  53. package/lib/commands/build.ts +833 -801
  54. package/lib/commands/citations.ts +515 -515
  55. package/lib/commands/comments.ts +1050 -1050
  56. package/lib/commands/context.ts +174 -174
  57. package/lib/commands/core.ts +309 -309
  58. package/lib/commands/doi.ts +435 -435
  59. package/lib/commands/file-ops.ts +372 -372
  60. package/lib/commands/history.ts +320 -320
  61. package/lib/commands/index.ts +87 -87
  62. package/lib/commands/init.ts +259 -259
  63. package/lib/commands/merge-resolve.ts +378 -378
  64. package/lib/commands/preview.ts +178 -178
  65. package/lib/commands/project-info.ts +244 -244
  66. package/lib/commands/quality.ts +517 -517
  67. package/lib/commands/response.ts +454 -454
  68. package/lib/commands/section-boundaries.ts +82 -82
  69. package/lib/commands/sections.ts +451 -451
  70. package/lib/commands/sync.ts +706 -706
  71. package/lib/commands/text-ops.ts +449 -449
  72. package/lib/commands/utilities.ts +448 -448
  73. package/lib/commands/verify-anchors.ts +272 -272
  74. package/lib/commands/word-tools.ts +340 -340
  75. package/lib/comment-realign.ts +517 -517
  76. package/lib/config.ts +84 -84
  77. package/lib/crossref.ts +781 -781
  78. package/lib/csl.ts +191 -191
  79. package/lib/dependencies.ts +98 -98
  80. package/lib/diff-engine.ts +465 -465
  81. package/lib/doi-cache.ts +115 -115
  82. package/lib/doi.ts +897 -897
  83. package/lib/equations.ts +506 -506
  84. package/lib/errors.ts +346 -346
  85. package/lib/format.ts +541 -541
  86. package/lib/git.ts +326 -326
  87. package/lib/grammar.ts +303 -303
  88. package/lib/image-registry.ts +180 -180
  89. package/lib/import.ts +911 -911
  90. package/lib/journals.ts +543 -543
  91. package/lib/merge.ts +633 -633
  92. package/lib/orcid.ts +144 -144
  93. package/lib/pdf-comments.ts +263 -263
  94. package/lib/pdf-import.ts +524 -524
  95. package/lib/plugins.ts +362 -362
  96. package/lib/postprocess.ts +188 -188
  97. package/lib/pptx-color-filter.lua +37 -37
  98. package/lib/pptx-template.ts +469 -469
  99. package/lib/pptx-themes.ts +483 -483
  100. package/lib/protect-restore.ts +520 -520
  101. package/lib/rate-limiter.ts +94 -94
  102. package/lib/response.ts +197 -197
  103. package/lib/restore-references.ts +240 -240
  104. package/lib/review.ts +327 -327
  105. package/lib/schema.ts +417 -417
  106. package/lib/scientific-words.ts +73 -73
  107. package/lib/sections.ts +335 -335
  108. package/lib/slides.ts +756 -756
  109. package/lib/spelling.ts +334 -334
  110. package/lib/templates.ts +526 -526
  111. package/lib/themes.ts +742 -742
  112. package/lib/trackchanges.ts +247 -247
  113. package/lib/tui.ts +450 -450
  114. package/lib/types.ts +550 -550
  115. package/lib/undo.ts +250 -250
  116. package/lib/utils.ts +69 -69
  117. package/lib/variables.ts +179 -179
  118. package/lib/word-extraction.ts +806 -806
  119. package/lib/word.ts +643 -643
  120. package/lib/wordcomments.ts +817 -817
  121. package/package.json +137 -137
  122. package/scripts/postbuild.js +28 -28
  123. package/skill/REFERENCE.md +473 -431
  124. package/skill/SKILL.md +274 -258
  125. package/tsconfig.json +26 -26
  126. package/types/index.d.ts +525 -525
@@ -1,431 +1,473 @@
1
- # docrev Command Reference
2
-
3
- ## Project Creation
4
-
5
- ### rev new
6
- Create a new document project.
7
- ```bash
8
- rev new my-document # Creates my-document/ with section files
9
- rev new my-document --template apa
10
- ```
11
-
12
- ## Document Import/Export
13
-
14
- ### rev import
15
- Import a Word document with track changes and comments.
16
- ```bash
17
- rev import manuscript.docx
18
- rev import manuscript.docx --output ./project
19
- ```
20
-
21
- ### rev sync
22
- Sync feedback from a reviewed Word document into existing markdown sections.
23
- ```bash
24
- rev sync reviewed.docx # Updates markdown with track changes/comments
25
- rev sync # Auto-detect most recent .docx
26
- rev sync reviewed.docx methods # Sync only methods section
27
- rev sync reviewed.docx --comments-only # Insert comments only; never modify prose
28
- ```
29
-
30
- `--comments-only` skips the Word→Markdown diff entirely. Use it when the
31
- markdown has been revised between sending the docx out for review and
32
- receiving it back: applying track changes from a stale draft would clobber
33
- newer edits, but comments still need to land. Comments are placed at
34
- fuzzy-matched anchors against the current prose. Pair with
35
- `rev verify-anchors` to see which ones won't fit before you run sync.
36
-
37
- ### rev verify-anchors
38
- Report drift between Word comment anchors and the current markdown.
39
- ```bash
40
- rev verify-anchors reviewed.docx # Print per-comment match quality
41
- rev verify-anchors reviewed.docx --json # Machine-readable report
42
- ```
43
-
44
- Each comment is classified by how well its anchor still matches the current
45
- section prose:
46
-
47
- - `clean` – exact or whitespace-normalized hit
48
- - `drift` – anchor only matches via stripped-CriticMarkup or partial-prefix fallbacks
49
- - `context-only` – anchor text is gone, only surrounding context survives
50
- - `ambiguous` – multiple candidate positions; needs context to disambiguate
51
- - `unmatched` – nothing maps; user must place the comment manually
52
-
53
- Useful before `rev sync --comments-only` to plan which comments will land
54
- automatically and which need manual placement.
55
-
56
- ### rev build
57
- Build output documents from markdown sections.
58
- ```bash
59
- rev build # Build PDF and DOCX
60
- rev build pdf # PDF only
61
- rev build docx # DOCX only
62
- rev build --toc # Include table of contents
63
- rev build docx --dual # Clean + annotated versions
64
- ```
65
-
66
- The `--dual` flag produces:
67
- - `paper.docx` clean, for submission
68
- - `paper_comments.docx` includes comment threads as Word comments
69
-
70
- ### rev preview
71
- Build and open document in default app.
72
- ```bash
73
- rev preview pdf # Build and open PDF
74
- rev preview docx # Build and open Word
75
- ```
76
-
77
- ### rev export
78
- Export project as distributable zip.
79
- ```bash
80
- rev export # Creates project.zip (no node_modules)
81
- ```
82
-
83
- ### rev backup
84
- Create timestamped project backup.
85
- ```bash
86
- rev backup # Creates backup-2024-12-29.zip
87
- rev backup --name v1-draft # Creates v1-draft.zip
88
- ```
89
-
90
- ## Comments & Annotations
91
-
92
- ### rev comments
93
- List all comments with context.
94
- ```bash
95
- rev comments methods.md # Show comments
96
- rev comments methods.md --export out.csv # Export to CSV
97
- ```
98
-
99
- ### rev reply
100
- Reply to a specific comment (non-interactive).
101
- ```bash
102
- rev reply methods.md -n 1 -m "Added clarification"
103
- rev reply results.md -n 3 -m "Updated figure"
104
- ```
105
-
106
- ### rev resolve
107
- Mark a comment as resolved.
108
- ```bash
109
- rev resolve methods.md -n 1
110
- rev resolve methods.md -n 1,2,3 # Multiple comments
111
- ```
112
-
113
- ### rev status
114
- Show project overview or annotation counts for a file.
115
- ```bash
116
- rev status # Project overview (words, comments, changes)
117
- rev status methods.md # Specific file annotations
118
- ```
119
-
120
- ### rev next / rev prev
121
- Navigate pending comments.
122
- ```bash
123
- rev next # Show next pending comment
124
- rev next -n 3 # Show 3rd pending comment
125
- rev prev # Show last pending comment
126
- rev first methods # First comment in methods section
127
- rev last # Last comment overall
128
- ```
129
-
130
- ### rev todo
131
- List all pending comments as a checklist.
132
- ```bash
133
- rev todo # List all pending
134
- rev todo --by-author # Group by author
135
- ```
136
-
137
- ### rev accept / rev reject
138
- Accept or reject track changes.
139
- ```bash
140
- rev accept methods.md # List all changes
141
- rev accept methods.md -n 1 # Accept change #1
142
- rev accept methods.md -a # Accept all
143
- rev reject methods.md -n 2 # Reject change #2
144
- ```
145
-
146
- ### rev archive
147
- Archive reviewer .docx files.
148
- ```bash
149
- rev archive # Move all .docx to archive/
150
- rev archive --by Smith # Specify reviewer name
151
- rev archive --dry-run # Preview without moving
152
- ```
153
-
154
- ### rev strip
155
- Remove all annotations from markdown.
156
- ```bash
157
- rev strip methods.md --output clean.md
158
- rev strip methods.md --accept # Accept all changes
159
- rev strip methods.md --reject # Reject all changes
160
- ```
161
-
162
- ## Response Letter
163
-
164
- ### rev response
165
- Generate point-by-point response letter from comments.
166
- ```bash
167
- rev response # Generate response letter
168
- ```
169
-
170
- ## Validation & Checks
171
-
172
- ### rev check
173
- Run all pre-submission checks (lint + grammar + citations).
174
- ```bash
175
- rev check # Run all checks
176
- rev check --fix # Auto-fix where possible
177
- ```
178
-
179
- ### rev lint
180
- Check for common issues.
181
- ```bash
182
- rev lint # Run all checks
183
- rev lint --fix # Auto-fix where possible
184
- ```
185
- Checks: broken cross-references, missing citations, orphaned figures, unresolved comments.
186
-
187
- ### rev grammar
188
- Check grammar and style.
189
- ```bash
190
- rev grammar # Check all sections
191
- rev grammar --rules # List available rules
192
- rev grammar --learn word # Add to custom dictionary
193
- rev grammar --forget word # Remove from dictionary
194
- rev grammar --list # Show custom dictionary
195
- rev grammar -s warning # Filter by severity
196
- ```
197
-
198
- ### rev spelling
199
- Check spelling in all sections.
200
- ```bash
201
- rev spelling # Check all sections
202
- rev spelling --british # Use British English dictionary
203
- rev spelling --learn word # Add to global dictionary (~/.rev-dictionary)
204
- rev spelling --learn-project word # Add to project dictionary
205
- rev spelling --forget word # Remove from global dictionary
206
- rev spelling --list # Show global dictionary
207
- rev spelling --list-all # Show global + project dictionaries
208
- ```
209
- Built-in scientific vocabulary reduces false positives. Possible author names are shown separately for easy review.
210
-
211
- ### rev validate
212
- Check against journal requirements.
213
- ```bash
214
- rev validate --journal nature
215
- rev validate --list # List 22 available journals
216
- ```
217
-
218
- ### rev citations
219
- Validate citations against bibliography.
220
- ```bash
221
- rev citations
222
- ```
223
-
224
- ## DOI Management
225
-
226
- ### rev doi check
227
- Validate DOIs in bibliography.
228
- ```bash
229
- rev doi check references.bib
230
- rev doi check references.bib --strict # Fail if articles missing DOIs
231
- ```
232
-
233
- ### rev doi lookup
234
- Find missing DOIs by title/author/year.
235
- ```bash
236
- rev doi lookup references.bib
237
- rev doi lookup references.bib --confidence high
238
- ```
239
-
240
- ### rev doi fetch
241
- Get BibTeX from a DOI.
242
- ```bash
243
- rev doi fetch 10.1234/example
244
- ```
245
-
246
- ### rev doi add
247
- Add citation to .bib file from DOI.
248
- ```bash
249
- rev doi add 10.1234/example
250
- rev doi add 10.1234/example --file references.bib
251
- ```
252
-
253
- ## Content Analysis
254
-
255
- ### rev word-count
256
- Show word counts per section.
257
- ```bash
258
- rev word-count # Per-section counts
259
- rev word-count --limit 5000 # Warn if over limit
260
- rev word-count -j nature # Use journal word limit
261
- ```
262
-
263
- ### rev stats
264
- Project dashboard showing overview.
265
- ```bash
266
- rev stats # Words, figures, citations, comments
267
- ```
268
-
269
- ### rev search
270
- Search across all section files.
271
- ```bash
272
- rev search "climate change"
273
- rev search -i "method" # Case-insensitive
274
- ```
275
-
276
- ### rev figures
277
- List figures with reference counts.
278
- ```bash
279
- rev figures methods.md
280
- ```
281
-
282
- ### rev equations
283
- Work with LaTeX equations.
284
- ```bash
285
- rev equations list # List all equations
286
- rev equations from-word manuscript.docx # Extract from Word
287
- ```
288
-
289
- ## Direct DOCX Editing (Layout Workflow)
290
-
291
- ### rev annotate
292
- Add comments directly to Word document.
293
- ```bash
294
- rev annotate paper.docx -m "Comment" -s "text to find"
295
- ```
296
-
297
- ### rev apply
298
- Apply MD annotations as Word track changes.
299
- ```bash
300
- rev apply paper.md output.docx
301
- ```
302
-
303
- ### rev comment
304
- Interactive comment mode for Word documents.
305
- ```bash
306
- rev comment paper.docx
307
- ```
308
-
309
- ## Project Management
310
-
311
- ### rev clean
312
- Remove generated files.
313
- ```bash
314
- rev clean # Remove paper.md, PDFs, DOCXs
315
- rev clean --dry-run # Show what would be deleted
316
- rev clean --all # Also remove backups and exports
317
- ```
318
-
319
- ### rev open
320
- Open project folder or file.
321
- ```bash
322
- rev open # Open project folder
323
- rev open paper.pdf # Open specific file
324
- ```
325
-
326
- ### rev watch
327
- Auto-rebuild on file changes.
328
- ```bash
329
- rev watch # Watch and rebuild
330
- rev watch pdf # Only rebuild PDF
331
- rev watch --no-open # Don't open after build
332
- ```
333
-
334
- ## Configuration
335
-
336
- ### rev config
337
- Configure user settings.
338
- ```bash
339
- rev config user "Your Name" # Set author name for replies
340
- rev config # Show current config
341
- ```
342
-
343
- ## rev.yaml Settings
344
-
345
- ### Tables
346
-
347
- Configure table formatting for PDF output:
348
-
349
- ```yaml
350
- tables:
351
- nowrap:
352
- - Prior # Column headers to keep on one line
353
- - "$\\widehat{R}$"
354
- ```
355
-
356
- In `nowrap` columns, distribution notation is auto-converted to LaTeX math:
357
- - `Normal(0, 0.5)` `$\mathcal{N}(0, 0.5)$`
358
- - `Student-t(3, 0, 1)` `$t_3(0, 1)$`
359
- - `Gamma(2, 0.5)` → `$\text{Gamma}(2, 0.5)$`
360
- - `Half-Normal(0, 1)` → `$\text{Half-Normal}(0, 1)$`
361
- - `Exponential(1)` `$\text{Exp}(1)$`
362
-
363
- **Tip:** For complex tables, use simple tables (space-aligned with dashes) instead of pipe tables to avoid column width issues:
364
-
365
- ```markdown
366
- Parameter Prior Description
367
- ---------- ------------------------- ------------------
368
- alpha $\mathcal{N}(0, 0.5)$ Intercept prior
369
- beta $t_3(0, 2.5)$ Slope prior
370
- ```
371
-
372
- ### Postprocess Scripts
373
-
374
- Run custom scripts after output generation:
375
-
376
- ```yaml
377
- postprocess:
378
- pdf: ./scripts/fix-pdf.py # Runs after PDF
379
- docx: ./scripts/add-meta.js # Runs after DOCX
380
- tex: ./scripts/tweak-latex.sh # Runs after TEX
381
- pptx: ./scripts/fix-slides.ps1 # Runs after PPTX
382
- all: ./scripts/notify.js # Runs after ANY format
383
- ```
384
-
385
- **Environment variables** available to scripts:
386
-
387
- | Variable | Description |
388
- |----------|-------------|
389
- | `OUTPUT_FILE` | Full path to generated file |
390
- | `OUTPUT_FORMAT` | Format: `pdf`, `docx`, `tex`, `pptx`, `beamer` |
391
- | `PROJECT_DIR` | Directory containing rev.yaml |
392
- | `CONFIG_PATH` | Full path to rev.yaml |
393
-
394
- **Supported script types:** `.js`, `.mjs` (Node), `.py` (Python), `.ps1` (PowerShell), `.sh` (Bash)
395
-
396
- **Example Python script** (add DOCX metadata):
397
- ```python
398
- import os
399
- from docx import Document
400
- doc = Document(os.environ['OUTPUT_FILE'])
401
- doc.core_properties.author = "Research Team"
402
- doc.save(os.environ['OUTPUT_FILE'])
403
- ```
404
-
405
- Use `--verbose` flag to see script output:
406
- ```bash
407
- rev build pdf --verbose
408
- ```
409
-
410
- ## Shell Completions
411
-
412
- ### rev completions
413
- Output shell completions.
414
- ```bash
415
- eval "$(rev completions bash)" # Bash
416
- eval "$(rev completions zsh)" # Zsh
417
- ```
418
-
419
- ## AI Skill Installation
420
-
421
- ### rev install-cli-skill
422
- Install the docrev skill for AI coding assistants.
423
- ```bash
424
- rev install-cli-skill # Install to ~/.claude/skills/docrev
425
- ```
426
-
427
- ### rev uninstall-cli-skill
428
- Remove the installed skill.
429
- ```bash
430
- rev uninstall-cli-skill
431
- ```
1
+ # docrev Command Reference
2
+
3
+ ## Project Creation
4
+
5
+ ### rev new
6
+ Create a new document project.
7
+ ```bash
8
+ rev new my-document # Creates my-document/ with section files
9
+ rev new my-document --template apa
10
+ ```
11
+
12
+ ## Document Import/Export
13
+
14
+ ### rev import
15
+ Import a Word document with track changes and comments.
16
+ ```bash
17
+ rev import manuscript.docx
18
+ rev import manuscript.docx --output ./project
19
+ ```
20
+
21
+ ### rev sync
22
+ Sync feedback from a reviewed Word document into existing markdown sections.
23
+ ```bash
24
+ rev sync reviewed.docx # Updates markdown with track changes/comments
25
+ rev sync # Auto-detect most recent .docx
26
+ rev sync reviewed.docx methods # Sync only methods section
27
+ rev sync reviewed.docx --comments-only # Insert comments only; never modify prose
28
+ ```
29
+
30
+ `--comments-only` skips the Word→Markdown diff entirely. Use it when the
31
+ markdown has been revised between sending the docx out for review and
32
+ receiving it back: applying track changes from a stale draft would clobber
33
+ newer edits, but comments still need to land. Comments are placed at
34
+ fuzzy-matched anchors against the current prose. Pair with
35
+ `rev verify-anchors` to see which ones won't fit before you run sync.
36
+
37
+ ### rev verify-anchors
38
+ Report drift between Word comment anchors and the current markdown.
39
+ ```bash
40
+ rev verify-anchors reviewed.docx # Print per-comment match quality
41
+ rev verify-anchors reviewed.docx --json # Machine-readable report
42
+ ```
43
+
44
+ Each comment is classified by how well its anchor still matches the current
45
+ section prose:
46
+
47
+ - `clean` – exact or whitespace-normalized hit
48
+ - `drift` – anchor only matches via stripped-CriticMarkup or partial-prefix fallbacks
49
+ - `context-only` – anchor text is gone, only surrounding context survives
50
+ - `ambiguous` – multiple candidate positions; needs context to disambiguate
51
+ - `unmatched` – nothing maps; user must place the comment manually
52
+
53
+ Useful before `rev sync --comments-only` to plan which comments will land
54
+ automatically and which need manual placement.
55
+
56
+ ### rev build
57
+ Build output documents from markdown sections.
58
+ ```bash
59
+ rev build # Build PDF and DOCX
60
+ rev build pdf # PDF only
61
+ rev build docx # DOCX only
62
+ rev build --toc # Include table of contents
63
+ rev build docx --dual # Clean + annotated versions
64
+ rev build docx --show-changes # DOCX with visible track changes (audit)
65
+ ```
66
+
67
+ By default, outputs land in `output/` next to `rev.yaml`. Override or
68
+ disable via the `outputDir` field in rev.yaml (see below).
69
+
70
+ The `--dual` flag produces:
71
+ - `output/<title>.docx` clean, for submission
72
+ - `output/<title>_comments.docx` — includes comment threads as Word comments
73
+
74
+ The `--show-changes` flag (DOCX only) produces a single audit document
75
+ where every accepted/rejected revision and substitution is exported as a
76
+ visible Word track change, attributed to the configured user. Useful when
77
+ a co-author wants to see what changed since the last shared version.
78
+
79
+ ### rev preview
80
+ Build and open document in default app.
81
+ ```bash
82
+ rev preview pdf # Build and open PDF
83
+ rev preview docx # Build and open Word
84
+ ```
85
+
86
+ ### rev export
87
+ Export project as distributable zip.
88
+ ```bash
89
+ rev export # Creates project.zip (no node_modules)
90
+ ```
91
+
92
+ ### rev backup
93
+ Create timestamped project backup.
94
+ ```bash
95
+ rev backup # Creates backup-2024-12-29.zip
96
+ rev backup --name v1-draft # Creates v1-draft.zip
97
+ ```
98
+
99
+ ## Comments & Annotations
100
+
101
+ ### rev comments
102
+ List all comments with context.
103
+ ```bash
104
+ rev comments methods.md # Show comments
105
+ rev comments methods.md --export out.csv # Export to CSV
106
+ ```
107
+
108
+ ### rev reply
109
+ Reply to a specific comment (non-interactive).
110
+ ```bash
111
+ rev reply methods.md -n 1 -m "Added clarification"
112
+ rev reply results.md -n 3 -m "Updated figure"
113
+ ```
114
+
115
+ ### rev resolve
116
+ Mark a comment as resolved.
117
+ ```bash
118
+ rev resolve methods.md -n 1
119
+ rev resolve methods.md -n 1,2,3 # Multiple comments
120
+ ```
121
+
122
+ ### rev status
123
+ Show project overview or annotation counts for a file.
124
+ ```bash
125
+ rev status # Project overview (words, comments, changes)
126
+ rev status methods.md # Specific file annotations
127
+ ```
128
+
129
+ ### rev next / rev prev
130
+ Navigate pending comments.
131
+ ```bash
132
+ rev next # Show next pending comment
133
+ rev next -n 3 # Show 3rd pending comment
134
+ rev prev # Show last pending comment
135
+ rev first methods # First comment in methods section
136
+ rev last # Last comment overall
137
+ ```
138
+
139
+ ### rev todo
140
+ List all pending comments as a checklist.
141
+ ```bash
142
+ rev todo # List all pending
143
+ rev todo --by-author # Group by author
144
+ ```
145
+
146
+ ### rev accept / rev reject
147
+ Accept or reject track changes.
148
+ ```bash
149
+ rev accept methods.md # List all changes
150
+ rev accept methods.md -n 1 # Accept change #1
151
+ rev accept methods.md -a # Accept all
152
+ rev reject methods.md -n 2 # Reject change #2
153
+ ```
154
+
155
+ ### rev archive
156
+ Archive reviewer .docx files.
157
+ ```bash
158
+ rev archive # Move all .docx to archive/
159
+ rev archive --by Smith # Specify reviewer name
160
+ rev archive --dry-run # Preview without moving
161
+ ```
162
+
163
+ ### rev strip
164
+ Remove all annotations from markdown.
165
+ ```bash
166
+ rev strip methods.md --output clean.md
167
+ rev strip methods.md --accept # Accept all changes
168
+ rev strip methods.md --reject # Reject all changes
169
+ ```
170
+
171
+ ## Response Letter
172
+
173
+ ### rev response
174
+ Generate point-by-point response letter from comments.
175
+ ```bash
176
+ rev response # Generate response letter
177
+ ```
178
+
179
+ ## Validation & Checks
180
+
181
+ ### rev check
182
+ Run all pre-submission checks (lint + grammar + citations).
183
+ ```bash
184
+ rev check # Run all checks
185
+ rev check --fix # Auto-fix where possible
186
+ ```
187
+
188
+ ### rev lint
189
+ Check for common issues.
190
+ ```bash
191
+ rev lint # Run all checks
192
+ rev lint --fix # Auto-fix where possible
193
+ ```
194
+ Checks: broken cross-references, missing citations, orphaned figures, unresolved comments.
195
+
196
+ ### rev grammar
197
+ Check grammar and style.
198
+ ```bash
199
+ rev grammar # Check all sections
200
+ rev grammar --rules # List available rules
201
+ rev grammar --learn word # Add to custom dictionary
202
+ rev grammar --forget word # Remove from dictionary
203
+ rev grammar --list # Show custom dictionary
204
+ rev grammar -s warning # Filter by severity
205
+ ```
206
+
207
+ ### rev spelling
208
+ Check spelling in all sections.
209
+ ```bash
210
+ rev spelling # Check all sections
211
+ rev spelling --british # Use British English dictionary
212
+ rev spelling --learn word # Add to global dictionary (~/.rev-dictionary)
213
+ rev spelling --learn-project word # Add to project dictionary
214
+ rev spelling --forget word # Remove from global dictionary
215
+ rev spelling --list # Show global dictionary
216
+ rev spelling --list-all # Show global + project dictionaries
217
+ ```
218
+ Built-in scientific vocabulary reduces false positives. Possible author names are shown separately for easy review.
219
+
220
+ ### rev validate
221
+ Check against journal requirements.
222
+ ```bash
223
+ rev validate --journal nature
224
+ rev validate --list # List 22 available journals
225
+ ```
226
+
227
+ ### rev citations
228
+ Validate citations against bibliography.
229
+ ```bash
230
+ rev citations
231
+ ```
232
+
233
+ ## DOI Management
234
+
235
+ ### rev doi check
236
+ Validate DOIs in bibliography.
237
+ ```bash
238
+ rev doi check references.bib
239
+ rev doi check references.bib --strict # Fail if articles missing DOIs
240
+ ```
241
+
242
+ ### rev doi lookup
243
+ Find missing DOIs by title/author/year.
244
+ ```bash
245
+ rev doi lookup references.bib
246
+ rev doi lookup references.bib --confidence high
247
+ ```
248
+
249
+ ### rev doi fetch
250
+ Get BibTeX from a DOI.
251
+ ```bash
252
+ rev doi fetch 10.1234/example
253
+ ```
254
+
255
+ ### rev doi add
256
+ Add citation to .bib file from DOI.
257
+ ```bash
258
+ rev doi add 10.1234/example
259
+ rev doi add 10.1234/example --file references.bib
260
+ ```
261
+
262
+ ## Content Analysis
263
+
264
+ ### rev word-count
265
+ Show word counts per section.
266
+ ```bash
267
+ rev word-count # Per-section counts
268
+ rev word-count --limit 5000 # Warn if over limit
269
+ rev word-count -j nature # Use journal word limit
270
+ ```
271
+
272
+ ### rev stats
273
+ Project dashboard showing overview.
274
+ ```bash
275
+ rev stats # Words, figures, citations, comments
276
+ ```
277
+
278
+ ### rev search
279
+ Search across all section files.
280
+ ```bash
281
+ rev search "climate change"
282
+ rev search -i "method" # Case-insensitive
283
+ ```
284
+
285
+ ### rev figures
286
+ List figures with reference counts.
287
+ ```bash
288
+ rev figures methods.md
289
+ ```
290
+
291
+ ### rev equations
292
+ Work with LaTeX equations.
293
+ ```bash
294
+ rev equations list # List all equations
295
+ rev equations from-word manuscript.docx # Extract from Word
296
+ ```
297
+
298
+ ## Direct DOCX Editing (Layout Workflow)
299
+
300
+ ### rev annotate
301
+ Add comments directly to Word document.
302
+ ```bash
303
+ rev annotate paper.docx -m "Comment" -s "text to find"
304
+ ```
305
+
306
+ ### rev apply
307
+ Apply MD annotations as Word track changes.
308
+ ```bash
309
+ rev apply paper.md output.docx
310
+ ```
311
+
312
+ ### rev comment
313
+ Interactive comment mode for Word documents.
314
+ ```bash
315
+ rev comment paper.docx
316
+ ```
317
+
318
+ ## Project Management
319
+
320
+ ### rev clean
321
+ Remove generated files.
322
+ ```bash
323
+ rev clean # Remove paper.md, PDFs, DOCXs
324
+ rev clean --dry-run # Show what would be deleted
325
+ rev clean --all # Also remove backups and exports
326
+ ```
327
+
328
+ ### rev open
329
+ Open project folder or file.
330
+ ```bash
331
+ rev open # Open project folder
332
+ rev open paper.pdf # Open specific file
333
+ ```
334
+
335
+ ### rev watch
336
+ Auto-rebuild on file changes.
337
+ ```bash
338
+ rev watch # Watch and rebuild
339
+ rev watch pdf # Only rebuild PDF
340
+ rev watch --no-open # Don't open after build
341
+ ```
342
+
343
+ ## Configuration
344
+
345
+ ### rev config
346
+ Configure user settings.
347
+ ```bash
348
+ rev config user "Your Name" # Set author name for replies
349
+ rev config # Show current config
350
+ ```
351
+
352
+ ## rev.yaml Settings
353
+
354
+ ### Output Directory
355
+
356
+ By default, built artefacts land in `output/` next to `rev.yaml`. Both the
357
+ clean output and `--dual` companion (`*_comments.docx` / `*_comments.pdf`)
358
+ follow the configured location. Override or disable:
359
+
360
+ ```yaml
361
+ outputDir: output # default — outputs land in ./output/
362
+ outputDir: dist # custom subdirectory
363
+ outputDir: null # legacy layout outputs alongside paper.md
364
+ ```
365
+
366
+ Explicit caller-supplied output paths (e.g. internal temp files in the
367
+ dual flow) bypass `outputDir`.
368
+
369
+ ### PDF Engine and Fonts
370
+
371
+ The default PDF engine is `pdflatex`. Switch to xelatex/lualatex when the
372
+ manuscript needs native UTF-8 rendering of Latin-Extended diacritics
373
+ (Czech/Polish/Croatian/Spanish author names, species epithets):
374
+
375
+ ```yaml
376
+ pdf:
377
+ engine: xelatex # or lualatex, tectonic, etc.
378
+ mainfont: "TeX Gyre Termes" # serif (xelatex/lualatex only — uses fontspec)
379
+ sansfont: "TeX Gyre Heros" # sans (optional)
380
+ monofont: "TeX Gyre Cursor" # monospace (optional)
381
+ ```
382
+
383
+ `mainfont`/`sansfont`/`monofont` are forwarded as pandoc `-V` flags and
384
+ require an engine that loads `fontspec` (xelatex or lualatex). They are
385
+ ignored under `pdflatex`.
386
+
387
+ ### Tables
388
+
389
+ Configure table formatting for PDF output:
390
+
391
+ ```yaml
392
+ tables:
393
+ nowrap:
394
+ - Prior # Column headers to keep on one line
395
+ - "$\\widehat{R}$"
396
+ ```
397
+
398
+ In `nowrap` columns, distribution notation is auto-converted to LaTeX math:
399
+ - `Normal(0, 0.5)` → `$\mathcal{N}(0, 0.5)$`
400
+ - `Student-t(3, 0, 1)` → `$t_3(0, 1)$`
401
+ - `Gamma(2, 0.5)` `$\text{Gamma}(2, 0.5)$`
402
+ - `Half-Normal(0, 1)` → `$\text{Half-Normal}(0, 1)$`
403
+ - `Exponential(1)` → `$\text{Exp}(1)$`
404
+
405
+ **Tip:** For complex tables, use simple tables (space-aligned with dashes) instead of pipe tables to avoid column width issues:
406
+
407
+ ```markdown
408
+ Parameter Prior Description
409
+ ---------- ------------------------- ------------------
410
+ alpha $\mathcal{N}(0, 0.5)$ Intercept prior
411
+ beta $t_3(0, 2.5)$ Slope prior
412
+ ```
413
+
414
+ ### Postprocess Scripts
415
+
416
+ Run custom scripts after output generation:
417
+
418
+ ```yaml
419
+ postprocess:
420
+ pdf: ./scripts/fix-pdf.py # Runs after PDF
421
+ docx: ./scripts/add-meta.js # Runs after DOCX
422
+ tex: ./scripts/tweak-latex.sh # Runs after TEX
423
+ pptx: ./scripts/fix-slides.ps1 # Runs after PPTX
424
+ all: ./scripts/notify.js # Runs after ANY format
425
+ ```
426
+
427
+ **Environment variables** available to scripts:
428
+
429
+ | Variable | Description |
430
+ |----------|-------------|
431
+ | `OUTPUT_FILE` | Full path to generated file |
432
+ | `OUTPUT_FORMAT` | Format: `pdf`, `docx`, `tex`, `pptx`, `beamer` |
433
+ | `PROJECT_DIR` | Directory containing rev.yaml |
434
+ | `CONFIG_PATH` | Full path to rev.yaml |
435
+
436
+ **Supported script types:** `.js`, `.mjs` (Node), `.py` (Python), `.ps1` (PowerShell), `.sh` (Bash)
437
+
438
+ **Example Python script** (add DOCX metadata):
439
+ ```python
440
+ import os
441
+ from docx import Document
442
+ doc = Document(os.environ['OUTPUT_FILE'])
443
+ doc.core_properties.author = "Research Team"
444
+ doc.save(os.environ['OUTPUT_FILE'])
445
+ ```
446
+
447
+ Use `--verbose` flag to see script output:
448
+ ```bash
449
+ rev build pdf --verbose
450
+ ```
451
+
452
+ ## Shell Completions
453
+
454
+ ### rev completions
455
+ Output shell completions.
456
+ ```bash
457
+ eval "$(rev completions bash)" # Bash
458
+ eval "$(rev completions zsh)" # Zsh
459
+ ```
460
+
461
+ ## AI Skill Installation
462
+
463
+ ### rev install-cli-skill
464
+ Install the docrev skill for AI coding assistants.
465
+ ```bash
466
+ rev install-cli-skill # Install to ~/.claude/skills/docrev
467
+ ```
468
+
469
+ ### rev uninstall-cli-skill
470
+ Remove the installed skill.
471
+ ```bash
472
+ rev uninstall-cli-skill
473
+ ```