codebakers 1.0.45 → 2.0.1

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 (82) hide show
  1. package/README.md +275 -60
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +4260 -0
  4. package/install.bat +9 -0
  5. package/package.json +71 -115
  6. package/src/channels/discord.ts +5 -0
  7. package/src/channels/slack.ts +5 -0
  8. package/src/channels/sms.ts +4 -0
  9. package/src/channels/telegram.ts +5 -0
  10. package/src/channels/whatsapp.ts +7 -0
  11. package/src/commands/check.ts +365 -0
  12. package/src/commands/code.ts +684 -0
  13. package/src/commands/connect.ts +12 -0
  14. package/src/commands/deploy.ts +414 -0
  15. package/src/commands/design.ts +298 -0
  16. package/src/commands/fix.ts +20 -0
  17. package/src/commands/gateway.ts +604 -0
  18. package/src/commands/generate.ts +178 -0
  19. package/src/commands/init.ts +574 -0
  20. package/src/commands/learn.ts +36 -0
  21. package/src/commands/security.ts +102 -0
  22. package/src/commands/setup.ts +448 -0
  23. package/src/commands/status.ts +56 -0
  24. package/src/index.ts +278 -0
  25. package/src/patterns/loader.ts +337 -0
  26. package/src/services/github.ts +61 -0
  27. package/src/services/supabase.ts +147 -0
  28. package/src/services/vercel.ts +61 -0
  29. package/src/utils/claude-md.ts +287 -0
  30. package/src/utils/config.ts +282 -0
  31. package/src/utils/updates.ts +27 -0
  32. package/tsconfig.json +17 -10
  33. package/.vscodeignore +0 -18
  34. package/LICENSE +0 -21
  35. package/codebakers-1.0.0.vsix +0 -0
  36. package/codebakers-1.0.10.vsix +0 -0
  37. package/codebakers-1.0.11.vsix +0 -0
  38. package/codebakers-1.0.12.vsix +0 -0
  39. package/codebakers-1.0.13.vsix +0 -0
  40. package/codebakers-1.0.14.vsix +0 -0
  41. package/codebakers-1.0.15.vsix +0 -0
  42. package/codebakers-1.0.16.vsix +0 -0
  43. package/codebakers-1.0.17.vsix +0 -0
  44. package/codebakers-1.0.18.vsix +0 -0
  45. package/codebakers-1.0.19.vsix +0 -0
  46. package/codebakers-1.0.20.vsix +0 -0
  47. package/codebakers-1.0.21.vsix +0 -0
  48. package/codebakers-1.0.22.vsix +0 -0
  49. package/codebakers-1.0.23.vsix +0 -0
  50. package/codebakers-1.0.24.vsix +0 -0
  51. package/codebakers-1.0.25.vsix +0 -0
  52. package/codebakers-1.0.26.vsix +0 -0
  53. package/codebakers-1.0.27.vsix +0 -0
  54. package/codebakers-1.0.28.vsix +0 -0
  55. package/codebakers-1.0.29.vsix +0 -0
  56. package/codebakers-1.0.30.vsix +0 -0
  57. package/codebakers-1.0.31.vsix +0 -0
  58. package/codebakers-1.0.32.vsix +0 -0
  59. package/codebakers-1.0.35.vsix +0 -0
  60. package/codebakers-1.0.36.vsix +0 -0
  61. package/codebakers-1.0.37.vsix +0 -0
  62. package/codebakers-1.0.38.vsix +0 -0
  63. package/codebakers-1.0.39.vsix +0 -0
  64. package/codebakers-1.0.40.vsix +0 -0
  65. package/codebakers-1.0.41.vsix +0 -0
  66. package/codebakers-1.0.42.vsix +0 -0
  67. package/codebakers-1.0.43.vsix +0 -0
  68. package/codebakers-1.0.44.vsix +0 -0
  69. package/codebakers-1.0.45.vsix +0 -0
  70. package/dist/extension.js +0 -1394
  71. package/esbuild.js +0 -63
  72. package/media/icon.png +0 -0
  73. package/media/icon.svg +0 -7
  74. package/nul +0 -1
  75. package/preview.html +0 -547
  76. package/src/ChatPanelProvider.ts +0 -1815
  77. package/src/ChatViewProvider.ts +0 -749
  78. package/src/CodeBakersClient.ts +0 -1146
  79. package/src/CodeValidator.ts +0 -645
  80. package/src/FileOperations.ts +0 -410
  81. package/src/ProjectContext.ts +0 -526
  82. package/src/extension.ts +0 -332
