docrev 0.9.5 → 0.9.7

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 (99) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dev_notes/bug_repro_comment_parser.md +71 -0
  3. package/dist/lib/anchor-match.d.ts +41 -0
  4. package/dist/lib/anchor-match.d.ts.map +1 -0
  5. package/dist/lib/anchor-match.js +192 -0
  6. package/dist/lib/anchor-match.js.map +1 -0
  7. package/dist/lib/annotations.d.ts.map +1 -1
  8. package/dist/lib/annotations.js +8 -5
  9. package/dist/lib/annotations.js.map +1 -1
  10. package/dist/lib/commands/file-ops.d.ts +11 -0
  11. package/dist/lib/commands/file-ops.d.ts.map +1 -0
  12. package/dist/lib/commands/file-ops.js +301 -0
  13. package/dist/lib/commands/file-ops.js.map +1 -0
  14. package/dist/lib/commands/index.d.ts +10 -1
  15. package/dist/lib/commands/index.d.ts.map +1 -1
  16. package/dist/lib/commands/index.js +19 -1
  17. package/dist/lib/commands/index.js.map +1 -1
  18. package/dist/lib/commands/merge-resolve.d.ts +12 -0
  19. package/dist/lib/commands/merge-resolve.d.ts.map +1 -0
  20. package/dist/lib/commands/merge-resolve.js +318 -0
  21. package/dist/lib/commands/merge-resolve.js.map +1 -0
  22. package/dist/lib/commands/preview.d.ts +11 -0
  23. package/dist/lib/commands/preview.d.ts.map +1 -0
  24. package/dist/lib/commands/preview.js +138 -0
  25. package/dist/lib/commands/preview.js.map +1 -0
  26. package/dist/lib/commands/project-info.d.ts +11 -0
  27. package/dist/lib/commands/project-info.d.ts.map +1 -0
  28. package/dist/lib/commands/project-info.js +187 -0
  29. package/dist/lib/commands/project-info.js.map +1 -0
  30. package/dist/lib/commands/quality.d.ts +11 -0
  31. package/dist/lib/commands/quality.d.ts.map +1 -0
  32. package/dist/lib/commands/quality.js +384 -0
  33. package/dist/lib/commands/quality.js.map +1 -0
  34. package/dist/lib/commands/section-boundaries.d.ts +22 -0
  35. package/dist/lib/commands/section-boundaries.d.ts.map +1 -0
  36. package/dist/lib/commands/section-boundaries.js +53 -0
  37. package/dist/lib/commands/section-boundaries.js.map +1 -0
  38. package/dist/lib/commands/sections.d.ts +3 -2
  39. package/dist/lib/commands/sections.d.ts.map +1 -1
  40. package/dist/lib/commands/sections.js +4 -736
  41. package/dist/lib/commands/sections.js.map +1 -1
  42. package/dist/lib/commands/sync.d.ts +11 -0
  43. package/dist/lib/commands/sync.d.ts.map +1 -0
  44. package/dist/lib/commands/sync.js +576 -0
  45. package/dist/lib/commands/sync.js.map +1 -0
  46. package/dist/lib/commands/text-ops.d.ts +11 -0
  47. package/dist/lib/commands/text-ops.d.ts.map +1 -0
  48. package/dist/lib/commands/text-ops.js +357 -0
  49. package/dist/lib/commands/text-ops.js.map +1 -0
  50. package/dist/lib/commands/utilities.d.ts +2 -4
  51. package/dist/lib/commands/utilities.d.ts.map +1 -1
  52. package/dist/lib/commands/utilities.js +3 -1572
  53. package/dist/lib/commands/utilities.js.map +1 -1
  54. package/dist/lib/commands/verify-anchors.d.ts +17 -0
  55. package/dist/lib/commands/verify-anchors.d.ts.map +1 -0
  56. package/dist/lib/commands/verify-anchors.js +215 -0
  57. package/dist/lib/commands/verify-anchors.js.map +1 -0
  58. package/dist/lib/commands/word-tools.d.ts +11 -0
  59. package/dist/lib/commands/word-tools.d.ts.map +1 -0
  60. package/dist/lib/commands/word-tools.js +272 -0
  61. package/dist/lib/commands/word-tools.js.map +1 -0
  62. package/dist/lib/diff-engine.d.ts +25 -0
  63. package/dist/lib/diff-engine.d.ts.map +1 -0
  64. package/dist/lib/diff-engine.js +354 -0
  65. package/dist/lib/diff-engine.js.map +1 -0
  66. package/dist/lib/import.d.ts +44 -118
  67. package/dist/lib/import.d.ts.map +1 -1
  68. package/dist/lib/import.js +25 -1173
  69. package/dist/lib/import.js.map +1 -1
  70. package/dist/lib/restore-references.d.ts +35 -0
  71. package/dist/lib/restore-references.d.ts.map +1 -0
  72. package/dist/lib/restore-references.js +188 -0
  73. package/dist/lib/restore-references.js.map +1 -0
  74. package/dist/lib/word-extraction.d.ts +100 -0
  75. package/dist/lib/word-extraction.d.ts.map +1 -0
  76. package/dist/lib/word-extraction.js +594 -0
  77. package/dist/lib/word-extraction.js.map +1 -0
  78. package/lib/anchor-match.ts +238 -0
  79. package/lib/annotations.ts +9 -5
  80. package/lib/commands/file-ops.ts +372 -0
  81. package/lib/commands/index.ts +27 -0
  82. package/lib/commands/merge-resolve.ts +378 -0
  83. package/lib/commands/preview.ts +178 -0
  84. package/lib/commands/project-info.ts +244 -0
  85. package/lib/commands/quality.ts +517 -0
  86. package/lib/commands/section-boundaries.ts +72 -0
  87. package/lib/commands/sections.ts +3 -870
  88. package/lib/commands/sync.ts +701 -0
  89. package/lib/commands/text-ops.ts +449 -0
  90. package/lib/commands/utilities.ts +62 -2043
  91. package/lib/commands/verify-anchors.ts +261 -0
  92. package/lib/commands/word-tools.ts +340 -0
  93. package/lib/diff-engine.ts +465 -0
  94. package/lib/import.ts +108 -1504
  95. package/lib/restore-references.ts +240 -0
  96. package/lib/word-extraction.ts +759 -0
  97. package/package.json +1 -1
  98. package/skill/REFERENCE.md +29 -2
  99. package/skill/SKILL.md +12 -2
