@webhouse/cms-cli 0.1.3 → 0.2.1
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/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -2428,11 +2428,22 @@ import { join, resolve } from "path";
|
|
|
2428
2428
|
// src/utils/logger.ts
|
|
2429
2429
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
2430
2430
|
var logger = {
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2431
|
+
silent: false,
|
|
2432
|
+
info: (msg) => {
|
|
2433
|
+
if (!logger.silent) console.log(import_picocolors.default.blue("i"), msg);
|
|
2434
|
+
},
|
|
2435
|
+
success: (msg) => {
|
|
2436
|
+
if (!logger.silent) console.log(import_picocolors.default.green("\u2713"), msg);
|
|
2437
|
+
},
|
|
2438
|
+
warn: (msg) => {
|
|
2439
|
+
if (!logger.silent) console.log(import_picocolors.default.yellow("!"), msg);
|
|
2440
|
+
},
|
|
2441
|
+
error: (msg) => {
|
|
2442
|
+
if (!logger.silent) console.error(import_picocolors.default.red("x"), msg);
|
|
2443
|
+
},
|
|
2444
|
+
log: (msg) => {
|
|
2445
|
+
if (!logger.silent) console.log(msg);
|
|
2446
|
+
}
|
|
2436
2447
|
};
|
|
2437
2448
|
|
|
2438
2449
|
// src/commands/init.ts
|
|
@@ -2907,6 +2918,30 @@ async function mcpStatusCommand(args) {
|
|
|
2907
2918
|
}
|
|
2908
2919
|
}
|
|
2909
2920
|
|
|
2921
|
+
// src/commands/mcp-serve.ts
|
|
2922
|
+
async function mcpServeCommand(args) {
|
|
2923
|
+
const cwd = args.cwd ?? process.cwd();
|
|
2924
|
+
logger.silent = true;
|
|
2925
|
+
try {
|
|
2926
|
+
const config = await loadConfig(cwd);
|
|
2927
|
+
const { createCms } = await import("@webhouse/cms");
|
|
2928
|
+
const cms = await createCms(config);
|
|
2929
|
+
const { createPublicMcpServer } = await import("@webhouse/cms-mcp-client");
|
|
2930
|
+
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
2931
|
+
const server = createPublicMcpServer(cms.content, config);
|
|
2932
|
+
const transport = new StdioServerTransport();
|
|
2933
|
+
await server.connect(transport);
|
|
2934
|
+
process.stdin.on("end", async () => {
|
|
2935
|
+
await cms.storage.close();
|
|
2936
|
+
process.exit(0);
|
|
2937
|
+
});
|
|
2938
|
+
} catch (err) {
|
|
2939
|
+
process.stderr.write(`CMS MCP server error: ${err.message}
|
|
2940
|
+
`);
|
|
2941
|
+
process.exit(1);
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2910
2945
|
// src/index.ts
|
|
2911
2946
|
var envPath = resolve3(process.cwd(), ".env");
|
|
2912
2947
|
if (existsSync4(envPath)) {
|
|
@@ -3030,9 +3065,15 @@ var mcpStatus = defineCommand({
|
|
|
3030
3065
|
await mcpStatusCommand({ endpoint: args.endpoint });
|
|
3031
3066
|
}
|
|
3032
3067
|
});
|
|
3068
|
+
var mcpServe = defineCommand({
|
|
3069
|
+
meta: { name: "serve", description: "Start stdio MCP server (for Claude Code / .mcp.json)" },
|
|
3070
|
+
async run() {
|
|
3071
|
+
await mcpServeCommand({});
|
|
3072
|
+
}
|
|
3073
|
+
});
|
|
3033
3074
|
var mcp = defineCommand({
|
|
3034
3075
|
meta: { name: "mcp", description: "MCP server management" },
|
|
3035
|
-
subCommands: { keygen: mcpKeygen, test: mcpTest, status: mcpStatus }
|
|
3076
|
+
subCommands: { serve: mcpServe, keygen: mcpKeygen, test: mcpTest, status: mcpStatus }
|
|
3036
3077
|
});
|
|
3037
3078
|
var main = defineCommand({
|
|
3038
3079
|
meta: {
|