codebakers 2.5.0 → 2.5.4
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/AUDIT_REPORT.md +138 -0
- package/dist/{advisors-3PWAN6UL.js → advisors-RWRTSJRR.js} +1 -1
- package/dist/{chunk-URNRSXPU.js → chunk-D44U3IEA.js} +1 -1
- package/dist/{chunk-WZQNFV7Q.js → chunk-LANM5XQW.js} +1 -1
- package/dist/index.js +439 -283
- package/dist/{prd-YAUSAL5V.js → prd-RYITSL6Q.js} +1 -1
- package/package.json +1 -1
- package/src/commands/advisors.ts +1 -1
- package/src/commands/build.ts +1 -1
- package/src/commands/check.ts +1 -1
- package/src/commands/code.ts +1 -1
- package/src/commands/deploy.ts +2 -2
- package/src/commands/design.ts +1 -1
- package/src/commands/generate.ts +1 -1
- package/src/commands/init.ts +9 -2
- package/src/commands/integrate.ts +1 -1
- package/src/commands/migrate.ts +1 -1
- package/src/commands/prd-maker.ts +3 -2
- package/src/commands/prd.ts +1 -1
- package/src/commands/security.ts +1 -1
- package/src/commands/status.ts +1 -1
- package/src/commands/website.ts +41 -33
- package/src/index.ts +54 -42
- package/src/patterns/loader.ts +1 -1
- package/src/utils/display.ts +13 -0
- package/src/utils/files.ts +1 -1
- package/src/utils/ui.ts +441 -0
- package/src/utils/voice.ts +1 -1
package/AUDIT_REPORT.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# CodeBakers CLI Audit Report
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
- **Total TypeScript Errors**: 206 (mostly non-critical type issues)
|
|
5
|
+
- **Critical Runtime Bugs Found**: 3
|
|
6
|
+
- **Moderate Issues**: 12
|
|
7
|
+
- **Minor Issues**: Many (type annotations)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🔴 CRITICAL ISSUES (Will crash at runtime)
|
|
12
|
+
|
|
13
|
+
### 1. ~~Missing `execa` import in prd-maker.ts~~ ✅ FIXED
|
|
14
|
+
**File**: `src/commands/prd-maker.ts`
|
|
15
|
+
**Issue**: `execa` was used but not imported
|
|
16
|
+
**Status**: Fixed
|
|
17
|
+
|
|
18
|
+
### 2. ~~Duplicate function declarations in prd-maker.ts~~ ✅ FIXED
|
|
19
|
+
**File**: `src/commands/prd-maker.ts`
|
|
20
|
+
**Issue**: `getVoiceInput` and `checkVoiceAvailability` were both imported AND defined locally
|
|
21
|
+
**Status**: Fixed (removed imports, kept local implementations)
|
|
22
|
+
|
|
23
|
+
### 3. ~~fs-extra import style causing writeJson to fail~~ ✅ FIXED (Previous session)
|
|
24
|
+
**Files**: All command files
|
|
25
|
+
**Issue**: `import * as fs from 'fs-extra'` doesn't work in ESM
|
|
26
|
+
**Status**: Fixed to `import fs from 'fs-extra'`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🟡 MODERATE ISSUES (May cause unexpected behavior)
|
|
31
|
+
|
|
32
|
+
### 4. Missing try-catch around async operations
|
|
33
|
+
**Files affected**:
|
|
34
|
+
- `build.ts`: 15 async calls, only 5 try blocks
|
|
35
|
+
- `deploy.ts`: 10 async calls, only 8 try blocks
|
|
36
|
+
- `migrate.ts`: 17 async calls, only 7 try blocks
|
|
37
|
+
- `website.ts`: 8 async calls, only 4 try blocks
|
|
38
|
+
|
|
39
|
+
**Risk**: Unhandled promise rejections can crash the CLI
|
|
40
|
+
**Recommendation**: Add try-catch or handle with .catch()
|
|
41
|
+
|
|
42
|
+
### 5. Silent failures with `reject: false`
|
|
43
|
+
**Files**: `build.ts`, `deploy.ts`, `integrate.ts`, `migrate.ts`
|
|
44
|
+
**Locations**:
|
|
45
|
+
```
|
|
46
|
+
build.ts:541, 554, 578, 890, 904, 908
|
|
47
|
+
deploy.ts:320
|
|
48
|
+
integrate.ts:685
|
|
49
|
+
migrate.ts:105, 108
|
|
50
|
+
```
|
|
51
|
+
**Risk**: Commands may appear to succeed when they actually failed
|
|
52
|
+
**Recommendation**: Log failures or show warnings to users
|
|
53
|
+
|
|
54
|
+
### 6. Vercel deploy returns incomplete object
|
|
55
|
+
**File**: `src/commands/deploy.ts:233`
|
|
56
|
+
**Issue**: Accesses `deployment.dashboardUrl` but Vercel service only returns `{ url: string }`
|
|
57
|
+
**Fix needed**: Update VercelService to return dashboardUrl or remove that line
|
|
58
|
+
|
|
59
|
+
### 7. Type issues with package.json generation in init.ts
|
|
60
|
+
**File**: `src/commands/init.ts:394-423`
|
|
61
|
+
**Issue**: Dynamic property assignment to typed objects
|
|
62
|
+
**Risk**: TypeScript errors, but works at runtime
|
|
63
|
+
**Recommendation**: Type the objects as `Record<string, string>`
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🟢 MINOR ISSUES (Won't crash, but should fix)
|
|
68
|
+
|
|
69
|
+
### 8. Anthropic response type checking
|
|
70
|
+
**Files**: Most AI command files
|
|
71
|
+
**Current code**:
|
|
72
|
+
```typescript
|
|
73
|
+
const text = response.content[0].type === 'text' ? response.content[0].text : '';
|
|
74
|
+
```
|
|
75
|
+
**Issue**: Accesses `[0]` without checking if array has elements
|
|
76
|
+
**Better**:
|
|
77
|
+
```typescript
|
|
78
|
+
const firstContent = response.content?.[0];
|
|
79
|
+
const text = firstContent?.type === 'text' ? firstContent.text : '';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 9. Potential null pointer on string operations
|
|
83
|
+
**Files**: Multiple
|
|
84
|
+
**Examples**:
|
|
85
|
+
- `advisors.ts:488`: `projectName.toUpperCase()` - projectName could be undefined
|
|
86
|
+
- `code.ts:135`: `input.trim()` - input could be undefined
|
|
87
|
+
|
|
88
|
+
### 10. Symbol to string conversion
|
|
89
|
+
**File**: `code.ts:590`
|
|
90
|
+
**Issue**: Implicit symbol to string conversion will fail
|
|
91
|
+
**Recommendation**: Wrap in `String(...)`
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 📊 TypeScript Error Categories
|
|
96
|
+
|
|
97
|
+
| Error Code | Count | Description | Severity |
|
|
98
|
+
|------------|-------|-------------|----------|
|
|
99
|
+
| TS2532 | 72 | Object possibly undefined | Low |
|
|
100
|
+
| TS2339 | 22 | Property doesn't exist on type | Low |
|
|
101
|
+
| TS7053 | 15 | Dynamic index signature | Low |
|
|
102
|
+
| TS2345 | 11 | Type assignment mismatch | Low |
|
|
103
|
+
| TS2322 | 10 | Type mismatch | Low |
|
|
104
|
+
| TS18048 | 7 | Possibly undefined | Low |
|
|
105
|
+
| TS2440 | 2 | Duplicate declarations | Fixed |
|
|
106
|
+
| TS7006 | 1 | Implicit any | Low |
|
|
107
|
+
| TS2769 | 1 | No overload matches | Medium |
|
|
108
|
+
| TS2731 | 1 | Symbol conversion | Medium |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## ✅ Already Working Well
|
|
113
|
+
|
|
114
|
+
1. **Config system** - Solid implementation with Zod validation
|
|
115
|
+
2. **Service classes** - GitHub, Vercel, Supabase all properly structured
|
|
116
|
+
3. **CLI structure** - Commander.js setup is correct
|
|
117
|
+
4. **Error display utilities** - New display.ts is well-implemented
|
|
118
|
+
5. **Voice input** - Has fallback to text input
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 🔧 Recommended Fixes Priority
|
|
123
|
+
|
|
124
|
+
1. ✅ ~~Fix prd-maker.ts imports~~ DONE
|
|
125
|
+
2. 🔴 Fix deploy.ts dashboardUrl issue
|
|
126
|
+
3. 🔴 Add better error handling to build.ts and migrate.ts
|
|
127
|
+
4. 🟡 Add null checks for Anthropic responses
|
|
128
|
+
5. 🟡 Fix init.ts type issues
|
|
129
|
+
6. 🟢 Add strict TypeScript checks gradually
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Next Steps
|
|
134
|
+
|
|
135
|
+
1. Test all commands manually
|
|
136
|
+
2. Add integration tests
|
|
137
|
+
3. Gradually enable stricter TypeScript
|
|
138
|
+
4. Add more comprehensive error handling
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
// src/commands/advisors.ts
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
7
|
import chalk from "chalk";
|
|
8
|
-
import
|
|
8
|
+
import fs from "fs-extra";
|
|
9
9
|
import * as path from "path";
|
|
10
10
|
import Anthropic from "@anthropic-ai/sdk";
|
|
11
11
|
var DREAM_TEAM = [
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
// src/commands/prd.ts
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
7
|
import chalk from "chalk";
|
|
8
|
-
import
|
|
8
|
+
import fs from "fs-extra";
|
|
9
9
|
import * as path from "path";
|
|
10
10
|
import Anthropic from "@anthropic-ai/sdk";
|
|
11
11
|
async function prdCommand(filePath) {
|