@forcefield/mcp-server 0.1.0 → 0.1.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/README.md +22 -6
- package/build/chunk-4L46G65Q.js +1229 -0
- package/build/chunk-4L46G65Q.js.map +1 -0
- package/build/chunk-6YANB5QT.js +15 -0
- package/build/chunk-6YANB5QT.js.map +1 -0
- package/build/chunk-7XLGRGP6.js +9161 -0
- package/build/chunk-7XLGRGP6.js.map +1 -0
- package/build/cli/index.js +73 -0
- package/build/cli/index.js.map +1 -0
- package/build/index.js +6 -9142
- package/build/index.js.map +1 -1
- package/build/setup/index.js +7 -1040
- package/build/setup/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runMcpCli
|
|
4
|
+
} from "../chunk-7XLGRGP6.js";
|
|
5
|
+
import {
|
|
6
|
+
runSetupCli
|
|
7
|
+
} from "../chunk-4L46G65Q.js";
|
|
8
|
+
import "../chunk-6YANB5QT.js";
|
|
9
|
+
|
|
10
|
+
// cli/index.ts
|
|
11
|
+
import { pathToFileURL } from "url";
|
|
12
|
+
function parseForcefieldCommand(argv) {
|
|
13
|
+
const cmd = argv[2];
|
|
14
|
+
const rest = argv.slice(3);
|
|
15
|
+
if (!cmd || cmd === "setup") return { command: "setup", rest };
|
|
16
|
+
if (cmd === "doctor") return { command: "doctor", rest };
|
|
17
|
+
if (cmd === "status") return { command: "status", rest };
|
|
18
|
+
if (cmd === "mcp") return { command: "mcp", rest };
|
|
19
|
+
if (cmd === "help" || cmd === "--help" || cmd === "-h") return { command: "help", rest };
|
|
20
|
+
return { command: "help", rest: [cmd, ...rest] };
|
|
21
|
+
}
|
|
22
|
+
function printUsage() {
|
|
23
|
+
console.log(
|
|
24
|
+
[
|
|
25
|
+
"Forcefield CLI",
|
|
26
|
+
"",
|
|
27
|
+
"Usage:",
|
|
28
|
+
" forcefield setup Run interactive setup wizard",
|
|
29
|
+
" forcefield doctor Validate setup + MCP connectivity",
|
|
30
|
+
" forcefield status Show setup status in current project",
|
|
31
|
+
" forcefield mcp Start MCP server process (stdio)",
|
|
32
|
+
" forcefield help Show this help",
|
|
33
|
+
"",
|
|
34
|
+
"One-off without global install:",
|
|
35
|
+
" npx -y forcefield setup",
|
|
36
|
+
"",
|
|
37
|
+
"Direct runtime package path (equivalent):",
|
|
38
|
+
" npx -y -p @forcefield/mcp-server forcefield setup"
|
|
39
|
+
].join("\n")
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
async function runForcefieldCli(argv = process.argv) {
|
|
43
|
+
const { command, rest } = parseForcefieldCommand(argv);
|
|
44
|
+
if (command === "help") {
|
|
45
|
+
printUsage();
|
|
46
|
+
if (rest.length > 0) {
|
|
47
|
+
process.exitCode = 1;
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (command === "mcp") {
|
|
52
|
+
await runMcpCli();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const setupArgv = ["node", "forcefield-setup"];
|
|
56
|
+
if (command === "doctor") setupArgv.push("--doctor");
|
|
57
|
+
if (command === "status") setupArgv.push("--status");
|
|
58
|
+
setupArgv.push(...rest);
|
|
59
|
+
await runSetupCli(setupArgv);
|
|
60
|
+
}
|
|
61
|
+
function isExecutedDirectly(metaUrl) {
|
|
62
|
+
const entryPath = process.argv[1];
|
|
63
|
+
if (!entryPath) return false;
|
|
64
|
+
return metaUrl === pathToFileURL(entryPath).href;
|
|
65
|
+
}
|
|
66
|
+
if (isExecutedDirectly(import.meta.url)) {
|
|
67
|
+
void runForcefieldCli();
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
parseForcefieldCommand,
|
|
71
|
+
runForcefieldCli
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../cli/index.ts"],"sourcesContent":["/**\n * Unified Forcefield CLI entrypoint.\n *\n * Gives users a single command surface:\n * forcefield setup\n * forcefield doctor\n * forcefield status\n * forcefield mcp\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { runSetupCli } from '../setup/index.js';\nimport { runMcpCli } from '../src/index.js';\n\ntype ForcefieldCommand = 'setup' | 'doctor' | 'status' | 'mcp' | 'help';\n\nexport function parseForcefieldCommand(argv: string[]): { command: ForcefieldCommand; rest: string[] } {\n const cmd = argv[2];\n const rest = argv.slice(3);\n\n if (!cmd || cmd === 'setup') return { command: 'setup', rest };\n if (cmd === 'doctor') return { command: 'doctor', rest };\n if (cmd === 'status') return { command: 'status', rest };\n if (cmd === 'mcp') return { command: 'mcp', rest };\n if (cmd === 'help' || cmd === '--help' || cmd === '-h') return { command: 'help', rest };\n\n return { command: 'help', rest: [cmd, ...rest] };\n}\n\nfunction printUsage(): void {\n console.log(\n [\n 'Forcefield CLI',\n '',\n 'Usage:',\n ' forcefield setup Run interactive setup wizard',\n ' forcefield doctor Validate setup + MCP connectivity',\n ' forcefield status Show setup status in current project',\n ' forcefield mcp Start MCP server process (stdio)',\n ' forcefield help Show this help',\n '',\n 'One-off without global install:',\n ' npx -y forcefield setup',\n '',\n 'Direct runtime package path (equivalent):',\n ' npx -y -p @forcefield/mcp-server forcefield setup',\n ].join('\\n'),\n );\n}\n\nexport async function runForcefieldCli(argv: string[] = process.argv): Promise<void> {\n const { command, rest } = parseForcefieldCommand(argv);\n\n if (command === 'help') {\n printUsage();\n if (rest.length > 0) {\n process.exitCode = 1;\n }\n return;\n }\n\n if (command === 'mcp') {\n await runMcpCli();\n return;\n }\n\n const setupArgv = ['node', 'forcefield-setup'];\n if (command === 'doctor') setupArgv.push('--doctor');\n if (command === 'status') setupArgv.push('--status');\n setupArgv.push(...rest);\n await runSetupCli(setupArgv);\n}\n\nfunction isExecutedDirectly(metaUrl: string): boolean {\n const entryPath = process.argv[1];\n if (!entryPath) return false;\n return metaUr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