@quickback-dev/cli 0.9.5
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 +7 -0
- package/dist/commands/claude.d.ts +13 -0
- package/dist/commands/claude.d.ts.map +1 -0
- package/dist/commands/claude.js +305 -0
- package/dist/commands/claude.js.map +1 -0
- package/dist/commands/compile.d.ts +18 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +326 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/create.d.ts +18 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +798 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/cursor.d.ts +11 -0
- package/dist/commands/cursor.d.ts.map +1 -0
- package/dist/commands/cursor.js +156 -0
- package/dist/commands/cursor.js.map +1 -0
- package/dist/commands/docs.d.ts +10 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +93 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/example.d.ts +7 -0
- package/dist/commands/example.d.ts.map +1 -0
- package/dist/commands/example.js +153 -0
- package/dist/commands/example.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +383 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +16 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +287 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +19 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/mcp.d.ts +21 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +331 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/whoami.d.ts +7 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +37 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/cursor/quickback.mdc +277 -0
- package/dist/docs/content.d.ts +7 -0
- package/dist/docs/content.d.ts.map +1 -0
- package/dist/docs/content.js +577 -0
- package/dist/docs/content.js.map +1 -0
- package/dist/examples/recruitment.tar.gz +0 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +188 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api-client.d.ts +103 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +231 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/api-client.test.d.ts +2 -0
- package/dist/lib/api-client.test.d.ts.map +1 -0
- package/dist/lib/api-client.test.js +133 -0
- package/dist/lib/api-client.test.js.map +1 -0
- package/dist/lib/artifact-routing.d.ts +8 -0
- package/dist/lib/artifact-routing.d.ts.map +1 -0
- package/dist/lib/artifact-routing.js +34 -0
- package/dist/lib/artifact-routing.js.map +1 -0
- package/dist/lib/artifact-routing.test.d.ts +2 -0
- package/dist/lib/artifact-routing.test.d.ts.map +1 -0
- package/dist/lib/artifact-routing.test.js +37 -0
- package/dist/lib/artifact-routing.test.js.map +1 -0
- package/dist/lib/async-utils.d.ts +6 -0
- package/dist/lib/async-utils.d.ts.map +1 -0
- package/dist/lib/async-utils.js +26 -0
- package/dist/lib/async-utils.js.map +1 -0
- package/dist/lib/auth.d.ts +55 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +102 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/compiler-stubs.d.ts +108 -0
- package/dist/lib/compiler-stubs.d.ts.map +1 -0
- package/dist/lib/compiler-stubs.js +142 -0
- package/dist/lib/compiler-stubs.js.map +1 -0
- package/dist/lib/drizzle-meta-routing.test.d.ts +2 -0
- package/dist/lib/drizzle-meta-routing.test.d.ts.map +1 -0
- package/dist/lib/drizzle-meta-routing.test.js +123 -0
- package/dist/lib/drizzle-meta-routing.test.js.map +1 -0
- package/dist/lib/file-loader.d.ts +165 -0
- package/dist/lib/file-loader.d.ts.map +1 -0
- package/dist/lib/file-loader.js +577 -0
- package/dist/lib/file-loader.js.map +1 -0
- package/dist/lib/file-loader.test.d.ts +2 -0
- package/dist/lib/file-loader.test.d.ts.map +1 -0
- package/dist/lib/file-loader.test.js +75 -0
- package/dist/lib/file-loader.test.js.map +1 -0
- package/dist/lib/file-writer.d.ts +30 -0
- package/dist/lib/file-writer.d.ts.map +1 -0
- package/dist/lib/file-writer.js +122 -0
- package/dist/lib/file-writer.js.map +1 -0
- package/dist/lib/helpers.d.ts +39 -0
- package/dist/lib/helpers.d.ts.map +1 -0
- package/dist/lib/helpers.js +299 -0
- package/dist/lib/helpers.js.map +1 -0
- package/dist/lib/markdown-renderer.d.ts +8 -0
- package/dist/lib/markdown-renderer.d.ts.map +1 -0
- package/dist/lib/markdown-renderer.js +151 -0
- package/dist/lib/markdown-renderer.js.map +1 -0
- package/dist/lib/shell.d.ts +15 -0
- package/dist/lib/shell.d.ts.map +1 -0
- package/dist/lib/shell.js +32 -0
- package/dist/lib/shell.js.map +1 -0
- package/dist/skill/SKILL.md +887 -0
- package/dist/skill/agents/quickback-specialist/AGENT.md +298 -0
- package/dist/templates/registry.d.ts +36 -0
- package/dist/templates/registry.d.ts.map +1 -0
- package/dist/templates/registry.js +181 -0
- package/dist/templates/registry.js.map +1 -0
- package/package.json +55 -0
- package/src/cursor/quickback.mdc +277 -0
- package/src/examples/recruitment.tar.gz +0 -0
- package/src/skill/SKILL.md +887 -0
- package/src/skill/agents/quickback-specialist/AGENT.md +298 -0
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Command
|
|
3
|
+
*
|
|
4
|
+
* One-shot project creation with templates.
|
|
5
|
+
* Usage: quickback create <template> <app-name>
|
|
6
|
+
* Example: quickback create betterauth-d1-cloudflare my-app
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
9
|
+
import { join, resolve } from "path";
|
|
10
|
+
import { spawnSync } from "child_process";
|
|
11
|
+
import pc from "picocolors";
|
|
12
|
+
import ora from "ora";
|
|
13
|
+
import prompts from "prompts";
|
|
14
|
+
import { getTemplate, listTemplates, formatTemplateList, TEMPLATE_ALIASES, } from "../templates/registry.js";
|
|
15
|
+
import { callCompiler } from "../lib/api-client.js";
|
|
16
|
+
import { loadConfig, loadFeatures, findConfigPath, findFeaturesDir } from "../lib/file-loader.js";
|
|
17
|
+
import { writeFiles, writeFilesWithMerge } from "../lib/file-writer.js";
|
|
18
|
+
import { partitionGeneratedFiles } from "../lib/artifact-routing.js";
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Main Create Function
|
|
21
|
+
// ============================================================================
|
|
22
|
+
export async function create(args) {
|
|
23
|
+
console.log(pc.bold("\nQuickback Create") + pc.gray(" · One-shot project generator\n"));
|
|
24
|
+
try {
|
|
25
|
+
// Parse arguments
|
|
26
|
+
const options = await parseCreateArgs(args);
|
|
27
|
+
if (options.dryRun) {
|
|
28
|
+
await performDryRun(options);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Resolve template
|
|
32
|
+
const template = getTemplate(options.template);
|
|
33
|
+
if (!template) {
|
|
34
|
+
console.error(pc.red(`Unknown template: ${options.template}\n`));
|
|
35
|
+
console.log(formatTemplateList());
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
// Validate target directory
|
|
39
|
+
const targetDir = resolve(process.cwd(), options.appName);
|
|
40
|
+
if (existsSync(targetDir)) {
|
|
41
|
+
console.error(pc.red(`Directory already exists: ${options.appName}`));
|
|
42
|
+
console.log(pc.gray("Choose a different name or delete the existing directory."));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
console.log(pc.cyan(`Creating ${template.name}...`));
|
|
46
|
+
console.log(pc.gray(`Template: ${options.template}`));
|
|
47
|
+
console.log(pc.gray(`Location: ${targetDir}\n`));
|
|
48
|
+
// Step 1: Create project directory
|
|
49
|
+
const spinner = ora("Creating project structure...").start();
|
|
50
|
+
const resolvedTemplateId = TEMPLATE_ALIASES[options.template] || options.template;
|
|
51
|
+
const isSaas = resolvedTemplateId === "b2bsaas-cloudflare";
|
|
52
|
+
const isBlog = resolvedTemplateId === "blog-cloudflare";
|
|
53
|
+
const isEmpty = resolvedTemplateId === "empty-cloudflare" || resolvedTemplateId === "empty-bun";
|
|
54
|
+
mkdirSync(targetDir, { recursive: true });
|
|
55
|
+
mkdirSync(join(targetDir, "quickback"), { recursive: true });
|
|
56
|
+
if (!isEmpty) {
|
|
57
|
+
const featureName = isSaas ? "projects" : isBlog ? "posts" : "todos";
|
|
58
|
+
mkdirSync(join(targetDir, "quickback", "features", featureName), { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
mkdirSync(join(targetDir, "quickback", "features"), { recursive: true });
|
|
62
|
+
}
|
|
63
|
+
spinner.succeed("Project structure created");
|
|
64
|
+
// Step 2: Generate config file
|
|
65
|
+
spinner.start("Generating configuration...");
|
|
66
|
+
generateConfigFile(targetDir, options.appName, template, resolvedTemplateId);
|
|
67
|
+
if (isSaas) {
|
|
68
|
+
generateProjectsFeature(targetDir);
|
|
69
|
+
}
|
|
70
|
+
else if (isBlog) {
|
|
71
|
+
generateBlogFeature(targetDir);
|
|
72
|
+
}
|
|
73
|
+
else if (!isEmpty) {
|
|
74
|
+
generateTodoFeature(targetDir);
|
|
75
|
+
}
|
|
76
|
+
generateAuthConfig(targetDir);
|
|
77
|
+
spinner.succeed("Configuration generated");
|
|
78
|
+
// Step 3: Setup Cloudflare resources (if applicable)
|
|
79
|
+
if (template.requiresCloudflare && !options.skipCloudflareSetup) {
|
|
80
|
+
await setupCloudflareResources(options.appName, targetDir, options.verbose);
|
|
81
|
+
}
|
|
82
|
+
// Step 4: Compile the project via remote API
|
|
83
|
+
spinner.start("Compiling via Quickback API...");
|
|
84
|
+
const quickbackDir = join(targetDir, "quickback");
|
|
85
|
+
const configPath = await findConfigPath(quickbackDir);
|
|
86
|
+
if (!configPath) {
|
|
87
|
+
spinner.fail("Configuration not found");
|
|
88
|
+
throw new Error("Could not find quickback.config.ts");
|
|
89
|
+
}
|
|
90
|
+
const config = await loadConfig(configPath);
|
|
91
|
+
const featuresDir = await findFeaturesDir(targetDir);
|
|
92
|
+
const features = featuresDir ? await loadFeatures(featuresDir) : [];
|
|
93
|
+
const result = await callCompiler({
|
|
94
|
+
config: {
|
|
95
|
+
name: config.name,
|
|
96
|
+
preset: config.preset,
|
|
97
|
+
template: config.template,
|
|
98
|
+
providers: config.providers,
|
|
99
|
+
build: config.build,
|
|
100
|
+
features: config.features,
|
|
101
|
+
},
|
|
102
|
+
features: features.map((f) => ({
|
|
103
|
+
name: f.name,
|
|
104
|
+
schema: f.schema,
|
|
105
|
+
tables: f.tables,
|
|
106
|
+
resourceSource: f.resourceSource,
|
|
107
|
+
actionsSource: f.actionsSource,
|
|
108
|
+
handlerFiles: f.handlerFiles,
|
|
109
|
+
})),
|
|
110
|
+
}, (msg) => spinner.text = msg);
|
|
111
|
+
// Write output files — partition runtime vs state artifacts
|
|
112
|
+
const { runtimeFiles, stateFiles } = partitionGeneratedFiles(result.files);
|
|
113
|
+
await writeFiles(targetDir, runtimeFiles);
|
|
114
|
+
if (stateFiles.length > 0) {
|
|
115
|
+
const quickbackDir = join(targetDir, 'quickback');
|
|
116
|
+
await writeFilesWithMerge(quickbackDir, stateFiles);
|
|
117
|
+
}
|
|
118
|
+
spinner.succeed(`Compiled ${result.meta.fileCount} files (v${result.meta.version})`);
|
|
119
|
+
// Step 5: Install dependencies
|
|
120
|
+
if (!options.skipInstall) {
|
|
121
|
+
spinner.start("Installing dependencies...");
|
|
122
|
+
// Prefer bun for bun templates (better peer dep handling)
|
|
123
|
+
const preferBun = template.preset === 'bun' || !template.requiresCloudflare;
|
|
124
|
+
const pm = detectPackageManager(preferBun);
|
|
125
|
+
const installResult = runCommand(pm, ["install"], targetDir, options.verbose);
|
|
126
|
+
if (installResult.success) {
|
|
127
|
+
spinner.succeed(`Dependencies installed with ${pm}`);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
spinner.warn("Dependency installation had issues");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Step 6: Generate database schemas (drizzle-kit generate)
|
|
134
|
+
spinner.start("Generating database schemas...");
|
|
135
|
+
const schemaResult = runCommand("npx", ["drizzle-kit", "generate"], targetDir, options.verbose);
|
|
136
|
+
if (schemaResult.success) {
|
|
137
|
+
spinner.succeed("Database schemas generated");
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
spinner.warn("Schema generation skipped (install dependencies first)");
|
|
141
|
+
}
|
|
142
|
+
// Step 7: Apply local migrations (for non-Cloudflare)
|
|
143
|
+
if (!template.requiresCloudflare && !options.skipMigrations) {
|
|
144
|
+
// Ensure data directory exists for SQLite
|
|
145
|
+
const dataDir = join(targetDir, "data");
|
|
146
|
+
if (!existsSync(dataDir)) {
|
|
147
|
+
mkdirSync(dataDir, { recursive: true });
|
|
148
|
+
}
|
|
149
|
+
spinner.start("Applying local migrations...");
|
|
150
|
+
const migrateResult = runCommand("npx", ["drizzle-kit", "migrate"], targetDir, options.verbose);
|
|
151
|
+
if (migrateResult.success) {
|
|
152
|
+
spinner.succeed("Local migrations applied");
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
spinner.warn("Migrations skipped");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Success!
|
|
159
|
+
printSuccessMessage(options.appName, template);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.error(pc.red("\nProject creation failed:"));
|
|
163
|
+
console.error(pc.red(String(error)));
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// ============================================================================
|
|
168
|
+
// Argument Parsing
|
|
169
|
+
// ============================================================================
|
|
170
|
+
async function parseCreateArgs(args) {
|
|
171
|
+
let template;
|
|
172
|
+
let appName;
|
|
173
|
+
let skipCloudflareSetup = false;
|
|
174
|
+
let skipInstall = false;
|
|
175
|
+
let skipMigrations = false;
|
|
176
|
+
let dryRun = false;
|
|
177
|
+
let verbose = false;
|
|
178
|
+
// Parse flags and positional args
|
|
179
|
+
const positional = [];
|
|
180
|
+
for (const arg of args) {
|
|
181
|
+
if (arg === "--skip-cloudflare-setup" || arg === "--skip-cf") {
|
|
182
|
+
skipCloudflareSetup = true;
|
|
183
|
+
}
|
|
184
|
+
else if (arg === "--skip-install") {
|
|
185
|
+
skipInstall = true;
|
|
186
|
+
}
|
|
187
|
+
else if (arg === "--skip-migrations") {
|
|
188
|
+
skipMigrations = true;
|
|
189
|
+
}
|
|
190
|
+
else if (arg === "--dry-run") {
|
|
191
|
+
dryRun = true;
|
|
192
|
+
}
|
|
193
|
+
else if (arg === "--verbose" || arg === "-v") {
|
|
194
|
+
verbose = true;
|
|
195
|
+
}
|
|
196
|
+
else if (arg === "--help" || arg === "-h") {
|
|
197
|
+
printHelp();
|
|
198
|
+
process.exit(0);
|
|
199
|
+
}
|
|
200
|
+
else if (arg === "--list" || arg === "-l") {
|
|
201
|
+
console.log(formatTemplateList());
|
|
202
|
+
process.exit(0);
|
|
203
|
+
}
|
|
204
|
+
else if (!arg.startsWith("-")) {
|
|
205
|
+
positional.push(arg);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Extract template and appName from positional args
|
|
209
|
+
if (positional.length >= 2) {
|
|
210
|
+
template = positional[0];
|
|
211
|
+
appName = positional[1];
|
|
212
|
+
}
|
|
213
|
+
else if (positional.length === 1) {
|
|
214
|
+
// Could be template or app name - check if it's a known template
|
|
215
|
+
if (getTemplate(positional[0]) || TEMPLATE_ALIASES[positional[0]]) {
|
|
216
|
+
template = positional[0];
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
appName = positional[0];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// Interactive prompts if needed
|
|
223
|
+
if (!template) {
|
|
224
|
+
const templates = listTemplates();
|
|
225
|
+
const response = await prompts({
|
|
226
|
+
type: "select",
|
|
227
|
+
name: "template",
|
|
228
|
+
message: "Choose a template",
|
|
229
|
+
choices: templates.map(t => ({
|
|
230
|
+
title: t.name,
|
|
231
|
+
description: t.description,
|
|
232
|
+
value: Object.entries(TEMPLATE_ALIASES).find(([_, v]) => v === Object.keys(TEMPLATE_ALIASES).find(k => getTemplate(k)?.name === t.name))?.[0] || t.name.toLowerCase().replace(/\s+/g, "-"),
|
|
233
|
+
})),
|
|
234
|
+
});
|
|
235
|
+
template = response.template;
|
|
236
|
+
if (!template) {
|
|
237
|
+
console.log(pc.yellow("\nOperation cancelled."));
|
|
238
|
+
process.exit(0);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (!appName) {
|
|
242
|
+
const response = await prompts({
|
|
243
|
+
type: "text",
|
|
244
|
+
name: "appName",
|
|
245
|
+
message: "Project name",
|
|
246
|
+
validate: (v) => {
|
|
247
|
+
if (!v || v.trim().length === 0)
|
|
248
|
+
return "Name is required";
|
|
249
|
+
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(v)) {
|
|
250
|
+
return "Use lowercase letters, numbers, and hyphens only";
|
|
251
|
+
}
|
|
252
|
+
return true;
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
appName = response.appName;
|
|
256
|
+
if (!appName) {
|
|
257
|
+
console.log(pc.yellow("\nOperation cancelled."));
|
|
258
|
+
process.exit(0);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
template: template,
|
|
263
|
+
appName: appName,
|
|
264
|
+
skipCloudflareSetup,
|
|
265
|
+
skipInstall,
|
|
266
|
+
skipMigrations,
|
|
267
|
+
dryRun,
|
|
268
|
+
verbose,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
// ============================================================================
|
|
272
|
+
// File Generation
|
|
273
|
+
// ============================================================================
|
|
274
|
+
function isSingleTenantTemplate(templateId) {
|
|
275
|
+
return templateId === 'blog-cloudflare';
|
|
276
|
+
}
|
|
277
|
+
function generateConfigFile(targetDir, appName, template, templateId) {
|
|
278
|
+
const providers = getProvidersForPreset(template.preset, templateId);
|
|
279
|
+
const singleTenant = isSingleTenantTemplate(templateId);
|
|
280
|
+
const configContent = `/**
|
|
281
|
+
* Quickback Configuration
|
|
282
|
+
* Generated by: quickback create ${template.preset} ${appName}
|
|
283
|
+
*
|
|
284
|
+
* Project structure:
|
|
285
|
+
* ${appName}/
|
|
286
|
+
* ├── quickback/ ← definitions live here
|
|
287
|
+
* │ ├── quickback.config.ts
|
|
288
|
+
* │ └── features/...
|
|
289
|
+
* ├── src/ ← compiled code
|
|
290
|
+
* └── package.json
|
|
291
|
+
*
|
|
292
|
+
* Run 'quickback compile' to regenerate after editing definitions.
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
export default {
|
|
296
|
+
name: "${appName}",
|
|
297
|
+
template: "hono",
|
|
298
|
+
features: {
|
|
299
|
+
organizations: ${singleTenant ? 'false' : 'true'},
|
|
300
|
+
},
|
|
301
|
+
providers: ${JSON.stringify(providers, null, 8).replace(/^/gm, ' ').trim()},
|
|
302
|
+
};
|
|
303
|
+
`;
|
|
304
|
+
writeFileSync(join(targetDir, "quickback", "quickback.config.ts"), configContent);
|
|
305
|
+
}
|
|
306
|
+
function getProvidersForPreset(preset, templateId) {
|
|
307
|
+
// SaaS template gets extra providers (file storage, split databases, webhooks)
|
|
308
|
+
if (templateId === "b2bsaas-cloudflare") {
|
|
309
|
+
return {
|
|
310
|
+
runtime: { name: "cloudflare", config: {} },
|
|
311
|
+
database: {
|
|
312
|
+
name: "cloudflare-d1",
|
|
313
|
+
config: {
|
|
314
|
+
splitDatabases: true,
|
|
315
|
+
authBinding: "AUTH_DB",
|
|
316
|
+
featuresBinding: "DB",
|
|
317
|
+
webhooksBinding: "WEBHOOKS_DB",
|
|
318
|
+
realtime: true,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
auth: { name: "better-auth", config: {} },
|
|
322
|
+
fileStorage: {
|
|
323
|
+
name: "cloudflare-r2",
|
|
324
|
+
config: {},
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
switch (preset) {
|
|
329
|
+
case "bun":
|
|
330
|
+
return {
|
|
331
|
+
runtime: { name: "bun", config: {} },
|
|
332
|
+
database: { name: "bun-sqlite", config: { path: "./data/app.db" } },
|
|
333
|
+
auth: { name: "better-auth", config: {} },
|
|
334
|
+
};
|
|
335
|
+
case "blog":
|
|
336
|
+
return {
|
|
337
|
+
runtime: { name: "cloudflare", config: {} },
|
|
338
|
+
database: { name: "cloudflare-d1", config: { binding: "DB" } },
|
|
339
|
+
auth: { name: "better-auth", config: {} },
|
|
340
|
+
};
|
|
341
|
+
case "cloudflare":
|
|
342
|
+
return {
|
|
343
|
+
runtime: { name: "cloudflare", config: {} },
|
|
344
|
+
database: { name: "cloudflare-d1", config: { binding: "DB", realtime: true } },
|
|
345
|
+
auth: { name: "better-auth", config: {} },
|
|
346
|
+
};
|
|
347
|
+
case "turso":
|
|
348
|
+
return {
|
|
349
|
+
runtime: { name: "bun", config: {} },
|
|
350
|
+
database: { name: "libsql", config: {} },
|
|
351
|
+
auth: { name: "better-auth", config: {} },
|
|
352
|
+
};
|
|
353
|
+
default:
|
|
354
|
+
return {
|
|
355
|
+
runtime: { name: "bun", config: {} },
|
|
356
|
+
database: { name: "bun-sqlite", config: {} },
|
|
357
|
+
auth: { name: "better-auth", config: {} },
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function generateTodoFeature(targetDir) {
|
|
362
|
+
// Audit fields (createdAt, createdBy, modifiedAt, modifiedBy) and soft delete (deletedAt)
|
|
363
|
+
// are added automatically by the compiler based on firewall config — do not define them here.
|
|
364
|
+
const todosContent = `/**
|
|
365
|
+
* Todo Feature
|
|
366
|
+
*
|
|
367
|
+
* Audit fields (createdAt, createdBy, modifiedAt, modifiedBy) and soft delete
|
|
368
|
+
* (deletedAt) are added automatically by the compiler — no need to define them.
|
|
369
|
+
*/
|
|
370
|
+
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
|
|
371
|
+
import { defineTable } from "@quickback/compiler";
|
|
372
|
+
|
|
373
|
+
export const todos = sqliteTable("todos", {
|
|
374
|
+
id: text("id").primaryKey(),
|
|
375
|
+
title: text("title").notNull(),
|
|
376
|
+
description: text("description"),
|
|
377
|
+
completed: integer("completed", { mode: "boolean" }).default(false),
|
|
378
|
+
priority: text("priority").default("medium"),
|
|
379
|
+
dueDate: integer("due_date", { mode: "timestamp" }),
|
|
380
|
+
|
|
381
|
+
// Ownership — used by Firewall for data isolation
|
|
382
|
+
organizationId: text("organization_id").notNull(),
|
|
383
|
+
ownerId: text("owner_id").notNull(),
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
export default defineTable(todos, {
|
|
387
|
+
firewall: {
|
|
388
|
+
organization: {},
|
|
389
|
+
owner: { mode: "optional" },
|
|
390
|
+
softDelete: {},
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
guards: {
|
|
394
|
+
createable: ["title", "description", "completed", "priority", "dueDate"],
|
|
395
|
+
updatable: ["title", "description", "completed", "priority", "dueDate"],
|
|
396
|
+
immutable: ["id", "organizationId", "ownerId"],
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
masking: {
|
|
400
|
+
description: {
|
|
401
|
+
type: "redact",
|
|
402
|
+
show: { roles: ["owner", "admin"], or: "owner" },
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
crud: {
|
|
407
|
+
list: { access: { roles: ["owner", "admin", "member"] } },
|
|
408
|
+
get: { access: { roles: ["owner", "admin", "member"] } },
|
|
409
|
+
create: { access: { roles: ["owner", "admin", "member"] } },
|
|
410
|
+
update: { access: { roles: ["owner", "admin", "member"] } },
|
|
411
|
+
delete: { access: { roles: ["owner", "admin"] }, mode: "soft" },
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
`;
|
|
415
|
+
// Actions are defined in a separate file
|
|
416
|
+
const actionsContent = `/**
|
|
417
|
+
* Todo Actions
|
|
418
|
+
* Custom business logic with security guards
|
|
419
|
+
*/
|
|
420
|
+
import { todos } from './todos';
|
|
421
|
+
import { defineActions } from '@quickback/compiler';
|
|
422
|
+
import { z } from 'zod';
|
|
423
|
+
|
|
424
|
+
export default defineActions(todos, {
|
|
425
|
+
complete: {
|
|
426
|
+
description: "Mark todo as complete",
|
|
427
|
+
input: z.object({
|
|
428
|
+
completedAt: z.string().datetime().optional(),
|
|
429
|
+
}),
|
|
430
|
+
guard: {
|
|
431
|
+
roles: ["owner", "admin", "member"],
|
|
432
|
+
record: { completed: { equals: false } },
|
|
433
|
+
},
|
|
434
|
+
sideEffects: "sync",
|
|
435
|
+
},
|
|
436
|
+
uncomplete: {
|
|
437
|
+
description: "Mark todo as incomplete",
|
|
438
|
+
input: z.object({}),
|
|
439
|
+
guard: {
|
|
440
|
+
roles: ["owner", "admin", "member"],
|
|
441
|
+
record: { completed: { equals: true } },
|
|
442
|
+
},
|
|
443
|
+
sideEffects: "sync",
|
|
444
|
+
},
|
|
445
|
+
});
|
|
446
|
+
`;
|
|
447
|
+
const featureDir = join(targetDir, "quickback", "features", "todos");
|
|
448
|
+
writeFileSync(join(featureDir, "todos.ts"), todosContent);
|
|
449
|
+
writeFileSync(join(featureDir, "actions.ts"), actionsContent);
|
|
450
|
+
}
|
|
451
|
+
function generateBlogFeature(targetDir) {
|
|
452
|
+
const postsContent = `/**
|
|
453
|
+
* Posts Feature (Single-Tenant Blog)
|
|
454
|
+
*
|
|
455
|
+
* Public read access, admin-only write access.
|
|
456
|
+
* Uses owner scope for tracking who created each post.
|
|
457
|
+
* Audit fields are added automatically by the compiler.
|
|
458
|
+
*/
|
|
459
|
+
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
|
|
460
|
+
import { defineTable } from "@quickback/compiler";
|
|
461
|
+
|
|
462
|
+
export const posts = sqliteTable("posts", {
|
|
463
|
+
id: text("id").primaryKey(),
|
|
464
|
+
title: text("title").notNull(),
|
|
465
|
+
slug: text("slug").notNull().unique(),
|
|
466
|
+
content: text("content"),
|
|
467
|
+
excerpt: text("excerpt"),
|
|
468
|
+
status: text("status").notNull().default("draft"),
|
|
469
|
+
publishedAt: text("published_at"),
|
|
470
|
+
|
|
471
|
+
// Ownership — tracks who created the post
|
|
472
|
+
ownerId: text("owner_id").notNull(),
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
export default defineTable(posts, {
|
|
476
|
+
firewall: {
|
|
477
|
+
owner: {},
|
|
478
|
+
softDelete: {},
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
guards: {
|
|
482
|
+
createable: ["title", "slug", "content", "excerpt", "status", "publishedAt"],
|
|
483
|
+
updatable: ["title", "slug", "content", "excerpt", "status", "publishedAt"],
|
|
484
|
+
immutable: ["id", "ownerId"],
|
|
485
|
+
},
|
|
486
|
+
|
|
487
|
+
crud: {
|
|
488
|
+
list: { access: { roles: ["PUBLIC"] } },
|
|
489
|
+
get: { access: { roles: ["PUBLIC"] } },
|
|
490
|
+
create: { access: { roles: ["admin"] } },
|
|
491
|
+
update: { access: { roles: ["admin"] } },
|
|
492
|
+
delete: { access: { roles: ["admin"] }, mode: "soft" },
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
`;
|
|
496
|
+
const actionsContent = `/**
|
|
497
|
+
* Post Actions
|
|
498
|
+
* Admin-only publishing workflow
|
|
499
|
+
*/
|
|
500
|
+
import { posts } from './posts';
|
|
501
|
+
import { defineActions } from '@quickback/compiler';
|
|
502
|
+
import { z } from 'zod';
|
|
503
|
+
|
|
504
|
+
export default defineActions(posts, {
|
|
505
|
+
publish: {
|
|
506
|
+
description: "Publish a draft post",
|
|
507
|
+
input: z.object({}),
|
|
508
|
+
guard: {
|
|
509
|
+
roles: ["admin"],
|
|
510
|
+
record: { status: { equals: "draft" } },
|
|
511
|
+
},
|
|
512
|
+
sideEffects: "sync",
|
|
513
|
+
},
|
|
514
|
+
unpublish: {
|
|
515
|
+
description: "Revert a published post to draft",
|
|
516
|
+
input: z.object({}),
|
|
517
|
+
guard: {
|
|
518
|
+
roles: ["admin"],
|
|
519
|
+
record: { status: { equals: "published" } },
|
|
520
|
+
},
|
|
521
|
+
sideEffects: "sync",
|
|
522
|
+
},
|
|
523
|
+
});
|
|
524
|
+
`;
|
|
525
|
+
const featureDir = join(targetDir, "quickback", "features", "posts");
|
|
526
|
+
writeFileSync(join(featureDir, "posts.ts"), postsContent);
|
|
527
|
+
writeFileSync(join(featureDir, "actions.ts"), actionsContent);
|
|
528
|
+
}
|
|
529
|
+
function generateProjectsFeature(targetDir) {
|
|
530
|
+
// SaaS template uses a richer "projects" feature with views
|
|
531
|
+
// Audit fields and soft delete (deletedAt) are added automatically by the compiler.
|
|
532
|
+
const projectsContent = `/**
|
|
533
|
+
* Projects Feature
|
|
534
|
+
* B2B SaaS example with views.
|
|
535
|
+
*
|
|
536
|
+
* Audit fields (createdAt, createdBy, modifiedAt, modifiedBy) and soft delete
|
|
537
|
+
* (deletedAt) are added automatically by the compiler — no need to define them.
|
|
538
|
+
*/
|
|
539
|
+
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
|
|
540
|
+
import { defineTable } from "@quickback/compiler";
|
|
541
|
+
|
|
542
|
+
export const projects = sqliteTable("projects", {
|
|
543
|
+
id: text("id").primaryKey(),
|
|
544
|
+
name: text("name").notNull(),
|
|
545
|
+
description: text("description"),
|
|
546
|
+
status: text("status").default("active"),
|
|
547
|
+
|
|
548
|
+
// Ownership — used by Firewall for data isolation
|
|
549
|
+
organizationId: text("organization_id").notNull(),
|
|
550
|
+
ownerId: text("owner_id").notNull(),
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
export default defineTable(projects, {
|
|
554
|
+
firewall: {
|
|
555
|
+
organization: {},
|
|
556
|
+
owner: { mode: "optional" },
|
|
557
|
+
softDelete: {},
|
|
558
|
+
},
|
|
559
|
+
guards: {
|
|
560
|
+
createable: ["name", "description", "status"],
|
|
561
|
+
updatable: ["name", "description", "status"],
|
|
562
|
+
immutable: ["id", "organizationId", "ownerId"],
|
|
563
|
+
},
|
|
564
|
+
crud: {
|
|
565
|
+
list: { access: { roles: ["owner", "admin", "member"] } },
|
|
566
|
+
get: { access: { roles: ["owner", "admin", "member"] } },
|
|
567
|
+
create: { access: { roles: ["owner", "admin", "member"] } },
|
|
568
|
+
update: { access: { roles: ["owner", "admin", "member"] } },
|
|
569
|
+
delete: { access: { roles: ["owner", "admin"] }, mode: "soft" },
|
|
570
|
+
},
|
|
571
|
+
views: {
|
|
572
|
+
summary: {
|
|
573
|
+
fields: ["id", "name", "status"],
|
|
574
|
+
access: { roles: ["owner", "admin", "member"] },
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
`;
|
|
579
|
+
const featureDir = join(targetDir, "quickback", "features", "projects");
|
|
580
|
+
writeFileSync(join(featureDir, "projects.ts"), projectsContent);
|
|
581
|
+
}
|
|
582
|
+
function generateAuthConfig(targetDir) {
|
|
583
|
+
const authContent = `/**
|
|
584
|
+
* Better Auth Configuration
|
|
585
|
+
*
|
|
586
|
+
* Security Best Practices:
|
|
587
|
+
* - Cookie security: SameSite=Lax (CSRF protection), Secure (HTTPS only), HttpOnly (XSS protection)
|
|
588
|
+
* - Rate limiting: Device authorization endpoints protected against brute-force
|
|
589
|
+
* - Trusted origins: Set TRUSTED_ORIGINS env var to whitelist allowed domains
|
|
590
|
+
*/
|
|
591
|
+
export default {
|
|
592
|
+
emailAndPassword: {
|
|
593
|
+
enabled: true,
|
|
594
|
+
requireEmailVerification: false,
|
|
595
|
+
},
|
|
596
|
+
plugins: ["anonymous"],
|
|
597
|
+
session: {
|
|
598
|
+
expiresInDays: 30,
|
|
599
|
+
updateAgeInDays: 1,
|
|
600
|
+
},
|
|
601
|
+
database: {
|
|
602
|
+
usePlural: true,
|
|
603
|
+
debugLogs: true,
|
|
604
|
+
},
|
|
605
|
+
// Security: Secure cookie defaults
|
|
606
|
+
advanced: {
|
|
607
|
+
defaultCookieAttributes: {
|
|
608
|
+
sameSite: 'lax', // Prevent CSRF attacks
|
|
609
|
+
secure: true, // HTTPS only
|
|
610
|
+
httpOnly: true, // Prevent JavaScript access (XSS mitigation)
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
// Security: Rate limiting for device authorization
|
|
614
|
+
rateLimit: {
|
|
615
|
+
enabled: true,
|
|
616
|
+
window: 60,
|
|
617
|
+
max: 100,
|
|
618
|
+
customRules: {
|
|
619
|
+
"/sign-in/email": { window: 60, max: 10 },
|
|
620
|
+
"/sign-in/social": { window: 60, max: 10 },
|
|
621
|
+
"/device/init": { window: 60, max: 5 },
|
|
622
|
+
"/device/poll": { window: 60, max: 30 },
|
|
623
|
+
"/device/token": { window: 60, max: 10 },
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
};
|
|
627
|
+
`;
|
|
628
|
+
mkdirSync(join(targetDir, "quickback", "definitions", "auth", "better-auth"), { recursive: true });
|
|
629
|
+
writeFileSync(join(targetDir, "quickback", "definitions", "auth", "better-auth", "config.ts"), authContent);
|
|
630
|
+
}
|
|
631
|
+
// ============================================================================
|
|
632
|
+
// Cloudflare Setup
|
|
633
|
+
// ============================================================================
|
|
634
|
+
async function setupCloudflareResources(appName, targetDir, verbose) {
|
|
635
|
+
const spinner = ora("Setting up Cloudflare resources...").start();
|
|
636
|
+
// Check if wrangler is available
|
|
637
|
+
const wranglerCheck = spawnSync("npx", ["wrangler", "--version"], { encoding: "utf-8" });
|
|
638
|
+
if (wranglerCheck.status !== 0) {
|
|
639
|
+
spinner.warn("Wrangler not available - skipping Cloudflare setup");
|
|
640
|
+
console.log(pc.gray(" Install wrangler and run: npx wrangler d1 create " + appName + "-db"));
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
// Check authentication
|
|
644
|
+
const whoami = spawnSync("npx", ["wrangler", "whoami"], { encoding: "utf-8" });
|
|
645
|
+
if (whoami.status !== 0 || whoami.stdout.includes("not authenticated")) {
|
|
646
|
+
spinner.warn("Not authenticated with Cloudflare - skipping resource creation");
|
|
647
|
+
console.log(pc.gray(" Run 'npx wrangler login' first, then create resources manually."));
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
// Create D1 database
|
|
651
|
+
spinner.text = `Creating D1 database: ${appName}-db`;
|
|
652
|
+
const d1Result = spawnSync("npx", ["wrangler", "d1", "create", `${appName}-db`], { encoding: "utf-8", cwd: targetDir });
|
|
653
|
+
if (d1Result.status === 0) {
|
|
654
|
+
// Extract database ID from output
|
|
655
|
+
const dbIdMatch = d1Result.stdout.match(/database_id\s*=\s*"([^"]+)"/);
|
|
656
|
+
if (dbIdMatch) {
|
|
657
|
+
spinner.succeed(`D1 database created: ${appName}-db (${dbIdMatch[1]})`);
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
spinner.succeed(`D1 database created: ${appName}-db`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
else if (d1Result.stderr.includes("already exists")) {
|
|
664
|
+
spinner.info(`D1 database already exists: ${appName}-db`);
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
spinner.warn("D1 database creation failed");
|
|
668
|
+
if (verbose) {
|
|
669
|
+
console.log(pc.gray(d1Result.stderr));
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
// ============================================================================
|
|
674
|
+
// Utilities
|
|
675
|
+
// ============================================================================
|
|
676
|
+
function runCommand(cmd, args, cwd, verbose) {
|
|
677
|
+
const result = spawnSync(cmd, args, {
|
|
678
|
+
cwd,
|
|
679
|
+
encoding: "utf-8",
|
|
680
|
+
stdio: verbose ? "inherit" : "pipe",
|
|
681
|
+
});
|
|
682
|
+
return {
|
|
683
|
+
success: result.status === 0,
|
|
684
|
+
stdout: result.stdout || "",
|
|
685
|
+
stderr: result.stderr || "",
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
function detectPackageManager(preferBun = false) {
|
|
689
|
+
// Check for existing lockfiles first
|
|
690
|
+
if (existsSync("bun.lockb"))
|
|
691
|
+
return "bun";
|
|
692
|
+
if (existsSync("pnpm-lock.yaml"))
|
|
693
|
+
return "pnpm";
|
|
694
|
+
if (existsSync("yarn.lock"))
|
|
695
|
+
return "yarn";
|
|
696
|
+
// If preferBun and bun is available, use it (better peer dep handling)
|
|
697
|
+
if (preferBun) {
|
|
698
|
+
try {
|
|
699
|
+
const result = spawnSync("bun", ["--version"], { encoding: "utf-8" });
|
|
700
|
+
if (result.status === 0)
|
|
701
|
+
return "bun";
|
|
702
|
+
}
|
|
703
|
+
catch {
|
|
704
|
+
// bun not available, fall through
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return "npm";
|
|
708
|
+
}
|
|
709
|
+
function performDryRun(options) {
|
|
710
|
+
const template = getTemplate(options.template);
|
|
711
|
+
console.log(pc.bold("Dry Run - No changes will be made\n"));
|
|
712
|
+
console.log(pc.cyan("Configuration:"));
|
|
713
|
+
console.log(` Template: ${options.template}${template ? ` (${template.name})` : ""}`);
|
|
714
|
+
console.log(` App Name: ${options.appName}`);
|
|
715
|
+
console.log(` Target Dir: ${resolve(process.cwd(), options.appName)}`);
|
|
716
|
+
console.log("");
|
|
717
|
+
console.log(pc.cyan("Steps that would be executed:"));
|
|
718
|
+
console.log(" 1. Create project directory structure");
|
|
719
|
+
console.log(" 2. Generate quickback.config.ts");
|
|
720
|
+
console.log(" 3. Generate feature definitions");
|
|
721
|
+
if (template?.requiresCloudflare && !options.skipCloudflareSetup) {
|
|
722
|
+
console.log(" 4. Create Cloudflare D1 database");
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
console.log(" 4. [SKIP] Cloudflare setup");
|
|
726
|
+
}
|
|
727
|
+
console.log(" 5. Compile project (quickback compile)");
|
|
728
|
+
if (!options.skipInstall) {
|
|
729
|
+
console.log(" 6. Install dependencies");
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
console.log(" 6. [SKIP] Install dependencies");
|
|
733
|
+
}
|
|
734
|
+
console.log(" 7. Generate database schemas");
|
|
735
|
+
if (!template?.requiresCloudflare && !options.skipMigrations) {
|
|
736
|
+
console.log(" 8. Apply local migrations");
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
console.log(" 8. [SKIP] Local migrations");
|
|
740
|
+
}
|
|
741
|
+
console.log(pc.green("\nDry run complete. Remove --dry-run to execute."));
|
|
742
|
+
}
|
|
743
|
+
function printSuccessMessage(appName, template) {
|
|
744
|
+
console.log("");
|
|
745
|
+
console.log(pc.green("✔ Project created successfully!"));
|
|
746
|
+
console.log("");
|
|
747
|
+
console.log(pc.bold("Next steps:"));
|
|
748
|
+
console.log(pc.cyan(` cd ${appName}`));
|
|
749
|
+
console.log(pc.cyan(" npm run dev"));
|
|
750
|
+
console.log("");
|
|
751
|
+
if (template.requiresCloudflare) {
|
|
752
|
+
console.log(pc.bold("Deploy to Cloudflare:"));
|
|
753
|
+
console.log(pc.cyan(" npm run deploy"));
|
|
754
|
+
console.log("");
|
|
755
|
+
}
|
|
756
|
+
console.log(pc.bold("Useful commands:"));
|
|
757
|
+
console.log(" npm run dev " + pc.gray("Start development server"));
|
|
758
|
+
console.log(" quickback compile " + pc.gray("Regenerate after editing definitions"));
|
|
759
|
+
console.log(" npx drizzle-kit generate " + pc.gray("Generate new migrations"));
|
|
760
|
+
console.log(" npx drizzle-kit migrate " + pc.gray("Apply database migrations"));
|
|
761
|
+
if (template.requiresCloudflare) {
|
|
762
|
+
console.log(" npm run deploy " + pc.gray("Deploy to Cloudflare Workers"));
|
|
763
|
+
}
|
|
764
|
+
console.log("");
|
|
765
|
+
console.log(pc.bold("Project structure:"));
|
|
766
|
+
console.log(pc.gray(` ${appName}/`));
|
|
767
|
+
console.log(pc.gray(" ├── quickback/ ← edit definitions here"));
|
|
768
|
+
console.log(pc.gray(" ├── src/ ← generated API code"));
|
|
769
|
+
console.log(pc.gray(" └── quickback/drizzle/ ← database migrations"));
|
|
770
|
+
console.log("");
|
|
771
|
+
}
|
|
772
|
+
function printHelp() {
|
|
773
|
+
console.log(`
|
|
774
|
+
${pc.bold("quickback create")} - Create a new Quickback project
|
|
775
|
+
|
|
776
|
+
${pc.bold("Usage:")}
|
|
777
|
+
quickback create <template> <app-name>
|
|
778
|
+
quickback create <app-name> ${pc.gray("(interactive template selection)")}
|
|
779
|
+
|
|
780
|
+
${pc.bold("Examples:")}
|
|
781
|
+
quickback create betterauth-d1-cloudflare my-app
|
|
782
|
+
quickback create cloudflare my-app ${pc.gray("(alias)")}
|
|
783
|
+
quickback create bun my-app ${pc.gray("(local development)")}
|
|
784
|
+
|
|
785
|
+
${pc.bold("Options:")}
|
|
786
|
+
--skip-cloudflare-setup Skip automatic Cloudflare resource creation
|
|
787
|
+
--skip-install Skip npm/bun install
|
|
788
|
+
--skip-migrations Skip database migrations
|
|
789
|
+
--dry-run Preview what would be created
|
|
790
|
+
--verbose, -v Show detailed output
|
|
791
|
+
--list, -l List available templates
|
|
792
|
+
--help, -h Show this help
|
|
793
|
+
|
|
794
|
+
${pc.bold("Templates:")}
|
|
795
|
+
${formatTemplateList()}
|
|
796
|
+
`);
|
|
797
|
+
}
|
|
798
|
+
//# sourceMappingURL=create.js.map
|