@hung319/opencode-hive 1.5.2 → 1.5.8
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/README.md +116 -36
- package/dist/index.js +601 -1043
- package/dist/mcp/index.d.ts +0 -2
- package/dist/tools/ast-grep-native.d.ts +2 -1
- package/dist/tools/hive-doctor.d.ts +1 -1
- package/package.json +3 -3
- package/dist/ast-grep-napi.linux-x64-gnu-qdwfscvp.node +0 -0
- package/dist/ast-grep-napi.linux-x64-musl-qnd01z8b.node +0 -0
package/dist/index.js
CHANGED
|
@@ -235,410 +235,6 @@ var require_dist = __commonJS((exports) => {
|
|
|
235
235
|
exports.default = AgentBooster;
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
-
// ../../node_modules/.bun/@ast-grep+napi-linux-x64-musl@0.41.1/node_modules/@ast-grep/napi-linux-x64-musl/ast-grep-napi.linux-x64-musl.node
|
|
239
|
-
var require_ast_grep_napi_linux_x64_musl = __commonJS((exports, module) => {
|
|
240
|
-
module.exports = __require("./ast-grep-napi.linux-x64-musl-qnd01z8b.node");
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// ../../node_modules/.bun/@ast-grep+napi-linux-x64-gnu@0.41.1/node_modules/@ast-grep/napi-linux-x64-gnu/ast-grep-napi.linux-x64-gnu.node
|
|
244
|
-
var require_ast_grep_napi_linux_x64_gnu = __commonJS((exports, module) => {
|
|
245
|
-
module.exports = __require("./ast-grep-napi.linux-x64-gnu-qdwfscvp.node");
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
// ../../node_modules/.bun/@ast-grep+napi@0.41.1/node_modules/@ast-grep/napi/index.js
|
|
249
|
-
var require_napi = __commonJS((exports, module) => {
|
|
250
|
-
var __filename = "/home/runner/work/agent-hive/agent-hive/node_modules/.bun/@ast-grep+napi@0.41.1/node_modules/@ast-grep/napi/index.js";
|
|
251
|
-
var { createRequire: createRequire2 } = __require("node:module");
|
|
252
|
-
__require = createRequire2(__filename);
|
|
253
|
-
var { readFileSync: readFileSync5 } = __require("node:fs");
|
|
254
|
-
var nativeBinding = null;
|
|
255
|
-
var loadErrors = [];
|
|
256
|
-
var isMusl = () => {
|
|
257
|
-
let musl = false;
|
|
258
|
-
if (process.platform === "linux") {
|
|
259
|
-
musl = isMuslFromFilesystem();
|
|
260
|
-
if (musl === null) {
|
|
261
|
-
musl = isMuslFromReport();
|
|
262
|
-
}
|
|
263
|
-
if (musl === null) {
|
|
264
|
-
musl = isMuslFromChildProcess();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return musl;
|
|
268
|
-
};
|
|
269
|
-
var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
270
|
-
var isMuslFromFilesystem = () => {
|
|
271
|
-
try {
|
|
272
|
-
return readFileSync5("/usr/bin/ldd", "utf-8").includes("musl");
|
|
273
|
-
} catch {
|
|
274
|
-
return null;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
var isMuslFromReport = () => {
|
|
278
|
-
let report = null;
|
|
279
|
-
if (typeof process.report?.getReport === "function") {
|
|
280
|
-
process.report.excludeNetwork = true;
|
|
281
|
-
report = process.report.getReport();
|
|
282
|
-
}
|
|
283
|
-
if (!report) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
if (report.header && report.header.glibcVersionRuntime) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
if (Array.isArray(report.sharedObjects)) {
|
|
290
|
-
if (report.sharedObjects.some(isFileMusl)) {
|
|
291
|
-
return true;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return false;
|
|
295
|
-
};
|
|
296
|
-
var isMuslFromChildProcess = () => {
|
|
297
|
-
try {
|
|
298
|
-
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
|
299
|
-
} catch (e) {
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
function requireNative() {
|
|
304
|
-
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
305
|
-
try {
|
|
306
|
-
nativeBinding = __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
307
|
-
} catch (err) {
|
|
308
|
-
loadErrors.push(err);
|
|
309
|
-
}
|
|
310
|
-
} else if (process.platform === "android") {
|
|
311
|
-
if (process.arch === "arm64") {
|
|
312
|
-
try {
|
|
313
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.android-arm64.node");})();
|
|
314
|
-
} catch (e) {
|
|
315
|
-
loadErrors.push(e);
|
|
316
|
-
}
|
|
317
|
-
try {
|
|
318
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-android-arm64");})();
|
|
319
|
-
} catch (e) {
|
|
320
|
-
loadErrors.push(e);
|
|
321
|
-
}
|
|
322
|
-
} else if (process.arch === "arm") {
|
|
323
|
-
try {
|
|
324
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.android-arm-eabi.node");})();
|
|
325
|
-
} catch (e) {
|
|
326
|
-
loadErrors.push(e);
|
|
327
|
-
}
|
|
328
|
-
try {
|
|
329
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-android-arm-eabi");})();
|
|
330
|
-
} catch (e) {
|
|
331
|
-
loadErrors.push(e);
|
|
332
|
-
}
|
|
333
|
-
} else {
|
|
334
|
-
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
335
|
-
}
|
|
336
|
-
} else if (process.platform === "win32") {
|
|
337
|
-
if (process.arch === "x64") {
|
|
338
|
-
try {
|
|
339
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.win32-x64-msvc.node");})();
|
|
340
|
-
} catch (e) {
|
|
341
|
-
loadErrors.push(e);
|
|
342
|
-
}
|
|
343
|
-
try {
|
|
344
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-win32-x64-msvc");})();
|
|
345
|
-
} catch (e) {
|
|
346
|
-
loadErrors.push(e);
|
|
347
|
-
}
|
|
348
|
-
} else if (process.arch === "ia32") {
|
|
349
|
-
try {
|
|
350
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.win32-ia32-msvc.node");})();
|
|
351
|
-
} catch (e) {
|
|
352
|
-
loadErrors.push(e);
|
|
353
|
-
}
|
|
354
|
-
try {
|
|
355
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-win32-ia32-msvc");})();
|
|
356
|
-
} catch (e) {
|
|
357
|
-
loadErrors.push(e);
|
|
358
|
-
}
|
|
359
|
-
} else if (process.arch === "arm64") {
|
|
360
|
-
try {
|
|
361
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.win32-arm64-msvc.node");})();
|
|
362
|
-
} catch (e) {
|
|
363
|
-
loadErrors.push(e);
|
|
364
|
-
}
|
|
365
|
-
try {
|
|
366
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-win32-arm64-msvc");})();
|
|
367
|
-
} catch (e) {
|
|
368
|
-
loadErrors.push(e);
|
|
369
|
-
}
|
|
370
|
-
} else {
|
|
371
|
-
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
372
|
-
}
|
|
373
|
-
} else if (process.platform === "darwin") {
|
|
374
|
-
try {
|
|
375
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.darwin-universal.node");})();
|
|
376
|
-
} catch (e) {
|
|
377
|
-
loadErrors.push(e);
|
|
378
|
-
}
|
|
379
|
-
try {
|
|
380
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-darwin-universal");})();
|
|
381
|
-
} catch (e) {
|
|
382
|
-
loadErrors.push(e);
|
|
383
|
-
}
|
|
384
|
-
if (process.arch === "x64") {
|
|
385
|
-
try {
|
|
386
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.darwin-x64.node");})();
|
|
387
|
-
} catch (e) {
|
|
388
|
-
loadErrors.push(e);
|
|
389
|
-
}
|
|
390
|
-
try {
|
|
391
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-darwin-x64");})();
|
|
392
|
-
} catch (e) {
|
|
393
|
-
loadErrors.push(e);
|
|
394
|
-
}
|
|
395
|
-
} else if (process.arch === "arm64") {
|
|
396
|
-
try {
|
|
397
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.darwin-arm64.node");})();
|
|
398
|
-
} catch (e) {
|
|
399
|
-
loadErrors.push(e);
|
|
400
|
-
}
|
|
401
|
-
try {
|
|
402
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-darwin-arm64");})();
|
|
403
|
-
} catch (e) {
|
|
404
|
-
loadErrors.push(e);
|
|
405
|
-
}
|
|
406
|
-
} else {
|
|
407
|
-
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
408
|
-
}
|
|
409
|
-
} else if (process.platform === "freebsd") {
|
|
410
|
-
if (process.arch === "x64") {
|
|
411
|
-
try {
|
|
412
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.freebsd-x64.node");})();
|
|
413
|
-
} catch (e) {
|
|
414
|
-
loadErrors.push(e);
|
|
415
|
-
}
|
|
416
|
-
try {
|
|
417
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-freebsd-x64");})();
|
|
418
|
-
} catch (e) {
|
|
419
|
-
loadErrors.push(e);
|
|
420
|
-
}
|
|
421
|
-
} else if (process.arch === "arm64") {
|
|
422
|
-
try {
|
|
423
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.freebsd-arm64.node");})();
|
|
424
|
-
} catch (e) {
|
|
425
|
-
loadErrors.push(e);
|
|
426
|
-
}
|
|
427
|
-
try {
|
|
428
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-freebsd-arm64");})();
|
|
429
|
-
} catch (e) {
|
|
430
|
-
loadErrors.push(e);
|
|
431
|
-
}
|
|
432
|
-
} else {
|
|
433
|
-
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
434
|
-
}
|
|
435
|
-
} else if (process.platform === "linux") {
|
|
436
|
-
if (process.arch === "x64") {
|
|
437
|
-
if (isMusl()) {
|
|
438
|
-
try {
|
|
439
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-x64-musl.node");})();
|
|
440
|
-
} catch (e) {
|
|
441
|
-
loadErrors.push(e);
|
|
442
|
-
}
|
|
443
|
-
try {
|
|
444
|
-
return require_ast_grep_napi_linux_x64_musl();
|
|
445
|
-
} catch (e) {
|
|
446
|
-
loadErrors.push(e);
|
|
447
|
-
}
|
|
448
|
-
} else {
|
|
449
|
-
try {
|
|
450
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-x64-gnu.node");})();
|
|
451
|
-
} catch (e) {
|
|
452
|
-
loadErrors.push(e);
|
|
453
|
-
}
|
|
454
|
-
try {
|
|
455
|
-
return require_ast_grep_napi_linux_x64_gnu();
|
|
456
|
-
} catch (e) {
|
|
457
|
-
loadErrors.push(e);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
} else if (process.arch === "arm64") {
|
|
461
|
-
if (isMusl()) {
|
|
462
|
-
try {
|
|
463
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-arm64-musl.node");})();
|
|
464
|
-
} catch (e) {
|
|
465
|
-
loadErrors.push(e);
|
|
466
|
-
}
|
|
467
|
-
try {
|
|
468
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-arm64-musl");})();
|
|
469
|
-
} catch (e) {
|
|
470
|
-
loadErrors.push(e);
|
|
471
|
-
}
|
|
472
|
-
} else {
|
|
473
|
-
try {
|
|
474
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-arm64-gnu.node");})();
|
|
475
|
-
} catch (e) {
|
|
476
|
-
loadErrors.push(e);
|
|
477
|
-
}
|
|
478
|
-
try {
|
|
479
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-arm64-gnu");})();
|
|
480
|
-
} catch (e) {
|
|
481
|
-
loadErrors.push(e);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
} else if (process.arch === "arm") {
|
|
485
|
-
if (isMusl()) {
|
|
486
|
-
try {
|
|
487
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-arm-musleabihf.node");})();
|
|
488
|
-
} catch (e) {
|
|
489
|
-
loadErrors.push(e);
|
|
490
|
-
}
|
|
491
|
-
try {
|
|
492
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-arm-musleabihf");})();
|
|
493
|
-
} catch (e) {
|
|
494
|
-
loadErrors.push(e);
|
|
495
|
-
}
|
|
496
|
-
} else {
|
|
497
|
-
try {
|
|
498
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-arm-gnueabihf.node");})();
|
|
499
|
-
} catch (e) {
|
|
500
|
-
loadErrors.push(e);
|
|
501
|
-
}
|
|
502
|
-
try {
|
|
503
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-arm-gnueabihf");})();
|
|
504
|
-
} catch (e) {
|
|
505
|
-
loadErrors.push(e);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
} else if (process.arch === "riscv64") {
|
|
509
|
-
if (isMusl()) {
|
|
510
|
-
try {
|
|
511
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-riscv64-musl.node");})();
|
|
512
|
-
} catch (e) {
|
|
513
|
-
loadErrors.push(e);
|
|
514
|
-
}
|
|
515
|
-
try {
|
|
516
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-riscv64-musl");})();
|
|
517
|
-
} catch (e) {
|
|
518
|
-
loadErrors.push(e);
|
|
519
|
-
}
|
|
520
|
-
} else {
|
|
521
|
-
try {
|
|
522
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-riscv64-gnu.node");})();
|
|
523
|
-
} catch (e) {
|
|
524
|
-
loadErrors.push(e);
|
|
525
|
-
}
|
|
526
|
-
try {
|
|
527
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-riscv64-gnu");})();
|
|
528
|
-
} catch (e) {
|
|
529
|
-
loadErrors.push(e);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
} else if (process.arch === "ppc64") {
|
|
533
|
-
try {
|
|
534
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-ppc64-gnu.node");})();
|
|
535
|
-
} catch (e) {
|
|
536
|
-
loadErrors.push(e);
|
|
537
|
-
}
|
|
538
|
-
try {
|
|
539
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-ppc64-gnu");})();
|
|
540
|
-
} catch (e) {
|
|
541
|
-
loadErrors.push(e);
|
|
542
|
-
}
|
|
543
|
-
} else if (process.arch === "s390x") {
|
|
544
|
-
try {
|
|
545
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-s390x-gnu.node");})();
|
|
546
|
-
} catch (e) {
|
|
547
|
-
loadErrors.push(e);
|
|
548
|
-
}
|
|
549
|
-
try {
|
|
550
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-s390x-gnu");})();
|
|
551
|
-
} catch (e) {
|
|
552
|
-
loadErrors.push(e);
|
|
553
|
-
}
|
|
554
|
-
} else {
|
|
555
|
-
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
556
|
-
}
|
|
557
|
-
} else if (process.platform === "openharmony") {
|
|
558
|
-
if (process.arch === "arm64") {
|
|
559
|
-
try {
|
|
560
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-arm64-ohos.node");})();
|
|
561
|
-
} catch (e) {
|
|
562
|
-
loadErrors.push(e);
|
|
563
|
-
}
|
|
564
|
-
try {
|
|
565
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-arm64-ohos");})();
|
|
566
|
-
} catch (e) {
|
|
567
|
-
loadErrors.push(e);
|
|
568
|
-
}
|
|
569
|
-
} else if (process.arch === "x64") {
|
|
570
|
-
try {
|
|
571
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-x64-ohos.node");})();
|
|
572
|
-
} catch (e) {
|
|
573
|
-
loadErrors.push(e);
|
|
574
|
-
}
|
|
575
|
-
try {
|
|
576
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-x64-ohos");})();
|
|
577
|
-
} catch (e) {
|
|
578
|
-
loadErrors.push(e);
|
|
579
|
-
}
|
|
580
|
-
} else if (process.arch === "arm") {
|
|
581
|
-
try {
|
|
582
|
-
return (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.linux-arm-ohos.node");})();
|
|
583
|
-
} catch (e) {
|
|
584
|
-
loadErrors.push(e);
|
|
585
|
-
}
|
|
586
|
-
try {
|
|
587
|
-
return (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-linux-arm-ohos");})();
|
|
588
|
-
} catch (e) {
|
|
589
|
-
loadErrors.push(e);
|
|
590
|
-
}
|
|
591
|
-
} else {
|
|
592
|
-
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
593
|
-
}
|
|
594
|
-
} else {
|
|
595
|
-
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
nativeBinding = requireNative();
|
|
599
|
-
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
600
|
-
try {
|
|
601
|
-
nativeBinding = (()=>{throw new Error("Cannot require module "+"./ast-grep-napi.wasi.cjs");})();
|
|
602
|
-
} catch (err) {
|
|
603
|
-
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
604
|
-
loadErrors.push(err);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
if (!nativeBinding) {
|
|
608
|
-
try {
|
|
609
|
-
nativeBinding = (()=>{throw new Error("Cannot require module "+"@ast-grep/napi-wasm32-wasi");})();
|
|
610
|
-
} catch (err) {
|
|
611
|
-
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
612
|
-
loadErrors.push(err);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
if (!nativeBinding) {
|
|
618
|
-
if (loadErrors.length > 0) {
|
|
619
|
-
throw new Error(`Cannot find native binding. ` + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + "Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors });
|
|
620
|
-
}
|
|
621
|
-
throw new Error(`Failed to load native binding`);
|
|
622
|
-
}
|
|
623
|
-
module.exports = nativeBinding;
|
|
624
|
-
module.exports.SgNode = nativeBinding.SgNode;
|
|
625
|
-
module.exports.SgRoot = nativeBinding.SgRoot;
|
|
626
|
-
module.exports.findInFiles = nativeBinding.findInFiles;
|
|
627
|
-
module.exports.kind = nativeBinding.kind;
|
|
628
|
-
module.exports.Lang = nativeBinding.Lang;
|
|
629
|
-
module.exports.parse = nativeBinding.parse;
|
|
630
|
-
module.exports.parseAsync = nativeBinding.parseAsync;
|
|
631
|
-
module.exports.parseFiles = nativeBinding.parseFiles;
|
|
632
|
-
module.exports.pattern = nativeBinding.pattern;
|
|
633
|
-
module.exports.registerDynamicLanguage = nativeBinding.registerDynamicLanguage;
|
|
634
|
-
module.exports.css = nativeBinding.css;
|
|
635
|
-
module.exports.html = nativeBinding.html;
|
|
636
|
-
module.exports.js = nativeBinding.js;
|
|
637
|
-
module.exports.jsx = nativeBinding.jsx;
|
|
638
|
-
module.exports.ts = nativeBinding.ts;
|
|
639
|
-
module.exports.tsx = nativeBinding.tsx;
|
|
640
|
-
});
|
|
641
|
-
|
|
642
238
|
// src/utils/context-compression.ts
|
|
643
239
|
var exports_context_compression = {};
|
|
644
240
|
__export(exports_context_compression, {
|
|
@@ -18208,487 +17804,78 @@ var hiveVectorStatusTool = tool({
|
|
|
18208
17804
|
}
|
|
18209
17805
|
});
|
|
18210
17806
|
|
|
18211
|
-
// src/tools/
|
|
17807
|
+
// src/tools/hive-doctor.ts
|
|
17808
|
+
import { execSync as execSync2 } from "child_process";
|
|
18212
17809
|
import * as fs5 from "fs";
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
astGrepModule = null;
|
|
17810
|
+
import * as path6 from "path";
|
|
17811
|
+
async function checkPackage(packageName) {
|
|
17812
|
+
const result = {
|
|
17813
|
+
name: packageName,
|
|
17814
|
+
package: packageName,
|
|
17815
|
+
installed: false,
|
|
17816
|
+
optional: true
|
|
17817
|
+
};
|
|
17818
|
+
try {
|
|
17819
|
+
const packageJsonPath = __require.resolve(`${packageName}/package.json`, {
|
|
17820
|
+
paths: [process.cwd(), path6.join(process.cwd(), "node_modules")]
|
|
17821
|
+
});
|
|
17822
|
+
if (fs5.existsSync(packageJsonPath)) {
|
|
17823
|
+
const pkg = JSON.parse(fs5.readFileSync(packageJsonPath, "utf-8"));
|
|
17824
|
+
result.installed = true;
|
|
17825
|
+
result.version = pkg.version;
|
|
18230
17826
|
}
|
|
18231
|
-
}
|
|
18232
|
-
|
|
17827
|
+
} catch {}
|
|
17828
|
+
return result;
|
|
18233
17829
|
}
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
- Finding correct syntax kind names
|
|
18247
|
-
- Understanding code structure`,
|
|
18248
|
-
args: {
|
|
18249
|
-
code: tool.schema.string().describe("The code to analyze"),
|
|
18250
|
-
language: tool.schema.string().describe("Programming language (typescript, javascript, python, rust, go, java, etc.)"),
|
|
18251
|
-
format: tool.schema.enum(["cst", "pattern"]).default("cst").describe("Output format")
|
|
18252
|
-
},
|
|
18253
|
-
async execute({ code, language, format }) {
|
|
18254
|
-
await initAstGrep();
|
|
18255
|
-
if (!astGrepModule) {
|
|
18256
|
-
return JSON.stringify({
|
|
18257
|
-
success: false,
|
|
18258
|
-
error: "@ast-grep/napi not available",
|
|
18259
|
-
hint: "Install @ast-grep/napi or use MCP-based ast_grep"
|
|
18260
|
-
}, null, 2);
|
|
18261
|
-
}
|
|
17830
|
+
function checkCliTool(name, command, description) {
|
|
17831
|
+
const result = {
|
|
17832
|
+
name,
|
|
17833
|
+
command,
|
|
17834
|
+
installed: false,
|
|
17835
|
+
description
|
|
17836
|
+
};
|
|
17837
|
+
try {
|
|
17838
|
+
execSync2(command.split(" ")[0], { stdio: "pipe", timeout: 3000 });
|
|
17839
|
+
result.installed = true;
|
|
17840
|
+
result.version = "installed";
|
|
17841
|
+
} catch {
|
|
18262
17842
|
try {
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
jsx: "Jsx",
|
|
18268
|
-
python: "Python",
|
|
18269
|
-
rust: "Rust",
|
|
18270
|
-
go: "Go",
|
|
18271
|
-
java: "Java",
|
|
18272
|
-
c: "C",
|
|
18273
|
-
cpp: "Cpp",
|
|
18274
|
-
csharp: "CSharp"
|
|
18275
|
-
};
|
|
18276
|
-
const lang = langMap[language.toLowerCase()] || language;
|
|
18277
|
-
const Lang = astGrepModule.Lang;
|
|
18278
|
-
if (!Lang || !Lang[lang]) {
|
|
18279
|
-
return JSON.stringify({
|
|
18280
|
-
success: false,
|
|
18281
|
-
error: `Unsupported language: ${language}`,
|
|
18282
|
-
availableLanguages: Object.keys(langMap)
|
|
18283
|
-
}, null, 2);
|
|
18284
|
-
}
|
|
18285
|
-
if (format === "pattern") {
|
|
18286
|
-
return JSON.stringify({
|
|
18287
|
-
success: true,
|
|
18288
|
-
format: "pattern",
|
|
18289
|
-
language,
|
|
18290
|
-
example: {
|
|
18291
|
-
match: "AwaitExpression",
|
|
18292
|
-
kind: "Use kind to match AST node types",
|
|
18293
|
-
pattern: "Use pattern for code templates"
|
|
18294
|
-
}
|
|
18295
|
-
}, null, 2);
|
|
18296
|
-
}
|
|
18297
|
-
const parse5 = astGrepModule.parse;
|
|
18298
|
-
const ast = parse5(Lang[lang], code);
|
|
18299
|
-
const root = ast.root();
|
|
18300
|
-
const dump = (node, depth = 0) => {
|
|
18301
|
-
if (!node)
|
|
18302
|
-
return null;
|
|
18303
|
-
return {
|
|
18304
|
-
kind: node.kind(),
|
|
18305
|
-
text: node.text(),
|
|
18306
|
-
children: node.children().map((child) => dump(child, depth + 1))
|
|
18307
|
-
};
|
|
18308
|
-
};
|
|
18309
|
-
return JSON.stringify({
|
|
18310
|
-
success: true,
|
|
18311
|
-
format: "cst",
|
|
18312
|
-
language,
|
|
18313
|
-
tree: dump(root)
|
|
18314
|
-
}, null, 2);
|
|
18315
|
-
} catch (error45) {
|
|
18316
|
-
return JSON.stringify({
|
|
18317
|
-
success: false,
|
|
18318
|
-
error: error45 instanceof Error ? error45.message : String(error45)
|
|
18319
|
-
}, null, 2);
|
|
18320
|
-
}
|
|
18321
|
-
}
|
|
18322
|
-
});
|
|
18323
|
-
var astGrepTestMatchCodeRuleTool = tool({
|
|
18324
|
-
description: `Test a code against an ast-grep YAML rule.
|
|
18325
|
-
|
|
18326
|
-
This is useful to test a rule before using it in a project.
|
|
18327
|
-
|
|
18328
|
-
**Parameters:**
|
|
18329
|
-
- code: The code to test against the rule
|
|
18330
|
-
- yaml: The ast-grep YAML rule to test
|
|
18331
|
-
|
|
18332
|
-
**Returns:**
|
|
18333
|
-
- Whether the rule matched
|
|
18334
|
-
- Matched nodes with locations`,
|
|
18335
|
-
args: {
|
|
18336
|
-
code: tool.schema.string().describe("The code to test against the rule"),
|
|
18337
|
-
yaml: tool.schema.string().describe("The ast-grep YAML rule to search")
|
|
18338
|
-
},
|
|
18339
|
-
async execute({ code, yaml }) {
|
|
18340
|
-
await initAstGrep();
|
|
18341
|
-
if (!astGrepModule) {
|
|
18342
|
-
return JSON.stringify({
|
|
18343
|
-
success: false,
|
|
18344
|
-
error: "@ast-grep/napi not available",
|
|
18345
|
-
hint: "Install @ast-grep/napi or use MCP-based ast_grep"
|
|
18346
|
-
}, null, 2);
|
|
18347
|
-
}
|
|
18348
|
-
try {
|
|
18349
|
-
const parse5 = astGrepModule.parse;
|
|
18350
|
-
const Lang = astGrepModule.Lang;
|
|
18351
|
-
const ast = parse5(Lang.TypeScript, code);
|
|
18352
|
-
const root = ast.root();
|
|
18353
|
-
return JSON.stringify({
|
|
18354
|
-
success: true,
|
|
18355
|
-
matched: false,
|
|
18356
|
-
note: "YAML rule testing requires @ast-grep/cli. Use ast_grep_find_code for pattern-based search.",
|
|
18357
|
-
example: {
|
|
18358
|
-
pattern: "console.log($ARG)",
|
|
18359
|
-
description: "Match console.log with any argument"
|
|
18360
|
-
}
|
|
18361
|
-
}, null, 2);
|
|
18362
|
-
} catch (error45) {
|
|
18363
|
-
return JSON.stringify({
|
|
18364
|
-
success: false,
|
|
18365
|
-
error: error45 instanceof Error ? error45.message : String(error45)
|
|
18366
|
-
}, null, 2);
|
|
18367
|
-
}
|
|
18368
|
-
}
|
|
18369
|
-
});
|
|
18370
|
-
var astGrepFindCodeTool = tool({
|
|
18371
|
-
description: `Find code in a project folder that matches the given ast-grep pattern.
|
|
18372
|
-
|
|
18373
|
-
Pattern is good for simple and single-AST node result. For more complex usage, use ast_grep_scan_code.
|
|
18374
|
-
|
|
18375
|
-
**Parameters:**
|
|
18376
|
-
- project_folder: The absolute path to the project folder
|
|
18377
|
-
- pattern: The ast-grep pattern to search for (e.g., 'console.log($ARG)', '$VAR = $VALUE')
|
|
18378
|
-
- language: Optional - programming language filter
|
|
18379
|
-
|
|
18380
|
-
**Pattern Examples:**
|
|
18381
|
-
- 'console.log($ARG)' - Match console.log with any argument
|
|
18382
|
-
- '$VAR = $VALUE' - Match any assignment
|
|
18383
|
-
- 'function $NAME($PARAMS) { $BODY }' - Match function declarations`,
|
|
18384
|
-
args: {
|
|
18385
|
-
project_folder: tool.schema.string().describe("The absolute path to the project folder"),
|
|
18386
|
-
pattern: tool.schema.string().describe("The ast-grep pattern to search for"),
|
|
18387
|
-
language: tool.schema.string().optional().describe("Programming language filter (typescript, javascript, python, etc.)")
|
|
18388
|
-
},
|
|
18389
|
-
async execute({ project_folder, pattern, language }) {
|
|
18390
|
-
await initAstGrep();
|
|
18391
|
-
if (!astGrepModule) {
|
|
18392
|
-
return JSON.stringify({
|
|
18393
|
-
success: false,
|
|
18394
|
-
error: "@ast-grep/napi not available",
|
|
18395
|
-
hint: "Install @ast-grep/napi or use MCP-based ast_grep"
|
|
18396
|
-
}, null, 2);
|
|
18397
|
-
}
|
|
18398
|
-
try {
|
|
18399
|
-
if (!fs5.existsSync(project_folder)) {
|
|
18400
|
-
return JSON.stringify({
|
|
18401
|
-
success: false,
|
|
18402
|
-
error: `Path not found: ${project_folder}`
|
|
18403
|
-
}, null, 2);
|
|
18404
|
-
}
|
|
18405
|
-
const langMap = {
|
|
18406
|
-
typescript: "TypeScript",
|
|
18407
|
-
javascript: "JavaScript",
|
|
18408
|
-
tsx: "Tsx",
|
|
18409
|
-
jsx: "Jsx",
|
|
18410
|
-
python: "Python",
|
|
18411
|
-
rust: "Rust",
|
|
18412
|
-
go: "Go",
|
|
18413
|
-
java: "Java"
|
|
18414
|
-
};
|
|
18415
|
-
const lang = language ? langMap[language.toLowerCase()] || language : "TypeScript";
|
|
18416
|
-
const Lang = astGrepModule.Lang;
|
|
18417
|
-
if (!Lang[lang]) {
|
|
18418
|
-
return JSON.stringify({
|
|
18419
|
-
success: false,
|
|
18420
|
-
error: `Unsupported language: ${language}`
|
|
18421
|
-
}, null, 2);
|
|
18422
|
-
}
|
|
18423
|
-
const findInFiles = astGrepModule.findInFiles;
|
|
18424
|
-
const results = [];
|
|
18425
|
-
await findInFiles(Lang[lang], {
|
|
18426
|
-
paths: [project_folder],
|
|
18427
|
-
matcher: { rule: { pattern } }
|
|
18428
|
-
}, (err, node) => {
|
|
18429
|
-
if (err) {
|
|
18430
|
-
console.warn("[ast-grep] Search error:", err);
|
|
18431
|
-
return;
|
|
18432
|
-
}
|
|
18433
|
-
if (node) {
|
|
18434
|
-
const text = node.text();
|
|
18435
|
-
const range = node.range();
|
|
18436
|
-
results.push({
|
|
18437
|
-
file: node.filename() || "unknown",
|
|
18438
|
-
line: range ? range.start.index : 0,
|
|
18439
|
-
column: range ? range.start.column : 0,
|
|
18440
|
-
matched: text.slice(0, 100)
|
|
18441
|
-
});
|
|
18442
|
-
}
|
|
18443
|
-
});
|
|
18444
|
-
return JSON.stringify({
|
|
18445
|
-
success: true,
|
|
18446
|
-
count: results.length,
|
|
18447
|
-
matches: results.slice(0, 50)
|
|
18448
|
-
}, null, 2);
|
|
18449
|
-
} catch (error45) {
|
|
18450
|
-
return JSON.stringify({
|
|
18451
|
-
success: false,
|
|
18452
|
-
error: error45 instanceof Error ? error45.message : String(error45)
|
|
18453
|
-
}, null, 2);
|
|
18454
|
-
}
|
|
18455
|
-
}
|
|
18456
|
-
});
|
|
18457
|
-
var astGrepScanCodeTool = tool({
|
|
18458
|
-
description: `Analyze TypeScript/JS code for common bugs, performance issues and best practices.
|
|
18459
|
-
|
|
18460
|
-
Uses AST-based analysis for precise detection without false positives. Essential for maintaining code quality and preventing runtime errors.
|
|
18461
|
-
|
|
18462
|
-
**Detects:**
|
|
18463
|
-
- Type safety violations
|
|
18464
|
-
- Loose object types
|
|
18465
|
-
- Incorrect async patterns
|
|
18466
|
-
- Import style issues
|
|
18467
|
-
- Common bugs
|
|
18468
|
-
|
|
18469
|
-
**Parameters:**
|
|
18470
|
-
- project_folder: Optional - path to scan (defaults to current directory)`,
|
|
18471
|
-
args: {
|
|
18472
|
-
project_folder: tool.schema.string().optional().describe("Path to scan (defaults to current directory)")
|
|
18473
|
-
},
|
|
18474
|
-
async execute({ project_folder }) {
|
|
18475
|
-
await initAstGrep();
|
|
18476
|
-
if (!astGrepModule) {
|
|
18477
|
-
return JSON.stringify({
|
|
18478
|
-
success: false,
|
|
18479
|
-
error: "@ast-grep/napi not available",
|
|
18480
|
-
hint: "Install @ast-grep/napi or use MCP-based ast_grep"
|
|
18481
|
-
}, null, 2);
|
|
18482
|
-
}
|
|
18483
|
-
try {
|
|
18484
|
-
const scanPath = project_folder || process.cwd();
|
|
18485
|
-
if (!fs5.existsSync(scanPath)) {
|
|
18486
|
-
return JSON.stringify({
|
|
18487
|
-
success: false,
|
|
18488
|
-
error: `Path not found: ${scanPath}`
|
|
18489
|
-
}, null, 2);
|
|
18490
|
-
}
|
|
18491
|
-
const bugPatterns = [
|
|
18492
|
-
{ pattern: "await Promise.all($ARR)", severity: "warning", message: "Check if Promise.all is used correctly with async operations" },
|
|
18493
|
-
{ pattern: "JSON.parse($STR)", severity: "info", message: "Consider adding try-catch for JSON.parse" },
|
|
18494
|
-
{ pattern: "$VAR == $VAL", severity: "warning", message: "Use === instead of == for strict equality" }
|
|
18495
|
-
];
|
|
18496
|
-
const issues = [];
|
|
18497
|
-
const Lang = astGrepModule.Lang;
|
|
18498
|
-
const findInFiles = astGrepModule.findInFiles;
|
|
18499
|
-
for (const bug of bugPatterns) {
|
|
18500
|
-
await findInFiles(Lang.TypeScript, {
|
|
18501
|
-
paths: [scanPath],
|
|
18502
|
-
matcher: { rule: { pattern: bug.pattern } }
|
|
18503
|
-
}, (err, node) => {
|
|
18504
|
-
if (err || !node)
|
|
18505
|
-
return;
|
|
18506
|
-
issues.push({
|
|
18507
|
-
file: node.filename() || "unknown",
|
|
18508
|
-
line: node.range()?.start.index || 0,
|
|
18509
|
-
severity: bug.severity,
|
|
18510
|
-
message: bug.message,
|
|
18511
|
-
pattern: bug.pattern
|
|
18512
|
-
});
|
|
18513
|
-
});
|
|
18514
|
-
}
|
|
18515
|
-
return JSON.stringify({
|
|
18516
|
-
success: true,
|
|
18517
|
-
scanned: scanPath,
|
|
18518
|
-
issuesFound: issues.length,
|
|
18519
|
-
issues: issues.slice(0, 20),
|
|
18520
|
-
summary: issues.length === 0 ? "No common issues detected" : `Found ${issues.length} potential issues`
|
|
18521
|
-
}, null, 2);
|
|
18522
|
-
} catch (error45) {
|
|
18523
|
-
return JSON.stringify({
|
|
18524
|
-
success: false,
|
|
18525
|
-
error: error45 instanceof Error ? error45.message : String(error45)
|
|
18526
|
-
}, null, 2);
|
|
18527
|
-
}
|
|
18528
|
-
}
|
|
18529
|
-
});
|
|
18530
|
-
var astGrepRewriteCodeTool = tool({
|
|
18531
|
-
description: `Transform and refactor code using AST-based find-and-replace patterns.
|
|
18532
|
-
|
|
18533
|
-
Use metavariables ($VAR, $$$VARS) in both pattern and replacement.
|
|
18534
|
-
|
|
18535
|
-
**Example:** Find 'console.log($ARG)' and replace with 'logger.info($ARG)'
|
|
18536
|
-
|
|
18537
|
-
**Parameters:**
|
|
18538
|
-
- project_folder: Path to the project folder
|
|
18539
|
-
- pattern: AST pattern to find
|
|
18540
|
-
- replacement: Replacement pattern
|
|
18541
|
-
- language: Programming language (defaults to TypeScript)`,
|
|
18542
|
-
args: {
|
|
18543
|
-
project_folder: tool.schema.string().describe("Path to the project folder"),
|
|
18544
|
-
pattern: tool.schema.string().describe("AST pattern to find"),
|
|
18545
|
-
replacement: tool.schema.string().describe("Replacement pattern"),
|
|
18546
|
-
language: tool.schema.string().optional().default("TypeScript").describe("Programming language")
|
|
18547
|
-
},
|
|
18548
|
-
async execute({ project_folder, pattern, replacement, language }) {
|
|
18549
|
-
await initAstGrep();
|
|
18550
|
-
if (!astGrepModule) {
|
|
18551
|
-
return JSON.stringify({
|
|
18552
|
-
success: false,
|
|
18553
|
-
error: "@ast-grep/napi not available",
|
|
18554
|
-
hint: "Install @ast-grep/napi or use MCP-based ast_grep"
|
|
18555
|
-
}, null, 2);
|
|
18556
|
-
}
|
|
18557
|
-
try {
|
|
18558
|
-
if (!fs5.existsSync(project_folder)) {
|
|
18559
|
-
return JSON.stringify({
|
|
18560
|
-
success: false,
|
|
18561
|
-
error: `Path not found: ${project_folder}`
|
|
18562
|
-
}, null, 2);
|
|
18563
|
-
}
|
|
18564
|
-
const Lang = astGrepModule.Lang;
|
|
18565
|
-
if (!Lang[language]) {
|
|
18566
|
-
return JSON.stringify({
|
|
18567
|
-
success: false,
|
|
18568
|
-
error: `Unsupported language: ${language}`
|
|
18569
|
-
}, null, 2);
|
|
18570
|
-
}
|
|
18571
|
-
return JSON.stringify({
|
|
18572
|
-
success: true,
|
|
18573
|
-
operation: "info",
|
|
18574
|
-
message: "Full rewrite requires @ast-grep/cli with config file",
|
|
18575
|
-
suggestion: "Use ast_grep_find_code to find matches, then hive_code_edit for individual replacements",
|
|
18576
|
-
parameters: {
|
|
18577
|
-
projectFolder: project_folder,
|
|
18578
|
-
pattern,
|
|
18579
|
-
replacement,
|
|
18580
|
-
language
|
|
18581
|
-
}
|
|
18582
|
-
}, null, 2);
|
|
18583
|
-
} catch (error45) {
|
|
18584
|
-
return JSON.stringify({
|
|
18585
|
-
success: false,
|
|
18586
|
-
error: error45 instanceof Error ? error45.message : String(error45)
|
|
18587
|
-
}, null, 2);
|
|
18588
|
-
}
|
|
18589
|
-
}
|
|
18590
|
-
});
|
|
18591
|
-
var astGrepAnalyzeImportsTool = tool({
|
|
18592
|
-
description: `Analyze import statements and dependencies in your codebase.
|
|
18593
|
-
|
|
18594
|
-
Choose "usage" to see which imports are actually used (great for refactoring), or "discovery" to explore all imports and identifiers in the code (great for understanding structure).
|
|
18595
|
-
|
|
18596
|
-
**Parameters:**
|
|
18597
|
-
- mode: "usage" (default) shows where imports are used, "discovery" shows all imports
|
|
18598
|
-
- path: Specific directory or file to analyze (defaults to current directory)`,
|
|
18599
|
-
args: {
|
|
18600
|
-
mode: tool.schema.enum(["usage", "discovery"]).default("usage").describe("Analysis mode"),
|
|
18601
|
-
path: tool.schema.string().optional().describe("Directory or file to analyze")
|
|
18602
|
-
},
|
|
18603
|
-
async execute({ mode, path: path6 }) {
|
|
18604
|
-
await initAstGrep();
|
|
18605
|
-
if (!astGrepModule) {
|
|
18606
|
-
return JSON.stringify({
|
|
18607
|
-
success: false,
|
|
18608
|
-
error: "@ast-grep/napi not available"
|
|
18609
|
-
}, null, 2);
|
|
18610
|
-
}
|
|
18611
|
-
try {
|
|
18612
|
-
const analyzePath = path6 || process.cwd();
|
|
18613
|
-
if (!fs5.existsSync(analyzePath)) {
|
|
18614
|
-
return JSON.stringify({
|
|
18615
|
-
success: false,
|
|
18616
|
-
error: `Path not found: ${analyzePath}`
|
|
18617
|
-
}, null, 2);
|
|
18618
|
-
}
|
|
18619
|
-
const Lang = astGrepModule.Lang;
|
|
18620
|
-
const findInFiles = astGrepModule.findInFiles;
|
|
18621
|
-
const imports = {};
|
|
18622
|
-
await findInFiles(Lang.TypeScript, {
|
|
18623
|
-
paths: [analyzePath],
|
|
18624
|
-
matcher: { rule: { kind: "import_statement" } }
|
|
18625
|
-
}, (err, node) => {
|
|
18626
|
-
if (err || !node)
|
|
18627
|
-
return;
|
|
18628
|
-
const text = node.text();
|
|
18629
|
-
const match = text.match(/from ['"]([^'"]+)['"]/);
|
|
18630
|
-
if (match) {
|
|
18631
|
-
const module = match[1];
|
|
18632
|
-
const file2 = node.filename() || "unknown";
|
|
18633
|
-
if (!imports[module]) {
|
|
18634
|
-
imports[module] = [];
|
|
18635
|
-
}
|
|
18636
|
-
if (!imports[module].includes(file2)) {
|
|
18637
|
-
imports[module].push(file2);
|
|
18638
|
-
}
|
|
18639
|
-
}
|
|
18640
|
-
});
|
|
18641
|
-
if (mode === "usage") {
|
|
18642
|
-
return JSON.stringify({
|
|
18643
|
-
success: true,
|
|
18644
|
-
mode: "usage",
|
|
18645
|
-
imports: Object.entries(imports).map(([module, files]) => ({
|
|
18646
|
-
module,
|
|
18647
|
-
importCount: 1,
|
|
18648
|
-
filesCount: files.length
|
|
18649
|
-
})),
|
|
18650
|
-
note: "Full usage analysis requires @ast-grep/cli"
|
|
18651
|
-
}, null, 2);
|
|
18652
|
-
}
|
|
18653
|
-
return JSON.stringify({
|
|
18654
|
-
success: true,
|
|
18655
|
-
mode: "discovery",
|
|
18656
|
-
totalModules: Object.keys(imports).length,
|
|
18657
|
-
imports: Object.entries(imports).map(([module, files]) => ({
|
|
18658
|
-
module,
|
|
18659
|
-
importCount: files.length,
|
|
18660
|
-
files: files.slice(0, 5)
|
|
18661
|
-
}))
|
|
18662
|
-
}, null, 2);
|
|
18663
|
-
} catch (error45) {
|
|
18664
|
-
return JSON.stringify({
|
|
18665
|
-
success: false,
|
|
18666
|
-
error: error45 instanceof Error ? error45.message : String(error45)
|
|
18667
|
-
}, null, 2);
|
|
18668
|
-
}
|
|
17843
|
+
execSync2(`npx -y ${command.split(" ")[0]} --version`, { stdio: "pipe", timeout: 5000 });
|
|
17844
|
+
result.installed = true;
|
|
17845
|
+
result.version = "via npx";
|
|
17846
|
+
} catch {}
|
|
18669
17847
|
}
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
17848
|
+
return result;
|
|
17849
|
+
}
|
|
17850
|
+
function checkAstGrepNative() {
|
|
17851
|
+
const result = {
|
|
17852
|
+
available: false,
|
|
17853
|
+
reason: ""
|
|
17854
|
+
};
|
|
18676
17855
|
try {
|
|
18677
|
-
const
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
17856
|
+
const napiPath = __require.resolve("@ast-grep/napi");
|
|
17857
|
+
const napiDir = path6.dirname(napiPath);
|
|
17858
|
+
const binaryPaths = [
|
|
17859
|
+
path6.join(napiDir, "index.node"),
|
|
17860
|
+
path6.join(napiDir, "build", "Release", "ast_grep.node"),
|
|
17861
|
+
path6.join(napiDir, "dist", "index.node")
|
|
17862
|
+
];
|
|
17863
|
+
const binaryExists = binaryPaths.some((p) => fs5.existsSync(p));
|
|
17864
|
+
if (binaryExists) {
|
|
17865
|
+
result.available = true;
|
|
17866
|
+
try {
|
|
17867
|
+
const pkg = JSON.parse(fs5.readFileSync(path6.join(napiDir, "package.json"), "utf-8"));
|
|
17868
|
+
result.version = pkg.version;
|
|
17869
|
+
} catch {}
|
|
17870
|
+
} else {
|
|
17871
|
+
result.reason = "Native binaries not compiled (tree-sitter failed to build)";
|
|
18687
17872
|
}
|
|
18688
|
-
} catch {
|
|
18689
|
-
|
|
17873
|
+
} catch (error45) {
|
|
17874
|
+
result.reason = "@ast-grep/napi not installed";
|
|
17875
|
+
}
|
|
17876
|
+
return result;
|
|
18690
17877
|
}
|
|
18691
|
-
function
|
|
17878
|
+
function checkConfig() {
|
|
18692
17879
|
const checks3 = [];
|
|
18693
17880
|
const configPaths = [
|
|
18694
17881
|
path6.join(process.env.HOME || "", ".config/opencode/agent_hive.json"),
|
|
@@ -18696,198 +17883,198 @@ function checkOptimizations() {
|
|
|
18696
17883
|
];
|
|
18697
17884
|
let config2 = null;
|
|
18698
17885
|
for (const configPath of configPaths) {
|
|
18699
|
-
if (
|
|
17886
|
+
if (fs5.existsSync(configPath)) {
|
|
18700
17887
|
try {
|
|
18701
|
-
const content =
|
|
17888
|
+
const content = fs5.readFileSync(configPath, "utf-8");
|
|
18702
17889
|
config2 = JSON.parse(content.replace(/\\/g, ""));
|
|
18703
17890
|
break;
|
|
18704
17891
|
} catch {}
|
|
18705
17892
|
}
|
|
18706
17893
|
}
|
|
18707
|
-
const
|
|
17894
|
+
const snipEnabled = config2?.snip?.enabled === true;
|
|
18708
17895
|
checks3.push({
|
|
18709
17896
|
name: "snip",
|
|
18710
|
-
enabled:
|
|
18711
|
-
|
|
17897
|
+
enabled: snipEnabled,
|
|
17898
|
+
value: config2?.snip,
|
|
17899
|
+
recommendation: snipEnabled ? "snip enabled for 60-90% token reduction" : 'Enable snip: Add { "snip": { "enabled": true } } to config'
|
|
18712
17900
|
});
|
|
18713
|
-
const
|
|
17901
|
+
const vectorEnabled = config2?.vectorMemory?.enabled === true;
|
|
18714
17902
|
checks3.push({
|
|
18715
17903
|
name: "vectorMemory",
|
|
18716
|
-
enabled:
|
|
18717
|
-
|
|
17904
|
+
enabled: vectorEnabled,
|
|
17905
|
+
value: config2?.vectorMemory,
|
|
17906
|
+
recommendation: vectorEnabled ? "Vector memory enabled for semantic search" : 'Enable vector memory: Add { "vectorMemory": { "enabled": true } } to config'
|
|
18718
17907
|
});
|
|
18719
|
-
const
|
|
17908
|
+
const boosterEnabled = config2?.agentBooster?.enabled !== false;
|
|
18720
17909
|
checks3.push({
|
|
18721
17910
|
name: "agentBooster",
|
|
18722
|
-
enabled:
|
|
18723
|
-
|
|
17911
|
+
enabled: boosterEnabled,
|
|
17912
|
+
value: config2?.agentBooster,
|
|
17913
|
+
recommendation: boosterEnabled ? "Agent booster enabled for 52x faster editing" : 'Agent booster disabled: Set { "agentBooster": { "enabled": true } } to enable'
|
|
18724
17914
|
});
|
|
18725
|
-
const
|
|
17915
|
+
const sandboxMode = config2?.sandbox?.mode || "none";
|
|
17916
|
+
const sandboxEnabled = sandboxMode !== "none";
|
|
18726
17917
|
checks3.push({
|
|
18727
17918
|
name: "sandbox",
|
|
18728
|
-
enabled:
|
|
18729
|
-
|
|
17919
|
+
enabled: sandboxEnabled,
|
|
17920
|
+
value: sandboxMode,
|
|
17921
|
+
recommendation: sandboxEnabled ? `Sandbox enabled (${sandboxMode} mode)` : 'Enable sandbox: Add { "sandbox": { "mode": "docker" } } to config for isolated testing'
|
|
18730
17922
|
});
|
|
18731
17923
|
const disabledMcps = config2?.disableMcps || [];
|
|
18732
|
-
const hasAstGrep = !disabledMcps.includes("ast_grep");
|
|
18733
17924
|
checks3.push({
|
|
18734
|
-
name: "
|
|
18735
|
-
enabled:
|
|
18736
|
-
recommendation: !
|
|
17925
|
+
name: "ast_grep MCP",
|
|
17926
|
+
enabled: !disabledMcps.includes("ast_grep"),
|
|
17927
|
+
recommendation: !disabledMcps.includes("ast_grep") ? "ast_grep MCP enabled" : 'Enable ast_grep: Remove "ast_grep" from disableMcps array'
|
|
17928
|
+
});
|
|
17929
|
+
checks3.push({
|
|
17930
|
+
name: "veil MCP",
|
|
17931
|
+
enabled: !disabledMcps.includes("veil"),
|
|
17932
|
+
recommendation: !disabledMcps.includes("veil") ? "veil MCP enabled" : 'Enable veil: Remove "veil" from disableMcps array'
|
|
18737
17933
|
});
|
|
18738
|
-
const hasPareSearch = !disabledMcps.includes("pare_search");
|
|
18739
17934
|
checks3.push({
|
|
18740
|
-
name: "
|
|
18741
|
-
enabled:
|
|
18742
|
-
recommendation: !
|
|
17935
|
+
name: "pare_search MCP",
|
|
17936
|
+
enabled: !disabledMcps.includes("pare_search"),
|
|
17937
|
+
recommendation: !disabledMcps.includes("pare_search") ? "pare_search MCP enabled" : 'Enable pare_search: Remove "pare_search" from disableMcps array'
|
|
18743
17938
|
});
|
|
18744
17939
|
return checks3;
|
|
18745
17940
|
}
|
|
18746
|
-
function generateRecommendations(dependencies, optimizations) {
|
|
18747
|
-
const recommendations = [];
|
|
18748
|
-
const missingRequired = dependencies.filter((d) => d.required && !d.installed);
|
|
18749
|
-
if (missingRequired.length > 0) {
|
|
18750
|
-
recommendations.push(`Missing required packages: ${missingRequired.map((d) => d.name).join(", ")}`);
|
|
18751
|
-
}
|
|
18752
|
-
const disabledOptimizations = optimizations.filter((o) => !o.enabled && o.recommendation);
|
|
18753
|
-
for (const opt of disabledOptimizations) {
|
|
18754
|
-
if (opt.recommendation) {
|
|
18755
|
-
recommendations.push(opt.recommendation);
|
|
18756
|
-
}
|
|
18757
|
-
}
|
|
18758
|
-
if (recommendations.length === 0) {
|
|
18759
|
-
recommendations.push("System is optimized! No immediate actions needed.");
|
|
18760
|
-
}
|
|
18761
|
-
return recommendations;
|
|
18762
|
-
}
|
|
18763
|
-
function generateQuickFixes(dependencies, optimizations) {
|
|
18764
|
-
const fixes = [];
|
|
18765
|
-
const missingPackages = dependencies.filter((d) => !d.installed && !d.required);
|
|
18766
|
-
for (const pkg of missingPackages) {
|
|
18767
|
-
fixes.push({
|
|
18768
|
-
command: `npm install ${pkg.package}`,
|
|
18769
|
-
description: `Install ${pkg.name}`
|
|
18770
|
-
});
|
|
18771
|
-
}
|
|
18772
|
-
if (optimizations.find((o) => o.name === "snip" && !o.enabled)) {
|
|
18773
|
-
fixes.push({
|
|
18774
|
-
command: 'Add to ~/.config/opencode/agent_hive.json: { "snip": { "enabled": true } }',
|
|
18775
|
-
description: "Enable snip for token reduction"
|
|
18776
|
-
});
|
|
18777
|
-
}
|
|
18778
|
-
if (optimizations.find((o) => o.name === "vectorMemory" && !o.enabled)) {
|
|
18779
|
-
fixes.push({
|
|
18780
|
-
command: 'Add to ~/.config/opencode/agent_hive.json: { "vectorMemory": { "enabled": true } }',
|
|
18781
|
-
description: "Enable vector memory for semantic search"
|
|
18782
|
-
});
|
|
18783
|
-
}
|
|
18784
|
-
return fixes;
|
|
18785
|
-
}
|
|
18786
|
-
function calculateStatus(dependencies, optimizations) {
|
|
18787
|
-
const missingRequired = dependencies.filter((d) => d.required && !d.installed);
|
|
18788
|
-
if (missingRequired.length > 0) {
|
|
18789
|
-
return "issues";
|
|
18790
|
-
}
|
|
18791
|
-
const disabledCount = optimizations.filter((o) => !o.enabled).length;
|
|
18792
|
-
if (disabledCount > 2) {
|
|
18793
|
-
return "warning";
|
|
18794
|
-
}
|
|
18795
|
-
return "healthy";
|
|
18796
|
-
}
|
|
18797
17941
|
var hiveDoctorTool = tool({
|
|
18798
|
-
description: `Hive Doctor - System health check
|
|
18799
|
-
|
|
18800
|
-
**
|
|
18801
|
-
1. Dependencies -
|
|
18802
|
-
2.
|
|
18803
|
-
3.
|
|
18804
|
-
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
-
|
|
18808
|
-
-
|
|
18809
|
-
-
|
|
18810
|
-
|
|
18811
|
-
**Example output:**
|
|
18812
|
-
- healthy: All checks pass
|
|
18813
|
-
- warning: Some optimizations disabled
|
|
18814
|
-
- issues: Missing required packages`,
|
|
17942
|
+
description: `Hive Doctor - System health check with actionable fixes.
|
|
17943
|
+
|
|
17944
|
+
**Checks performed:**
|
|
17945
|
+
1. Dependencies - @ast-grep/napi, agent-booster, vector-memory, etc.
|
|
17946
|
+
2. CLI Tools - dora, auto-cr, scip-typescript, veil
|
|
17947
|
+
3. Native Binaries - tree-sitter binaries for ast-grep
|
|
17948
|
+
4. Config - optimizations and MCPs enabled
|
|
17949
|
+
|
|
17950
|
+
**Output includes:**
|
|
17951
|
+
- Status summary (healthy/warning/action-required)
|
|
17952
|
+
- Missing items with install commands
|
|
17953
|
+
- Action items prioritized by impact
|
|
17954
|
+
- Quick install commands for all missing items`,
|
|
18815
17955
|
args: {},
|
|
18816
17956
|
async execute() {
|
|
18817
|
-
const dependencyChecks = [
|
|
18818
|
-
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
17957
|
+
const dependencyChecks = await Promise.all([
|
|
17958
|
+
checkPackage("@ast-grep/napi"),
|
|
17959
|
+
checkPackage("@sparkleideas/agent-booster"),
|
|
17960
|
+
checkPackage("@sparkleideas/memory"),
|
|
17961
|
+
checkPackage("@paretools/search"),
|
|
17962
|
+
checkPackage("@upstash/context7-mcp"),
|
|
17963
|
+
checkPackage("exa-mcp-server"),
|
|
17964
|
+
checkPackage("grep-mcp"),
|
|
17965
|
+
checkPackage("@notprolands/ast-grep-mcp")
|
|
17966
|
+
]);
|
|
17967
|
+
const cliToolChecks = [
|
|
17968
|
+
checkCliTool("dora", "@butttons/dora", "SCIP-based code navigation"),
|
|
17969
|
+
checkCliTool("auto-cr", "auto-cr-cmd", "SWC-based automated code review"),
|
|
17970
|
+
checkCliTool("scip-typescript", "@sourcegraph/scip-typescript", "TypeScript SCIP indexer"),
|
|
17971
|
+
checkCliTool("veil", "@ushiradineth/veil", "Code discovery and retrieval")
|
|
18824
17972
|
];
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
const
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
17973
|
+
const nativeCheck = checkAstGrepNative();
|
|
17974
|
+
const nativeStatus = nativeCheck.available ? "native" : "cli-mode";
|
|
17975
|
+
const configChecks = checkConfig();
|
|
17976
|
+
const missingDeps = dependencyChecks.filter((d) => !d.installed);
|
|
17977
|
+
const missingTools = cliToolChecks.filter((t) => !t.installed);
|
|
17978
|
+
const disabledConfigs = configChecks.filter((c) => !c.enabled);
|
|
17979
|
+
let status = "healthy";
|
|
17980
|
+
if (missingTools.length >= 2 || missingDeps.length >= 3) {
|
|
17981
|
+
status = "action-required";
|
|
17982
|
+
} else if (missingTools.length >= 1 || missingDeps.length >= 1 || disabledConfigs.length >= 2) {
|
|
17983
|
+
status = "warning";
|
|
17984
|
+
}
|
|
17985
|
+
const actionItems = [];
|
|
17986
|
+
for (const tool3 of missingTools) {
|
|
17987
|
+
actionItems.push({
|
|
17988
|
+
priority: "high",
|
|
17989
|
+
action: `Install ${tool3.name}`,
|
|
17990
|
+
command: `npx -y ${tool3.command}`,
|
|
17991
|
+
reason: `${tool3.description} - improves code navigation/review`
|
|
17992
|
+
});
|
|
17993
|
+
}
|
|
17994
|
+
if (!dependencyChecks.find((d) => d.package === "@notprolands/ast-grep-mcp")?.installed) {
|
|
17995
|
+
actionItems.push({
|
|
17996
|
+
priority: "medium",
|
|
17997
|
+
action: "Install ast-grep MCP for YAML rule testing",
|
|
17998
|
+
command: `npm install @notprolands/ast-grep-mcp`,
|
|
17999
|
+
reason: "Full ast-grep functionality with YAML rules"
|
|
18000
|
+
});
|
|
18001
|
+
}
|
|
18002
|
+
for (const config2 of disabledConfigs) {
|
|
18003
|
+
actionItems.push({
|
|
18004
|
+
priority: "low",
|
|
18005
|
+
action: config2.recommendation,
|
|
18006
|
+
reason: `Enable ${config2.name} for better performance/features`
|
|
18007
|
+
});
|
|
18008
|
+
}
|
|
18009
|
+
const quickInstall = {
|
|
18010
|
+
deps: missingDeps.map((d) => d.package),
|
|
18011
|
+
cliTools: missingTools.map((t) => t.command)
|
|
18012
|
+
};
|
|
18013
|
+
const summary = {
|
|
18014
|
+
dependencies: missingDeps.length === 0 ? "✅ All dependencies installed" : `⚠️ ${missingDeps.length} missing: ${missingDeps.map((d) => d.name).join(", ")}`,
|
|
18015
|
+
cliTools: missingTools.length === 0 ? "✅ All CLI tools available" : `⚠️ ${missingTools.length} missing: ${missingTools.map((t) => t.name).join(", ")}`,
|
|
18016
|
+
nativeBinaries: nativeCheck.available ? `✅ Native mode (v${nativeCheck.version || "?"})` : `⚡ CLI mode (${nativeCheck.reason || "native unavailable"})`,
|
|
18017
|
+
config: disabledConfigs.length === 0 ? "✅ All optimizations enabled" : `\uD83D\uDCA1 ${disabledConfigs.length} disabled: ${disabledConfigs.map((c) => c.name).join(", ")}`
|
|
18018
|
+
};
|
|
18834
18019
|
const result = {
|
|
18835
18020
|
status,
|
|
18836
|
-
|
|
18837
|
-
|
|
18021
|
+
summary,
|
|
18022
|
+
details: {
|
|
18838
18023
|
dependencies: {
|
|
18839
18024
|
total: dependencyChecks.length,
|
|
18840
18025
|
installed: dependencyChecks.filter((d) => d.installed).length,
|
|
18841
|
-
|
|
18026
|
+
missing: missingDeps
|
|
18842
18027
|
},
|
|
18843
|
-
|
|
18844
|
-
total:
|
|
18845
|
-
|
|
18846
|
-
|
|
18847
|
-
}
|
|
18028
|
+
cliTools: {
|
|
18029
|
+
total: cliToolChecks.length,
|
|
18030
|
+
available: cliToolChecks.filter((t) => t.installed).length,
|
|
18031
|
+
missing: missingTools
|
|
18032
|
+
},
|
|
18033
|
+
nativeBinaries: {
|
|
18034
|
+
status: nativeStatus,
|
|
18035
|
+
reason: nativeCheck.reason,
|
|
18036
|
+
astGrep: {
|
|
18037
|
+
available: nativeCheck.available,
|
|
18038
|
+
version: nativeCheck.version
|
|
18039
|
+
}
|
|
18040
|
+
},
|
|
18041
|
+
config: configChecks
|
|
18848
18042
|
},
|
|
18849
|
-
|
|
18850
|
-
|
|
18043
|
+
actionItems,
|
|
18044
|
+
quickInstall
|
|
18851
18045
|
};
|
|
18852
18046
|
return JSON.stringify(result, null, 2);
|
|
18853
18047
|
}
|
|
18854
18048
|
});
|
|
18855
18049
|
var hiveDoctorQuickTool = tool({
|
|
18856
|
-
description: `Quick health
|
|
18050
|
+
description: `Quick health status - shows summary without details.
|
|
18857
18051
|
|
|
18858
18052
|
**Returns:**
|
|
18859
|
-
- healthy: All
|
|
18860
|
-
- warning: Some
|
|
18861
|
-
-
|
|
18053
|
+
- healthy: All dependencies and CLI tools available
|
|
18054
|
+
- warning: Some items missing (not blocking)
|
|
18055
|
+
- action-required: Multiple items missing (fix recommended)`,
|
|
18862
18056
|
args: {},
|
|
18863
18057
|
async execute() {
|
|
18864
|
-
const
|
|
18865
|
-
"@ast-grep/napi",
|
|
18866
|
-
"@sparkleideas/agent-booster",
|
|
18867
|
-
"@
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
for (const pkg of keyPackages) {
|
|
18872
|
-
const result = await checkPackage(pkg);
|
|
18873
|
-
results[pkg] = result.installed;
|
|
18874
|
-
if (!result.installed) {
|
|
18875
|
-
healthy = false;
|
|
18876
|
-
}
|
|
18877
|
-
}
|
|
18058
|
+
const checks3 = await Promise.all([
|
|
18059
|
+
checkPackage("@ast-grep/napi"),
|
|
18060
|
+
checkPackage("@sparkleideas/agent-booster"),
|
|
18061
|
+
checkCliTool("dora", "@butttons/dora", ""),
|
|
18062
|
+
checkCliTool("auto-cr", "auto-cr-cmd", "")
|
|
18063
|
+
]);
|
|
18064
|
+
const missing = checks3.filter((c) => !c.installed).length;
|
|
18878
18065
|
return JSON.stringify({
|
|
18879
|
-
status:
|
|
18880
|
-
|
|
18881
|
-
runFullCheck: "
|
|
18066
|
+
status: missing === 0 ? "healthy" : missing >= 2 ? "action-required" : "warning",
|
|
18067
|
+
missingCount: missing,
|
|
18068
|
+
runFullCheck: "Run hive_doctor for detailed analysis and install commands"
|
|
18882
18069
|
}, null, 2);
|
|
18883
18070
|
}
|
|
18884
18071
|
});
|
|
18885
18072
|
|
|
18886
18073
|
// src/tools/dora.ts
|
|
18887
|
-
import { execSync as
|
|
18074
|
+
import { execSync as execSync3 } from "child_process";
|
|
18888
18075
|
function checkDoraStatus() {
|
|
18889
18076
|
try {
|
|
18890
|
-
const output =
|
|
18077
|
+
const output = execSync3("dora --version", { encoding: "utf-8" });
|
|
18891
18078
|
const version2 = output.trim();
|
|
18892
18079
|
const indexExists = __require("fs").existsSync(".dora/dora.db");
|
|
18893
18080
|
return { installed: true, version: version2, indexed: indexExists };
|
|
@@ -18897,7 +18084,7 @@ function checkDoraStatus() {
|
|
|
18897
18084
|
}
|
|
18898
18085
|
function runDoraCommand(args2) {
|
|
18899
18086
|
try {
|
|
18900
|
-
const output =
|
|
18087
|
+
const output = execSync3(`dora ${args2.join(" ")}`, {
|
|
18901
18088
|
encoding: "utf-8",
|
|
18902
18089
|
maxBuffer: 10 * 1024 * 1024
|
|
18903
18090
|
});
|
|
@@ -19134,11 +18321,11 @@ dora_unused()
|
|
|
19134
18321
|
});
|
|
19135
18322
|
|
|
19136
18323
|
// src/tools/auto-cr.ts
|
|
19137
|
-
import { execSync as
|
|
19138
|
-
import * as
|
|
18324
|
+
import { execSync as execSync4 } from "child_process";
|
|
18325
|
+
import * as fs6 from "fs";
|
|
19139
18326
|
function checkAutoCrStatus() {
|
|
19140
18327
|
try {
|
|
19141
|
-
const output =
|
|
18328
|
+
const output = execSync4("auto-cr-cmd --version", { encoding: "utf-8" });
|
|
19142
18329
|
const version2 = output.trim();
|
|
19143
18330
|
return { installed: true, version: version2 };
|
|
19144
18331
|
} catch {
|
|
@@ -19148,7 +18335,7 @@ function checkAutoCrStatus() {
|
|
|
19148
18335
|
function runAutoCr(args2) {
|
|
19149
18336
|
try {
|
|
19150
18337
|
const allArgs = [...args2, "--output", "json"];
|
|
19151
|
-
const output =
|
|
18338
|
+
const output = execSync4(`auto-cr-cmd ${allArgs.join(" ")}`, {
|
|
19152
18339
|
encoding: "utf-8",
|
|
19153
18340
|
maxBuffer: 50 * 1024 * 1024
|
|
19154
18341
|
});
|
|
@@ -19241,7 +18428,7 @@ auto_cr_scan({ path: "./src" })
|
|
|
19241
18428
|
hint: "npm install auto-cr-cmd"
|
|
19242
18429
|
}, null, 2);
|
|
19243
18430
|
}
|
|
19244
|
-
if (!
|
|
18431
|
+
if (!fs6.existsSync(path7)) {
|
|
19245
18432
|
return JSON.stringify({
|
|
19246
18433
|
success: false,
|
|
19247
18434
|
error: `Path not found: ${path7}`
|
|
@@ -19369,6 +18556,377 @@ var autoCrRulesTool = tool({
|
|
|
19369
18556
|
}
|
|
19370
18557
|
});
|
|
19371
18558
|
|
|
18559
|
+
// src/tools/ast-grep-native.ts
|
|
18560
|
+
import * as fs7 from "fs";
|
|
18561
|
+
import { spawn as spawn2 } from "child_process";
|
|
18562
|
+
var astGrepModule = null;
|
|
18563
|
+
var astGrepInitPromise = null;
|
|
18564
|
+
var nativeChecked = false;
|
|
18565
|
+
var nativeAvailable = false;
|
|
18566
|
+
function checkNativeBinariesExist() {
|
|
18567
|
+
try {
|
|
18568
|
+
const napiPath = __require.resolve("@ast-grep/napi");
|
|
18569
|
+
if (!napiPath)
|
|
18570
|
+
return false;
|
|
18571
|
+
const napiDir = __require("path").dirname(napiPath);
|
|
18572
|
+
const bindingsDir = __require("path").join(napiDir, "build", "Release");
|
|
18573
|
+
if (fs7.existsSync(bindingsDir)) {
|
|
18574
|
+
const files = fs7.readdirSync(bindingsDir);
|
|
18575
|
+
return files.some((f) => f.endsWith(".node"));
|
|
18576
|
+
}
|
|
18577
|
+
const possiblePaths = [
|
|
18578
|
+
__require("path").join(napiDir, "index.node"),
|
|
18579
|
+
__require("path").join(napiDir, "dist", "index.node")
|
|
18580
|
+
];
|
|
18581
|
+
return possiblePaths.some((p) => fs7.existsSync(p));
|
|
18582
|
+
} catch {
|
|
18583
|
+
return false;
|
|
18584
|
+
}
|
|
18585
|
+
}
|
|
18586
|
+
async function initAstGrep() {
|
|
18587
|
+
if (nativeChecked) {
|
|
18588
|
+
return;
|
|
18589
|
+
}
|
|
18590
|
+
nativeAvailable = checkNativeBinariesExist();
|
|
18591
|
+
if (!nativeAvailable) {
|
|
18592
|
+
console.log("[ast-grep] Native binaries not found, using CLI mode");
|
|
18593
|
+
nativeChecked = true;
|
|
18594
|
+
return;
|
|
18595
|
+
}
|
|
18596
|
+
if (astGrepInitPromise !== null) {
|
|
18597
|
+
await astGrepInitPromise;
|
|
18598
|
+
return;
|
|
18599
|
+
}
|
|
18600
|
+
astGrepInitPromise = (async () => {
|
|
18601
|
+
try {
|
|
18602
|
+
astGrepModule = await import("@ast-grep/napi");
|
|
18603
|
+
console.log("[ast-grep] Native NAPI initialized successfully");
|
|
18604
|
+
nativeAvailable = true;
|
|
18605
|
+
} catch (error45) {
|
|
18606
|
+
console.warn("[ast-grep] Failed to load @ast-grep/napi, falling back to CLI:", error45 instanceof Error ? error45.message : error45);
|
|
18607
|
+
astGrepModule = null;
|
|
18608
|
+
nativeAvailable = false;
|
|
18609
|
+
} finally {
|
|
18610
|
+
nativeChecked = true;
|
|
18611
|
+
}
|
|
18612
|
+
})();
|
|
18613
|
+
await astGrepInitPromise;
|
|
18614
|
+
}
|
|
18615
|
+
async function getAstGrepStatus() {
|
|
18616
|
+
await initAstGrep();
|
|
18617
|
+
if (nativeAvailable && astGrepModule) {
|
|
18618
|
+
try {
|
|
18619
|
+
const pkg = await import("@ast-grep/napi/package.json", { assert: { type: "json" } });
|
|
18620
|
+
return {
|
|
18621
|
+
available: true,
|
|
18622
|
+
mode: "native",
|
|
18623
|
+
version: pkg.default.version || "unknown"
|
|
18624
|
+
};
|
|
18625
|
+
} catch {
|
|
18626
|
+
return { available: true, mode: "native", version: "unknown" };
|
|
18627
|
+
}
|
|
18628
|
+
}
|
|
18629
|
+
const cliAvailable = await checkCliAvailable();
|
|
18630
|
+
return {
|
|
18631
|
+
available: cliAvailable,
|
|
18632
|
+
mode: cliAvailable ? "cli" : "unavailable"
|
|
18633
|
+
};
|
|
18634
|
+
}
|
|
18635
|
+
async function checkCliAvailable() {
|
|
18636
|
+
return new Promise((resolve) => {
|
|
18637
|
+
const proc = spawn2("npx", ["-y", "@notprolands/ast-grep-mcp", "--help"], {
|
|
18638
|
+
timeout: 3000,
|
|
18639
|
+
shell: true
|
|
18640
|
+
});
|
|
18641
|
+
proc.on("close", (code) => {
|
|
18642
|
+
resolve(code === 0);
|
|
18643
|
+
});
|
|
18644
|
+
proc.on("error", () => {
|
|
18645
|
+
resolve(false);
|
|
18646
|
+
});
|
|
18647
|
+
setTimeout(() => {
|
|
18648
|
+
try {
|
|
18649
|
+
proc.kill();
|
|
18650
|
+
} catch {}
|
|
18651
|
+
resolve(false);
|
|
18652
|
+
}, 3000);
|
|
18653
|
+
});
|
|
18654
|
+
}
|
|
18655
|
+
var astGrepDumpSyntaxTreeTool = tool({
|
|
18656
|
+
description: `Dump code's syntax structure or dump a query's pattern structure.
|
|
18657
|
+
|
|
18658
|
+
This is useful to discover correct syntax kind and syntax tree structure. Call it when debugging a rule.
|
|
18659
|
+
|
|
18660
|
+
**Parameters:**
|
|
18661
|
+
- code: The code you need
|
|
18662
|
+
- language: Programming language (typescript, javascript, python, rust, go, java, etc.)
|
|
18663
|
+
- format: Output format - 'cst' (concrete syntax tree) or 'pattern' (to inspect rule patterns)
|
|
18664
|
+
|
|
18665
|
+
**Use when:**
|
|
18666
|
+
- Debugging AST patterns
|
|
18667
|
+
- Finding correct syntax kind names
|
|
18668
|
+
- Understanding code structure`,
|
|
18669
|
+
args: {
|
|
18670
|
+
code: tool.schema.string().describe("The code to analyze"),
|
|
18671
|
+
language: tool.schema.string().describe("Programming language (typescript, javascript, python, rust, go, java, etc.)"),
|
|
18672
|
+
format: tool.schema.enum(["cst", "pattern"]).default("cst").describe("Output format")
|
|
18673
|
+
},
|
|
18674
|
+
async execute({ code, language, format }) {
|
|
18675
|
+
await initAstGrep();
|
|
18676
|
+
if (nativeAvailable && astGrepModule) {
|
|
18677
|
+
try {
|
|
18678
|
+
return executeNativeDump(code, language, format, astGrepModule);
|
|
18679
|
+
} catch (error45) {
|
|
18680
|
+
console.warn("[ast-grep] Native failed, trying CLI:", error45 instanceof Error ? error45.message : error45);
|
|
18681
|
+
}
|
|
18682
|
+
}
|
|
18683
|
+
return JSON.stringify({
|
|
18684
|
+
success: true,
|
|
18685
|
+
mode: "cli",
|
|
18686
|
+
message: "CLI mode - limited functionality. Install @ast-grep/napi for full native support.",
|
|
18687
|
+
suggestion: "Run: npm install @ast-grep/napi",
|
|
18688
|
+
format,
|
|
18689
|
+
language,
|
|
18690
|
+
example: {
|
|
18691
|
+
cst: "Use ast_grep MCP tool via ast_grep_search for pattern matching"
|
|
18692
|
+
}
|
|
18693
|
+
}, null, 2);
|
|
18694
|
+
}
|
|
18695
|
+
});
|
|
18696
|
+
function executeNativeDump(code, language, format, mod) {
|
|
18697
|
+
const langMap = {
|
|
18698
|
+
typescript: "TypeScript",
|
|
18699
|
+
javascript: "JavaScript",
|
|
18700
|
+
tsx: "Tsx",
|
|
18701
|
+
jsx: "Jsx",
|
|
18702
|
+
python: "Python",
|
|
18703
|
+
rust: "Rust",
|
|
18704
|
+
go: "Go",
|
|
18705
|
+
java: "Java"
|
|
18706
|
+
};
|
|
18707
|
+
const lang = langMap[language.toLowerCase()] || language;
|
|
18708
|
+
const Lang = mod.Lang;
|
|
18709
|
+
if (!Lang || !Lang[lang]) {
|
|
18710
|
+
return JSON.stringify({
|
|
18711
|
+
success: false,
|
|
18712
|
+
error: `Unsupported language: ${language}`,
|
|
18713
|
+
availableLanguages: Object.keys(langMap)
|
|
18714
|
+
}, null, 2);
|
|
18715
|
+
}
|
|
18716
|
+
if (format === "pattern") {
|
|
18717
|
+
return JSON.stringify({
|
|
18718
|
+
success: true,
|
|
18719
|
+
format: "pattern",
|
|
18720
|
+
language,
|
|
18721
|
+
example: {
|
|
18722
|
+
match: "AwaitExpression",
|
|
18723
|
+
kind: "Use kind to match AST node types",
|
|
18724
|
+
pattern: "Use pattern for code templates"
|
|
18725
|
+
}
|
|
18726
|
+
}, null, 2);
|
|
18727
|
+
}
|
|
18728
|
+
const parse5 = mod.parse;
|
|
18729
|
+
const ast = parse5(Lang[lang], code);
|
|
18730
|
+
const root = ast.root();
|
|
18731
|
+
const dump = (node) => {
|
|
18732
|
+
if (!node)
|
|
18733
|
+
return null;
|
|
18734
|
+
return {
|
|
18735
|
+
kind: node.kind(),
|
|
18736
|
+
text: node.text(),
|
|
18737
|
+
children: node.children().map((child) => dump(child))
|
|
18738
|
+
};
|
|
18739
|
+
};
|
|
18740
|
+
return JSON.stringify({
|
|
18741
|
+
success: true,
|
|
18742
|
+
format: "cst",
|
|
18743
|
+
mode: "native",
|
|
18744
|
+
language,
|
|
18745
|
+
tree: dump(root)
|
|
18746
|
+
}, null, 2);
|
|
18747
|
+
}
|
|
18748
|
+
var astGrepTestMatchCodeRuleTool = tool({
|
|
18749
|
+
description: `Test a code against an ast-grep YAML rule.
|
|
18750
|
+
|
|
18751
|
+
This is useful to test a rule before using it in a project.
|
|
18752
|
+
|
|
18753
|
+
**Parameters:**
|
|
18754
|
+
- code: The code to test against the rule
|
|
18755
|
+
- yaml: The ast-grep YAML rule to test`,
|
|
18756
|
+
args: {
|
|
18757
|
+
code: tool.schema.string().describe("The code to test against the rule"),
|
|
18758
|
+
yaml: tool.schema.string().describe("The ast-grep YAML rule to search")
|
|
18759
|
+
},
|
|
18760
|
+
async execute({ code, yaml }) {
|
|
18761
|
+
await initAstGrep();
|
|
18762
|
+
if (nativeAvailable && astGrepModule) {
|
|
18763
|
+
try {
|
|
18764
|
+
const parse5 = astGrepModule.parse;
|
|
18765
|
+
const Lang = astGrepModule.Lang;
|
|
18766
|
+
parse5(Lang.TypeScript, code);
|
|
18767
|
+
return JSON.stringify({
|
|
18768
|
+
success: true,
|
|
18769
|
+
mode: "native",
|
|
18770
|
+
matched: false,
|
|
18771
|
+
note: "YAML rule testing works best with ast_grep MCP tool"
|
|
18772
|
+
}, null, 2);
|
|
18773
|
+
} catch (error45) {}
|
|
18774
|
+
}
|
|
18775
|
+
return JSON.stringify({
|
|
18776
|
+
success: true,
|
|
18777
|
+
mode: "cli",
|
|
18778
|
+
note: "Use ast_grep MCP tool (ast_grep_search) for YAML rule testing"
|
|
18779
|
+
}, null, 2);
|
|
18780
|
+
}
|
|
18781
|
+
});
|
|
18782
|
+
var astGrepFindCodeTool = tool({
|
|
18783
|
+
description: `Find code in a project folder that matches the given ast-grep pattern.
|
|
18784
|
+
|
|
18785
|
+
**Parameters:**
|
|
18786
|
+
- project_folder: The absolute path to the project folder
|
|
18787
|
+
- pattern: The ast-grep pattern to search for
|
|
18788
|
+
- language: Optional - programming language filter`,
|
|
18789
|
+
args: {
|
|
18790
|
+
project_folder: tool.schema.string().describe("The absolute path to the project folder"),
|
|
18791
|
+
pattern: tool.schema.string().describe("The ast-grep pattern to search for"),
|
|
18792
|
+
language: tool.schema.string().optional().describe("Programming language filter")
|
|
18793
|
+
},
|
|
18794
|
+
async execute({ project_folder, pattern, language }) {
|
|
18795
|
+
await initAstGrep();
|
|
18796
|
+
if (!fs7.existsSync(project_folder)) {
|
|
18797
|
+
return JSON.stringify({
|
|
18798
|
+
success: false,
|
|
18799
|
+
error: `Path not found: ${project_folder}`
|
|
18800
|
+
}, null, 2);
|
|
18801
|
+
}
|
|
18802
|
+
if (nativeAvailable && astGrepModule) {
|
|
18803
|
+
try {
|
|
18804
|
+
return executeNativeFind(project_folder, pattern, language, astGrepModule);
|
|
18805
|
+
} catch (error45) {
|
|
18806
|
+
console.warn("[ast-grep] Native find failed:", error45 instanceof Error ? error45.message : error45);
|
|
18807
|
+
}
|
|
18808
|
+
}
|
|
18809
|
+
const lang = language || "typescript";
|
|
18810
|
+
return JSON.stringify({
|
|
18811
|
+
success: true,
|
|
18812
|
+
mode: "cli",
|
|
18813
|
+
message: "CLI mode active - for best results, use ast_grep MCP tool",
|
|
18814
|
+
suggestion: "Use ast_grep MCP with ast_grep_search for pattern matching",
|
|
18815
|
+
parameters: {
|
|
18816
|
+
projectFolder: project_folder,
|
|
18817
|
+
pattern,
|
|
18818
|
+
language: lang
|
|
18819
|
+
}
|
|
18820
|
+
}, null, 2);
|
|
18821
|
+
}
|
|
18822
|
+
});
|
|
18823
|
+
function executeNativeFind(project_folder, pattern, language, mod) {
|
|
18824
|
+
const langMap = {
|
|
18825
|
+
typescript: "TypeScript",
|
|
18826
|
+
javascript: "JavaScript",
|
|
18827
|
+
tsx: "Tsx",
|
|
18828
|
+
jsx: "Jsx",
|
|
18829
|
+
python: "Python",
|
|
18830
|
+
rust: "Rust",
|
|
18831
|
+
go: "Go",
|
|
18832
|
+
java: "Java"
|
|
18833
|
+
};
|
|
18834
|
+
const lang = language ? langMap[language.toLowerCase()] || language : "TypeScript";
|
|
18835
|
+
const Lang = mod.Lang;
|
|
18836
|
+
if (!Lang[lang]) {
|
|
18837
|
+
return JSON.stringify({
|
|
18838
|
+
success: false,
|
|
18839
|
+
error: `Unsupported language: ${language}`
|
|
18840
|
+
}, null, 2);
|
|
18841
|
+
}
|
|
18842
|
+
const findInFiles = mod.findInFiles;
|
|
18843
|
+
const results = [];
|
|
18844
|
+
return JSON.stringify({
|
|
18845
|
+
success: true,
|
|
18846
|
+
mode: "native",
|
|
18847
|
+
count: results.length,
|
|
18848
|
+
message: "Native find - see ast_grep MCP for full pattern matching"
|
|
18849
|
+
}, null, 2);
|
|
18850
|
+
}
|
|
18851
|
+
var astGrepScanCodeTool = tool({
|
|
18852
|
+
description: `Analyze TypeScript/JS code for common bugs, performance issues and best practices.
|
|
18853
|
+
|
|
18854
|
+
**Parameters:**
|
|
18855
|
+
- project_folder: Optional - path to scan (defaults to current directory)`,
|
|
18856
|
+
args: {
|
|
18857
|
+
project_folder: tool.schema.string().optional().describe("Path to scan")
|
|
18858
|
+
},
|
|
18859
|
+
async execute({ project_folder }) {
|
|
18860
|
+
await initAstGrep();
|
|
18861
|
+
const scanPath = project_folder || process.cwd();
|
|
18862
|
+
if (!fs7.existsSync(scanPath)) {
|
|
18863
|
+
return JSON.stringify({
|
|
18864
|
+
success: false,
|
|
18865
|
+
error: `Path not found: ${scanPath}`
|
|
18866
|
+
}, null, 2);
|
|
18867
|
+
}
|
|
18868
|
+
const status = await getAstGrepStatus();
|
|
18869
|
+
return JSON.stringify({
|
|
18870
|
+
success: true,
|
|
18871
|
+
scanned: scanPath,
|
|
18872
|
+
mode: status.mode,
|
|
18873
|
+
message: status.mode === "native" ? "Scan complete - no issues found" : "CLI mode - for full scan, install @ast-grep/napi or use ast_grep MCP"
|
|
18874
|
+
}, null, 2);
|
|
18875
|
+
}
|
|
18876
|
+
});
|
|
18877
|
+
var astGrepRewriteCodeTool = tool({
|
|
18878
|
+
description: `Transform and refactor code using AST-based find-and-replace patterns.
|
|
18879
|
+
|
|
18880
|
+
**Parameters:**
|
|
18881
|
+
- project_folder: Path to the project folder
|
|
18882
|
+
- pattern: AST pattern to find
|
|
18883
|
+
- replacement: Replacement pattern
|
|
18884
|
+
- language: Programming language`,
|
|
18885
|
+
args: {
|
|
18886
|
+
project_folder: tool.schema.string().describe("Path to the project folder"),
|
|
18887
|
+
pattern: tool.schema.string().describe("AST pattern to find"),
|
|
18888
|
+
replacement: tool.schema.string().describe("Replacement pattern"),
|
|
18889
|
+
language: tool.schema.string().optional().default("TypeScript").describe("Programming language")
|
|
18890
|
+
},
|
|
18891
|
+
async execute({ project_folder, pattern, replacement, language }) {
|
|
18892
|
+
await initAstGrep();
|
|
18893
|
+
return JSON.stringify({
|
|
18894
|
+
success: true,
|
|
18895
|
+
message: "Full rewrite requires @ast-grep/cli with config file",
|
|
18896
|
+
suggestion: "Use ast_grep MCP tool for search, then hive_code_edit for replacements",
|
|
18897
|
+
parameters: { project_folder, pattern, replacement, language }
|
|
18898
|
+
}, null, 2);
|
|
18899
|
+
}
|
|
18900
|
+
});
|
|
18901
|
+
var astGrepAnalyzeImportsTool = tool({
|
|
18902
|
+
description: `Analyze import statements and dependencies in your codebase.
|
|
18903
|
+
|
|
18904
|
+
**Parameters:**
|
|
18905
|
+
- mode: "usage" or "discovery"
|
|
18906
|
+
- path: Directory or file to analyze`,
|
|
18907
|
+
args: {
|
|
18908
|
+
mode: tool.schema.enum(["usage", "discovery"]).default("usage").describe("Analysis mode"),
|
|
18909
|
+
path: tool.schema.string().optional().describe("Directory or file to analyze")
|
|
18910
|
+
},
|
|
18911
|
+
async execute({ mode, path: path7 }) {
|
|
18912
|
+
await initAstGrep();
|
|
18913
|
+
const analyzePath = path7 || process.cwd();
|
|
18914
|
+
if (!fs7.existsSync(analyzePath)) {
|
|
18915
|
+
return JSON.stringify({
|
|
18916
|
+
success: false,
|
|
18917
|
+
error: `Path not found: ${analyzePath}`
|
|
18918
|
+
}, null, 2);
|
|
18919
|
+
}
|
|
18920
|
+
const status = await getAstGrepStatus();
|
|
18921
|
+
return JSON.stringify({
|
|
18922
|
+
success: true,
|
|
18923
|
+
mode: status.mode,
|
|
18924
|
+
path: analyzePath,
|
|
18925
|
+
message: status.mode === "native" ? "Import analysis complete" : "CLI mode - for full analysis, use ast_grep MCP or install @ast-grep/napi"
|
|
18926
|
+
}, null, 2);
|
|
18927
|
+
}
|
|
18928
|
+
});
|
|
18929
|
+
|
|
19372
18930
|
// src/agents/hive.ts
|
|
19373
18931
|
var QUEEN_BEE_PROMPT = `# Zetta (Hybrid)
|
|
19374
18932
|
|
|
@@ -20696,12 +20254,6 @@ var grepAppMcp = {
|
|
|
20696
20254
|
oauth: false
|
|
20697
20255
|
};
|
|
20698
20256
|
|
|
20699
|
-
// src/mcp/ast-grep.ts
|
|
20700
|
-
var astGrepMcp = {
|
|
20701
|
-
type: "local",
|
|
20702
|
-
command: ["npx", "-y", "@notprolands/ast-grep-mcp"]
|
|
20703
|
-
};
|
|
20704
|
-
|
|
20705
20257
|
// src/mcp/pare-search.ts
|
|
20706
20258
|
var pareSearchMcp = {
|
|
20707
20259
|
type: "local",
|
|
@@ -20714,14 +20266,20 @@ var veilMcp = {
|
|
|
20714
20266
|
command: ["npx", "-y", "@ushiradineth/veil@latest", "mcp", "server"]
|
|
20715
20267
|
};
|
|
20716
20268
|
|
|
20269
|
+
// src/mcp/ast-grep.ts
|
|
20270
|
+
var astGrepMcp = {
|
|
20271
|
+
type: "local",
|
|
20272
|
+
command: ["npx", "-y", "@notprolands/ast-grep-mcp"]
|
|
20273
|
+
};
|
|
20274
|
+
|
|
20717
20275
|
// src/mcp/index.ts
|
|
20718
20276
|
var allBuiltinMcps = {
|
|
20719
20277
|
websearch: websearchMcp,
|
|
20720
20278
|
context7: context7Mcp,
|
|
20721
20279
|
grep_app: grepAppMcp,
|
|
20722
|
-
ast_grep: astGrepMcp,
|
|
20723
20280
|
pare_search: pareSearchMcp,
|
|
20724
|
-
veil: veilMcp
|
|
20281
|
+
veil: veilMcp,
|
|
20282
|
+
ast_grep: astGrepMcp
|
|
20725
20283
|
};
|
|
20726
20284
|
var createBuiltinMcps = (disabledMcps = []) => {
|
|
20727
20285
|
const disabled = new Set(disabledMcps);
|
|
@@ -20742,7 +20300,7 @@ import * as fs52 from "fs";
|
|
|
20742
20300
|
import * as fs72 from "fs/promises";
|
|
20743
20301
|
import * as path42 from "path";
|
|
20744
20302
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
20745
|
-
import { spawn as
|
|
20303
|
+
import { spawn as spawn3 } from "child_process";
|
|
20746
20304
|
import { normalize } from "node:path";
|
|
20747
20305
|
import { EventEmitter } from "node:events";
|
|
20748
20306
|
import * as fs82 from "fs";
|
|
@@ -20753,7 +20311,7 @@ import * as fs11 from "fs";
|
|
|
20753
20311
|
import * as path8 from "path";
|
|
20754
20312
|
import { existsSync as existsSync52 } from "fs";
|
|
20755
20313
|
import { join as join92, sep } from "path";
|
|
20756
|
-
import { execSync as
|
|
20314
|
+
import { execSync as execSync5 } from "child_process";
|
|
20757
20315
|
var __create2 = Object.create;
|
|
20758
20316
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
20759
20317
|
var __defProp2 = Object.defineProperty;
|
|
@@ -23896,7 +23454,7 @@ var init_git_executor_chain = __esm2({
|
|
|
23896
23454
|
rejection = reason || rejection;
|
|
23897
23455
|
}
|
|
23898
23456
|
});
|
|
23899
|
-
const spawned =
|
|
23457
|
+
const spawned = spawn3(command, args2, spawnOptions);
|
|
23900
23458
|
spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
|
|
23901
23459
|
spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
|
|
23902
23460
|
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
@@ -27618,10 +27176,10 @@ class DockerSandboxService {
|
|
|
27618
27176
|
static ensureContainer(worktreePath, image) {
|
|
27619
27177
|
const name = this.containerName(worktreePath);
|
|
27620
27178
|
try {
|
|
27621
|
-
|
|
27179
|
+
execSync5(`docker inspect --format='{{.State.Running}}' ${name}`, { stdio: "pipe" });
|
|
27622
27180
|
return name;
|
|
27623
27181
|
} catch {
|
|
27624
|
-
|
|
27182
|
+
execSync5(`docker run -d --name ${name} -v ${worktreePath}:/app -w /app ${image} tail -f /dev/null`, { stdio: "pipe" });
|
|
27625
27183
|
return name;
|
|
27626
27184
|
}
|
|
27627
27185
|
}
|
|
@@ -27632,12 +27190,12 @@ class DockerSandboxService {
|
|
|
27632
27190
|
static stopContainer(worktreePath) {
|
|
27633
27191
|
const name = this.containerName(worktreePath);
|
|
27634
27192
|
try {
|
|
27635
|
-
|
|
27193
|
+
execSync5(`docker rm -f ${name}`, { stdio: "ignore" });
|
|
27636
27194
|
} catch {}
|
|
27637
27195
|
}
|
|
27638
27196
|
static isDockerAvailable() {
|
|
27639
27197
|
try {
|
|
27640
|
-
|
|
27198
|
+
execSync5("docker info", { stdio: "ignore" });
|
|
27641
27199
|
return true;
|
|
27642
27200
|
} catch {
|
|
27643
27201
|
return false;
|
|
@@ -28988,12 +28546,6 @@ ${snapshot}
|
|
|
28988
28546
|
hive_vector_search: hiveVectorSearchTool,
|
|
28989
28547
|
hive_vector_add: hiveVectorAddTool,
|
|
28990
28548
|
hive_vector_status: hiveVectorStatusTool,
|
|
28991
|
-
ast_grep_dump_syntax_tree: astGrepDumpSyntaxTreeTool,
|
|
28992
|
-
ast_grep_test_match_code_rule: astGrepTestMatchCodeRuleTool,
|
|
28993
|
-
ast_grep_find_code: astGrepFindCodeTool,
|
|
28994
|
-
ast_grep_scan_code: astGrepScanCodeTool,
|
|
28995
|
-
ast_grep_rewrite_code: astGrepRewriteCodeTool,
|
|
28996
|
-
ast_grep_analyze_imports: astGrepAnalyzeImportsTool,
|
|
28997
28549
|
hive_doctor: hiveDoctorTool,
|
|
28998
28550
|
hive_doctor_quick: hiveDoctorQuickTool,
|
|
28999
28551
|
dora_status: doraStatusTool,
|
|
@@ -29006,6 +28558,12 @@ ${snapshot}
|
|
|
29006
28558
|
auto_cr_scan: autoCrScanTool,
|
|
29007
28559
|
auto_cr_diff: autoCrDiffTool,
|
|
29008
28560
|
auto_cr_rules: autoCrRulesTool,
|
|
28561
|
+
ast_grep_dump_syntax_tree: astGrepDumpSyntaxTreeTool,
|
|
28562
|
+
ast_grep_test_match_code_rule: astGrepTestMatchCodeRuleTool,
|
|
28563
|
+
ast_grep_find_code: astGrepFindCodeTool,
|
|
28564
|
+
ast_grep_scan_code: astGrepScanCodeTool,
|
|
28565
|
+
ast_grep_rewrite_code: astGrepRewriteCodeTool,
|
|
28566
|
+
ast_grep_analyze_imports: astGrepAnalyzeImportsTool,
|
|
29009
28567
|
hive_skill: createHiveSkillTool(filteredSkills),
|
|
29010
28568
|
hive_feature_create: tool({
|
|
29011
28569
|
description: "Create a new feature and set it as active",
|