codebakers 1.0.45 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +275 -60
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3999 -0
- package/install.bat +9 -0
- package/package.json +71 -115
- package/src/channels/discord.ts +5 -0
- package/src/channels/slack.ts +5 -0
- package/src/channels/sms.ts +4 -0
- package/src/channels/telegram.ts +5 -0
- package/src/channels/whatsapp.ts +7 -0
- package/src/commands/check.ts +365 -0
- package/src/commands/code.ts +684 -0
- package/src/commands/connect.ts +12 -0
- package/src/commands/deploy.ts +414 -0
- package/src/commands/fix.ts +20 -0
- package/src/commands/gateway.ts +604 -0
- package/src/commands/generate.ts +178 -0
- package/src/commands/init.ts +574 -0
- package/src/commands/learn.ts +36 -0
- package/src/commands/security.ts +102 -0
- package/src/commands/setup.ts +448 -0
- package/src/commands/status.ts +56 -0
- package/src/index.ts +268 -0
- package/src/patterns/loader.ts +337 -0
- package/src/services/github.ts +61 -0
- package/src/services/supabase.ts +147 -0
- package/src/services/vercel.ts +61 -0
- package/src/utils/claude-md.ts +287 -0
- package/src/utils/config.ts +282 -0
- package/src/utils/updates.ts +27 -0
- package/tsconfig.json +17 -10
- package/.vscodeignore +0 -18
- package/LICENSE +0 -21
- package/codebakers-1.0.0.vsix +0 -0
- package/codebakers-1.0.10.vsix +0 -0
- package/codebakers-1.0.11.vsix +0 -0
- package/codebakers-1.0.12.vsix +0 -0
- package/codebakers-1.0.13.vsix +0 -0
- package/codebakers-1.0.14.vsix +0 -0
- package/codebakers-1.0.15.vsix +0 -0
- package/codebakers-1.0.16.vsix +0 -0
- package/codebakers-1.0.17.vsix +0 -0
- package/codebakers-1.0.18.vsix +0 -0
- package/codebakers-1.0.19.vsix +0 -0
- package/codebakers-1.0.20.vsix +0 -0
- package/codebakers-1.0.21.vsix +0 -0
- package/codebakers-1.0.22.vsix +0 -0
- package/codebakers-1.0.23.vsix +0 -0
- package/codebakers-1.0.24.vsix +0 -0
- package/codebakers-1.0.25.vsix +0 -0
- package/codebakers-1.0.26.vsix +0 -0
- package/codebakers-1.0.27.vsix +0 -0
- package/codebakers-1.0.28.vsix +0 -0
- package/codebakers-1.0.29.vsix +0 -0
- package/codebakers-1.0.30.vsix +0 -0
- package/codebakers-1.0.31.vsix +0 -0
- package/codebakers-1.0.32.vsix +0 -0
- package/codebakers-1.0.35.vsix +0 -0
- package/codebakers-1.0.36.vsix +0 -0
- package/codebakers-1.0.37.vsix +0 -0
- package/codebakers-1.0.38.vsix +0 -0
- package/codebakers-1.0.39.vsix +0 -0
- package/codebakers-1.0.40.vsix +0 -0
- package/codebakers-1.0.41.vsix +0 -0
- package/codebakers-1.0.42.vsix +0 -0
- package/codebakers-1.0.43.vsix +0 -0
- package/codebakers-1.0.44.vsix +0 -0
- package/codebakers-1.0.45.vsix +0 -0
- package/dist/extension.js +0 -1394
- package/esbuild.js +0 -63
- package/media/icon.png +0 -0
- package/media/icon.svg +0 -7
- package/nul +0 -1
- package/preview.html +0 -547
- package/src/ChatPanelProvider.ts +0 -1815
- package/src/ChatViewProvider.ts +0 -749
- package/src/CodeBakersClient.ts +0 -1146
- package/src/CodeValidator.ts +0 -645
- package/src/FileOperations.ts +0 -410
- package/src/ProjectContext.ts +0 -526
- package/src/extension.ts +0 -332
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import * as fs from 'fs-extra';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
|
|
6
|
+
export async function generateCommand(type?: string): Promise<void> {
|
|
7
|
+
p.intro(chalk.bgCyan.black(' Generate '));
|
|
8
|
+
|
|
9
|
+
const generateType = type || await p.select({
|
|
10
|
+
message: 'What do you want to generate?',
|
|
11
|
+
options: [
|
|
12
|
+
{ value: 'component', label: '🧩 Component' },
|
|
13
|
+
{ value: 'page', label: '📄 Page' },
|
|
14
|
+
{ value: 'api', label: '🔌 API Route' },
|
|
15
|
+
{ value: 'hook', label: '🪝 Custom Hook' },
|
|
16
|
+
{ value: 'store', label: '📦 Zustand Store' },
|
|
17
|
+
{ value: 'form', label: '📝 Form Component' },
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (p.isCancel(generateType)) return;
|
|
22
|
+
|
|
23
|
+
const name = await p.text({
|
|
24
|
+
message: 'Name:',
|
|
25
|
+
placeholder: generateType === 'page' ? 'dashboard' : 'MyComponent',
|
|
26
|
+
validate: (v) => !v ? 'Name is required' : undefined,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (p.isCancel(name)) return;
|
|
30
|
+
|
|
31
|
+
const spinner = p.spinner();
|
|
32
|
+
spinner.start('Generating...');
|
|
33
|
+
|
|
34
|
+
await generateFile(generateType as string, name as string);
|
|
35
|
+
|
|
36
|
+
spinner.stop(`Generated ${name}`);
|
|
37
|
+
p.outro('');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function generateFile(type: string, name: string): Promise<void> {
|
|
41
|
+
const cwd = process.cwd();
|
|
42
|
+
|
|
43
|
+
const templates: Record<string, { path: string; content: string }> = {
|
|
44
|
+
component: {
|
|
45
|
+
path: `src/components/${name}.tsx`,
|
|
46
|
+
content: `'use client';
|
|
47
|
+
|
|
48
|
+
interface ${name}Props {
|
|
49
|
+
// props
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function ${name}({}: ${name}Props) {
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<h2>${name}</h2>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
},
|
|
61
|
+
page: {
|
|
62
|
+
path: `src/app/${name}/page.tsx`,
|
|
63
|
+
content: `export default function ${name.charAt(0).toUpperCase() + name.slice(1)}Page() {
|
|
64
|
+
return (
|
|
65
|
+
<div className="container mx-auto py-8">
|
|
66
|
+
<h1 className="text-2xl font-bold">${name}</h1>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
},
|
|
72
|
+
api: {
|
|
73
|
+
path: `src/app/api/${name}/route.ts`,
|
|
74
|
+
content: `import { NextRequest, NextResponse } from 'next/server';
|
|
75
|
+
|
|
76
|
+
export async function GET(request: NextRequest) {
|
|
77
|
+
try {
|
|
78
|
+
return NextResponse.json({ data: [] });
|
|
79
|
+
} catch (error) {
|
|
80
|
+
return NextResponse.json({ error: 'Internal error' }, { status: 500 });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export async function POST(request: NextRequest) {
|
|
85
|
+
try {
|
|
86
|
+
const body = await request.json();
|
|
87
|
+
return NextResponse.json({ success: true }, { status: 201 });
|
|
88
|
+
} catch (error) {
|
|
89
|
+
return NextResponse.json({ error: 'Internal error' }, { status: 500 });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`,
|
|
93
|
+
},
|
|
94
|
+
hook: {
|
|
95
|
+
path: `src/hooks/use-${name.toLowerCase()}.ts`,
|
|
96
|
+
content: `import { useState, useEffect } from 'react';
|
|
97
|
+
|
|
98
|
+
export function use${name}() {
|
|
99
|
+
const [data, setData] = useState(null);
|
|
100
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
101
|
+
const [error, setError] = useState<Error | null>(null);
|
|
102
|
+
|
|
103
|
+
return { data, isLoading, error };
|
|
104
|
+
}
|
|
105
|
+
`,
|
|
106
|
+
},
|
|
107
|
+
store: {
|
|
108
|
+
path: `src/stores/${name.toLowerCase()}-store.ts`,
|
|
109
|
+
content: `import { create } from 'zustand';
|
|
110
|
+
|
|
111
|
+
interface ${name}State {
|
|
112
|
+
items: unknown[];
|
|
113
|
+
isLoading: boolean;
|
|
114
|
+
setItems: (items: unknown[]) => void;
|
|
115
|
+
reset: () => void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const use${name}Store = create<${name}State>((set) => ({
|
|
119
|
+
items: [],
|
|
120
|
+
isLoading: false,
|
|
121
|
+
setItems: (items) => set({ items }),
|
|
122
|
+
reset: () => set({ items: [], isLoading: false }),
|
|
123
|
+
}));
|
|
124
|
+
`,
|
|
125
|
+
},
|
|
126
|
+
form: {
|
|
127
|
+
path: `src/components/forms/${name}-form.tsx`,
|
|
128
|
+
content: `'use client';
|
|
129
|
+
|
|
130
|
+
import { useState } from 'react';
|
|
131
|
+
import { useForm } from 'react-hook-form';
|
|
132
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
133
|
+
import { z } from 'zod';
|
|
134
|
+
import { toast } from 'sonner';
|
|
135
|
+
|
|
136
|
+
const schema = z.object({
|
|
137
|
+
name: z.string().min(1, 'Required'),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
type FormData = z.infer<typeof schema>;
|
|
141
|
+
|
|
142
|
+
export function ${name}Form({ onSuccess }: { onSuccess?: () => void }) {
|
|
143
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
144
|
+
const form = useForm<FormData>({ resolver: zodResolver(schema) });
|
|
145
|
+
|
|
146
|
+
const onSubmit = async (data: FormData) => {
|
|
147
|
+
setIsSubmitting(true);
|
|
148
|
+
try {
|
|
149
|
+
// Submit
|
|
150
|
+
toast.success('Success!');
|
|
151
|
+
onSuccess?.();
|
|
152
|
+
} catch (error) {
|
|
153
|
+
toast.error('Failed');
|
|
154
|
+
} finally {
|
|
155
|
+
setIsSubmitting(false);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
161
|
+
{/* Form fields */}
|
|
162
|
+
<button type="submit" disabled={isSubmitting}>
|
|
163
|
+
{isSubmitting ? 'Submitting...' : 'Submit'}
|
|
164
|
+
</button>
|
|
165
|
+
</form>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
`,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const template = templates[type];
|
|
173
|
+
if (!template) throw new Error(`Unknown type: ${type}`);
|
|
174
|
+
|
|
175
|
+
const filePath = path.join(cwd, template.path);
|
|
176
|
+
await fs.ensureDir(path.dirname(filePath));
|
|
177
|
+
await fs.writeFile(filePath, template.content);
|
|
178
|
+
}
|