@@ -0,0 +1,576 @@
1
+ /**
2
+ * SYNC command: Import feedback from Word/PDF back to section files
3
+ *
4
+ * Split from sections.ts for maintainability.
5
+ */
6
+ import { chalk, fs, path, fmt, findFiles, loadConfig, extractSectionsFromText, countAnnotations, buildRegistry, convertHardcodedRefs, inlineDiffPreview, } from './context.js';
7
+ import * as readline from 'readline';
8
+ /**
9
+ * Register the sync command with the program
10
+ */
11
+ export function register(program) {
12
+ // ==========================================================================
13
+ // SYNC command - Import with section awareness
14
+ // ==========================================================================
15
+ program
16
+ .command('sync')
17
+ .alias('sections')
18
+ .description('Sync feedback from Word/PDF back to section files')
19
+ .argument('[file]', 'Word (.docx) or PDF file from reviewer (default: most recent)')
20
+ .argument('[sections...]', 'Specific sections to sync (default: all)')
21
+ .option('-c, --config <file>', 'Sections config file', 'sections.yaml')
22
+ .option('-d, --dir <directory>', 'Directory with section files', '.')
23
+ .option('--no-crossref', 'Skip converting hardcoded figure/table refs')
24
+ .option('--no-diff', 'Skip showing diff preview')
25
+ .option('--force', 'Overwrite files without conflict warning')
26
+ .option('--dry-run', 'Preview without writing files')
27
+ .option('--comments-only', 'Insert comments at fuzzy-matched anchors only; never modify existing prose or apply track changes (use when markdown was revised after the docx was sent for review)')
28
+ .action(async (docx, sections, options) => {
29
+ // Auto-detect most recent docx or pdf if not provided
30
+ if (!docx) {
31
+ const docxFiles = findFiles('.docx');
32
+ const pdfFiles = findFiles('.pdf');
33
+ const allFiles = [...docxFiles, ...pdfFiles];
34
+ if (allFiles.length === 0) {
35
+ console.error(fmt.status('error', 'No .docx or .pdf files found in current directory.'));
36
+ process.exit(1);
37
+ }
38
+ const sorted = allFiles
39
+ .map(f => ({ name: f, mtime: fs.statSync(f).mtime }))
40
+ .sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
41
+ docx = sorted[0].name;
42
+ console.log(fmt.status('info', `Using most recent: ${docx}`));
43
+ console.log();
44
+ }
45
+ if (!fs.existsSync(docx)) {
46
+ console.error(fmt.status('error', `File not found: ${docx}`));
47
+ process.exit(1);
48
+ }
49
+ // Handle PDF files
50
+ if (docx.toLowerCase().endsWith('.pdf')) {
51
+ const { extractPdfComments, formatPdfComments, getPdfCommentStats } = await import('../pdf-import.js');
52
+ const spin = fmt.spinner(`Extracting comments from ${path.basename(docx)}...`).start();
53
+ try {
54
+ const comments = await extractPdfComments(docx);
55
+ spin.stop();
56
+ if (comments.length === 0) {
57
+ console.log(fmt.status('info', 'No comments found in PDF.'));
58
+ return;
59
+ }
60
+ const stats = getPdfCommentStats(comments);
61
+ console.log(fmt.header(`PDF Comments from ${path.basename(docx)}`));
62
+ console.log();
63
+ console.log(formatPdfComments(comments));
64
+ console.log();
65
+ const authorList = Object.entries(stats.byAuthor)
66
+ .map(([author, count]) => `${author} (${count})`)
67
+ .join(', ');
68
+ console.log(chalk.dim(`Total: ${stats.total} comments from ${authorList}`));
69
+ console.log();
70
+ const configPath = path.resolve(options.dir, options.config);
71
+ if (fs.existsSync(configPath) && !options.dryRun) {
72
+ const config = loadConfig(configPath);
73
+ const mainSection = config.sections?.[0];
74
+ if (mainSection && typeof mainSection === 'string') {
75
+ const mainPath = path.join(options.dir, mainSection);
76
+ if (fs.existsSync(mainPath)) {
77
+ console.log(chalk.dim(`Use 'rev pdf-comments ${docx} --append ${mainSection}' to add comments to markdown.`));
78
+ }
79
+ }
80
+ }
81
+ }
82
+ catch (err) {
83
+ spin.stop();
84
+ const error = err;
85
+ console.error(fmt.status('error', `Failed to extract PDF comments: ${error.message}`));
86
+ if (process.env.DEBUG)
87
+ console.error(error.stack);
88
+ process.exit(1);
89
+ }
90
+ return;
91
+ }
92
+ const configPath = path.resolve(options.dir, options.config);
93
+ if (!fs.existsSync(configPath)) {
94
+ console.error(fmt.status('error', `Config not found: ${configPath}`));
95
+ console.error(chalk.dim(' Run "rev init" first to generate sections.yaml'));
96
+ process.exit(1);
97
+ }
98
+ // --comments-only: import comments only, never modify existing prose.
99
+ // Use this when the markdown has been revised since the docx was sent
100
+ // out — track changes from a stale draft would clobber newer edits.
101
+ if (options.commentsOnly) {
102
+ await syncCommentsOnly(docx, sections, options, configPath);
103
+ return;
104
+ }
105
+ // Check pandoc availability upfront and warn
106
+ const { hasPandoc, getInstallInstructions } = await import('../dependencies.js');
107
+ if (!hasPandoc()) {
108
+ console.log(fmt.status('warning', `Pandoc not installed. Track changes will be extracted from XML (formatting may differ).`));
109
+ console.log(chalk.dim(` Install for best results: ${getInstallInstructions('pandoc')}`));
110
+ console.log();
111
+ }
112
+ const spin = fmt.spinner(`Importing ${path.basename(docx)}...`).start();
113
+ try {
114
+ const config = loadConfig(configPath);
115
+ const { importFromWord, extractWordComments, extractCommentAnchors, insertCommentsIntoMarkdown, extractFromWord } = await import('../import.js');
116
+ let registry = null;
117
+ let totalRefConversions = 0;
118
+ if (options.crossref !== false) {
119
+ registry = buildRegistry(options.dir);
120
+ }
121
+ const comments = await extractWordComments(docx);
122
+ const { anchors, fullDocText: xmlDocText } = await extractCommentAnchors(docx);
123
+ // Extract Word text (uses pandoc if available, falls back to XML extraction)
124
+ const wordExtraction = await extractFromWord(docx, { mediaDir: options.dir });
125
+ let wordText = wordExtraction.text;
126
+ const wordTables = wordExtraction.tables || [];
127
+ // Log extraction messages (warnings about pandoc, track change stats, etc.)
128
+ for (const msg of wordExtraction.messages || []) {
129
+ if (msg.type === 'warning') {
130
+ spin.stop();
131
+ console.log(fmt.status('warning', msg.message));
132
+ spin.start();
133
+ }
134
+ }
135
+ // Restore crossref on FULL text BEFORE splitting into sections
136
+ // This ensures duplicate labels from track changes are handled correctly
137
+ // (the same figure may appear multiple times in old/new versions)
138
+ const { restoreCrossrefFromWord, restoreImagesFromRegistry } = await import('../import.js');
139
+ const crossrefResult = restoreCrossrefFromWord(wordText, options.dir);
140
+ wordText = crossrefResult.text;
141
+ if (crossrefResult.restored > 0) {
142
+ console.log(`Restored ${crossrefResult.restored} crossref reference(s)`);
143
+ }
144
+ // Also restore images from registry using shared restoredLabels
145
+ const imageRestoreResult = restoreImagesFromRegistry(wordText, options.dir, crossrefResult.restoredLabels);
146
+ wordText = imageRestoreResult.text;
147
+ if (imageRestoreResult.restored > 0) {
148
+ console.log(`Restored ${imageRestoreResult.restored} image(s) from registry`);
149
+ }
150
+ let wordSections = extractSectionsFromText(wordText, config.sections);
151
+ if (wordSections.length === 0) {
152
+ spin.stop();
153
+ console.error(fmt.status('warning', 'No sections detected in Word document.'));
154
+ console.error(chalk.dim(' Check that headings match sections.yaml'));
155
+ process.exit(1);
156
+ }
157
+ if (sections && sections.length > 0) {
158
+ const onlyList = sections.map(s => s.trim().toLowerCase());
159
+ wordSections = wordSections.filter(section => {
160
+ const fileName = section.file.replace(/\.md$/i, '').toLowerCase();
161
+ const header = section.header.toLowerCase();
162
+ return onlyList.some(name => fileName === name || fileName.includes(name) || header.includes(name));
163
+ });
164
+ if (wordSections.length === 0) {
165
+ spin.stop();
166
+ console.error(fmt.status('error', `No sections matched: ${sections.join(', ')}`));
167
+ console.error(chalk.dim(` Available: ${extractSectionsFromText(wordText, config.sections).map(s => s.file.replace(/\.md$/i, '')).join(', ')}`));
168
+ process.exit(1);
169
+ }
170
+ }
171
+ spin.stop();
172
+ console.log(fmt.header(`Import from ${path.basename(docx)}`));
173
+ console.log();
174
+ // Conflict detection
175
+ if (!options.force && !options.dryRun) {
176
+ const conflicts = [];
177
+ for (const section of wordSections) {
178
+ const sectionPath = path.join(options.dir, section.file);
179
+ if (fs.existsSync(sectionPath)) {
180
+ const existing = fs.readFileSync(sectionPath, 'utf-8');
181
+ const existingCounts = countAnnotations(existing);
182
+ if (existingCounts.total > 0) {
183
+ conflicts.push({
184
+ file: section.file,
185
+ annotations: existingCounts.total,
186
+ });
187
+ }
188
+ }
189
+ }
190
+ if (conflicts.length > 0) {
191
+ console.log(fmt.status('warning', 'Files with existing annotations will be overwritten:'));
192
+ for (const c of conflicts) {
193
+ console.log(chalk.yellow(` - ${c.file} (${c.annotations} annotations)`));
194
+ }
195
+ console.log();
196
+ const rl = readline.createInterface({
197
+ input: process.stdin,
198
+ output: process.stdout,
199
+ });
200
+ const answer = await new Promise((resolve) => rl.question(chalk.cyan('Continue and overwrite? [y/N] '), resolve));
201
+ rl.close();
202
+ if (answer.toLowerCase() !== 'y') {
203
+ console.log(chalk.dim('Aborted. Use --force to skip this check.'));
204
+ process.exit(0);
205
+ }
206
+ console.log();
207
+ }
208
+ }
209
+ const sectionResults = [];
210
+ let totalChanges = 0;
211
+ // Calculate section boundaries in the XML document text for comment filtering
212
+ // Comment positions (docPosition) are relative to xmlDocText, NOT wordText
213
+ // So we must find section headers in xmlDocText to get matching boundaries
214
+ const sectionBoundaries = [];
215
+ const xmlLower = xmlDocText.toLowerCase();
216
+ // Standard section header keywords to search for in XML
217
+ // Map from file name pattern to search terms
218
+ const sectionKeywords = {
219
+ 'abstract': ['abstract', 'summary'],
220
+ 'introduction': ['introduction', 'background'],
221
+ 'methods': ['methods', 'materials and methods', 'methodology'],
222
+ 'results': ['results'],
223
+ 'discussion': ['discussion'],
224
+ 'conclusion': ['conclusion', 'conclusions'],
225
+ };
226
+ // Helper: find section header (skip labels like "Methods:" in structured abstracts)
227
+ // Real section headers are NOT followed by ":" immediately
228
+ function findSectionHeader(text, keyword, startFrom = 0) {
229
+ const lower = text.toLowerCase();
230
+ let idx = startFrom;
231
+ while ((idx = lower.indexOf(keyword, idx)) !== -1) {
232
+ // Check what follows the keyword
233
+ const afterKeyword = text.slice(idx + keyword.length, idx + keyword.length + 5);
234
+ // Skip if followed by ":" (this is a label, not a section header)
235
+ // Real headers are followed by text content, a newline, or a subheading
236
+ if (!afterKeyword.startsWith(':') && !afterKeyword.startsWith(' :')) {
237
+ return idx;
238
+ }
239
+ idx++;
240
+ }
241
+ return -1;
242
+ }
243
+ for (const section of wordSections) {
244
+ const fileBase = section.file.replace(/\.md$/i, '').toLowerCase();
245
+ // Get keywords for this section
246
+ const keywords = sectionKeywords[fileBase] || [fileBase];
247
+ // Find the first valid keyword that exists in XML (not a label)
248
+ let headerIdx = -1;
249
+ for (const kw of keywords) {
250
+ const idx = findSectionHeader(xmlDocText, kw, 0);
251
+ if (idx >= 0 && (headerIdx < 0 || idx < headerIdx)) {
252
+ headerIdx = idx;
253
+ }
254
+ }
255
+ if (headerIdx >= 0) {
256
+ // Find the next section's start to determine end boundary
257
+ let nextHeaderIdx = xmlDocText.length;
258
+ const sectionIdx = wordSections.indexOf(section);
259
+ if (sectionIdx < wordSections.length - 1) {
260
+ const nextFileBase = wordSections[sectionIdx + 1].file.replace(/\.md$/i, '').toLowerCase();
261
+ const nextKeywords = sectionKeywords[nextFileBase] || [nextFileBase];
262
+ for (const nkw of nextKeywords) {
263
+ const foundNext = findSectionHeader(xmlDocText, nkw, headerIdx + 10);
264
+ if (foundNext >= 0 && foundNext < nextHeaderIdx) {
265
+ nextHeaderIdx = foundNext;
266
+ }
267
+ }
268
+ }
269
+ sectionBoundaries.push({
270
+ file: section.file,
271
+ start: headerIdx,
272
+ end: nextHeaderIdx
273
+ });
274
+ }
275
+ }
276
+ // Document length is the XML text length (same coordinate system as docPosition)
277
+ const docLength = xmlDocText.length;
278
+ for (const section of wordSections) {
279
+ const sectionPath = path.join(options.dir, section.file);
280
+ if (!fs.existsSync(sectionPath)) {
281
+ sectionResults.push({
282
+ file: section.file,
283
+ header: section.header,
284
+ status: 'skipped',
285
+ stats: undefined,
286
+ });
287
+ continue;
288
+ }
289
+ const result = await importFromWord(docx, sectionPath, {
290
+ sectionContent: section.content,
291
+ author: 'Reviewer',
292
+ wordTables: wordTables,
293
+ });
294
+ let { annotated, stats } = result;
295
+ let refConversions = [];
296
+ if (registry && options.crossref !== false) {
297
+ const crossrefResult = convertHardcodedRefs(annotated, registry);
298
+ annotated = crossrefResult.converted;
299
+ refConversions = crossrefResult.conversions;
300
+ totalRefConversions += refConversions.length;
301
+ }
302
+ let commentsInserted = 0;
303
+ if (comments.length > 0 && anchors.size > 0) {
304
+ // Filter comments to only those that belong to this section
305
+ // Use exact position matching: docPosition is in xmlDocText coordinates,
306
+ // and sectionBoundaries are also in xmlDocText coordinates (same source!)
307
+ const boundary = sectionBoundaries.find(b => b.file === section.file);
308
+ const isFirstSection = wordSections.indexOf(section) === 0;
309
+ const firstBoundaryStart = sectionBoundaries.length > 0 ? Math.min(...sectionBoundaries.map(b => b.start)) : 0;
310
+ const sectionComments = comments.filter((c) => {
311
+ const anchorData = anchors.get(c.id);
312
+ if (!anchorData)
313
+ return false;
314
+ // Use exact position - no scaling needed since both are in xmlDocText coordinates
315
+ if (anchorData.docPosition !== undefined && boundary) {
316
+ // Include comments within section boundaries
317
+ if (anchorData.docPosition >= boundary.start && anchorData.docPosition < boundary.end) {
318
+ return true;
319
+ }
320
+ // Also include "outside" comments (before first section) in the first section file
321
+ if (isFirstSection && anchorData.docPosition < firstBoundaryStart) {
322
+ return true;
323
+ }
324
+ }
325
+ return false;
326
+ });
327
+ if (process.env.DEBUG) {
328
+ console.log(`[DEBUG] ${section.file}: ${sectionComments.length} comments to place (boundary: ${boundary?.start}-${boundary?.end})`);
329
+ }
330
+ if (sectionComments.length > 0) {
331
+ // Use a more robust pattern that handles < in comment text
332
+ const commentPattern = /\{>>.*?<<\}/gs;
333
+ const beforeCount = (annotated.match(commentPattern) || []).length;
334
+ annotated = insertCommentsIntoMarkdown(annotated, sectionComments, anchors, {
335
+ quiet: !process.env.DEBUG,
336
+ sectionBoundary: boundary // Pass section boundary for position-based insertion
337
+ });
338
+ const afterCount = (annotated.match(commentPattern) || []).length;
339
+ commentsInserted = afterCount - beforeCount;
340
+ if (process.env.DEBUG) {
341
+ console.log(`[DEBUG] ${section.file}: inserted ${commentsInserted} of ${sectionComments.length} comments`);
342
+ }
343
+ if (commentsInserted > 0) {
344
+ stats.comments = (stats.comments || 0) + commentsInserted;
345
+ }
346
+ }
347
+ }
348
+ totalChanges += stats.total;
349
+ sectionResults.push({
350
+ file: section.file,
351
+ header: section.header,
352
+ status: 'ok',
353
+ stats,
354
+ refs: refConversions.length,
355
+ });
356
+ if (!options.dryRun) {
357
+ // Preserve any preamble content (YAML frontmatter, author blocks, metadata)
358
+ // that exists before the first heading in the original file.
359
+ // This content is never included in the Word build output, so it won't
360
+ // appear in the Word doc and would otherwise be lost during sync.
361
+ const originalContent = fs.readFileSync(sectionPath, 'utf-8');
362
+ const firstHeadingMatch = originalContent.match(/^(#\s)/m);
363
+ if (firstHeadingMatch && firstHeadingMatch.index !== undefined && firstHeadingMatch.index > 0) {
364
+ const preamble = originalContent.slice(0, firstHeadingMatch.index);
365
+ // Only prepend if preamble has non-whitespace content
366
+ if (preamble.trim().length > 0) {
367
+ annotated = preamble + annotated;
368
+ }
369
+ }
370
+ fs.writeFileSync(sectionPath, annotated, 'utf-8');
371
+ }
372
+ }
373
+ const tableRows = sectionResults.map((r) => {
374
+ if (r.status === 'skipped') {
375
+ return [
376
+ chalk.dim(r.file),
377
+ chalk.dim(r.header.slice(0, 25)),
378
+ chalk.yellow('skipped'),
379
+ '',
380
+ '',
381
+ '',
382
+ '',
383
+ ];
384
+ }
385
+ const s = r.stats;
386
+ return [
387
+ chalk.bold(r.file),
388
+ r.header.length > 25 ? r.header.slice(0, 22) + '...' : r.header,
389
+ s.insertions > 0 ? chalk.green(`+${s.insertions}`) : chalk.dim('-'),
390
+ s.deletions > 0 ? chalk.red(`-${s.deletions}`) : chalk.dim('-'),
391
+ s.substitutions > 0 ? chalk.yellow(`~${s.substitutions}`) : chalk.dim('-'),
392
+ s.comments > 0 ? chalk.blue(`#${s.comments}`) : chalk.dim('-'),
393
+ r.refs > 0 ? chalk.magenta(`@${r.refs}`) : chalk.dim('-'),
394
+ ];
395
+ });
396
+ console.log(fmt.table(['File', 'Section', 'Ins', 'Del', 'Sub', 'Cmt', 'Ref'], tableRows, { align: ['left', 'left', 'right', 'right', 'right', 'right', 'right'] }));
397
+ console.log();
398
+ if (options.diff !== false && totalChanges > 0) {
399
+ console.log(fmt.header('Changes Preview'));
400
+ console.log();
401
+ for (const result of sectionResults) {
402
+ if (result.status === 'ok' && result.stats && result.stats.total > 0) {
403
+ const sectionPath = path.join(options.dir, result.file);
404
+ if (fs.existsSync(sectionPath)) {
405
+ const content = fs.readFileSync(sectionPath, 'utf-8');
406
+ const preview = inlineDiffPreview(content, { maxLines: 3 });
407
+ if (preview) {
408
+ console.log(chalk.bold(result.file) + ':');
409
+ console.log(preview);
410
+ console.log();
411
+ }
412
+ }
413
+ }
414
+ }
415
+ }
416
+ if (options.dryRun) {
417
+ console.log(fmt.box(chalk.yellow('Dry run - no files written'), { padding: 0 }));
418
+ }
419
+ else if (totalChanges > 0 || totalRefConversions > 0 || comments.length > 0) {
420
+ const summaryLines = [];
421
+ summaryLines.push(`${chalk.bold(wordSections.length)} sections processed`);
422
+ if (totalChanges > 0)
423
+ summaryLines.push(`${chalk.bold(totalChanges)} annotations imported`);
424
+ if (comments.length > 0)
425
+ summaryLines.push(`${chalk.bold(comments.length)} comments placed`);
426
+ if (totalRefConversions > 0)
427
+ summaryLines.push(`${chalk.bold(totalRefConversions)} refs converted to @-syntax`);
428
+ console.log(fmt.box(summaryLines.join('\n'), { title: 'Summary', padding: 0 }));
429
+ console.log();
430
+ console.log(chalk.dim('Next steps:'));
431
+ console.log(chalk.dim(' 1. rev review <section.md> - Accept/reject changes'));
432
+ console.log(chalk.dim(' 2. rev comments <section.md> - View/address comments'));
433
+ console.log(chalk.dim(' 3. rev build docx - Rebuild Word doc'));
434
+ }
435
+ else {
436
+ console.log(fmt.status('success', 'No changes detected.'));
437
+ }
438
+ }
439
+ catch (err) {
440
+ spin.stop();
441
+ const error = err;
442
+ console.error(fmt.status('error', error.message));
443
+ if (process.env.DEBUG)
444
+ console.error(error.stack);
445
+ process.exit(1);
446
+ }
447
+ });
448
+ }
449
+ /**
450
+ * `sync --comments-only`: import only Word comments at fuzzy-matched anchors.
451
+ *
452
+ * Skips the Word→Markdown diff entirely (no track changes, no pandoc, no
453
+ * prose modifications). Useful when the markdown has been edited after the
454
+ * docx was sent for review — applying track changes from a stale draft
455
+ * would overwrite newer edits.
456
+ */
457
+ async function syncCommentsOnly(docx, sectionFilter, options, configPath) {
458
+ const config = loadConfig(configPath);
459
+ const { extractWordComments, extractCommentAnchors, extractHeadings, insertCommentsIntoMarkdown } = await import('../import.js');
460
+ const { computeSectionBoundaries } = await import('./section-boundaries.js');
461
+ const spin = fmt.spinner(`Reading comments from ${path.basename(docx)}...`).start();
462
+ let comments;
463
+ let anchors;
464
+ let headings;
465
+ try {
466
+ comments = await extractWordComments(docx);
467
+ const result = await extractCommentAnchors(docx);
468
+ anchors = result.anchors;
469
+ headings = await extractHeadings(docx);
470
+ spin.stop();
471
+ }
472
+ catch (err) {
473
+ spin.stop();
474
+ const error = err;
475
+ console.error(fmt.status('error', error.message));
476
+ process.exit(1);
477
+ }
478
+ console.log(fmt.header(`Comments from ${path.basename(docx)} (comments-only)`));
479
+ console.log();
480
+ if (comments.length === 0) {
481
+ console.log(fmt.status('info', 'No comments found in document.'));
482
+ return;
483
+ }
484
+ const boundaries = computeSectionBoundaries(config.sections, headings);
485
+ if (boundaries.length === 0) {
486
+ console.error(fmt.status('warning', 'No section headings detected in Word document.'));
487
+ console.error(chalk.dim(' Check that headers in sections.yaml match heading paragraphs in the docx.'));
488
+ process.exit(1);
489
+ }
490
+ // Apply optional section filter from CLI
491
+ let activeBoundaries = boundaries;
492
+ if (sectionFilter && sectionFilter.length > 0) {
493
+ const wanted = sectionFilter.map(s => s.trim().toLowerCase());
494
+ activeBoundaries = boundaries.filter(b => {
495
+ const base = b.file.replace(/\.md$/i, '').toLowerCase();
496
+ return wanted.some(name => base === name || base.includes(name));
497
+ });
498
+ if (activeBoundaries.length === 0) {
499
+ console.error(fmt.status('error', `No sections matched: ${sectionFilter.join(', ')}`));
500
+ process.exit(1);
501
+ }
502
+ }
503
+ const firstBoundaryStart = boundaries[0].start;
504
+ const results = [];
505
+ for (const boundary of activeBoundaries) {
506
+ const sectionPath = path.join(options.dir, boundary.file);
507
+ if (!fs.existsSync(sectionPath)) {
508
+ results.push({ file: boundary.file, placed: 0, unmatched: 0, skipped: true });
509
+ continue;
510
+ }
511
+ const isFirstSection = boundary === activeBoundaries[0];
512
+ const sectionComments = comments.filter((c) => {
513
+ const anchor = anchors.get(c.id);
514
+ if (!anchor || anchor.docPosition === undefined)
515
+ return false;
516
+ if (anchor.docPosition >= boundary.start && anchor.docPosition < boundary.end)
517
+ return true;
518
+ // Comments before the first heading land in the first matched section
519
+ if (isFirstSection && anchor.docPosition < firstBoundaryStart)
520
+ return true;
521
+ return false;
522
+ });
523
+ if (sectionComments.length === 0) {
524
+ results.push({ file: boundary.file, placed: 0, unmatched: 0, skipped: false });
525
+ continue;
526
+ }
527
+ const original = fs.readFileSync(sectionPath, 'utf-8');
528
+ const commentPattern = /\{>>.*?<<\}/gs;
529
+ const beforeCount = (original.match(commentPattern) || []).length;
530
+ const annotated = insertCommentsIntoMarkdown(original, sectionComments, anchors, {
531
+ quiet: !process.env.DEBUG,
532
+ sectionBoundary: { start: boundary.start, end: boundary.end },
533
+ wrapAnchor: false,
534
+ });
535
+ const afterCount = (annotated.match(commentPattern) || []).length;
536
+ const placed = afterCount - beforeCount;
537
+ const unmatched = sectionComments.length - placed;
538
+ if (!options.dryRun && placed > 0) {
539
+ fs.writeFileSync(sectionPath, annotated, 'utf-8');
540
+ }
541
+ results.push({ file: boundary.file, placed, unmatched, skipped: false });
542
+ }
543
+ const tableRows = results.map(r => {
544
+ if (r.skipped) {
545
+ return [chalk.dim(r.file), chalk.yellow('missing'), '', ''];
546
+ }
547
+ return [
548
+ chalk.bold(r.file),
549
+ chalk.green(`${r.placed}`),
550
+ r.unmatched > 0 ? chalk.yellow(`${r.unmatched}`) : chalk.dim('-'),
551
+ chalk.dim('comments only'),
552
+ ];
553
+ });
554
+ console.log(fmt.table(['File', 'Placed', 'Unmatched', 'Mode'], tableRows, { align: ['left', 'right', 'right', 'left'] }));
555
+ console.log();
556
+ const totalPlaced = results.reduce((s, r) => s + r.placed, 0);
557
+ const totalUnmatched = results.reduce((s, r) => s + r.unmatched, 0);
558
+ const lines = [];
559
+ lines.push(`${chalk.bold(comments.length)} comments in document`);
560
+ lines.push(`${chalk.bold(totalPlaced)} placed at fuzzy-matched anchors`);
561
+ if (totalUnmatched > 0) {
562
+ lines.push(`${chalk.yellow(totalUnmatched)} unmatched (no anchor in current prose)`);
563
+ }
564
+ if (options.dryRun) {
565
+ lines.push(chalk.yellow('Dry run — no files written'));
566
+ }
567
+ else if (totalPlaced > 0) {
568
+ lines.push(chalk.dim('Existing prose unchanged.'));
569
+ }
570
+ console.log(fmt.box(lines.join('\n'), { title: 'Summary', padding: 0 }));
571
+ if (totalUnmatched > 0) {
572
+ console.log();
573
+ console.log(chalk.dim('Tip: run "rev verify-anchors" to see which comments drifted.'));
574
+ }
575
+ }
576
+ //# s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C;IAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAClE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAC;IACzE,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,yCAAyC,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACzD,CAAC;SAAM,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAEzE,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Text operation commands: spelling, batch
3
+ *
4
+ * Commands for spelling checks and batch operations on markdown files.
5
+ */
6
+ import type { Command } from 'commander';
7
+ /**
8
+ * Register text-ops commands with the program
9
+ */
10
+ export declare function register(program: Command): void;
11
+ //# sourceMappingURL=text-ops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-ops.d.ts","sourceRoot":"","sources":["../../../lib/commands/text-ops.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8DzC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyX/C"}