docs(mcp-sync): the alt config file is written when it parses (#599 merge-time fix)

Three comments said `altPath` is never written, but run() makes the alt file
the write target when the primary is absent. The behaviour is fine (a JSONC
file with comments fails the parse guard and is never written); the
comments now say so, so nobody loosens the path rule on that belief.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-13 18:28:34 +02:00
1 parent 1f41eacd87
commit 82d588a339
2 files changed
+8 -3

No files matched your search

+2 -1
View File
@@ -453,7 +453,8 @@ const capabilitiesSchema = z
.object({ .object({
// Home-relative, no traversal: sync writes to this path. // Home-relative, no traversal: sync writes to this path.
path: mcpRelativePath, path: mcpRelativePath,
// Home-relative fallback read when `path` is absent (never written). // Home-relative fallback used when `path` is absent. Same no-traversal rule as `path`:
// sync reads it and, when it parses as plain JSON, writes to it.
altPath: mcpRelativePath.optional(), altPath: mcpRelativePath.optional(),
// Every value must be a known McpConfigFormat (types.ts); mcp-sync.ts's dialect table is // Every value must be a known McpConfigFormat (types.ts); mcp-sync.ts's dialect table is
// keyed by the same type, so an adapter-less format fails to compile there. // keyed by the same type, so an adapter-less format fails to compile there.
+6 -2
View File
@@ -66,7 +66,10 @@ export interface McpSyncTarget {
label: string; label: string;
/** Home-relative default location of the config file. */ /** Home-relative default location of the config file. */
path: string; path: string;
/** Home-relative fallback file read when `path` is absent (never written). */ /**
* Home-relative fallback file used when `path` is absent: read, and written in place when it
* parses (a JSONC file with comments fails the parse and is never written).
*/
altPath?: string; altPath?: string;
format: McpFormat; format: McpFormat;
/** The env var the CLI reads to move the file, and the path under it (`mcpConfig.relocation`). */ /** The env var the CLI reads to move the file, and the path under it (`mcpConfig.relocation`). */
@@ -612,7 +615,8 @@ function resolveFile(
/** /**
* The alternate config file for a target (`McpSyncTarget.altPath`), honouring the same relocation * The alternate config file for a target (`McpSyncTarget.altPath`), honouring the same relocation
* as the primary file: the alt lives in the same directory, so the relocated path is the primary's * as the primary file: the alt lives in the same directory, so the relocated path is the primary's
* directory plus the alt filename. Like the primary, it is only ever read, never written. * directory plus the alt filename. Once chosen it is read and written exactly like the primary; a
* JSONC file with comments fails the parse guard and is never written.
*/ */
function resolveAltFile( function resolveAltFile(
t: McpSyncTarget, t: McpSyncTarget,