@primeinc/swarm 0.57.8-beta.0 → 0.57.10-beta.0
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/bin/swarm.ts +3 -3
- package/claude-plugin/dist/index.js +1419 -693
- package/claude-plugin/dist/utils/arg-normalizer.d.ts +9 -0
- package/claude-plugin/dist/utils/arg-normalizer.d.ts.map +1 -0
- package/dist/bin/swarm.js +3563 -1632
- package/dist/dashboard.d.ts +2 -6
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/hive.d.ts +7 -2
- package/dist/hive.d.ts.map +1 -1
- package/dist/hive.js +545 -76
- package/dist/index.js +781 -302
- package/dist/marketplace/index.js +1419 -693
- package/dist/plugin.js +781 -288
- package/dist/swarm-mail.d.ts.map +1 -1
- package/dist/swarm-prompts.js +593 -118
- package/dist/swarm-research.d.ts +1 -2
- package/dist/swarm-research.d.ts.map +1 -1
- package/dist/utils/arg-normalizer.d.ts +9 -0
- package/dist/utils/arg-normalizer.d.ts.map +1 -0
- package/package.json +6 -5
- package/claude-plugin/dist/utils/normalize-path.d.ts +0 -75
- package/claude-plugin/dist/utils/normalize-path.d.ts.map +0 -1
- package/dist/utils/normalize-path.d.ts +0 -75
- package/dist/utils/normalize-path.d.ts.map +0 -1
package/dist/hive.js
CHANGED
|
@@ -112,7 +112,7 @@ __export(exports_util2, {
|
|
|
112
112
|
promiseAllObject: () => promiseAllObject2,
|
|
113
113
|
primitiveTypes: () => primitiveTypes2,
|
|
114
114
|
prefixIssues: () => prefixIssues2,
|
|
115
|
-
pick: () =>
|
|
115
|
+
pick: () => pick3,
|
|
116
116
|
partial: () => partial2,
|
|
117
117
|
optionalKeys: () => optionalKeys2,
|
|
118
118
|
omit: () => omit2,
|
|
@@ -263,10 +263,10 @@ function mergeDefs2(...defs) {
|
|
|
263
263
|
function cloneDef2(schema) {
|
|
264
264
|
return mergeDefs2(schema._zod.def);
|
|
265
265
|
}
|
|
266
|
-
function getElementAtPath2(obj,
|
|
267
|
-
if (!
|
|
266
|
+
function getElementAtPath2(obj, path3) {
|
|
267
|
+
if (!path3)
|
|
268
268
|
return obj;
|
|
269
|
-
return
|
|
269
|
+
return path3.reduce((acc, key) => acc?.[key], obj);
|
|
270
270
|
}
|
|
271
271
|
function promiseAllObject2(promisesObj) {
|
|
272
272
|
const keys = Object.keys(promisesObj);
|
|
@@ -393,7 +393,7 @@ function optionalKeys2(shape) {
|
|
|
393
393
|
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function pick3(schema, mask) {
|
|
397
397
|
const currDef = schema._zod.def;
|
|
398
398
|
const def = mergeDefs2(schema._zod.def, {
|
|
399
399
|
get shape() {
|
|
@@ -555,11 +555,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
555
555
|
}
|
|
556
556
|
return false;
|
|
557
557
|
}
|
|
558
|
-
function prefixIssues2(
|
|
558
|
+
function prefixIssues2(path3, issues) {
|
|
559
559
|
return issues.map((iss) => {
|
|
560
560
|
var _a;
|
|
561
561
|
(_a = iss).path ?? (_a.path = []);
|
|
562
|
-
iss.path.unshift(
|
|
562
|
+
iss.path.unshift(path3);
|
|
563
563
|
return iss;
|
|
564
564
|
});
|
|
565
565
|
}
|
|
@@ -782,7 +782,7 @@ function treeifyError2(error45, _mapper) {
|
|
|
782
782
|
return issue3.message;
|
|
783
783
|
};
|
|
784
784
|
const result = { errors: [] };
|
|
785
|
-
const processError = (error46,
|
|
785
|
+
const processError = (error46, path3 = []) => {
|
|
786
786
|
var _a, _b;
|
|
787
787
|
for (const issue3 of error46.issues) {
|
|
788
788
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -792,7 +792,7 @@ function treeifyError2(error45, _mapper) {
|
|
|
792
792
|
} else if (issue3.code === "invalid_element") {
|
|
793
793
|
processError({ issues: issue3.issues }, issue3.path);
|
|
794
794
|
} else {
|
|
795
|
-
const fullpath = [...
|
|
795
|
+
const fullpath = [...path3, ...issue3.path];
|
|
796
796
|
if (fullpath.length === 0) {
|
|
797
797
|
result.errors.push(mapper(issue3));
|
|
798
798
|
continue;
|
|
@@ -824,8 +824,8 @@ function treeifyError2(error45, _mapper) {
|
|
|
824
824
|
}
|
|
825
825
|
function toDotPath2(_path) {
|
|
826
826
|
const segs = [];
|
|
827
|
-
const
|
|
828
|
-
for (const seg of
|
|
827
|
+
const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
828
|
+
for (const seg of path3) {
|
|
829
829
|
if (typeof seg === "number")
|
|
830
830
|
segs.push(`[${seg}]`);
|
|
831
831
|
else if (typeof seg === "symbol")
|
|
@@ -12710,14 +12710,14 @@ __export(exports_eval_capture, {
|
|
|
12710
12710
|
});
|
|
12711
12711
|
import * as fs from "node:fs";
|
|
12712
12712
|
import * as os from "node:os";
|
|
12713
|
-
import * as
|
|
12713
|
+
import * as path3 from "node:path";
|
|
12714
12714
|
import { getSwarmMailLibSQL } from "swarm-mail";
|
|
12715
12715
|
function getEvalDataPath(projectPath) {
|
|
12716
|
-
return
|
|
12716
|
+
return path3.join(projectPath, DEFAULT_EVAL_DATA_PATH);
|
|
12717
12717
|
}
|
|
12718
12718
|
function ensureEvalDataDir(projectPath) {
|
|
12719
12719
|
const evalPath = getEvalDataPath(projectPath);
|
|
12720
|
-
const dir =
|
|
12720
|
+
const dir = path3.dirname(evalPath);
|
|
12721
12721
|
if (!fs.existsSync(dir)) {
|
|
12722
12722
|
fs.mkdirSync(dir, { recursive: true });
|
|
12723
12723
|
}
|
|
@@ -12891,10 +12891,10 @@ function getEvalDataStats(projectPath) {
|
|
|
12891
12891
|
};
|
|
12892
12892
|
}
|
|
12893
12893
|
function getSessionDir() {
|
|
12894
|
-
return process.env.SWARM_SESSIONS_DIR ||
|
|
12894
|
+
return process.env.SWARM_SESSIONS_DIR || path3.join(os.homedir(), ".config", "swarm-tools", "sessions");
|
|
12895
12895
|
}
|
|
12896
12896
|
function getSessionPath(sessionId) {
|
|
12897
|
-
return
|
|
12897
|
+
return path3.join(getSessionDir(), `${sessionId}.jsonl`);
|
|
12898
12898
|
}
|
|
12899
12899
|
function ensureSessionDir() {
|
|
12900
12900
|
const sessionDir = getSessionDir();
|
|
@@ -25594,29 +25594,398 @@ import {
|
|
|
25594
25594
|
findCellsByPartialId
|
|
25595
25595
|
} from "swarm-mail";
|
|
25596
25596
|
|
|
25597
|
-
//
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
if (
|
|
25616
|
-
|
|
25597
|
+
// ../cross-path/dist/normalize.js
|
|
25598
|
+
import path2 from "node:path";
|
|
25599
|
+
|
|
25600
|
+
// ../cross-path/dist/detect.js
|
|
25601
|
+
var cachedEnvironment = null;
|
|
25602
|
+
function detectEnvironment() {
|
|
25603
|
+
if (cachedEnvironment !== null) {
|
|
25604
|
+
return cachedEnvironment;
|
|
25605
|
+
}
|
|
25606
|
+
const platform = process.platform;
|
|
25607
|
+
if (platform === "win32") {
|
|
25608
|
+
cachedEnvironment = "windows";
|
|
25609
|
+
return cachedEnvironment;
|
|
25610
|
+
}
|
|
25611
|
+
if (platform === "darwin") {
|
|
25612
|
+
cachedEnvironment = "darwin";
|
|
25613
|
+
return cachedEnvironment;
|
|
25614
|
+
}
|
|
25615
|
+
if (platform === "linux") {
|
|
25616
|
+
if (process.env.WSL_DISTRO_NAME || process.env.WSLENV) {
|
|
25617
|
+
cachedEnvironment = "wsl";
|
|
25618
|
+
return cachedEnvironment;
|
|
25619
|
+
}
|
|
25620
|
+
const msystem = process.env.MSYSTEM;
|
|
25621
|
+
if (msystem && (msystem.includes("MINGW") || msystem.includes("MSYS"))) {
|
|
25622
|
+
cachedEnvironment = "git-bash";
|
|
25623
|
+
return cachedEnvironment;
|
|
25624
|
+
}
|
|
25625
|
+
if (process.env.CYGWIN) {
|
|
25626
|
+
cachedEnvironment = "cygwin";
|
|
25627
|
+
return cachedEnvironment;
|
|
25628
|
+
}
|
|
25629
|
+
cachedEnvironment = "linux";
|
|
25630
|
+
return cachedEnvironment;
|
|
25631
|
+
}
|
|
25632
|
+
cachedEnvironment = "linux";
|
|
25633
|
+
return cachedEnvironment;
|
|
25634
|
+
}
|
|
25635
|
+
|
|
25636
|
+
// ../cross-path/dist/validate.js
|
|
25637
|
+
import path from "node:path";
|
|
25638
|
+
function isAbsolute(inputPath) {
|
|
25639
|
+
return path.win32.isAbsolute(inputPath) || path.posix.isAbsolute(inputPath);
|
|
25640
|
+
}
|
|
25641
|
+
function isUNC(inputPath) {
|
|
25642
|
+
const normalized = inputPath.replace(/\\/g, "/");
|
|
25643
|
+
if (normalized.length < 3) {
|
|
25644
|
+
return false;
|
|
25645
|
+
}
|
|
25646
|
+
if (!normalized.startsWith("//")) {
|
|
25647
|
+
return false;
|
|
25648
|
+
}
|
|
25649
|
+
if (normalized[2] === "/") {
|
|
25650
|
+
return false;
|
|
25651
|
+
}
|
|
25652
|
+
const afterPrefix = normalized.substring(2);
|
|
25653
|
+
const hasValidServerPart = /^[^\s\/]+/.test(afterPrefix);
|
|
25654
|
+
return hasValidServerPart;
|
|
25655
|
+
}
|
|
25656
|
+
function isWSLMount(inputPath) {
|
|
25657
|
+
const wslMountPattern = /^\/mnt\/[a-z](\/|$)/i;
|
|
25658
|
+
return wslMountPattern.test(inputPath);
|
|
25659
|
+
}
|
|
25660
|
+
function isGitBashMount(inputPath) {
|
|
25661
|
+
const gitBashPattern = /^\/[a-z]\//i;
|
|
25662
|
+
return gitBashPattern.test(inputPath);
|
|
25663
|
+
}
|
|
25664
|
+
function hasDriveLetter(inputPath) {
|
|
25665
|
+
const driveLetterPattern = /^[A-Za-z]:/;
|
|
25666
|
+
return driveLetterPattern.test(inputPath);
|
|
25667
|
+
}
|
|
25668
|
+
function parseWSLUNC(inputPath) {
|
|
25669
|
+
const normalized = inputPath.replace(/\\/g, "/");
|
|
25670
|
+
const wslUNCPattern = /^\/\/(wsl\.localhost|wsl\$)\/([^/]+)(\/.*)?$/i;
|
|
25671
|
+
const match = normalized.match(wslUNCPattern);
|
|
25672
|
+
if (!match) {
|
|
25673
|
+
return null;
|
|
25674
|
+
}
|
|
25675
|
+
const distro = match[2];
|
|
25676
|
+
const restPath = match[3] || "/";
|
|
25677
|
+
return { distro, path: restPath };
|
|
25678
|
+
}
|
|
25679
|
+
function isDriveRelative(inputPath) {
|
|
25680
|
+
if (inputPath.length < 3) {
|
|
25681
|
+
return false;
|
|
25682
|
+
}
|
|
25683
|
+
const hasLetter = /^[A-Za-z]$/.test(inputPath[0]);
|
|
25684
|
+
const hasColon = inputPath[1] === ":";
|
|
25685
|
+
const notSlash = inputPath[2] !== "/" && inputPath[2] !== "\\";
|
|
25686
|
+
return hasLetter && hasColon && notSlash;
|
|
25687
|
+
}
|
|
25688
|
+
|
|
25689
|
+
// ../cross-path/dist/normalize.js
|
|
25690
|
+
function normalize(inputPath, options) {
|
|
25691
|
+
if (inputPath === null || inputPath === undefined) {
|
|
25692
|
+
throw new TypeError("Path cannot be null or undefined");
|
|
25693
|
+
}
|
|
25694
|
+
if (typeof inputPath !== "string") {
|
|
25695
|
+
throw new TypeError(`Path must be a string, received ${typeof inputPath}`);
|
|
25696
|
+
}
|
|
25697
|
+
if (inputPath.length === 0) {
|
|
25698
|
+
throw new TypeError("Path cannot be empty");
|
|
25699
|
+
}
|
|
25700
|
+
if (inputPath.includes("\x00")) {
|
|
25701
|
+
throw new TypeError("Path cannot contain null bytes");
|
|
25702
|
+
}
|
|
25703
|
+
const env = options?.env ?? detectEnvironment();
|
|
25704
|
+
const wslUNCInfo = parseWSLUNC(inputPath);
|
|
25705
|
+
if (wslUNCInfo) {
|
|
25706
|
+
const currentDistro = process.env.WSL_DISTRO_NAME;
|
|
25707
|
+
if (env === "wsl" && currentDistro && wslUNCInfo.distro.toLowerCase() === currentDistro.toLowerCase()) {
|
|
25708
|
+
return path2.posix.normalize(wslUNCInfo.path);
|
|
25709
|
+
}
|
|
25710
|
+
}
|
|
25711
|
+
let intermediate = inputPath.replace(/\\/g, "/");
|
|
25712
|
+
const originalIsUNC = isUNC(intermediate);
|
|
25713
|
+
if (isWSLMount(intermediate)) {
|
|
25714
|
+
const driveLetter = intermediate.charAt(5).toLowerCase();
|
|
25715
|
+
intermediate = `${driveLetter}:${intermediate.substring(6)}`;
|
|
25716
|
+
if (intermediate.length === 2) {
|
|
25717
|
+
intermediate = `${driveLetter}:/`;
|
|
25718
|
+
}
|
|
25719
|
+
} else if (isGitBashMount(intermediate)) {
|
|
25720
|
+
const driveLetter = intermediate.charAt(1).toLowerCase();
|
|
25721
|
+
intermediate = `${driveLetter}:${intermediate.substring(2)}`;
|
|
25722
|
+
}
|
|
25723
|
+
const hasWindowsDrive = hasDriveLetter(intermediate);
|
|
25724
|
+
const isAbsolutePath = isAbsolute(intermediate);
|
|
25725
|
+
const driveRelative = isDriveRelative(intermediate);
|
|
25726
|
+
if (!isAbsolutePath && !hasWindowsDrive) {
|
|
25727
|
+
const basePath = options?.basePath ?? process.cwd();
|
|
25728
|
+
const normalizedBase = basePath.replace(/\\/g, "/");
|
|
25729
|
+
if (hasDriveLetter(normalizedBase)) {
|
|
25730
|
+
const drive = normalizedBase.substring(0, 2);
|
|
25731
|
+
const baseRest = normalizedBase.substring(2) || "/";
|
|
25732
|
+
const resolved = path2.posix.resolve(baseRest, intermediate);
|
|
25733
|
+
intermediate = drive + resolved;
|
|
25734
|
+
} else {
|
|
25735
|
+
intermediate = path2.posix.resolve(normalizedBase, intermediate);
|
|
25736
|
+
}
|
|
25737
|
+
} else if (driveRelative) {
|
|
25738
|
+
const pathDrive = intermediate.substring(0, 2).toLowerCase();
|
|
25739
|
+
const pathRest = intermediate.substring(2);
|
|
25740
|
+
const basePath = options?.basePath ?? process.cwd();
|
|
25741
|
+
const normalizedBase = basePath.replace(/\\/g, "/");
|
|
25742
|
+
if (hasDriveLetter(normalizedBase)) {
|
|
25743
|
+
const baseDrive = normalizedBase.substring(0, 2).toLowerCase();
|
|
25744
|
+
if (baseDrive === pathDrive) {
|
|
25745
|
+
const baseRest = normalizedBase.substring(2) || "/";
|
|
25746
|
+
const resolved = path2.posix.resolve(baseRest, pathRest);
|
|
25747
|
+
intermediate = pathDrive + resolved;
|
|
25748
|
+
} else {
|
|
25749
|
+
intermediate = pathDrive + "/" + pathRest;
|
|
25750
|
+
}
|
|
25751
|
+
} else {
|
|
25752
|
+
intermediate = pathDrive + "/" + pathRest;
|
|
25753
|
+
}
|
|
25754
|
+
}
|
|
25755
|
+
if (originalIsUNC || isUNC(intermediate)) {
|
|
25756
|
+
const withoutPrefix = intermediate.substring(2);
|
|
25757
|
+
const normalizedRest = path2.posix.normalize(withoutPrefix);
|
|
25758
|
+
intermediate = "//" + normalizedRest;
|
|
25759
|
+
} else if (hasWindowsDrive || hasDriveLetter(intermediate)) {
|
|
25760
|
+
const drive = intermediate.substring(0, 2);
|
|
25761
|
+
let rest = intermediate.substring(2);
|
|
25762
|
+
if (!rest.startsWith("/")) {
|
|
25763
|
+
rest = "/" + rest;
|
|
25764
|
+
}
|
|
25765
|
+
const normalizedRest = path2.posix.normalize(rest);
|
|
25766
|
+
intermediate = drive + normalizedRest;
|
|
25617
25767
|
} else {
|
|
25618
|
-
|
|
25768
|
+
intermediate = path2.posix.normalize(intermediate);
|
|
25769
|
+
}
|
|
25770
|
+
const finalHasDrive = hasDriveLetter(intermediate);
|
|
25771
|
+
const finalIsUNC = isUNC(intermediate);
|
|
25772
|
+
if (finalHasDrive || finalIsUNC) {
|
|
25773
|
+
intermediate = intermediate.toLowerCase();
|
|
25774
|
+
const segments = intermediate.split("/");
|
|
25775
|
+
const normalizedSegments = segments.map((segment, index) => {
|
|
25776
|
+
if (index === 0 || segment === "") {
|
|
25777
|
+
return segment;
|
|
25778
|
+
}
|
|
25779
|
+
return segment.replace(/[\s.]+$/, "");
|
|
25780
|
+
});
|
|
25781
|
+
intermediate = normalizedSegments.join("/");
|
|
25782
|
+
}
|
|
25783
|
+
if (intermediate.length > 1 && intermediate.endsWith("/")) {
|
|
25784
|
+
const isWindowsRoot = finalHasDrive && intermediate.length === 3;
|
|
25785
|
+
const isPosixRoot = intermediate === "/";
|
|
25786
|
+
const isUNCRoot = finalIsUNC && intermediate.split("/").filter(Boolean).length <= 2;
|
|
25787
|
+
if (!isWindowsRoot && !isPosixRoot && !isUNCRoot) {
|
|
25788
|
+
intermediate = intermediate.slice(0, -1);
|
|
25789
|
+
}
|
|
25790
|
+
}
|
|
25791
|
+
if (finalHasDrive && intermediate.length === 2) {
|
|
25792
|
+
intermediate = intermediate + "/";
|
|
25793
|
+
}
|
|
25794
|
+
return intermediate;
|
|
25795
|
+
}
|
|
25796
|
+
// src/utils/arg-normalizer.ts
|
|
25797
|
+
function toPlainObject(value) {
|
|
25798
|
+
if (typeof value === "string") {
|
|
25799
|
+
try {
|
|
25800
|
+
const parsed = JSON.parse(value);
|
|
25801
|
+
if (parsed && typeof parsed === "object")
|
|
25802
|
+
return parsed;
|
|
25803
|
+
} catch {
|
|
25804
|
+
return { title: value };
|
|
25805
|
+
}
|
|
25806
|
+
}
|
|
25807
|
+
if (value && typeof value === "object")
|
|
25808
|
+
return value;
|
|
25809
|
+
return {};
|
|
25810
|
+
}
|
|
25811
|
+
function coerceBoolean(v) {
|
|
25812
|
+
if (typeof v === "boolean")
|
|
25813
|
+
return v;
|
|
25814
|
+
if (typeof v === "string") {
|
|
25815
|
+
const s = v.trim().toLowerCase();
|
|
25816
|
+
if (["true", "t", "1", "yes", "y"].includes(s))
|
|
25817
|
+
return true;
|
|
25818
|
+
if (["false", "f", "0", "no", "n"].includes(s))
|
|
25819
|
+
return false;
|
|
25820
|
+
}
|
|
25821
|
+
if (typeof v === "number")
|
|
25822
|
+
return v !== 0;
|
|
25823
|
+
return;
|
|
25824
|
+
}
|
|
25825
|
+
function coerceNumber(v) {
|
|
25826
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
25827
|
+
return v;
|
|
25828
|
+
if (typeof v === "string") {
|
|
25829
|
+
const n = Number(v);
|
|
25830
|
+
if (!Number.isNaN(n))
|
|
25831
|
+
return n;
|
|
25832
|
+
}
|
|
25833
|
+
return;
|
|
25834
|
+
}
|
|
25835
|
+
function normalizeStatus(v) {
|
|
25836
|
+
if (typeof v !== "string")
|
|
25837
|
+
return;
|
|
25838
|
+
const s = v.trim().toLowerCase().replace(/\s+/g, "_").replace(/-+/g, "_");
|
|
25839
|
+
const allowed = new Set(["open", "in_progress", "blocked", "closed"]);
|
|
25840
|
+
if (allowed.has(s))
|
|
25841
|
+
return s;
|
|
25842
|
+
return;
|
|
25843
|
+
}
|
|
25844
|
+
function normalizeType(v) {
|
|
25845
|
+
if (typeof v !== "string")
|
|
25846
|
+
return;
|
|
25847
|
+
const s = v.trim().toLowerCase();
|
|
25848
|
+
const allowed = new Set(["bug", "feature", "task", "epic", "chore"]);
|
|
25849
|
+
if (allowed.has(s))
|
|
25850
|
+
return s;
|
|
25851
|
+
return;
|
|
25852
|
+
}
|
|
25853
|
+
function pick2(obj, keys) {
|
|
25854
|
+
const out = {};
|
|
25855
|
+
for (const k of keys)
|
|
25856
|
+
if (k in obj)
|
|
25857
|
+
out[k] = obj[k];
|
|
25858
|
+
return out;
|
|
25859
|
+
}
|
|
25860
|
+
function aliasCommonKeys(obj) {
|
|
25861
|
+
const out = { ...obj };
|
|
25862
|
+
const move = (from, to) => {
|
|
25863
|
+
if (out[from] !== undefined && out[to] === undefined) {
|
|
25864
|
+
out[to] = out[from];
|
|
25865
|
+
delete out[from];
|
|
25866
|
+
}
|
|
25867
|
+
};
|
|
25868
|
+
move("cell_id", "id");
|
|
25869
|
+
move("bead_id", "id");
|
|
25870
|
+
move("beadId", "id");
|
|
25871
|
+
move("parentId", "parent_id");
|
|
25872
|
+
move("issue_type", "type");
|
|
25873
|
+
move("issueType", "type");
|
|
25874
|
+
move("kind", "type");
|
|
25875
|
+
move("epicTitle", "epic_title");
|
|
25876
|
+
move("epicDescription", "epic_description");
|
|
25877
|
+
move("subTasks", "subtasks");
|
|
25878
|
+
move("tasks", "subtasks");
|
|
25879
|
+
move("items", "subtasks");
|
|
25880
|
+
move("idSuffix", "id_suffix");
|
|
25881
|
+
return out;
|
|
25882
|
+
}
|
|
25883
|
+
function normalizeCreateArgs(raw) {
|
|
25884
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
25885
|
+
if (typeof raw === "string" && !obj.title)
|
|
25886
|
+
obj.title = String(raw);
|
|
25887
|
+
if (obj.priority !== undefined)
|
|
25888
|
+
obj.priority = coerceNumber(obj.priority);
|
|
25889
|
+
if (obj.type !== undefined)
|
|
25890
|
+
obj.type = normalizeType(obj.type) ?? obj.type;
|
|
25891
|
+
if (obj.parent_id !== undefined)
|
|
25892
|
+
obj.parent_id = String(obj.parent_id);
|
|
25893
|
+
return pick2(obj, ["title", "type", "priority", "description", "parent_id"]);
|
|
25894
|
+
}
|
|
25895
|
+
function normalizeUpdateArgs(raw) {
|
|
25896
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
25897
|
+
if (obj.status !== undefined)
|
|
25898
|
+
obj.status = normalizeStatus(obj.status) ?? obj.status;
|
|
25899
|
+
if (obj.priority !== undefined)
|
|
25900
|
+
obj.priority = coerceNumber(obj.priority);
|
|
25901
|
+
if (obj.description !== undefined && obj.description != null)
|
|
25902
|
+
obj.description = String(obj.description);
|
|
25903
|
+
if (obj.id !== undefined)
|
|
25904
|
+
obj.id = String(obj.id);
|
|
25905
|
+
return pick2(obj, ["id", "status", "description", "priority"]);
|
|
25906
|
+
}
|
|
25907
|
+
function normalizeCloseArgs(raw) {
|
|
25908
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
25909
|
+
if (obj.id !== undefined)
|
|
25910
|
+
obj.id = String(obj.id);
|
|
25911
|
+
if (obj.reason !== undefined)
|
|
25912
|
+
obj.reason = String(obj.reason);
|
|
25913
|
+
return pick2(obj, ["id", "reason"]);
|
|
25914
|
+
}
|
|
25915
|
+
function normalizeQueryArgs(raw) {
|
|
25916
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
25917
|
+
if (obj.status !== undefined)
|
|
25918
|
+
obj.status = normalizeStatus(obj.status) ?? obj.status;
|
|
25919
|
+
if (obj.type !== undefined)
|
|
25920
|
+
obj.type = normalizeType(obj.type) ?? obj.type;
|
|
25921
|
+
if (obj.ready !== undefined)
|
|
25922
|
+
obj.ready = coerceBoolean(obj.ready);
|
|
25923
|
+
if (obj.parent_id !== undefined)
|
|
25924
|
+
obj.parent_id = String(obj.parent_id);
|
|
25925
|
+
if (obj.limit !== undefined)
|
|
25926
|
+
obj.limit = coerceNumber(obj.limit);
|
|
25927
|
+
return pick2(obj, ["status", "type", "ready", "parent_id", "limit"]);
|
|
25928
|
+
}
|
|
25929
|
+
function normalizeCellsArgs(raw) {
|
|
25930
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
25931
|
+
if (obj.id !== undefined)
|
|
25932
|
+
obj.id = String(obj.id);
|
|
25933
|
+
if (obj.status !== undefined)
|
|
25934
|
+
obj.status = normalizeStatus(obj.status) ?? obj.status;
|
|
25935
|
+
if (obj.type !== undefined)
|
|
25936
|
+
obj.type = normalizeType(obj.type) ?? obj.type;
|
|
25937
|
+
if (obj.parent_id !== undefined)
|
|
25938
|
+
obj.parent_id = String(obj.parent_id);
|
|
25939
|
+
if (obj.ready !== undefined)
|
|
25940
|
+
obj.ready = coerceBoolean(obj.ready);
|
|
25941
|
+
if (obj.limit !== undefined)
|
|
25942
|
+
obj.limit = coerceNumber(obj.limit);
|
|
25943
|
+
return pick2(obj, ["id", "status", "type", "parent_id", "ready", "limit"]);
|
|
25944
|
+
}
|
|
25945
|
+
function normalizeEpicCreateArgs(raw) {
|
|
25946
|
+
const obj0 = aliasCommonKeys(toPlainObject(raw));
|
|
25947
|
+
const obj = { ...obj0 };
|
|
25948
|
+
if (obj.subtasks !== undefined && !Array.isArray(obj.subtasks)) {
|
|
25949
|
+
if (typeof obj.subtasks === "string")
|
|
25950
|
+
obj.subtasks = obj.subtasks.split(/[,\n]/).map((s) => ({ title: s.trim() })).filter((x) => x.title);
|
|
25951
|
+
else if (obj.subtasks && typeof obj.subtasks === "object")
|
|
25952
|
+
obj.subtasks = [obj.subtasks];
|
|
25953
|
+
}
|
|
25954
|
+
if (Array.isArray(obj.subtasks)) {
|
|
25955
|
+
obj.subtasks = obj.subtasks.map((st) => {
|
|
25956
|
+
if (typeof st === "string")
|
|
25957
|
+
return { title: st };
|
|
25958
|
+
const s = aliasCommonKeys(toPlainObject(st));
|
|
25959
|
+
if (s.priority !== undefined)
|
|
25960
|
+
s.priority = coerceNumber(s.priority);
|
|
25961
|
+
if (s.files && !Array.isArray(s.files))
|
|
25962
|
+
s.files = [String(s.files)];
|
|
25963
|
+
if (Array.isArray(s.files))
|
|
25964
|
+
s.files = s.files.map((p) => String(p));
|
|
25965
|
+
return pick2(s, ["title", "priority", "files", "id_suffix"]);
|
|
25966
|
+
});
|
|
25619
25967
|
}
|
|
25968
|
+
if (obj.epic_title === undefined && typeof raw === "string")
|
|
25969
|
+
obj.epic_title = String(raw);
|
|
25970
|
+
if (obj.epic_description !== undefined)
|
|
25971
|
+
obj.epic_description = String(obj.epic_description);
|
|
25972
|
+
return pick2(obj, ["epic_title", "epic_description", "epic_id", "subtasks", "strategy", "task", "project_key", "recovery_context"]);
|
|
25973
|
+
}
|
|
25974
|
+
function formatZodError(toolName, err, example) {
|
|
25975
|
+
const issues = err.issues.map((i) => `- ${i.path.join(".") || "<root>"}: ${i.message}`).join(`
|
|
25976
|
+
`);
|
|
25977
|
+
const guidance = `How to fix:
|
|
25978
|
+
1) Check field names (snake_case expected).
|
|
25979
|
+
2) Coercions allowed: booleans as 'true/false', numbers as strings, status 'in-progress' -> 'in_progress'.
|
|
25980
|
+
3) Remove unknown fields or typos.`;
|
|
25981
|
+
const sample = example ? `
|
|
25982
|
+
|
|
25983
|
+
Example:
|
|
25984
|
+
${example}` : "";
|
|
25985
|
+
return `${toolName}: Invalid arguments.
|
|
25986
|
+
${issues}
|
|
25987
|
+
|
|
25988
|
+
${guidance}${sample}`;
|
|
25620
25989
|
}
|
|
25621
25990
|
|
|
25622
25991
|
// src/hive.ts
|
|
@@ -26201,6 +26570,25 @@ async function runGitCommand(args) {
|
|
|
26201
26570
|
const exitCode = await proc.exited;
|
|
26202
26571
|
return { exitCode, stdout, stderr };
|
|
26203
26572
|
}
|
|
26573
|
+
async function withRetry(operation, retries = 3, delayMs = 100) {
|
|
26574
|
+
let lastError;
|
|
26575
|
+
for (let attempt = 0;attempt <= retries; attempt++) {
|
|
26576
|
+
try {
|
|
26577
|
+
return await operation();
|
|
26578
|
+
} catch (err) {
|
|
26579
|
+
lastError = err;
|
|
26580
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
26581
|
+
if (attempt < retries && (message.includes("SQLITE_BUSY") || message.includes("SQLITE_BUSY_RECOVERY") || message.includes("database is locked"))) {
|
|
26582
|
+
await new Promise((r) => setTimeout(r, delayMs * (attempt + 1)));
|
|
26583
|
+
continue;
|
|
26584
|
+
}
|
|
26585
|
+
break;
|
|
26586
|
+
}
|
|
26587
|
+
}
|
|
26588
|
+
if (lastError instanceof Error)
|
|
26589
|
+
throw lastError;
|
|
26590
|
+
throw new Error(String(lastError));
|
|
26591
|
+
}
|
|
26204
26592
|
|
|
26205
26593
|
class HiveError extends Error {
|
|
26206
26594
|
command;
|
|
@@ -26226,8 +26614,8 @@ class HiveValidationError extends Error {
|
|
|
26226
26614
|
}
|
|
26227
26615
|
var BeadValidationError = HiveValidationError;
|
|
26228
26616
|
function checkBeadsMigrationNeeded(projectPath) {
|
|
26229
|
-
const beadsDir =
|
|
26230
|
-
const hiveDir =
|
|
26617
|
+
const beadsDir = normalize(join2(projectPath, ".beads"));
|
|
26618
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
26231
26619
|
if (existsSync2(hiveDir)) {
|
|
26232
26620
|
return { needed: false };
|
|
26233
26621
|
}
|
|
@@ -26237,8 +26625,8 @@ function checkBeadsMigrationNeeded(projectPath) {
|
|
|
26237
26625
|
return { needed: false };
|
|
26238
26626
|
}
|
|
26239
26627
|
async function migrateBeadsToHive(projectPath) {
|
|
26240
|
-
const beadsDir =
|
|
26241
|
-
const hiveDir =
|
|
26628
|
+
const beadsDir = normalize(join2(projectPath, ".beads"));
|
|
26629
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
26242
26630
|
if (existsSync2(hiveDir)) {
|
|
26243
26631
|
return {
|
|
26244
26632
|
migrated: false,
|
|
@@ -26256,7 +26644,7 @@ async function migrateBeadsToHive(projectPath) {
|
|
|
26256
26644
|
return { migrated: true };
|
|
26257
26645
|
}
|
|
26258
26646
|
function ensureHiveDirectory(projectPath) {
|
|
26259
|
-
const hiveDir =
|
|
26647
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
26260
26648
|
if (!existsSync2(hiveDir)) {
|
|
26261
26649
|
const { mkdirSync: mkdirSync2 } = __require("node:fs");
|
|
26262
26650
|
mkdirSync2(hiveDir, { recursive: true });
|
|
@@ -26264,9 +26652,9 @@ function ensureHiveDirectory(projectPath) {
|
|
|
26264
26652
|
}
|
|
26265
26653
|
async function mergeHistoricBeads(projectPath) {
|
|
26266
26654
|
const { readFileSync: readFileSync3, writeFileSync: writeFileSync2, existsSync: existsSync3 } = await import("node:fs");
|
|
26267
|
-
const hiveDir =
|
|
26268
|
-
const basePath =
|
|
26269
|
-
const issuesPath =
|
|
26655
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
26656
|
+
const basePath = normalize(join2(hiveDir, "beads.base.jsonl"));
|
|
26657
|
+
const issuesPath = normalize(join2(hiveDir, "issues.jsonl"));
|
|
26270
26658
|
if (!existsSync3(basePath)) {
|
|
26271
26659
|
return { merged: 0, skipped: 0 };
|
|
26272
26660
|
}
|
|
@@ -26298,7 +26686,7 @@ async function mergeHistoricBeads(projectPath) {
|
|
|
26298
26686
|
writeFileSync2(issuesPath, mergedContent, "utf-8");
|
|
26299
26687
|
return { merged, skipped };
|
|
26300
26688
|
}
|
|
26301
|
-
async function
|
|
26689
|
+
async function importJsonlToLibSQL(projectPath) {
|
|
26302
26690
|
const jsonlPath = join2(projectPath, ".hive", "issues.jsonl");
|
|
26303
26691
|
if (!existsSync2(jsonlPath)) {
|
|
26304
26692
|
return { imported: 0, updated: 0, errors: 0 };
|
|
@@ -26366,6 +26754,7 @@ async function importJsonlToPGLite(projectPath) {
|
|
|
26366
26754
|
}
|
|
26367
26755
|
return { imported, updated, errors: errors5 };
|
|
26368
26756
|
}
|
|
26757
|
+
var importJsonlToPGLite = importJsonlToLibSQL;
|
|
26369
26758
|
var adapterCache = new Map;
|
|
26370
26759
|
var exitHookRegistered = false;
|
|
26371
26760
|
var exitHookRunning = false;
|
|
@@ -26471,7 +26860,19 @@ var hive_create = tool({
|
|
|
26471
26860
|
parent_id: tool.schema.string().optional().describe("Parent cell ID for epic children")
|
|
26472
26861
|
},
|
|
26473
26862
|
async execute(args, ctx) {
|
|
26474
|
-
const
|
|
26863
|
+
const normalized = normalizeCreateArgs(args);
|
|
26864
|
+
const parsed = CellCreateArgsSchema.safeParse(normalized);
|
|
26865
|
+
if (!parsed.success) {
|
|
26866
|
+
const message = formatZodError("hive_create", parsed.error, `{
|
|
26867
|
+
"title": "Fix login bug",
|
|
26868
|
+
"type": "bug",
|
|
26869
|
+
"priority": 2,
|
|
26870
|
+
"description": "Null check on session token",
|
|
26871
|
+
"parent_id": "project-abc12"
|
|
26872
|
+
}`);
|
|
26873
|
+
throw new HiveValidationError(message, parsed.error);
|
|
26874
|
+
}
|
|
26875
|
+
const validated = parsed.data;
|
|
26475
26876
|
const projectKey = getHiveWorkingDirectory();
|
|
26476
26877
|
const adapter = await getHiveAdapter(projectKey);
|
|
26477
26878
|
try {
|
|
@@ -26527,7 +26928,20 @@ var hive_create_epic = tool({
|
|
|
26527
26928
|
}).optional().describe("Recovery context from checkpoint compaction")
|
|
26528
26929
|
},
|
|
26529
26930
|
async execute(args, ctx) {
|
|
26530
|
-
const
|
|
26931
|
+
const normalized = normalizeEpicCreateArgs(args);
|
|
26932
|
+
const parsed = EpicCreateArgsSchema.safeParse(normalized);
|
|
26933
|
+
if (!parsed.success) {
|
|
26934
|
+
const message = formatZodError("hive_create_epic", parsed.error, `{
|
|
26935
|
+
"epic_title": "Ship new Auth",
|
|
26936
|
+
"epic_description": "Auth overhaul with passwordless",
|
|
26937
|
+
"subtasks": [
|
|
26938
|
+
{ "title": "DB migration", "priority": 1 },
|
|
26939
|
+
{ "title": "Add magic links", "priority": 2 }
|
|
26940
|
+
]
|
|
26941
|
+
}`);
|
|
26942
|
+
throw new HiveValidationError(message, parsed.error);
|
|
26943
|
+
}
|
|
26944
|
+
const validated = parsed.data;
|
|
26531
26945
|
const projectKey = getHiveWorkingDirectory();
|
|
26532
26946
|
const adapter = await getHiveAdapter(projectKey);
|
|
26533
26947
|
const created = [];
|
|
@@ -26550,12 +26964,21 @@ var hive_create_epic = tool({
|
|
|
26550
26964
|
await adapter.markDirty(projectKey, subtaskCell.id);
|
|
26551
26965
|
created.push(subtaskCell);
|
|
26552
26966
|
}
|
|
26967
|
+
try {
|
|
26968
|
+
const children = await adapter.queryCells(projectKey, { parent_id: epic.id });
|
|
26969
|
+
if (children.length !== validated.subtasks.length) {
|
|
26970
|
+
throw new Error(`Post-create validation failed: expected ${validated.subtasks.length} subtasks, found ${children.length}`);
|
|
26971
|
+
}
|
|
26972
|
+
} catch (e) {
|
|
26973
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
26974
|
+
throw new Error(`Epic integrity check failed: ${msg}`);
|
|
26975
|
+
}
|
|
26553
26976
|
const result = {
|
|
26554
26977
|
success: true,
|
|
26555
26978
|
epic: formatCellForOutput(epic),
|
|
26556
26979
|
subtasks: created.slice(1).map((c) => formatCellForOutput(c))
|
|
26557
26980
|
};
|
|
26558
|
-
const effectiveProjectKey =
|
|
26981
|
+
const effectiveProjectKey = normalized.project_key || projectKey;
|
|
26559
26982
|
try {
|
|
26560
26983
|
const epicCreatedEvent = createEvent("epic_created", {
|
|
26561
26984
|
project_key: effectiveProjectKey,
|
|
@@ -26573,16 +26996,16 @@ var hive_create_epic = tool({
|
|
|
26573
26996
|
const event = createEvent("decomposition_generated", {
|
|
26574
26997
|
project_key: effectiveProjectKey,
|
|
26575
26998
|
epic_id: epic.id,
|
|
26576
|
-
task:
|
|
26999
|
+
task: normalized.task || validated.epic_title,
|
|
26577
27000
|
context: validated.epic_description,
|
|
26578
|
-
strategy:
|
|
27001
|
+
strategy: normalized.strategy || "feature-based",
|
|
26579
27002
|
epic_title: validated.epic_title,
|
|
26580
27003
|
subtasks: validated.subtasks.map((st) => ({
|
|
26581
27004
|
title: st.title,
|
|
26582
27005
|
files: st.files || [],
|
|
26583
27006
|
priority: st.priority
|
|
26584
27007
|
})),
|
|
26585
|
-
recovery_context:
|
|
27008
|
+
recovery_context: normalized.recovery_context
|
|
26586
27009
|
});
|
|
26587
27010
|
await appendEvent(event, effectiveProjectKey);
|
|
26588
27011
|
} catch (error89) {
|
|
@@ -26594,7 +27017,7 @@ var hive_create_epic = tool({
|
|
|
26594
27017
|
project_key: effectiveProjectKey,
|
|
26595
27018
|
epic_id: epic.id,
|
|
26596
27019
|
epic_title: validated.epic_title,
|
|
26597
|
-
strategy:
|
|
27020
|
+
strategy: normalized.strategy || "feature-based",
|
|
26598
27021
|
subtask_count: validated.subtasks.length,
|
|
26599
27022
|
total_files: totalFiles,
|
|
26600
27023
|
coordinator_agent: "coordinator"
|
|
@@ -26619,10 +27042,10 @@ var hive_create_epic = tool({
|
|
|
26619
27042
|
decision_type: "decomposition_complete",
|
|
26620
27043
|
payload: {
|
|
26621
27044
|
subtask_count: validated.subtasks.length,
|
|
26622
|
-
strategy_used:
|
|
27045
|
+
strategy_used: normalized.strategy || "feature-based",
|
|
26623
27046
|
files_per_subtask: filesPerSubtask,
|
|
26624
27047
|
epic_title: validated.epic_title,
|
|
26625
|
-
task:
|
|
27048
|
+
task: normalized.task
|
|
26626
27049
|
}
|
|
26627
27050
|
});
|
|
26628
27051
|
} catch (error89) {
|
|
@@ -26678,7 +27101,18 @@ var hive_query = tool({
|
|
|
26678
27101
|
limit: tool.schema.number().optional().describe("Max results to return (default: 20)")
|
|
26679
27102
|
},
|
|
26680
27103
|
async execute(args, ctx) {
|
|
26681
|
-
const
|
|
27104
|
+
const normalized = normalizeQueryArgs(args);
|
|
27105
|
+
const parsed = CellQueryArgsSchema.safeParse(normalized);
|
|
27106
|
+
if (!parsed.success) {
|
|
27107
|
+
const message = formatZodError("hive_query", parsed.error, `{
|
|
27108
|
+
"status": "in_progress",
|
|
27109
|
+
"type": "task",
|
|
27110
|
+
"parent_id": "project-abc12",
|
|
27111
|
+
"limit": 10
|
|
27112
|
+
}`);
|
|
27113
|
+
throw new HiveValidationError(message, parsed.error);
|
|
27114
|
+
}
|
|
27115
|
+
const validated = parsed.data;
|
|
26682
27116
|
const projectKey = getHiveWorkingDirectory();
|
|
26683
27117
|
const adapter = await getHiveAdapter(projectKey);
|
|
26684
27118
|
try {
|
|
@@ -26711,20 +27145,32 @@ var hive_update = tool({
|
|
|
26711
27145
|
priority: tool.schema.number().min(0).max(3).optional().describe("New priority")
|
|
26712
27146
|
},
|
|
26713
27147
|
async execute(args, ctx) {
|
|
26714
|
-
const
|
|
27148
|
+
const normalized = normalizeUpdateArgs(args);
|
|
27149
|
+
const parsed = CellUpdateArgsSchema.safeParse(normalized);
|
|
27150
|
+
if (!parsed.success) {
|
|
27151
|
+
const message = formatZodError("hive_update", parsed.error, `{
|
|
27152
|
+
"id": "project-abc12",
|
|
27153
|
+
"status": "in_progress",
|
|
27154
|
+
"priority": 1,
|
|
27155
|
+
"description": "Ready for review"
|
|
27156
|
+
}`);
|
|
27157
|
+
throw new HiveValidationError(message, parsed.error);
|
|
27158
|
+
}
|
|
27159
|
+
const validated = parsed.data;
|
|
26715
27160
|
const projectKey = getHiveWorkingDirectory();
|
|
26716
27161
|
const adapter = await getHiveAdapter(projectKey);
|
|
26717
27162
|
try {
|
|
26718
27163
|
const cellId = await resolvePartialId(adapter, projectKey, validated.id) || validated.id;
|
|
26719
27164
|
let cell;
|
|
26720
|
-
if (validated.status) {
|
|
26721
|
-
|
|
27165
|
+
if (validated.status !== undefined) {
|
|
27166
|
+
const newStatus = validated.status;
|
|
27167
|
+
cell = await withRetry(() => adapter.changeCellStatus(projectKey, cellId, newStatus));
|
|
26722
27168
|
}
|
|
26723
27169
|
if (validated.description !== undefined || validated.priority !== undefined) {
|
|
26724
|
-
cell = await adapter.updateCell(projectKey, cellId, {
|
|
27170
|
+
cell = await withRetry(() => adapter.updateCell(projectKey, cellId, {
|
|
26725
27171
|
description: validated.description,
|
|
26726
27172
|
priority: validated.priority
|
|
26727
|
-
});
|
|
27173
|
+
}));
|
|
26728
27174
|
} else if (!validated.status) {
|
|
26729
27175
|
const existingCell = await adapter.getCell(projectKey, cellId);
|
|
26730
27176
|
if (!existingCell) {
|
|
@@ -26771,14 +27217,23 @@ var hive_close = tool({
|
|
|
26771
27217
|
reason: tool.schema.string().describe("Completion reason")
|
|
26772
27218
|
},
|
|
26773
27219
|
async execute(args, ctx) {
|
|
26774
|
-
const
|
|
27220
|
+
const normalized = normalizeCloseArgs(args);
|
|
27221
|
+
const parsed = CellCloseArgsSchema.safeParse(normalized);
|
|
27222
|
+
if (!parsed.success) {
|
|
27223
|
+
const message = formatZodError("hive_close", parsed.error, `{
|
|
27224
|
+
"id": "project-abc12",
|
|
27225
|
+
"reason": "Merged in main"
|
|
27226
|
+
}`);
|
|
27227
|
+
throw new HiveValidationError(message, parsed.error);
|
|
27228
|
+
}
|
|
27229
|
+
const validated = parsed.data;
|
|
26775
27230
|
const projectKey = getHiveWorkingDirectory();
|
|
26776
27231
|
const adapter = await getHiveAdapter(projectKey);
|
|
26777
27232
|
try {
|
|
26778
27233
|
const cellId = await resolvePartialId(adapter, projectKey, validated.id) || validated.id;
|
|
26779
27234
|
const cellBeforeClose = await adapter.getCell(projectKey, cellId);
|
|
26780
27235
|
const isEpic = cellBeforeClose?.type === "epic";
|
|
26781
|
-
const cell = await adapter.closeCell(projectKey, cellId, validated.reason);
|
|
27236
|
+
const cell = await withRetry(() => adapter.closeCell(projectKey, cellId, validated.reason));
|
|
26782
27237
|
await adapter.markDirty(projectKey, cellId);
|
|
26783
27238
|
if (isEpic && cellBeforeClose) {
|
|
26784
27239
|
try {
|
|
@@ -26899,7 +27354,7 @@ var hive_start = tool({
|
|
|
26899
27354
|
const adapter = await getHiveAdapter(projectKey);
|
|
26900
27355
|
try {
|
|
26901
27356
|
const cellId = await resolvePartialId(adapter, projectKey, args.id) || args.id;
|
|
26902
|
-
const cell = await adapter.changeCellStatus(projectKey, cellId, "in_progress");
|
|
27357
|
+
const cell = await withRetry(() => adapter.changeCellStatus(projectKey, cellId, "in_progress"));
|
|
26903
27358
|
await adapter.markDirty(projectKey, cellId);
|
|
26904
27359
|
try {
|
|
26905
27360
|
const event = createEvent("cell_status_changed", {
|
|
@@ -26974,16 +27429,17 @@ PREFER THIS OVER hive_query when you need to:
|
|
|
26974
27429
|
async execute(args, ctx) {
|
|
26975
27430
|
const projectKey = getHiveWorkingDirectory();
|
|
26976
27431
|
const adapter = await getHiveAdapter(projectKey);
|
|
27432
|
+
const normalized = normalizeCellsArgs(args);
|
|
26977
27433
|
try {
|
|
26978
|
-
if (
|
|
26979
|
-
const matchingCells = await findCellsByPartialId(adapter, projectKey,
|
|
27434
|
+
if (normalized.id) {
|
|
27435
|
+
const matchingCells = await findCellsByPartialId(adapter, projectKey, normalized.id);
|
|
26980
27436
|
if (matchingCells.length === 0) {
|
|
26981
|
-
throw new HiveError(`No cell found matching ID '${
|
|
27437
|
+
throw new HiveError(`No cell found matching ID '${normalized.id}'`, "hive_cells");
|
|
26982
27438
|
}
|
|
26983
27439
|
const formatted2 = matchingCells.map((c) => formatCellForOutput(c));
|
|
26984
27440
|
return JSON.stringify(formatted2, null, 2);
|
|
26985
27441
|
}
|
|
26986
|
-
if (
|
|
27442
|
+
if (normalized.ready) {
|
|
26987
27443
|
const ready = await adapter.getNextReadyCell(projectKey);
|
|
26988
27444
|
if (!ready) {
|
|
26989
27445
|
return JSON.stringify([], null, 2);
|
|
@@ -26992,10 +27448,10 @@ PREFER THIS OVER hive_query when you need to:
|
|
|
26992
27448
|
return JSON.stringify([formatted2], null, 2);
|
|
26993
27449
|
}
|
|
26994
27450
|
const cells = await adapter.queryCells(projectKey, {
|
|
26995
|
-
status:
|
|
26996
|
-
type:
|
|
26997
|
-
parent_id:
|
|
26998
|
-
limit:
|
|
27451
|
+
status: normalized.status,
|
|
27452
|
+
type: normalized.type,
|
|
27453
|
+
parent_id: normalized.parent_id,
|
|
27454
|
+
limit: normalized.limit || 20
|
|
26999
27455
|
});
|
|
27000
27456
|
const formatted = cells.map((c) => formatCellForOutput(c));
|
|
27001
27457
|
return JSON.stringify(formatted, null, 2);
|
|
@@ -27005,7 +27461,7 @@ PREFER THIS OVER hive_query when you need to:
|
|
|
27005
27461
|
}
|
|
27006
27462
|
const message = error89 instanceof Error ? error89.message : String(error89);
|
|
27007
27463
|
if (message.includes("Bead not found") || message.includes("Cell not found")) {
|
|
27008
|
-
throw new HiveError(`No cell found matching ID '${
|
|
27464
|
+
throw new HiveError(`No cell found matching ID '${normalized.id || "unknown"}'`, "hive_cells");
|
|
27009
27465
|
}
|
|
27010
27466
|
throw new HiveError(`Failed to query cells: ${message}`, "hive_cells");
|
|
27011
27467
|
}
|
|
@@ -27074,6 +27530,14 @@ var hive_sync = tool({
|
|
|
27074
27530
|
const remoteCheckResult2 = await runGitCommand(["remote"]);
|
|
27075
27531
|
const hasRemote2 = remoteCheckResult2.stdout.trim() !== "";
|
|
27076
27532
|
if (hasRemote2) {
|
|
27533
|
+
await withTimeout(runGitCommand(["fetch", "--all", "--prune"]), TIMEOUT_MS, "git fetch");
|
|
27534
|
+
const upstreamResult = await runGitCommand([
|
|
27535
|
+
"rev-parse",
|
|
27536
|
+
"--abbrev-ref",
|
|
27537
|
+
"--symbolic-full-name",
|
|
27538
|
+
"@{u}"
|
|
27539
|
+
]);
|
|
27540
|
+
const hasUpstream = upstreamResult.exitCode === 0;
|
|
27077
27541
|
const statusResult = await runGitCommand(["status", "--porcelain"]);
|
|
27078
27542
|
const hasUnstagedChanges = statusResult.stdout.trim() !== "";
|
|
27079
27543
|
let didStash = false;
|
|
@@ -27084,9 +27548,13 @@ var hive_sync = tool({
|
|
|
27084
27548
|
}
|
|
27085
27549
|
}
|
|
27086
27550
|
try {
|
|
27087
|
-
|
|
27088
|
-
|
|
27089
|
-
|
|
27551
|
+
if (hasUpstream) {
|
|
27552
|
+
const pullResult = await withTimeout(runGitCommand(["pull", "--rebase"]), TIMEOUT_MS, "git pull --rebase");
|
|
27553
|
+
if (pullResult.exitCode !== 0) {
|
|
27554
|
+
throw new HiveError(`Failed to pull: ${pullResult.stderr}`, "git pull --rebase", pullResult.exitCode);
|
|
27555
|
+
}
|
|
27556
|
+
} else {
|
|
27557
|
+
console.warn("[hive_sync] No upstream configured for current branch. Skipping pull.");
|
|
27090
27558
|
}
|
|
27091
27559
|
} finally {
|
|
27092
27560
|
if (didStash) {
|
|
@@ -27314,6 +27782,7 @@ export {
|
|
|
27314
27782
|
migrateBeadsToHive,
|
|
27315
27783
|
mergeHistoricBeads,
|
|
27316
27784
|
importJsonlToPGLite,
|
|
27785
|
+
importJsonlToLibSQL,
|
|
27317
27786
|
hive_update,
|
|
27318
27787
|
hive_sync,
|
|
27319
27788
|
hive_start,
|