codebakers 2.5.3 → 3.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.
Files changed (60) hide show
  1. package/README.md +54 -255
  2. package/dist/chunk-HOWR3YTF.js +146 -0
  3. package/dist/index.d.ts +0 -3
  4. package/dist/index.js +10489 -7994
  5. package/dist/terminal-6ZQVP6R7.js +10 -0
  6. package/package.json +26 -41
  7. package/AUDIT_REPORT.md +0 -138
  8. package/dist/advisors-RWRTSJRR.js +0 -7
  9. package/dist/chunk-ASIJIQYC.js +0 -320
  10. package/dist/chunk-D44U3IEA.js +0 -565
  11. package/dist/chunk-LANM5XQW.js +0 -326
  12. package/dist/prd-RYITSL6Q.js +0 -7
  13. package/install.bat +0 -9
  14. package/installers/CodeBakers-Install.bat +0 -207
  15. package/installers/CodeBakers-Install.command +0 -232
  16. package/installers/README.md +0 -157
  17. package/installers/mac/assets/README.txt +0 -31
  18. package/installers/mac/build-mac-installer.sh +0 -240
  19. package/installers/windows/CodeBakers.iss +0 -256
  20. package/installers/windows/assets/README.txt +0 -16
  21. package/installers/windows/scripts/post-install.bat +0 -15
  22. package/src/channels/discord.ts +0 -5
  23. package/src/channels/slack.ts +0 -5
  24. package/src/channels/sms.ts +0 -4
  25. package/src/channels/telegram.ts +0 -5
  26. package/src/channels/whatsapp.ts +0 -7
  27. package/src/commands/advisors.ts +0 -699
  28. package/src/commands/build.ts +0 -1025
  29. package/src/commands/check.ts +0 -365
  30. package/src/commands/code.ts +0 -806
  31. package/src/commands/connect.ts +0 -12
  32. package/src/commands/deploy.ts +0 -448
  33. package/src/commands/design.ts +0 -298
  34. package/src/commands/fix.ts +0 -20
  35. package/src/commands/gateway.ts +0 -604
  36. package/src/commands/generate.ts +0 -178
  37. package/src/commands/init.ts +0 -634
  38. package/src/commands/integrate.ts +0 -884
  39. package/src/commands/learn.ts +0 -36
  40. package/src/commands/migrate.ts +0 -419
  41. package/src/commands/prd-maker.ts +0 -588
  42. package/src/commands/prd.ts +0 -419
  43. package/src/commands/security.ts +0 -102
  44. package/src/commands/setup.ts +0 -600
  45. package/src/commands/status.ts +0 -56
  46. package/src/commands/website.ts +0 -741
  47. package/src/index.ts +0 -627
  48. package/src/patterns/loader.ts +0 -337
  49. package/src/services/github.ts +0 -61
  50. package/src/services/supabase.ts +0 -147
  51. package/src/services/vercel.ts +0 -61
  52. package/src/utils/claude-md.ts +0 -287
  53. package/src/utils/config.ts +0 -375
  54. package/src/utils/display.ts +0 -338
  55. package/src/utils/files.ts +0 -418
  56. package/src/utils/nlp.ts +0 -312
  57. package/src/utils/ui.ts +0 -441
  58. package/src/utils/updates.ts +0 -8
  59. package/src/utils/voice.ts +0 -323
  60. package/tsconfig.json +0 -26
