@morebeans/cli 2.7.0 → 2.8.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/index.ts +80 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
16
16
|
import { join, resolve } from "path";
|
|
17
17
|
import { homedir } from "os";
|
|
18
18
|
|
|
19
|
-
const VERSION = "2.
|
|
19
|
+
const VERSION = "2.8.0";
|
|
20
20
|
const BEANS_HOME = join(homedir(), ".beans");
|
|
21
21
|
const BEANS_CONFIG = join(BEANS_HOME, "config.json");
|
|
22
22
|
|
|
@@ -250,6 +250,25 @@ async function cmdInit() {
|
|
|
250
250
|
if (existsSync(settingsSrc) && !existsSync(settingsDest)) {
|
|
251
251
|
await $`cp ${settingsSrc} ${settingsDest}`.nothrow();
|
|
252
252
|
}
|
|
253
|
+
|
|
254
|
+
// Install hooks (for context continuity)
|
|
255
|
+
info("Installing hooks...");
|
|
256
|
+
const hooksDir = join(cwd, ".claude/hooks");
|
|
257
|
+
const hooksScriptsDir = join(hooksDir, "scripts");
|
|
258
|
+
mkdirSync(hooksScriptsDir, { recursive: true });
|
|
259
|
+
|
|
260
|
+
const hooksSrc = join(pluginSource, "hooks/hooks.json");
|
|
261
|
+
const preCompactSrc = join(pluginSource, "hooks/scripts/pre-compact.sh");
|
|
262
|
+
|
|
263
|
+
if (existsSync(hooksSrc)) {
|
|
264
|
+
await $`cp ${hooksSrc} ${join(hooksDir, "hooks.json")}`.nothrow();
|
|
265
|
+
}
|
|
266
|
+
if (existsSync(preCompactSrc)) {
|
|
267
|
+
await $`cp ${preCompactSrc} ${join(hooksScriptsDir, "pre-compact.sh")}`.nothrow();
|
|
268
|
+
await $`chmod +x ${join(hooksScriptsDir, "pre-compact.sh")}`.nothrow();
|
|
269
|
+
}
|
|
270
|
+
success("Hooks installed (SessionStart, PreCompact, Stop)");
|
|
271
|
+
|
|
253
272
|
success("Commands registered (10 BEANS commands + beans-loop)");
|
|
254
273
|
|
|
255
274
|
// Initialize beads issue tracker (uses .beans directory now)
|
|
@@ -682,6 +701,61 @@ Use research_store tool to manually add web/codebase findings.
|
|
|
682
701
|
`);
|
|
683
702
|
}
|
|
684
703
|
|
|
704
|
+
async function cmdCheck() {
|
|
705
|
+
log(`\n${c.bold}${c.blue}🔄 BEANS Update Check${c.reset}\n`);
|
|
706
|
+
|
|
707
|
+
info("Checking npm for latest version...");
|
|
708
|
+
|
|
709
|
+
try {
|
|
710
|
+
const result = await $`npm view @morebeans/cli version`.text();
|
|
711
|
+
const latestVersion = result.trim();
|
|
712
|
+
|
|
713
|
+
if (latestVersion === VERSION) {
|
|
714
|
+
success(`Already on latest version: ${VERSION}`);
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
log(` Current: ${c.yellow}${VERSION}${c.reset}`);
|
|
719
|
+
log(` Latest: ${c.green}${latestVersion}${c.reset}`);
|
|
720
|
+
log("");
|
|
721
|
+
|
|
722
|
+
info("Updating BEANS CLI...");
|
|
723
|
+
|
|
724
|
+
// Try bun first, fallback to npm
|
|
725
|
+
try {
|
|
726
|
+
await $`bun install -g @morebeans/cli@latest`.quiet();
|
|
727
|
+
success(`Updated to v${latestVersion} (via bun)`);
|
|
728
|
+
} catch {
|
|
729
|
+
try {
|
|
730
|
+
await $`npm install -g @morebeans/cli@latest`.quiet();
|
|
731
|
+
success(`Updated to v${latestVersion} (via npm)`);
|
|
732
|
+
} catch (e) {
|
|
733
|
+
error(`Failed to update: ${e}`);
|
|
734
|
+
info("Try manually: bun install -g @morebeans/cli@latest");
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Update global ~/.beans repo
|
|
740
|
+
const beansHome = join(homedir(), ".beans");
|
|
741
|
+
if (existsSync(beansHome)) {
|
|
742
|
+
info("Updating ~/.beans repo...");
|
|
743
|
+
try {
|
|
744
|
+
await $`cd ${beansHome} && git pull --ff-only`.quiet();
|
|
745
|
+
success("~/.beans repo updated");
|
|
746
|
+
} catch {
|
|
747
|
+
warn("Could not update ~/.beans - run 'cd ~/.beans && git pull' manually");
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
log(`\n${c.green}${c.bold}✅ BEANS updated to v${latestVersion}${c.reset}`);
|
|
752
|
+
log(`Run ${c.cyan}beans doctor${c.reset} to verify installation.`);
|
|
753
|
+
|
|
754
|
+
} catch (e) {
|
|
755
|
+
error(`Failed to check for updates: ${e}`);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
685
759
|
async function cmdHelp() {
|
|
686
760
|
log(`
|
|
687
761
|
${c.bold}${c.blue}🫘 BEANS CLI v${VERSION}${c.reset}
|
|
@@ -691,6 +765,7 @@ ${c.bold}Usage:${c.reset}
|
|
|
691
765
|
|
|
692
766
|
${c.bold}Commands:${c.reset}
|
|
693
767
|
${c.cyan}init${c.reset} Initialize BEANS in current project
|
|
768
|
+
${c.cyan}check${c.reset} Check for updates and install
|
|
694
769
|
${c.cyan}config${c.reset} Configure API keys
|
|
695
770
|
${c.cyan}doctor${c.reset} Check installation status
|
|
696
771
|
${c.cyan}research${c.reset} Manage research database
|
|
@@ -727,6 +802,10 @@ switch (command) {
|
|
|
727
802
|
case "init":
|
|
728
803
|
await cmdInit();
|
|
729
804
|
break;
|
|
805
|
+
case "check":
|
|
806
|
+
case "update":
|
|
807
|
+
await cmdCheck();
|
|
808
|
+
break;
|
|
730
809
|
case "config":
|
|
731
810
|
await cmdConfig(args);
|
|
732
811
|
break;
|