@@ -0,0 +1,282 @@
1
+ import Conf from 'conf';
2
+ import * as fs from 'fs-extra';
3
+ import * as path from 'path';
4
+ import os from 'os';
5
+ import { z } from 'zod';
6
+
7
+ // Schema for config validation
8
+ const ConfigSchema = z.object({
9
+ version: z.string().default('1.0.0'),
10
+ credentials: z.object({
11
+ github: z.object({
12
+ token: z.string().optional(),
13
+ username: z.string().optional(),
14
+ }).optional(),
15
+ vercel: z.object({
16
+ token: z.string().optional(),
17
+ teamId: z.string().optional(),
18
+ }).optional(),
19
+ supabase: z.object({
20
+ accessToken: z.string().optional(),
21
+ orgId: z.string().optional(),
22
+ }).optional(),
23
+ anthropic: z.object({
24
+ apiKey: z.string().optional(),
25
+ }).optional(),
26
+ openai: z.object({
27
+ apiKey: z.string().optional(),
28
+ }).optional(),
29
+ stripe: z.object({
30
+ secretKey: z.string().optional(),
31
+ publishableKey: z.string().optional(),
32
+ webhookSecret: z.string().optional(),
33
+ }).optional(),
34
+ twilio: z.object({
35
+ accountSid: z.string().optional(),
36
+ authToken: z.string().optional(),
37
+ phoneNumber: z.string().optional(),
38
+ }).optional(),
39
+ vapi: z.object({
40
+ apiKey: z.string().optional(),
41
+ }).optional(),
42
+ resend: z.object({
43
+ apiKey: z.string().optional(),
44
+ }).optional(),
45
+ elevenLabs: z.object({
46
+ apiKey: z.string().optional(),
47
+ }).optional(),
48
+ microsoft: z.object({
49
+ clientId: z.string().optional(),
50
+ clientSecret: z.string().optional(),
51
+ tenantId: z.string().optional(),
52
+ }).optional(),
53
+ google: z.object({
54
+ clientId: z.string().optional(),
55
+ clientSecret: z.string().optional(),
56
+ }).optional(),
57
+ }).default({}),
58
+ preferences: z.object({
59
+ defaultFramework: z.string().optional(),
60
+ defaultUI: z.string().optional(),
61
+ defaultPackages: z.array(z.string()).optional(),
62
+ deployToPreviewFirst: z.boolean().default(true),
63
+ }).default({}),
64
+ learning: z.object({
65
+ enabled: z.boolean().default(true),
66
+ shortcuts: z.record(z.string()).default({}),
67
+ preferences: z.record(z.any()).default({}),
68
+ rejections: z.array(z.string()).default([]),
69
+ workflows: z.record(z.array(z.string())).default({}),
70
+ }).default({}),
71
+ projects: z.array(z.object({
72
+ name: z.string(),
73
+ path: z.string(),
74
+ github: z.string().optional(),
75
+ vercel: z.string().optional(),
76
+ supabase: z.string().optional(),
77
+ createdAt: z.string(),
78
+ })).default([]),
79
+ channels: z.object({
80
+ whatsapp: z.object({
81
+ enabled: z.boolean().default(false),
82
+ phoneNumber: z.string().optional(),
83
+ }).optional(),
84
+ telegram: z.object({
85
+ enabled: z.boolean().default(false),
86
+ botToken: z.string().optional(),
87
+ }).optional(),
88
+ discord: z.object({
89
+ enabled: z.boolean().default(false),
90
+ botToken: z.string().optional(),
91
+ }).optional(),
92
+ slack: z.object({
93
+ enabled: z.boolean().default(false),
94
+ botToken: z.string().optional(),
95
+ }).optional(),
96
+ }).default({}),
97
+ });
98
+
99
+ type ConfigType = z.infer<typeof ConfigSchema>;
100
+
101
+ export class Config {
102
+ private conf: Conf<ConfigType>;
103
+ private configDir: string;
104
+
105
+ constructor() {
106
+ this.configDir = path.join(os.homedir(), '.codebakers');
107
+
108
+ // Ensure config directory exists
109
+ fs.ensureDirSync(this.configDir);
110
+ fs.ensureDirSync(path.join(this.configDir, 'patterns'));
111
+ fs.ensureDirSync(path.join(this.configDir, 'templates'));
112
+ fs.ensureDirSync(path.join(this.configDir, 'learning'));
113
+
114
+ this.conf = new Conf<ConfigType>({
115
+ projectName: 'codebakers',
116
+ cwd: this.configDir,
117
+ schema: {
118
+ version: { type: 'string', default: '1.0.0' },
119
+ credentials: { type: 'object', default: {} },
120
+ preferences: { type: 'object', default: {} },
121
+ learning: { type: 'object', default: { enabled: true, shortcuts: {}, preferences: {}, rejections: [], workflows: {} } },
122
+ projects: { type: 'array', default: [] },
123
+ channels: { type: 'object', default: {} },
124
+ } as any,
125
+ });
126
+ }
127
+
128
+ // Check if initial setup is complete
129
+ isConfigured(): boolean {
130
+ const creds = this.conf.get('credentials') || {};
131
+ return !!(
132
+ creds.github?.token &&
133
+ creds.vercel?.token &&
134
+ creds.supabase?.accessToken &&
135
+ creds.anthropic?.apiKey
136
+ );
137
+ }
138
+
139
+ // Check if current directory is a CodeBakers project
140
+ isInProject(): boolean {
141
+ const cwd = process.cwd();
142
+ const codebakersDir = path.join(cwd, '.codebakers');
143
+ const claudeFile = path.join(cwd, 'CLAUDE.md');
144
+ return fs.existsSync(codebakersDir) || fs.existsSync(claudeFile);
145
+ }
146
+
147
+ // Get current project config
148
+ getProjectConfig(): Record<string, unknown> | null {
149
+ const cwd = process.cwd();
150
+ const configPath = path.join(cwd, '.codebakers', 'config.json');
151
+ if (fs.existsSync(configPath)) {
152
+ return fs.readJsonSync(configPath);
153
+ }
154
+ return null;
155
+ }
156
+
157
+ // Credentials
158
+ getCredentials(service: string): Record<string, string | undefined> | undefined {
159
+ const creds = this.conf.get('credentials') || {};
160
+ return creds[service as keyof typeof creds];
161
+ }
162
+
163
+ setCredentials(service: string, credentials: Record<string, string>): void {
164
+ const current = this.conf.get('credentials') || {};
165
+ this.conf.set('credentials', {
166
+ ...current,
167
+ [service]: { ...current[service as keyof typeof current], ...credentials },
168
+ });
169
+ }
170
+
171
+ // Preferences
172
+ getPreference<T>(key: string): T | undefined {
173
+ const prefs = this.conf.get('preferences') || {};
174
+ return prefs[key as keyof typeof prefs] as T;
175
+ }
176
+
177
+ setPreference(key: string, value: unknown): void {
178
+ const current = this.conf.get('preferences') || {};
179
+ this.conf.set('preferences', { ...current, [key]: value });
180
+ }
181
+
182
+ // Learning
183
+ getLearning(): ConfigType['learning'] {
184
+ return this.conf.get('learning') || { enabled: true, shortcuts: {}, preferences: {}, rejections: [], workflows: {} };
185
+ }
186
+
187
+ addShortcut(shortcut: string, expansion: string): void {
188
+ const learning = this.getLearning();
189
+ learning.shortcuts[shortcut] = expansion;
190
+ this.conf.set('learning', learning);
191
+ }
192
+
193
+ addRejection(item: string): void {
194
+ const learning = this.getLearning();
195
+ if (!learning.rejections.includes(item)) {
196
+ learning.rejections.push(item);
197
+ this.conf.set('learning', learning);
198
+ }
199
+ }
200
+
201
+ addWorkflow(name: string, steps: string[]): void {
202
+ const learning = this.getLearning();
203
+ learning.workflows[name] = steps;
204
+ this.conf.set('learning', learning);
205
+ }
206
+
207
+ learnPreference(key: string, value: unknown): void {
208
+ const learning = this.getLearning();
209
+ learning.preferences[key] = value;
210
+ this.conf.set('learning', learning);
211
+ }
212
+
213
+ forgetPreference(key: string): void {
214
+ const learning = this.getLearning();
215
+ delete learning.preferences[key];
216
+ this.conf.set('learning', learning);
217
+ }
218
+
219
+ resetLearning(): void {
220
+ this.conf.set('learning', { enabled: true, shortcuts: {}, preferences: {}, rejections: [], workflows: {} });
221
+ }
222
+
223
+ // Projects
224
+ getProjects(): ConfigType['projects'] {
225
+ return this.conf.get('projects') || [];
226
+ }
227
+
228
+ addProject(project: ConfigType['projects'][0]): void {
229
+ const projects = this.getProjects();
230
+ projects.push(project);
231
+ this.conf.set('projects', projects);
232
+ }
233
+
234
+ // Channels
235
+ getChannelConfig(channel: string): Record<string, unknown> | undefined {
236
+ const channels = this.conf.get('channels') || {};
237
+ return channels[channel as keyof typeof channels];
238
+ }
239
+
240
+ setChannelConfig(channel: string, config: Record<string, unknown>): void {
241
+ const current = this.conf.get('channels') || {};
242
+ this.conf.set('channels', { ...current, [channel]: config });
243
+ }
244
+
245
+ // Config directory access
246
+ getConfigDir(): string {
247
+ return this.configDir;
248
+ }
249
+
250
+ getPatternsDir(): string {
251
+ return path.join(this.configDir, 'patterns');
252
+ }
253
+
254
+ getTemplatesDir(): string {
255
+ return path.join(this.configDir, 'templates');
256
+ }
257
+
258
+ getLearningDir(): string {
259
+ return path.join(this.configDir, 'learning');
260
+ }
261
+
262
+ // Export/Import
263
+ exportConfig(): ConfigType {
264
+ return {
265
+ version: this.conf.get('version') || '1.0.0',
266
+ credentials: {}, // Don't export credentials
267
+ preferences: this.conf.get('preferences') || {},
268
+ learning: this.getLearning(),
269
+ projects: this.getProjects(),
270
+ channels: {}, // Don't export channel tokens
271
+ };
272
+ }
273
+
274
+ importConfig(config: Partial<ConfigType>): void {
275
+ if (config.preferences) {
276
+ this.conf.set('preferences', config.preferences);
277
+ }
278
+ if (config.learning) {
279
+ this.conf.set('learning', config.learning);
280
+ }
281
+ }
282
+ }
@@ -0,0 +1,27 @@
1
+ import chalk from 'chalk';
2
+
3
+ const VERSION = '1.0.0';
4
+
5
+ export async function checkForUpdates(): Promise<void> {
6
+ try {
7
+ const response = await fetch('https://registry.npmjs.org/codebakers/latest', {
8
+ signal: AbortSignal.timeout(3000),
9
+ });
10
+
11
+ if (!response.ok) return;
12
+
13
+ const data = await response.json();
14
+ const latestVersion = data.version;
15
+
16
+ if (latestVersion && latestVersion !== VERSION) {
17
+ console.log(chalk.yellow(`
18
+ ╭────────────────────────────────────────────╮
19
+ │ Update available: ${VERSION} → ${latestVersion.padEnd(10)} │
20
+ │ Run: npm install -g codebakers │
21
+ ╰────────────────────────────────────────────╯
22
+ `));
23
+ }
24
+ } catch {
25
+ // Silently fail - update check is not critical
26
+ }
27
+ }
package/tsconfig.json CHANGED
@@ -1,19 +1,26 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "ES2020",
5
- "lib": ["ES2020"],
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "esModuleInterop": true,
7
+ "strict": true,
8
+ "skipLibCheck": true,
6
9
  "outDir": "dist",
