@hasna/domains 0.0.7 → 0.0.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-install.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mcp-install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-install.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mcp-install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCzC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwGzD"}
|
package/dist/cli/index.js
CHANGED
|
@@ -43470,9 +43470,9 @@ ${"\u2500".repeat(45)}`);
|
|
|
43470
43470
|
}
|
|
43471
43471
|
|
|
43472
43472
|
// src/cli/commands/mcp-install.ts
|
|
43473
|
-
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
43473
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
43474
43474
|
import { homedir as homedir9 } from "os";
|
|
43475
|
-
import { join as join9 } from "path";
|
|
43475
|
+
import { dirname as dirname5, join as join9 } from "path";
|
|
43476
43476
|
import { execSync as execSync3 } from "child_process";
|
|
43477
43477
|
var MCP_SERVER_NAME = "domains";
|
|
43478
43478
|
function getClaudeConfigPaths() {
|
|
@@ -43488,20 +43488,29 @@ function getMcpBinaryPath() {
|
|
|
43488
43488
|
return "domains-mcp";
|
|
43489
43489
|
}
|
|
43490
43490
|
}
|
|
43491
|
+
function ensureConfigDir(configPath2) {
|
|
43492
|
+
const dir = dirname5(configPath2);
|
|
43493
|
+
if (!existsSync7(dir)) {
|
|
43494
|
+
mkdirSync6(dir, { recursive: true });
|
|
43495
|
+
}
|
|
43496
|
+
}
|
|
43497
|
+
function readConfig(configPath2) {
|
|
43498
|
+
if (!existsSync7(configPath2))
|
|
43499
|
+
return {};
|
|
43500
|
+
try {
|
|
43501
|
+
return JSON.parse(readFileSync6(configPath2, "utf-8"));
|
|
43502
|
+
} catch {
|
|
43503
|
+
return {};
|
|
43504
|
+
}
|
|
43505
|
+
}
|
|
43491
43506
|
function registerMcpCommand(program2) {
|
|
43492
43507
|
const mcp = program2.command("mcp").description("MCP server management for AI agents");
|
|
43493
43508
|
mcp.command("install").description("Register domains MCP server with Claude Code").option("--project", "Install in project .claude/settings.json instead of global config").action((opts) => {
|
|
43494
43509
|
const paths = getClaudeConfigPaths();
|
|
43495
43510
|
const configPath2 = opts.project ? paths.project : paths.global;
|
|
43496
43511
|
const binary = getMcpBinaryPath();
|
|
43497
|
-
|
|
43498
|
-
|
|
43499
|
-
try {
|
|
43500
|
-
config = JSON.parse(readFileSync6(configPath2, "utf-8"));
|
|
43501
|
-
} catch {
|
|
43502
|
-
config = {};
|
|
43503
|
-
}
|
|
43504
|
-
}
|
|
43512
|
+
ensureConfigDir(configPath2);
|
|
43513
|
+
const config = readConfig(configPath2);
|
|
43505
43514
|
const mcpServers = config.mcpServers ?? {};
|
|
43506
43515
|
mcpServers[MCP_SERVER_NAME] = { command: binary, args: [] };
|
|
43507
43516
|
config.mcpServers = mcpServers;
|
|
@@ -43519,7 +43528,7 @@ function registerMcpCommand(program2) {
|
|
|
43519
43528
|
console.log("Config file not found \u2014 nothing to remove.");
|
|
43520
43529
|
return;
|
|
43521
43530
|
}
|
|
43522
|
-
const config =
|
|
43531
|
+
const config = readConfig(configPath2);
|
|
43523
43532
|
const mcpServers = config.mcpServers;
|
|
43524
43533
|
if (!mcpServers?.[MCP_SERVER_NAME]) {
|
|
43525
43534
|
console.log(`MCP server '${MCP_SERVER_NAME}' is not registered.`);
|
|
@@ -43529,23 +43538,50 @@ function registerMcpCommand(program2) {
|
|
|
43529
43538
|
writeFileSync4(configPath2, JSON.stringify(config, null, 2), "utf-8");
|
|
43530
43539
|
console.log(`\u2713 MCP server removed: ${MCP_SERVER_NAME}`);
|
|
43531
43540
|
});
|
|
43532
|
-
mcp.command("status").description("Check if domains MCP server is registered").action(() => {
|
|
43541
|
+
mcp.command("status").description("Check if domains MCP server is registered").option("-j, --json", "Output JSON").action((opts) => {
|
|
43533
43542
|
const paths = getClaudeConfigPaths();
|
|
43534
|
-
|
|
43543
|
+
const status = [];
|
|
43544
|
+
for (const [scope, configPath2] of [["global", paths.global], ["project", paths.project]]) {
|
|
43535
43545
|
if (!existsSync7(configPath2)) {
|
|
43536
|
-
|
|
43546
|
+
status.push({ scope, config_path: configPath2, exists: false, registered: false });
|
|
43537
43547
|
continue;
|
|
43538
43548
|
}
|
|
43539
43549
|
try {
|
|
43540
|
-
const config =
|
|
43550
|
+
const config = readConfig(configPath2);
|
|
43541
43551
|
const mcpServers = config.mcpServers;
|
|
43542
|
-
|
|
43543
|
-
|
|
43544
|
-
|
|
43545
|
-
|
|
43546
|
-
|
|
43547
|
-
|
|
43548
|
-
|
|
43552
|
+
status.push({
|
|
43553
|
+
scope,
|
|
43554
|
+
config_path: configPath2,
|
|
43555
|
+
exists: true,
|
|
43556
|
+
registered: Boolean(mcpServers?.[MCP_SERVER_NAME])
|
|
43557
|
+
});
|
|
43558
|
+
} catch (error) {
|
|
43559
|
+
status.push({
|
|
43560
|
+
scope,
|
|
43561
|
+
config_path: configPath2,
|
|
43562
|
+
exists: true,
|
|
43563
|
+
registered: false,
|
|
43564
|
+
error: error instanceof Error ? error.message : String(error)
|
|
43565
|
+
});
|
|
43566
|
+
}
|
|
43567
|
+
}
|
|
43568
|
+
if (opts.json) {
|
|
43569
|
+
console.log(JSON.stringify({ server: MCP_SERVER_NAME, checks: status }, null, 2));
|
|
43570
|
+
return;
|
|
43571
|
+
}
|
|
43572
|
+
for (const item of status) {
|
|
43573
|
+
if (!item.exists) {
|
|
43574
|
+
console.log(` ${item.scope}: not found`);
|
|
43575
|
+
continue;
|
|
43576
|
+
}
|
|
43577
|
+
if (item.error) {
|
|
43578
|
+
console.log(` ${item.scope}: error reading config`);
|
|
43579
|
+
continue;
|
|
43580
|
+
}
|
|
43581
|
+
if (item.registered) {
|
|
43582
|
+
console.log(` ${item.scope}: \u2713 registered`);
|
|
43583
|
+
} else {
|
|
43584
|
+
console.log(` ${item.scope}: \u2717 not registered`);
|
|
43549
43585
|
}
|
|
43550
43586
|
}
|
|
43551
43587
|
});
|