@hasna/todos 0.2.1 → 0.2.2
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/cli/index.js +23 -18
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8909,13 +8909,13 @@ program2.command("export").description("Export tasks").option("-f, --format <for
|
|
|
8909
8909
|
console.log(JSON.stringify(tasks, null, 2));
|
|
8910
8910
|
}
|
|
8911
8911
|
});
|
|
8912
|
-
program2.command("mcp").description("Start MCP server (stdio)").option("--register <agent>", "Register MCP server with an agent (claude, codex, gemini, all)").option("--unregister <agent>", "Unregister MCP server from an agent (claude, codex, gemini, all)").action(async (opts) => {
|
|
8912
|
+
program2.command("mcp").description("Start MCP server (stdio)").option("--register <agent>", "Register MCP server with an agent (claude, codex, gemini, all)").option("--unregister <agent>", "Unregister MCP server from an agent (claude, codex, gemini, all)").option("-g, --global", "Register/unregister globally (user-level) instead of project-level").action(async (opts) => {
|
|
8913
8913
|
if (opts.register) {
|
|
8914
|
-
registerMcp(opts.register);
|
|
8914
|
+
registerMcp(opts.register, opts.global);
|
|
8915
8915
|
return;
|
|
8916
8916
|
}
|
|
8917
8917
|
if (opts.unregister) {
|
|
8918
|
-
unregisterMcp(opts.unregister);
|
|
8918
|
+
unregisterMcp(opts.unregister, opts.global);
|
|
8919
8919
|
return;
|
|
8920
8920
|
}
|
|
8921
8921
|
await Promise.resolve().then(() => (init_mcp(), exports_mcp));
|
|
@@ -8959,28 +8959,33 @@ function writeTomlFile(path, content) {
|
|
|
8959
8959
|
mkdirSync2(dir, { recursive: true });
|
|
8960
8960
|
writeFileSync(path, content);
|
|
8961
8961
|
}
|
|
8962
|
-
function registerClaude(binPath) {
|
|
8963
|
-
const
|
|
8964
|
-
const configPath = join3(cwd, ".mcp.json");
|
|
8962
|
+
function registerClaude(binPath, global) {
|
|
8963
|
+
const configPath = global ? join3(HOME, ".claude", ".mcp.json") : join3(process.cwd(), ".mcp.json");
|
|
8965
8964
|
const config = readJsonFile(configPath);
|
|
8966
|
-
config["
|
|
8965
|
+
if (!config["mcpServers"]) {
|
|
8966
|
+
config["mcpServers"] = {};
|
|
8967
|
+
}
|
|
8968
|
+
const servers = config["mcpServers"];
|
|
8969
|
+
servers["todos"] = {
|
|
8967
8970
|
command: binPath,
|
|
8968
8971
|
args: []
|
|
8969
8972
|
};
|
|
8970
8973
|
writeJsonFile(configPath, config);
|
|
8971
|
-
|
|
8974
|
+
const scope = global ? "global" : "project";
|
|
8975
|
+
console.log(chalk.green(`Claude Code (${scope}): registered in ${configPath}`));
|
|
8972
8976
|
}
|
|
8973
|
-
function unregisterClaude() {
|
|
8974
|
-
const
|
|
8975
|
-
const configPath = join3(cwd, ".mcp.json");
|
|
8977
|
+
function unregisterClaude(global) {
|
|
8978
|
+
const configPath = global ? join3(HOME, ".claude", ".mcp.json") : join3(process.cwd(), ".mcp.json");
|
|
8976
8979
|
const config = readJsonFile(configPath);
|
|
8977
|
-
|
|
8980
|
+
const servers = config["mcpServers"];
|
|
8981
|
+
if (!servers || !("todos" in servers)) {
|
|
8978
8982
|
console.log(chalk.dim(`Claude Code: todos not found in ${configPath}`));
|
|
8979
8983
|
return;
|
|
8980
8984
|
}
|
|
8981
|
-
delete
|
|
8985
|
+
delete servers["todos"];
|
|
8982
8986
|
writeJsonFile(configPath, config);
|
|
8983
|
-
|
|
8987
|
+
const scope = global ? "global" : "project";
|
|
8988
|
+
console.log(chalk.green(`Claude Code (${scope}): unregistered from ${configPath}`));
|
|
8984
8989
|
}
|
|
8985
8990
|
function registerCodex(binPath) {
|
|
8986
8991
|
const configPath = join3(HOME, ".codex", "config.toml");
|
|
@@ -9055,13 +9060,13 @@ function unregisterGemini() {
|
|
|
9055
9060
|
writeJsonFile(configPath, config);
|
|
9056
9061
|
console.log(chalk.green(`Gemini CLI: unregistered from ${configPath}`));
|
|
9057
9062
|
}
|
|
9058
|
-
function registerMcp(agent) {
|
|
9063
|
+
function registerMcp(agent, global) {
|
|
9059
9064
|
const agents = agent === "all" ? ["claude", "codex", "gemini"] : [agent];
|
|
9060
9065
|
const binPath = getMcpBinaryPath();
|
|
9061
9066
|
for (const a of agents) {
|
|
9062
9067
|
switch (a) {
|
|
9063
9068
|
case "claude":
|
|
9064
|
-
registerClaude(binPath);
|
|
9069
|
+
registerClaude(binPath, global);
|
|
9065
9070
|
break;
|
|
9066
9071
|
case "codex":
|
|
9067
9072
|
registerCodex(binPath);
|
|
@@ -9074,12 +9079,12 @@ function registerMcp(agent) {
|
|
|
9074
9079
|
}
|
|
9075
9080
|
}
|
|
9076
9081
|
}
|
|
9077
|
-
function unregisterMcp(agent) {
|
|
9082
|
+
function unregisterMcp(agent, global) {
|
|
9078
9083
|
const agents = agent === "all" ? ["claude", "codex", "gemini"] : [agent];
|
|
9079
9084
|
for (const a of agents) {
|
|
9080
9085
|
switch (a) {
|
|
9081
9086
|
case "claude":
|
|
9082
|
-
unregisterClaude();
|
|
9087
|
+
unregisterClaude(global);
|
|
9083
9088
|
break;
|
|
9084
9089
|
case "codex":
|
|
9085
9090
|
unregisterCodex();
|