@webhouse/cms-cli 0.1.2 → 0.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/README.md +24 -12
- package/dist/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -5,16 +5,19 @@ CLI for [@webhouse/cms](https://github.com/webhousecode/cms) — scaffold projec
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
# 1.
|
|
8
|
+
# 1. Install the CLI globally
|
|
9
|
+
npm install -g @webhouse/cms-cli
|
|
10
|
+
|
|
11
|
+
# 2. Create a new project
|
|
9
12
|
npm create @webhouse/cms my-site
|
|
10
13
|
cd my-site
|
|
11
14
|
npm install
|
|
12
15
|
|
|
13
|
-
#
|
|
16
|
+
# 3. Add your AI key (optional, for AI content generation)
|
|
14
17
|
echo "ANTHROPIC_API_KEY=sk-ant-..." >> .env
|
|
15
18
|
|
|
16
|
-
#
|
|
17
|
-
|
|
19
|
+
# 4. Start developing
|
|
20
|
+
cms dev
|
|
18
21
|
```
|
|
19
22
|
|
|
20
23
|
Your site is running at `http://localhost:3000` with a full REST API.
|
|
@@ -81,7 +84,7 @@ curl -X POST http://localhost:3000/api/content/posts \
|
|
|
81
84
|
|
|
82
85
|
**B) Via AI generation** (from terminal)
|
|
83
86
|
```bash
|
|
84
|
-
|
|
87
|
+
cms ai generate posts "Write a blog post about TypeScript best practices"
|
|
85
88
|
```
|
|
86
89
|
|
|
87
90
|
**C) Via Claude Code** (AI-assisted development)
|
|
@@ -95,7 +98,7 @@ Claude Code will edit `cms.config.ts`, call the API to create content, and verif
|
|
|
95
98
|
### Step 4: Build & deploy
|
|
96
99
|
|
|
97
100
|
```bash
|
|
98
|
-
|
|
101
|
+
cms build # Generates static HTML, sitemap, llms.txt
|
|
99
102
|
```
|
|
100
103
|
|
|
101
104
|
Output goes to `dist/` — deploy anywhere (Fly.io, Vercel, Cloudflare Pages, etc.)
|
|
@@ -116,13 +119,13 @@ Claude: I'll set up the project for you.
|
|
|
116
119
|
You: Create a blog post about AI-native CMS
|
|
117
120
|
|
|
118
121
|
Claude: I'll use the AI content generator.
|
|
119
|
-
[runs:
|
|
122
|
+
[runs: cms ai generate posts "Write about AI-native CMS"]
|
|
120
123
|
✓ Created: why-ai-native-cms-is-the-future
|
|
121
124
|
Cost: $0.0096 | Tokens: 195 in / 602 out
|
|
122
125
|
|
|
123
126
|
You: Build it
|
|
124
127
|
|
|
125
|
-
Claude: [runs:
|
|
128
|
+
Claude: [runs: cms build]
|
|
126
129
|
✓ Build complete — 6 pages in dist/
|
|
127
130
|
```
|
|
128
131
|
|
|
@@ -155,14 +158,23 @@ At least one AI key is required for `cms ai` commands. Anthropic is used by defa
|
|
|
155
158
|
## Installation
|
|
156
159
|
|
|
157
160
|
```bash
|
|
158
|
-
# Global install
|
|
161
|
+
# Global install (recommended) — gives you the `cms` command directly
|
|
159
162
|
npm install -g @webhouse/cms-cli
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
cms --version
|
|
165
|
+
cms dev
|
|
166
|
+
cms ai generate posts "..."
|
|
167
|
+
```
|
|
163
168
|
|
|
164
|
-
|
|
169
|
+
> **Note:** Do not use `npx cms` — npm will resolve it to an unrelated package called `cms`.
|
|
170
|
+
> Use `npx @webhouse/cms-cli` if you prefer not to install globally, or install as a project dependency.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# As a project dependency (added automatically by `npm create @webhouse/cms`)
|
|
165
174
|
npm install @webhouse/cms-cli
|
|
175
|
+
|
|
176
|
+
# Then use via npx within the project
|
|
177
|
+
npx @webhouse/cms-cli dev
|
|
166
178
|
```
|
|
167
179
|
|
|
168
180
|
## Documentation
|
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: {
|