codebakers 2.5.4 → 3.1.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 +54 -255
- package/dist/chunk-HOWR3YTF.js +146 -0
- package/dist/index.d.ts +0 -3
- package/dist/index.js +10505 -7997
- package/dist/terminal-6ZQVP6R7.js +10 -0
- package/package.json +26 -41
- package/AUDIT_REPORT.md +0 -138
- package/dist/advisors-RWRTSJRR.js +0 -7
- package/dist/chunk-ASIJIQYC.js +0 -320
- package/dist/chunk-D44U3IEA.js +0 -565
- package/dist/chunk-LANM5XQW.js +0 -326
- package/dist/prd-RYITSL6Q.js +0 -7
- package/install.bat +0 -9
- package/installers/CodeBakers-Install.bat +0 -207
- package/installers/CodeBakers-Install.command +0 -232
- package/installers/README.md +0 -157
- package/installers/mac/assets/README.txt +0 -31
- package/installers/mac/build-mac-installer.sh +0 -240
- package/installers/windows/CodeBakers.iss +0 -256
- package/installers/windows/assets/README.txt +0 -16
- package/installers/windows/scripts/post-install.bat +0 -15
- package/src/channels/discord.ts +0 -5
- package/src/channels/slack.ts +0 -5
- package/src/channels/sms.ts +0 -4
- package/src/channels/telegram.ts +0 -5
- package/src/channels/whatsapp.ts +0 -7
- package/src/commands/advisors.ts +0 -699
- package/src/commands/build.ts +0 -1025
- package/src/commands/check.ts +0 -365
- package/src/commands/code.ts +0 -806
- package/src/commands/connect.ts +0 -12
- package/src/commands/deploy.ts +0 -448
- package/src/commands/design.ts +0 -298
- package/src/commands/fix.ts +0 -20
- package/src/commands/gateway.ts +0 -604
- package/src/commands/generate.ts +0 -178
- package/src/commands/init.ts +0 -634
- package/src/commands/integrate.ts +0 -884
- package/src/commands/learn.ts +0 -36
- package/src/commands/migrate.ts +0 -419
- package/src/commands/prd-maker.ts +0 -588
- package/src/commands/prd.ts +0 -419
- package/src/commands/security.ts +0 -102
- package/src/commands/setup.ts +0 -600
- package/src/commands/status.ts +0 -56
- package/src/commands/website.ts +0 -741
- package/src/index.ts +0 -627
- package/src/patterns/loader.ts +0 -337
- package/src/services/github.ts +0 -61
- package/src/services/supabase.ts +0 -147
- package/src/services/vercel.ts +0 -61
- package/src/utils/claude-md.ts +0 -287
- package/src/utils/config.ts +0 -375
- package/src/utils/display.ts +0 -338
- package/src/utils/files.ts +0 -418
- package/src/utils/nlp.ts +0 -312
- package/src/utils/ui.ts +0 -441
- package/src/utils/updates.ts +0 -8
- package/src/utils/voice.ts +0 -323
- package/tsconfig.json +0 -26
package/README.md
CHANGED
|
@@ -1,303 +1,102 @@
|
|
|
1
1
|
# CodeBakers CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AI-powered product development CLI that builds faster with pattern enforcement, persistent memory, and parallel agents.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
██████╗ ██████╗ ██████╗ ███████╗██████╗ █████╗ ██╗ ██╗███████╗██████╗ ███████╗
|
|
9
|
-
██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗██╔══██╗██║ ██╔╝██╔════╝██╔══██╗██╔════╝
|
|
10
|
-
██║ ██║ ██║██║ ██║█████╗ ██████╔╝███████║█████╔╝ █████╗ ██████╔╝███████╗
|
|
11
|
-
██║ ██║ ██║██║ ██║██╔══╝ ██╔══██╗██╔══██║██╔═██╗ ██╔══╝ ██╔══██╗╚════██║
|
|
12
|
-
╚██████╗╚██████╔╝██████╔╝███████╗██████╔╝██║ ██║██║ ██╗███████╗██║ ██║███████║
|
|
13
|
-
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Why CodeBakers?
|
|
17
|
-
|
|
18
|
-
| Problem | Claude Code / Cursor | CodeBakers |
|
|
19
|
-
|---------|---------------------|------------|
|
|
20
|
-
| AI follows YOUR patterns? | ❌ Generic output | ✅ Enforced rules |
|
|
21
|
-
| Auto-provisions infrastructure? | ❌ Manual setup | ✅ GitHub + Vercel + Supabase |
|
|
22
|
-
| Fixes deploy errors automatically? | ❌ | ✅ Auto-fix with AI |
|
|
23
|
-
| Build from phone? | ❌ | ✅ WhatsApp, Telegram, Discord |
|
|
24
|
-
| Pattern check before commit? | ❌ | ✅ Git hooks |
|
|
25
|
-
| Learns your preferences? | ❌ | ✅ Gets smarter over time |
|
|
26
|
-
|
|
27
|
-
## Quick Start
|
|
5
|
+
## Installation
|
|
28
6
|
|
|
29
7
|
```bash
|
|
30
|
-
# Install
|
|
31
8
|
npm install -g codebakers
|
|
32
|
-
|
|
33
|
-
# First-time setup (connects GitHub, Vercel, Supabase, Anthropic)
|
|
34
|
-
codebakers setup
|
|
35
|
-
|
|
36
|
-
# Create a new project
|
|
37
|
-
codebakers init
|
|
38
|
-
|
|
39
|
-
# Start coding with AI
|
|
40
|
-
codebakers code
|
|
41
9
|
```
|
|
42
10
|
|
|
43
|
-
##
|
|
44
|
-
|
|
45
|
-
### Interactive Mode
|
|
46
|
-
```bash
|
|
47
|
-
codebakers # Opens interactive menu
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Project Commands
|
|
51
|
-
```bash
|
|
52
|
-
codebakers init # Create new project
|
|
53
|
-
codebakers code # AI coding agent
|
|
54
|
-
codebakers check # Run pattern enforcement
|
|
55
|
-
codebakers deploy # Deploy to production
|
|
56
|
-
codebakers fix # Auto-fix errors
|
|
57
|
-
codebakers status # View project health
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Generation
|
|
61
|
-
```bash
|
|
62
|
-
codebakers generate component # Generate React component
|
|
63
|
-
codebakers generate page # Generate Next.js page
|
|
64
|
-
codebakers generate api # Generate API route
|
|
65
|
-
codebakers generate hook # Generate custom hook
|
|
66
|
-
codebakers generate store # Generate Zustand store
|
|
67
|
-
codebakers generate form # Generate form with validation
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Services
|
|
71
|
-
```bash
|
|
72
|
-
codebakers connect # Connect external services
|
|
73
|
-
codebakers setup # Configure credentials
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Messaging Channels
|
|
77
|
-
```bash
|
|
78
|
-
codebakers gateway # Manage messaging channels
|
|
79
|
-
codebakers gateway --start # Start receiving messages
|
|
80
|
-
codebakers gateway --stop # Stop gateway
|
|
81
|
-
```
|
|
11
|
+
## Quick Start
|
|
82
12
|
|
|
83
|
-
### Security & Quality
|
|
84
13
|
```bash
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
```
|
|
14
|
+
# Login to CodeBakers
|
|
15
|
+
cb login
|
|
88
16
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
codebakers learn # View learned preferences
|
|
92
|
-
codebakers learn --reset # Reset all learning
|
|
17
|
+
# Start building
|
|
18
|
+
cb
|
|
93
19
|
```
|
|
94
20
|
|
|
95
21
|
## Features
|
|
96
22
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
? What do you want to build?
|
|
104
|
-
> Add a contact form that sends emails via Resend
|
|
105
|
-
|
|
106
|
-
📋 Plan:
|
|
107
|
-
1. Create ContactForm component with React Hook Form
|
|
108
|
-
2. Add Zod validation schema
|
|
109
|
-
3. Create API route /api/contact
|
|
110
|
-
4. Configure Resend email sending
|
|
111
|
-
5. Add success/error toasts
|
|
112
|
-
|
|
113
|
-
? Execute this plan? Yes
|
|
114
|
-
|
|
115
|
-
Building...
|
|
116
|
-
✓ Created src/components/forms/contact-form.tsx
|
|
117
|
-
✓ Created src/app/api/contact/route.ts
|
|
118
|
-
✓ Updated src/lib/validations.ts
|
|
119
|
-
|
|
120
|
-
🔍 Running CodeBakers check...
|
|
121
|
-
✓ All patterns satisfied
|
|
122
|
-
```
|
|
23
|
+
- **Pattern Enforcement** - Your code follows your rules, every time
|
|
24
|
+
- **Persistent Memory** - Remembers your project, decisions, and context
|
|
25
|
+
- **Parallel Builds** - 3x faster with multiple AI agents
|
|
26
|
+
- **Spec Generator** - Idea → Spec → Build
|
|
27
|
+
- **Codebase Audit** - Find and auto-fix issues
|
|
28
|
+
- **Smart Git** - Auto-branches, smart commits, PRs
|
|
123
29
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Your rules, enforced automatically:
|
|
127
|
-
|
|
128
|
-
- ✅ Every button has onClick handler
|
|
129
|
-
- ✅ Every form has Zod validation
|
|
130
|
-
- ✅ Every async operation has loading/error states
|
|
131
|
-
- ✅ Every list has empty state
|
|
132
|
-
- ✅ No `any` types
|
|
133
|
-
- ✅ No `@ts-ignore`
|
|
134
|
-
- ✅ No `console.log` in production
|
|
135
|
-
- ✅ No hardcoded secrets
|
|
136
|
-
|
|
137
|
-
### 🚀 Auto-Provisioning
|
|
30
|
+
## Commands
|
|
138
31
|
|
|
139
|
-
|
|
32
|
+
### Building
|
|
140
33
|
|
|
141
34
|
```bash
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
✓ Supabase project created
|
|
147
|
-
✓ Vercel project created
|
|
148
|
-
✓ Deployed: https://my-app.vercel.app
|
|
149
|
-
✓ CLAUDE.md generated
|
|
150
|
-
✓ Git hooks configured
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 🔧 Auto-Fix
|
|
154
|
-
|
|
155
|
-
Deploy errors? Fixed automatically:
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
Deploying to production...
|
|
159
|
-
✗ Build failed: Type error in src/components/Button.tsx
|
|
160
|
-
|
|
161
|
-
? Attempt to fix with AI? Yes
|
|
162
|
-
|
|
163
|
-
Fixing...
|
|
164
|
-
✓ Fixed type error
|
|
165
|
-
✓ Build successful
|
|
166
|
-
✓ Deployed: https://my-app.vercel.app
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### 📱 Build From Anywhere
|
|
170
|
-
|
|
171
|
-
Connect messaging channels and code from your phone:
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
WhatsApp: "Create a landing page for a dog walking app with pricing"
|
|
175
|
-
|
|
176
|
-
CodeBakers: Building PupWalk...
|
|
177
|
-
✓ Created landing page
|
|
178
|
-
✓ Added pricing section
|
|
179
|
-
✓ Deployed to pupwalk.vercel.app
|
|
180
|
-
|
|
181
|
-
Here's your site: https://pupwalk.vercel.app
|
|
35
|
+
cb # Start interactive session
|
|
36
|
+
/spec "An Uber for X" # Generate spec and build
|
|
37
|
+
/parallel "Build auth" # 3x faster parallel build
|
|
38
|
+
/create myapp # One-click GitHub + Supabase + Vercel
|
|
182
39
|
```
|
|
183
40
|
|
|
184
|
-
|
|
185
|
-
- 💬 WhatsApp (via Baileys)
|
|
186
|
-
- ✈️ Telegram
|
|
187
|
-
- 🎮 Discord
|
|
188
|
-
- 💼 Slack
|
|
189
|
-
- 📱 SMS (via Twilio)
|
|
190
|
-
- 🍎 iMessage (macOS only)
|
|
191
|
-
|
|
192
|
-
### 🧠 Learning System
|
|
193
|
-
|
|
194
|
-
CodeBakers learns from you:
|
|
195
|
-
|
|
196
|
-
- Your framework preferences (Next.js, Remix, etc.)
|
|
197
|
-
- Your UI library choices (shadcn, Chakra, etc.)
|
|
198
|
-
- Your naming conventions
|
|
199
|
-
- Common shortcuts ("lp" → "login page")
|
|
200
|
-
- Things you don't want
|
|
201
|
-
- Workflows you repeat
|
|
41
|
+
### Code Quality
|
|
202
42
|
|
|
203
43
|
```bash
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
Preferences:
|
|
209
|
-
defaultFramework: nextjs (your usual choice)
|
|
210
|
-
defaultUI: shadcn
|
|
211
|
-
|
|
212
|
-
Shortcuts:
|
|
213
|
-
lp → login page
|
|
214
|
-
dash → dashboard
|
|
215
|
-
|
|
216
|
-
Rejections:
|
|
217
|
-
✗ Material UI
|
|
218
|
-
✗ Class components
|
|
44
|
+
/audit # Scan codebase for issues
|
|
45
|
+
/audit fix # Auto-fix issues
|
|
46
|
+
/patterns # View/manage pattern rules
|
|
47
|
+
/test # Generate tests
|
|
219
48
|
```
|
|
220
49
|
|
|
221
|
-
###
|
|
222
|
-
|
|
223
|
-
Built-in security scanning:
|
|
50
|
+
### Git
|
|
224
51
|
|
|
225
52
|
```bash
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
🔴 CRITICAL: Hardcoded Stripe key
|
|
231
|
-
src/lib/payments.ts:15
|
|
232
|
-
Stripe API key should be in environment variables
|
|
233
|
-
|
|
234
|
-
🟠 HIGH: dangerouslySetInnerHTML
|
|
235
|
-
src/components/Comment.tsx:23
|
|
236
|
-
Ensure content is sanitized with DOMPurify
|
|
237
|
-
|
|
238
|
-
Security Score: 65/100 Grade: D
|
|
53
|
+
/git status # Branch and changes
|
|
54
|
+
/git commit # Smart commit with good messages
|
|
55
|
+
/git push # Push and create PR
|
|
56
|
+
/pr # Create pull request
|
|
239
57
|
```
|
|
240
58
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
### Global Config
|
|
59
|
+
### Other
|
|
244
60
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
├── credentials.enc # Encrypted API keys
|
|
251
|
-
├── patterns/ # Global patterns
|
|
252
|
-
├── templates/ # Project templates
|
|
253
|
-
└── learning/ # Learned preferences
|
|
61
|
+
```bash
|
|
62
|
+
/preview # Start dev server
|
|
63
|
+
/review # Deep codebase analysis
|
|
64
|
+
/templates # View template library
|
|
65
|
+
/help # All commands
|
|
254
66
|
```
|
|
255
67
|
|
|
256
|
-
|
|
68
|
+
## Natural Language
|
|
257
69
|
|
|
258
|
-
|
|
70
|
+
Just type what you want:
|
|
259
71
|
|
|
260
72
|
```
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
73
|
+
> I want to build an Uber for dog walkers
|
|
74
|
+
> Add a login page with Google auth
|
|
75
|
+
> Find all the bugs in my code
|
|
76
|
+
> Deploy this to production
|
|
265
77
|
```
|
|
266
78
|
|
|
267
|
-
##
|
|
79
|
+
## Modes
|
|
268
80
|
|
|
269
|
-
|
|
270
|
-
- GitHub
|
|
271
|
-
- Vercel
|
|
272
|
-
- Supabase
|
|
273
|
-
- Anthropic (Claude)
|
|
81
|
+
Press `Shift+Tab` to cycle:
|
|
274
82
|
|
|
275
|
-
**
|
|
276
|
-
-
|
|
277
|
-
-
|
|
278
|
-
- Twilio
|
|
279
|
-
- VAPI
|
|
280
|
-
- Resend
|
|
281
|
-
- ElevenLabs
|
|
282
|
-
- Microsoft Graph
|
|
283
|
-
- Google APIs
|
|
83
|
+
- **[PLAN]** - Shows what will happen, asks to execute
|
|
84
|
+
- **[QUESTION]** - Asks clarifying questions first
|
|
85
|
+
- **[AGENT]** - Runs autonomously
|
|
284
86
|
|
|
285
87
|
## Requirements
|
|
286
88
|
|
|
287
89
|
- Node.js 18+
|
|
288
|
-
-
|
|
289
|
-
- Git
|
|
290
|
-
|
|
291
|
-
## License
|
|
90
|
+
- Anthropic API key (set via `cb setup`)
|
|
292
91
|
|
|
293
|
-
|
|
92
|
+
## Pricing
|
|
294
93
|
|
|
295
|
-
|
|
94
|
+
- **Free** - Basic builds, memory, patterns
|
|
95
|
+
- **Pro** - Parallel builds, audit, spec generator, RAG
|
|
96
|
+
- **Agency** - Team sharing, white label
|
|
296
97
|
|
|
297
|
-
|
|
298
|
-
- Documentation: https://codebakers.dev/docs
|
|
299
|
-
- Discord: https://discord.gg/codebakers
|
|
98
|
+
Visit [codebakers.ai/pricing](https://codebakers.ai/pricing) for details.
|
|
300
99
|
|
|
301
|
-
|
|
100
|
+
## License
|
|
302
101
|
|
|
303
|
-
|
|
102
|
+
MIT © BotMakers Inc
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// src/core/terminal.ts
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
var Terminal = class extends EventEmitter {
|
|
5
|
+
currentProcess = null;
|
|
6
|
+
projectPath;
|
|
7
|
+
constructor(projectPath = process.cwd()) {
|
|
8
|
+
super();
|
|
9
|
+
this.projectPath = projectPath;
|
|
10
|
+
}
|
|
11
|
+
async run(command, checkCancelled) {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
let stdout = "";
|
|
14
|
+
let stderr = "";
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
this.currentProcess = spawn(command, {
|
|
17
|
+
cwd: this.projectPath,
|
|
18
|
+
shell: true,
|
|
19
|
+
env: { ...process.env, FORCE_COLOR: "0" }
|
|
20
|
+
});
|
|
21
|
+
const proc = this.currentProcess;
|
|
22
|
+
proc.stdout?.on("data", (data) => {
|
|
23
|
+
const text = data.toString();
|
|
24
|
+
stdout += text;
|
|
25
|
+
this.emit("stdout", text);
|
|
26
|
+
});
|
|
27
|
+
proc.stderr?.on("data", (data) => {
|
|
28
|
+
const text = data.toString();
|
|
29
|
+
stderr += text;
|
|
30
|
+
this.emit("stderr", text);
|
|
31
|
+
});
|
|
32
|
+
proc.on("close", (code) => {
|
|
33
|
+
this.currentProcess = null;
|
|
34
|
+
resolve({
|
|
35
|
+
stdout,
|
|
36
|
+
stderr,
|
|
37
|
+
exitCode: code ?? 0,
|
|
38
|
+
success: code === 0,
|
|
39
|
+
cancelled
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
proc.on("error", (error) => {
|
|
43
|
+
this.currentProcess = null;
|
|
44
|
+
resolve({
|
|
45
|
+
stdout,
|
|
46
|
+
stderr: stderr + "\n" + error.message,
|
|
47
|
+
exitCode: 1,
|
|
48
|
+
success: false,
|
|
49
|
+
cancelled
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
if (checkCancelled) {
|
|
53
|
+
const interval = setInterval(() => {
|
|
54
|
+
if (checkCancelled()) {
|
|
55
|
+
cancelled = true;
|
|
56
|
+
this.kill();
|
|
57
|
+
clearInterval(interval);
|
|
58
|
+
}
|
|
59
|
+
}, 100);
|
|
60
|
+
proc.on("close", () => clearInterval(interval));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
kill() {
|
|
65
|
+
if (this.currentProcess) {
|
|
66
|
+
this.currentProcess.kill("SIGTERM");
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
if (this.currentProcess) {
|
|
69
|
+
this.currentProcess.kill("SIGKILL");
|
|
70
|
+
}
|
|
71
|
+
}, 1e3);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async npmInstall(packages) {
|
|
75
|
+
const cmd = packages ? `npm install ${packages.join(" ")}` : "npm install";
|
|
76
|
+
return this.run(cmd);
|
|
77
|
+
}
|
|
78
|
+
async typecheck() {
|
|
79
|
+
return this.run("npx tsc --noEmit");
|
|
80
|
+
}
|
|
81
|
+
async build() {
|
|
82
|
+
return this.run("npm run build");
|
|
83
|
+
}
|
|
84
|
+
async test() {
|
|
85
|
+
return this.run("npm test");
|
|
86
|
+
}
|
|
87
|
+
async lint() {
|
|
88
|
+
return this.run("npm run lint");
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function parseErrors(output) {
|
|
92
|
+
const errors = [];
|
|
93
|
+
const tsRegex = /(.+?)\((\d+),\d+\):\s*error\s+TS\d+:\s*(.+)/g;
|
|
94
|
+
let match;
|
|
95
|
+
while ((match = tsRegex.exec(output)) !== null) {
|
|
96
|
+
errors.push({
|
|
97
|
+
file: match[1],
|
|
98
|
+
line: parseInt(match[2]),
|
|
99
|
+
message: match[3],
|
|
100
|
+
type: "typescript"
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const tsRegex2 = /(.+?):(\d+):\d+\s*-\s*error\s+TS\d+:\s*(.+)/g;
|
|
104
|
+
while ((match = tsRegex2.exec(output)) !== null) {
|
|
105
|
+
errors.push({
|
|
106
|
+
file: match[1],
|
|
107
|
+
line: parseInt(match[2]),
|
|
108
|
+
message: match[3],
|
|
109
|
+
type: "typescript"
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const webpackRegex = /\.\/(.+?):(\d+):\d+\n(.+)/g;
|
|
113
|
+
while ((match = webpackRegex.exec(output)) !== null) {
|
|
114
|
+
errors.push({
|
|
115
|
+
file: match[1],
|
|
116
|
+
line: parseInt(match[2]),
|
|
117
|
+
message: match[3].trim(),
|
|
118
|
+
type: "build"
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return errors;
|
|
122
|
+
}
|
|
123
|
+
function extractPackages(code) {
|
|
124
|
+
const packages = /* @__PURE__ */ new Set();
|
|
125
|
+
const importRegex = /import\s+.*?from\s+['"]([^'"./][^'"]*)['"]/g;
|
|
126
|
+
let match;
|
|
127
|
+
while ((match = importRegex.exec(code)) !== null) {
|
|
128
|
+
let pkg = match[1];
|
|
129
|
+
if (pkg.startsWith("@")) {
|
|
130
|
+
pkg = pkg.split("/").slice(0, 2).join("/");
|
|
131
|
+
} else {
|
|
132
|
+
pkg = pkg.split("/")[0];
|
|
133
|
+
}
|
|
134
|
+
const builtins = ["fs", "path", "http", "https", "crypto", "stream", "events", "os", "util"];
|
|
135
|
+
if (!builtins.includes(pkg)) {
|
|
136
|
+
packages.add(pkg);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return Array.from(packages);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export {
|
|
143
|
+
Terminal,
|
|
144
|
+
parseErrors,
|
|
145
|
+
extractPackages
|
|
146
|
+
};
|
package/dist/index.d.ts
CHANGED