thetoolforthat 1.1.0 → 1.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/cli.js +73 -106
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -1,137 +1,106 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { program } from "commander";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { spawn } from "child_process";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
import { dirname } from "path";
|
|
10
|
-
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
|
|
14
|
-
const CONFIG_PATHS = {
|
|
15
|
-
claude: join(homedir(), ".claude", "settings.json"),
|
|
16
|
-
cursor: join(process.cwd(), ".cursor", "mcp.json"),
|
|
17
|
-
vscode: join(process.cwd(), ".vscode", "mcp.json"),
|
|
18
|
-
codex: join(homedir(), ".codex", "config.toml"),
|
|
19
|
-
opencode: join(homedir(), ".opencode", "mcp.json"),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const MCP_CONFIG = {
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
|
|
6
|
+
const MCP_CONFIG = JSON.stringify({
|
|
23
7
|
command: "npx",
|
|
24
8
|
args: ["thetoolforthat", "mcp"],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function ensureDir(filePath) {
|
|
28
|
-
const dir = dirname(filePath);
|
|
29
|
-
if (!existsSync(dir)) {
|
|
30
|
-
mkdirSync(dir, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
9
|
+
});
|
|
33
10
|
|
|
34
|
-
function
|
|
35
|
-
if (!existsSync(path)) {
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
11
|
+
function runCommand(cmd) {
|
|
38
12
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
execSync(cmd, { stdio: "inherit" });
|
|
14
|
+
return true;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
return false;
|
|
42
17
|
}
|
|
43
18
|
}
|
|
44
19
|
|
|
45
|
-
function writeJsonConfig(path, config) {
|
|
46
|
-
ensureDir(path);
|
|
47
|
-
writeFileSync(path, JSON.stringify(config, null, 2) + "\n");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
20
|
function initClaude() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
21
|
+
console.log("Adding thetoolforthat to Claude Code...\n");
|
|
22
|
+
|
|
23
|
+
// Use claude mcp add-json with user scope
|
|
24
|
+
const success = runCommand(
|
|
25
|
+
`claude mcp add-json --scope user thetoolforthat '${MCP_CONFIG}'`
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (success) {
|
|
29
|
+
console.log("\n✓ Added thetoolforthat MCP server");
|
|
30
|
+
console.log("\nRestart Claude Code and try:");
|
|
31
|
+
console.log(" - Search for animation libraries");
|
|
32
|
+
console.log(" - Recommend tools for building a SaaS dashboard");
|
|
33
|
+
console.log(" - List all design agencies");
|
|
34
|
+
} else {
|
|
35
|
+
console.error("\nFailed to add MCP server. Try manually:");
|
|
36
|
+
console.log(`\nclaude mcp add-json --scope user thetoolforthat '${MCP_CONFIG}'`);
|
|
56
37
|
}
|
|
57
|
-
|
|
58
|
-
config.mcpServers.thetoolforthat = MCP_CONFIG;
|
|
59
|
-
|
|
60
|
-
writeJsonConfig(configPath, config);
|
|
61
|
-
console.log(`✓ Added thetoolforthat to ${configPath}`);
|
|
62
|
-
console.log("\nRestart Claude Code and try:");
|
|
63
|
-
console.log(" - Search for animation libraries");
|
|
64
|
-
console.log(" - Recommend tools for building a SaaS dashboard");
|
|
65
|
-
console.log(" - List all design agencies");
|
|
66
38
|
}
|
|
67
39
|
|
|
68
40
|
function initCursor() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
console.log("
|
|
81
|
-
console.log(
|
|
82
|
-
console.log("
|
|
83
|
-
console.log(" - Recommend tools for building a SaaS dashboard");
|
|
41
|
+
console.log("Adding thetoolforthat to Cursor...\n");
|
|
42
|
+
|
|
43
|
+
const config = {
|
|
44
|
+
mcpServers: {
|
|
45
|
+
thetoolforthat: {
|
|
46
|
+
command: "npx",
|
|
47
|
+
args: ["thetoolforthat", "mcp"],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
console.log("Add this to .cursor/mcp.json in your project:\n");
|
|
53
|
+
console.log(JSON.stringify(config, null, 2));
|
|
54
|
+
console.log("\nThen open Cursor Settings and enable the MCP server.");
|
|
84
55
|
}
|
|
85
56
|
|
|
86
57
|
function initVscode() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
console.log("
|
|
99
|
-
console.log(
|
|
100
|
-
console.log("
|
|
101
|
-
console.log(" - Recommend tools for building a SaaS dashboard");
|
|
58
|
+
console.log("Adding thetoolforthat to VS Code...\n");
|
|
59
|
+
|
|
60
|
+
const config = {
|
|
61
|
+
servers: {
|
|
62
|
+
thetoolforthat: {
|
|
63
|
+
command: "npx",
|
|
64
|
+
args: ["thetoolforthat", "mcp"],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
console.log("Add this to .vscode/mcp.json in your project:\n");
|
|
70
|
+
console.log(JSON.stringify(config, null, 2));
|
|
71
|
+
console.log("\nThen click Start next to thetoolforthat in the MCP panel.");
|
|
102
72
|
}
|
|
103
73
|
|
|
104
74
|
function initCodex() {
|
|
105
|
-
console.log(
|
|
75
|
+
console.log("Adding thetoolforthat to Codex...\n");
|
|
76
|
+
console.log("Add this to ~/.codex/config.toml:\n");
|
|
106
77
|
console.log(`[mcp_servers.thetoolforthat]`);
|
|
107
78
|
console.log(`command = "npx"`);
|
|
108
79
|
console.log(`args = ["thetoolforthat", "mcp"]`);
|
|
109
|
-
console.log("\nThen restart Codex
|
|
110
|
-
console.log(" - Search for animation libraries");
|
|
111
|
-
console.log(" - Recommend tools for building a SaaS dashboard");
|
|
80
|
+
console.log("\nThen restart Codex.");
|
|
112
81
|
}
|
|
113
82
|
|
|
114
83
|
function initOpencode() {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
console.log("
|
|
127
|
-
console.log(
|
|
128
|
-
console.log("
|
|
84
|
+
console.log("Adding thetoolforthat to OpenCode...\n");
|
|
85
|
+
|
|
86
|
+
const config = {
|
|
87
|
+
mcpServers: {
|
|
88
|
+
thetoolforthat: {
|
|
89
|
+
command: "npx",
|
|
90
|
+
args: ["thetoolforthat", "mcp"],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
console.log("Add this to ~/.opencode/mcp.json:\n");
|
|
96
|
+
console.log(JSON.stringify(config, null, 2));
|
|
97
|
+
console.log("\nThen restart OpenCode.");
|
|
129
98
|
}
|
|
130
99
|
|
|
131
100
|
program
|
|
132
101
|
.name("thetoolforthat")
|
|
133
102
|
.description("Curated tools, resources, and agencies for builders")
|
|
134
|
-
.version("1.
|
|
103
|
+
.version("1.2.0");
|
|
135
104
|
|
|
136
105
|
program
|
|
137
106
|
.command("init")
|
|
@@ -141,8 +110,8 @@ program
|
|
|
141
110
|
const client = options.client?.toLowerCase();
|
|
142
111
|
|
|
143
112
|
if (!client) {
|
|
144
|
-
console.log("Available clients: claude, cursor, vscode, codex, opencode");
|
|
145
|
-
console.log("
|
|
113
|
+
console.log("Available clients: claude, cursor, vscode, codex, opencode\n");
|
|
114
|
+
console.log("Usage: npx thetoolforthat init --client <client>");
|
|
146
115
|
console.log("Example: npx thetoolforthat init --client claude");
|
|
147
116
|
return;
|
|
148
117
|
}
|
|
@@ -174,11 +143,9 @@ program
|
|
|
174
143
|
.command("mcp")
|
|
175
144
|
.description("Start the MCP server")
|
|
176
145
|
.action(async () => {
|
|
177
|
-
// Import and run the server
|
|
178
146
|
await import("./server.js");
|
|
179
147
|
});
|
|
180
148
|
|
|
181
|
-
// Default command (no args) - show help
|
|
182
149
|
program.action(() => {
|
|
183
150
|
program.help();
|
|
184
151
|
});
|