7
10
  "rootDir": "src",
11
+ "declaration": true,
12
+ "declarationMap": true,
8
13
  "sourceMap": true,
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
14
  "resolveJsonModule": true,
14
- "declaration": true,
15
- "declarationMap": true
15
+ "allowSyntheticDefaultImports": true,
16
+ "forceConsistentCasingInFileNames": true,
17
+ "noUncheckedIndexedAccess": true,
18
+ "noImplicitOverride": true,
19
+ "noPropertyAccessFromIndexSignature": false,
20
+ "paths": {
21
+ "@/*": ["./src/*"]
22
+ }
16
23
  },
17
24
  "include": ["src/**/*"],
18
- "exclude": ["node_modules", "dist"]
25
+ "exclude": ["node_modules", "dist", "templates"]
19
26
  }
package/.vscodeignore DELETED
@@ -1,18 +0,0 @@
1
- .vscode/**
2
- .vscode-test/**
3
- src/**
4
- node_modules/**
5
- **/*.ts
6
- **/*.map
7
- .gitignore
8
- tsconfig.json
9
- esbuild.js
10
- **/*.d.ts
11
- **/*.d.ts.map
12
- preview.html
13
- nul
14
- dist/ChatPanelProvider.js
15
- dist/ChatViewProvider.js
16
- dist/CodeBakersClient.js
17
- dist/ProjectContext.js
18
- dist/nul
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 CodeBakers / BotMakers Software
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file