@morebeans/cli 2.1.1 → 2.1.3
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/index.ts +93 -21
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
15
15
|
import { join, resolve } from "path";
|
|
16
16
|
import { homedir } from "os";
|
|
17
17
|
|
|
18
|
-
const VERSION = "2.
|
|
18
|
+
const VERSION = "2.1.3";
|
|
19
19
|
const BEANS_HOME = join(homedir(), ".beans");
|
|
20
20
|
const BEANS_CONFIG = join(BEANS_HOME, "config.json");
|
|
21
21
|
|
|
@@ -193,6 +193,13 @@ async function cmdInit() {
|
|
|
193
193
|
if (existsSync(claudeMd)) {
|
|
194
194
|
await $`ln -sf ${claudeMd} ${join(cwd, ".claude/CLAUDE.md")}`.nothrow();
|
|
195
195
|
}
|
|
196
|
+
|
|
197
|
+
// Copy settings.json if not exists
|
|
198
|
+
const settingsSrc = join(pluginSource, "settings.json");
|
|
199
|
+
const settingsDest = join(cwd, ".claude/settings.json");
|
|
200
|
+
if (existsSync(settingsSrc) && !existsSync(settingsDest)) {
|
|
201
|
+
await $`cp ${settingsSrc} ${settingsDest}`.nothrow();
|
|
202
|
+
}
|
|
196
203
|
success("Commands registered (3 BEANS commands)");
|
|
197
204
|
|
|
198
205
|
// Track installation
|
|
@@ -276,22 +283,49 @@ async function cmdConfig(args: string[]) {
|
|
|
276
283
|
log(`\nConfig stored at: ${c.dim}${BEANS_CONFIG}${c.reset}`);
|
|
277
284
|
}
|
|
278
285
|
|
|
279
|
-
async function cmdDoctor() {
|
|
280
|
-
|
|
286
|
+
async function cmdDoctor(args: string[]) {
|
|
287
|
+
const fix = args.includes("--fix") || args.includes("-f");
|
|
288
|
+
|
|
289
|
+
log(`\n${c.bold}${c.blue}🩺 BEANS Doctor${fix ? " (--fix)" : ""}${c.reset}\n`);
|
|
281
290
|
|
|
282
291
|
const cwd = process.cwd();
|
|
283
292
|
const config = loadConfig();
|
|
284
293
|
let issues = 0;
|
|
294
|
+
let fixed = 0;
|
|
285
295
|
|
|
286
296
|
// Check CLI tools
|
|
287
297
|
log(`${c.bold}CLI Tools${c.reset}`);
|
|
288
|
-
const tools
|
|
289
|
-
|
|
298
|
+
const tools: Record<string, string> = {
|
|
299
|
+
"bd": "curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash",
|
|
300
|
+
"ast-grep": "npm install -g @ast-grep/cli",
|
|
301
|
+
"repomix": "npm install -g repomix",
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
for (const [tool, installCmd] of Object.entries(tools)) {
|
|
290
305
|
try {
|
|
291
306
|
await $`which ${tool}`.quiet();
|
|
292
307
|
success(tool);
|
|
293
308
|
} catch {
|
|
294
|
-
|
|
309
|
+
if (fix && tool !== "bd") {
|
|
310
|
+
info(`Installing ${tool}...`);
|
|
311
|
+
try {
|
|
312
|
+
await $`${installCmd.split(" ")[0]} ${installCmd.split(" ").slice(1)}`.quiet();
|
|
313
|
+
success(`${tool} installed`);
|
|
314
|
+
fixed++;
|
|
315
|
+
} catch (e) {
|
|
316
|
+
error(`Failed to install ${tool}: ${e}`);
|
|
317
|
+
issues++;
|
|
318
|
+
}
|
|
319
|
+
} else if (tool === "bd") {
|
|
320
|
+
error(`${tool} not found (required)`);
|
|
321
|
+
info(` Install: ${installCmd}`);
|
|
322
|
+
issues++;
|
|
323
|
+
} else {
|
|
324
|
+
warn(`${tool} not found`);
|
|
325
|
+
if (fix) {
|
|
326
|
+
info(` Install: ${installCmd}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
295
329
|
}
|
|
296
330
|
}
|
|
297
331
|
|
|
@@ -302,15 +336,49 @@ async function cmdDoctor() {
|
|
|
302
336
|
if (existsSync(join(cwd, dir))) {
|
|
303
337
|
success(dir);
|
|
304
338
|
} else {
|
|
305
|
-
|
|
306
|
-
|
|
339
|
+
if (fix) {
|
|
340
|
+
info(`Running beans init to fix missing directories...`);
|
|
341
|
+
await cmdInit();
|
|
342
|
+
fixed++;
|
|
343
|
+
break;
|
|
344
|
+
} else {
|
|
345
|
+
error(dir);
|
|
346
|
+
issues++;
|
|
347
|
+
}
|
|
307
348
|
}
|
|
308
349
|
}
|
|
309
|
-
|
|
350
|
+
|
|
351
|
+
// Check .beads (created by bd init)
|
|
310
352
|
if (existsSync(join(cwd, ".beads"))) {
|
|
311
353
|
success(".beads (beads issue tracker)");
|
|
354
|
+
|
|
355
|
+
// Run bd doctor if --fix
|
|
356
|
+
if (fix) {
|
|
357
|
+
log(`\n${c.bold}Running bd doctor --fix...${c.reset}`);
|
|
358
|
+
try {
|
|
359
|
+
const result = await $`bd doctor --fix`.nothrow();
|
|
360
|
+
if (result.exitCode !== 0) {
|
|
361
|
+
warn("bd doctor reported issues (see output above)");
|
|
362
|
+
} else {
|
|
363
|
+
fixed++;
|
|
364
|
+
}
|
|
365
|
+
} catch {
|
|
366
|
+
warn("bd doctor failed");
|
|
367
|
+
}
|
|
368
|
+
}
|
|
312
369
|
} else {
|
|
313
|
-
|
|
370
|
+
if (fix) {
|
|
371
|
+
info("Initializing beads...");
|
|
372
|
+
try {
|
|
373
|
+
await $`bd init`.nothrow();
|
|
374
|
+
success(".beads initialized");
|
|
375
|
+
fixed++;
|
|
376
|
+
} catch {
|
|
377
|
+
warn("bd init failed - run manually");
|
|
378
|
+
}
|
|
379
|
+
} else {
|
|
380
|
+
warn(".beads not initialized (run 'beans doctor --fix' or 'bd init')");
|
|
381
|
+
}
|
|
314
382
|
}
|
|
315
383
|
|
|
316
384
|
// Check config
|
|
@@ -345,15 +413,12 @@ async function cmdDoctor() {
|
|
|
345
413
|
const commands = join(pluginPath, "commands");
|
|
346
414
|
const agents = join(pluginPath, "agents");
|
|
347
415
|
if (existsSync(commands)) {
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
const ralphCount = existsSync(join(commands, "ralph")) ?
|
|
351
|
-
(await $`ls ${join(commands, "ralph")}`.text()).split("\n").filter(Boolean).length : 0;
|
|
352
|
-
log(` Commands: ${bdCount} bd, ${ralphCount} ralph`);
|
|
416
|
+
const cmdCount = (await $`ls ${commands}/*.md 2>/dev/null`.text().catch(() => "")).split("\n").filter(Boolean).length;
|
|
417
|
+
log(` Commands: ${cmdCount} (/beans, /beans:status, /beans:land)`);
|
|
353
418
|
}
|
|
354
419
|
if (existsSync(agents)) {
|
|
355
420
|
const agentCount = (await $`ls ${agents}`.text()).split("\n").filter(Boolean).length;
|
|
356
|
-
log(` Agents: ${agentCount}`);
|
|
421
|
+
log(` Agents: ${agentCount} subagents`);
|
|
357
422
|
}
|
|
358
423
|
} else {
|
|
359
424
|
error("Plugin not installed");
|
|
@@ -361,10 +426,16 @@ async function cmdDoctor() {
|
|
|
361
426
|
}
|
|
362
427
|
|
|
363
428
|
log("");
|
|
429
|
+
if (fix && fixed > 0) {
|
|
430
|
+
log(`${c.green}${c.bold}🔧 Fixed ${fixed} issue(s)${c.reset}`);
|
|
431
|
+
}
|
|
364
432
|
if (issues === 0) {
|
|
365
433
|
log(`${c.green}${c.bold}✅ BEANS is healthy!${c.reset}`);
|
|
366
434
|
} else {
|
|
367
|
-
log(`${c.yellow}⚠ ${issues} issue(s) found
|
|
435
|
+
log(`${c.yellow}⚠ ${issues} issue(s) found.${c.reset}`);
|
|
436
|
+
if (!fix) {
|
|
437
|
+
log(`${c.dim}Run 'beans doctor --fix' to auto-fix.${c.reset}`);
|
|
438
|
+
}
|
|
368
439
|
}
|
|
369
440
|
log("");
|
|
370
441
|
}
|
|
@@ -383,14 +454,15 @@ ${c.bold}Commands:${c.reset}
|
|
|
383
454
|
${c.cyan}config --github${c.reset} Set GitHub token
|
|
384
455
|
${c.cyan}config --show${c.reset} Show current configuration
|
|
385
456
|
${c.cyan}doctor${c.reset} Check installation status
|
|
457
|
+
${c.cyan}doctor --fix${c.reset} Auto-fix issues (install tools, run bd doctor)
|
|
386
458
|
${c.cyan}help${c.reset} Show this help message
|
|
387
459
|
|
|
388
460
|
${c.bold}In Claude Code:${c.reset}
|
|
389
461
|
${c.cyan}/beans${c.reset} List ready issues
|
|
390
462
|
${c.cyan}/beans "Add feature"${c.reset} Full autonomous flow
|
|
391
|
-
${c.cyan}/beans task-001${c.reset}
|
|
392
|
-
${c.cyan}/
|
|
393
|
-
${c.cyan}/
|
|
463
|
+
${c.cyan}/beans task-001${c.reset} Continue existing issue
|
|
464
|
+
${c.cyan}/beans:status${c.reset} Check progress
|
|
465
|
+
${c.cyan}/beans:land${c.reset} Commit, push, close
|
|
394
466
|
|
|
395
467
|
${c.bold}Environment:${c.reset}
|
|
396
468
|
Config stored at: ${c.dim}~/.beans/config.json${c.reset}
|
|
@@ -414,7 +486,7 @@ switch (command) {
|
|
|
414
486
|
await cmdConfig(args);
|
|
415
487
|
break;
|
|
416
488
|
case "doctor":
|
|
417
|
-
await cmdDoctor();
|
|
489
|
+
await cmdDoctor(args);
|
|
418
490
|
break;
|
|
419
491
|
case "help":
|
|
420
492
|
case "--help":
|