@beehexa/hexasync-template-assets 2610.4.7 → 2610.12.1

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/dist/index.d.ts CHANGED
@@ -7,5 +7,4 @@ export { assertInstalled, updateAssets, type ConfirmOverwrite, type OverwriteDif
7
7
  export type { FileReader } from './ports.js';
8
8
  export { COLLECTIONS, FILENAME_CONVENTION, MAX_COLLECTIONS_PER_FILE, declaredCollections, lintDocument, summariseLint, type Collection, type LintDiagnostic, type LintSummary, type Severity, } from './lint.js';
9
9
  export { checkEnvironment, formatEnvReport, type EnvItem, type EnvObservation, type EnvOutcome, type EnvReport, } from './env.js';
10
- export { MCP_CLIENTS, serverEntry, removeNativeClientEntry, VSCODE_NATIVE_CLIENT, LEGACY_SERVER_NAMES, type McpLaunch, SERVER_NAME, clientSnippet, mergeClientConfig, type McpClient, type MergeOutcome, } from './mcpClients.js';
11
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,MAAM,EACN,KAAK,SAAS,EACd,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW,EACX,WAAW,EACX,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,SAAS,EACd,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,MAAM,EACN,KAAK,SAAS,EACd,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -5,5 +5,4 @@ export { classifyTarget, summariseClassification, } from './classify.js';
5
5
  export { assertInstalled, updateAssets, } from './update.js';
6
6
  export { COLLECTIONS, FILENAME_CONVENTION, MAX_COLLECTIONS_PER_FILE, declaredCollections, lintDocument, summariseLint, } from './lint.js';
7
7
  export { checkEnvironment, formatEnvReport, } from './env.js';
8
- export { MCP_CLIENTS, serverEntry, removeNativeClientEntry, VSCODE_NATIVE_CLIENT, LEGACY_SERVER_NAMES, SERVER_NAME, clientSnippet, mergeClientConfig, } from './mcpClients.js';
9
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,MAAM,EAEN,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAMd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,uBAAuB,GAKxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,YAAY,GAMb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,aAAa,GAKd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,eAAe,GAKhB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW,EACX,WAAW,EACX,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EAEnB,WAAW,EACX,aAAa,EACb,iBAAiB,GAGlB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,MAAM,EAEN,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAMd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,uBAAuB,GAKxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,YAAY,GAMb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,aAAa,GAKd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,eAAe,GAKhB,MAAM,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beehexa/hexasync-template-assets",
3
- "version": "2610.4.7",
3
+ "version": "2610.12.1",
4
4
  "description": "Canonical intellisense asset installation. Pure core: ports in, no IO.",
5
5
  "license": "SEE LICENSE IN ../../LICENSE",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "main": "./dist/index.js",
21
21
  "types": "./dist/index.d.ts",
22
22
  "dependencies": {
23
- "@beehexa/hexasync-template-model": "2610.4.7"
23
+ "@beehexa/hexasync-template-model": "2610.12.1"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"
@@ -1,112 +0,0 @@
1
- /**
2
- * Writing an MCP server entry into each client's own configuration (Story 7.5).
3
- *
4
- * ### Why this is data, not four code paths
5
- *
6
- * Every client stores the same three facts — a name, a command, its arguments — under a different key, in a different
7
- * file, with a different nesting. Four bespoke writers would be four places to update when a fifth client appears, and
8
- * four chances for one of them to overwrite something. So a client is a **row**, and one merge serves all of them.
9
- *
10
- * ### Pure, so the decision is testable without a filesystem
11
- *
12
- * `mergeClientConfig` takes the existing file's text and returns the text to write. The caller does the reading and
13
- * writing. That is what makes AC-2 (*"those survive — the file is extended, never overwritten"*) and AC-4 (*"nothing
14
- * changes"*) assertable on strings rather than on a temp directory.
15
- */
16
- /** How one client stores MCP servers. */
17
- export interface McpClient {
18
- readonly id: string;
19
- readonly label: string;
20
- /** Project-scoped path, relative to the workspace root. `undefined` when the client is user-scoped only. */
21
- readonly file?: string;
22
- /** The property that holds the server map — clients disagree about this. */
23
- readonly key: string;
24
- }
25
- /**
26
- * The clients this writes for.
27
- *
28
- * ⚠️ `claude-desktop` has **no project-scoped file** — its configuration is user-scoped and lives outside any
29
- * workspace. Writing there would edit a file the user did not put under version control and did not ask us to touch, so
30
- * AC-3 prints a snippet instead. That is a deliberate refusal, not a gap.
31
- */
32
- export declare const MCP_CLIENTS: readonly McpClient[];
33
- /**
34
- * How a client should LAUNCH the server.
35
- *
36
- * ⛔ This was `{ command: 'hexasync', args: ['mcp'] } as const` — a fixed entry naming a global CLI. Three things
37
- * were wrong with it and the third is fatal: it required a separate install, it required that install to be on
38
- * `PATH`, and the CLI it names is being retired. A client configured from it would keep the entry long after the
39
- * command stopped existing, and MCP would fail with `ENOENT` rather than with anything a user could act on.
40
- *
41
- * So the entry is now COMPUTED from where the server actually is. The extension bundles it (`dist/mcp/server.js`)
42
- * and knows both its own path and the Node running it; nothing here has to guess, and nothing has to be installed.
43
- */
44
- export interface McpLaunch {
45
- readonly command: string;
46
- readonly args: readonly string[];
47
- }
48
- /** The entry every client gets — the same server, however each one spells the surrounding structure. */
49
- export declare function serverEntry(launch: McpLaunch): {
50
- command: string;
51
- args: string[];
52
- };
53
- /**
54
- * The key our entry occupies in a client's server map — CAP-8's `hexasync-template-ide`.
55
- *
56
- * ⛔ It was `'hexasync'`, which names the vendor rather than the product, and HexaSync ships sibling MCP servers.
57
- * Two of them configured in one client would have collided on a single key, silently overwriting each other.
58
- */
59
- export declare const SERVER_NAME = "hexasync-template-ide";
60
- /**
61
- * Every key this feature has ever written, newest first.
62
- *
63
- * Cleanup has to know the OLD name too: a workspace configured before the rename holds `hexasync`, and a cleanup
64
- * that only looked for the current name would leave exactly the duplicate it exists to remove.
65
- */
66
- export declare const LEGACY_SERVER_NAMES: readonly string[];
67
- /**
68
- * The VS Code client, kept ONLY so its previously-written entry can be removed.
69
- *
70
- * ⚠️ Deliberately not a member of `MCP_CLIENTS` — see the note there. Nothing writes this; `removeNativeClientEntry`
71
- * reads it to find the file to clean.
72
- */
73
- export declare const VSCODE_NATIVE_CLIENT: McpClient;
74
- /**
75
- * Strip our server entry from a config file the editor now provides natively.
76
- *
77
- * ⛔ Removes ONE key and preserves everything else, for the same reason `mergeClientConfig` never overwrites: the
78
- * file is the user's and may hold servers this feature knows nothing about. An unparseable file is left completely
79
- * alone — it still contains their work, and destroying it to tidy up our own mess would be the worse trade.
80
- *
81
- * Returns `text: undefined` when there was nothing of ours to remove, so a caller writes no file and churns no mtime.
82
- * When our entry was the only one, the result is an empty server map rather than a deleted file: removing a file a
83
- * user may have committed is not this command's business.
84
- */
85
- export declare function removeNativeClientEntry(existing: string | undefined): MergeOutcome;
86
- export interface MergeOutcome {
87
- /** The text to write, or `undefined` when nothing needs writing (AC-4). */
88
- readonly text?: string;
89
- /** Why, in one line — for a report a human reads. */
90
- readonly reason: string;
91
- /** True when the file already said the right thing. */
92
- readonly unchanged: boolean;
93
- }
94
- /**
95
- * Merge our entry into a client's configuration.
96
- *
97
- * ⛔ **Never overwrites.** The existing document is parsed, one key is added under the server map, and everything else
98
- * is preserved — including servers this feature knows nothing about. A configuration file is the user's, and the most
99
- * damaging thing an installer can do is silently drop someone else's entry.
100
- *
101
- * ⚠️ Unparseable input is REFUSED rather than replaced. A file with a syntax error still contains the user's work, and
102
- * overwriting it to make the install succeed would trade their configuration for our convenience.
103
- */
104
- export declare function mergeClientConfig(client: McpClient, existing: string | undefined, launch: McpLaunch): MergeOutcome;
105
- /**
106
- * The snippet for a client we will not write to (AC-3).
107
- *
108
- * Named by client and ready to paste, because "configure it yourself" without the exact shape is how a user ends up
109
- * with a subtly wrong key name.
110
- */
111
- export declare function clientSnippet(client: McpClient, launch: McpLaunch): string;
112
- //# sourceMappingURL=mcpClients.d.ts.map
@@ -1 +0,0 @@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;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,SAAS,GAChB,YAAY,CA8Cd;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAS1E"}
@@ -1,215 +0,0 @@
1
- /**
2
- * Writing an MCP server entry into each client's own configuration (Story 7.5).
3
- *
4
- * ### Why this is data, not four code paths
5
- *
6
- * Every client stores the same three facts — a name, a command, its arguments — under a different key, in a different
7
- * file, with a different nesting. Four bespoke writers would be four places to update when a fifth client appears, and
8
- * four chances for one of them to overwrite something. So a client is a **row**, and one merge serves all of them.
9
- *
10
- * ### Pure, so the decision is testable without a filesystem
11
- *
12
- * `mergeClientConfig` takes the existing file's text and returns the text to write. The caller does the reading and
13
- * writing. That is what makes AC-2 (*"those survive — the file is extended, never overwritten"*) and AC-4 (*"nothing
14
- * changes"*) assertable on strings rather than on a temp directory.
15
- */
16
- /**
17
- * The clients this writes for.
18
- *
19
- * ⚠️ `claude-desktop` has **no project-scoped file** — its configuration is user-scoped and lives outside any
20
- * workspace. Writing there would edit a file the user did not put under version control and did not ask us to touch, so
21
- * AC-3 prints a snippet instead. That is a deliberate refusal, not a gap.
22
- */
23
- export const MCP_CLIENTS = [
24
- /**
25
- * ⛔ **VS Code is NOT in this list, and removing it was the fix for a real mess.**
26
- *
27
- * It used to be — `{ id: 'vscode', file: '.vscode/mcp.json', key: 'servers' }` — written on every run of
28
- * *Install IntelliSense*. Since the extension began contributing an MCP server definition provider, that entry is
29
- * a DUPLICATE of a server the editor already has, and the duplicate is strictly worse than the original in three
30
- * ways that were all reported at once:
31
- *
32
- * 1. the MCP servers list showed two rows for one server, the second one disabled, and running the command again
33
- * produced another;
34
- * 2. the written entry hard-codes the extension's VERSIONED install path
35
- * (`…/beehexa-corp.hexasync-templates-2609.28.2/dist/mcp/server.js`), so it breaks on the next update and
36
- * keeps pointing at a directory that no longer exists;
37
- * 3. a server from a config file has no contributing extension for the editor to attribute, so it renders with
38
- * the generic MCP glyph instead of this extension's icon — the "rubbish icon" half of the same report.
39
- *
40
- * The provider has none of those problems: the editor resolves the path at launch, attributes it to this
41
- * extension, and offers it with no file at all. `removeNativeClientEntry` below deletes what was already written.
42
- *
43
- * ⚠️ The other clients stay. They are separate applications with no equivalent of the provider API, so a
44
- * config file is the only way to reach them.
45
- */
46
- {
47
- id: 'cursor',
48
- label: 'Cursor',
49
- file: '.cursor/mcp.json',
50
- key: 'mcpServers',
51
- },
52
- {
53
- id: 'claude-code',
54
- label: 'Claude Code',
55
- file: '.mcp.json',
56
- key: 'mcpServers',
57
- },
58
- {
59
- id: 'windsurf',
60
- label: 'Windsurf',
61
- file: '.windsurf/mcp.json',
62
- key: 'mcpServers',
63
- },
64
- { id: 'claude-desktop', label: 'Claude Desktop', key: 'mcpServers' },
65
- ];
66
- /** The entry every client gets — the same server, however each one spells the surrounding structure. */
67
- export function serverEntry(launch) {
68
- return { command: launch.command, args: [...launch.args] };
69
- }
70
- /**
71
- * The key our entry occupies in a client's server map — CAP-8's `hexasync-template-ide`.
72
- *
73
- * ⛔ It was `'hexasync'`, which names the vendor rather than the product, and HexaSync ships sibling MCP servers.
74
- * Two of them configured in one client would have collided on a single key, silently overwriting each other.
75
- */
76
- export const SERVER_NAME = 'hexasync-template-ide';
77
- /**
78
- * Every key this feature has ever written, newest first.
79
- *
80
- * Cleanup has to know the OLD name too: a workspace configured before the rename holds `hexasync`, and a cleanup
81
- * that only looked for the current name would leave exactly the duplicate it exists to remove.
82
- */
83
- export const LEGACY_SERVER_NAMES = ['hexasync-template-ide', 'hexasync'];
84
- /**
85
- * The VS Code client, kept ONLY so its previously-written entry can be removed.
86
- *
87
- * ⚠️ Deliberately not a member of `MCP_CLIENTS` — see the note there. Nothing writes this; `removeNativeClientEntry`
88
- * reads it to find the file to clean.
89
- */
90
- export const VSCODE_NATIVE_CLIENT = {
91
- id: 'vscode',
92
- label: 'VS Code',
93
- file: '.vscode/mcp.json',
94
- key: 'servers',
95
- };
96
- /**
97
- * Strip our server entry from a config file the editor now provides natively.
98
- *
99
- * ⛔ Removes ONE key and preserves everything else, for the same reason `mergeClientConfig` never overwrites: the
100
- * file is the user's and may hold servers this feature knows nothing about. An unparseable file is left completely
101
- * alone — it still contains their work, and destroying it to tidy up our own mess would be the worse trade.
102
- *
103
- * Returns `text: undefined` when there was nothing of ours to remove, so a caller writes no file and churns no mtime.
104
- * When our entry was the only one, the result is an empty server map rather than a deleted file: removing a file a
105
- * user may have committed is not this command's business.
106
- */
107
- export function removeNativeClientEntry(existing) {
108
- if (existing === undefined || existing.trim() === '') {
109
- return { reason: 'VS Code: nothing to clean up.', unchanged: true };
110
- }
111
- let document;
112
- try {
113
- const parsed = JSON.parse(existing);
114
- if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
115
- return {
116
- reason: 'VS Code: its configuration is not a JSON object, so it was left alone.',
117
- unchanged: true,
118
- };
119
- }
120
- document = parsed;
121
- }
122
- catch {
123
- return {
124
- reason: 'VS Code: its configuration could not be parsed, so it was left alone.',
125
- unchanged: true,
126
- };
127
- }
128
- const servers = document[VSCODE_NATIVE_CLIENT.key];
129
- if (!servers || typeof servers !== 'object' || Array.isArray(servers)) {
130
- return { reason: 'VS Code: nothing to clean up.', unchanged: true };
131
- }
132
- const remaining = { ...servers };
133
- const removed = LEGACY_SERVER_NAMES.filter((name) => Object.hasOwn(remaining, name));
134
- if (removed.length === 0) {
135
- return { reason: 'VS Code: nothing to clean up.', unchanged: true };
136
- }
137
- for (const name of removed)
138
- delete remaining[name];
139
- const merged = { ...document, [VSCODE_NATIVE_CLIENT.key]: remaining };
140
- const others = Object.keys(remaining).length;
141
- return {
142
- text: `${JSON.stringify(merged, null, 2)}\n`,
143
- reason: `VS Code: removed the stale \`${removed.join('`, `')}\` entry — the extension now provides this server ` +
144
- `itself, with no configuration${others > 0 ? `, keeping ${others} other server(s)` : ''}.`,
145
- unchanged: false,
146
- };
147
- }
148
- /**
149
- * Merge our entry into a client's configuration.
150
- *
151
- * ⛔ **Never overwrites.** The existing document is parsed, one key is added under the server map, and everything else
152
- * is preserved — including servers this feature knows nothing about. A configuration file is the user's, and the most
153
- * damaging thing an installer can do is silently drop someone else's entry.
154
- *
155
- * ⚠️ Unparseable input is REFUSED rather than replaced. A file with a syntax error still contains the user's work, and
156
- * overwriting it to make the install succeed would trade their configuration for our convenience.
157
- */
158
- export function mergeClientConfig(client, existing, launch) {
159
- const entry = serverEntry(launch);
160
- let document = {};
161
- if (existing !== undefined && existing.trim() !== '') {
162
- try {
163
- const parsed = JSON.parse(existing);
164
- if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
165
- return {
166
- reason: `${client.label}: its configuration is not a JSON object, so it was left alone.`,
167
- unchanged: true,
168
- };
169
- }
170
- document = parsed;
171
- }
172
- catch {
173
- return {
174
- reason: `${client.label}: its configuration does not parse as JSON, so it was left alone — it still holds your ` +
175
- `work, and overwriting it would trade that for a successful install.`,
176
- unchanged: true,
177
- };
178
- }
179
- }
180
- const servers = document[client.key] ?? {};
181
- const current = servers[SERVER_NAME];
182
- if (JSON.stringify(current) === JSON.stringify(entry)) {
183
- // AC-4 — already correct, so nothing is written. Rewriting an identical file churns a diff and a mtime for nothing.
184
- return { reason: `${client.label}: already configured.`, unchanged: true };
185
- }
186
- const merged = {
187
- ...document,
188
- [client.key]: { ...servers, [SERVER_NAME]: entry },
189
- };
190
- const others = Object.keys(servers).filter((name) => name !== SERVER_NAME);
191
- return {
192
- text: `${JSON.stringify(merged, null, 2)}\n`,
193
- reason: others.length > 0
194
- ? `${client.label}: added \`${SERVER_NAME}\`, keeping ${others.length} other server(s).`
195
- : `${client.label}: added \`${SERVER_NAME}\`.`,
196
- unchanged: false,
197
- };
198
- }
199
- /**
200
- * The snippet for a client we will not write to (AC-3).
201
- *
202
- * Named by client and ready to paste, because "configure it yourself" without the exact shape is how a user ends up
203
- * with a subtly wrong key name.
204
- */
205
- export function clientSnippet(client, launch) {
206
- /**
207
- * ⚠️ A `parent` field once let a client nest the server map under an outer object. No client declared it, no test
208
- * exercised it, and a mutation throwing inside both branches ran 18 tests green — so it was capability nobody could
209
- * see was broken. Removed rather than kept "just in case": all four supported clients key the map at the root, and
210
- * a nesting client can have it back in a few lines, with a row that proves it.
211
- */
212
- const body = { [client.key]: { [SERVER_NAME]: serverEntry(launch) } };
213
- return `${client.label} (user-scoped — paste this into its config):\n${JSON.stringify(body, null, 2)}`;
214
- }
215
- //# sourceMappingURL=mcpClients.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcpClients.js","sourceRoot":"","sources":["../src/mcpClients.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;QACE,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,kBAAkB;QACxB,GAAG,EAAE,YAAY;KAClB;IACD;QACE,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,YAAY;KAClB;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,oBAAoB;QAC1B,GAAG,EAAE,YAAY;KAClB;IACD,EAAE,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,YAAY,EAAE;CACrE,CAAC;AAkBF,wGAAwG;AACxG,MAAM,UAAU,WAAW,CAAC,MAAiB;IAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CA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