mycontext-cli 1.0.3 ā 1.0.4
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/agents/intelligence/ProjectIntelligence.d.ts.map +1 -1
- package/dist/agents/intelligence/ProjectIntelligence.js +4 -16
- package/dist/agents/intelligence/ProjectIntelligence.js.map +1 -1
- package/dist/cli.js +55 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +15 -8
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/playbooks.d.ts +1 -0
- package/dist/commands/playbooks.d.ts.map +1 -1
- package/dist/commands/playbooks.js +58 -24
- package/dist/commands/playbooks.js.map +1 -1
- package/dist/commands/predict.js +1 -1
- package/dist/commands/refine.js +1 -1
- package/dist/commands/sanitize.d.ts +30 -0
- package/dist/commands/sanitize.d.ts.map +1 -0
- package/dist/commands/sanitize.js +489 -0
- package/dist/commands/sanitize.js.map +1 -0
- package/dist/commands/setup-database.d.ts +33 -0
- package/dist/commands/setup-database.d.ts.map +1 -0
- package/dist/commands/setup-database.js +665 -0
- package/dist/commands/setup-database.js.map +1 -0
- package/dist/utils/contextLoader.d.ts.map +1 -1
- package/dist/utils/contextLoader.js +7 -12
- package/dist/utils/contextLoader.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.DatabaseSetupCommand = void 0;
|
|
40
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
41
|
+
const spinner_1 = require("../utils/spinner");
|
|
42
|
+
const fileSystem_1 = require("../utils/fileSystem");
|
|
43
|
+
const child_process_1 = require("child_process");
|
|
44
|
+
const fs = __importStar(require("fs-extra"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
class DatabaseSetupCommand {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.fs = new fileSystem_1.FileSystemManager();
|
|
49
|
+
this.spinner = new spinner_1.EnhancedSpinner("Setting up database...");
|
|
50
|
+
}
|
|
51
|
+
async execute(options) {
|
|
52
|
+
const { provider = "instantdb", auth = true, schema = true, components = true, skipAuth = false, skipSchema = false, skipComponents = false, } = options;
|
|
53
|
+
console.log(chalk_1.default.blue.bold("šļø Database Setup\n"));
|
|
54
|
+
try {
|
|
55
|
+
// Check if we're in a valid project
|
|
56
|
+
if (!(await this.isValidProject())) {
|
|
57
|
+
throw new Error("Not a valid MyContext project. Run 'mycontext init' first.");
|
|
58
|
+
}
|
|
59
|
+
// Check if context files exist
|
|
60
|
+
if (!(await this.hasContextFiles())) {
|
|
61
|
+
console.log(chalk_1.default.yellow("ā ļø Context files not found. Generating them first..."));
|
|
62
|
+
console.log(chalk_1.default.gray("Run 'mycontext generate context' first, then retry this command."));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (provider === "instantdb") {
|
|
66
|
+
await this.setupInstantDB({
|
|
67
|
+
auth: auth && !skipAuth,
|
|
68
|
+
schema: schema && !skipSchema,
|
|
69
|
+
components: components && !skipComponents,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
console.log(chalk_1.default.yellow(`Provider '${provider}' not yet implemented. Only InstantDB is supported.`));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
console.log(chalk_1.default.green.bold("\nā
Database setup completed!"));
|
|
77
|
+
this.showNextSteps();
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.spinner.fail("Database setup failed");
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async isValidProject() {
|
|
85
|
+
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
86
|
+
const mycontextDir = path.join(process.cwd(), ".mycontext");
|
|
87
|
+
return ((await fs.pathExists(packageJsonPath)) &&
|
|
88
|
+
(await fs.pathExists(mycontextDir)));
|
|
89
|
+
}
|
|
90
|
+
async hasContextFiles() {
|
|
91
|
+
const prdPath = path.join(process.cwd(), ".mycontext", "01-prd.md");
|
|
92
|
+
const typesPath = path.join(process.cwd(), ".mycontext", "types.ts");
|
|
93
|
+
return (await fs.pathExists(prdPath)) && (await fs.pathExists(typesPath));
|
|
94
|
+
}
|
|
95
|
+
async setupInstantDB(options) {
|
|
96
|
+
console.log(chalk_1.default.blue("š Setting up InstantDB...\n"));
|
|
97
|
+
// Step 1: Install InstantDB dependencies
|
|
98
|
+
this.spinner.start().updateText("Installing InstantDB dependencies...");
|
|
99
|
+
await this.installInstantDBDependencies();
|
|
100
|
+
this.spinner.succeed("Dependencies installed");
|
|
101
|
+
// Step 2: Initialize InstantDB CLI
|
|
102
|
+
this.spinner.start().updateText("Initializing InstantDB...");
|
|
103
|
+
await this.initializeInstantDB();
|
|
104
|
+
this.spinner.succeed("InstantDB initialized");
|
|
105
|
+
// Step 3: Generate schema from context
|
|
106
|
+
if (options.schema) {
|
|
107
|
+
this.spinner.start().updateText("Generating database schema...");
|
|
108
|
+
await this.generateSchemaFromContext();
|
|
109
|
+
this.spinner.succeed("Schema generated");
|
|
110
|
+
}
|
|
111
|
+
// Step 4: Generate auth components
|
|
112
|
+
if (options.auth) {
|
|
113
|
+
this.spinner.start().updateText("Setting up authentication...");
|
|
114
|
+
await this.setupAuthentication();
|
|
115
|
+
this.spinner.succeed("Authentication setup");
|
|
116
|
+
}
|
|
117
|
+
// Step 5: Generate database components
|
|
118
|
+
if (options.components) {
|
|
119
|
+
this.spinner.start().updateText("Generating database components...");
|
|
120
|
+
await this.generateDatabaseComponents();
|
|
121
|
+
this.spinner.succeed("Database components generated");
|
|
122
|
+
}
|
|
123
|
+
// Step 6: Update existing components with DB integration
|
|
124
|
+
this.spinner
|
|
125
|
+
.start()
|
|
126
|
+
.updateText("Integrating database with existing components...");
|
|
127
|
+
await this.integrateDatabaseWithComponents();
|
|
128
|
+
this.spinner.succeed("Database integration complete");
|
|
129
|
+
}
|
|
130
|
+
async installInstantDBDependencies() {
|
|
131
|
+
const packageManager = await this.detectPackageManager();
|
|
132
|
+
try {
|
|
133
|
+
(0, child_process_1.execSync)(`${packageManager} add @instantdb/react @instantdb/admin`, {
|
|
134
|
+
stdio: "inherit",
|
|
135
|
+
cwd: process.cwd(),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
console.log(chalk_1.default.yellow("ā ļø Failed to install with pnpm, trying npm..."));
|
|
140
|
+
(0, child_process_1.execSync)("npm install @instantdb/react @instantdb/admin", {
|
|
141
|
+
stdio: "inherit",
|
|
142
|
+
cwd: process.cwd(),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async detectPackageManager() {
|
|
147
|
+
if (await fs.pathExists(path.join(process.cwd(), "pnpm-lock.yaml"))) {
|
|
148
|
+
return "pnpm";
|
|
149
|
+
}
|
|
150
|
+
return "npm";
|
|
151
|
+
}
|
|
152
|
+
async initializeInstantDB() {
|
|
153
|
+
try {
|
|
154
|
+
// Check if instant.schema.ts already exists
|
|
155
|
+
const schemaPath = path.join(process.cwd(), "instant.schema.ts");
|
|
156
|
+
if (await fs.pathExists(schemaPath)) {
|
|
157
|
+
console.log(chalk_1.default.gray(" InstantDB already initialized"));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
// Run instant-cli init
|
|
161
|
+
(0, child_process_1.execSync)("npx instant-cli@latest init --yes", {
|
|
162
|
+
stdio: "inherit",
|
|
163
|
+
cwd: process.cwd(),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.log(chalk_1.default.yellow("ā ļø InstantDB CLI init failed, creating schema manually..."));
|
|
168
|
+
await this.createBasicSchema();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async createBasicSchema() {
|
|
172
|
+
const schemaContent = `import { i } from "@instantdb/react";
|
|
173
|
+
|
|
174
|
+
const schema = i.schema({
|
|
175
|
+
entities: {
|
|
176
|
+
$users: i.entity({
|
|
177
|
+
email: i.string().unique().indexed(),
|
|
178
|
+
name: i.string(),
|
|
179
|
+
createdAt: i.date(),
|
|
180
|
+
updatedAt: i.date(),
|
|
181
|
+
}),
|
|
182
|
+
profiles: i.entity({
|
|
183
|
+
userId: i.string(),
|
|
184
|
+
nickname: i.string(),
|
|
185
|
+
bio: i.string().optional(),
|
|
186
|
+
avatar: i.string().optional(),
|
|
187
|
+
createdAt: i.date(),
|
|
188
|
+
updatedAt: i.date(),
|
|
189
|
+
}),
|
|
190
|
+
// Add more entities based on your project context
|
|
191
|
+
},
|
|
192
|
+
links: {
|
|
193
|
+
userProfile: {
|
|
194
|
+
forward: { on: "profiles", has: "one", label: "user" },
|
|
195
|
+
reverse: { on: "$users", has: "one", label: "profile" },
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
export default schema;
|
|
201
|
+
`;
|
|
202
|
+
await fs.writeFile(path.join(process.cwd(), "instant.schema.ts"), schemaContent);
|
|
203
|
+
}
|
|
204
|
+
async generateSchemaFromContext() {
|
|
205
|
+
// Read context files
|
|
206
|
+
const prdPath = path.join(process.cwd(), ".mycontext", "01-prd.md");
|
|
207
|
+
const typesPath = path.join(process.cwd(), ".mycontext", "types.ts");
|
|
208
|
+
const prd = await fs.readFile(prdPath, "utf-8");
|
|
209
|
+
const types = await fs.readFile(typesPath, "utf-8");
|
|
210
|
+
// Generate enhanced schema based on context
|
|
211
|
+
const enhancedSchema = await this.buildEnhancedSchema(prd, types);
|
|
212
|
+
// Update the schema file
|
|
213
|
+
await fs.writeFile(path.join(process.cwd(), "instant.schema.ts"), enhancedSchema);
|
|
214
|
+
}
|
|
215
|
+
async buildEnhancedSchema(prd, types) {
|
|
216
|
+
// Extract entities from types file
|
|
217
|
+
const entities = this.extractEntitiesFromTypes(types);
|
|
218
|
+
// Build schema with extracted entities
|
|
219
|
+
let schemaContent = `import { i } from "@instantdb/react";
|
|
220
|
+
|
|
221
|
+
const schema = i.schema({
|
|
222
|
+
entities: {
|
|
223
|
+
$users: i.entity({
|
|
224
|
+
email: i.string().unique().indexed(),
|
|
225
|
+
name: i.string(),
|
|
226
|
+
createdAt: i.date(),
|
|
227
|
+
updatedAt: i.date(),
|
|
228
|
+
}),
|
|
229
|
+
profiles: i.entity({
|
|
230
|
+
userId: i.string(),
|
|
231
|
+
nickname: i.string(),
|
|
232
|
+
bio: i.string().optional(),
|
|
233
|
+
avatar: i.string().optional(),
|
|
234
|
+
createdAt: i.date(),
|
|
235
|
+
updatedAt: i.date(),
|
|
236
|
+
}),
|
|
237
|
+
`;
|
|
238
|
+
// Add extracted entities
|
|
239
|
+
entities.forEach((entity) => {
|
|
240
|
+
schemaContent += ` ${entity.name}: i.entity({\n`;
|
|
241
|
+
entity.fields.forEach((field) => {
|
|
242
|
+
const instantType = this.mapTypeToInstant(field.type);
|
|
243
|
+
schemaContent += ` ${field.name}: i.${instantType}()${field.optional ? ".optional()" : ""},\n`;
|
|
244
|
+
});
|
|
245
|
+
schemaContent += ` createdAt: i.date(),\n`;
|
|
246
|
+
schemaContent += ` updatedAt: i.date(),\n`;
|
|
247
|
+
schemaContent += ` }),\n`;
|
|
248
|
+
});
|
|
249
|
+
schemaContent += ` },\n`;
|
|
250
|
+
schemaContent += ` links: {\n`;
|
|
251
|
+
schemaContent += ` userProfile: {\n`;
|
|
252
|
+
schemaContent += ` forward: { on: "profiles", has: "one", label: "user" },\n`;
|
|
253
|
+
schemaContent += ` reverse: { on: "$users", has: "one", label: "profile" },\n`;
|
|
254
|
+
schemaContent += ` },\n`;
|
|
255
|
+
schemaContent += ` },\n`;
|
|
256
|
+
schemaContent += `});\n\n`;
|
|
257
|
+
schemaContent += `export default schema;\n`;
|
|
258
|
+
return schemaContent;
|
|
259
|
+
}
|
|
260
|
+
extractEntitiesFromTypes(typesContent) {
|
|
261
|
+
const entities = [];
|
|
262
|
+
// Simple regex to extract interfaces
|
|
263
|
+
const interfaceRegex = /interface\s+(\w+)\s*\{([^}]+)\}/g;
|
|
264
|
+
let match;
|
|
265
|
+
while ((match = interfaceRegex.exec(typesContent)) !== null) {
|
|
266
|
+
const name = match[1];
|
|
267
|
+
const fieldsContent = match[2];
|
|
268
|
+
const fields = [];
|
|
269
|
+
const fieldRegex = /(\w+)(\?)?\s*:\s*([^;,\n]+)/g;
|
|
270
|
+
let fieldMatch;
|
|
271
|
+
while ((fieldMatch = fieldRegex.exec(fieldsContent)) !== null) {
|
|
272
|
+
fields.push({
|
|
273
|
+
name: fieldMatch[1],
|
|
274
|
+
type: fieldMatch[3].trim(),
|
|
275
|
+
optional: !!fieldMatch[2],
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
if (fields.length > 0) {
|
|
279
|
+
entities.push({ name: name.toLowerCase(), fields });
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return entities;
|
|
283
|
+
}
|
|
284
|
+
mapTypeToInstant(type) {
|
|
285
|
+
const typeMap = {
|
|
286
|
+
string: "string",
|
|
287
|
+
number: "number",
|
|
288
|
+
boolean: "boolean",
|
|
289
|
+
Date: "date",
|
|
290
|
+
object: "json",
|
|
291
|
+
any: "any",
|
|
292
|
+
};
|
|
293
|
+
return typeMap[type] || "string";
|
|
294
|
+
}
|
|
295
|
+
async setupAuthentication() {
|
|
296
|
+
// Create auth utilities
|
|
297
|
+
const authUtilsContent = `import { init, id } from "@instantdb/react";
|
|
298
|
+
import schema from "./instant.schema";
|
|
299
|
+
|
|
300
|
+
const db = init({
|
|
301
|
+
appId: process.env.NEXT_PUBLIC_INSTANT_APP_ID || "__APP_ID__",
|
|
302
|
+
schema
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
export { db, id };
|
|
306
|
+
|
|
307
|
+
// Auth utilities
|
|
308
|
+
export const authUtils = {
|
|
309
|
+
async sendMagicCode(email: string) {
|
|
310
|
+
try {
|
|
311
|
+
await db.auth.sendMagicCode({ email });
|
|
312
|
+
return { success: true };
|
|
313
|
+
} catch (error) {
|
|
314
|
+
return { success: false, error: error.message };
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
|
|
318
|
+
async signInWithMagicCode(email: string, code: string) {
|
|
319
|
+
try {
|
|
320
|
+
await db.auth.signInWithMagicCode({ email, code });
|
|
321
|
+
return { success: true };
|
|
322
|
+
} catch (error) {
|
|
323
|
+
return { success: false, error: error.message };
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
async signOut() {
|
|
328
|
+
try {
|
|
329
|
+
await db.auth.signOut();
|
|
330
|
+
return { success: true };
|
|
331
|
+
} catch (error) {
|
|
332
|
+
return { success: false, error: error.message };
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
async createUserProfile(userId: string, data: { nickname: string; bio?: string }) {
|
|
337
|
+
try {
|
|
338
|
+
await db.transact([
|
|
339
|
+
db.tx.profiles[id()].create({
|
|
340
|
+
userId,
|
|
341
|
+
nickname: data.nickname,
|
|
342
|
+
bio: data.bio || "",
|
|
343
|
+
createdAt: Date.now(),
|
|
344
|
+
updatedAt: Date.now(),
|
|
345
|
+
})
|
|
346
|
+
]);
|
|
347
|
+
return { success: true };
|
|
348
|
+
} catch (error) {
|
|
349
|
+
return { success: false, error: error.message };
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
`;
|
|
354
|
+
await fs.writeFile(path.join(process.cwd(), "lib", "instantdb.ts"), authUtilsContent);
|
|
355
|
+
// Create auth components
|
|
356
|
+
await this.createAuthComponents();
|
|
357
|
+
}
|
|
358
|
+
async createAuthComponents() {
|
|
359
|
+
// Create auth directory
|
|
360
|
+
const authDir = path.join(process.cwd(), "components", "auth");
|
|
361
|
+
await fs.ensureDir(authDir);
|
|
362
|
+
// Create LoginForm component
|
|
363
|
+
const loginFormContent = `"use client";
|
|
364
|
+
|
|
365
|
+
import { useState } from "react";
|
|
366
|
+
import { Button } from "@/components/ui/button";
|
|
367
|
+
import { Input } from "@/components/ui/input";
|
|
368
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
369
|
+
import { authUtils } from "@/lib/instantdb";
|
|
370
|
+
import { toast } from "sonner";
|
|
371
|
+
|
|
372
|
+
interface LoginFormProps {
|
|
373
|
+
onSuccess?: () => void;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export function LoginForm({ onSuccess }: LoginFormProps) {
|
|
377
|
+
const [email, setEmail] = useState("");
|
|
378
|
+
const [code, setCode] = useState("");
|
|
379
|
+
const [step, setStep] = useState<"email" | "code">("email");
|
|
380
|
+
const [loading, setLoading] = useState(false);
|
|
381
|
+
|
|
382
|
+
const handleSendCode = async (e: React.FormEvent) => {
|
|
383
|
+
e.preventDefault();
|
|
384
|
+
if (!email) return;
|
|
385
|
+
|
|
386
|
+
setLoading(true);
|
|
387
|
+
const result = await authUtils.sendMagicCode(email);
|
|
388
|
+
setLoading(false);
|
|
389
|
+
|
|
390
|
+
if (result.success) {
|
|
391
|
+
setStep("code");
|
|
392
|
+
toast.success("Magic code sent to your email!");
|
|
393
|
+
} else {
|
|
394
|
+
toast.error(result.error || "Failed to send code");
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const handleVerifyCode = async (e: React.FormEvent) => {
|
|
399
|
+
e.preventDefault();
|
|
400
|
+
if (!code) return;
|
|
401
|
+
|
|
402
|
+
setLoading(true);
|
|
403
|
+
const result = await authUtils.signInWithMagicCode(email, code);
|
|
404
|
+
setLoading(false);
|
|
405
|
+
|
|
406
|
+
if (result.success) {
|
|
407
|
+
toast.success("Successfully signed in!");
|
|
408
|
+
onSuccess?.();
|
|
409
|
+
} else {
|
|
410
|
+
toast.error(result.error || "Invalid code");
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
return (
|
|
415
|
+
<Card className="w-full max-w-md mx-auto">
|
|
416
|
+
<CardHeader>
|
|
417
|
+
<CardTitle>Sign In</CardTitle>
|
|
418
|
+
<CardDescription>
|
|
419
|
+
{step === "email"
|
|
420
|
+
? "Enter your email to receive a magic code"
|
|
421
|
+
: "Enter the code sent to your email"
|
|
422
|
+
}
|
|
423
|
+
</CardDescription>
|
|
424
|
+
</CardHeader>
|
|
425
|
+
<CardContent>
|
|
426
|
+
{step === "email" ? (
|
|
427
|
+
<form onSubmit={handleSendCode} className="space-y-4">
|
|
428
|
+
<Input
|
|
429
|
+
type="email"
|
|
430
|
+
placeholder="Enter your email"
|
|
431
|
+
value={email}
|
|
432
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
433
|
+
required
|
|
434
|
+
/>
|
|
435
|
+
<Button type="submit" className="w-full" disabled={loading}>
|
|
436
|
+
{loading ? "Sending..." : "Send Magic Code"}
|
|
437
|
+
</Button>
|
|
438
|
+
</form>
|
|
439
|
+
) : (
|
|
440
|
+
<form onSubmit={handleVerifyCode} className="space-y-4">
|
|
441
|
+
<Input
|
|
442
|
+
type="text"
|
|
443
|
+
placeholder="Enter magic code"
|
|
444
|
+
value={code}
|
|
445
|
+
onChange={(e) => setCode(e.target.value)}
|
|
446
|
+
required
|
|
447
|
+
/>
|
|
448
|
+
<div className="flex gap-2">
|
|
449
|
+
<Button
|
|
450
|
+
type="button"
|
|
451
|
+
variant="outline"
|
|
452
|
+
onClick={() => setStep("email")}
|
|
453
|
+
className="flex-1"
|
|
454
|
+
>
|
|
455
|
+
Back
|
|
456
|
+
</Button>
|
|
457
|
+
<Button type="submit" className="flex-1" disabled={loading}>
|
|
458
|
+
{loading ? "Verifying..." : "Verify Code"}
|
|
459
|
+
</Button>
|
|
460
|
+
</div>
|
|
461
|
+
</form>
|
|
462
|
+
)}
|
|
463
|
+
</CardContent>
|
|
464
|
+
</Card>
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
`;
|
|
468
|
+
await fs.writeFile(path.join(authDir, "LoginForm.tsx"), loginFormContent);
|
|
469
|
+
// Create UserDashboard component
|
|
470
|
+
const userDashboardContent = `"use client";
|
|
471
|
+
|
|
472
|
+
import { db } from "@/lib/instantdb";
|
|
473
|
+
import { Button } from "@/components/ui/button";
|
|
474
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
475
|
+
import { authUtils } from "@/lib/instantdb";
|
|
476
|
+
import { toast } from "sonner";
|
|
477
|
+
|
|
478
|
+
export function UserDashboard() {
|
|
479
|
+
const user = db.useUser();
|
|
480
|
+
|
|
481
|
+
const handleSignOut = async () => {
|
|
482
|
+
const result = await authUtils.signOut();
|
|
483
|
+
if (result.success) {
|
|
484
|
+
toast.success("Signed out successfully");
|
|
485
|
+
} else {
|
|
486
|
+
toast.error(result.error || "Failed to sign out");
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
if (!user) {
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return (
|
|
495
|
+
<Card className="w-full max-w-md mx-auto">
|
|
496
|
+
<CardHeader>
|
|
497
|
+
<CardTitle>Welcome, {user.email}!</CardTitle>
|
|
498
|
+
<CardDescription>Your account dashboard</CardDescription>
|
|
499
|
+
</CardHeader>
|
|
500
|
+
<CardContent className="space-y-4">
|
|
501
|
+
<div>
|
|
502
|
+
<p className="text-sm text-muted-foreground">Email:</p>
|
|
503
|
+
<p className="font-medium">{user.email}</p>
|
|
504
|
+
</div>
|
|
505
|
+
<div>
|
|
506
|
+
<p className="text-sm text-muted-foreground">User ID:</p>
|
|
507
|
+
<p className="font-mono text-xs">{user.id}</p>
|
|
508
|
+
</div>
|
|
509
|
+
<Button onClick={handleSignOut} variant="outline" className="w-full">
|
|
510
|
+
Sign Out
|
|
511
|
+
</Button>
|
|
512
|
+
</CardContent>
|
|
513
|
+
</Card>
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
`;
|
|
517
|
+
await fs.writeFile(path.join(authDir, "UserDashboard.tsx"), userDashboardContent);
|
|
518
|
+
// Create AuthProvider component
|
|
519
|
+
const authProviderContent = `"use client";
|
|
520
|
+
|
|
521
|
+
import { db } from "@/lib/instantdb";
|
|
522
|
+
import { LoginForm } from "./LoginForm";
|
|
523
|
+
import { UserDashboard } from "./UserDashboard";
|
|
524
|
+
|
|
525
|
+
export function AuthProvider() {
|
|
526
|
+
return (
|
|
527
|
+
<db.SignedIn>
|
|
528
|
+
<UserDashboard />
|
|
529
|
+
</db.SignedIn>
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export function AuthForm() {
|
|
534
|
+
return (
|
|
535
|
+
<db.SignedOut>
|
|
536
|
+
<LoginForm />
|
|
537
|
+
</db.SignedOut>
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
`;
|
|
541
|
+
await fs.writeFile(path.join(authDir, "AuthProvider.tsx"), authProviderContent);
|
|
542
|
+
// Create index file
|
|
543
|
+
const indexContent = `export { LoginForm } from "./LoginForm";
|
|
544
|
+
export { UserDashboard } from "./UserDashboard";
|
|
545
|
+
export { AuthProvider, AuthForm } from "./AuthProvider";
|
|
546
|
+
`;
|
|
547
|
+
await fs.writeFile(path.join(authDir, "index.ts"), indexContent);
|
|
548
|
+
}
|
|
549
|
+
async generateDatabaseComponents() {
|
|
550
|
+
// Create database utilities
|
|
551
|
+
const dbUtilsContent = `import { db, id } from "@/lib/instantdb";
|
|
552
|
+
|
|
553
|
+
// Generic CRUD operations
|
|
554
|
+
export const dbUtils = {
|
|
555
|
+
// Create operations
|
|
556
|
+
async create(collection: string, data: any) {
|
|
557
|
+
try {
|
|
558
|
+
await db.transact([
|
|
559
|
+
db.tx[collection][id()].create({
|
|
560
|
+
...data,
|
|
561
|
+
createdAt: Date.now(),
|
|
562
|
+
updatedAt: Date.now(),
|
|
563
|
+
})
|
|
564
|
+
]);
|
|
565
|
+
return { success: true };
|
|
566
|
+
} catch (error) {
|
|
567
|
+
return { success: false, error: error.message };
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
|
|
571
|
+
// Read operations
|
|
572
|
+
async read(collection: string, id: string) {
|
|
573
|
+
try {
|
|
574
|
+
const { data } = await db.query({ [collection]: { $: { where: { id } } } });
|
|
575
|
+
return { success: true, data: data[collection]?.[0] };
|
|
576
|
+
} catch (error) {
|
|
577
|
+
return { success: false, error: error.message };
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
|
|
581
|
+
// Update operations
|
|
582
|
+
async update(collection: string, id: string, data: any) {
|
|
583
|
+
try {
|
|
584
|
+
await db.transact([
|
|
585
|
+
db.tx[collection][id].update({
|
|
586
|
+
...data,
|
|
587
|
+
updatedAt: Date.now(),
|
|
588
|
+
})
|
|
589
|
+
]);
|
|
590
|
+
return { success: true };
|
|
591
|
+
} catch (error) {
|
|
592
|
+
return { success: false, error: error.message };
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
|
|
596
|
+
// Delete operations
|
|
597
|
+
async delete(collection: string, id: string) {
|
|
598
|
+
try {
|
|
599
|
+
await db.transact([
|
|
600
|
+
db.tx[collection][id].delete()
|
|
601
|
+
]);
|
|
602
|
+
return { success: true };
|
|
603
|
+
} catch (error) {
|
|
604
|
+
return { success: false, error: error.message };
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
// List operations
|
|
609
|
+
async list(collection: string, filters?: any) {
|
|
610
|
+
try {
|
|
611
|
+
const query = filters ? { [collection]: { $: { where: filters } } } : { [collection]: {} };
|
|
612
|
+
const { data } = await db.query(query);
|
|
613
|
+
return { success: true, data: data[collection] || [] };
|
|
614
|
+
} catch (error) {
|
|
615
|
+
return { success: false, error: error.message };
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// Real-time hooks
|
|
621
|
+
export const useRealtimeQuery = (query: any) => {
|
|
622
|
+
return db.useQuery(query);
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
export const useUser = () => {
|
|
626
|
+
return db.useUser();
|
|
627
|
+
};
|
|
628
|
+
`;
|
|
629
|
+
await fs.writeFile(path.join(process.cwd(), "lib", "db-utils.ts"), dbUtilsContent);
|
|
630
|
+
}
|
|
631
|
+
async integrateDatabaseWithComponents() {
|
|
632
|
+
// Update existing components to use database
|
|
633
|
+
const componentsDir = path.join(process.cwd(), "components");
|
|
634
|
+
if (!(await fs.pathExists(componentsDir))) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
// This would scan existing components and add database integration
|
|
638
|
+
// For now, we'll create a sample integration
|
|
639
|
+
console.log(chalk_1.default.gray(" Database integration ready for existing components"));
|
|
640
|
+
}
|
|
641
|
+
showNextSteps() {
|
|
642
|
+
console.log(chalk_1.default.blue.bold("\nšÆ Next Steps:\n"));
|
|
643
|
+
console.log(chalk_1.default.yellow("1. Configure your InstantDB app:"));
|
|
644
|
+
console.log(chalk_1.default.gray(" ⢠Visit https://instantdb.com/dash"));
|
|
645
|
+
console.log(chalk_1.default.gray(" ⢠Create a new app or use existing one"));
|
|
646
|
+
console.log(chalk_1.default.gray(" ⢠Copy your APP_ID\n"));
|
|
647
|
+
console.log(chalk_1.default.yellow("2. Set up environment variables:"));
|
|
648
|
+
console.log(chalk_1.default.gray(" ⢠Add NEXT_PUBLIC_INSTANT_APP_ID to your .env.local"));
|
|
649
|
+
console.log(chalk_1.default.gray(" ⢠Example: NEXT_PUBLIC_INSTANT_APP_ID=your_app_id_here\n"));
|
|
650
|
+
console.log(chalk_1.default.yellow("3. Push your schema to InstantDB:"));
|
|
651
|
+
console.log(chalk_1.default.gray(" ⢠Run: npx instant-cli@latest push"));
|
|
652
|
+
console.log(chalk_1.default.gray(" ⢠This will sync your schema with InstantDB\n"));
|
|
653
|
+
console.log(chalk_1.default.yellow("4. Test your setup:"));
|
|
654
|
+
console.log(chalk_1.default.gray(" ⢠Import and use AuthProvider in your app"));
|
|
655
|
+
console.log(chalk_1.default.gray(" ⢠Test the magic code authentication flow\n"));
|
|
656
|
+
console.log(chalk_1.default.yellow("5. Generate components with database integration:"));
|
|
657
|
+
console.log(chalk_1.default.gray(" ⢠Run: mycontext generate-components"));
|
|
658
|
+
console.log(chalk_1.default.gray(" ⢠Components will automatically include database features\n"));
|
|
659
|
+
console.log(chalk_1.default.cyan("š Documentation:"));
|
|
660
|
+
console.log(chalk_1.default.gray(" ⢠InstantDB Docs: https://instantdb.com/docs"));
|
|
661
|
+
console.log(chalk_1.default.gray(" ⢠Magic Code Auth: https://instantdb.com/docs/auth/magic-codes"));
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
exports.DatabaseSetupCommand = DatabaseSetupCommand;
|
|
665
|
+
//# sourceMappingURL=setup-database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-database.js","sourceRoot":"","sources":["../../src/commands/setup-database.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAG1B,8CAAmD;AACnD,oDAAwD;AACxD,iDAAyC;AACzC,6CAA+B;AAC/B,2CAA6B;AAY7B,MAAa,oBAAoB;IAAjC;QACU,OAAE,GAAG,IAAI,8BAAiB,EAAE,CAAC;QAC7B,YAAO,GAAG,IAAI,yBAAe,CAAC,wBAAwB,CAAC,CAAC;IAgvBlE,CAAC;IA9uBC,KAAK,CAAC,OAAO,CAAC,OAA6B;QACzC,MAAM,EACJ,QAAQ,GAAG,WAAW,EACtB,IAAI,GAAG,IAAI,EACX,MAAM,GAAG,IAAI,EACb,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,KAAK,EAChB,UAAU,GAAG,KAAK,EAClB,cAAc,GAAG,KAAK,GACvB,GAAG,OAAO,CAAC;QAEZ,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAErD,IAAI,CAAC;YACH,oCAAoC;YACpC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAC;YACJ,C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