@codebakers/cli 1.1.5 → 1.1.7
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/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.js +218 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +772 -0
- package/dist/commands/install-hook.d.ts +12 -0
- package/dist/commands/install-hook.js +193 -0
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.js +81 -0
- package/dist/commands/login.d.ts +1 -0
- package/dist/commands/login.js +54 -0
- package/dist/commands/mcp-config.d.ts +6 -0
- package/dist/commands/mcp-config.js +209 -0
- package/dist/commands/serve.d.ts +1 -0
- package/dist/commands/serve.js +26 -0
- package/dist/commands/setup.d.ts +1 -0
- package/dist/commands/setup.js +92 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +49 -0
- package/dist/commands/uninstall.d.ts +1 -0
- package/dist/commands/uninstall.js +50 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +71 -1075
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +544 -0
- package/package.json +17 -38
- package/src/commands/doctor.ts +231 -0
- package/src/commands/init.ts +827 -0
- package/src/commands/install-hook.ts +207 -0
- package/src/commands/install.ts +94 -0
- package/src/commands/login.ts +56 -0
- package/src/commands/mcp-config.ts +235 -0
- package/src/commands/serve.ts +23 -0
- package/src/commands/setup.ts +104 -0
- package/src/commands/status.ts +48 -0
- package/src/commands/uninstall.ts +49 -0
- package/src/config.ts +34 -0
- package/src/index.ts +87 -0
- package/src/mcp/server.ts +617 -0
- package/tsconfig.json +16 -0
- package/README.md +0 -89
- package/dist/chunk-7CKLRE2H.js +0 -36
- package/dist/config-R2H6JKGW.js +0 -16
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { homedir } from 'os';
|
|
5
|
+
import { isHookInstalled } from './install-hook.js';
|
|
6
|
+
|
|
7
|
+
interface CheckResult {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Run all health checks for CodeBakers setup
|
|
15
|
+
*/
|
|
16
|
+
export async function doctor(): Promise<void> {
|
|
17
|
+
console.log(chalk.blue('\n CodeBakers Doctor\n'));
|
|
18
|
+
console.log(chalk.gray(' Checking your setup...\n'));
|
|
19
|
+
|
|
20
|
+
const projectChecks = checkProject();
|
|
21
|
+
const systemChecks = checkSystem();
|
|
22
|
+
|
|
23
|
+
// Display project checks
|
|
24
|
+
console.log(chalk.white(' Project:'));
|
|
25
|
+
for (const check of projectChecks) {
|
|
26
|
+
const icon = check.ok ? chalk.green('✓') : chalk.red('✗');
|
|
27
|
+
console.log(` ${icon} ${check.message}`);
|
|
28
|
+
if (check.details && !check.ok) {
|
|
29
|
+
console.log(chalk.gray(` └─ ${check.details}`));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
console.log(chalk.white('\n System:'));
|
|
34
|
+
for (const check of systemChecks) {
|
|
35
|
+
const icon = check.ok ? chalk.green('✓') : chalk.red('✗');
|
|
36
|
+
console.log(` ${icon} ${check.message}`);
|
|
37
|
+
if (check.details && !check.ok) {
|
|
38
|
+
console.log(chalk.gray(` └─ ${check.details}`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Summary
|
|
43
|
+
const allChecks = [...projectChecks, ...systemChecks];
|
|
44
|
+
const passed = allChecks.filter(c => c.ok).length;
|
|
45
|
+
const total = allChecks.length;
|
|
46
|
+
|
|
47
|
+
console.log('');
|
|
48
|
+
if (passed === total) {
|
|
49
|
+
console.log(chalk.green(' ✅ Everything looks good!\n'));
|
|
50
|
+
} else {
|
|
51
|
+
console.log(chalk.yellow(` ⚠️ ${passed}/${total} checks passed. See issues above.\n`));
|
|
52
|
+
|
|
53
|
+
// Provide fix suggestions
|
|
54
|
+
console.log(chalk.white(' Suggested fixes:'));
|
|
55
|
+
|
|
56
|
+
const claudeMdCheck = projectChecks.find(c => c.message.includes('CLAUDE.md'));
|
|
57
|
+
if (claudeMdCheck && !claudeMdCheck.ok) {
|
|
58
|
+
console.log(chalk.gray(' • Run: codebakers install'));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const hookCheck = systemChecks.find(c => c.message.includes('Hook'));
|
|
62
|
+
if (hookCheck && !hookCheck.ok) {
|
|
63
|
+
console.log(chalk.gray(' • Run: codebakers install-hook'));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log('');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Check project-level setup
|
|
72
|
+
*/
|
|
73
|
+
function checkProject(): CheckResult[] {
|
|
74
|
+
const results: CheckResult[] = [];
|
|
75
|
+
const cwd = process.cwd();
|
|
76
|
+
|
|
77
|
+
// Check CLAUDE.md
|
|
78
|
+
const claudeMdPath = join(cwd, 'CLAUDE.md');
|
|
79
|
+
if (existsSync(claudeMdPath)) {
|
|
80
|
+
const content = readFileSync(claudeMdPath, 'utf-8');
|
|
81
|
+
if (content.includes('CODEBAKERS') || content.includes('CodeBakers') || content.includes('.claude')) {
|
|
82
|
+
results.push({ ok: true, message: 'CLAUDE.md exists (CodeBakers router)' });
|
|
83
|
+
} else {
|
|
84
|
+
results.push({
|
|
85
|
+
ok: false,
|
|
86
|
+
message: 'CLAUDE.md exists but is not CodeBakers router',
|
|
87
|
+
details: 'Run: codebakers install --force'
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
results.push({
|
|
92
|
+
ok: false,
|
|
93
|
+
message: 'CLAUDE.md not found',
|
|
94
|
+
details: 'Run: codebakers install'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Check .claude folder
|
|
99
|
+
const claudeDir = join(cwd, '.claude');
|
|
100
|
+
if (existsSync(claudeDir)) {
|
|
101
|
+
results.push({ ok: true, message: '.claude/ folder exists' });
|
|
102
|
+
|
|
103
|
+
// Count modules
|
|
104
|
+
try {
|
|
105
|
+
const files = readdirSync(claudeDir).filter(f => f.endsWith('.md'));
|
|
106
|
+
const moduleCount = files.length;
|
|
107
|
+
|
|
108
|
+
if (moduleCount >= 10) {
|
|
109
|
+
results.push({ ok: true, message: `${moduleCount} modules present` });
|
|
110
|
+
} else if (moduleCount > 0) {
|
|
111
|
+
results.push({
|
|
112
|
+
ok: false,
|
|
113
|
+
message: `Only ${moduleCount} modules found (expected 10+)`,
|
|
114
|
+
details: 'Run: codebakers install to add missing modules'
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
results.push({
|
|
118
|
+
ok: false,
|
|
119
|
+
message: 'No modules found in .claude/',
|
|
120
|
+
details: 'Run: codebakers install'
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Check for 00-core.md
|
|
125
|
+
const corePath = join(claudeDir, '00-core.md');
|
|
126
|
+
if (existsSync(corePath)) {
|
|
127
|
+
results.push({ ok: true, message: '00-core.md exists (base patterns)' });
|
|
128
|
+
} else {
|
|
129
|
+
results.push({
|
|
130
|
+
ok: false,
|
|
131
|
+
message: '00-core.md not found',
|
|
132
|
+
details: 'This module is loaded on every task'
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Check for 00-system.md
|
|
137
|
+
const systemPath = join(claudeDir, '00-system.md');
|
|
138
|
+
if (existsSync(systemPath)) {
|
|
139
|
+
results.push({ ok: true, message: '00-system.md exists (workflow module)' });
|
|
140
|
+
} else {
|
|
141
|
+
results.push({
|
|
142
|
+
ok: true, // Not required, just recommended
|
|
143
|
+
message: '00-system.md not found (optional workflow module)',
|
|
144
|
+
details: 'Contains 9-step execution flow'
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
} catch {
|
|
148
|
+
results.push({
|
|
149
|
+
ok: false,
|
|
150
|
+
message: 'Could not read .claude/ folder',
|
|
151
|
+
details: 'Check folder permissions'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
results.push({
|
|
156
|
+
ok: false,
|
|
157
|
+
message: '.claude/ folder not found',
|
|
158
|
+
details: 'Run: codebakers install'
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Check PROJECT-STATE.md (optional)
|
|
163
|
+
const statePath = join(cwd, 'PROJECT-STATE.md');
|
|
164
|
+
if (existsSync(statePath)) {
|
|
165
|
+
results.push({ ok: true, message: 'PROJECT-STATE.md exists' });
|
|
166
|
+
} else {
|
|
167
|
+
results.push({
|
|
168
|
+
ok: true, // It's optional
|
|
169
|
+
message: 'PROJECT-STATE.md not found (created on first run)',
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return results;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Check system-level setup
|
|
178
|
+
*/
|
|
179
|
+
function checkSystem(): CheckResult[] {
|
|
180
|
+
const results: CheckResult[] = [];
|
|
181
|
+
|
|
182
|
+
// Check hook installation
|
|
183
|
+
if (isHookInstalled()) {
|
|
184
|
+
results.push({ ok: true, message: 'Hook installed in ~/.claude/settings.json' });
|
|
185
|
+
} else {
|
|
186
|
+
results.push({
|
|
187
|
+
ok: false,
|
|
188
|
+
message: 'Hook not installed',
|
|
189
|
+
details: 'Run: codebakers install-hook'
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Check ~/.claude directory exists
|
|
194
|
+
const claudeConfigDir = join(homedir(), '.claude');
|
|
195
|
+
if (existsSync(claudeConfigDir)) {
|
|
196
|
+
results.push({ ok: true, message: '~/.claude directory exists' });
|
|
197
|
+
} else {
|
|
198
|
+
results.push({
|
|
199
|
+
ok: false,
|
|
200
|
+
message: '~/.claude directory not found',
|
|
201
|
+
details: 'Run: codebakers install-hook (will create it)'
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Check settings.json exists
|
|
206
|
+
const settingsPath = join(claudeConfigDir, 'settings.json');
|
|
207
|
+
if (existsSync(settingsPath)) {
|
|
208
|
+
results.push({ ok: true, message: '~/.claude/settings.json exists' });
|
|
209
|
+
} else {
|
|
210
|
+
results.push({
|
|
211
|
+
ok: true, // Will be created by install-hook
|
|
212
|
+
message: '~/.claude/settings.json not found',
|
|
213
|
+
details: 'Run: codebakers install-hook'
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return results;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Quick check - returns true if basic setup is complete
|
|
222
|
+
*/
|
|
223
|
+
export function isSetupComplete(): boolean {
|
|
224
|
+
const cwd = process.cwd();
|
|
225
|
+
|
|
226
|
+
const hasClaudeMd = existsSync(join(cwd, 'CLAUDE.md'));
|
|
227
|
+
const hasClaudeDir = existsSync(join(cwd, '.claude'));
|
|
228
|
+
const hasHook = isHookInstalled();
|
|
229
|
+
|
|
230
|
+
return hasClaudeMd && hasClaudeDir && hasHook;
|
|
231
|
+
}
|