@morebeans/cli 2.3.2 → 2.3.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/index.ts +33 -27
- 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.
|
|
18
|
+
const VERSION = "2.3.4";
|
|
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
|
-
//
|
|
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(
|
|
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
|
-
|
|
134
|
-
|
|
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
|
|
@@ -174,7 +181,6 @@ async function cmdInit() {
|
|
|
174
181
|
}
|
|
175
182
|
|
|
176
183
|
// Install essential subagents from catalog
|
|
177
|
-
const beansHome = join(homedir(), ".beans");
|
|
178
184
|
const subagentsSrc = join(beansHome, "package/subagents/categories");
|
|
179
185
|
const agentsDest = join(cwd, ".claude/agents");
|
|
180
186
|
|