@buildautomaton/cli 0.1.70 → 0.1.71
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/cli.js +83 -35
- package/dist/cli.js.map +4 -4
- package/dist/index.js +83 -35
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22367,14 +22367,14 @@ var init_access = __esm({
|
|
|
22367
22367
|
|
|
22368
22368
|
// src/sqlite/read-migration-sql.ts
|
|
22369
22369
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
22370
|
-
import { dirname as dirname2, join } from "node:path";
|
|
22370
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
22371
22371
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
22372
22372
|
function readMigrationSql(filename, ...searchSubdirs) {
|
|
22373
22373
|
const moduleDir = dirname2(fileURLToPath2(import.meta.url));
|
|
22374
22374
|
const candidates = searchSubdirs.flatMap((sub) => [
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22375
|
+
join2(moduleDir, sub, filename),
|
|
22376
|
+
join2(moduleDir, "..", sub, filename),
|
|
22377
|
+
join2(moduleDir, "..", "..", "dist", sub, filename)
|
|
22378
22378
|
]);
|
|
22379
22379
|
const resolved = candidates.find((path82) => existsSync(path82));
|
|
22380
22380
|
if (!resolved) {
|
|
@@ -25255,26 +25255,26 @@ var init_member_access = __esm({
|
|
|
25255
25255
|
|
|
25256
25256
|
// src/code-nav/tree-sitter-assets-dir.ts
|
|
25257
25257
|
import { existsSync as existsSync2 } from "node:fs";
|
|
25258
|
-
import { dirname as dirname3, join as
|
|
25258
|
+
import { dirname as dirname3, join as join3 } from "node:path";
|
|
25259
25259
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
25260
25260
|
function repoNodeModulesDir(fromDir) {
|
|
25261
|
-
return
|
|
25261
|
+
return join3(fromDir, "..", "..", "..", "node_modules");
|
|
25262
25262
|
}
|
|
25263
25263
|
function firstDirWithWebTreeSitterWasm(candidates) {
|
|
25264
25264
|
for (const dir of candidates) {
|
|
25265
|
-
if (existsSync2(
|
|
25265
|
+
if (existsSync2(join3(dir, "web-tree-sitter.wasm"))) return dir;
|
|
25266
25266
|
}
|
|
25267
25267
|
return null;
|
|
25268
25268
|
}
|
|
25269
25269
|
function getTreeSitterAssetsDir() {
|
|
25270
25270
|
const moduleDir = dirname3(fileURLToPath3(import.meta.url));
|
|
25271
25271
|
const fromModule = firstDirWithWebTreeSitterWasm([
|
|
25272
|
-
|
|
25273
|
-
|
|
25274
|
-
|
|
25272
|
+
join3(moduleDir, "tree-sitter"),
|
|
25273
|
+
join3(moduleDir, "..", "tree-sitter"),
|
|
25274
|
+
join3(moduleDir, "..", "..", "dist", "tree-sitter")
|
|
25275
25275
|
]);
|
|
25276
25276
|
if (fromModule) return fromModule;
|
|
25277
|
-
const fromNodeModules = firstDirWithWebTreeSitterWasm([
|
|
25277
|
+
const fromNodeModules = firstDirWithWebTreeSitterWasm([join3(repoNodeModulesDir(moduleDir), "web-tree-sitter")]);
|
|
25278
25278
|
if (fromNodeModules) return fromNodeModules;
|
|
25279
25279
|
throw new Error(
|
|
25280
25280
|
"Missing web-tree-sitter.wasm. Run `pnpm build` in packages/cli to copy tree-sitter assets into dist/tree-sitter."
|
|
@@ -25288,7 +25288,7 @@ var init_tree_sitter_assets_dir = __esm({
|
|
|
25288
25288
|
|
|
25289
25289
|
// src/code-nav/parser/tree-sitter-runtime.ts
|
|
25290
25290
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
25291
|
-
import { dirname as dirname4, join as
|
|
25291
|
+
import { dirname as dirname4, join as join4 } from "node:path";
|
|
25292
25292
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
25293
25293
|
import { Parser, Language, Query, LANGUAGE_VERSION, MIN_COMPATIBLE_VERSION } from "web-tree-sitter";
|
|
25294
25294
|
function withTreeSitterRuntimeLock(fn) {
|
|
@@ -25303,7 +25303,7 @@ async function ensureParserInit() {
|
|
|
25303
25303
|
if (!initPromise2) {
|
|
25304
25304
|
const assetsDir = getTreeSitterAssetsDir();
|
|
25305
25305
|
initPromise2 = Parser.init({
|
|
25306
|
-
locateFile: (scriptName) =>
|
|
25306
|
+
locateFile: (scriptName) => join4(assetsDir, scriptName)
|
|
25307
25307
|
}).catch((e) => {
|
|
25308
25308
|
initPromise2 = null;
|
|
25309
25309
|
throw e;
|
|
@@ -25313,9 +25313,9 @@ async function ensureParserInit() {
|
|
|
25313
25313
|
}
|
|
25314
25314
|
function resolveWasmPath(assetsDir, wasmFile) {
|
|
25315
25315
|
const candidates = [
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
|
|
25316
|
+
join4(assetsDir, wasmFile),
|
|
25317
|
+
join4(assetsDir, "..", "..", "dist", "tree-sitter", wasmFile),
|
|
25318
|
+
join4(assetsDir, "..", "..", "..", "node_modules", wasmFile.replace(".wasm", ""), wasmFile)
|
|
25319
25319
|
];
|
|
25320
25320
|
const hit = candidates.find((p) => existsSync3(p));
|
|
25321
25321
|
if (!hit) throw new Error(`Missing tree-sitter wasm: ${wasmFile}`);
|
|
@@ -25324,10 +25324,10 @@ function resolveWasmPath(assetsDir, wasmFile) {
|
|
|
25324
25324
|
function resolveTagsPath(assetsDir, tagsQueryFile) {
|
|
25325
25325
|
const pkgName = tagsQueryFile.split("/")[0] ?? "";
|
|
25326
25326
|
const candidates = [
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25327
|
+
join4(CODE_NAV_QUERIES_ROOT, tagsQueryFile),
|
|
25328
|
+
join4(assetsDir, tagsQueryFile),
|
|
25329
|
+
join4(assetsDir, "..", "..", "dist", "tree-sitter", tagsQueryFile),
|
|
25330
|
+
join4(assetsDir, "..", "..", "..", "node_modules", pkgName, "queries", "tags.scm")
|
|
25331
25331
|
];
|
|
25332
25332
|
const hit = candidates.find((p) => existsSync3(p));
|
|
25333
25333
|
if (!hit) throw new Error(`Missing tags query: ${tagsQueryFile}`);
|
|
@@ -25365,7 +25365,7 @@ var init_tree_sitter_runtime = __esm({
|
|
|
25365
25365
|
loadedByKey = /* @__PURE__ */ new Map();
|
|
25366
25366
|
failedLanguageKeys = /* @__PURE__ */ new Set();
|
|
25367
25367
|
runtimeChain = Promise.resolve();
|
|
25368
|
-
CODE_NAV_QUERIES_ROOT =
|
|
25368
|
+
CODE_NAV_QUERIES_ROOT = join4(dirname4(fileURLToPath4(import.meta.url)), "..", "queries");
|
|
25369
25369
|
}
|
|
25370
25370
|
});
|
|
25371
25371
|
|
|
@@ -26936,7 +26936,7 @@ var init_in_process_bridge = __esm({
|
|
|
26936
26936
|
});
|
|
26937
26937
|
|
|
26938
26938
|
// src/code-nav/symbol-index/worker/lifecycle/state.ts
|
|
26939
|
-
import { dirname as dirname5, join as
|
|
26939
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
26940
26940
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
26941
26941
|
function getWorker() {
|
|
26942
26942
|
return worker;
|
|
@@ -26955,7 +26955,7 @@ function shouldUseInProcessWorker() {
|
|
|
26955
26955
|
}
|
|
26956
26956
|
function resolveWorkerScriptPath() {
|
|
26957
26957
|
const moduleDir = dirname5(fileURLToPath5(import.meta.url));
|
|
26958
|
-
return
|
|
26958
|
+
return join5(moduleDir, "..", "worker.js");
|
|
26959
26959
|
}
|
|
26960
26960
|
function resetLifecycleStateForTests() {
|
|
26961
26961
|
terminatePromise = null;
|
|
@@ -30586,7 +30586,7 @@ function installBridgeProcessResilience() {
|
|
|
30586
30586
|
}
|
|
30587
30587
|
|
|
30588
30588
|
// src/cli-version.ts
|
|
30589
|
-
var CLI_VERSION = "0.1.
|
|
30589
|
+
var CLI_VERSION = "0.1.71".length > 0 ? "0.1.71" : "0.0.0-dev";
|
|
30590
30590
|
|
|
30591
30591
|
// src/connection/heartbeat/constants.ts
|
|
30592
30592
|
var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
@@ -31708,6 +31708,46 @@ function runPendingAuth(options) {
|
|
|
31708
31708
|
// src/run-bridge-connected.ts
|
|
31709
31709
|
init_log();
|
|
31710
31710
|
|
|
31711
|
+
// src/agents/acp/clients/bridge-agent-path.ts
|
|
31712
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
31713
|
+
import { homedir } from "node:os";
|
|
31714
|
+
import { join } from "node:path";
|
|
31715
|
+
function getBridgeAgentPathEntries(home = process.env.HOME ?? homedir()) {
|
|
31716
|
+
const entries = [
|
|
31717
|
+
join(home, ".local", "bin"),
|
|
31718
|
+
join(home, ".npm-global", "bin"),
|
|
31719
|
+
"/usr/local/bin"
|
|
31720
|
+
];
|
|
31721
|
+
const prefix = process.env.NPM_CONFIG_PREFIX;
|
|
31722
|
+
if (prefix) entries.push(join(prefix, "bin"));
|
|
31723
|
+
try {
|
|
31724
|
+
const npmBin = execFileSync2("npm", ["bin", "-g"], { encoding: "utf8", timeout: 2e3 }).trim();
|
|
31725
|
+
if (npmBin) entries.push(npmBin);
|
|
31726
|
+
} catch {
|
|
31727
|
+
}
|
|
31728
|
+
return entries;
|
|
31729
|
+
}
|
|
31730
|
+
function augmentPath(pathValue, extra) {
|
|
31731
|
+
const current = pathValue ?? "";
|
|
31732
|
+
const parts = current.split(":").filter(Boolean);
|
|
31733
|
+
const seen = new Set(parts);
|
|
31734
|
+
const prefix = [];
|
|
31735
|
+
for (const entry of extra) {
|
|
31736
|
+
if (!entry || seen.has(entry)) continue;
|
|
31737
|
+
seen.add(entry);
|
|
31738
|
+
prefix.push(entry);
|
|
31739
|
+
}
|
|
31740
|
+
if (prefix.length === 0) return current;
|
|
31741
|
+
return current ? `${prefix.join(":")}:${current}` : prefix.join(":");
|
|
31742
|
+
}
|
|
31743
|
+
function ensureBridgeAgentPathInProcessEnv() {
|
|
31744
|
+
const extra = getBridgeAgentPathEntries();
|
|
31745
|
+
process.env.PATH = augmentPath(process.env.PATH, extra);
|
|
31746
|
+
}
|
|
31747
|
+
function bridgeAgentPathEnv(base = process.env) {
|
|
31748
|
+
return { ...base, PATH: augmentPath(base.PATH, getBridgeAgentPathEntries()) };
|
|
31749
|
+
}
|
|
31750
|
+
|
|
31711
31751
|
// src/files/watch-file-index.ts
|
|
31712
31752
|
import path25 from "node:path";
|
|
31713
31753
|
|
|
@@ -33012,7 +33052,10 @@ async function execFileShutdownAware(file2, args, timeoutMs) {
|
|
|
33012
33052
|
async function isCommandOnPath(command, timeoutMs = COMMAND_ON_PATH_PROBE_TIMEOUT_MS) {
|
|
33013
33053
|
if (isCliImmediateShutdownRequested()) return false;
|
|
33014
33054
|
try {
|
|
33015
|
-
await
|
|
33055
|
+
await execFileAsync5("which", [command], {
|
|
33056
|
+
timeout: timeoutMs,
|
|
33057
|
+
env: bridgeAgentPathEnv()
|
|
33058
|
+
});
|
|
33016
33059
|
return true;
|
|
33017
33060
|
} catch {
|
|
33018
33061
|
return false;
|
|
@@ -33704,15 +33747,15 @@ function resolveAgentCommand(preferredAgentType) {
|
|
|
33704
33747
|
}
|
|
33705
33748
|
|
|
33706
33749
|
// src/agents/acp/session-file-change-path-kind.ts
|
|
33707
|
-
import { execFileSync as
|
|
33750
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
33708
33751
|
import { existsSync as existsSync4, statSync } from "node:fs";
|
|
33709
33752
|
|
|
33710
33753
|
// src/git/get-git-repo-root-sync.ts
|
|
33711
|
-
import { execFileSync as
|
|
33754
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
33712
33755
|
import * as path27 from "node:path";
|
|
33713
33756
|
function getGitRepoRootSync(startDir) {
|
|
33714
33757
|
try {
|
|
33715
|
-
const out =
|
|
33758
|
+
const out = execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
33716
33759
|
cwd: path27.resolve(startDir),
|
|
33717
33760
|
encoding: "utf8",
|
|
33718
33761
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -33725,7 +33768,7 @@ function getGitRepoRootSync(startDir) {
|
|
|
33725
33768
|
}
|
|
33726
33769
|
|
|
33727
33770
|
// src/agents/acp/workspace-files.ts
|
|
33728
|
-
import { execFileSync as
|
|
33771
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
33729
33772
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
33730
33773
|
import * as path28 from "node:path";
|
|
33731
33774
|
function resolveWorkspaceFilePath(sessionParentPath, rawPath) {
|
|
@@ -33786,7 +33829,7 @@ function readGitHeadBlob(sessionParentPath, displayPath) {
|
|
|
33786
33829
|
const gitRoot = getGitRepoRootSync(sessionParentPath);
|
|
33787
33830
|
const execCwd = gitRoot ?? sessionParentPath;
|
|
33788
33831
|
try {
|
|
33789
|
-
return
|
|
33832
|
+
return execFileSync4("git", ["show", `HEAD:${displayPath}`], {
|
|
33790
33833
|
cwd: execCwd,
|
|
33791
33834
|
encoding: "utf8",
|
|
33792
33835
|
maxBuffer: 50 * 1024 * 1024
|
|
@@ -33802,7 +33845,7 @@ function gitHeadPathObjectType(sessionParentPath, displayPath) {
|
|
|
33802
33845
|
const gitRoot = getGitRepoRootSync(sessionParentPath);
|
|
33803
33846
|
if (!gitRoot) return null;
|
|
33804
33847
|
try {
|
|
33805
|
-
return
|
|
33848
|
+
return execFileSync5("git", ["cat-file", "-t", `HEAD:${displayPath}`], {
|
|
33806
33849
|
cwd: gitRoot,
|
|
33807
33850
|
encoding: "utf8"
|
|
33808
33851
|
}).trim();
|
|
@@ -34657,11 +34700,11 @@ init_cli_process_interrupt();
|
|
|
34657
34700
|
var BRIDGE_MCP_SERVER_NAME2 = "buildautomaton-bridge";
|
|
34658
34701
|
|
|
34659
34702
|
// src/mcp/resolve-bridge-mcp-server-path.ts
|
|
34660
|
-
import { dirname as dirname7, join as
|
|
34703
|
+
import { dirname as dirname7, join as join6 } from "node:path";
|
|
34661
34704
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
34662
34705
|
function resolveBridgeMcpServerScriptPath() {
|
|
34663
34706
|
const cliDir = dirname7(fileURLToPath7(import.meta.url));
|
|
34664
|
-
return
|
|
34707
|
+
return join6(cliDir, "bridge-mcp-server.js");
|
|
34665
34708
|
}
|
|
34666
34709
|
|
|
34667
34710
|
// src/mcp/build-acp-mcp-servers.ts
|
|
@@ -49683,7 +49726,7 @@ import { execFile as execFile9 } from "node:child_process";
|
|
|
49683
49726
|
import { promisify as promisify10 } from "node:util";
|
|
49684
49727
|
var execFileAsync8 = promisify10(execFile9);
|
|
49685
49728
|
async function runNpmGlobalInstall(packageName, env, timeoutMs = 3e5) {
|
|
49686
|
-
await execFileAsync8("npm", ["install", "-g", packageName], { timeout: timeoutMs, env });
|
|
49729
|
+
await execFileAsync8("npm", ["install", "-g", packageName], { timeout: timeoutMs, env: bridgeAgentPathEnv(env) });
|
|
49687
49730
|
}
|
|
49688
49731
|
|
|
49689
49732
|
// src/agents/install/commands/claude-code.ts
|
|
@@ -49723,7 +49766,7 @@ var cursorCliInstallCommand = {
|
|
|
49723
49766
|
ctx.onProgress?.("Installing Cursor CLI");
|
|
49724
49767
|
await execFileAsync9("bash", ["-lc", "curl -fsSL https://cursor.com/install | bash"], {
|
|
49725
49768
|
timeout: 3e5,
|
|
49726
|
-
env: { ...ctx.env, CURSOR_API_KEY: ctx.authToken }
|
|
49769
|
+
env: { ...bridgeAgentPathEnv(ctx.env), CURSOR_API_KEY: ctx.authToken }
|
|
49727
49770
|
});
|
|
49728
49771
|
}
|
|
49729
49772
|
};
|
|
@@ -49770,6 +49813,7 @@ async function installLocalAgentOnBridge(params) {
|
|
|
49770
49813
|
const msg = e instanceof Error ? e.message : String(e);
|
|
49771
49814
|
return { success: false, error: msg };
|
|
49772
49815
|
}
|
|
49816
|
+
ensureBridgeAgentPathInProcessEnv();
|
|
49773
49817
|
const found = await isCommandOnPath(command.detectCommand);
|
|
49774
49818
|
if (!found) {
|
|
49775
49819
|
return { success: false, error: `${command.detectCommand} not found on PATH after install` };
|
|
@@ -49816,6 +49860,9 @@ var handleInstallAgentMessage = (msg, deps) => {
|
|
|
49816
49860
|
error: result.error
|
|
49817
49861
|
});
|
|
49818
49862
|
}
|
|
49863
|
+
if (result.success) {
|
|
49864
|
+
await deps.reportAutoDetectedAgents?.();
|
|
49865
|
+
}
|
|
49819
49866
|
if (!result.success) {
|
|
49820
49867
|
deps.log(`[Bridge service] Install agent failed: ${result.error ?? "unknown"}`);
|
|
49821
49868
|
}
|
|
@@ -50501,6 +50548,7 @@ init_log();
|
|
|
50501
50548
|
async function createBridgeConnection(options) {
|
|
50502
50549
|
const { apiUrl, workspaceId, justAuthenticated, onAuthInvalid, persistTokens } = options;
|
|
50503
50550
|
const logFn = options.log ?? log;
|
|
50551
|
+
ensureBridgeAgentPathInProcessEnv();
|
|
50504
50552
|
await ensureBridgeConnectionDatabases(logFn);
|
|
50505
50553
|
const { state, getWs } = createMainBridgeReconnectState();
|
|
50506
50554
|
const runtime = await createBridgeConnectionRuntime(options, { state, getWs, logFn });
|