sharkbait 1.0.15 → 1.0.17
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 +89 -22
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1249,6 +1249,7 @@ var fileTools = [
|
|
|
1249
1249
|
];
|
|
1250
1250
|
|
|
1251
1251
|
// src/tools/shell.ts
|
|
1252
|
+
import { resolve as resolve2 } from "path";
|
|
1252
1253
|
var shellTools = [
|
|
1253
1254
|
{
|
|
1254
1255
|
name: "run_command",
|
|
@@ -1330,8 +1331,12 @@ var shellTools = [
|
|
|
1330
1331
|
required: ["path"]
|
|
1331
1332
|
},
|
|
1332
1333
|
async execute({ path, application }) {
|
|
1333
|
-
|
|
1334
|
+
let target = path;
|
|
1334
1335
|
const app = application;
|
|
1336
|
+
const isUrl = /^https?:\/\//i.test(target);
|
|
1337
|
+
if (!isUrl) {
|
|
1338
|
+
target = resolve2(process.cwd(), target);
|
|
1339
|
+
}
|
|
1335
1340
|
const SAFE_APPS = [
|
|
1336
1341
|
"code",
|
|
1337
1342
|
"cursor",
|
|
@@ -1412,7 +1417,7 @@ var beadsTools = [
|
|
|
1412
1417
|
installed,
|
|
1413
1418
|
initialized,
|
|
1414
1419
|
ready: installed && initialized,
|
|
1415
|
-
message: !installed ? "Beads (bd) is not installed.
|
|
1420
|
+
message: !installed ? "Beads (bd) is not installed. Run 'sharkbait setup' or install manually: npm install -g @beads/bd" : !initialized ? "Beads is installed but not initialized here. Use beads_init to initialize." : "Beads is ready to use.",
|
|
1416
1421
|
bdPath: BD_PATH
|
|
1417
1422
|
};
|
|
1418
1423
|
}
|
|
@@ -1441,7 +1446,7 @@ var beadsTools = [
|
|
|
1441
1446
|
if (!await isBdInstalled()) {
|
|
1442
1447
|
return {
|
|
1443
1448
|
success: false,
|
|
1444
|
-
message: "Beads (bd) is not installed.
|
|
1449
|
+
message: "Beads (bd) is not installed. Run 'sharkbait setup' or install manually: npm install -g @beads/bd",
|
|
1445
1450
|
installed: false
|
|
1446
1451
|
};
|
|
1447
1452
|
}
|
|
@@ -4725,9 +4730,9 @@ class ParallelExecutor {
|
|
|
4725
4730
|
if (invocation.mode && agent.supportsMode(invocation.mode)) {
|
|
4726
4731
|
agent.setMode(invocation.mode);
|
|
4727
4732
|
}
|
|
4728
|
-
return new Promise(async (
|
|
4733
|
+
return new Promise(async (resolve3) => {
|
|
4729
4734
|
const timeoutId = setTimeout(() => {
|
|
4730
|
-
|
|
4735
|
+
resolve3({
|
|
4731
4736
|
agent: invocation.agent,
|
|
4732
4737
|
mode: invocation.mode,
|
|
4733
4738
|
success: false,
|
|
@@ -4751,7 +4756,7 @@ class ParallelExecutor {
|
|
|
4751
4756
|
break;
|
|
4752
4757
|
case "done":
|
|
4753
4758
|
clearTimeout(timeoutId);
|
|
4754
|
-
|
|
4759
|
+
resolve3(event.result ? {
|
|
4755
4760
|
...event.result,
|
|
4756
4761
|
agent: invocation.agent,
|
|
4757
4762
|
mode: invocation.mode
|
|
@@ -4767,7 +4772,7 @@ class ParallelExecutor {
|
|
|
4767
4772
|
return;
|
|
4768
4773
|
case "error":
|
|
4769
4774
|
clearTimeout(timeoutId);
|
|
4770
|
-
|
|
4775
|
+
resolve3({
|
|
4771
4776
|
agent: invocation.agent,
|
|
4772
4777
|
mode: invocation.mode,
|
|
4773
4778
|
success: false,
|
|
@@ -4781,7 +4786,7 @@ class ParallelExecutor {
|
|
|
4781
4786
|
}
|
|
4782
4787
|
}
|
|
4783
4788
|
clearTimeout(timeoutId);
|
|
4784
|
-
|
|
4789
|
+
resolve3({
|
|
4785
4790
|
agent: invocation.agent,
|
|
4786
4791
|
mode: invocation.mode,
|
|
4787
4792
|
success: true,
|
|
@@ -4792,7 +4797,7 @@ class ParallelExecutor {
|
|
|
4792
4797
|
});
|
|
4793
4798
|
} catch (error) {
|
|
4794
4799
|
clearTimeout(timeoutId);
|
|
4795
|
-
|
|
4800
|
+
resolve3({
|
|
4796
4801
|
agent: invocation.agent,
|
|
4797
4802
|
mode: invocation.mode,
|
|
4798
4803
|
success: false,
|
|
@@ -4806,7 +4811,7 @@ class ParallelExecutor {
|
|
|
4806
4811
|
});
|
|
4807
4812
|
}
|
|
4808
4813
|
async raceWithTimeout(promises, timeout) {
|
|
4809
|
-
const timeoutPromise = new Promise((
|
|
4814
|
+
const timeoutPromise = new Promise((resolve3) => setTimeout(() => resolve3(null), timeout));
|
|
4810
4815
|
const racePromises = promises.map((p) => p.then((result) => result.success ? result : null));
|
|
4811
4816
|
const results = await Promise.race([
|
|
4812
4817
|
...racePromises.map((p) => p.then((r) => r ? [r] : [])),
|
|
@@ -4817,15 +4822,15 @@ class ParallelExecutor {
|
|
|
4817
4822
|
async waitForQuorum(promises, threshold, timeout) {
|
|
4818
4823
|
const required = Math.ceil(promises.length * threshold);
|
|
4819
4824
|
const results = [];
|
|
4820
|
-
return new Promise((
|
|
4821
|
-
const timeoutId = setTimeout(() =>
|
|
4825
|
+
return new Promise((resolve3) => {
|
|
4826
|
+
const timeoutId = setTimeout(() => resolve3(results), timeout);
|
|
4822
4827
|
for (const promise of promises) {
|
|
4823
4828
|
promise.then((result) => {
|
|
4824
4829
|
if (result.success) {
|
|
4825
4830
|
results.push(result);
|
|
4826
4831
|
if (results.length >= required) {
|
|
4827
4832
|
clearTimeout(timeoutId);
|
|
4828
|
-
|
|
4833
|
+
resolve3(results);
|
|
4829
4834
|
}
|
|
4830
4835
|
}
|
|
4831
4836
|
});
|
|
@@ -7511,7 +7516,7 @@ function ConfirmDialog({
|
|
|
7511
7516
|
}
|
|
7512
7517
|
|
|
7513
7518
|
// src/ui/commands/registry.ts
|
|
7514
|
-
import { resolve as
|
|
7519
|
+
import { resolve as resolve3, isAbsolute } from "path";
|
|
7515
7520
|
import { existsSync as existsSync5, statSync as statSync2, readFileSync as readFileSync2 } from "fs";
|
|
7516
7521
|
|
|
7517
7522
|
// src/commands/init.ts
|
|
@@ -7659,7 +7664,7 @@ var commands = [
|
|
|
7659
7664
|
Usage: /cd <path>`
|
|
7660
7665
|
};
|
|
7661
7666
|
}
|
|
7662
|
-
const newPath = isAbsolute(args) ? args :
|
|
7667
|
+
const newPath = isAbsolute(args) ? args : resolve3(ctx.currentDir, args);
|
|
7663
7668
|
if (!existsSync5(newPath)) {
|
|
7664
7669
|
ctx.setPendingConfirm({ type: "mkdir", data: { path: newPath } });
|
|
7665
7670
|
return {
|
|
@@ -8028,7 +8033,7 @@ Example:
|
|
|
8028
8033
|
}
|
|
8029
8034
|
}
|
|
8030
8035
|
}
|
|
8031
|
-
const resolvedPath = isAbsolute(filePath) ? filePath :
|
|
8036
|
+
const resolvedPath = isAbsolute(filePath) ? filePath : resolve3(ctx.currentDir, filePath);
|
|
8032
8037
|
if (!existsSync5(resolvedPath)) {
|
|
8033
8038
|
return {
|
|
8034
8039
|
handled: true,
|
|
@@ -8741,7 +8746,7 @@ ${event.consolidated}`,
|
|
|
8741
8746
|
}
|
|
8742
8747
|
|
|
8743
8748
|
// src/version.ts
|
|
8744
|
-
var VERSION = "1.0.
|
|
8749
|
+
var VERSION = "1.0.17";
|
|
8745
8750
|
|
|
8746
8751
|
// src/agent/start-chat.ts
|
|
8747
8752
|
async function startChat(options = {}) {
|
|
@@ -8929,7 +8934,7 @@ import React4, { useState as useState3, useEffect as useEffect3 } from "react";
|
|
|
8929
8934
|
import { render as render2, Box as Box13, Text as Text13, useInput as useInput2, useApp as useApp2 } from "ink";
|
|
8930
8935
|
import TextInput from "ink-text-input";
|
|
8931
8936
|
import { writeFile as writeFile4, readFile as readFile3, mkdir as mkdir4, stat as stat3 } from "fs/promises";
|
|
8932
|
-
import { join as join8, resolve as
|
|
8937
|
+
import { join as join8, resolve as resolve4 } from "path";
|
|
8933
8938
|
import { homedir as homedir4 } from "os";
|
|
8934
8939
|
import { existsSync as existsSync6 } from "fs";
|
|
8935
8940
|
import { execSync } from "child_process";
|
|
@@ -8949,6 +8954,8 @@ function SetupWizardWithCallback({ onComplete }) {
|
|
|
8949
8954
|
const [inputValue, setInputValue] = useState3("");
|
|
8950
8955
|
const [error, setError] = useState3(null);
|
|
8951
8956
|
const [saving, setSaving] = useState3(false);
|
|
8957
|
+
const [beadsInstallStatus, setBeadsInstallStatus] = useState3("pending");
|
|
8958
|
+
const [beadsInstallError, setBeadsInstallError] = useState3(null);
|
|
8952
8959
|
useEffect3(() => {
|
|
8953
8960
|
loadExistingConfig();
|
|
8954
8961
|
}, []);
|
|
@@ -9088,7 +9095,7 @@ function SetupWizardWithCallback({ onComplete }) {
|
|
|
9088
9095
|
}
|
|
9089
9096
|
case "working-dir": {
|
|
9090
9097
|
if (value.trim()) {
|
|
9091
|
-
const resolved =
|
|
9098
|
+
const resolved = resolve4(value.trim().replace(/^~/, homedir4()));
|
|
9092
9099
|
if (!existsSync6(resolved)) {
|
|
9093
9100
|
setError(`Directory not found: ${resolved}`);
|
|
9094
9101
|
return;
|
|
@@ -9155,6 +9162,27 @@ function SetupWizardWithCallback({ onComplete }) {
|
|
|
9155
9162
|
`) + `
|
|
9156
9163
|
`;
|
|
9157
9164
|
await writeFile4(join8(configDir2, ".env"), envContent);
|
|
9165
|
+
if (state.enableBeads) {
|
|
9166
|
+
let bdAvailable = false;
|
|
9167
|
+
try {
|
|
9168
|
+
execSync("bd --version", { stdio: "ignore" });
|
|
9169
|
+
bdAvailable = true;
|
|
9170
|
+
} catch {}
|
|
9171
|
+
if (!bdAvailable) {
|
|
9172
|
+
setBeadsInstallStatus("installing");
|
|
9173
|
+
try {
|
|
9174
|
+
execSync("npm install -g @beads/bd", { stdio: "ignore", timeout: 60000 });
|
|
9175
|
+
setBeadsInstallStatus("installed");
|
|
9176
|
+
} catch (installErr) {
|
|
9177
|
+
setBeadsInstallStatus("failed");
|
|
9178
|
+
setBeadsInstallError(installErr instanceof Error ? installErr.message : String(installErr));
|
|
9179
|
+
}
|
|
9180
|
+
} else {
|
|
9181
|
+
setBeadsInstallStatus("skipped");
|
|
9182
|
+
}
|
|
9183
|
+
} else {
|
|
9184
|
+
setBeadsInstallStatus("skipped");
|
|
9185
|
+
}
|
|
9158
9186
|
setStep("complete");
|
|
9159
9187
|
} catch (err) {
|
|
9160
9188
|
setError(`Failed to save: ${err}`);
|
|
@@ -9710,6 +9738,45 @@ function SetupWizardWithCallback({ onComplete }) {
|
|
|
9710
9738
|
}, undefined, true, undefined, this)
|
|
9711
9739
|
]
|
|
9712
9740
|
}, undefined, true, undefined, this),
|
|
9741
|
+
state.enableBeads && /* @__PURE__ */ jsxDEV13(Box13, {
|
|
9742
|
+
marginTop: 1,
|
|
9743
|
+
flexDirection: "column",
|
|
9744
|
+
children: [
|
|
9745
|
+
beadsInstallStatus === "installed" && /* @__PURE__ */ jsxDEV13(Text13, {
|
|
9746
|
+
color: colors.success,
|
|
9747
|
+
children: [
|
|
9748
|
+
icons.success,
|
|
9749
|
+
" Beads (bd) installed successfully"
|
|
9750
|
+
]
|
|
9751
|
+
}, undefined, true, undefined, this),
|
|
9752
|
+
beadsInstallStatus === "skipped" && /* @__PURE__ */ jsxDEV13(Text13, {
|
|
9753
|
+
color: colors.textMuted,
|
|
9754
|
+
children: [
|
|
9755
|
+
icons.success,
|
|
9756
|
+
" Beads (bd) already installed"
|
|
9757
|
+
]
|
|
9758
|
+
}, undefined, true, undefined, this),
|
|
9759
|
+
beadsInstallStatus === "failed" && /* @__PURE__ */ jsxDEV13(Fragment3, {
|
|
9760
|
+
children: [
|
|
9761
|
+
/* @__PURE__ */ jsxDEV13(Text13, {
|
|
9762
|
+
color: colors.warning,
|
|
9763
|
+
children: "⚠ Beads (bd) install failed. Install manually:"
|
|
9764
|
+
}, undefined, false, undefined, this),
|
|
9765
|
+
/* @__PURE__ */ jsxDEV13(Text13, {
|
|
9766
|
+
color: colors.text,
|
|
9767
|
+
children: " npm install -g @beads/bd"
|
|
9768
|
+
}, undefined, false, undefined, this),
|
|
9769
|
+
beadsInstallError && /* @__PURE__ */ jsxDEV13(Text13, {
|
|
9770
|
+
color: colors.textDim,
|
|
9771
|
+
children: [
|
|
9772
|
+
" ",
|
|
9773
|
+
beadsInstallError
|
|
9774
|
+
]
|
|
9775
|
+
}, undefined, true, undefined, this)
|
|
9776
|
+
]
|
|
9777
|
+
}, undefined, true, undefined, this)
|
|
9778
|
+
]
|
|
9779
|
+
}, undefined, true, undefined, this),
|
|
9713
9780
|
/* @__PURE__ */ jsxDEV13(Box13, {
|
|
9714
9781
|
marginTop: 1,
|
|
9715
9782
|
flexDirection: "column",
|
|
@@ -9794,10 +9861,10 @@ async function runSetup() {
|
|
|
9794
9861
|
|
|
9795
9862
|
// src/commands/review.ts
|
|
9796
9863
|
import { readFileSync as readFileSync3, existsSync as existsSync7 } from "fs";
|
|
9797
|
-
import { resolve as
|
|
9864
|
+
import { resolve as resolve5, isAbsolute as isAbsolute2 } from "path";
|
|
9798
9865
|
async function runReview(filePath, options = {}) {
|
|
9799
9866
|
const config = loadConfig();
|
|
9800
|
-
const resolvedPath = isAbsolute2(filePath) ? filePath :
|
|
9867
|
+
const resolvedPath = isAbsolute2(filePath) ? filePath : resolve5(process.cwd(), filePath);
|
|
9801
9868
|
if (!existsSync7(resolvedPath)) {
|
|
9802
9869
|
console.error(`❌ File not found: ${resolvedPath}`);
|
|
9803
9870
|
process.exit(1);
|
|
@@ -9918,7 +9985,7 @@ ${"━".repeat(60)}`);
|
|
|
9918
9985
|
}
|
|
9919
9986
|
|
|
9920
9987
|
// src/version.ts
|
|
9921
|
-
var VERSION2 = "1.0.
|
|
9988
|
+
var VERSION2 = "1.0.17";
|
|
9922
9989
|
|
|
9923
9990
|
// src/ui/logo.tsx
|
|
9924
9991
|
import { Box as Box14, Text as Text14 } from "ink";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sharkbait",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "AI-powered coding assistant for the command line. Uses OpenAI Responses API (not Chat). Autonomous agents, parallel code reviews, 36 tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|