@codebakers/mcp 5.4.1 → 5.4.3
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/INSTALL.md +221 -221
- package/LICENSE +21 -21
- package/README.md +412 -412
- package/dist/cli.js +27 -27
- package/dist/tools/analyze-mockups.js +37 -37
- package/dist/tools/autonomous-build.d.ts +18 -18
- package/dist/tools/autonomous-build.js +286 -286
- package/dist/tools/check-gate.js +6 -6
- package/dist/tools/check-scope.js +10 -10
- package/dist/tools/enforce-feature.js +15 -15
- package/dist/tools/fix-commit.js +18 -18
- package/dist/tools/fix-mockups.js +191 -191
- package/dist/tools/generate-api-route.js +155 -155
- package/dist/tools/generate-chatbot.js +306 -306
- package/dist/tools/generate-component.js +117 -117
- package/dist/tools/generate-docs.js +525 -525
- package/dist/tools/generate-e2e-tests.js +19 -19
- package/dist/tools/generate-migration.js +22 -22
- package/dist/tools/generate-schema.js +37 -37
- package/dist/tools/generate-spec.js +38 -38
- package/dist/tools/generate-store-contracts.js +42 -42
- package/dist/tools/generate-store.js +109 -109
- package/dist/tools/generate-unit-tests.js +57 -57
- package/dist/tools/map-dependencies.js +45 -45
- package/dist/tools/run-interview.js +142 -142
- package/dist/tools/setup-github.js +8 -8
- package/dist/tools/setup-supabase.js +8 -8
- package/dist/tools/setup-vercel.js +8 -8
- package/dist/tools/validate-mockups.js +19 -19
- package/package.json +50 -50
|
@@ -37,176 +37,176 @@ export async function generateApiRoute(args) {
|
|
|
37
37
|
const fullPath = path.join(cwd, routePath);
|
|
38
38
|
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
39
39
|
await fs.writeFile(fullPath, code, 'utf-8');
|
|
40
|
-
return `🍞 CodeBakers: API Route Generated
|
|
41
|
-
|
|
42
|
-
**File:** ${routePath}
|
|
43
|
-
**Entity:** ${entity}
|
|
44
|
-
**Operation:** ${operation}
|
|
45
|
-
|
|
46
|
-
Includes:
|
|
47
|
-
✅ Authentication check
|
|
48
|
-
✅ Security filter (user_id)
|
|
49
|
-
✅ Error handling
|
|
50
|
-
✅ TypeScript types
|
|
51
|
-
✅ Supabase integration
|
|
40
|
+
return `🍞 CodeBakers: API Route Generated
|
|
41
|
+
|
|
42
|
+
**File:** ${routePath}
|
|
43
|
+
**Entity:** ${entity}
|
|
44
|
+
**Operation:** ${operation}
|
|
45
|
+
|
|
46
|
+
Includes:
|
|
47
|
+
✅ Authentication check
|
|
48
|
+
✅ Security filter (user_id)
|
|
49
|
+
✅ Error handling
|
|
50
|
+
✅ TypeScript types
|
|
51
|
+
✅ Supabase integration
|
|
52
52
|
✅ Uses .maybeSingle() (not .single())`;
|
|
53
53
|
}
|
|
54
54
|
function generateListRoute(entity, table) {
|
|
55
|
-
return `import { createClient } from '@/lib/supabase/server';
|
|
56
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
57
|
-
|
|
58
|
-
export async function GET(req: NextRequest) {
|
|
59
|
-
const supabase = createClient();
|
|
60
|
-
|
|
61
|
-
const { data: { user } } = await supabase.auth.getUser();
|
|
62
|
-
if (!user) {
|
|
63
|
-
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const { data, error } = await supabase
|
|
67
|
-
.from('${table}')
|
|
68
|
-
.select('*')
|
|
69
|
-
.eq('user_id', user.id)
|
|
70
|
-
.order('created_at', { ascending: false });
|
|
71
|
-
|
|
72
|
-
if (error) {
|
|
73
|
-
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return NextResponse.json({ data });
|
|
77
|
-
}
|
|
55
|
+
return `import { createClient } from '@/lib/supabase/server';
|
|
56
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
57
|
+
|
|
58
|
+
export async function GET(req: NextRequest) {
|
|
59
|
+
const supabase = createClient();
|
|
60
|
+
|
|
61
|
+
const { data: { user } } = await supabase.auth.getUser();
|
|
62
|
+
if (!user) {
|
|
63
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const { data, error } = await supabase
|
|
67
|
+
.from('${table}')
|
|
68
|
+
.select('*')
|
|
69
|
+
.eq('user_id', user.id)
|
|
70
|
+
.order('created_at', { ascending: false });
|
|
71
|
+
|
|
72
|
+
if (error) {
|
|
73
|
+
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return NextResponse.json({ data });
|
|
77
|
+
}
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
function generateGetRoute(entity, table) {
|
|
81
|
-
return `import { createClient } from '@/lib/supabase/server';
|
|
82
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
83
|
-
|
|
84
|
-
export async function GET(
|
|
85
|
-
req: NextRequest,
|
|
86
|
-
{ params }: { params: { id: string } }
|
|
87
|
-
) {
|
|
88
|
-
const supabase = createClient();
|
|
89
|
-
|
|
90
|
-
const { data: { user } } = await supabase.auth.getUser();
|
|
91
|
-
if (!user) {
|
|
92
|
-
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const { data, error } = await supabase
|
|
96
|
-
.from('${table}')
|
|
97
|
-
.select('*')
|
|
98
|
-
.eq('id', params.id)
|
|
99
|
-
.eq('user_id', user.id)
|
|
100
|
-
.maybeSingle();
|
|
101
|
-
|
|
102
|
-
if (error) {
|
|
103
|
-
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (!data) {
|
|
107
|
-
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return NextResponse.json({ data });
|
|
111
|
-
}
|
|
81
|
+
return `import { createClient } from '@/lib/supabase/server';
|
|
82
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
83
|
+
|
|
84
|
+
export async function GET(
|
|
85
|
+
req: NextRequest,
|
|
86
|
+
{ params }: { params: { id: string } }
|
|
87
|
+
) {
|
|
88
|
+
const supabase = createClient();
|
|
89
|
+
|
|
90
|
+
const { data: { user } } = await supabase.auth.getUser();
|
|
91
|
+
if (!user) {
|
|
92
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const { data, error } = await supabase
|
|
96
|
+
.from('${table}')
|
|
97
|
+
.select('*')
|
|
98
|
+
.eq('id', params.id)
|
|
99
|
+
.eq('user_id', user.id)
|
|
100
|
+
.maybeSingle();
|
|
101
|
+
|
|
102
|
+
if (error) {
|
|
103
|
+
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (!data) {
|
|
107
|
+
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return NextResponse.json({ data });
|
|
111
|
+
}
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
114
|
function generateCreateRoute(entity, table) {
|
|
115
|
-
return `import { createClient } from '@/lib/supabase/server';
|
|
116
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
117
|
-
|
|
118
|
-
export async function POST(req: NextRequest) {
|
|
119
|
-
const supabase = createClient();
|
|
120
|
-
|
|
121
|
-
const { data: { user } } = await supabase.auth.getUser();
|
|
122
|
-
if (!user) {
|
|
123
|
-
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const body = await req.json();
|
|
127
|
-
|
|
128
|
-
const { data, error } = await supabase
|
|
129
|
-
.from('${table}')
|
|
130
|
-
.insert({
|
|
131
|
-
...body,
|
|
132
|
-
user_id: user.id,
|
|
133
|
-
})
|
|
134
|
-
.select()
|
|
135
|
-
.maybeSingle();
|
|
136
|
-
|
|
137
|
-
if (error) {
|
|
138
|
-
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return NextResponse.json({ data }, { status: 201 });
|
|
142
|
-
}
|
|
115
|
+
return `import { createClient } from '@/lib/supabase/server';
|
|
116
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
117
|
+
|
|
118
|
+
export async function POST(req: NextRequest) {
|
|
119
|
+
const supabase = createClient();
|
|
120
|
+
|
|
121
|
+
const { data: { user } } = await supabase.auth.getUser();
|
|
122
|
+
if (!user) {
|
|
123
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const body = await req.json();
|
|
127
|
+
|
|
128
|
+
const { data, error } = await supabase
|
|
129
|
+
.from('${table}')
|
|
130
|
+
.insert({
|
|
131
|
+
...body,
|
|
132
|
+
user_id: user.id,
|
|
133
|
+
})
|
|
134
|
+
.select()
|
|
135
|
+
.maybeSingle();
|
|
136
|
+
|
|
137
|
+
if (error) {
|
|
138
|
+
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return NextResponse.json({ data }, { status: 201 });
|
|
142
|
+
}
|
|
143
143
|
`;
|
|
144
144
|
}
|
|
145
145
|
function generateUpdateRoute(entity, table) {
|
|
146
|
-
return `import { createClient } from '@/lib/supabase/server';
|
|
147
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
148
|
-
|
|
149
|
-
export async function PATCH(
|
|
150
|
-
req: NextRequest,
|
|
151
|
-
{ params }: { params: { id: string } }
|
|
152
|
-
) {
|
|
153
|
-
const supabase = createClient();
|
|
154
|
-
|
|
155
|
-
const { data: { user } } = await supabase.auth.getUser();
|
|
156
|
-
if (!user) {
|
|
157
|
-
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const body = await req.json();
|
|
161
|
-
|
|
162
|
-
const { data, error } = await supabase
|
|
163
|
-
.from('${table}')
|
|
164
|
-
.update(body)
|
|
165
|
-
.eq('id', params.id)
|
|
166
|
-
.eq('user_id', user.id)
|
|
167
|
-
.select()
|
|
168
|
-
.maybeSingle();
|
|
169
|
-
|
|
170
|
-
if (error) {
|
|
171
|
-
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (!data) {
|
|
175
|
-
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return NextResponse.json({ data });
|
|
179
|
-
}
|
|
146
|
+
return `import { createClient } from '@/lib/supabase/server';
|
|
147
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
148
|
+
|
|
149
|
+
export async function PATCH(
|
|
150
|
+
req: NextRequest,
|
|
151
|
+
{ params }: { params: { id: string } }
|
|
152
|
+
) {
|
|
153
|
+
const supabase = createClient();
|
|
154
|
+
|
|
155
|
+
const { data: { user } } = await supabase.auth.getUser();
|
|
156
|
+
if (!user) {
|
|
157
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const body = await req.json();
|
|
161
|
+
|
|
162
|
+
const { data, error } = await supabase
|
|
163
|
+
.from('${table}')
|
|
164
|
+
.update(body)
|
|
165
|
+
.eq('id', params.id)
|
|
166
|
+
.eq('user_id', user.id)
|
|
167
|
+
.select()
|
|
168
|
+
.maybeSingle();
|
|
169
|
+
|
|
170
|
+
if (error) {
|
|
171
|
+
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (!data) {
|
|
175
|
+
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return NextResponse.json({ data });
|
|
179
|
+
}
|
|
180
180
|
`;
|
|
181
181
|
}
|
|
182
182
|
function generateDeleteRoute(entity, table) {
|
|
183
|
-
return `import { createClient } from '@/lib/supabase/server';
|
|
184
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
185
|
-
|
|
186
|
-
export async function DELETE(
|
|
187
|
-
req: NextRequest,
|
|
188
|
-
{ params }: { params: { id: string } }
|
|
189
|
-
) {
|
|
190
|
-
const supabase = createClient();
|
|
191
|
-
|
|
192
|
-
const { data: { user } } = await supabase.auth.getUser();
|
|
193
|
-
if (!user) {
|
|
194
|
-
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const { error } = await supabase
|
|
198
|
-
.from('${table}')
|
|
199
|
-
.delete()
|
|
200
|
-
.eq('id', params.id)
|
|
201
|
-
.eq('user_id', user.id)
|
|
202
|
-
.maybeSingle();
|
|
203
|
-
|
|
204
|
-
if (error) {
|
|
205
|
-
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return NextResponse.json({ success: true });
|
|
209
|
-
}
|
|
183
|
+
return `import { createClient } from '@/lib/supabase/server';
|
|
184
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
185
|
+
|
|
186
|
+
export async function DELETE(
|
|
187
|
+
req: NextRequest,
|
|
188
|
+
{ params }: { params: { id: string } }
|
|
189
|
+
) {
|
|
190
|
+
const supabase = createClient();
|
|
191
|
+
|
|
192
|
+
const { data: { user } } = await supabase.auth.getUser();
|
|
193
|
+
if (!user) {
|
|
194
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const { error } = await supabase
|
|
198
|
+
.from('${table}')
|
|
199
|
+
.delete()
|
|
200
|
+
.eq('id', params.id)
|
|
201
|
+
.eq('user_id', user.id)
|
|
202
|
+
.maybeSingle();
|
|
203
|
+
|
|
204
|
+
if (error) {
|
|
205
|
+
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return NextResponse.json({ success: true });
|
|
209
|
+
}
|
|
210
210
|
`;
|
|
211
211
|
}
|
|
212
212
|
//# sourceMappingURL=generate-api-route.js.map
|