@imenam/mcp-documentor 1.0.58 → 1.0.59

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
@@ -8,6 +8,7 @@ Connect it to Cursor, Claude Desktop, or any MCP-compatible agent to let your AI
8
8
 
9
9
  - **Create & update docs** — write markdown documentation entries linked to source files; prefer partial edits via `patch_doc`
10
10
  - **Staleness tracking** — automatically detects when tracked files have changed since the last doc update
11
+ - **Portable code references** — tracked-file paths are stored relative to a configurable code root (`MCP_DOCUMENTOR_CODE_ROOT`), so synced docs resolve their source files on any machine regardless of where the repos live
11
12
  - **Semantic search** — find relevant docs by meaning (requires an OpenAI API key)
12
13
  - **Multi-project support** — organize docs into separate projects; MCP tools work across projects; `set_project` only changes what the GUI shows
13
14
  - **GUI** — built-in web interface when a proxy is configured (`PROXY_URL`); without it, the GUI worker is not started
@@ -32,6 +33,7 @@ Global install exposes:
32
33
 
33
34
  - `mcp-documentor` — MCP server
34
35
  - `mcp-documentor-migrate` — CLI helper for migrating inline doc links (see `scripts/migrate-links.js`)
36
+ - `mcp-documentor-migrate-paths` — one-shot migration of tracked-file paths from absolute to code-root-relative (see [Portable tracked-file paths](#portable-tracked-file-paths))
35
37
 
36
38
  ## MCP Configuration
37
39
 
@@ -59,9 +61,11 @@ Add to your MCP client config (e.g. Cursor `mcp.json`):
59
61
  | `MCP_DOCUMENTOR_OPENAI_MODEL` | No | Embedding model (default: `text-embedding-3-small`) |
60
62
  | `PROXY_URL` | No | URL of the proxy server to register and launch the GUI |
61
63
  | `MCP_DATA_DIR` | No | Overrides the default data directory (see Data storage) |
64
+ | `MCP_DOCUMENTOR_CODE_ROOT` | No | Base directory that tracked-file paths are stored relative to, keeping docs portable across machines (see [Portable tracked-file paths](#portable-tracked-file-paths)) |
65
+ | `MCP_DOCUMENTOR_CODE_ROOTS` | No | JSON map of per-project code-root overrides, e.g. `{"my-proj":"/srv/my-proj"}` |
62
66
  | `READ_ONLY` | No | When set to `1`/`true`/`yes`, disables all create/update/delete tools and GUI write actions (read-only mode) |
63
67
  | `MCP_DOCUMENTOR_SYNC_REMOTE` | No | HTTPS URL of the private GitHub repo to sync with; enables GitHub sync when set |
64
- | `MCP_DOCUMENTOR_SYNC_BRANCH` | No | Branch to sync (default: `main`) |
68
+ | `MCP_DOCUMENTOR_SYNC_BRANCH` | No | Branch of the documentation sync repo to push/pull docs on (default: `main`) |
65
69
  | `MCP_DOCUMENTOR_SYNC_TOKEN` | No | Fine-grained GitHub PAT used for HTTPS auth (see GitHub sync) |
66
70
  | `SYNC_PULL_ON_START` | No | Set to `false` to disable the automatic pull at server startup |
67
71
 
@@ -148,7 +152,7 @@ The sync target is **administrator-controlled**: the repository, branch and toke
148
152
  "args": ["-y", "@imenam/mcp-documentor"],
149
153
  "env": {
150
154
  "MCP_DOCUMENTOR_SYNC_REMOTE": "https://github.com/<you>/my-docs.git",
151
- "MCP_DOCUMENTOR_SYNC_BRANCH": "main", // optional, defaults to "main"
155
+ "MCP_DOCUMENTOR_SYNC_BRANCH": "main", // branch of the docs sync repo, optional, defaults to "main"
152
156
  "MCP_DOCUMENTOR_SYNC_TOKEN": "github_pat_..."
153
157
  }
154
158
  }
@@ -177,6 +181,50 @@ then run `push_docs` to publish the resolution. If you have **uncommitted** loca
177
181
 
178
182
  > Read-only machines (`READ_ONLY=1`) can still `pull_docs` and `sync_status`, but `push_docs`, `sync_docs`, and `resolve_sync_conflict` are disabled.
179
183
 
184
+ ## Portable tracked-file paths
185
+
186
+ When docs are synced across machines, absolute tracked-file paths break: the codebase rarely lives at the same absolute location everywhere. To stay portable, tracked-file paths are stored **relative to a configurable code root** and resolved back to absolute paths on demand.
187
+
188
+ Agents keep passing **absolute** paths to `create_doc` / `update_doc` (and in `[copy-from-codebase|…]` tags) as usual — the conversion to a stored relative path happens automatically server-side. No change in how the agent works.
189
+
190
+ ### Configuration
191
+
192
+ Set the code root per machine (it is machine-local, so it lives in the environment, never in the synced data):
193
+
194
+ ```jsonc
195
+ {
196
+ "env": {
197
+ "MCP_DOCUMENTOR_CODE_ROOT": "/home/you/code/repos",
198
+ // optional per-project overrides when repos don't share a common parent:
199
+ "MCP_DOCUMENTOR_CODE_ROOTS": "{\"my-proj\":\"/srv/my-proj\"}"
200
+ }
201
+ }
202
+ ```
203
+
204
+ Resolution precedence: `MCP_DOCUMENTOR_CODE_ROOTS[project]` → `MCP_DOCUMENTOR_CODE_ROOT` → none.
205
+
206
+ | Stored path | On read |
207
+ |---|---|
208
+ | Relative + code root configured | resolved against the root |
209
+ | Relative + **no** root on this machine | reported as `unverifiable` (source absent) instead of a false `stale` |
210
+ | Absolute (legacy, or file outside the root) | used as-is |
211
+
212
+ The feature is **opt-in**: with no code root configured, behaviour is unchanged (paths stored and resolved as absolute).
213
+
214
+ ### Migrating existing docs
215
+
216
+ Docs created before this feature store absolute paths. Convert them in one shot with the bundled `mcp-documentor-migrate-paths`:
217
+
218
+ ```bash
219
+ MCP_DOCUMENTOR_CODE_ROOT="/home/you/code/repos" \
220
+ MCP_DATA_DIR="/path/to/your/data" \
221
+ npx -p @imenam/mcp-documentor mcp-documentor-migrate-paths --dry-run
222
+ ```
223
+
224
+ Review the report (`converted` / `kept absolute (outside root)` / `projects skipped`), then re-run without `--dry-run`. Finally publish with `sync_docs` (never commit the data dir by hand). The data dir is resolved like the server: `--data-dir` flag → `MCP_DATA_DIR` → package-relative fallback.
225
+
226
+ This is a **one-time** operation, and must run on the machine whose OS/filesystem **created** the stored absolute paths (path semantics differ between Windows and POSIX). Once migrated and synced, every other machine just `pull_docs` and sets its own `MCP_DOCUMENTOR_CODE_ROOT` — no migration needed.
227
+
180
228
  ## Data Storage
181
229
 
182
230
  By default, data lives under **`.docs-data`** next to the resolved package root (the folder that contains `package.json` for the running install). Set **`MCP_DATA_DIR`** to use another directory. Contents include projects, SQLite/embeddings, and logs under `.docs-data/logs`. This tree is **not** part of the npm package; it is created at runtime.
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.58";
1
+ export declare const APP_VERSION = "1.0.59";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.58';
2
+ export const APP_VERSION = '1.0.59';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imenam/mcp-documentor",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "main": "dist/src/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",