sharkbait 1.0.25 → 1.0.26
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 +91 -24
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1406,6 +1406,14 @@ function getBdPath() {
|
|
|
1406
1406
|
return "bd";
|
|
1407
1407
|
}
|
|
1408
1408
|
var BD_PATH = getBdPath();
|
|
1409
|
+
var forceNoDb = false;
|
|
1410
|
+
function bdArgs(...args) {
|
|
1411
|
+
const cmd = [BD_PATH, ...args];
|
|
1412
|
+
if (forceNoDb && !cmd.includes("--no-db")) {
|
|
1413
|
+
cmd.push("--no-db");
|
|
1414
|
+
}
|
|
1415
|
+
return cmd;
|
|
1416
|
+
}
|
|
1409
1417
|
function hasBeadsDir(cwd) {
|
|
1410
1418
|
const dir = cwd || process.cwd();
|
|
1411
1419
|
return existsSync3(join3(dir, ".beads"));
|
|
@@ -1417,12 +1425,19 @@ async function isBeadsFunctional() {
|
|
|
1417
1425
|
try {
|
|
1418
1426
|
const result = await exec([BD_PATH, "list", "--json"], { cwd: process.cwd() });
|
|
1419
1427
|
if (result.exitCode === 0) {
|
|
1420
|
-
return { functional: true };
|
|
1428
|
+
return { functional: true, useNoDb: false };
|
|
1421
1429
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1430
|
+
} catch {}
|
|
1431
|
+
if (bdSupportsNoDb()) {
|
|
1432
|
+
try {
|
|
1433
|
+
const result = await exec([BD_PATH, "list", "--json", "--no-db"], { cwd: process.cwd() });
|
|
1434
|
+
if (result.exitCode === 0) {
|
|
1435
|
+
forceNoDb = true;
|
|
1436
|
+
return { functional: true, useNoDb: true };
|
|
1437
|
+
}
|
|
1438
|
+
} catch {}
|
|
1425
1439
|
}
|
|
1440
|
+
return { functional: false, error: "bd list failed (dolt unreachable and --no-db fallback failed)" };
|
|
1426
1441
|
}
|
|
1427
1442
|
async function isBdInstalled() {
|
|
1428
1443
|
try {
|
|
@@ -1531,13 +1546,14 @@ var beadsTools = [
|
|
|
1531
1546
|
bdPath: BD_PATH
|
|
1532
1547
|
};
|
|
1533
1548
|
}
|
|
1534
|
-
const { functional, error } = await isBeadsFunctional();
|
|
1549
|
+
const { functional, useNoDb, error } = await isBeadsFunctional();
|
|
1535
1550
|
return {
|
|
1536
1551
|
installed: true,
|
|
1537
1552
|
initialized: dirExists,
|
|
1538
1553
|
functional,
|
|
1539
1554
|
ready: functional,
|
|
1540
|
-
|
|
1555
|
+
mode: useNoDb ? "no-db" : "dolt",
|
|
1556
|
+
message: functional ? useNoDb ? "Beads is ready (using --no-db fallback, dolt server unreachable)." : "Beads is ready to use." : `Beads directory exists but is not functional: ${error}. Write operations (beads_create, beads_done) will not work. However, if the user asks about their beads/tasks, still try beads_list — it may be able to read local task data. For new tasks, proceed without beads.`,
|
|
1541
1557
|
bdPath: BD_PATH,
|
|
1542
1558
|
proceedWithoutBeads: !functional
|
|
1543
1559
|
};
|
|
@@ -1641,7 +1657,7 @@ var beadsTools = [
|
|
|
1641
1657
|
},
|
|
1642
1658
|
async execute() {
|
|
1643
1659
|
try {
|
|
1644
|
-
const result = await exec(
|
|
1660
|
+
const result = await exec(bdArgs("ready", "--json"));
|
|
1645
1661
|
if (result.exitCode !== 0) {
|
|
1646
1662
|
return { tasks: [], message: "Beads not functional. Proceed without beads.", proceedWithoutBeads: true };
|
|
1647
1663
|
}
|
|
@@ -1671,7 +1687,7 @@ var beadsTools = [
|
|
|
1671
1687
|
proceedWithoutBeads: true
|
|
1672
1688
|
};
|
|
1673
1689
|
}
|
|
1674
|
-
const args =
|
|
1690
|
+
const args = bdArgs("create", title);
|
|
1675
1691
|
if (priority !== undefined) {
|
|
1676
1692
|
args.push("-p", String(priority));
|
|
1677
1693
|
}
|
|
@@ -1722,7 +1738,7 @@ var beadsTools = [
|
|
|
1722
1738
|
},
|
|
1723
1739
|
async execute({ id }) {
|
|
1724
1740
|
try {
|
|
1725
|
-
const result = await exec(
|
|
1741
|
+
const result = await exec(bdArgs("show", id, "--json"));
|
|
1726
1742
|
if (result.exitCode !== 0) {
|
|
1727
1743
|
return { error: `Task not found: ${id}`, proceedWithoutBeads: true };
|
|
1728
1744
|
}
|
|
@@ -1746,7 +1762,7 @@ var beadsTools = [
|
|
|
1746
1762
|
async execute({ id, message }) {
|
|
1747
1763
|
const msg = message || "Completed";
|
|
1748
1764
|
try {
|
|
1749
|
-
const result = await exec(
|
|
1765
|
+
const result = await exec(bdArgs("close", id, "-m", msg));
|
|
1750
1766
|
if (result.exitCode !== 0) {
|
|
1751
1767
|
return { success: false, error: `Failed to complete task: ${id}`, proceedWithoutBeads: true };
|
|
1752
1768
|
}
|
|
@@ -1769,7 +1785,7 @@ var beadsTools = [
|
|
|
1769
1785
|
},
|
|
1770
1786
|
async execute({ childId, parentId }) {
|
|
1771
1787
|
try {
|
|
1772
|
-
const result = await exec(
|
|
1788
|
+
const result = await exec(bdArgs("dep", "add", childId, parentId));
|
|
1773
1789
|
if (result.exitCode !== 0) {
|
|
1774
1790
|
return { success: false, error: "Failed to add dependency", proceedWithoutBeads: true };
|
|
1775
1791
|
}
|
|
@@ -1781,7 +1797,7 @@ var beadsTools = [
|
|
|
1781
1797
|
},
|
|
1782
1798
|
{
|
|
1783
1799
|
name: "beads_list",
|
|
1784
|
-
description: "List all tasks",
|
|
1800
|
+
description: "List all tasks. ALWAYS try this when the user asks about their beads/tasks, even if beads_status reported non-functional — task data may still be readable from local files.",
|
|
1785
1801
|
parameters: {
|
|
1786
1802
|
type: "object",
|
|
1787
1803
|
properties: {
|
|
@@ -1794,7 +1810,7 @@ var beadsTools = [
|
|
|
1794
1810
|
required: []
|
|
1795
1811
|
},
|
|
1796
1812
|
async execute({ status }) {
|
|
1797
|
-
const args =
|
|
1813
|
+
const args = bdArgs("list", "--json");
|
|
1798
1814
|
if (status === "all") {
|
|
1799
1815
|
args.push("--all");
|
|
1800
1816
|
} else if (status) {
|
|
@@ -1802,12 +1818,53 @@ var beadsTools = [
|
|
|
1802
1818
|
}
|
|
1803
1819
|
try {
|
|
1804
1820
|
const result = await exec(args);
|
|
1805
|
-
if (result.exitCode
|
|
1806
|
-
return
|
|
1821
|
+
if (result.exitCode === 0) {
|
|
1822
|
+
return JSON.parse(result.stdout);
|
|
1807
1823
|
}
|
|
1808
|
-
|
|
1824
|
+
} catch {}
|
|
1825
|
+
if (!forceNoDb && bdSupportsNoDb()) {
|
|
1826
|
+
try {
|
|
1827
|
+
const noDbArgs = [...args, "--no-db"];
|
|
1828
|
+
const result = await exec(noDbArgs);
|
|
1829
|
+
if (result.exitCode === 0) {
|
|
1830
|
+
forceNoDb = true;
|
|
1831
|
+
return JSON.parse(result.stdout);
|
|
1832
|
+
}
|
|
1833
|
+
} catch {}
|
|
1834
|
+
}
|
|
1835
|
+
try {
|
|
1836
|
+
const { readFileSync, readdirSync: readdirSync2 } = await import("fs");
|
|
1837
|
+
const beadsDir = join3(process.cwd(), ".beads");
|
|
1838
|
+
if (!existsSync3(beadsDir)) {
|
|
1839
|
+
return { tasks: [], message: "No .beads directory found. Beads is not initialized here.", proceedWithoutBeads: true };
|
|
1840
|
+
}
|
|
1841
|
+
const tasks = [];
|
|
1842
|
+
const scanDirs = [beadsDir, join3(beadsDir, "tasks"), join3(beadsDir, "data")];
|
|
1843
|
+
for (const dir of scanDirs) {
|
|
1844
|
+
if (!existsSync3(dir))
|
|
1845
|
+
continue;
|
|
1846
|
+
const files = readdirSync2(dir).filter((f) => f.endsWith(".jsonl") || f.endsWith(".json"));
|
|
1847
|
+
for (const file of files) {
|
|
1848
|
+
try {
|
|
1849
|
+
const content = readFileSync(join3(dir, file), "utf-8");
|
|
1850
|
+
for (const line of content.split(`
|
|
1851
|
+
`)) {
|
|
1852
|
+
const trimmed = line.trim();
|
|
1853
|
+
if (!trimmed)
|
|
1854
|
+
continue;
|
|
1855
|
+
try {
|
|
1856
|
+
tasks.push(JSON.parse(trimmed));
|
|
1857
|
+
} catch {}
|
|
1858
|
+
}
|
|
1859
|
+
} catch {}
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (tasks.length > 0) {
|
|
1863
|
+
return { tasks, source: "local-files", message: `Read ${tasks.length} task record(s) from local .beads files (dolt unavailable).` };
|
|
1864
|
+
}
|
|
1865
|
+
return { tasks: [], message: "No task data found in .beads directory. Beads may need dolt to store tasks.", proceedWithoutBeads: true };
|
|
1809
1866
|
} catch {
|
|
1810
|
-
return { tasks: [], message: "Beads (bd) not available. Proceed without beads.", proceedWithoutBeads: true };
|
|
1867
|
+
return { tasks: [], message: "Beads (bd) not available and could not read local files. Proceed without beads.", proceedWithoutBeads: true };
|
|
1811
1868
|
}
|
|
1812
1869
|
}
|
|
1813
1870
|
}
|
|
@@ -3371,6 +3428,12 @@ var MAX_REPLANS2 = 2;
|
|
|
3371
3428
|
var MAX_ITERATIONS = 50;
|
|
3372
3429
|
var MAX_MESSAGES = 200;
|
|
3373
3430
|
var BEADS_FAIL_LIMIT = 2;
|
|
3431
|
+
var BEADS_WRITE_TOOLS = new Set([
|
|
3432
|
+
"beads_init",
|
|
3433
|
+
"beads_create",
|
|
3434
|
+
"beads_done",
|
|
3435
|
+
"beads_add_dependency"
|
|
3436
|
+
]);
|
|
3374
3437
|
var BEADS_TOOL_NAMES = new Set([
|
|
3375
3438
|
"beads_status",
|
|
3376
3439
|
"beads_init",
|
|
@@ -3603,13 +3666,14 @@ BEADS ARE YOUR MEMORY SYSTEM:
|
|
|
3603
3666
|
- Use beads_done when you've completed the work
|
|
3604
3667
|
|
|
3605
3668
|
CRITICAL — BEADS FAILURE POLICY:
|
|
3606
|
-
If
|
|
3607
|
-
- Do NOT retry the same beads operation more than ONCE
|
|
3669
|
+
If beads WRITE tools fail (beads_create, beads_done, beads_init) or return proceedWithoutBeads:
|
|
3670
|
+
- Do NOT retry the same beads write operation more than ONCE
|
|
3608
3671
|
- Do NOT try to troubleshoot, fix, or debug beads problems
|
|
3609
3672
|
- Do NOT install dolt, restart services, or run bd commands via run_command
|
|
3610
3673
|
- IMMEDIATELY proceed with the user's actual task
|
|
3611
3674
|
- Inform the user beads is unavailable — their task will proceed without tracking
|
|
3612
3675
|
- The user's task is ALWAYS more important than beads
|
|
3676
|
+
Exception: When the user EXPLICITLY asks about beads/tasks ("what's on my beads", "list tasks"), ALWAYS try beads_list — it can read local files even when dolt is down.
|
|
3613
3677
|
|
|
3614
3678
|
Guidelines:
|
|
3615
3679
|
1. Always read files before editing
|
|
@@ -3912,13 +3976,16 @@ When the user asks to install Beads, use the \`beads_install\` tool. NEVER use r
|
|
|
3912
3976
|
To check status, use \`beads_status\`. To initialize in a project, use \`beads_init\`.
|
|
3913
3977
|
|
|
3914
3978
|
**CRITICAL — Beads Failure Policy:**
|
|
3915
|
-
If
|
|
3916
|
-
- Do NOT retry the same beads operation more than ONCE
|
|
3979
|
+
If beads WRITE tools fail (beads_create, beads_done, beads_init):
|
|
3980
|
+
- Do NOT retry the same beads write operation more than ONCE
|
|
3917
3981
|
- Do NOT try to troubleshoot or fix beads (e.g., installing dolt, restarting services, running bd commands via run_command)
|
|
3918
3982
|
- IMMEDIATELY proceed with the user's actual task
|
|
3919
3983
|
- Inform the user that beads is unavailable and their task will proceed without task tracking
|
|
3920
3984
|
- The user's task is ALWAYS more important than beads working
|
|
3921
|
-
If a beads tool returns \`proceedWithoutBeads: true\`, that is your signal to stop
|
|
3985
|
+
If a beads tool returns \`proceedWithoutBeads: true\`, that is your signal to stop beads WRITE operations and focus on the task.
|
|
3986
|
+
|
|
3987
|
+
**Exception for READ operations:**
|
|
3988
|
+
When the user explicitly asks about their beads, tasks, or previous work (e.g., "what's on my beads", "show my tasks", "list beads"), ALWAYS try beads_list even if beads_status reported non-functional. The list tool has fallback logic to read local task files.
|
|
3922
3989
|
`;
|
|
3923
3990
|
var ORCHESTRATOR_PROMPT = `${BASE_PROMPT}
|
|
3924
3991
|
|
|
@@ -9022,7 +9089,7 @@ ${event.consolidated}`,
|
|
|
9022
9089
|
}
|
|
9023
9090
|
|
|
9024
9091
|
// src/version.ts
|
|
9025
|
-
var VERSION = "1.0.
|
|
9092
|
+
var VERSION = "1.0.26";
|
|
9026
9093
|
|
|
9027
9094
|
// src/agent/start-chat.ts
|
|
9028
9095
|
async function startChat(options = {}) {
|
|
@@ -10306,7 +10373,7 @@ ${"━".repeat(60)}`);
|
|
|
10306
10373
|
}
|
|
10307
10374
|
|
|
10308
10375
|
// src/version.ts
|
|
10309
|
-
var VERSION2 = "1.0.
|
|
10376
|
+
var VERSION2 = "1.0.26";
|
|
10310
10377
|
|
|
10311
10378
|
// src/ui/logo.tsx
|
|
10312
10379
|
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.26",
|
|
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",
|