@morebeans/cli 2.3.1 → 2.3.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.
Files changed (2) hide show
  1. package/index.ts +44 -47
  2. 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.3.1";
18
+ const VERSION = "2.3.3";
19
19
  const BEANS_HOME = join(homedir(), ".beans");
20
20
  const BEANS_CONFIG = join(BEANS_HOME, "config.json");
21
21
 
@@ -112,11 +112,39 @@ async function cmdInit() {
112
112
  }
113
113
  success("Directories created");
114
114
 
115
- // Find plugin source
115
+ // Ensure global ~/.beans repo exists (for subagent catalog)
116
+ const beansHome = join(homedir(), ".beans");
117
+ const beansRepoMarker = join(beansHome, "plugin"); // Check if it's a proper repo clone
118
+
119
+ if (!existsSync(beansRepoMarker)) {
120
+ info("Setting up global BEANS repo (~/.beans)...");
121
+ try {
122
+ // Backup config if exists
123
+ const configBackup = existsSync(join(beansHome, "config.json"))
124
+ ? JSON.parse(readFileSync(join(beansHome, "config.json"), "utf-8"))
125
+ : null;
126
+
127
+ // Clone fresh (removes any partial state)
128
+ if (existsSync(beansHome)) {
129
+ await $`rm -rf ${beansHome}`.quiet();
130
+ }
131
+ await $`git clone https://github.com/shinyobjectz/beans.git ${beansHome}`.quiet();
132
+
133
+ // Restore config
134
+ if (configBackup) {
135
+ writeFileSync(join(beansHome, "config.json"), JSON.stringify(configBackup, null, 2));
136
+ }
137
+ success("BEANS repo cloned to ~/.beans (subagent catalog available)");
138
+ } catch (e) {
139
+ warn(`Could not clone global BEANS repo: ${e}`);
140
+ }
141
+ }
142
+
143
+ // Find plugin source (prefer local, fallback to global)
116
144
  const pluginSources = [
117
145
  join(cwd, "submodules/beans/plugin"),
118
146
  join(cwd, "plugin"), // If running from beans repo itself
119
- join(homedir(), ".beans/plugin"),
147
+ join(beansHome, "plugin"),
120
148
  join(import.meta.dir, "../plugin"),
121
149
  ];
122
150
 
@@ -128,30 +156,9 @@ async function cmdInit() {
128
156
  }
129
157
  }
130
158
 
131
- // Auto-clone if not found
132
159
  if (!pluginSource) {
133
- info("BEANS plugin not found locally, cloning from GitHub...");
134
- const beansHome = join(homedir(), ".beans");
135
-
136
- try {
137
- if (existsSync(beansHome)) {
138
- info("Updating existing ~/.beans...");
139
- await $`cd ${beansHome} && git pull`.quiet();
140
- } else {
141
- await $`git clone https://github.com/shinyobjectz/beans.git ${beansHome}`;
142
- }
143
- pluginSource = join(beansHome, "plugin");
144
-
145
- if (!existsSync(pluginSource)) {
146
- error("Clone succeeded but plugin directory not found");
147
- return;
148
- }
149
- success("BEANS repo cloned to ~/.beans");
150
- } catch (e) {
151
- error(`Failed to clone BEANS repo: ${e}`);
152
- info("Try manually: git clone https://github.com/shinyobjectz/beans.git ~/.beans");
153
- return;
154
- }
160
+ error("BEANS plugin not found. Try: git clone https://github.com/shinyobjectz/beans.git ~/.beans");
161
+ return;
155
162
  }
156
163
 
157
164
  // Symlink plugin
@@ -385,39 +392,29 @@ async function cmdDoctor(args: string[]) {
385
392
  }
386
393
  }
387
394
 
388
- // Check beads database (now in .beans, created by bd init)
395
+ // Check beads database (supports both .beans and legacy .beads locations)
389
396
  const beansDir = join(cwd, ".beans");
390
- const hasBeadsDb = existsSync(join(beansDir, "beads.db")) || existsSync(join(beansDir, "issues.jsonl"));
397
+ const legacyBeadsDir = join(cwd, ".beads");
391
398
 
392
- if (hasBeadsDb) {
393
- success(".beans/beads.db (issue tracker)");
394
-
395
- // Run bd doctor if --fix
396
- if (fix) {
397
- log(`\n${c.bold}Running bd doctor --fix...${c.reset}`);
398
- try {
399
- const result = await $`bd doctor --fix`.nothrow();
400
- if (result.exitCode !== 0) {
401
- warn("bd doctor reported issues (see output above)");
402
- } else {
403
- fixed++;
404
- }
405
- } catch {
406
- warn("bd doctor failed");
407
- }
408
- }
399
+ const hasBeadsInBeans = existsSync(join(beansDir, "beads.db")) || existsSync(join(beansDir, "issues.jsonl"));
400
+ const hasLegacyBeads = existsSync(join(legacyBeadsDir, "beads.db")) || existsSync(join(legacyBeadsDir, "issues.jsonl"));
401
+
402
+ if (hasBeadsInBeans) {
403
+ success(".beans/ (issue tracker)");
404
+ } else if (hasLegacyBeads) {
405
+ success(".beads/ (issue tracker - legacy location)");
409
406
  } else {
410
407
  if (fix) {
411
408
  info("Initializing beads (bd init)...");
412
409
  try {
413
410
  await $`bd init`.nothrow();
414
- success("beads initialized in .beans/");
411
+ success("beads initialized");
415
412
  fixed++;
416
413
  } catch {
417
414
  warn("bd init failed - run manually");
418
415
  }
419
416
  } else {
420
- warn("beads not initialized (run 'beans doctor --fix' or 'bd init')");
417
+ warn("Issue tracker not initialized (run 'beans doctor --fix' or 'bd init')");
421
418
  }
422
419
  }
423
420
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morebeans/cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "BEANS CLI - Setup and configure autonomous development for Claude Code",
5
5
  "type": "module",
6
6
  "main": "index.ts",