package/src/utils/nlp.ts DELETED
@@ -1,312 +0,0 @@
1
- import * as p from '@clack/prompts';
2
- import chalk from 'chalk';
3
- import Anthropic from '@anthropic-ai/sdk';
4
- import { Config } from '../utils/config.js';
5
-
6
- // ============================================================================
7
- // COMMAND MAPPING
8
- // ============================================================================
9
-
10
- interface ParsedCommand {
11
- command: string;
12
- args: string[];
13
- confidence: number;
14
- interpretation: string;
15
- }
16
-
17
- interface CommandOption {
18
- value: string;
19
- label: string;
20
- description: string;
21
- }
22
-
23
- const COMMAND_PATTERNS: Record<string, { patterns: string[]; description: string }> = {
24
- init: {
25
- patterns: ['new project', 'create app', 'start project', 'initialize', 'new app', 'start building', 'create new'],
26
- description: 'Create a new project',
27
- },
28
- build: {
29
- patterns: ['build from prd', 'build app', 'build project', 'use prd', 'parallel build', 'swarm build', 'build this'],
30
- description: 'Build from PRD with parallel agents',
31
- },
32
- code: {
33
- patterns: ['add feature', 'create component', 'fix bug', 'help me code', 'write code', 'implement', 'add', 'create'],
34
- description: 'AI coding agent',
35
- },
36
- check: {
37
- patterns: ['check code', 'lint', 'validate', 'any problems', 'check quality', 'review code', 'check patterns'],
38
- description: 'Check code quality and patterns',
39
- },
40
- deploy: {
41
- patterns: ['deploy', 'publish', 'go live', 'push to production', 'ship it', 'release', 'launch'],
42
- description: 'Deploy to Vercel',
43
- },
44
- fix: {
45
- patterns: ['fix errors', 'fix bugs', 'repair', 'broken', 'not working', 'fix issues', 'auto fix'],
46
- description: 'Auto-fix errors',
47
- },
48
- migrate: {
49
- patterns: ['database', 'migration', 'schema', 'db push', 'migrate', 'update database'],
50
- description: 'Database migrations',
51
- },
52
- design: {
53
- patterns: ['design', 'colors', 'style', 'theme', 'branding', 'look and feel', 'ui style'],
54
- description: 'Design system settings',
55
- },
56
- advisors: {
57
- patterns: ['advisors', 'dream team', 'experts', 'feedback', 'review idea', 'consult', 'get advice'],
58
- description: 'Dream Team advisory board',
59
- },
60
- 'prd-maker': {
61
- patterns: ['make prd', 'create prd', 'write requirements', 'plan project', 'document requirements', 'spec'],
62
- description: 'Create PRD through interview',
63
- },
64
- security: {
65
- patterns: ['security', 'vulnerabilities', 'audit', 'security check', 'scan for issues'],
66
- description: 'Security audit',
67
- },
68
- status: {
69
- patterns: ['status', 'progress', 'how is it going', 'show projects', 'list projects'],
70
- description: 'Project status',
71
- },
72
- setup: {
73
- patterns: ['setup', 'configure', 'connect accounts', 'api keys', 'settings'],
74
- description: 'Initial setup',
75
- },
76
- help: {
77
- patterns: ['help', 'what can you do', 'commands', 'how to use', 'guide'],
78
- description: 'Show help',
79
- },
80
- };
81
-
82
- // ============================================================================
83
- // NATURAL LANGUAGE PARSER
84
- // ============================================================================
85
-
86
- export async function parseNaturalLanguage(input: string, config: Config): Promise<ParsedCommand | null> {
87
- const normalizedInput = input.toLowerCase().trim();
88
-
89
- // Quick pattern matching first (no API call needed)
90
- const quickMatch = quickPatternMatch(normalizedInput);
91
- if (quickMatch && quickMatch.confidence > 0.8) {
92
- return quickMatch;
93
- }
94
-
95
- // For ambiguous or complex inputs, use Claude
96
- const anthropicCreds = config.getCredentials('anthropic');
97
- if (!anthropicCreds?.apiKey) {
98
- // Fall back to best guess without AI
99
- return quickMatch;
100
- }
101
-
102
- const anthropic = new Anthropic({ apiKey: anthropicCreds.apiKey });
103
-
104
- try {
105
- const result = await parseWithAI(anthropic, input);
106
- return result;
107
- } catch {
108
- // Fall back to pattern matching
109
- return quickMatch;
110
- }
111
- }
112
-
113
- function quickPatternMatch(input: string): ParsedCommand | null {
114
- let bestMatch: ParsedCommand | null = null;
115
- let highestScore = 0;
116
-
117
- for (const [command, { patterns, description }] of Object.entries(COMMAND_PATTERNS)) {
118
- for (const pattern of patterns) {
119
- const score = calculateSimilarity(input, pattern);
120
- if (score > highestScore) {
121
- highestScore = score;
122
- bestMatch = {
123
- command,
124
- args: extractArgs(input, pattern),
125
- confidence: score,
126
- interpretation: description,
127
- };
128
- }
129
- }
130
- }
131
-
132
- // Check for direct command names
133
- for (const command of Object.keys(COMMAND_PATTERNS)) {
134
- if (input.includes(command)) {
135
- return {
136
- command,
137
- args: extractArgs(input, command),
138
- confidence: 0.95,
139
- interpretation: COMMAND_PATTERNS[command].description,
140
- };
141
- }
142
- }
143
-
144
- return bestMatch;
145
- }
146
-
147
- function calculateSimilarity(input: string, pattern: string): number {
148
- const inputWords = input.toLowerCase().split(/\s+/);
149
- const patternWords = pattern.toLowerCase().split(/\s+/);
150
-
151
- let matches = 0;
152
- for (const patternWord of patternWords) {
153
- if (inputWords.some(w => w.includes(patternWord) || patternWord.includes(w))) {
154
- matches++;
155
- }
156
- }
157
-
158
- return matches / patternWords.length;
159
- }
160
-
161
- function extractArgs(input: string, pattern: string): string[] {
162
- // Remove the pattern words to get remaining args
163
- const patternWords = pattern.toLowerCase().split(/\s+/);
164
- const inputWords = input.split(/\s+/);
165
-
166
- const args = inputWords.filter(word =>
167
- !patternWords.some(p => word.toLowerCase().includes(p) || p.includes(word.toLowerCase()))
168
- );
169
-
170
- return args.filter(a => a.length > 2); // Filter out tiny words
171
- }
172
-
173
- async function parseWithAI(anthropic: Anthropic, input: string): Promise<ParsedCommand> {
174
- const commandList = Object.entries(COMMAND_PATTERNS)
175
- .map(([cmd, { description }]) => `- ${cmd}: ${description}`)
176
- .join('\n');
177
-
178
- const response = await anthropic.messages.create({
179
- model: 'claude-sonnet-4-20250514',
180
- max_tokens: 500,
181
- messages: [{
182
- role: 'user',
183
- content: `Parse this user input into a CLI command.
184
-
185
- User said: "${input}"
186
-
187
- Available commands:
188
- ${commandList}
189
- - code: For any coding/feature request not matching above
190
-
191
- Return JSON only:
192
- {
193
- "command": "command-name",
194
- "args": ["any", "extracted", "arguments"],
195
- "confidence": 0.95,
196
- "interpretation": "What the user wants to do"
197
- }
198
-
199
- If the input is asking to build/create/add a specific feature, use "code" and put the request in args.
200
- If unclear between multiple commands, use the most likely one with lower confidence.`
201
- }],
202
- });
203
-
204
- const text = response.content[0].type === 'text' ? response.content[0].text : '';
205
- const jsonMatch = text.match(/\{[\s\S]*?\}/);
206
-
207
- if (!jsonMatch) {
208
- // Default to code command for anything unclear
209
- return {
210
- command: 'code',
211
- args: [input],
212
- confidence: 0.5,
213
- interpretation: 'Passing to AI coding agent',
214
- };
215
- }
216
-
217
- return JSON.parse(jsonMatch[0]);
218
- }
219
-
220
- // ============================================================================
221
- // CLARIFICATION
222
- // ============================================================================
223
-
224
- export async function clarifyCommand(parsed: ParsedCommand): Promise<ParsedCommand> {
225
- // If confidence is high enough, no clarification needed
226
- if (parsed.confidence >= 0.8) {
227
- return parsed;
228
- }
229
-
230
- // If confidence is medium, confirm
231
- if (parsed.confidence >= 0.5) {
232
- const confirm = await p.confirm({
233
- message: `Did you mean: ${parsed.interpretation}?`,
234
- initialValue: true,
235
- });
236
-
237
- if (confirm && !p.isCancel(confirm)) {
238
- return { ...parsed, confidence: 1 };
239
- }
240
- }
241
-
242
- // Low confidence or user said no - ask for clarification
243
- const options: CommandOption[] = [
244
- { value: 'init', label: '🆕 Create new project', description: 'Start a fresh project' },
245
- { value: 'build', label: '🏗️ Build from PRD', description: 'Parallel build from document' },
246
- { value: 'code', label: '💬 AI Coding', description: 'Get help writing code' },
247
- { value: 'check', label: '🔍 Check code', description: 'Lint and validate' },
248
- { value: 'deploy', label: '🚀 Deploy', description: 'Push to production' },
249
- { value: 'fix', label: '🔧 Fix errors', description: 'Auto-fix issues' },
250
- { value: 'advisors', label: '🌟 Dream Team', description: 'Get expert advice' },
251
- { value: 'prd-maker', label: '📝 Create PRD', description: 'Document your idea' },
252
- { value: 'other', label: '❓ Something else', description: 'Describe what you need' },
253
- ];
254
-
255
- const selection = await p.select({
256
- message: 'What would you like to do?',
257
- options: options.map(o => ({ value: o.value, label: o.label, hint: o.description })),
258
- });
259
-
260
- if (p.isCancel(selection)) {
261
- return { ...parsed, command: 'cancel', confidence: 1 };
262
- }
263
-
264
- if (selection === 'other') {
265
- const description = await p.text({
266
- message: 'Describe what you want to do:',
267
- placeholder: 'I want to...',
268
- });
269
-
270
- if (p.isCancel(description)) {
271
- return { ...parsed, command: 'cancel', confidence: 1 };
272
- }
273
-
274
- // Pass to code agent as free-form request
275
- return {
276
- command: 'code',
277
- args: [description as string],
278
- confidence: 1,
279
- interpretation: description as string,
280
- };
281
- }
282
-
283
- return {
284
- command: selection as string,
285
- args: parsed.args,
286
- confidence: 1,
287
- interpretation: options.find(o => o.value === selection)?.description || '',
288
- };
289
- }
290
-
291
- // ============================================================================
292
- // DEPLOY CLARIFICATION
293
- // ============================================================================
294
-
295
- export async function clarifyDeployTarget(): Promise<'preview' | 'production' | null> {
296
- const target = await p.select({
297
- message: 'Where do you want to deploy?',
298
- options: [
299
- { value: 'preview', label: '🔍 Preview', hint: 'Test URL to review changes' },
300
- { value: 'production', label: '🚀 Production', hint: 'Live site for users' },
301
- ],
302
- });
303
-
304
- if (p.isCancel(target)) return null;
305
- return target as 'preview' | 'production';
306
- }
307
-
308
- // ============================================================================
309
- // EXPORTS
310
- // ============================================================================
311
-
312
- export { COMMAND_PATTERNS };