@beechcms/cms 0.8.0 → 0.8.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.
Files changed (4) hide show
  1. package/README.md +1 -0
  2. package/bin/cli.mjs +303 -303
  3. package/bin/create.mjs +391 -391
  4. package/package.json +11 -11
package/README.md ADDED
@@ -0,0 +1 @@
1
+ .github/README.md
package/bin/cli.mjs CHANGED
@@ -1,303 +1,303 @@
1
- #!/usr/bin/env node
2
- // @ts-check
3
-
4
- import pc from 'picocolors'
5
-
6
- let [,, command, ...args] = process.argv
7
-
8
- if (command && args[0] && ['db', 'seed', 'schema', 'dev', 'generate', 'mailpit'].includes(command)) {
9
- command = `${command}:${args.shift()}`
10
- }
11
-
12
- if (command === 'gen' && args[0] === 'types') {
13
- command = 'gen-types'
14
- args.shift()
15
- if (args[0] === 'typescript') {
16
- args.shift()
17
- }
18
- }
19
-
20
- const COMMANDS = {
21
- build: cmdBuild,
22
- 'seed:load': cmdSeedLoad,
23
- 'seed:create': cmdSeedCreate,
24
- 'schema:diff': cmdSchemaDiff,
25
- 'init': cmdInit,
26
- 'validate': cmdValidate,
27
- 'deploy': cmdDeploy,
28
- 'update': cmdUpdate,
29
- 'onboard': cmdOnboard,
30
- 'reset': cmdReset,
31
- 'forms': cmdForms,
32
- 'form': cmdForms,
33
- 'forms:add': cmdForms,
34
- 'gen-types': cmdGenerateTypes,
35
- 'gen:types': cmdGenerateTypes,
36
- 'generate:types': cmdGenerateTypes,
37
- // New unified command mappings:
38
- 'db:migrate': cmdDbMigrate,
39
- 'db:reset': cmdDbReset,
40
- 'dev': cmdDev,
41
- 'start': cmdDev,
42
- 'dev:stop': cmdDevStop,
43
- 'dev:reset': cmdDevReset,
44
- 'dev:tunnel': cmdDevTunnel,
45
- 'mailpit:clear': cmdMailpitClear,
46
- 'logs': cmdLogs,
47
- 'test': cmdTest,
48
- 'lint': cmdLint,
49
- 'doctor': cmdDoctor,
50
- 'setup:cloudflare': cmdSetupCloudflare,
51
- 'setup:cf': cmdSetupCloudflare,
52
- }
53
-
54
- function help() {
55
- console.log(`
56
- ${pc.cyan('beech')} <command> [options]
57
-
58
- ${pc.bold('1. Local Management & Onboarding')}
59
- ${pc.cyan('init')} Check project files and optionally initialise the database
60
- --db Also initialise the D1 database (system tables)
61
- --remote Target remote D1 instead of local (default: local)
62
- --db-name <n> Override D1 database name
63
- --yes, -y Run in non-interactive mode
64
- ${pc.cyan('onboard')} One-command local provisioning (init --db)
65
- --remote Target remote D1 instead of local (default: local)
66
- --yes, -y Skip all interactive prompts (non-interactive mode)
67
- --db <name> Override D1 database name
68
- ${pc.cyan('update')} Update internals to latest, then apply system D1 migrations
69
-
70
- ${pc.bold('2. Database & Migrations')}
71
- ${pc.cyan('db:migrate')} Apply all pending local migrations
72
- ${pc.cyan('db:reset')} Remove local Wrangler state and re-bootstrap database
73
-
74
- ${pc.bold('3. Database & Types Management')}
75
- ${pc.cyan('gen types typescript')} (alias: ${pc.cyan('gen-types')})
76
- Generate TypeScript interfaces from active D1 database
77
- --local Target local D1 SQLite state (default)
78
- --remote Target remote Cloudflare D1
79
- --db <name> Override D1 database name
80
- -o, --output Output file path (default: standard output)
81
- ${pc.cyan('validate')} Validate runtime schema status
82
-
83
- ${pc.bold('4. Forms & Frontend Generation')}
84
- ${pc.cyan('forms / form')} Interactive wizard to generate React, Vue, Svelte, or Web Component forms
85
- --framework <f> Framework: react, vue, svelte, vanilla
86
- --seed <slug> Seed slug to bind to (e.g. clienti)
87
- --mode <mode> styled (Tailwind) or headless
88
- --yes, -y Skip interactive prompts
89
-
90
- ${pc.bold('5. Local Stack & Docker')}
91
- ${pc.cyan('dev / start')} Start the local dev environment (Docker + API + Dashboard)
92
- --plain Avoid Ink visual TUI and run clean log streaming
93
- ${pc.cyan('dev:stop')} Stop Docker containers without wiping data
94
- ${pc.cyan('dev:reset')} Stop Docker containers and remove all persistent volumes
95
- ${pc.cyan('dev:tunnel')} Display Cloudflare tunnel public testing URL
96
- ${pc.cyan('mailpit:clear')} Clear local test inbox in Mailpit
97
-
98
- ${pc.bold('6. Logs Streaming')}
99
- ${pc.cyan('logs <service>')} Show streaming logs for docker service: mailpit, db, tunnel, storage
100
-
101
- ${pc.bold('7. Quality & Deployment')}
102
- ${pc.cyan('test')} Run the test suite via Turborepo / Vitest
103
- --coverage Generate coverage reports
104
- --diff Run test coverage only for files modified on the branch
105
- ${pc.cyan('lint')} Run ESLint quality checks
106
- ${pc.cyan('setup:cloudflare')} (alias: ${pc.cyan('setup:cf')})
107
- Interactive 1-step Cloudflare provisioning (D1, R2, Presigned S3 secrets)
108
- --name <n> Project name override
109
- --yes, -y Non-interactive mode
110
- ${pc.cyan('deploy')} Compile, test, deploy to Cloudflare environment
111
- --skip-check Skip /admin reachability check
112
- ${pc.cyan('doctor')} Execute React diagnostics check on Dashboard
113
- `)
114
- }
115
-
116
- function cmdBuild() {
117
- console.log(
118
- '\nNo build step needed for BeechCMS projects.\n' +
119
- 'Manage content types dynamically in the BeechCMS Dashboard at /admin.\n'
120
- )
121
- }
122
-
123
- async function cmdInit(args) {
124
- const initDb = args.includes('--db')
125
- const remote = args.includes('--remote')
126
- const dbIdx = args.indexOf('--db-name')
127
- const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
128
- const yes = args.includes('--yes') || args.includes('-y')
129
-
130
- const { init } = await import('@beechcms/cli')
131
- await init({ initDb, local: !remote, db, nonInteractive: yes })
132
- }
133
-
134
- async function cmdSeedLoad(_args) {
135
- const { seedLoad } = await import('@beechcms/cli')
136
- await seedLoad({})
137
- }
138
-
139
- async function cmdValidate(_args) {
140
- const { validate } = await import('@beechcms/cli')
141
- await validate({})
142
- }
143
-
144
- async function cmdSeedCreate(_args) {
145
- const { seedCreate } = await import('@beechcms/cli')
146
- await seedCreate({})
147
- }
148
-
149
- async function cmdDeploy(args) {
150
- const skipSeed = args.includes('--skip-seed')
151
- const skipCheck = args.includes('--skip-check')
152
- const { deploy } = await import('@beechcms/cli')
153
- await deploy({ skipSeed, skipCheck })
154
- }
155
-
156
- async function cmdUpdate(_args) {
157
- const { update } = await import('@beechcms/cli')
158
- await update({})
159
- }
160
-
161
- async function cmdOnboard(args) {
162
- const local = !args.includes('--remote')
163
- const yes = args.includes('--yes') || args.includes('-y')
164
- const dbIdx = args.indexOf('--db')
165
- const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
166
- const { onboard } = await import('@beechcms/cli')
167
- await onboard({ local, yes, db })
168
- }
169
-
170
- async function cmdReset(args) {
171
- const db = args.includes('--db')
172
- const docker = args.includes('--docker')
173
- const all = args.includes('--all')
174
- const yes = args.includes('--yes') || args.includes('-y')
175
-
176
- const { reset } = await import('@beechcms/cli')
177
- await reset({ db, docker, all, yes })
178
- }
179
-
180
- async function cmdSchemaDiff(args) {
181
- const remote = args.includes('--remote')
182
- const write = args.includes('--write')
183
- const nameIdx = args.indexOf('--name')
184
- const name = nameIdx !== -1 ? args[nameIdx + 1] : undefined
185
- const dbIdx = args.indexOf('--db')
186
- const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
187
- const { schemaDiff } = await import('@beechcms/cli')
188
- await schemaDiff({ local: !remote, write, name, db })
189
- }
190
-
191
- async function cmdGenerateTypes(args) {
192
- const remote = args.includes('--remote')
193
- const local = !remote
194
-
195
- let out = null
196
- const outIdx = args.indexOf('--out')
197
- const outputIdx = args.indexOf('--output')
198
- const oIdx = args.indexOf('-o')
199
-
200
- if (outIdx !== -1 && args[outIdx + 1]) out = args[outIdx + 1]
201
- else if (outputIdx !== -1 && args[outputIdx + 1]) out = args[outputIdx + 1]
202
- else if (oIdx !== -1 && args[oIdx + 1]) out = args[oIdx + 1]
203
-
204
- const dbIdx = args.indexOf('--db')
205
- const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
206
-
207
- const { generateTypes } = await import('@beechcms/cli')
208
- await generateTypes({ out, local, db })
209
- }
210
-
211
- async function cmdForms(args) {
212
- const yes = args.includes('--yes') || args.includes('-y')
213
- const json = args.includes('--json')
214
- const frameworkIdx = args.indexOf('--framework')
215
- const framework = frameworkIdx !== -1 ? args[frameworkIdx + 1] : undefined
216
- const seedIdx = args.indexOf('--seed')
217
- const seed = seedIdx !== -1 ? args[seedIdx + 1] : undefined
218
- const modeIdx = args.indexOf('--mode')
219
- const mode = modeIdx !== -1 ? args[modeIdx + 1] : undefined
220
- const outIdx = args.indexOf('--out')
221
- const out = outIdx !== -1 ? args[outIdx + 1] : undefined
222
-
223
- const { forms } = await import('@beechcms/cli')
224
- await forms({ framework, seed, mode, out, yes, json })
225
- }
226
-
227
- // New unified command wrappers:
228
- async function cmdDbMigrate(args) {
229
- const { dbMigrate } = await import('@beechcms/cli')
230
- await dbMigrate({})
231
- }
232
-
233
- async function cmdDbReset(args) {
234
- const { dbReset } = await import('@beechcms/cli')
235
- await dbReset({})
236
- }
237
-
238
- async function cmdDev(args) {
239
- const plain = args.includes('--plain')
240
- const { dev } = await import('@beechcms/cli')
241
- await dev({ plain })
242
- }
243
-
244
- async function cmdDevStop(args) {
245
- const { devStop } = await import('@beechcms/cli')
246
- await devStop()
247
- }
248
-
249
- async function cmdDevReset(args) {
250
- const { devReset } = await import('@beechcms/cli')
251
- await devReset()
252
- }
253
-
254
- async function cmdDevTunnel(args) {
255
- const { devTunnel } = await import('@beechcms/cli')
256
- await devTunnel()
257
- }
258
-
259
- async function cmdMailpitClear(args) {
260
- const { mailpitClear } = await import('@beechcms/cli')
261
- await mailpitClear()
262
- }
263
-
264
- async function cmdLogs(args) {
265
- const service = args[0]
266
- const { logs } = await import('@beechcms/cli')
267
- await logs({ service })
268
- }
269
-
270
- async function cmdTest(args) {
271
- const coverage = args.includes('--coverage')
272
- const diff = args.includes('--diff')
273
- const { test } = await import('@beechcms/cli')
274
- await test({ coverage, diff })
275
- }
276
-
277
- async function cmdLint(args) {
278
- const { lint } = await import('@beechcms/cli')
279
- await lint()
280
- }
281
-
282
- async function cmdDoctor(args) {
283
- const { doctor } = await import('@beechcms/cli')
284
- await doctor()
285
- }
286
-
287
- async function cmdSetupCloudflare(args) {
288
- const yes = args.includes('--yes') || args.includes('-y')
289
- const nameIdx = args.indexOf('--name')
290
- const projectName = nameIdx !== -1 ? args[nameIdx + 1] : undefined
291
- const { setupCloudflare } = await import('@beechcms/cli')
292
- await setupCloudflare({ projectName, nonInteractive: yes })
293
- }
294
-
295
- const handler = COMMANDS[command]
296
- if (!handler) {
297
- help()
298
- if (command && command !== '--help' && command !== '-h' && command !== 'help') process.exit(1)
299
- } else if (args.includes('--help') || args.includes('-h')) {
300
- help()
301
- } else {
302
- await handler(args)
303
- }
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+
4
+ import pc from 'picocolors'
5
+
6
+ let [,, command, ...args] = process.argv
7
+
8
+ if (command && args[0] && ['db', 'seed', 'schema', 'dev', 'generate', 'mailpit'].includes(command)) {
9
+ command = `${command}:${args.shift()}`
10
+ }
11
+
12
+ if (command === 'gen' && args[0] === 'types') {
13
+ command = 'gen-types'
14
+ args.shift()
15
+ if (args[0] === 'typescript') {
16
+ args.shift()
17
+ }
18
+ }
19
+
20
+ const COMMANDS = {
21
+ build: cmdBuild,
22
+ 'seed:load': cmdSeedLoad,
23
+ 'seed:create': cmdSeedCreate,
24
+ 'schema:diff': cmdSchemaDiff,
25
+ 'init': cmdInit,
26
+ 'validate': cmdValidate,
27
+ 'deploy': cmdDeploy,
28
+ 'update': cmdUpdate,
29
+ 'onboard': cmdOnboard,
30
+ 'reset': cmdReset,
31
+ 'forms': cmdForms,
32
+ 'form': cmdForms,
33
+ 'forms:add': cmdForms,
34
+ 'gen-types': cmdGenerateTypes,
35
+ 'gen:types': cmdGenerateTypes,
36
+ 'generate:types': cmdGenerateTypes,
37
+ // New unified command mappings:
38
+ 'db:migrate': cmdDbMigrate,
39
+ 'db:reset': cmdDbReset,
40
+ 'dev': cmdDev,
41
+ 'start': cmdDev,
42
+ 'dev:stop': cmdDevStop,
43
+ 'dev:reset': cmdDevReset,
44
+ 'dev:tunnel': cmdDevTunnel,
45
+ 'mailpit:clear': cmdMailpitClear,
46
+ 'logs': cmdLogs,
47
+ 'test': cmdTest,
48
+ 'lint': cmdLint,
49
+ 'doctor': cmdDoctor,
50
+ 'setup:cloudflare': cmdSetupCloudflare,
51
+ 'setup:cf': cmdSetupCloudflare,
52
+ }
53
+
54
+ function help() {
55
+ console.log(`
56
+ ${pc.cyan('beech')} <command> [options]
57
+
58
+ ${pc.bold('1. Local Management & Onboarding')}
59
+ ${pc.cyan('init')} Check project files and optionally initialise the database
60
+ --db Also initialise the D1 database (system tables)
61
+ --remote Target remote D1 instead of local (default: local)
62
+ --db-name <n> Override D1 database name
63
+ --yes, -y Run in non-interactive mode
64
+ ${pc.cyan('onboard')} One-command local provisioning (init --db)
65
+ --remote Target remote D1 instead of local (default: local)
66
+ --yes, -y Skip all interactive prompts (non-interactive mode)
67
+ --db <name> Override D1 database name
68
+ ${pc.cyan('update')} Update internals to latest, then apply system D1 migrations
69
+
70
+ ${pc.bold('2. Database & Migrations')}
71
+ ${pc.cyan('db:migrate')} Apply all pending local migrations
72
+ ${pc.cyan('db:reset')} Remove local Wrangler state and re-bootstrap database
73
+
74
+ ${pc.bold('3. Database & Types Management')}
75
+ ${pc.cyan('gen types typescript')} (alias: ${pc.cyan('gen-types')})
76
+ Generate TypeScript interfaces from active D1 database
77
+ --local Target local D1 SQLite state (default)
78
+ --remote Target remote Cloudflare D1
79
+ --db <name> Override D1 database name
80
+ -o, --output Output file path (default: standard output)
81
+ ${pc.cyan('validate')} Validate runtime schema status
82
+
83
+ ${pc.bold('4. Forms & Frontend Generation')}
84
+ ${pc.cyan('forms / form')} Interactive wizard to generate React, Vue, Svelte, or Web Component forms
85
+ --framework <f> Framework: react, vue, svelte, vanilla
86
+ --seed <slug> Seed slug to bind to (e.g. clienti)
87
+ --mode <mode> styled (Tailwind) or headless
88
+ --yes, -y Skip interactive prompts
89
+
90
+ ${pc.bold('5. Local Stack & Docker')}
91
+ ${pc.cyan('dev / start')} Start the local dev environment (Docker + API + Dashboard)
92
+ --plain Avoid Ink visual TUI and run clean log streaming
93
+ ${pc.cyan('dev:stop')} Stop Docker containers without wiping data
94
+ ${pc.cyan('dev:reset')} Stop Docker containers and remove all persistent volumes
95
+ ${pc.cyan('dev:tunnel')} Display Cloudflare tunnel public testing URL
96
+ ${pc.cyan('mailpit:clear')} Clear local test inbox in Mailpit
97
+
98
+ ${pc.bold('6. Logs Streaming')}
99
+ ${pc.cyan('logs <service>')} Show streaming logs for docker service: mailpit, db, tunnel, storage
100
+
101
+ ${pc.bold('7. Quality & Deployment')}
102
+ ${pc.cyan('test')} Run the test suite via Turborepo / Vitest
103
+ --coverage Generate coverage reports
104
+ --diff Run test coverage only for files modified on the branch
105
+ ${pc.cyan('lint')} Run ESLint quality checks
106
+ ${pc.cyan('setup:cloudflare')} (alias: ${pc.cyan('setup:cf')})
107
+ Interactive 1-step Cloudflare provisioning (D1, R2, Presigned S3 secrets)
108
+ --name <n> Project name override
109
+ --yes, -y Non-interactive mode
110
+ ${pc.cyan('deploy')} Compile, test, deploy to Cloudflare environment
111
+ --skip-check Skip /admin reachability check
112
+ ${pc.cyan('doctor')} Execute React diagnostics check on Dashboard
113
+ `)
114
+ }
115
+
116
+ function cmdBuild() {
117
+ console.log(
118
+ '\nNo build step needed for BeechCMS projects.\n' +
119
+ 'Manage content types dynamically in the BeechCMS Dashboard at /admin.\n'
120
+ )
121
+ }
122
+
123
+ async function cmdInit(args) {
124
+ const initDb = args.includes('--db')
125
+ const remote = args.includes('--remote')
126
+ const dbIdx = args.indexOf('--db-name')
127
+ const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
128
+ const yes = args.includes('--yes') || args.includes('-y')
129
+
130
+ const { init } = await import('@beechcms/cli')
131
+ await init({ initDb, local: !remote, db, nonInteractive: yes })
132
+ }
133
+
134
+ async function cmdSeedLoad(_args) {
135
+ const { seedLoad } = await import('@beechcms/cli')
136
+ await seedLoad({})
137
+ }
138
+
139
+ async function cmdValidate(_args) {
140
+ const { validate } = await import('@beechcms/cli')
141
+ await validate({})
142
+ }
143
+
144
+ async function cmdSeedCreate(_args) {
145
+ const { seedCreate } = await import('@beechcms/cli')
146
+ await seedCreate({})
147
+ }
148
+
149
+ async function cmdDeploy(args) {
150
+ const skipSeed = args.includes('--skip-seed')
151
+ const skipCheck = args.includes('--skip-check')
152
+ const { deploy } = await import('@beechcms/cli')
153
+ await deploy({ skipSeed, skipCheck })
154
+ }
155
+
156
+ async function cmdUpdate(_args) {
157
+ const { update } = await import('@beechcms/cli')
158
+ await update({})
159
+ }
160
+
161
+ async function cmdOnboard(args) {
162
+ const local = !args.includes('--remote')
163
+ const yes = args.includes('--yes') || args.includes('-y')
164
+ const dbIdx = args.indexOf('--db')
165
+ const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
166
+ const { onboard } = await import('@beechcms/cli')
167
+ await onboard({ local, yes, db })
168
+ }
169
+
170
+ async function cmdReset(args) {
171
+ const db = args.includes('--db')
172
+ const docker = args.includes('--docker')
173
+ const all = args.includes('--all')
174
+ const yes = args.includes('--yes') || args.includes('-y')
175
+
176
+ const { reset } = await import('@beechcms/cli')
177
+ await reset({ db, docker, all, yes })
178
+ }
179
+
180
+ async function cmdSchemaDiff(args) {
181
+ const remote = args.includes('--remote')
182
+ const write = args.includes('--write')
183
+ const nameIdx = args.indexOf('--name')
184
+ const name = nameIdx !== -1 ? args[nameIdx + 1] : undefined
185
+ const dbIdx = args.indexOf('--db')
186
+ const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
187
+ const { schemaDiff } = await import('@beechcms/cli')
188
+ await schemaDiff({ local: !remote, write, name, db })
189
+ }
190
+
191
+ async function cmdGenerateTypes(args) {
192
+ const remote = args.includes('--remote')
193
+ const local = !remote
194
+
195
+ let out = null
196
+ const outIdx = args.indexOf('--out')
197
+ const outputIdx = args.indexOf('--output')
198
+ const oIdx = args.indexOf('-o')
199
+
200
+ if (outIdx !== -1 && args[outIdx + 1]) out = args[outIdx + 1]
201
+ else if (outputIdx !== -1 && args[outputIdx + 1]) out = args[outputIdx + 1]
202
+ else if (oIdx !== -1 && args[oIdx + 1]) out = args[oIdx + 1]
203
+
204
+ const dbIdx = args.indexOf('--db')
205
+ const db = dbIdx !== -1 ? args[dbIdx + 1] : undefined
206
+
207
+ const { generateTypes } = await import('@beechcms/cli')
208
+ await generateTypes({ out, local, db })
209
+ }
210
+
211
+ async function cmdForms(args) {
212
+ const yes = args.includes('--yes') || args.includes('-y')
213
+ const json = args.includes('--json')
214
+ const frameworkIdx = args.indexOf('--framework')
215
+ const framework = frameworkIdx !== -1 ? args[frameworkIdx + 1] : undefined
216
+ const seedIdx = args.indexOf('--seed')
217
+ const seed = seedIdx !== -1 ? args[seedIdx + 1] : undefined
218
+ const modeIdx = args.indexOf('--mode')
219
+ const mode = modeIdx !== -1 ? args[modeIdx + 1] : undefined
220
+ const outIdx = args.indexOf('--out')
221
+ const out = outIdx !== -1 ? args[outIdx + 1] : undefined
222
+
223
+ const { forms } = await import('@beechcms/cli')
224
+ await forms({ framework, seed, mode, out, yes, json })
225
+ }
226
+
227
+ // New unified command wrappers:
228
+ async function cmdDbMigrate(args) {
229
+ const { dbMigrate } = await import('@beechcms/cli')
230
+ await dbMigrate({})
231
+ }
232
+
233
+ async function cmdDbReset(args) {
234
+ const { dbReset } = await import('@beechcms/cli')
235
+ await dbReset({})
236
+ }
237
+
238
+ async function cmdDev(args) {
239
+ const plain = args.includes('--plain')
240
+ const { dev } = await import('@beechcms/cli')
241
+ await dev({ plain })
242
+ }
243
+
244
+ async function cmdDevStop(args) {
245
+ const { devStop } = await import('@beechcms/cli')
246
+ await devStop()
247
+ }
248
+
249
+ async function cmdDevReset(args) {
250
+ const { devReset } = await import('@beechcms/cli')
251
+ await devReset()
252
+ }
253
+
254
+ async function cmdDevTunnel(args) {
255
+ const { devTunnel } = await import('@beechcms/cli')
256
+ await devTunnel()
257
+ }
258
+
259
+ async function cmdMailpitClear(args) {
260
+ const { mailpitClear } = await import('@beechcms/cli')
261
+ await mailpitClear()
262
+ }
263
+
264
+ async function cmdLogs(args) {
265
+ const service = args[0]
266
+ const { logs } = await import('@beechcms/cli')
267
+ await logs({ service })
268
+ }
269
+
270
+ async function cmdTest(args) {
271
+ const coverage = args.includes('--coverage')
272
+ const diff = args.includes('--diff')
273
+ const { test } = await import('@beechcms/cli')
274
+ await test({ coverage, diff })
275
+ }
276
+
277
+ async function cmdLint(args) {
278
+ const { lint } = await import('@beechcms/cli')
279
+ await lint()
280
+ }
281
+
282
+ async function cmdDoctor(args) {
283
+ const { doctor } = await import('@beechcms/cli')
284
+ await doctor()
285
+ }
286
+
287
+ async function cmdSetupCloudflare(args) {
288
+ const yes = args.includes('--yes') || args.includes('-y')
289
+ const nameIdx = args.indexOf('--name')
290
+ const projectName = nameIdx !== -1 ? args[nameIdx + 1] : undefined
291
+ const { setupCloudflare } = await import('@beechcms/cli')
292
+ await setupCloudflare({ projectName, nonInteractive: yes })
293
+ }
294
+
295
+ const handler = COMMANDS[command]
296
+ if (!handler) {
297
+ help()
298
+ if (command && command !== '--help' && command !== '-h' && command !== 'help') process.exit(1)
299
+ } else if (args.includes('--help') || args.includes('-h')) {
300
+ help()
301
+ } else {
302
+ await handler(args)
303
+ }