Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(npm): delegate vibe help flags to runtime

cyh044cfff8202c
diff --git a/npm/avibe/bin/avibe.js b/npm/avibe/bin/avibe.js
index b33055de5..73e52b4bd 100755
--- a/npm/avibe/bin/avibe.js
+++ b/npm/avibe/bin/avibe.js
@@ -40,6 +40,11 @@ function printVersion() {
console.log(`avibe ${packageJson.version}`);
}
+function invokedAsVibe() {
+ const invokedName = path.basename(process.argv[1] || "").toLowerCase();
+ return invokedName === "vibe" || invokedName === "vibe.cmd" || invokedName === "vibe.bat" || invokedName === "vibe.exe";
+}
+
function prependPathEntries(env, entries) {
const delimiter = path.delimiter;
const currentPath = env.PATH || env.Path || "";
@@ -319,13 +324,14 @@ function normalizeArgs(args) {
function main() {
const args = process.argv.slice(2);
const command = args[0];
+ const shouldDelegateHelpAndVersion = invokedAsVibe();
- if (command === "--help" || command === "-h" || command === "help") {
+ if (!shouldDelegateHelpAndVersion && (command === "--help" || command === "-h" || command === "help")) {
printHelp();
return;
}
- if (command === "--version" || command === "-v") {
+ if (!shouldDelegateHelpAndVersion && (command === "--version" || command === "-v")) {
printVersion();
return;
}
diff --git a/npm/avibe/test/cli.test.js b/npm/avibe/test/cli.test.js
index a8c6d3d7e..03ca7446d 100644
--- a/npm/avibe/test/cli.test.js
+++ b/npm/avibe/test/cli.test.js
@@ -42,13 +42,13 @@ function writeSelfNpmVibeShim(bin) {
return shimPath;
}
-function runCli(args, envOverrides = {}) {
+function runCli(args, envOverrides = {}, binPath = cliPath) {
const env = {
...process.env,
...envOverrides,
};
- return childProcess.spawnSync(process.execPath, [cliPath, ...args], {
+ return childProcess.spawnSync(process.execPath, [binPath, ...args], {
encoding: "utf8",
env,
});
@@ -92,6 +92,39 @@ test("prints wrapper help without installing", () => {
assert.match(result.stdout, /npm install -g avibe/);
});
+test("delegates help and version when invoked through vibe", () => {
+ const temp = makeTempEnv();
+ const runtimeBin = path.join(temp.root, "runtime-bin");
+ const npmBin = path.join(temp.root, "npm-bin");
+ fs.mkdirSync(runtimeBin, { recursive: true });
+ fs.mkdirSync(npmBin, { recursive: true });
+ writeFakeVibe(runtimeBin, "runtime-vibe");
+ const npmVibeShim = writeSelfNpmVibeShim(npmBin);
+
+ const help = runCli(["--help"], {
+ HOME: temp.home,
+ USERPROFILE: temp.home,
+ PATH: `${npmBin}${path.delimiter}${runtimeBin}`,
+ }, npmVibeShim);
+ const version = runCli(["--version"], {
+ HOME: temp.home,
+ USERPROFILE: temp.home,
+ PATH: `${npmBin}${path.delimiter}${runtimeBin}`,
+ }, npmVibeShim);
+ const commandHelp = runCli(["help", "remote"], {
+ HOME: temp.home,
+ USERPROFILE: temp.home,
+ PATH: `${npmBin}${path.delimiter}${runtimeBin}`,
+ }, npmVibeShim);
+
+ assert.equal(help.status, 0);
+ assert.equal(version.status, 0);
+ assert.equal(commandHelp.status, 0);
+ assert.match(help.stdout, /runtime-vibe --help/);
+ assert.match(version.stdout, /runtime-vibe --version/);
+ assert.match(commandHelp.stdout, /runtime-vibe help remote/);
+});
+
test("delegates commands to an existing vibe binary", () => {
const temp = makeTempEnv();
writeFakeVibe(temp.bin, "existing-vibe");