@paretools/init 0.2.0
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/LICENSE +21 -0
- package/dist/doctor.d.ts +3 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +146 -0
- package/dist/doctor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/args.d.ts +18 -0
- package/dist/lib/args.d.ts.map +1 -0
- package/dist/lib/args.js +65 -0
- package/dist/lib/args.js.map +1 -0
- package/dist/lib/clients.d.ts +21 -0
- package/dist/lib/clients.d.ts.map +1 -0
- package/dist/lib/clients.js +120 -0
- package/dist/lib/clients.js.map +1 -0
- package/dist/lib/config-writers/json-mcpservers.d.ts +14 -0
- package/dist/lib/config-writers/json-mcpservers.d.ts.map +1 -0
- package/dist/lib/config-writers/json-mcpservers.js +43 -0
- package/dist/lib/config-writers/json-mcpservers.js.map +1 -0
- package/dist/lib/config-writers/json-vscode.d.ts +9 -0
- package/dist/lib/config-writers/json-vscode.d.ts.map +1 -0
- package/dist/lib/config-writers/json-vscode.js +36 -0
- package/dist/lib/config-writers/json-vscode.js.map +1 -0
- package/dist/lib/config-writers/json-zed.d.ts +9 -0
- package/dist/lib/config-writers/json-zed.d.ts.map +1 -0
- package/dist/lib/config-writers/json-zed.js +36 -0
- package/dist/lib/config-writers/json-zed.js.map +1 -0
- package/dist/lib/config-writers/toml-codex.d.ts +8 -0
- package/dist/lib/config-writers/toml-codex.d.ts.map +1 -0
- package/dist/lib/config-writers/toml-codex.js +34 -0
- package/dist/lib/config-writers/toml-codex.js.map +1 -0
- package/dist/lib/config-writers/yaml-continue.d.ts +8 -0
- package/dist/lib/config-writers/yaml-continue.d.ts.map +1 -0
- package/dist/lib/config-writers/yaml-continue.js +50 -0
- package/dist/lib/config-writers/yaml-continue.js.map +1 -0
- package/dist/lib/detect.d.ts +7 -0
- package/dist/lib/detect.d.ts.map +1 -0
- package/dist/lib/detect.js +10 -0
- package/dist/lib/detect.js.map +1 -0
- package/dist/lib/doctor/health-check.d.ts +12 -0
- package/dist/lib/doctor/health-check.d.ts.map +1 -0
- package/dist/lib/doctor/health-check.js +50 -0
- package/dist/lib/doctor/health-check.js.map +1 -0
- package/dist/lib/doctor/report.d.ts +4 -0
- package/dist/lib/doctor/report.d.ts.map +1 -0
- package/dist/lib/doctor/report.js +22 -0
- package/dist/lib/doctor/report.js.map +1 -0
- package/dist/lib/merge.d.ts +24 -0
- package/dist/lib/merge.d.ts.map +1 -0
- package/dist/lib/merge.js +60 -0
- package/dist/lib/merge.js.map +1 -0
- package/dist/lib/parse-utils.d.ts +18 -0
- package/dist/lib/parse-utils.d.ts.map +1 -0
- package/dist/lib/parse-utils.js +78 -0
- package/dist/lib/parse-utils.js.map +1 -0
- package/dist/lib/platform.d.ts +14 -0
- package/dist/lib/platform.d.ts.map +1 -0
- package/dist/lib/platform.js +20 -0
- package/dist/lib/platform.js.map +1 -0
- package/dist/lib/presets.d.ts +10 -0
- package/dist/lib/presets.d.ts.map +1 -0
- package/dist/lib/presets.js +58 -0
- package/dist/lib/presets.js.map +1 -0
- package/dist/lib/prompts.d.ts +7 -0
- package/dist/lib/prompts.d.ts.map +1 -0
- package/dist/lib/prompts.js +54 -0
- package/dist/lib/prompts.js.map +1 -0
- package/dist/lib/servers.d.ts +14 -0
- package/dist/lib/servers.d.ts.map +1 -0
- package/dist/lib/servers.js +33 -0
- package/dist/lib/servers.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-vscode.js","sourceRoot":"","sources":["../../../src/lib/config-writers/json-vscode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAO9D;;;;GAIG;AAC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9 @@
|
|
|
1
|
+
import type { FileSystem } from "../merge.js";
|
|
2
|
+
import type { ServerEntry } from "../servers.js";
|
|
3
|
+
/**
|
|
4
|
+
* Merge Pare server entries into Zed's settings.json.
|
|
5
|
+
* Format: context_servers key with env field.
|
|
6
|
+
* Handles JSONC (JSON with comments) safely.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeZedConfig(configPath: string, servers: ServerEntry[], fs: FileSystem): string;
|
|
9
|
+
//# sourceMappingURL=json-zed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-zed.d.ts","sourceRoot":"","sources":["../../../src/lib/config-writers/json-zed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAYjD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CA4BjG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { npxCommand } from "../platform.js";
|
|
2
|
+
import { isPlainObject, parseJsonc } from "../parse-utils.js";
|
|
3
|
+
/**
|
|
4
|
+
* Merge Pare server entries into Zed's settings.json.
|
|
5
|
+
* Format: context_servers key with env field.
|
|
6
|
+
* Handles JSONC (JSON with comments) safely.
|
|
7
|
+
*/
|
|
8
|
+
export function writeZedConfig(configPath, servers, fs) {
|
|
9
|
+
let existing = {};
|
|
10
|
+
const raw = fs.readFile(configPath);
|
|
11
|
+
if (raw !== undefined && raw.trim().length > 0) {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = parseJsonc(raw);
|
|
14
|
+
if (isPlainObject(parsed)) {
|
|
15
|
+
existing = parsed;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.warn(`Warning: ${configPath} is not a JSON object, creating fresh config.`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
console.warn(`Warning: Could not parse ${configPath}, creating fresh config.`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!existing.context_servers) {
|
|
26
|
+
existing.context_servers = {};
|
|
27
|
+
}
|
|
28
|
+
for (const s of servers) {
|
|
29
|
+
const { command, args } = npxCommand(s.pkg);
|
|
30
|
+
existing.context_servers[s.id] = { command, args, env: {} };
|
|
31
|
+
}
|
|
32
|
+
const output = JSON.stringify(existing, null, 2) + "\n";
|
|
33
|
+
fs.writeFile(configPath, output);
|
|
34
|
+
return output;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=json-zed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-zed.js","sourceRoot":"","sources":["../../../src/lib/config-writers/json-zed.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU9D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,OAAsB,EAAE,EAAc;IACvF,IAAI,QAAQ,GAAgB,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,QAAQ,GAAG,MAAqB,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,YAAY,UAAU,+CAA+C,CAAC,CAAC;YACtF,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,CAAC,4BAA4B,UAAU,0BAA0B,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;QAC9B,QAAQ,CAAC,eAAe,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5C,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC9D,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IACxD,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileSystem } from "../merge.js";
|
|
2
|
+
import type { ServerEntry } from "../servers.js";
|
|
3
|
+
/**
|
|
4
|
+
* Merge Pare server entries into OpenAI Codex's config.toml.
|
|
5
|
+
* Format: [mcp_servers.<name>] sections.
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeCodexConfig(configPath: string, servers: ServerEntry[], fs: FileSystem): string;
|
|
8
|
+
//# sourceMappingURL=toml-codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toml-codex.d.ts","sourceRoot":"","sources":["../../../src/lib/config-writers/toml-codex.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AASjD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EAAE,EACtB,EAAE,EAAE,UAAU,GACb,MAAM,CA2BR"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { parse, stringify } from "smol-toml";
|
|
2
|
+
import { npxCommand } from "../platform.js";
|
|
3
|
+
import { stripBom } from "../parse-utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Merge Pare server entries into OpenAI Codex's config.toml.
|
|
6
|
+
* Format: [mcp_servers.<name>] sections.
|
|
7
|
+
*/
|
|
8
|
+
export function writeCodexConfig(configPath, servers, fs) {
|
|
9
|
+
let existing = {};
|
|
10
|
+
const raw = fs.readFile(configPath);
|
|
11
|
+
if (raw !== undefined) {
|
|
12
|
+
const trimmed = stripBom(raw).trim();
|
|
13
|
+
if (trimmed.length > 0) {
|
|
14
|
+
try {
|
|
15
|
+
existing = parse(trimmed);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
console.warn(`Warning: Could not parse ${configPath}, creating fresh config.`);
|
|
19
|
+
existing = {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!existing.mcp_servers) {
|
|
24
|
+
existing.mcp_servers = {};
|
|
25
|
+
}
|
|
26
|
+
for (const s of servers) {
|
|
27
|
+
const { command, args } = npxCommand(s.pkg);
|
|
28
|
+
existing.mcp_servers[s.id] = { command, args };
|
|
29
|
+
}
|
|
30
|
+
const output = stringify(existing) + "\n";
|
|
31
|
+
fs.writeFile(configPath, output);
|
|
32
|
+
return output;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=toml-codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toml-codex.js","sourceRoot":"","sources":["../../../src/lib/config-writers/toml-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,M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merge.js";
|
|
2
|
+
import type { ServerEntry } from "../servers.js";
|
|
3
|
+
/**
|
|
4
|
+
* Merge Pare server entries into Continue.dev's pare.yaml.
|
|
5
|
+
* Format: mcpServers array with name, type, command, args.
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeContinueConfig(configPath: string, servers: ServerEntry[], fs: FileSystem): string;
|
|
8
|
+
//# sourceMappingURL=yaml-continue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-continue.d.ts","sourceRoot":"","sources":["../../../src/lib/config-writers/yaml-continue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAWjD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EAAE,EACtB,EAAE,EAAE,UAAU,GACb,MAAM,CAwCR"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import YAML from "yaml";
|
|
2
|
+
import { npxCommand } from "../platform.js";
|
|
3
|
+
import { stripBom } from "../parse-utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Merge Pare server entries into Continue.dev's pare.yaml.
|
|
6
|
+
* Format: mcpServers array with name, type, command, args.
|
|
7
|
+
*/
|
|
8
|
+
export function writeContinueConfig(configPath, servers, fs) {
|
|
9
|
+
let existing = {};
|
|
10
|
+
const raw = fs.readFile(configPath);
|
|
11
|
+
if (raw !== undefined) {
|
|
12
|
+
const trimmed = stripBom(raw).trim();
|
|
13
|
+
if (trimmed.length > 0) {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = YAML.parse(trimmed);
|
|
16
|
+
existing = parsed ?? {};
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
console.warn(`Warning: Could not parse ${configPath}, creating fresh config.`);
|
|
20
|
+
existing = {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!existing.name)
|
|
25
|
+
existing.name = "Pare Tools";
|
|
26
|
+
if (!existing.version)
|
|
27
|
+
existing.version = "0.0.1";
|
|
28
|
+
if (!existing.schema)
|
|
29
|
+
existing.schema = "v1";
|
|
30
|
+
if (!existing.mcpServers)
|
|
31
|
+
existing.mcpServers = [];
|
|
32
|
+
// Build a set of existing Pare server names for replacement
|
|
33
|
+
const existingNames = new Set(existing.mcpServers.map((s) => s.name));
|
|
34
|
+
for (const s of servers) {
|
|
35
|
+
const { command, args } = npxCommand(s.pkg);
|
|
36
|
+
const entry = { name: s.id, type: "stdio", command, args };
|
|
37
|
+
if (existingNames.has(s.id)) {
|
|
38
|
+
// Replace existing entry
|
|
39
|
+
const idx = existing.mcpServers.findIndex((e) => e.name === s.id);
|
|
40
|
+
existing.mcpServers[idx] = entry;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
existing.mcpServers.push(entry);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const output = YAML.stringify(existing);
|
|
47
|
+
fs.writeFile(configPath, output);
|
|
48
|
+
return output;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=yaml-continue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-continue.js","sourceRoot":"","sources":["../../../src/lib/config-writers/yaml-continue.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAS7C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAkB,EAClB,OAAsB,EACtB,EAAc;IAEd,IAAI,QAAQ,GAAmB,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,SAAS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AAE,CAAC,EAAE,CAAC;YAC5B,yBAAyB;YACzB,MAAM,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YAClE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClientEntry } from "./clients.js";
|
|
2
|
+
/**
|
|
3
|
+
* Auto-detect installed AI coding clients by checking for
|
|
4
|
+
* known config directories/files on the filesystem.
|
|
5
|
+
*/
|
|
6
|
+
export declare function detectClients(): ClientEntry[];
|
|
7
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/lib/detect.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,aAAa,IAAI,WAAW,EAAE,CAE7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { getClients } from "./clients.js";
|
|
3
|
+
/**
|
|
4
|
+
* Auto-detect installed AI coding clients by checking for
|
|
5
|
+
* known config directories/files on the filesystem.
|
|
6
|
+
*/
|
|
7
|
+
export function detectClients() {
|
|
8
|
+
return getClients().filter((client) => client.detectPaths.some((p) => existsSync(p)));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/lib/detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface HealthResult {
|
|
2
|
+
serverId: string;
|
|
3
|
+
status: "pass" | "fail";
|
|
4
|
+
toolCount?: number;
|
|
5
|
+
latencyMs?: number;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Spawn a Pare MCP server, perform initialize + listTools, report health.
|
|
10
|
+
*/
|
|
11
|
+
export declare function checkServer(serverId: string, command: string, args: string[]): Promise<HealthResult>;
|
|
12
|
+
//# sourceMappingURL=health-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-check.d.ts","sourceRoot":"","sources":["../../../src/lib/doctor/health-check.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAaD;;GAEG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,YAAY,CAAC,CAuCvB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
3
|
+
const SERVER_TIMEOUT = 15_000;
|
|
4
|
+
/** Race a promise against a timeout, cleaning up the timer on resolution. */
|
|
5
|
+
function withTimeout(promise, ms, label) {
|
|
6
|
+
let timeoutId;
|
|
7
|
+
const timeout = new Promise((_, reject) => {
|
|
8
|
+
timeoutId = setTimeout(() => reject(new Error(`${label} timeout`)), ms);
|
|
9
|
+
});
|
|
10
|
+
return Promise.race([promise, timeout]).finally(() => clearTimeout(timeoutId));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Spawn a Pare MCP server, perform initialize + listTools, report health.
|
|
14
|
+
*/
|
|
15
|
+
export async function checkServer(serverId, command, args) {
|
|
16
|
+
const start = Date.now();
|
|
17
|
+
try {
|
|
18
|
+
const transport = new StdioClientTransport({
|
|
19
|
+
command,
|
|
20
|
+
args,
|
|
21
|
+
stderr: "pipe",
|
|
22
|
+
});
|
|
23
|
+
const client = new Client({ name: "pare-doctor", version: "1.0.0" });
|
|
24
|
+
await withTimeout(client.connect(transport), SERVER_TIMEOUT, "Connection");
|
|
25
|
+
const { tools } = await withTimeout(client.listTools(), SERVER_TIMEOUT, "listTools");
|
|
26
|
+
const latencyMs = Date.now() - start;
|
|
27
|
+
// Clean up
|
|
28
|
+
try {
|
|
29
|
+
await transport.close();
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Ignore close errors
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
serverId,
|
|
36
|
+
status: "pass",
|
|
37
|
+
toolCount: tools.length,
|
|
38
|
+
latencyMs,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return {
|
|
43
|
+
serverId,
|
|
44
|
+
status: "fail",
|
|
45
|
+
latencyMs: Date.now() - start,
|
|
46
|
+
error: err instanceof Error ? err.message : String(err),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=health-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-check.js","sourceRoot":"","sources":["../../../src/lib/doctor/health-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAUjF,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,6EAA6E;AAC7E,SAAS,WAAW,CAAI,OAAmB,EAAE,EAAU,EAAE,KAAa;IACpE,IAAI,SAAwC,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AACjF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAgB,EAChB,OAAe,EACf,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC;YACzC,OAAO;YACP,IAAI;YACJ,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAErE,MAAM,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QAE3E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAErF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAErC,WAAW;QACX,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;QAED,OAAO;YACL,QAAQ;YACR,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,KAAK,CAAC,MAAM;YACvB,SAAS;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,QAAQ;YACR,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;YAC7B,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACxD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/lib/doctor/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAwB5D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Format doctor results as a terminal-friendly report. */
|
|
2
|
+
export function formatReport(results) {
|
|
3
|
+
const lines = [];
|
|
4
|
+
const passed = results.filter((r) => r.status === "pass").length;
|
|
5
|
+
const failed = results.filter((r) => r.status === "fail").length;
|
|
6
|
+
lines.push("");
|
|
7
|
+
lines.push("Pare Doctor Report");
|
|
8
|
+
lines.push("─".repeat(60));
|
|
9
|
+
for (const r of results) {
|
|
10
|
+
const icon = r.status === "pass" ? "PASS" : "FAIL";
|
|
11
|
+
const tools = r.toolCount !== undefined ? `${r.toolCount} tools` : "";
|
|
12
|
+
const latency = r.latencyMs !== undefined ? `${r.latencyMs}ms` : "";
|
|
13
|
+
const info = [tools, latency].filter(Boolean).join(", ");
|
|
14
|
+
const detail = r.error ? ` — ${r.error}` : "";
|
|
15
|
+
lines.push(` [${icon}] ${r.serverId}${info ? ` (${info})` : ""}${detail}`);
|
|
16
|
+
}
|
|
17
|
+
lines.push("─".repeat(60));
|
|
18
|
+
lines.push(` ${passed} passed, ${failed} failed, ${results.length} total`);
|
|
19
|
+
lines.push("");
|
|
20
|
+
return lines.join("\n");
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/lib/doctor/report.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,MAAM,UAAU,YAAY,CAAC,OAAuB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IACjE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IAEjE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjC,KAAK,CAA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|
|
1
|
+
import type { ClientEntry } from "./clients.js";
|
|
2
|
+
import type { ServerEntry } from "./servers.js";
|
|
3
|
+
/** Injectable filesystem interface for testability. */
|
|
4
|
+
export interface FileSystem {
|
|
5
|
+
readFile(path: string): string | undefined;
|
|
6
|
+
writeFile(path: string, content: string): void;
|
|
7
|
+
}
|
|
8
|
+
/** Real filesystem implementation. */
|
|
9
|
+
export declare function realFs(): FileSystem;
|
|
10
|
+
/** In-memory filesystem for testing. */
|
|
11
|
+
export declare function memoryFs(initialFiles?: Record<string, string>): FileSystem & {
|
|
12
|
+
files: Map<string, string>;
|
|
13
|
+
};
|
|
14
|
+
export interface MergeResult {
|
|
15
|
+
configPath: string;
|
|
16
|
+
output: string;
|
|
17
|
+
serverCount: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Merge Pare server entries into a client's config file.
|
|
21
|
+
* Returns the resolved config path and output content.
|
|
22
|
+
*/
|
|
23
|
+
export declare function mergeConfig(client: ClientEntry, servers: ServerEntry[], projectDir: string, fs: FileSystem): MergeResult;
|
|
24
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/lib/merge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,cAAc,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAOhD,uDAAuD;AACvD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD;AAED,sCAAsC;AACtC,wBAAgB,MAAM,IAAI,UAAU,CAcnC;AAED,wCAAwC;AACxC,wBAAgB,QAAQ,CACtB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,UAAU,GAAG;IAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAW7C;AAaD,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,GACb,WAAW,CAUb"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { resolveConfigPath } from "./clients.js";
|
|
4
|
+
import { writeMcpServersConfig } from "./config-writers/json-mcpservers.js";
|
|
5
|
+
import { writeVsCodeConfig } from "./config-writers/json-vscode.js";
|
|
6
|
+
import { writeZedConfig } from "./config-writers/json-zed.js";
|
|
7
|
+
import { writeCodexConfig } from "./config-writers/toml-codex.js";
|
|
8
|
+
import { writeContinueConfig } from "./config-writers/yaml-continue.js";
|
|
9
|
+
/** Real filesystem implementation. */
|
|
10
|
+
export function realFs() {
|
|
11
|
+
return {
|
|
12
|
+
readFile(path) {
|
|
13
|
+
if (!existsSync(path))
|
|
14
|
+
return undefined;
|
|
15
|
+
return readFileSync(path, "utf-8");
|
|
16
|
+
},
|
|
17
|
+
writeFile(path, content) {
|
|
18
|
+
const dir = dirname(path);
|
|
19
|
+
if (!existsSync(dir)) {
|
|
20
|
+
mkdirSync(dir, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
writeFileSync(path, content, "utf-8");
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** In-memory filesystem for testing. */
|
|
27
|
+
export function memoryFs(initialFiles) {
|
|
28
|
+
const files = new Map(initialFiles ? Object.entries(initialFiles) : []);
|
|
29
|
+
return {
|
|
30
|
+
files,
|
|
31
|
+
readFile(path) {
|
|
32
|
+
return files.get(path);
|
|
33
|
+
},
|
|
34
|
+
writeFile(path, content) {
|
|
35
|
+
files.set(path, content);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const FORMAT_WRITERS = {
|
|
40
|
+
"json-mcpservers": writeMcpServersConfig,
|
|
41
|
+
"json-vscode": writeVsCodeConfig,
|
|
42
|
+
"json-zed": writeZedConfig,
|
|
43
|
+
"toml-codex": writeCodexConfig,
|
|
44
|
+
"yaml-continue": writeContinueConfig,
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Merge Pare server entries into a client's config file.
|
|
48
|
+
* Returns the resolved config path and output content.
|
|
49
|
+
*/
|
|
50
|
+
export function mergeConfig(client, servers, projectDir, fs) {
|
|
51
|
+
const configPath = resolveConfigPath(client.configPath, projectDir);
|
|
52
|
+
const writer = FORMAT_WRITERS[client.format];
|
|
53
|
+
const output = writer(configPath, servers, fs);
|
|
54
|
+
return {
|
|
55
|
+
configPath,
|
|
56
|
+
output,
|
|
57
|
+
serverCount: servers.length,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/lib/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,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,EAAE,mBAAmB;CACrC,CAAC;AAQF;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,MAAmB,EACnB,OAAsB,EACtB,UAAkB,EAClB,EAAc;IAEd,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAE/C,OAAO;QACL,UAAU;QACV,MAAM;QACN,WAAW,EAAE,OAAO,CAAC,MAAM;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Strip UTF-8 BOM (byte order mark) from string content. */
|
|
2
|
+
export declare function stripBom(content: string): string;
|
|
3
|
+
/** Check if a value is a plain object (not an array, null, or primitive). */
|
|
4
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* Strip JSON comments (JSONC) from a string so it can be parsed by JSON.parse.
|
|
7
|
+
* Handles single-line (//) and block comments, respecting strings.
|
|
8
|
+
*
|
|
9
|
+
* VS Code, Zed, and other editors commonly use JSONC for config files.
|
|
10
|
+
* We must strip comments before parsing to avoid data loss.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stripJsonComments(input: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Parse a JSONC string (JSON with comments) into a value.
|
|
15
|
+
* Strips comments and BOM, then delegates to JSON.parse.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseJsonc(input: string): unknown;
|
|
18
|
+
//# sourceMappingURL=parse-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-utils.d.ts","sourceRoot":"","sources":["../../src/lib/parse-utils.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAwDvD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Strip UTF-8 BOM (byte order mark) from string content. */
|
|
2
|
+
export function stripBom(content) {
|
|
3
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
4
|
+
return content.slice(1);
|
|
5
|
+
}
|
|
6
|
+
return content;
|
|
7
|
+
}
|
|
8
|
+
/** Check if a value is a plain object (not an array, null, or primitive). */
|
|
9
|
+
export function isPlainObject(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Strip JSON comments (JSONC) from a string so it can be parsed by JSON.parse.
|
|
14
|
+
* Handles single-line (//) and block comments, respecting strings.
|
|
15
|
+
*
|
|
16
|
+
* VS Code, Zed, and other editors commonly use JSONC for config files.
|
|
17
|
+
* We must strip comments before parsing to avoid data loss.
|
|
18
|
+
*/
|
|
19
|
+
export function stripJsonComments(input) {
|
|
20
|
+
let result = "";
|
|
21
|
+
let i = 0;
|
|
22
|
+
const len = input.length;
|
|
23
|
+
while (i < len) {
|
|
24
|
+
const ch = input[i];
|
|
25
|
+
// String literal — copy verbatim including any escape sequences
|
|
26
|
+
if (ch === '"') {
|
|
27
|
+
result += '"';
|
|
28
|
+
i++;
|
|
29
|
+
while (i < len) {
|
|
30
|
+
const sc = input[i];
|
|
31
|
+
result += sc;
|
|
32
|
+
i++;
|
|
33
|
+
if (sc === "\\") {
|
|
34
|
+
// Copy escaped character
|
|
35
|
+
if (i < len) {
|
|
36
|
+
result += input[i];
|
|
37
|
+
i++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (sc === '"') {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
// Single-line comment
|
|
47
|
+
if (ch === "/" && i + 1 < len && input[i + 1] === "/") {
|
|
48
|
+
i += 2;
|
|
49
|
+
while (i < len && input[i] !== "\n") {
|
|
50
|
+
i++;
|
|
51
|
+
}
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// Block comment
|
|
55
|
+
if (ch === "/" && i + 1 < len && input[i + 1] === "*") {
|
|
56
|
+
i += 2;
|
|
57
|
+
while (i < len) {
|
|
58
|
+
if (input[i] === "*" && i + 1 < len && input[i + 1] === "/") {
|
|
59
|
+
i += 2;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
result += ch;
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse a JSONC string (JSON with comments) into a value.
|
|
73
|
+
* Strips comments and BOM, then delegates to JSON.parse.
|
|
74
|
+
*/
|
|
75
|
+
export function parseJsonc(input) {
|
|
76
|
+
return JSON.parse(stripJsonComments(stripBom(input).trim()));
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=parse-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-utils.js","sourceRoot":"","sources":["../../src/lib/parse-utils.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,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IAAI,CAAC,CAAC;YACP,OAAO,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;gBACpC,CAAC,EAAE,CAAC;YACN,CAAC;YACD,SAAS;QACX,CAAC;QAED,gBAAgB;QAChB,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACtD,CAAC,IAAI,CAAC,CAAC;YACP,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;gBACf,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC5D,CAAC,IAAI,CAAC,CAAC;oBACP,MAAM;gBACR,CAAC;gBACD,CAAC,EAAE,CAAC;YACN,CAAC;YACD,SAAS;QACX,CAAC;QAED,MAAM,IAAI,EAAE,CAAC;QACb,CAAC,EAAE,CAAC;IACN,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Whether we're running on Windows. */
|
|
2
|
+
export declare function isWindows(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Build the command + args for spawning an npx-based server.
|
|
5
|
+
* On Windows, wraps with `cmd /c` to avoid ENOENT issues.
|
|
6
|
+
*
|
|
7
|
+
* @param pkg - npm package name
|
|
8
|
+
* @param forceWindows - override platform detection (for testing)
|
|
9
|
+
*/
|
|
10
|
+
export declare function npxCommand(pkg: string, forceWindows?: boolean): {
|
|
11
|
+
command: string;
|
|
12
|
+
args: string[];
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/lib/platform.ts"],"names":[],"mappings":"AAEA,wCAAwC;AACxC,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,OAAO,GACrB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAMrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { platform } from "node:os";
|
|
2
|
+
/** Whether we're running on Windows. */
|
|
3
|
+
export function isWindows() {
|
|
4
|
+
return platform() === "win32";
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Build the command + args for spawning an npx-based server.
|
|
8
|
+
* On Windows, wraps with `cmd /c` to avoid ENOENT issues.
|
|
9
|
+
*
|
|
10
|
+
* @param pkg - npm package name
|
|
11
|
+
* @param forceWindows - override platform detection (for testing)
|
|
12
|
+
*/
|
|
13
|
+
export function npxCommand(pkg, forceWindows) {
|
|
14
|
+
const win = forceWindows ?? isWindows();
|
|
15
|
+
if (win) {
|
|
16
|
+
return { command: "cmd", args: ["/c", "npx", "-y", pkg] };
|
|
17
|
+
}
|
|
18
|
+
return { command: "npx", args: ["-y", pkg] };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/lib/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,wCAAwC;AACxC,MAAM,UAAU,SAAS;IACvB,OAAO,QAAQ,EAAE,KAAK,OAAO,CAAC;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,GAAW,EACX,YAAsB;IAEtB,MAAM,GAAG,GAAG,YAAY,IAAI,SAAS,EAAE,CAAC;IACxC,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5D,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Preset server groupings for common workflows. */
|
|
2
|
+
export interface Preset {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
serverIds: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const PRESETS: Preset[];
|
|
9
|
+
export declare const PRESET_MAP: Map<string, Preset>;
|
|
10
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/lib/presets.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAEpD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,OAAO,EAAE,MAAM,EAsD3B,CAAC;AAEF,eAAO,MAAM,UAAU,qBAAyC,CAAC"}
|