@morebeans/cli 2.0.0 → 2.0.1
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 +25 -5
- 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.0.
|
|
18
|
+
const VERSION = "2.0.1";
|
|
19
19
|
const BEANS_HOME = join(homedir(), ".beans");
|
|
20
20
|
const BEANS_CONFIG = join(BEANS_HOME, "config.json");
|
|
21
21
|
|
|
@@ -115,6 +115,7 @@ async function cmdInit() {
|
|
|
115
115
|
// Find plugin source
|
|
116
116
|
const pluginSources = [
|
|
117
117
|
join(cwd, "submodules/beans/plugin"),
|
|
118
|
+
join(cwd, "plugin"), // If running from beans repo itself
|
|
118
119
|
join(homedir(), ".beans/plugin"),
|
|
119
120
|
join(import.meta.dir, "../plugin"),
|
|
120
121
|
];
|
|
@@ -127,11 +128,30 @@ async function cmdInit() {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
// Auto-clone if not found
|
|
130
132
|
if (!pluginSource) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
+
}
|
|
135
155
|
}
|
|
136
156
|
|
|
137
157
|
// Symlink plugin
|