@hanna84/mcp-writing 2.10.5 → 2.10.6
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/CHANGELOG.md +10 -0
- package/index.js +11 -72
- package/package.json +2 -1
- package/runtime-diagnostics.js +97 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v2.10.6](https://github.com/hannasdev/mcp-writing.git
|
|
8
|
+
/compare/v2.10.5...v2.10.6)
|
|
9
|
+
|
|
10
|
+
- refactor(index): extract getRuntimeDiagnostics into runtime-diagnostics.js [`#110`](https://github.com/hannasdev/mcp-writing.git
|
|
11
|
+
/pull/110)
|
|
12
|
+
|
|
7
13
|
#### [v2.10.5](https://github.com/hannasdev/mcp-writing.git
|
|
8
14
|
/compare/v2.10.4...v2.10.5)
|
|
9
15
|
|
|
16
|
+
> 27 April 2026
|
|
17
|
+
|
|
10
18
|
- refactor(index): extract workflow catalogue module [`#109`](https://github.com/hannasdev/mcp-writing.git
|
|
11
19
|
/pull/109)
|
|
20
|
+
- Release 2.10.5 [`bee9b2b`](https://github.com/hannasdev/mcp-writing.git
|
|
21
|
+
/commit/bee9b2bee5992cfc69571d95ab1dc281d89d8812)
|
|
12
22
|
|
|
13
23
|
#### [v2.10.4](https://github.com/hannasdev/mcp-writing.git
|
|
14
24
|
/compare/v2.10.3...v2.10.4)
|
package/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { registerReviewBundleTools } from "./tools/review-bundles.js";
|
|
|
26
26
|
import { registerStyleguideTools } from "./tools/styleguide.js";
|
|
27
27
|
import { registerEditingTools } from "./tools/editing.js";
|
|
28
28
|
import { WORKFLOW_CATALOGUE } from "./workflow-catalogue.js";
|
|
29
|
+
import { getRuntimeDiagnostics } from "./runtime-diagnostics.js";
|
|
29
30
|
|
|
30
31
|
const SYNC_DIR = process.env.WRITING_SYNC_DIR ?? "./sync";
|
|
31
32
|
const DB_PATH = process.env.DB_PATH ?? "./writing.db";
|
|
@@ -200,78 +201,16 @@ function generateProposalId() {
|
|
|
200
201
|
return `proposal-${randomUUID()}`;
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (SYNC_OWNERSHIP_DIAGNOSTICS.runtime_uid_override_ignored) {
|
|
215
|
-
warnings.push("RUNTIME_UID_OVERRIDE_IGNORED: RUNTIME_UID_OVERRIDE is ignored unless NODE_ENV=test or ALLOW_RUNTIME_UID_OVERRIDE=1.");
|
|
216
|
-
recommendations.push("Avoid RUNTIME_UID_OVERRIDE in production runtime environments.");
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (SYNC_OWNERSHIP_DIAGNOSTICS.runtime_uid_override_invalid) {
|
|
220
|
-
warnings.push("RUNTIME_UID_OVERRIDE_INVALID: RUNTIME_UID_OVERRIDE must be a non-negative integer when enabled.");
|
|
221
|
-
recommendations.push("Set RUNTIME_UID_OVERRIDE to a non-negative integer, or unset it.");
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (!SYNC_DIR_WRITABLE) {
|
|
225
|
-
warnings.push("SYNC_DIR_READ_ONLY: sync dir is read-only; metadata write-back and prose editing tools are unavailable.");
|
|
226
|
-
recommendations.push("Mount WRITING_SYNC_DIR with write access (avoid read-only mounts like ':ro').");
|
|
227
|
-
recommendations.push("If running in Docker/OpenClaw, verify volume ownership and permissions for the container user.");
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (SYNC_OWNERSHIP_DIAGNOSTICS.supported && SYNC_OWNERSHIP_DIAGNOSTICS.non_runtime_owned_paths > 0) {
|
|
231
|
-
warnings.push(
|
|
232
|
-
`OWNERSHIP_MISMATCH: ${SYNC_OWNERSHIP_DIAGNOSTICS.non_runtime_owned_paths} sampled path(s) are not owned by runtime UID ${SYNC_OWNERSHIP_DIAGNOSTICS.runtime_uid}.`
|
|
233
|
-
);
|
|
234
|
-
recommendations.push(
|
|
235
|
-
`Repair ownership once on host: sudo chown -R "$(id -u):$(id -g)" "${SYNC_DIR_ABS}"`
|
|
236
|
-
);
|
|
237
|
-
recommendations.push(
|
|
238
|
-
"For Docker/OpenClaw, run container as host user (compose: user: \"${OPENCLAW_UID:-1000}:${OPENCLAW_GID:-1000}\")."
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (OWNERSHIP_GUARD_MODE === "fail" && SYNC_OWNERSHIP_DIAGNOSTICS.runtime_uid === 0) {
|
|
243
|
-
warnings.push(
|
|
244
|
-
"OWNERSHIP_GUARD_SKIPPED_FOR_ROOT: OWNERSHIP_GUARD_MODE=fail is skipped because runtime UID is 0 (root)."
|
|
245
|
-
);
|
|
246
|
-
recommendations.push("Prefer running as a non-root host-mapped UID/GID to make ownership guard checks meaningful.");
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (SYNC_OWNERSHIP_DIAGNOSTICS.supported && SYNC_OWNERSHIP_DIAGNOSTICS.root_owned_paths > 0) {
|
|
250
|
-
warnings.push(
|
|
251
|
-
`ROOT_OWNED_PATHS: ${SYNC_OWNERSHIP_DIAGNOSTICS.root_owned_paths} sampled path(s) are owned by UID 0 (root).`
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (!GIT_AVAILABLE) {
|
|
256
|
-
warnings.push("GIT_NOT_FOUND: git is not available on PATH; snapshot/edit tools are unavailable.");
|
|
257
|
-
recommendations.push("Install git in the runtime image/environment.");
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (GIT_AVAILABLE && SYNC_DIR_WRITABLE && !GIT_ENABLED) {
|
|
261
|
-
warnings.push("GIT_DISABLED: git is available but repository snapshot tools are not active.");
|
|
262
|
-
recommendations.push("Ensure WRITING_SYNC_DIR points to a writable git repository root, or allow mcp-writing to initialize one.");
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (GIT_AVAILABLE && !SYNC_DIR_WRITABLE) {
|
|
266
|
-
recommendations.push("If git reports 'dubious ownership' for mounted repos, add: git config --system --add safe.directory /sync");
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
recommendations.push("If indexing finds many files without scene_id, run scripts/import.js first for Scrivener Draft exports, then run sync.");
|
|
270
|
-
|
|
271
|
-
return { warnings, recommendations };
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const RUNTIME_DIAGNOSTICS = getRuntimeDiagnostics();
|
|
204
|
+
const RUNTIME_DIAGNOSTICS = getRuntimeDiagnostics({
|
|
205
|
+
ownershipGuardModeRaw: OWNERSHIP_GUARD_MODE_RAW,
|
|
206
|
+
ownershipGuardMode: OWNERSHIP_GUARD_MODE,
|
|
207
|
+
ownershipGuardModeRawDisplay: OWNERSHIP_GUARD_MODE_RAW_DISPLAY,
|
|
208
|
+
syncDirWritable: SYNC_DIR_WRITABLE,
|
|
209
|
+
syncDirAbs: SYNC_DIR_ABS,
|
|
210
|
+
syncOwnershipDiagnostics: SYNC_OWNERSHIP_DIAGNOSTICS,
|
|
211
|
+
gitAvailable: GIT_AVAILABLE,
|
|
212
|
+
gitEnabled: GIT_ENABLED,
|
|
213
|
+
});
|
|
275
214
|
if (RUNTIME_DIAGNOSTICS.warnings.length) {
|
|
276
215
|
process.stderr.write(`[mcp-writing] Runtime diagnostics:\n`);
|
|
277
216
|
for (const line of RUNTIME_DIAGNOSTICS.warnings) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanna84/mcp-writing",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
4
4
|
"description": "MCP service for AI-assisted reasoning and editing on long-form fiction projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"git.js",
|
|
18
18
|
"world-entity-templates.js",
|
|
19
19
|
"workflow-catalogue.js",
|
|
20
|
+
"runtime-diagnostics.js",
|
|
20
21
|
"metadata-lint.js",
|
|
21
22
|
"scene-character-normalization.js",
|
|
22
23
|
"review-bundles.js",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getRuntimeDiagnostics
|
|
3
|
+
*
|
|
4
|
+
* Inspects the startup environment and returns { warnings, recommendations }.
|
|
5
|
+
* All inputs are passed explicitly so this module has no side effects and
|
|
6
|
+
* is straightforward to test.
|
|
7
|
+
*
|
|
8
|
+
* @param {object} opts
|
|
9
|
+
* @param {string} opts.ownershipGuardModeRaw Raw env value before normalisation
|
|
10
|
+
* @param {string} opts.ownershipGuardMode Normalised value ("warn" | "fail")
|
|
11
|
+
* @param {string} opts.ownershipGuardModeRawDisplay JSON.stringify of the raw value
|
|
12
|
+
* @param {boolean} opts.syncDirWritable
|
|
13
|
+
* @param {string} opts.syncDirAbs Resolved absolute path shown in messages
|
|
14
|
+
* @param {object} opts.syncOwnershipDiagnostics Result of getSyncOwnershipDiagnostics()
|
|
15
|
+
* @param {boolean} opts.gitAvailable
|
|
16
|
+
* @param {boolean} opts.gitEnabled
|
|
17
|
+
* @returns {{ warnings: string[], recommendations: string[] }}
|
|
18
|
+
*/
|
|
19
|
+
export function getRuntimeDiagnostics({
|
|
20
|
+
ownershipGuardModeRaw,
|
|
21
|
+
ownershipGuardMode,
|
|
22
|
+
ownershipGuardModeRawDisplay,
|
|
23
|
+
syncDirWritable,
|
|
24
|
+
syncDirAbs,
|
|
25
|
+
syncOwnershipDiagnostics,
|
|
26
|
+
gitAvailable,
|
|
27
|
+
gitEnabled,
|
|
28
|
+
}) {
|
|
29
|
+
const warnings = [];
|
|
30
|
+
const recommendations = [];
|
|
31
|
+
|
|
32
|
+
if (ownershipGuardModeRaw !== ownershipGuardMode) {
|
|
33
|
+
warnings.push(
|
|
34
|
+
`OWNERSHIP_GUARD_MODE_INVALID: Unsupported OWNERSHIP_GUARD_MODE=${ownershipGuardModeRawDisplay}. Falling back to 'warn'.`
|
|
35
|
+
);
|
|
36
|
+
recommendations.push("Set OWNERSHIP_GUARD_MODE to either 'warn' or 'fail'.");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (syncOwnershipDiagnostics.runtime_uid_override_ignored) {
|
|
40
|
+
warnings.push("RUNTIME_UID_OVERRIDE_IGNORED: RUNTIME_UID_OVERRIDE is ignored unless NODE_ENV=test or ALLOW_RUNTIME_UID_OVERRIDE=1.");
|
|
41
|
+
recommendations.push("Avoid RUNTIME_UID_OVERRIDE in production runtime environments.");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (syncOwnershipDiagnostics.runtime_uid_override_invalid) {
|
|
45
|
+
warnings.push("RUNTIME_UID_OVERRIDE_INVALID: RUNTIME_UID_OVERRIDE must be a non-negative integer when enabled.");
|
|
46
|
+
recommendations.push("Set RUNTIME_UID_OVERRIDE to a non-negative integer, or unset it.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!syncDirWritable) {
|
|
50
|
+
warnings.push("SYNC_DIR_READ_ONLY: sync dir is read-only; metadata write-back and prose editing tools are unavailable.");
|
|
51
|
+
recommendations.push("Mount WRITING_SYNC_DIR with write access (avoid read-only mounts like ':ro').");
|
|
52
|
+
recommendations.push("If running in Docker/OpenClaw, verify volume ownership and permissions for the container user.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (syncOwnershipDiagnostics.supported && syncOwnershipDiagnostics.non_runtime_owned_paths > 0) {
|
|
56
|
+
warnings.push(
|
|
57
|
+
`OWNERSHIP_MISMATCH: ${syncOwnershipDiagnostics.non_runtime_owned_paths} sampled path(s) are not owned by runtime UID ${syncOwnershipDiagnostics.runtime_uid}.`
|
|
58
|
+
);
|
|
59
|
+
recommendations.push(
|
|
60
|
+
`Repair ownership once on host: sudo chown -R "$(id -u):$(id -g)" "${syncDirAbs}"`
|
|
61
|
+
);
|
|
62
|
+
recommendations.push(
|
|
63
|
+
"For Docker/OpenClaw, run container as host user (compose: user: \"${OPENCLAW_UID:-1000}:${OPENCLAW_GID:-1000}\")."
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (ownershipGuardMode === "fail" && syncOwnershipDiagnostics.runtime_uid === 0) {
|
|
68
|
+
warnings.push(
|
|
69
|
+
"OWNERSHIP_GUARD_SKIPPED_FOR_ROOT: OWNERSHIP_GUARD_MODE=fail is skipped because runtime UID is 0 (root)."
|
|
70
|
+
);
|
|
71
|
+
recommendations.push("Prefer running as a non-root host-mapped UID/GID to make ownership guard checks meaningful.");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (syncOwnershipDiagnostics.supported && syncOwnershipDiagnostics.root_owned_paths > 0) {
|
|
75
|
+
warnings.push(
|
|
76
|
+
`ROOT_OWNED_PATHS: ${syncOwnershipDiagnostics.root_owned_paths} sampled path(s) are owned by UID 0 (root).`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!gitAvailable) {
|
|
81
|
+
warnings.push("GIT_NOT_FOUND: git is not available on PATH; snapshot/edit tools are unavailable.");
|
|
82
|
+
recommendations.push("Install git in the runtime image/environment.");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (gitAvailable && syncDirWritable && !gitEnabled) {
|
|
86
|
+
warnings.push("GIT_DISABLED: git is available but repository snapshot tools are not active.");
|
|
87
|
+
recommendations.push("Ensure WRITING_SYNC_DIR points to a writable git repository root, or allow mcp-writing to initialize one.");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (gitAvailable && !syncDirWritable) {
|
|
91
|
+
recommendations.push("If git reports 'dubious ownership' for mounted repos, add: git config --system --add safe.directory /sync");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
recommendations.push("If indexing finds many files without scene_id, run scripts/import.js first for Scrivener Draft exports, then run sync.");
|
|
95
|
+
|
|
96
|
+
return { warnings, recommendations };
|
|
97
|
+
}
|