@burdenoff/vibe-agent 2.7.4 → 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/dist/{app-hc590rye.js → app-tba5zhmy.js} +2 -2
- package/dist/cli.js +395 -9
- package/dist/cli.js.map +9 -6
- package/dist/{index-wmvkjcjj.js → index-0429nfr9.js} +2 -2
- package/dist/{index-3rjnbp97.js → index-0nt6wnb9.js} +2 -2
- package/dist/{index-npmvh1x9.js → index-7ph3496b.js} +2 -2
- package/dist/{index-4nsdre0j.js → index-9grqzmk5.js} +40 -12
- package/dist/index-9grqzmk5.js.map +13 -0
- package/dist/{index-fm6gqenc.js → index-a3q5ewrj.js} +2 -2
- package/dist/{index-10wkaqpa.js → index-cndcb55v.js} +178 -13
- package/dist/index-cndcb55v.js.map +13 -0
- package/dist/{index-6vry08rz.js → index-dhbg241c.js} +2 -2
- package/dist/{index-hefqxwht.js → index-e2dzjkmm.js} +2 -2
- package/dist/{index-t0nsa57v.js → index-et6rnq2y.js} +2 -2
- package/dist/{index-ftbphe7j.js → index-exh7dh2v.js} +141 -14
- package/dist/{index-ftbphe7j.js.map → index-exh7dh2v.js.map} +3 -3
- package/dist/{index-30p492yv.js → index-swqzafr9.js} +2 -2
- package/dist/{index-xmeskdnb.js → index-t0x810hm.js} +133 -74
- package/dist/index-t0x810hm.js.map +12 -0
- package/dist/{index-c7zy3n33.js → index-vzmmv3r7.js} +2 -2
- package/dist/{index-a9g7hbj9.js → index-w7m3p4qa.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/{package-a5yw4d19.js → package-cck2kzyn.js} +3 -3
- package/dist/{package-a5yw4d19.js.map → package-cck2kzyn.js.map} +1 -1
- package/dist/{plugin-system-7hmbwvtf.js → plugin-system-75q3s1rf.js} +135 -16
- package/dist/plugin-system-75q3s1rf.js.map +10 -0
- package/package.json +1 -1
- package/dist/index-10wkaqpa.js.map +0 -13
- package/dist/index-4nsdre0j.js.map +0 -13
- package/dist/index-xmeskdnb.js.map +0 -11
- package/dist/plugin-system-7hmbwvtf.js.map +0 -10
- /package/dist/{app-hc590rye.js.map → app-tba5zhmy.js.map} +0 -0
- /package/dist/{index-wmvkjcjj.js.map → index-0429nfr9.js.map} +0 -0
- /package/dist/{index-3rjnbp97.js.map → index-0nt6wnb9.js.map} +0 -0
- /package/dist/{index-npmvh1x9.js.map → index-7ph3496b.js.map} +0 -0
- /package/dist/{index-fm6gqenc.js.map → index-a3q5ewrj.js.map} +0 -0
- /package/dist/{index-6vry08rz.js.map → index-dhbg241c.js.map} +0 -0
- /package/dist/{index-hefqxwht.js.map → index-e2dzjkmm.js.map} +0 -0
- /package/dist/{index-t0nsa57v.js.map → index-et6rnq2y.js.map} +0 -0
- /package/dist/{index-30p492yv.js.map → index-swqzafr9.js.map} +0 -0
- /package/dist/{index-c7zy3n33.js.map → index-vzmmv3r7.js.map} +0 -0
- /package/dist/{index-a9g7hbj9.js.map → index-w7m3p4qa.js.map} +0 -0
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./index-g8dczzvv.js";
|
|
18
18
|
import {
|
|
19
19
|
PluginManager
|
|
20
|
-
} from "./plugin-system-
|
|
20
|
+
} from "./plugin-system-75q3s1rf.js";
|
|
21
21
|
|
|
22
22
|
// node_modules/@elysiajs/cors/dist/index.mjs
|
|
23
23
|
var isBun = typeof new Headers()?.toJSON === "function";
|
|
@@ -1210,4 +1210,4 @@ async function getPackageVersion() {
|
|
|
1210
1210
|
export { createApp };
|
|
1211
1211
|
|
|
1212
1212
|
//# debugId=8FFB9BBA2F91A40A64756E2164756E21
|
|
1213
|
-
//# sourceMappingURL=app-
|
|
1213
|
+
//# sourceMappingURL=app-tba5zhmy.js.map
|
package/dist/cli.js
CHANGED
|
@@ -12,20 +12,23 @@ import {
|
|
|
12
12
|
logger
|
|
13
13
|
} from "./index-88ym10cs.js";
|
|
14
14
|
import {
|
|
15
|
+
apiGet,
|
|
15
16
|
blank,
|
|
16
17
|
colors,
|
|
17
18
|
fail,
|
|
18
19
|
formatStatus,
|
|
19
20
|
formatTable,
|
|
21
|
+
getAgentUrl,
|
|
20
22
|
header,
|
|
21
23
|
icons,
|
|
22
24
|
info,
|
|
23
25
|
kv,
|
|
24
26
|
printAgentDetails,
|
|
27
|
+
promptConfirm,
|
|
25
28
|
success,
|
|
26
29
|
timeAgo,
|
|
27
30
|
warn
|
|
28
|
-
} from "./index-
|
|
31
|
+
} from "./index-t0x810hm.js";
|
|
29
32
|
import {
|
|
30
33
|
__commonJS,
|
|
31
34
|
__require,
|
|
@@ -33,7 +36,7 @@ import {
|
|
|
33
36
|
} from "./index-g8dczzvv.js";
|
|
34
37
|
import {
|
|
35
38
|
PluginManager
|
|
36
|
-
} from "./plugin-system-
|
|
39
|
+
} from "./plugin-system-75q3s1rf.js";
|
|
37
40
|
|
|
38
41
|
// node_modules/commander/lib/error.js
|
|
39
42
|
var require_error = __commonJS((exports) => {
|
|
@@ -2145,7 +2148,7 @@ var {
|
|
|
2145
2148
|
} = import__.default;
|
|
2146
2149
|
|
|
2147
2150
|
// src/cli.ts
|
|
2148
|
-
import { join as
|
|
2151
|
+
import { join as join7 } from "path";
|
|
2149
2152
|
|
|
2150
2153
|
// src/cli/commands/start.cmd.ts
|
|
2151
2154
|
import { existsSync } from "fs";
|
|
@@ -2183,7 +2186,7 @@ async function findFreePortFrom(startPort, host = "0.0.0.0") {
|
|
|
2183
2186
|
|
|
2184
2187
|
// src/cli/commands/start.cmd.ts
|
|
2185
2188
|
function register(program2) {
|
|
2186
|
-
program2.command("start").description("Start a VibeControls agent instance").option("-p, --port <port>", "Port to listen on", "3005").option("-n, --name <name>", "Agent instance name", "default").option("-f, --foreground", "Run in foreground mode (default: daemon)", false).option("--db-path <path>", "Path to the SQLite database", "./vibecontrols-agent.db").option("--host <host>", "Host to bind to", "0.0.0.0").action(async (opts) => {
|
|
2189
|
+
program2.command("start").description("Start a VibeControls agent instance").option("-p, --port <port>", "Port to listen on", "3005").option("-n, --name <name>", "Agent instance name", "default").option("-f, --foreground", "Run in foreground mode (default: daemon)", false).option("--db-path <path>", "Path to the SQLite database", "./vibecontrols-agent.db").option("--host <host>", "Host to bind to", "0.0.0.0").option("--skip-plugin-install", "Skip automatic installation of default plugins", false).action(async (opts) => {
|
|
2187
2190
|
try {
|
|
2188
2191
|
const serviceManager = new ServiceManager;
|
|
2189
2192
|
const dbPath = opts.dbPath;
|
|
@@ -2210,6 +2213,26 @@ function register(program2) {
|
|
|
2210
2213
|
}
|
|
2211
2214
|
blank();
|
|
2212
2215
|
}
|
|
2216
|
+
if (!opts.skipPluginInstall) {
|
|
2217
|
+
const pluginManager = new PluginManager;
|
|
2218
|
+
await pluginManager.loadCorePlugins();
|
|
2219
|
+
await pluginManager.loadAll();
|
|
2220
|
+
const installed = await pluginManager.ensureDefaultPlugins((message) => {
|
|
2221
|
+
if (message.startsWith("No ")) {
|
|
2222
|
+
warn(message);
|
|
2223
|
+
} else if (message.startsWith("Installed ")) {
|
|
2224
|
+
success(message);
|
|
2225
|
+
} else if (message.startsWith("Failed ")) {
|
|
2226
|
+
warn(message);
|
|
2227
|
+
} else {
|
|
2228
|
+
info(message);
|
|
2229
|
+
}
|
|
2230
|
+
});
|
|
2231
|
+
if (installed.length > 0) {
|
|
2232
|
+
success(`Auto-installed ${installed.length} default plugin${installed.length > 1 ? "s" : ""}.`);
|
|
2233
|
+
blank();
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2213
2236
|
let port = parseInt(opts.port, 10);
|
|
2214
2237
|
if (isNaN(port) || port < 1 || port > 65535) {
|
|
2215
2238
|
fail("Invalid port number. Must be between 1 and 65535.");
|
|
@@ -2228,7 +2251,7 @@ function register(program2) {
|
|
|
2228
2251
|
kv("Host", host);
|
|
2229
2252
|
kv("Database", dbPath);
|
|
2230
2253
|
blank();
|
|
2231
|
-
const { createApp } = await import("./app-
|
|
2254
|
+
const { createApp } = await import("./app-tba5zhmy.js");
|
|
2232
2255
|
const appInstance = await createApp({
|
|
2233
2256
|
port,
|
|
2234
2257
|
host,
|
|
@@ -2502,7 +2525,7 @@ function register8(program2) {
|
|
|
2502
2525
|
blank();
|
|
2503
2526
|
let currentVersion;
|
|
2504
2527
|
try {
|
|
2505
|
-
const pkg = await import("./package-
|
|
2528
|
+
const pkg = await import("./package-cck2kzyn.js", {
|
|
2506
2529
|
with: { type: "json" }
|
|
2507
2530
|
});
|
|
2508
2531
|
currentVersion = pkg.default.version || pkg.version;
|
|
@@ -3152,6 +3175,366 @@ function register10(program2) {
|
|
|
3152
3175
|
});
|
|
3153
3176
|
}
|
|
3154
3177
|
|
|
3178
|
+
// src/cli/commands/reset.cmd.ts
|
|
3179
|
+
import { existsSync as existsSync4, readdirSync, unlinkSync as unlinkSync3 } from "fs";
|
|
3180
|
+
import { join as join4 } from "path";
|
|
3181
|
+
import { homedir as homedir4 } from "os";
|
|
3182
|
+
var VIBECONTROLS_DIR = join4(homedir4(), ".vibecontrols");
|
|
3183
|
+
function resolveTargets(opts) {
|
|
3184
|
+
if (opts.hard) {
|
|
3185
|
+
return { db: true, plugins: true, config: true, logs: true };
|
|
3186
|
+
}
|
|
3187
|
+
const hasSpecific = opts.db || opts.plugins || opts.config || opts.logs;
|
|
3188
|
+
if (!hasSpecific) {
|
|
3189
|
+
return { db: true, plugins: true, config: true, logs: true };
|
|
3190
|
+
}
|
|
3191
|
+
return {
|
|
3192
|
+
db: !!opts.db,
|
|
3193
|
+
plugins: !!opts.plugins,
|
|
3194
|
+
config: !!opts.config,
|
|
3195
|
+
logs: !!opts.logs
|
|
3196
|
+
};
|
|
3197
|
+
}
|
|
3198
|
+
async function confirmReset(targets) {
|
|
3199
|
+
const parts = [];
|
|
3200
|
+
if (targets.db)
|
|
3201
|
+
parts.push("database(s)");
|
|
3202
|
+
if (targets.plugins)
|
|
3203
|
+
parts.push("plugin registry");
|
|
3204
|
+
if (targets.config)
|
|
3205
|
+
parts.push("config file");
|
|
3206
|
+
if (targets.logs)
|
|
3207
|
+
parts.push("log files");
|
|
3208
|
+
const msg = `This will permanently delete: ${parts.join(", ")}`;
|
|
3209
|
+
console.log(`
|
|
3210
|
+
${colors.yellow(icons.warning + " " + msg)}`);
|
|
3211
|
+
console.log(` ${colors.dim("Data directory:")} ${colors.bold(VIBECONTROLS_DIR)}`);
|
|
3212
|
+
blank();
|
|
3213
|
+
return promptConfirm(colors.bold("Are you sure?"));
|
|
3214
|
+
}
|
|
3215
|
+
function register11(program2) {
|
|
3216
|
+
program2.command("reset").description("Reset local agent state, config, databases, and plugin registry").option("--db", "Reset database only").option("--plugins", "Reset plugin registry only").option("--config", "Reset config file only").option("--logs", "Reset log files only").option("--hard", "Reset everything (default if no flags specified)").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
|
|
3217
|
+
try {
|
|
3218
|
+
const targets = resolveTargets(opts);
|
|
3219
|
+
header("Agent Reset");
|
|
3220
|
+
if (targets.db)
|
|
3221
|
+
info(`${icons.bullet} Agent database(s)`);
|
|
3222
|
+
if (targets.plugins)
|
|
3223
|
+
info(`${icons.bullet} Plugin registry`);
|
|
3224
|
+
if (targets.config)
|
|
3225
|
+
info(`${icons.bullet} Config file`);
|
|
3226
|
+
if (targets.logs)
|
|
3227
|
+
info(`${icons.bullet} Log files`);
|
|
3228
|
+
blank();
|
|
3229
|
+
if (!opts.yes) {
|
|
3230
|
+
const confirmed = await confirmReset(targets);
|
|
3231
|
+
if (!confirmed) {
|
|
3232
|
+
info("Reset cancelled.");
|
|
3233
|
+
return;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
blank();
|
|
3237
|
+
const serviceManager = new ServiceManager;
|
|
3238
|
+
const instances = await serviceManager.listInstances();
|
|
3239
|
+
const running = instances.filter((i) => i.status === "running");
|
|
3240
|
+
if (running.length > 0) {
|
|
3241
|
+
info(`Stopping ${running.length} running agent(s)...`);
|
|
3242
|
+
for (const instance of running) {
|
|
3243
|
+
try {
|
|
3244
|
+
await serviceManager.stop(instance.name);
|
|
3245
|
+
success(`Stopped ${colors.bold(instance.name)}`);
|
|
3246
|
+
} catch {
|
|
3247
|
+
warn(`Could not stop ${colors.bold(instance.name)} \u2014 may need manual kill`);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
blank();
|
|
3251
|
+
}
|
|
3252
|
+
if (targets.db) {
|
|
3253
|
+
const agentDbPaths = new Set;
|
|
3254
|
+
agentDbPaths.add(join4(VIBECONTROLS_DIR, "agent.db"));
|
|
3255
|
+
for (const inst of instances) {
|
|
3256
|
+
if (inst.config?.dbPath) {
|
|
3257
|
+
agentDbPaths.add(inst.config.dbPath);
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
let dbRemoved = 0;
|
|
3261
|
+
for (const dbPath of agentDbPaths) {
|
|
3262
|
+
for (const suffix of ["", "-wal", "-shm"]) {
|
|
3263
|
+
const filePath = dbPath + suffix;
|
|
3264
|
+
if (existsSync4(filePath)) {
|
|
3265
|
+
try {
|
|
3266
|
+
unlinkSync3(filePath);
|
|
3267
|
+
dbRemoved++;
|
|
3268
|
+
} catch {
|
|
3269
|
+
warn(`Could not remove ${filePath}`);
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
if (dbRemoved > 0) {
|
|
3275
|
+
success(`Removed ${dbRemoved} database file(s)`);
|
|
3276
|
+
} else {
|
|
3277
|
+
info("No database files found");
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
if (targets.plugins) {
|
|
3281
|
+
const registryFile = join4(VIBECONTROLS_DIR, "plugins.json");
|
|
3282
|
+
if (existsSync4(registryFile)) {
|
|
3283
|
+
unlinkSync3(registryFile);
|
|
3284
|
+
success("Removed plugin registry");
|
|
3285
|
+
} else {
|
|
3286
|
+
info("No plugin registry found");
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
if (targets.config) {
|
|
3290
|
+
const configFile = join4(VIBECONTROLS_DIR, "config.json");
|
|
3291
|
+
if (existsSync4(configFile)) {
|
|
3292
|
+
unlinkSync3(configFile);
|
|
3293
|
+
success("Removed config file");
|
|
3294
|
+
} else {
|
|
3295
|
+
info("No config file found");
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
if (targets.logs) {
|
|
3299
|
+
const logsDir = join4(VIBECONTROLS_DIR, "logs");
|
|
3300
|
+
if (existsSync4(logsDir)) {
|
|
3301
|
+
try {
|
|
3302
|
+
const logFiles = readdirSync(logsDir);
|
|
3303
|
+
let removed = 0;
|
|
3304
|
+
for (const file of logFiles) {
|
|
3305
|
+
try {
|
|
3306
|
+
unlinkSync3(join4(logsDir, file));
|
|
3307
|
+
removed++;
|
|
3308
|
+
} catch {}
|
|
3309
|
+
}
|
|
3310
|
+
success(`Removed ${removed} log file(s)`);
|
|
3311
|
+
} catch {
|
|
3312
|
+
warn("Could not clean logs directory");
|
|
3313
|
+
}
|
|
3314
|
+
} else {
|
|
3315
|
+
info("No logs directory found");
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
if (targets.db || targets.config && targets.plugins && targets.logs) {
|
|
3319
|
+
const agentsFile = join4(VIBECONTROLS_DIR, "agents.json");
|
|
3320
|
+
if (existsSync4(agentsFile)) {
|
|
3321
|
+
unlinkSync3(agentsFile);
|
|
3322
|
+
success("Cleared agents registry");
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
blank();
|
|
3326
|
+
success(`${colors.bold("Reset complete.")} Run ${colors.bold("vibe start")} to begin fresh.`);
|
|
3327
|
+
blank();
|
|
3328
|
+
} catch (err) {
|
|
3329
|
+
fail(`Reset failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3330
|
+
}
|
|
3331
|
+
});
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
// src/cli/commands/export.cmd.ts
|
|
3335
|
+
import { existsSync as existsSync5, readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
3336
|
+
import { join as join5 } from "path";
|
|
3337
|
+
import { homedir as homedir5 } from "os";
|
|
3338
|
+
var VIBECONTROLS_DIR2 = join5(homedir5(), ".vibecontrols");
|
|
3339
|
+
function register12(program2) {
|
|
3340
|
+
program2.command("export").description("Export plugin config and user preferences to a JSON file").option("--plugins", "Export plugin registry only").option("--config", "Export config file only").option("--state", "Export plugin state from agent database").option("--all", "Export everything (default)").option("-o, --output <path>", "Output file path").option("--agent-url <url>", "Agent URL", "http://localhost:3005").option("--agent <name>", "Target agent instance by name").option("--profile <name>", "Alias for --agent").action(async (opts) => {
|
|
3341
|
+
try {
|
|
3342
|
+
header("Export Agent Configuration");
|
|
3343
|
+
const exportAll = opts.all || !opts.plugins && !opts.config && !opts.state;
|
|
3344
|
+
const data = {
|
|
3345
|
+
version: "1.0",
|
|
3346
|
+
exportedAt: new Date().toISOString()
|
|
3347
|
+
};
|
|
3348
|
+
let sections = 0;
|
|
3349
|
+
if (exportAll || opts.plugins) {
|
|
3350
|
+
const registryFile = join5(VIBECONTROLS_DIR2, "plugins.json");
|
|
3351
|
+
if (existsSync5(registryFile)) {
|
|
3352
|
+
try {
|
|
3353
|
+
data.plugins = JSON.parse(readFileSync2(registryFile, "utf-8"));
|
|
3354
|
+
sections++;
|
|
3355
|
+
info(`Exported ${Array.isArray(data.plugins) ? data.plugins.length : 0} plugin(s)`);
|
|
3356
|
+
} catch {
|
|
3357
|
+
warn("Could not read plugin registry");
|
|
3358
|
+
}
|
|
3359
|
+
} else {
|
|
3360
|
+
data.plugins = [];
|
|
3361
|
+
info("No plugin registry found (empty)");
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
if (exportAll || opts.config) {
|
|
3365
|
+
const configFile = join5(VIBECONTROLS_DIR2, "config.json");
|
|
3366
|
+
if (existsSync5(configFile)) {
|
|
3367
|
+
try {
|
|
3368
|
+
data.config = JSON.parse(readFileSync2(configFile, "utf-8"));
|
|
3369
|
+
sections++;
|
|
3370
|
+
info(`Exported ${Object.keys(data.config || {}).length} config key(s)`);
|
|
3371
|
+
} catch {
|
|
3372
|
+
warn("Could not read config file");
|
|
3373
|
+
}
|
|
3374
|
+
} else {
|
|
3375
|
+
data.config = {};
|
|
3376
|
+
info("No config file found (empty)");
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
if (exportAll || opts.state) {
|
|
3380
|
+
try {
|
|
3381
|
+
const url = getAgentUrl(opts);
|
|
3382
|
+
try {
|
|
3383
|
+
const agentConfig = await apiGet(url, "/api/config");
|
|
3384
|
+
data.agentConfig = agentConfig;
|
|
3385
|
+
sections++;
|
|
3386
|
+
info("Exported agent database config");
|
|
3387
|
+
} catch {
|
|
3388
|
+
warn("Could not export agent config (agent may not be running)");
|
|
3389
|
+
}
|
|
3390
|
+
try {
|
|
3391
|
+
const pluginState = await apiGet(url, "/api/state");
|
|
3392
|
+
data.pluginState = pluginState;
|
|
3393
|
+
sections++;
|
|
3394
|
+
info("Exported plugin state");
|
|
3395
|
+
} catch {
|
|
3396
|
+
warn("Could not export plugin state (agent may not be running)");
|
|
3397
|
+
}
|
|
3398
|
+
} catch {
|
|
3399
|
+
warn("Agent not reachable \u2014 skipping database exports");
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
if (sections === 0 && !data.plugins && !data.config) {
|
|
3403
|
+
fail("Nothing to export.");
|
|
3404
|
+
}
|
|
3405
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").replace("T", "_").slice(0, 19);
|
|
3406
|
+
const outputPath = opts.output || `vibe-export-${timestamp}.json`;
|
|
3407
|
+
writeFileSync3(outputPath, JSON.stringify(data, null, 2), "utf-8");
|
|
3408
|
+
blank();
|
|
3409
|
+
success(`Exported to ${colors.bold(outputPath)}`);
|
|
3410
|
+
kv("Sections", String(sections));
|
|
3411
|
+
kv("File", outputPath);
|
|
3412
|
+
blank();
|
|
3413
|
+
} catch (err) {
|
|
3414
|
+
fail(`Export failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3415
|
+
}
|
|
3416
|
+
});
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
// src/cli/commands/import.cmd.ts
|
|
3420
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
3421
|
+
import { join as join6 } from "path";
|
|
3422
|
+
import { homedir as homedir6 } from "os";
|
|
3423
|
+
var VIBECONTROLS_DIR3 = join6(homedir6(), ".vibecontrols");
|
|
3424
|
+
function register13(program2) {
|
|
3425
|
+
program2.command("import").description("Import plugin config and user preferences from a JSON file").argument("<file>", "Path to the export JSON file").option("--install", "Install plugins listed in the export", false).option("--plugins", "Import plugin registry only").option("--config", "Import config file only").option("--merge", "Merge with existing config instead of overwriting", false).option("-y, --yes", "Skip confirmation prompt").action(async (file, opts) => {
|
|
3426
|
+
try {
|
|
3427
|
+
header("Import Agent Configuration");
|
|
3428
|
+
if (!existsSync6(file)) {
|
|
3429
|
+
fail(`File not found: ${file}`);
|
|
3430
|
+
}
|
|
3431
|
+
let data;
|
|
3432
|
+
try {
|
|
3433
|
+
data = JSON.parse(readFileSync3(file, "utf-8"));
|
|
3434
|
+
} catch {
|
|
3435
|
+
fail("Invalid JSON file. Expected a file created by 'vibe export'.");
|
|
3436
|
+
return;
|
|
3437
|
+
}
|
|
3438
|
+
if (!data.version) {
|
|
3439
|
+
fail("Invalid export file: missing version field. Expected a file created by 'vibe export'.");
|
|
3440
|
+
}
|
|
3441
|
+
info(`Export file version: ${data.version}`);
|
|
3442
|
+
info(`Exported at: ${data.exportedAt || "unknown"}`);
|
|
3443
|
+
blank();
|
|
3444
|
+
const importAll = !opts.plugins && !opts.config;
|
|
3445
|
+
mkdirSync3(VIBECONTROLS_DIR3, { recursive: true });
|
|
3446
|
+
if (!opts.yes) {
|
|
3447
|
+
const parts = [];
|
|
3448
|
+
if ((importAll || opts.plugins) && data.plugins?.length) {
|
|
3449
|
+
parts.push(`${data.plugins.length} plugin(s)`);
|
|
3450
|
+
}
|
|
3451
|
+
if ((importAll || opts.config) && data.config) {
|
|
3452
|
+
parts.push(`${Object.keys(data.config).length} config key(s)`);
|
|
3453
|
+
}
|
|
3454
|
+
if (parts.length === 0) {
|
|
3455
|
+
info("Nothing to import from this file.");
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
console.log(` ${icons.warning} Will import: ${parts.join(", ")}`);
|
|
3459
|
+
if (!opts.merge) {
|
|
3460
|
+
console.log(` ${colors.dim("Mode: overwrite (use --merge to merge instead)")}`);
|
|
3461
|
+
}
|
|
3462
|
+
blank();
|
|
3463
|
+
const confirmed = await promptConfirm(colors.bold("Continue?"));
|
|
3464
|
+
if (!confirmed) {
|
|
3465
|
+
info("Import cancelled.");
|
|
3466
|
+
return;
|
|
3467
|
+
}
|
|
3468
|
+
blank();
|
|
3469
|
+
}
|
|
3470
|
+
if ((importAll || opts.plugins) && data.plugins) {
|
|
3471
|
+
const registryFile = join6(VIBECONTROLS_DIR3, "plugins.json");
|
|
3472
|
+
if (opts.merge && existsSync6(registryFile)) {
|
|
3473
|
+
try {
|
|
3474
|
+
const existing = JSON.parse(readFileSync3(registryFile, "utf-8"));
|
|
3475
|
+
const existingMap = new Map(existing.map((e) => [e.packageName, e]));
|
|
3476
|
+
for (const plugin of data.plugins) {
|
|
3477
|
+
existingMap.set(plugin.packageName, plugin);
|
|
3478
|
+
}
|
|
3479
|
+
writeFileSync4(registryFile, JSON.stringify(Array.from(existingMap.values()), null, 2), "utf-8");
|
|
3480
|
+
success(`Merged ${data.plugins.length} plugin(s) into registry`);
|
|
3481
|
+
} catch {
|
|
3482
|
+
writeFileSync4(registryFile, JSON.stringify(data.plugins, null, 2), "utf-8");
|
|
3483
|
+
success(`Wrote ${data.plugins.length} plugin(s) to registry`);
|
|
3484
|
+
}
|
|
3485
|
+
} else {
|
|
3486
|
+
writeFileSync4(registryFile, JSON.stringify(data.plugins, null, 2), "utf-8");
|
|
3487
|
+
success(`Wrote ${data.plugins.length} plugin(s) to registry`);
|
|
3488
|
+
}
|
|
3489
|
+
if (opts.install && data.plugins.length > 0) {
|
|
3490
|
+
blank();
|
|
3491
|
+
info("Installing plugins...");
|
|
3492
|
+
const pm = new PluginManager;
|
|
3493
|
+
let installed = 0;
|
|
3494
|
+
let failed = 0;
|
|
3495
|
+
for (const plugin of data.plugins) {
|
|
3496
|
+
try {
|
|
3497
|
+
info(`Installing ${colors.bold(plugin.packageName)}...`);
|
|
3498
|
+
await pm.install(plugin.packageName);
|
|
3499
|
+
success(`Installed ${colors.bold(plugin.packageName)}`);
|
|
3500
|
+
installed++;
|
|
3501
|
+
} catch (err) {
|
|
3502
|
+
warn(`Failed to install ${plugin.packageName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
3503
|
+
failed++;
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
blank();
|
|
3507
|
+
kv("Installed", String(installed));
|
|
3508
|
+
if (failed > 0)
|
|
3509
|
+
kv("Failed", String(failed));
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
if ((importAll || opts.config) && data.config) {
|
|
3513
|
+
const configFile = join6(VIBECONTROLS_DIR3, "config.json");
|
|
3514
|
+
if (opts.merge && existsSync6(configFile)) {
|
|
3515
|
+
try {
|
|
3516
|
+
const existing = JSON.parse(readFileSync3(configFile, "utf-8"));
|
|
3517
|
+
const merged = { ...existing, ...data.config };
|
|
3518
|
+
writeFileSync4(configFile, JSON.stringify(merged, null, 2), "utf-8");
|
|
3519
|
+
success(`Merged ${Object.keys(data.config).length} config key(s)`);
|
|
3520
|
+
} catch {
|
|
3521
|
+
writeFileSync4(configFile, JSON.stringify(data.config, null, 2), "utf-8");
|
|
3522
|
+
success(`Wrote ${Object.keys(data.config).length} config key(s)`);
|
|
3523
|
+
}
|
|
3524
|
+
} else {
|
|
3525
|
+
writeFileSync4(configFile, JSON.stringify(data.config, null, 2), "utf-8");
|
|
3526
|
+
success(`Wrote ${Object.keys(data.config).length} config key(s)`);
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
blank();
|
|
3530
|
+
success(`${colors.bold("Import complete.")} Run ${colors.bold("vibe start")} to apply changes.`);
|
|
3531
|
+
blank();
|
|
3532
|
+
} catch (err) {
|
|
3533
|
+
fail(`Import failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3155
3538
|
// src/cli.ts
|
|
3156
3539
|
if (typeof Bun === "undefined") {
|
|
3157
3540
|
console.error(`\x1B[31mError:\x1B[0m VibeControls Agent requires the Bun runtime.
|
|
@@ -3161,12 +3544,12 @@ if (typeof Bun === "undefined") {
|
|
|
3161
3544
|
}
|
|
3162
3545
|
var packageVersion = "1.0.0";
|
|
3163
3546
|
try {
|
|
3164
|
-
const packageJsonPath =
|
|
3547
|
+
const packageJsonPath = join7(import.meta.dir, "..", "package.json");
|
|
3165
3548
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
3166
3549
|
packageVersion = packageJson.version;
|
|
3167
3550
|
} catch {}
|
|
3168
3551
|
var program2 = new Command;
|
|
3169
|
-
program2.name("vibe").description("VibeControls Agent CLI \u2014 Remote development environment management").version(packageVersion, "-v, --version").option("--provider <name>", "Override the default provider for tunnel/session operations");
|
|
3552
|
+
program2.name("vibe").description("VibeControls Agent CLI \u2014 Remote development environment management").version(packageVersion, "-v, --version").option("--provider <name>", "Override the default provider for tunnel/session operations").option("--agent <name>", "Target a specific agent instance by name (resolves port from agents.json)").option("--profile <name>", "Alias for --agent \u2014 target a specific agent instance by name");
|
|
3170
3553
|
register(program2);
|
|
3171
3554
|
register2(program2);
|
|
3172
3555
|
register3(program2);
|
|
@@ -3177,6 +3560,9 @@ register7(program2);
|
|
|
3177
3560
|
register8(program2);
|
|
3178
3561
|
register9(program2);
|
|
3179
3562
|
register10(program2);
|
|
3563
|
+
register11(program2);
|
|
3564
|
+
register12(program2);
|
|
3565
|
+
register13(program2);
|
|
3180
3566
|
async function main() {
|
|
3181
3567
|
const pluginManager = new PluginManager;
|
|
3182
3568
|
try {
|
|
@@ -3219,5 +3605,5 @@ main().catch((err) => {
|
|
|
3219
3605
|
process.exit(1);
|
|
3220
3606
|
});
|
|
3221
3607
|
|
|
3222
|
-
//# debugId=
|
|
3608
|
+
//# debugId=FF5222CD5355224064756E2164756E21
|
|
3223
3609
|
//# sourceMappingURL=cli.js.map
|