@imenam/mcp-documentor 1.0.90 → 1.0.91

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.
package/README.md CHANGED
@@ -127,7 +127,7 @@ that work on a whole project (`list_docs`, `get_doc_tree`, `check_freshness` wit
127
127
  | `search_docs` | Semantic search over docs (natural language; requires OpenAI) |
128
128
  | `check_freshness` | Staleness for one doc (`project` required) or a full project scan |
129
129
  | `refresh_file_snapshot` | Mark tracked files as up-to-date without editing the doc (`project` required) |
130
- | `git_diff_doc` | Diff of changed tracked files between their snapshot content and the current one (`project` required) |
130
+ | `git_diff_doc` | Diff of changed tracked files between their snapshot content and the current one (`project` required). Files whose tracked sections can no longer be located (anchors lost) are included and diffed whole, with a warning |
131
131
  | `check_links` | Validate `related_docs`, `doc://` links, and `#heading` anchors (`project` required) |
132
132
  | `list_projects` | List all documentation projects |
133
133
  | `upload_image` | Upload an image from a local file path to a project's assets (`project` required); returns the markdown link to insert |
@@ -18,6 +18,8 @@ export async function getDocMetadata(storageEngine, args) {
18
18
  return "✗ modified";
19
19
  if (report.missing.includes(filePath))
20
20
  return "✗ missing";
21
+ if (report.anchors_lost.includes(filePath))
22
+ return "⚠ anchors lost (re-declare the sections via update_doc)";
21
23
  return "✓ up to date";
22
24
  };
23
25
  let text = `**Path:** ${doc.id}\n`;
@@ -163,15 +163,16 @@ export async function gitDiffDoc(storageEngine, args) {
163
163
  docSections.push(`## ${doc.title}\n\n[INFO] No tracked files.`);
164
164
  continue;
165
165
  }
166
+ const freshness = await computeFreshness(doc.tracked_files, project);
167
+ const anchorsLost = new Set(freshness.anchors_lost);
166
168
  let filesToDiff;
167
169
  if (wanted) {
168
170
  filesToDiff = doc.tracked_files.filter((tf) => wanted.has(tf.path));
169
171
  }
170
172
  else {
171
- const freshness = await computeFreshness(doc.tracked_files, project);
172
- // Broken entries (no snapshot) can't be hash-compared, but the git diff
173
- // is still the best signal the agent has to re-assess them — include them.
174
- const changedPaths = new Set([...freshness.modified, ...freshness.missing, ...freshness.broken]);
173
+ // Broken entries (no snapshot) and files whose sections can no longer be located can't be
174
+ // hash-compared, but the whole-file diff is the best signal the agent has to re-assess them.
175
+ const changedPaths = new Set([...freshness.modified, ...freshness.missing, ...freshness.broken, ...anchorsLost]);
175
176
  filesToDiff = doc.tracked_files.filter((tf) => changedPaths.has(tf.path));
176
177
  }
177
178
  if (filesToDiff.length === 0) {
@@ -194,7 +195,11 @@ export async function gitDiffDoc(storageEngine, args) {
194
195
  const diffs = await mapWithConcurrency(fresh, FILE_CONCURRENCY, (tf) => diffTrackedFile(tf, project, source));
195
196
  const fileSections = fresh.map((tf, i) => {
196
197
  const base = tf.sourceRevision ? `\nSnapshot commit: ${short(tf.sourceRevision)}` : "";
197
- return `### ${tf.path}\nSnapshot date: ${tf.lastModifiedAt}${base}\n\n${diffs[i]}`;
198
+ const anchorsNote = anchorsLost.has(tf.path)
199
+ ? ` [WARN] Anchors lost: the tracked section(s) can no longer be located, so the whole file is diffed.\n` +
200
+ ` → Re-declare the sections in tracked_files via update_doc.\n\n`
201
+ : "";
202
+ return `### ${tf.path}\nSnapshot date: ${tf.lastModifiedAt}${base}\n\n${anchorsNote}${diffs[i]}`;
198
203
  });
199
204
  docSections.push(`## ${doc.title} [${docPath}]\n\nCode source: ${source.label}\n\n${fileSections.join("\n\n---\n\n")}`);
200
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imenam/mcp-documentor",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "main": "dist/src/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",