mirror of
https://github.com/garrytan/gstack.git
synced 2026-07-05 23:57:53 +02:00
fix(gbrain): probe CLI without command builtin
This commit is contained in:
@@ -21,6 +21,7 @@ import { describe, it, expect, beforeEach, afterEach } from "bun:test";
|
||||
import {
|
||||
mkdtempSync,
|
||||
writeFileSync,
|
||||
readFileSync,
|
||||
mkdirSync,
|
||||
rmSync,
|
||||
chmodSync,
|
||||
@@ -160,6 +161,16 @@ describe("lib/gbrain-local-status — five status cases", () => {
|
||||
restoreEnv = null;
|
||||
});
|
||||
|
||||
it("probes the gbrain executable directly instead of shelling through command -v", () => {
|
||||
const source = readFileSync(
|
||||
join(import.meta.dir, "..", "lib", "gbrain-local-status.ts"),
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
expect(source).not.toContain('command -v gbrain');
|
||||
expect(source).toContain('execFileSync("gbrain", ["--version"]');
|
||||
});
|
||||
|
||||
it("returns 'no-cli' when gbrain is not on PATH", () => {
|
||||
env = makeEnv({ withGbrain: false });
|
||||
restoreEnv = applyEnv(env);
|
||||
|
||||
@@ -55,6 +55,13 @@ describe("gstack-gbrain-sync CLI", () => {
|
||||
expect(r.stderr).toContain("Unknown argument: --bogus");
|
||||
});
|
||||
|
||||
it("uses the shared local gbrain status classifier instead of shelling through command -v", () => {
|
||||
const source = readFileSync(SCRIPT, "utf-8");
|
||||
|
||||
expect(source).not.toContain('command -v gbrain');
|
||||
expect(source).toContain("localEngineStatus");
|
||||
});
|
||||
|
||||
it("--dry-run with --code-only reports the code import preview only", () => {
|
||||
const home = makeTestHome();
|
||||
const gstackHome = join(home, ".gstack");
|
||||
|
||||
@@ -421,6 +421,13 @@ esac
|
||||
}
|
||||
|
||||
describe("gstack-memory-ingest writer (gbrain v0.20+ batch `import` interface)", () => {
|
||||
it("probes the gbrain executable directly instead of shelling through command -v", () => {
|
||||
const source = readFileSync(SCRIPT, "utf-8");
|
||||
|
||||
expect(source).not.toContain('command -v gbrain');
|
||||
expect(source).toContain('execFileSync("gbrain", ["--help"]');
|
||||
});
|
||||
|
||||
it("invokes `gbrain import <dir> --no-embed --json` exactly once with hierarchical staging", () => {
|
||||
const home = makeTestHome();
|
||||
const gstackHome = join(home, ".gstack");
|
||||
|
||||
Reference in New Issue
Block a user