autohand-cli 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AutomodeManager-PUNJS7IZ.cjs → AutomodeManager-TJSW2SQY.cjs} +1 -3
- package/dist/{AutomodeManager-FQQPBHAD.js → AutomodeManager-WIMHLG4W.js} +0 -2
- package/dist/{CommunitySkillsCache-KO4DSKMA.cjs → CommunitySkillsCache-X3X237QQ.cjs} +0 -1
- package/dist/{CommunitySkillsCache-AY3ZYDTN.js → CommunitySkillsCache-XPDVYU3K.js} +0 -1
- package/dist/{GitHubRegistryFetcher-S4JREWUQ.cjs → GitHubRegistryFetcher-K744NNAJ.cjs} +0 -1
- package/dist/{GitHubRegistryFetcher-V23KTTLM.js → GitHubRegistryFetcher-US2JJID4.js} +0 -1
- package/dist/HookManager-EOMUXKJ4.cjs +6 -0
- package/dist/HookManager-VIX56KFU.js +6 -0
- package/dist/{MemoryManager-AFS5EZJ2.js → MemoryManager-UVHILGV5.js} +0 -1
- package/dist/{MemoryManager-KE6EKW7Y.cjs → MemoryManager-WO3KUZVA.cjs} +0 -1
- package/dist/{PermissionManager-MAPKIJMD.cjs → PermissionManager-PMTQN263.cjs} +0 -1
- package/dist/{PermissionManager-V2Q2OAS2.js → PermissionManager-YFZI4ZZ6.js} +0 -1
- package/dist/{SessionManager-V25OJDDY.js → SessionManager-IMW2HGR3.js} +0 -1
- package/dist/{SessionManager-MKLGLZWC.cjs → SessionManager-VZNWGX4O.cjs} +0 -1
- package/dist/{SkillsRegistry-FTLVJZMA.js → SkillsRegistry-7NICF6FY.js} +0 -1
- package/dist/{SkillsRegistry-4RU2OAEQ.cjs → SkillsRegistry-OINIPILA.cjs} +0 -1
- package/dist/{agents-E4NEH2PN.js → agents-B33IAATH.js} +0 -1
- package/dist/{agents-CHNQ7LQ4.cjs → agents-GRAFXZY3.cjs} +0 -1
- package/dist/{agents-new-GHVWXW7T.cjs → agents-new-67NJJSDA.cjs} +0 -1
- package/dist/{agents-new-W6HMQ7V5.js → agents-new-KTXJFC5E.js} +0 -1
- package/dist/{automode-BJYGRMEQ.cjs → automode-BRHUHGXU.cjs} +0 -1
- package/dist/{automode-XCNP6HP4.js → automode-QCRJSBRT.js} +0 -1
- package/dist/{chunk-EBM5QDJ4.cjs → chunk-7EIL6P6Q.cjs} +1 -1
- package/dist/{chunk-E6U4UE3B.cjs → chunk-CT2VTDPQ.cjs} +1 -1
- package/dist/{chunk-UOLJZFPJ.js → chunk-JXOXZTMA.js} +3 -3
- package/dist/{chunk-LCCJ26QR.js → chunk-KNYGI365.js} +1 -1
- package/dist/{chunk-HUE3GT5M.js → chunk-MFLRXVKU.js} +1 -1
- package/dist/{chunk-SXYYH3VD.cjs → chunk-SKT2CRNY.cjs} +3 -3
- package/dist/{completion-BTDPVWVB.cjs → completion-WVFWX7XQ.cjs} +0 -1
- package/dist/{completion-2XTEWNMC.js → completion-Y42FKDT3.js} +0 -1
- package/dist/{constants-V4V43DZQ.cjs → constants-PE5DLI7Q.cjs} +0 -1
- package/dist/{constants-RVCOJL3L.js → constants-QYBEF3DB.js} +0 -1
- package/dist/{defaultHooks-3GRSZNKA.js → defaultHooks-3G3DVF6I.js} +0 -2
- package/dist/{defaultHooks-7EAUU6MN.cjs → defaultHooks-Z4KA6U5C.cjs} +1 -3
- package/dist/{export-CB34FSEH.cjs → export-BKBJ7PB2.cjs} +0 -1
- package/dist/{export-LNPP3XXH.js → export-WJ5P6E5Z.js} +0 -1
- package/dist/{feedback-IZKDNGHP.js → feedback-PZ2PINDU.js} +0 -1
- package/dist/{feedback-OKGBXZZ4.cjs → feedback-R66B3B3C.cjs} +0 -1
- package/dist/{formatters-OIGPANHJ.cjs → formatters-N5IJKYZY.cjs} +0 -1
- package/dist/{formatters-JJK6RS55.js → formatters-UG6VZJJ5.js} +0 -1
- package/dist/{help-MU553D6W.js → help-PKC6QCNG.js} +0 -1
- package/dist/{help-QAAUDLFS.cjs → help-UEELQRHP.cjs} +0 -1
- package/dist/{hooks-7DZGBMXP.cjs → hooks-G4VLYMLX.cjs} +0 -1
- package/dist/{hooks-4N5VRVOF.js → hooks-LN4A6NQL.js} +0 -1
- package/dist/index.cjs +77 -80
- package/dist/index.js +463 -466
- package/dist/{init-WW4RITLV.js → init-DML7AOII.js} +0 -1
- package/dist/{init-2QEB7GL5.cjs → init-SLLSDDJN.cjs} +0 -1
- package/dist/{lint-ZLRBEAFF.cjs → lint-44UQJ673.cjs} +0 -1
- package/dist/{lint-L2TD6NY6.js → lint-TA2ZHVLM.js} +0 -1
- package/dist/{localProjectPermissions-2DP6X55S.cjs → localProjectPermissions-75X3ZGKH.cjs} +0 -1
- package/dist/{localProjectPermissions-5CXHD4DO.js → localProjectPermissions-DURCNDZG.js} +0 -1
- package/dist/{login-LH62FYMH.js → login-BZ7J4Z4M.js} +0 -1
- package/dist/{login-TWWYJKX6.cjs → login-HUH3CEWL.cjs} +0 -1
- package/dist/{logout-35XNU6Q2.cjs → logout-3V3SH7OL.cjs} +0 -1
- package/dist/{logout-KPHUXO23.js → logout-BZKEMNHB.js} +0 -1
- package/dist/{memory-2SGSO4MW.js → memory-4GSP7NKV.js} +0 -1
- package/dist/{memory-ALXCFFQY.cjs → memory-CFNC7RJH.cjs} +0 -1
- package/dist/{model-U3BWIWVH.js → model-HKEFSH5E.js} +0 -1
- package/dist/{model-JC43B3KM.cjs → model-TKVEJ5BC.cjs} +0 -1
- package/dist/{new-24YT5KVI.cjs → new-EB2MBQXA.cjs} +0 -1
- package/dist/{new-PCOF6OLV.js → new-EEZC4XXV.js} +0 -1
- package/dist/{patch-RPK3BZQR.js → patch-BAAQIYSW.js} +0 -2
- package/dist/{patch-ETANEGRW.cjs → patch-J32X2QQP.cjs} +1 -3
- package/dist/{permissions-5W5JOVM7.js → permissions-5MTH22EF.js} +0 -1
- package/dist/{permissions-NHPJPHDV.cjs → permissions-IP5SITPI.cjs} +0 -1
- package/dist/{quit-TMKMX2YF.cjs → quit-2RYFGIJP.cjs} +0 -1
- package/dist/{quit-NIDVPHNL.js → quit-RSYIERO5.js} +0 -1
- package/dist/{resume-ZZ2D2NMB.js → resume-2NERFSTD.js} +0 -1
- package/dist/{resume-5C44HAAH.cjs → resume-OYZMJRNO.cjs} +0 -1
- package/dist/{session-76F55XKA.js → session-H5QWKE5E.js} +0 -1
- package/dist/{session-6TMBGN7N.cjs → session-T3TAZ5ZU.cjs} +0 -1
- package/dist/{sessions-ERKBJ7MC.js → sessions-4KXIT76T.js} +0 -1
- package/dist/{sessions-NUPCJVCF.cjs → sessions-7RTCPVNE.cjs} +0 -1
- package/dist/skills-6PIGHOWS.cjs +12 -0
- package/dist/{skills-R25OBHE5.js → skills-CRFOVWEQ.js} +1 -2
- package/dist/{skills-install-GNTBBL46.js → skills-install-RMPXN6RK.js} +0 -1
- package/dist/{skills-install-VUSVGSON.cjs → skills-install-Z27KPEGF.cjs} +0 -1
- package/dist/{skills-new-AGXQNBRA.cjs → skills-new-3QJUST7P.cjs} +0 -1
- package/dist/{skills-new-L36LQXIE.js → skills-new-S2YPO635.js} +0 -1
- package/dist/{status-VJ6FOSRI.js → status-ROTJZEKU.js} +1 -2
- package/dist/status-RSWACM74.cjs +8 -0
- package/dist/{theme-ZXGSJBZI.js → theme-JAMJSCKR.js} +0 -1
- package/dist/{theme-MI3BM56M.cjs → theme-LIF3RD3A.cjs} +0 -1
- package/dist/{undo-W4VN2Y37.cjs → undo-2WR2ZIEC.cjs} +0 -1
- package/dist/{undo-3UU5LWQS.js → undo-7QJBXARS.js} +0 -1
- package/package.json +1 -1
- package/dist/HookManager-OGINWAJN.cjs +0 -7
- package/dist/HookManager-VG46FXSZ.js +0 -7
- package/dist/chunk-3RG5ZIWI.js +0 -10
- package/dist/chunk-OBGZSXTJ.cjs +0 -10
- package/dist/skills-UCWKIHHG.cjs +0 -13
- package/dist/status-2QV7C3JJ.cjs +0 -9
package/dist/index.js
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
} from "./chunk-SKU4M27Z.js";
|
|
14
14
|
import {
|
|
15
15
|
HookManager
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JXOXZTMA.js";
|
|
17
17
|
import {
|
|
18
18
|
installMetadata,
|
|
19
19
|
metadata as metadata23
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MFLRXVKU.js";
|
|
21
21
|
import {
|
|
22
22
|
metadata as metadata24
|
|
23
23
|
} from "./chunk-NGSLABLS.js";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
import {
|
|
42
42
|
metadata as metadata18,
|
|
43
43
|
package_default
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-KNYGI365.js";
|
|
45
45
|
import {
|
|
46
46
|
metadata as metadata19
|
|
47
47
|
} from "./chunk-6XITU2RU.js";
|
|
@@ -118,14 +118,11 @@ import {
|
|
|
118
118
|
import {
|
|
119
119
|
metadata as metadata6
|
|
120
120
|
} from "./chunk-QJ53OSGF.js";
|
|
121
|
-
import {
|
|
122
|
-
__require
|
|
123
|
-
} from "./chunk-3RG5ZIWI.js";
|
|
124
121
|
|
|
125
122
|
// src/index.ts
|
|
126
123
|
import "dotenv/config";
|
|
127
124
|
import { Command } from "commander";
|
|
128
|
-
import
|
|
125
|
+
import chalk16 from "chalk";
|
|
129
126
|
import enquirer4 from "enquirer";
|
|
130
127
|
import { execSync as execSync3 } from "child_process";
|
|
131
128
|
|
|
@@ -345,6 +342,7 @@ function printStartupCheckResults(results, verbose = false) {
|
|
|
345
342
|
import os2 from "os";
|
|
346
343
|
import path from "path";
|
|
347
344
|
import fs2 from "fs-extra";
|
|
345
|
+
import chalk2 from "chalk";
|
|
348
346
|
var DANGEROUS_PATHS = {
|
|
349
347
|
// Filesystem roots (Unix and Windows)
|
|
350
348
|
roots: ["/", "C:\\", "D:\\", "E:\\", "F:\\", "G:\\"],
|
|
@@ -537,46 +535,45 @@ function checkWorkspaceSafety(workspacePath) {
|
|
|
537
535
|
}
|
|
538
536
|
}
|
|
539
537
|
function printDangerousWorkspaceWarning(workspacePath, result) {
|
|
540
|
-
const chalk16 = __require("chalk");
|
|
541
538
|
const boxWidth = 65;
|
|
542
539
|
const horizontalLine = "\u2500".repeat(boxWidth - 2);
|
|
543
540
|
console.log();
|
|
544
|
-
console.log(
|
|
545
|
-
console.log(
|
|
546
|
-
console.log(
|
|
547
|
-
console.log(
|
|
548
|
-
console.log(
|
|
541
|
+
console.log(chalk2.red(`\u250C${horizontalLine}\u2510`));
|
|
542
|
+
console.log(chalk2.red(`\u2502`) + chalk2.yellow.bold(" \u26A0\uFE0F Unsafe Workspace Directory") + " ".repeat(boxWidth - 35) + chalk2.red("\u2502"));
|
|
543
|
+
console.log(chalk2.red(`\u251C${horizontalLine}\u2524`));
|
|
544
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
545
|
+
console.log(chalk2.red(`\u2502`) + chalk2.white(" You're trying to run autohand in:") + " ".repeat(boxWidth - 38) + chalk2.red("\u2502"));
|
|
549
546
|
const pathLine = ` ${workspacePath}`;
|
|
550
547
|
const truncatedPath = pathLine.length > boxWidth - 4 ? pathLine.slice(0, boxWidth - 7) + "..." : pathLine;
|
|
551
|
-
console.log(
|
|
552
|
-
console.log(
|
|
548
|
+
console.log(chalk2.red(`\u2502`) + chalk2.cyan(truncatedPath) + " ".repeat(Math.max(0, boxWidth - 2 - truncatedPath.length)) + chalk2.red("\u2502"));
|
|
549
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
553
550
|
if (result.reason) {
|
|
554
551
|
const reasonWords = result.reason.split(" ");
|
|
555
552
|
let currentLine = " ";
|
|
556
553
|
for (const word of reasonWords) {
|
|
557
554
|
if (currentLine.length + word.length + 1 > boxWidth - 4) {
|
|
558
555
|
const paddedLine = currentLine + " ".repeat(Math.max(0, boxWidth - 2 - currentLine.length));
|
|
559
|
-
console.log(
|
|
556
|
+
console.log(chalk2.red(`\u2502`) + chalk2.white(paddedLine) + chalk2.red("\u2502"));
|
|
560
557
|
currentLine = " ";
|
|
561
558
|
}
|
|
562
559
|
currentLine += (currentLine === " " ? "" : " ") + word;
|
|
563
560
|
}
|
|
564
561
|
if (currentLine.length > 2) {
|
|
565
562
|
const paddedLine = currentLine + " ".repeat(Math.max(0, boxWidth - 2 - currentLine.length));
|
|
566
|
-
console.log(
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
console.log(
|
|
570
|
-
console.log(
|
|
571
|
-
console.log(
|
|
572
|
-
console.log(
|
|
573
|
-
console.log(
|
|
574
|
-
console.log(
|
|
575
|
-
console.log(
|
|
576
|
-
console.log(
|
|
577
|
-
console.log(
|
|
578
|
-
console.log(
|
|
579
|
-
console.log(
|
|
563
|
+
console.log(chalk2.red(`\u2502`) + chalk2.white(paddedLine) + chalk2.red("\u2502"));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
567
|
+
console.log(chalk2.red(`\u2502`) + chalk2.white(" Please navigate to a specific project folder:") + " ".repeat(boxWidth - 50) + chalk2.red("\u2502"));
|
|
568
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
569
|
+
console.log(chalk2.red(`\u2502`) + chalk2.cyan(" cd ~/projects/my-app") + " ".repeat(boxWidth - 27) + chalk2.red("\u2502"));
|
|
570
|
+
console.log(chalk2.red(`\u2502`) + chalk2.cyan(" autohand") + " ".repeat(boxWidth - 15) + chalk2.red("\u2502"));
|
|
571
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
572
|
+
console.log(chalk2.red(`\u2502`) + chalk2.white(" Or specify a path directly:") + " ".repeat(boxWidth - 32) + chalk2.red("\u2502"));
|
|
573
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
574
|
+
console.log(chalk2.red(`\u2502`) + chalk2.cyan(" autohand --path ~/projects/my-app") + " ".repeat(boxWidth - 40) + chalk2.red("\u2502"));
|
|
575
|
+
console.log(chalk2.red(`\u2502`) + " ".repeat(boxWidth - 2) + chalk2.red("\u2502"));
|
|
576
|
+
console.log(chalk2.red(`\u2514${horizontalLine}\u2518`));
|
|
580
577
|
console.log();
|
|
581
578
|
}
|
|
582
579
|
|
|
@@ -2065,7 +2062,7 @@ var ProviderFactory = class {
|
|
|
2065
2062
|
};
|
|
2066
2063
|
|
|
2067
2064
|
// src/core/agent.ts
|
|
2068
|
-
import
|
|
2065
|
+
import chalk14 from "chalk";
|
|
2069
2066
|
import fs19 from "fs-extra";
|
|
2070
2067
|
import path18 from "path";
|
|
2071
2068
|
import { randomUUID } from "crypto";
|
|
@@ -2075,7 +2072,7 @@ import enquirer3 from "enquirer";
|
|
|
2075
2072
|
import readline4 from "readline";
|
|
2076
2073
|
|
|
2077
2074
|
// src/ui/inputPrompt.ts
|
|
2078
|
-
import
|
|
2075
|
+
import chalk5 from "chalk";
|
|
2079
2076
|
import readline2 from "readline";
|
|
2080
2077
|
import { existsSync, readFileSync } from "fs";
|
|
2081
2078
|
import { basename, extname } from "path";
|
|
@@ -2107,7 +2104,7 @@ var TerminalResizeWatcher = class {
|
|
|
2107
2104
|
};
|
|
2108
2105
|
|
|
2109
2106
|
// src/ui/mentionPreview.ts
|
|
2110
|
-
import
|
|
2107
|
+
import chalk3 from "chalk";
|
|
2111
2108
|
import readline from "readline";
|
|
2112
2109
|
|
|
2113
2110
|
// src/ui/mentionFilter.ts
|
|
@@ -2165,7 +2162,7 @@ var MentionPreview = class {
|
|
|
2165
2162
|
this.lastSuggestions = [];
|
|
2166
2163
|
const input = rl.input;
|
|
2167
2164
|
readline.emitKeypressEvents(input, rl);
|
|
2168
|
-
this.statusLine = statusLine ?
|
|
2165
|
+
this.statusLine = statusLine ? chalk3.gray(statusLine) : void 0;
|
|
2169
2166
|
this.keypressHandler = this.handleKeypress.bind(this);
|
|
2170
2167
|
input.prependListener("keypress", this.keypressHandler);
|
|
2171
2168
|
this.render([]);
|
|
@@ -2270,7 +2267,7 @@ var MentionPreview = class {
|
|
|
2270
2267
|
const normalized = seed.toLowerCase();
|
|
2271
2268
|
this.slashMatches = this.slashCommands.filter((cmd) => cmd.command.replace("/", "").toLowerCase().includes(normalized)).slice(0, 5);
|
|
2272
2269
|
return this.slashMatches.map((cmd) => {
|
|
2273
|
-
const detail = cmd.description ?
|
|
2270
|
+
const detail = cmd.description ? chalk3.gray(` \u2014 ${cmd.description}`) : "";
|
|
2274
2271
|
return `${cmd.command}${detail}`;
|
|
2275
2272
|
});
|
|
2276
2273
|
}
|
|
@@ -2280,21 +2277,21 @@ var MentionPreview = class {
|
|
|
2280
2277
|
}
|
|
2281
2278
|
const suggestionLines = suggestions.map((entry, idx) => {
|
|
2282
2279
|
const isSelected = this.mode && idx === this.activeIndex;
|
|
2283
|
-
const pointer = isSelected ?
|
|
2280
|
+
const pointer = isSelected ? chalk3.cyan("\u25B8") : " ";
|
|
2284
2281
|
if (this.mode === "file") {
|
|
2285
2282
|
const parts = entry.split("/");
|
|
2286
2283
|
const filename = parts.pop() || entry;
|
|
2287
2284
|
const dir = parts.length ? parts.join("/") + "/" : "";
|
|
2288
2285
|
if (isSelected) {
|
|
2289
|
-
const highlighted =
|
|
2290
|
-
const path21 = dir ?
|
|
2286
|
+
const highlighted = chalk3.cyan(filename);
|
|
2287
|
+
const path21 = dir ? chalk3.gray(dir) : "";
|
|
2291
2288
|
return `${pointer} ${path21}${highlighted}`;
|
|
2292
2289
|
}
|
|
2293
|
-
const dimmedFilename =
|
|
2294
|
-
const path20 = dir ?
|
|
2290
|
+
const dimmedFilename = chalk3.white(filename);
|
|
2291
|
+
const path20 = dir ? chalk3.gray(dir) : "";
|
|
2295
2292
|
return `${pointer} ${path20}${dimmedFilename}`;
|
|
2296
2293
|
}
|
|
2297
|
-
const text = isSelected ?
|
|
2294
|
+
const text = isSelected ? chalk3.cyan(entry) : entry;
|
|
2298
2295
|
return `${pointer} ${text}`;
|
|
2299
2296
|
});
|
|
2300
2297
|
const lines = [
|
|
@@ -2314,7 +2311,7 @@ var MentionPreview = class {
|
|
|
2314
2311
|
this.mentionLines = lines.length + 1;
|
|
2315
2312
|
readline.moveCursor(this.output, 0, -this.mentionLines);
|
|
2316
2313
|
readline.cursorTo(this.output, 0);
|
|
2317
|
-
this.output.write(`${
|
|
2314
|
+
this.output.write(`${chalk3.gray("\u203A")} ${this.rl.line}`);
|
|
2318
2315
|
readline.cursorTo(this.output, this.rl.cursor + 2);
|
|
2319
2316
|
}
|
|
2320
2317
|
clear(reprompt = true) {
|
|
@@ -2357,7 +2354,7 @@ var MentionPreview = class {
|
|
|
2357
2354
|
this.rl._refreshLine();
|
|
2358
2355
|
} else {
|
|
2359
2356
|
readline.cursorTo(this.output, 0);
|
|
2360
|
-
this.output.write(`${
|
|
2357
|
+
this.output.write(`${chalk3.gray("\u203A")} ${newLine}`);
|
|
2361
2358
|
readline.cursorTo(this.output, newCursorPos + 2);
|
|
2362
2359
|
}
|
|
2363
2360
|
}
|
|
@@ -2523,10 +2520,10 @@ function supportsVision(model) {
|
|
|
2523
2520
|
}
|
|
2524
2521
|
|
|
2525
2522
|
// src/ui/box.ts
|
|
2526
|
-
import
|
|
2523
|
+
import chalk4 from "chalk";
|
|
2527
2524
|
function drawInputBox(prompt, width) {
|
|
2528
2525
|
const padded = prompt.padEnd(width, " ");
|
|
2529
|
-
return
|
|
2526
|
+
return chalk4.bgHex("#2b2b2b").hex("#a0a0a0")(padded);
|
|
2530
2527
|
}
|
|
2531
2528
|
|
|
2532
2529
|
// src/ui/inputPrompt.ts
|
|
@@ -2569,7 +2566,7 @@ function createReadline(stdInput, stdOutput) {
|
|
|
2569
2566
|
const rl = readline2.createInterface({
|
|
2570
2567
|
input: stdInput,
|
|
2571
2568
|
output: stdOutput,
|
|
2572
|
-
prompt: `${
|
|
2569
|
+
prompt: `${chalk5.gray("\u203A")} `,
|
|
2573
2570
|
terminal: true,
|
|
2574
2571
|
crlfDelay: Infinity,
|
|
2575
2572
|
historySize: 100,
|
|
@@ -2605,7 +2602,7 @@ async function promptOnce(options) {
|
|
|
2605
2602
|
if (parsed) {
|
|
2606
2603
|
const id = onImageDetected(parsed.data, parsed.mimeType);
|
|
2607
2604
|
result = result.replace(dataUrl, `[Image #${id}]`);
|
|
2608
|
-
stdOutput.write(
|
|
2605
|
+
stdOutput.write(chalk5.cyan(`
|
|
2609
2606
|
\u{1F4F7} Detected base64 image -> [Image #${id}]
|
|
2610
2607
|
`));
|
|
2611
2608
|
}
|
|
@@ -2623,7 +2620,7 @@ async function promptOnce(options) {
|
|
|
2623
2620
|
if (mimeType) {
|
|
2624
2621
|
const id = onImageDetected(data, mimeType, basename(filePath));
|
|
2625
2622
|
result = result.replace(fullMatch, `[Image #${id}] ${basename(filePath)}`);
|
|
2626
|
-
stdOutput.write(
|
|
2623
|
+
stdOutput.write(chalk5.cyan(`
|
|
2627
2624
|
\u{1F4F7} Loaded image: ${filePath} -> [Image #${id}]
|
|
2628
2625
|
`));
|
|
2629
2626
|
}
|
|
@@ -2634,25 +2631,25 @@ async function promptOnce(options) {
|
|
|
2634
2631
|
const escapedPathRegex = /(?:^|[\s])((\/|~)(?:[^\s\\]|\\.)+\.(?:png|jpg|jpeg|gif|webp))(?=[\s]|$)/gi;
|
|
2635
2632
|
let escapedMatch;
|
|
2636
2633
|
if (process.env.DEBUG_IMAGES) {
|
|
2637
|
-
stdOutput.write(
|
|
2634
|
+
stdOutput.write(chalk5.gray(`
|
|
2638
2635
|
[DEBUG] processImagesInText called
|
|
2639
2636
|
`));
|
|
2640
|
-
stdOutput.write(
|
|
2637
|
+
stdOutput.write(chalk5.gray(`[DEBUG] Input text: ${JSON.stringify(text)}
|
|
2641
2638
|
`));
|
|
2642
|
-
stdOutput.write(
|
|
2639
|
+
stdOutput.write(chalk5.gray(`[DEBUG] Has backslash: ${text.includes("\\")}
|
|
2643
2640
|
`));
|
|
2644
|
-
stdOutput.write(
|
|
2641
|
+
stdOutput.write(chalk5.gray(`[DEBUG] Char codes: ${text.slice(0, 50).split("").map((c) => c.charCodeAt(0)).join(",")}
|
|
2645
2642
|
`));
|
|
2646
2643
|
}
|
|
2647
2644
|
while ((escapedMatch = escapedPathRegex.exec(text)) !== null) {
|
|
2648
2645
|
const rawPath = escapedMatch[1];
|
|
2649
2646
|
const filePath = rawPath.replace(/\\ /g, " ");
|
|
2650
2647
|
if (process.env.DEBUG_IMAGES) {
|
|
2651
|
-
stdOutput.write(
|
|
2648
|
+
stdOutput.write(chalk5.gray(`[DEBUG] Regex matched: ${JSON.stringify(rawPath)}
|
|
2652
2649
|
`));
|
|
2653
|
-
stdOutput.write(
|
|
2650
|
+
stdOutput.write(chalk5.gray(`[DEBUG] Converted path: ${JSON.stringify(filePath)}
|
|
2654
2651
|
`));
|
|
2655
|
-
stdOutput.write(
|
|
2652
|
+
stdOutput.write(chalk5.gray(`[DEBUG] File exists: ${existsSync(filePath)}
|
|
2656
2653
|
`));
|
|
2657
2654
|
}
|
|
2658
2655
|
if (result.includes(rawPath) && existsSync(filePath)) {
|
|
@@ -2663,7 +2660,7 @@ async function promptOnce(options) {
|
|
|
2663
2660
|
if (mimeType) {
|
|
2664
2661
|
const id = onImageDetected(data, mimeType, basename(filePath));
|
|
2665
2662
|
result = result.replace(rawPath, `[Image #${id}] ${basename(filePath)}`);
|
|
2666
|
-
stdOutput.write(
|
|
2663
|
+
stdOutput.write(chalk5.cyan(`
|
|
2667
2664
|
\u{1F4F7} Loaded image: ${filePath} -> [Image #${id}]
|
|
2668
2665
|
`));
|
|
2669
2666
|
}
|
|
@@ -2683,7 +2680,7 @@ async function promptOnce(options) {
|
|
|
2683
2680
|
if (mimeType) {
|
|
2684
2681
|
const id = onImageDetected(data, mimeType, basename(filePath));
|
|
2685
2682
|
result = result.replace(filePath, `[Image #${id}] ${basename(filePath)}`);
|
|
2686
|
-
stdOutput.write(
|
|
2683
|
+
stdOutput.write(chalk5.cyan(`
|
|
2687
2684
|
\u{1F4F7} Loaded image: ${filePath} -> [Image #${id}]
|
|
2688
2685
|
`));
|
|
2689
2686
|
}
|
|
@@ -2747,7 +2744,7 @@ async function promptOnce(options) {
|
|
|
2747
2744
|
ctrlCCount = 1;
|
|
2748
2745
|
mentionPreview.reset();
|
|
2749
2746
|
stdOutput.write(`
|
|
2750
|
-
${
|
|
2747
|
+
${chalk5.gray("Press Ctrl+C again to exit.")}
|
|
2751
2748
|
`);
|
|
2752
2749
|
renderPromptLine(rl, statusLine, stdOutput);
|
|
2753
2750
|
return;
|
|
@@ -2759,14 +2756,14 @@ ${chalk4.gray("Press Ctrl+C again to exit.")}
|
|
|
2759
2756
|
ctrlCCount = 0;
|
|
2760
2757
|
};
|
|
2761
2758
|
input.on("keypress", handleKeypress);
|
|
2762
|
-
rl.setPrompt(`${
|
|
2759
|
+
rl.setPrompt(`${chalk5.gray("\u203A")} `);
|
|
2763
2760
|
rl.prompt(true);
|
|
2764
2761
|
rl.on("line", (value) => {
|
|
2765
2762
|
let finalValue = convertNewlineMarkersToNewlines(value).trim();
|
|
2766
2763
|
finalValue = processImagesInText(finalValue);
|
|
2767
2764
|
stdOutput.write("\n");
|
|
2768
2765
|
if (finalValue && !finalValue.startsWith("/")) {
|
|
2769
|
-
stdOutput.write(`${
|
|
2766
|
+
stdOutput.write(`${chalk5.gray("press ESC to interrupt")}
|
|
2770
2767
|
|
|
2771
2768
|
`);
|
|
2772
2769
|
}
|
|
@@ -2790,7 +2787,7 @@ ${chalk4.gray("Press Ctrl+C again to exit.")}
|
|
|
2790
2787
|
ctrlCCount = 1;
|
|
2791
2788
|
mentionPreview.reset();
|
|
2792
2789
|
stdOutput.write(`
|
|
2793
|
-
${
|
|
2790
|
+
${chalk5.gray("Press Ctrl+C again to exit.")}
|
|
2794
2791
|
`);
|
|
2795
2792
|
renderPromptLine(rl, statusLine, stdOutput);
|
|
2796
2793
|
return;
|
|
@@ -2819,7 +2816,7 @@ function renderPromptLine(rl, statusLine, output, isResize = false) {
|
|
|
2819
2816
|
readline2.cursorTo(output, 0);
|
|
2820
2817
|
output.write(`${box}
|
|
2821
2818
|
`);
|
|
2822
|
-
rl.setPrompt(`${
|
|
2819
|
+
rl.setPrompt(`${chalk5.gray("\u203A")} `);
|
|
2823
2820
|
rl.prompt(true);
|
|
2824
2821
|
}
|
|
2825
2822
|
|
|
@@ -4940,12 +4937,12 @@ var ToolManager = class _ToolManager {
|
|
|
4940
4937
|
};
|
|
4941
4938
|
|
|
4942
4939
|
// src/core/actionExecutor.ts
|
|
4943
|
-
import
|
|
4940
|
+
import chalk7 from "chalk";
|
|
4944
4941
|
import enquirer from "enquirer";
|
|
4945
4942
|
import { diffLines } from "diff";
|
|
4946
4943
|
|
|
4947
4944
|
// src/ui/syntaxHighlight.ts
|
|
4948
|
-
import
|
|
4945
|
+
import chalk6 from "chalk";
|
|
4949
4946
|
import path5 from "path";
|
|
4950
4947
|
var EXTENSION_MAP = {
|
|
4951
4948
|
".ts": "typescript",
|
|
@@ -5450,21 +5447,21 @@ function colorToken(token) {
|
|
|
5450
5447
|
}
|
|
5451
5448
|
switch (token.type) {
|
|
5452
5449
|
case "keyword":
|
|
5453
|
-
return
|
|
5450
|
+
return chalk6.magenta(token.value);
|
|
5454
5451
|
case "string":
|
|
5455
|
-
return
|
|
5452
|
+
return chalk6.green(token.value);
|
|
5456
5453
|
case "number":
|
|
5457
|
-
return
|
|
5454
|
+
return chalk6.yellow(token.value);
|
|
5458
5455
|
case "comment":
|
|
5459
|
-
return
|
|
5456
|
+
return chalk6.gray(token.value);
|
|
5460
5457
|
case "type":
|
|
5461
|
-
return
|
|
5458
|
+
return chalk6.cyan(token.value);
|
|
5462
5459
|
case "function":
|
|
5463
|
-
return
|
|
5460
|
+
return chalk6.blue(token.value);
|
|
5464
5461
|
case "operator":
|
|
5465
|
-
return
|
|
5462
|
+
return chalk6.white(token.value);
|
|
5466
5463
|
case "punctuation":
|
|
5467
|
-
return
|
|
5464
|
+
return chalk6.white(token.value);
|
|
5468
5465
|
default:
|
|
5469
5466
|
return token.value;
|
|
5470
5467
|
}
|
|
@@ -6952,19 +6949,19 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
6952
6949
|
const startLine = Math.min(offset, totalLines);
|
|
6953
6950
|
const endLine = Math.min(startLine + effectiveLimit, totalLines);
|
|
6954
6951
|
const chunk = allLines.slice(startLine, endLine).join("\n");
|
|
6955
|
-
console.log(
|
|
6952
|
+
console.log(chalk7.cyan(`
|
|
6956
6953
|
\u{1F4C4} ${action.path}`));
|
|
6957
|
-
console.log(
|
|
6954
|
+
console.log(chalk7.gray(` Lines ${startLine + 1}-${endLine} of ${totalLines} (${fileSizeKB} KB total)`));
|
|
6958
6955
|
if (endLine < totalLines) {
|
|
6959
|
-
console.log(
|
|
6956
|
+
console.log(chalk7.yellow(` ${totalLines - endLine} more lines remaining`));
|
|
6960
6957
|
}
|
|
6961
6958
|
return chunk;
|
|
6962
6959
|
}
|
|
6963
6960
|
if (totalLines > MAX_LINES || fileSize > MAX_SIZE_BYTES) {
|
|
6964
|
-
console.log(
|
|
6961
|
+
console.log(chalk7.cyan(`
|
|
6965
6962
|
\u{1F4C4} ${action.path}`));
|
|
6966
|
-
console.log(
|
|
6967
|
-
console.log(
|
|
6963
|
+
console.log(chalk7.yellow(` \u26A0 Large file: ${totalLines} lines \u2022 ${fileSizeKB} KB`));
|
|
6964
|
+
console.log(chalk7.gray(` Smart chunking: outline + first ${CHUNK_SIZE} lines`));
|
|
6968
6965
|
const outline = this.extractFileOutline(allLines, action.path);
|
|
6969
6966
|
const firstChunk = allLines.slice(0, CHUNK_SIZE).join("\n");
|
|
6970
6967
|
const response = [
|
|
@@ -6983,9 +6980,9 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
6983
6980
|
].join("\n");
|
|
6984
6981
|
return response;
|
|
6985
6982
|
}
|
|
6986
|
-
console.log(
|
|
6983
|
+
console.log(chalk7.cyan(`
|
|
6987
6984
|
\u{1F4C4} ${action.path}`));
|
|
6988
|
-
console.log(
|
|
6985
|
+
console.log(chalk7.gray(` ${totalLines} lines \u2022 ${fileSizeKB} KB`));
|
|
6989
6986
|
return fullContents;
|
|
6990
6987
|
}
|
|
6991
6988
|
case "write_file": {
|
|
@@ -7008,7 +7005,7 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7008
7005
|
return `Blocked: Cannot create ${action.path} (${decision.reason})`;
|
|
7009
7006
|
}
|
|
7010
7007
|
if (decision.allowed) {
|
|
7011
|
-
console.log(
|
|
7008
|
+
console.log(chalk7.cyan(`
|
|
7012
7009
|
\u2728 Creating: ${action.path}`));
|
|
7013
7010
|
} else {
|
|
7014
7011
|
const hookResult = await this.checkPermissionHook({
|
|
@@ -7021,7 +7018,7 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7021
7018
|
}
|
|
7022
7019
|
if (hookResult.allowed !== void 0) {
|
|
7023
7020
|
if (hookResult.allowed) {
|
|
7024
|
-
console.log(
|
|
7021
|
+
console.log(chalk7.cyan(`
|
|
7025
7022
|
\u2728 Creating: ${action.path}`));
|
|
7026
7023
|
await this.permissionManager.recordDecision(permContext, true);
|
|
7027
7024
|
} else {
|
|
@@ -7029,10 +7026,10 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7029
7026
|
return `Denied: ${hookResult.reason}`;
|
|
7030
7027
|
}
|
|
7031
7028
|
} else {
|
|
7032
|
-
console.log(
|
|
7029
|
+
console.log(chalk7.cyan(`
|
|
7033
7030
|
\u2728 Creating new file: ${action.path}`));
|
|
7034
7031
|
const preview = newContent.length > 500 ? newContent.substring(0, 500) + "\n... (truncated)" : newContent;
|
|
7035
|
-
console.log(
|
|
7032
|
+
console.log(chalk7.gray(preview));
|
|
7036
7033
|
const confirmed = await this.confirmDangerousAction(
|
|
7037
7034
|
`Create new file ${action.path}?`,
|
|
7038
7035
|
{ tool: "write_file", path: action.path }
|
|
@@ -7044,7 +7041,7 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7044
7041
|
}
|
|
7045
7042
|
}
|
|
7046
7043
|
} else if (oldContent !== newContent) {
|
|
7047
|
-
console.log(
|
|
7044
|
+
console.log(chalk7.cyan(`
|
|
7048
7045
|
\u{1F4DD} ${action.path}:`));
|
|
7049
7046
|
this.showDiff(oldContent, newContent, action.path);
|
|
7050
7047
|
}
|
|
@@ -7059,7 +7056,7 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7059
7056
|
const addition = this.pickText(action.contents, action.content) ?? "";
|
|
7060
7057
|
const oldContent = await this.files.readFile(action.path).catch(() => "");
|
|
7061
7058
|
const newContent = oldContent + addition;
|
|
7062
|
-
console.log(
|
|
7059
|
+
console.log(chalk7.cyan(`
|
|
7063
7060
|
\u{1F4DD} ${action.path}:`));
|
|
7064
7061
|
this.showDiff(oldContent, newContent, action.path);
|
|
7065
7062
|
await this.files.appendFile(action.path, addition);
|
|
@@ -7075,9 +7072,9 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7075
7072
|
if (!patch) {
|
|
7076
7073
|
throw new Error("apply_patch requires patch or diff content.");
|
|
7077
7074
|
}
|
|
7078
|
-
console.log(
|
|
7075
|
+
console.log(chalk7.cyan(`
|
|
7079
7076
|
\u{1F527} ${action.path}:`));
|
|
7080
|
-
console.log(
|
|
7077
|
+
console.log(chalk7.gray("Applying patch..."));
|
|
7081
7078
|
await this.files.applyPatch(action.path, patch);
|
|
7082
7079
|
const newContent = await this.files.readFile(action.path);
|
|
7083
7080
|
this.showDiff(oldContent, newContent, action.path);
|
|
@@ -7127,7 +7124,7 @@ var ActionExecutor = class _ActionExecutor {
|
|
|
7127
7124
|
this.searchCache.set(cacheKey, "No matches found.");
|
|
7128
7125
|
return "No matches found.";
|
|
7129
7126
|
}
|
|
7130
|
-
const result = results.map((hit) => `${
|
|
7127
|
+
const result = results.map((hit) => `${chalk7.cyan(hit.file)}
|
|
7131
7128
|
${hit.snippet}`).join("\n\n");
|
|
7132
7129
|
this.searchCache.set(cacheKey, result);
|
|
7133
7130
|
return result;
|
|
@@ -7168,7 +7165,7 @@ ${hit.snippet}`).join("\n\n");
|
|
|
7168
7165
|
const content = await this.files.readFile(action.path);
|
|
7169
7166
|
const result = this.applySearchReplaceBlocks(content, action.blocks);
|
|
7170
7167
|
if (content !== result) {
|
|
7171
|
-
console.log(
|
|
7168
|
+
console.log(chalk7.cyan(`
|
|
7172
7169
|
\u{1F504} ${action.path}:`));
|
|
7173
7170
|
this.showDiff(content, result, action.path);
|
|
7174
7171
|
await this.files.writeFile(action.path, result);
|
|
@@ -7312,23 +7309,23 @@ ${hit.snippet}`).join("\n\n");
|
|
|
7312
7309
|
if (statuses.length === 0) {
|
|
7313
7310
|
return "No worktrees found.";
|
|
7314
7311
|
}
|
|
7315
|
-
const lines = [
|
|
7312
|
+
const lines = [chalk7.cyan("\u{1F4CA} Worktree Status Summary:"), ""];
|
|
7316
7313
|
for (const status of statuses) {
|
|
7317
7314
|
const branchName = status.worktree.branch || "(detached)";
|
|
7318
|
-
const cleanIcon = status.isClean ?
|
|
7319
|
-
const syncInfo = status.gitStatus.ahead > 0 || status.gitStatus.behind > 0 ?
|
|
7320
|
-
lines.push(`${cleanIcon} ${
|
|
7321
|
-
lines.push(
|
|
7315
|
+
const cleanIcon = status.isClean ? chalk7.green("\u2713") : chalk7.yellow("!");
|
|
7316
|
+
const syncInfo = status.gitStatus.ahead > 0 || status.gitStatus.behind > 0 ? chalk7.gray(` [\u2191${status.gitStatus.ahead} \u2193${status.gitStatus.behind}]`) : "";
|
|
7317
|
+
lines.push(`${cleanIcon} ${chalk7.bold(branchName)}${syncInfo}`);
|
|
7318
|
+
lines.push(chalk7.gray(` ${status.worktree.path}`));
|
|
7322
7319
|
if (!status.isClean) {
|
|
7323
7320
|
const changes = [];
|
|
7324
7321
|
if (status.gitStatus.staged > 0) changes.push(`${status.gitStatus.staged} staged`);
|
|
7325
7322
|
if (status.gitStatus.modified > 0) changes.push(`${status.gitStatus.modified} modified`);
|
|
7326
7323
|
if (status.gitStatus.untracked > 0) changes.push(`${status.gitStatus.untracked} untracked`);
|
|
7327
|
-
if (status.gitStatus.conflicts > 0) changes.push(
|
|
7328
|
-
lines.push(
|
|
7324
|
+
if (status.gitStatus.conflicts > 0) changes.push(chalk7.red(`${status.gitStatus.conflicts} conflicts`));
|
|
7325
|
+
lines.push(chalk7.yellow(` ${changes.join(", ")}`));
|
|
7329
7326
|
}
|
|
7330
7327
|
if (status.lastCommit) {
|
|
7331
|
-
lines.push(
|
|
7328
|
+
lines.push(chalk7.gray(` Last commit: ${status.lastCommit.message.substring(0, 50)}`));
|
|
7332
7329
|
}
|
|
7333
7330
|
lines.push("");
|
|
7334
7331
|
}
|
|
@@ -7356,7 +7353,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7356
7353
|
}
|
|
7357
7354
|
case "git_worktree_run_parallel": {
|
|
7358
7355
|
const manager = new WorktreeManager(this.runtime.workspaceRoot);
|
|
7359
|
-
console.log(
|
|
7356
|
+
console.log(chalk7.cyan(`
|
|
7360
7357
|
\u{1F504} Running "${action.command}" across all worktrees...
|
|
7361
7358
|
`));
|
|
7362
7359
|
const results = await manager.runParallel(action.command, {
|
|
@@ -7368,22 +7365,22 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7368
7365
|
let failCount = 0;
|
|
7369
7366
|
for (const result of results) {
|
|
7370
7367
|
const branchName = result.branch || "(detached)";
|
|
7371
|
-
const statusIcon = result.success ?
|
|
7368
|
+
const statusIcon = result.success ? chalk7.green("\u2713") : chalk7.red("\u2717");
|
|
7372
7369
|
const duration = `${(result.duration / 1e3).toFixed(1)}s`;
|
|
7373
|
-
lines.push(`${statusIcon} ${
|
|
7370
|
+
lines.push(`${statusIcon} ${chalk7.bold(branchName)} (${duration})`);
|
|
7374
7371
|
if (result.success) {
|
|
7375
7372
|
successCount++;
|
|
7376
7373
|
if (result.output.trim()) {
|
|
7377
|
-
lines.push(
|
|
7374
|
+
lines.push(chalk7.gray(result.output.trim().split("\n").map((l) => ` ${l}`).join("\n")));
|
|
7378
7375
|
}
|
|
7379
7376
|
} else {
|
|
7380
7377
|
failCount++;
|
|
7381
|
-
lines.push(
|
|
7378
|
+
lines.push(chalk7.red(` Error: ${result.error}`));
|
|
7382
7379
|
}
|
|
7383
7380
|
lines.push("");
|
|
7384
7381
|
}
|
|
7385
7382
|
lines.unshift(
|
|
7386
|
-
|
|
7383
|
+
chalk7.cyan(`\u{1F4CA} Results: ${successCount} succeeded, ${failCount} failed`),
|
|
7387
7384
|
""
|
|
7388
7385
|
);
|
|
7389
7386
|
return lines.join("\n");
|
|
@@ -7395,23 +7392,23 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7395
7392
|
mainBranch: action.main_branch,
|
|
7396
7393
|
dryRun: action.dry_run
|
|
7397
7394
|
});
|
|
7398
|
-
const lines = [
|
|
7395
|
+
const lines = [chalk7.cyan("\u{1F504} Worktree Sync Results:"), ""];
|
|
7399
7396
|
if (result.synced.length > 0) {
|
|
7400
|
-
lines.push(
|
|
7397
|
+
lines.push(chalk7.green(`Synced (${result.synced.length}):`));
|
|
7401
7398
|
for (const path20 of result.synced) {
|
|
7402
7399
|
lines.push(` \u2713 ${path20}`);
|
|
7403
7400
|
}
|
|
7404
7401
|
lines.push("");
|
|
7405
7402
|
}
|
|
7406
7403
|
if (result.skipped.length > 0) {
|
|
7407
|
-
lines.push(
|
|
7404
|
+
lines.push(chalk7.yellow(`Skipped (${result.skipped.length}):`));
|
|
7408
7405
|
for (const info of result.skipped) {
|
|
7409
7406
|
lines.push(` \u2298 ${info}`);
|
|
7410
7407
|
}
|
|
7411
7408
|
lines.push("");
|
|
7412
7409
|
}
|
|
7413
7410
|
if (result.failed.length > 0) {
|
|
7414
|
-
lines.push(
|
|
7411
|
+
lines.push(chalk7.red(`Failed (${result.failed.length}):`));
|
|
7415
7412
|
for (const info of result.failed) {
|
|
7416
7413
|
lines.push(` \u2717 ${info}`);
|
|
7417
7414
|
}
|
|
@@ -7433,9 +7430,9 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7433
7430
|
const available = templates.map((t) => t.name).join(", ");
|
|
7434
7431
|
throw new Error(`Unknown template "${action.template}". Available: ${available}`);
|
|
7435
7432
|
}
|
|
7436
|
-
console.log(
|
|
7433
|
+
console.log(chalk7.cyan(`
|
|
7437
7434
|
\u{1F4C1} Creating worktree from template "${action.template}"...`));
|
|
7438
|
-
console.log(
|
|
7435
|
+
console.log(chalk7.gray(` Template: ${template.description}`));
|
|
7439
7436
|
const result = await manager.create({
|
|
7440
7437
|
branch: action.branch,
|
|
7441
7438
|
newBranch: true,
|
|
@@ -7527,21 +7524,21 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7527
7524
|
}
|
|
7528
7525
|
const info = getAutoCommitInfo(this.runtime.workspaceRoot);
|
|
7529
7526
|
if (!info.canCommit) {
|
|
7530
|
-
console.log(
|
|
7527
|
+
console.log(chalk7.yellow(`
|
|
7531
7528
|
\u26A0 ${info.error}`));
|
|
7532
7529
|
return info.error || "Cannot commit";
|
|
7533
7530
|
}
|
|
7534
7531
|
let commitMessage = action.message || info.suggestedMessage;
|
|
7535
|
-
console.log(
|
|
7532
|
+
console.log(chalk7.cyan("\n\u{1F4DD} Changes to commit:"));
|
|
7536
7533
|
info.filesChanged.slice(0, 10).forEach((file) => {
|
|
7537
|
-
console.log(
|
|
7534
|
+
console.log(chalk7.gray(` ${file}`));
|
|
7538
7535
|
});
|
|
7539
7536
|
if (info.filesChanged.length > 10) {
|
|
7540
|
-
console.log(
|
|
7537
|
+
console.log(chalk7.gray(` ... and ${info.filesChanged.length - 10} more files`));
|
|
7541
7538
|
}
|
|
7542
7539
|
console.log();
|
|
7543
|
-
console.log(
|
|
7544
|
-
console.log(
|
|
7540
|
+
console.log(chalk7.cyan("Suggested commit message:"));
|
|
7541
|
+
console.log(chalk7.white(` ${commitMessage}`));
|
|
7545
7542
|
console.log();
|
|
7546
7543
|
const { choice } = await enquirer.prompt({
|
|
7547
7544
|
type: "select",
|
|
@@ -7554,7 +7551,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7554
7551
|
]
|
|
7555
7552
|
});
|
|
7556
7553
|
if (choice === "n") {
|
|
7557
|
-
console.log(
|
|
7554
|
+
console.log(chalk7.yellow("Commit cancelled."));
|
|
7558
7555
|
return "Commit cancelled by user";
|
|
7559
7556
|
}
|
|
7560
7557
|
if (choice === "e") {
|
|
@@ -7568,11 +7565,11 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7568
7565
|
}
|
|
7569
7566
|
const result = executeAutoCommit(this.runtime.workspaceRoot, commitMessage, action.stage_all !== false);
|
|
7570
7567
|
if (result.success) {
|
|
7571
|
-
console.log(
|
|
7568
|
+
console.log(chalk7.green(`
|
|
7572
7569
|
\u2713 ${result.message}`));
|
|
7573
7570
|
return result.message;
|
|
7574
7571
|
} else {
|
|
7575
|
-
console.log(
|
|
7572
|
+
console.log(chalk7.red(`
|
|
7576
7573
|
\u2717 ${result.message}`));
|
|
7577
7574
|
return result.message;
|
|
7578
7575
|
}
|
|
@@ -7600,24 +7597,24 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7600
7597
|
case "multi_file_edit": {
|
|
7601
7598
|
const oldContent = await this.files.readFile(action.file_path);
|
|
7602
7599
|
let newContent = oldContent;
|
|
7603
|
-
console.log(
|
|
7600
|
+
console.log(chalk7.cyan(`
|
|
7604
7601
|
\u270F\uFE0F ${action.file_path}:`));
|
|
7605
|
-
console.log(
|
|
7602
|
+
console.log(chalk7.gray(`Applying ${action.edits.length} edit(s)...`));
|
|
7606
7603
|
for (let i = 0; i < action.edits.length; i++) {
|
|
7607
7604
|
const edit = action.edits[i];
|
|
7608
7605
|
if (edit.replace_all) {
|
|
7609
7606
|
const count = (newContent.match(new RegExp(this.escapeRegex(edit.old_string), "g")) || []).length;
|
|
7610
7607
|
if (count === 0) {
|
|
7611
|
-
console.log(
|
|
7612
|
-
console.log(
|
|
7608
|
+
console.log(chalk7.yellow(` \u26A0 Edit ${i + 1}: No occurrences found to replace`));
|
|
7609
|
+
console.log(chalk7.gray(` Looking for: "${edit.old_string.substring(0, 60)}${edit.old_string.length > 60 ? "..." : ""}"`));
|
|
7613
7610
|
const similar = this.findSimilarText(newContent, edit.old_string);
|
|
7614
7611
|
if (similar) {
|
|
7615
|
-
console.log(
|
|
7612
|
+
console.log(chalk7.gray(` Similar text found: "${similar.substring(0, 60)}${similar.length > 60 ? "..." : ""}"`));
|
|
7616
7613
|
}
|
|
7617
7614
|
continue;
|
|
7618
7615
|
}
|
|
7619
7616
|
newContent = newContent.replaceAll(edit.old_string, edit.new_string);
|
|
7620
|
-
console.log(
|
|
7617
|
+
console.log(chalk7.green(` \u2713 Edit ${i + 1}: Replaced ${count} occurrence(s)`));
|
|
7621
7618
|
} else {
|
|
7622
7619
|
let firstIndex = newContent.indexOf(edit.old_string);
|
|
7623
7620
|
if (firstIndex === -1) {
|
|
@@ -7625,37 +7622,37 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7625
7622
|
const normalizedContent = this.normalizeText(newContent);
|
|
7626
7623
|
const normalizedIndex = normalizedContent.indexOf(normalizedOld);
|
|
7627
7624
|
if (normalizedIndex !== -1) {
|
|
7628
|
-
console.log(
|
|
7625
|
+
console.log(chalk7.yellow(` \u26A0 Edit ${i + 1}: Found match with normalized text (unicode chars differ)`));
|
|
7629
7626
|
const actualOldString = this.extractMatchingText(newContent, normalizedContent, normalizedOld, normalizedIndex);
|
|
7630
7627
|
if (actualOldString) {
|
|
7631
7628
|
firstIndex = newContent.indexOf(actualOldString);
|
|
7632
7629
|
if (firstIndex !== -1) {
|
|
7633
7630
|
newContent = newContent.substring(0, firstIndex) + edit.new_string + newContent.substring(firstIndex + actualOldString.length);
|
|
7634
|
-
console.log(
|
|
7631
|
+
console.log(chalk7.green(` \u2713 Edit ${i + 1}: Applied with normalized match`));
|
|
7635
7632
|
continue;
|
|
7636
7633
|
}
|
|
7637
7634
|
}
|
|
7638
7635
|
}
|
|
7639
7636
|
}
|
|
7640
7637
|
if (firstIndex === -1) {
|
|
7641
|
-
console.log(
|
|
7642
|
-
console.log(
|
|
7643
|
-
console.log(
|
|
7638
|
+
console.log(chalk7.red(` \u2717 Edit ${i + 1}: Could not find text to replace`));
|
|
7639
|
+
console.log(chalk7.gray(` Looking for (${edit.old_string.length} chars):`));
|
|
7640
|
+
console.log(chalk7.gray(` "${edit.old_string.substring(0, 80)}${edit.old_string.length > 80 ? "..." : ""}"`));
|
|
7644
7641
|
const similar = this.findSimilarText(newContent, edit.old_string);
|
|
7645
7642
|
if (similar) {
|
|
7646
|
-
console.log(
|
|
7647
|
-
console.log(
|
|
7643
|
+
console.log(chalk7.yellow(` Did you mean:`));
|
|
7644
|
+
console.log(chalk7.yellow(` "${similar.substring(0, 80)}${similar.length > 80 ? "..." : ""}"`));
|
|
7648
7645
|
}
|
|
7649
7646
|
if (edit.old_string.length < 100) {
|
|
7650
7647
|
const nonAscii = edit.old_string.match(/[^\x20-\x7E\n\r\t]/g);
|
|
7651
7648
|
if (nonAscii && nonAscii.length > 0) {
|
|
7652
|
-
console.log(
|
|
7649
|
+
console.log(chalk7.gray(` Non-ASCII chars: ${nonAscii.map((c) => `'${c}' (U+${c.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0")})`).join(", ")}`));
|
|
7653
7650
|
}
|
|
7654
7651
|
}
|
|
7655
7652
|
throw new Error(`Could not find text to replace in edit ${i + 1}. See details above.`);
|
|
7656
7653
|
}
|
|
7657
7654
|
newContent = newContent.substring(0, firstIndex) + edit.new_string + newContent.substring(firstIndex + edit.old_string.length);
|
|
7658
|
-
console.log(
|
|
7655
|
+
console.log(chalk7.green(` \u2713 Edit ${i + 1}: Applied successfully`));
|
|
7659
7656
|
}
|
|
7660
7657
|
}
|
|
7661
7658
|
if (oldContent !== newContent) {
|
|
@@ -7668,7 +7665,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7668
7665
|
case "todo_write": {
|
|
7669
7666
|
const todoPath = ".agent/todos.json";
|
|
7670
7667
|
if (!Array.isArray(action.tasks)) {
|
|
7671
|
-
console.log(
|
|
7668
|
+
console.log(chalk7.yellow("\u26A0\uFE0F todo_write received invalid tasks (not an array), skipping"));
|
|
7672
7669
|
return "todo_write skipped: tasks must be an array";
|
|
7673
7670
|
}
|
|
7674
7671
|
let existingTodos = [];
|
|
@@ -7686,7 +7683,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7686
7683
|
}
|
|
7687
7684
|
const allTodos = Array.from(todoMap.values());
|
|
7688
7685
|
await this.files.writeFile(todoPath, JSON.stringify(allTodos, null, 2));
|
|
7689
|
-
console.log(
|
|
7686
|
+
console.log(chalk7.cyan("\n\u{1F4CB} Task Progress:"));
|
|
7690
7687
|
const total = allTodos.length;
|
|
7691
7688
|
const completed = allTodos.filter((t) => t.status === "completed").length;
|
|
7692
7689
|
const inProgress = allTodos.filter((t) => t.status === "in_progress");
|
|
@@ -7695,10 +7692,10 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7695
7692
|
const barWidth = 20;
|
|
7696
7693
|
const filled = Math.round(barWidth * percent / 100);
|
|
7697
7694
|
const bar = "\u2588".repeat(filled) + "\u2591".repeat(barWidth - filled);
|
|
7698
|
-
console.log(` ${
|
|
7699
|
-
console.log(
|
|
7695
|
+
console.log(` ${chalk7.green(bar)} ${percent}%`);
|
|
7696
|
+
console.log(chalk7.gray(` ${completed} done \xB7 ${inProgress.length} in progress \xB7 ${pending} pending`));
|
|
7700
7697
|
if (inProgress.length > 0) {
|
|
7701
|
-
console.log(
|
|
7698
|
+
console.log(chalk7.yellow("\n \u{1F504} Active Tasks:"));
|
|
7702
7699
|
for (const task of inProgress) {
|
|
7703
7700
|
console.log(` \u2022 ${task.title}`);
|
|
7704
7701
|
}
|
|
@@ -7712,7 +7709,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7712
7709
|
}
|
|
7713
7710
|
const level = action.level ?? "user";
|
|
7714
7711
|
await this.memoryManager.store(action.fact, level);
|
|
7715
|
-
console.log(
|
|
7712
|
+
console.log(chalk7.green(`
|
|
7716
7713
|
\u{1F4BE} Memory saved (${level} level): "${action.fact.slice(0, 60)}${action.fact.length > 60 ? "..." : ""}"`));
|
|
7717
7714
|
return `Saved to ${level} memory: ${action.fact}`;
|
|
7718
7715
|
}
|
|
@@ -7725,9 +7722,9 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7725
7722
|
return action.query ? `No memories found matching "${action.query}"` : "No memories stored yet";
|
|
7726
7723
|
}
|
|
7727
7724
|
const formatted = memories.map((m) => `- [${m.level}] ${m.content}`).join("\n");
|
|
7728
|
-
console.log(
|
|
7725
|
+
console.log(chalk7.cyan(`
|
|
7729
7726
|
\u{1F9E0} Recalled ${memories.length} memor${memories.length === 1 ? "y" : "ies"}:`));
|
|
7730
|
-
console.log(
|
|
7727
|
+
console.log(chalk7.gray(formatted));
|
|
7731
7728
|
return formatted;
|
|
7732
7729
|
}
|
|
7733
7730
|
case "create_meta_tool": {
|
|
@@ -7778,10 +7775,10 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7778
7775
|
handler: action.handler,
|
|
7779
7776
|
source: "agent"
|
|
7780
7777
|
});
|
|
7781
|
-
console.log(
|
|
7778
|
+
console.log(chalk7.green(`
|
|
7782
7779
|
\u{1F527} Created meta-tool: ${action.name}`));
|
|
7783
|
-
console.log(
|
|
7784
|
-
console.log(
|
|
7780
|
+
console.log(chalk7.gray(` ${action.description}`));
|
|
7781
|
+
console.log(chalk7.gray(` Handler: ${action.handler}`));
|
|
7785
7782
|
return `Created meta-tool "${action.name}" - available in this and future sessions`;
|
|
7786
7783
|
}
|
|
7787
7784
|
// Web Search Operations
|
|
@@ -7789,16 +7786,16 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7789
7786
|
if (!action.query) {
|
|
7790
7787
|
throw new Error('web_search requires a "query" argument.');
|
|
7791
7788
|
}
|
|
7792
|
-
console.log(
|
|
7789
|
+
console.log(chalk7.cyan(`
|
|
7793
7790
|
\u{1F50D} Searching web: "${action.query}"...`));
|
|
7794
7791
|
const results = await webSearch(action.query, {
|
|
7795
7792
|
maxResults: action.max_results,
|
|
7796
7793
|
searchType: action.search_type
|
|
7797
7794
|
});
|
|
7798
7795
|
const formatted = formatSearchResults(results);
|
|
7799
|
-
console.log(
|
|
7796
|
+
console.log(chalk7.gray(formatted.split("\n").slice(0, 10).join("\n")));
|
|
7800
7797
|
if (results.length > 3) {
|
|
7801
|
-
console.log(
|
|
7798
|
+
console.log(chalk7.gray(" ..."));
|
|
7802
7799
|
}
|
|
7803
7800
|
return formatted;
|
|
7804
7801
|
}
|
|
@@ -7806,13 +7803,13 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7806
7803
|
if (!action.url) {
|
|
7807
7804
|
throw new Error('fetch_url requires a "url" argument.');
|
|
7808
7805
|
}
|
|
7809
|
-
console.log(
|
|
7806
|
+
console.log(chalk7.cyan(`
|
|
7810
7807
|
\u{1F310} Fetching: ${action.url}...`));
|
|
7811
7808
|
const content = await fetchUrl(action.url, {
|
|
7812
7809
|
maxLength: action.max_length
|
|
7813
7810
|
});
|
|
7814
7811
|
const preview = content.slice(0, 500);
|
|
7815
|
-
console.log(
|
|
7812
|
+
console.log(chalk7.gray(preview + (content.length > 500 ? "\n ... (truncated)" : "")));
|
|
7816
7813
|
return content;
|
|
7817
7814
|
}
|
|
7818
7815
|
case "package_info": {
|
|
@@ -7820,14 +7817,14 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7820
7817
|
throw new Error('package_info requires a "package_name" argument.');
|
|
7821
7818
|
}
|
|
7822
7819
|
const registryLabel = action.registry ? ` (${action.registry})` : "";
|
|
7823
|
-
console.log(
|
|
7820
|
+
console.log(chalk7.cyan(`
|
|
7824
7821
|
\u{1F4E6} Getting package info: ${action.package_name}${action.version ? `@${action.version}` : ""}${registryLabel}...`));
|
|
7825
7822
|
const info = await getPackageInfo(action.package_name, {
|
|
7826
7823
|
registry: action.registry,
|
|
7827
7824
|
version: action.version
|
|
7828
7825
|
});
|
|
7829
7826
|
const formatted = formatPackageInfo(info);
|
|
7830
|
-
console.log(
|
|
7827
|
+
console.log(chalk7.gray(formatted));
|
|
7831
7828
|
return formatted;
|
|
7832
7829
|
}
|
|
7833
7830
|
default: {
|
|
@@ -7955,11 +7952,11 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
7955
7952
|
return `Error: custom_command "${action.name}" requires a "command" argument (string)`;
|
|
7956
7953
|
}
|
|
7957
7954
|
if (!existing) {
|
|
7958
|
-
console.log(
|
|
7959
|
-
console.log(
|
|
7960
|
-
console.log(
|
|
7955
|
+
console.log(chalk7.cyan(`Custom command: ${definition.name}`));
|
|
7956
|
+
console.log(chalk7.gray(definition.description ?? "No description provided."));
|
|
7957
|
+
console.log(chalk7.gray(`Command: ${definition.command} ${(definition.args ?? []).join(" ")}`));
|
|
7961
7958
|
if (this.isDestructiveCommand(definition.command)) {
|
|
7962
|
-
console.log(
|
|
7959
|
+
console.log(chalk7.red("Warning: command may be destructive."));
|
|
7963
7960
|
}
|
|
7964
7961
|
const answer = await this.confirmDangerousAction(
|
|
7965
7962
|
"Add and run this custom command?",
|
|
@@ -8007,15 +8004,15 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8007
8004
|
let safeValue;
|
|
8008
8005
|
if (_ActionExecutor.SHELL_METACHARACTERS.test(stringValue)) {
|
|
8009
8006
|
safeValue = this.shellEscape(stringValue);
|
|
8010
|
-
console.log(
|
|
8007
|
+
console.log(chalk7.yellow(` \u26A0 Parameter "${paramName}" contains shell metacharacters, escaped for safety`));
|
|
8011
8008
|
} else {
|
|
8012
8009
|
safeValue = stringValue;
|
|
8013
8010
|
}
|
|
8014
8011
|
command = command.replace(new RegExp(`\\{\\{${paramName}\\}\\}`, "g"), safeValue);
|
|
8015
8012
|
}
|
|
8016
|
-
console.log(
|
|
8013
|
+
console.log(chalk7.cyan(`
|
|
8017
8014
|
\u{1F527} Running meta-tool: ${metaTool.name}`));
|
|
8018
|
-
console.log(
|
|
8015
|
+
console.log(chalk7.gray(` $ ${command}`));
|
|
8019
8016
|
const result = await runCommand(command, [], this.runtime.workspaceRoot, { shell: true });
|
|
8020
8017
|
return [`$ ${command}`, result.stdout, result.stderr].filter(Boolean).join("\n");
|
|
8021
8018
|
}
|
|
@@ -8124,7 +8121,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8124
8121
|
const useTheme = isThemeInitialized();
|
|
8125
8122
|
const theme = useTheme ? getTheme() : null;
|
|
8126
8123
|
if (!diffOutput || diffOutput === "No diff") {
|
|
8127
|
-
return theme ? theme.fg("muted", "No changes") :
|
|
8124
|
+
return theme ? theme.fg("muted", "No changes") : chalk7.gray("No changes");
|
|
8128
8125
|
}
|
|
8129
8126
|
const termWidth = process.stdout.columns || 100;
|
|
8130
8127
|
const lines = diffOutput.split("\n");
|
|
@@ -8145,32 +8142,32 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8145
8142
|
const remBgB = removedRgb ? Math.floor(removedRgb.b * 0.15) : 30;
|
|
8146
8143
|
for (const line of lines) {
|
|
8147
8144
|
if (line.startsWith("+++") || line.startsWith("---")) {
|
|
8148
|
-
colorizedLines.push(
|
|
8145
|
+
colorizedLines.push(chalk7.bold(line));
|
|
8149
8146
|
} else if (line.startsWith("@@")) {
|
|
8150
|
-
colorizedLines.push(
|
|
8147
|
+
colorizedLines.push(chalk7.hex(accentColor)(line));
|
|
8151
8148
|
} else if (line.startsWith("+")) {
|
|
8152
8149
|
additions++;
|
|
8153
8150
|
const content = line.slice(1);
|
|
8154
|
-
const prefix =
|
|
8155
|
-
const lineContent =
|
|
8151
|
+
const prefix = chalk7.bgHex(addedColor).black(" + ");
|
|
8152
|
+
const lineContent = chalk7.bgRgb(addBgR, addBgG, addBgB)(` ${content} `.padEnd(Math.max(termWidth - 5, content.length + 2)));
|
|
8156
8153
|
colorizedLines.push(prefix + lineContent);
|
|
8157
8154
|
} else if (line.startsWith("-")) {
|
|
8158
8155
|
deletions++;
|
|
8159
8156
|
const content = line.slice(1);
|
|
8160
|
-
const prefix =
|
|
8161
|
-
const lineContent =
|
|
8157
|
+
const prefix = chalk7.bgHex(removedColor).white(" - ");
|
|
8158
|
+
const lineContent = chalk7.bgRgb(remBgR, remBgG, remBgB)(` ${content} `.padEnd(Math.max(termWidth - 5, content.length + 2)));
|
|
8162
8159
|
colorizedLines.push(prefix + lineContent);
|
|
8163
8160
|
} else if (line.startsWith("diff --git")) {
|
|
8164
|
-
colorizedLines.push(
|
|
8161
|
+
colorizedLines.push(chalk7.bold.hex(accentColor)(line));
|
|
8165
8162
|
} else if (line.startsWith("index ") || line.startsWith("new file") || line.startsWith("deleted file")) {
|
|
8166
|
-
colorizedLines.push(
|
|
8163
|
+
colorizedLines.push(chalk7.hex(contextColor)(line));
|
|
8167
8164
|
} else {
|
|
8168
|
-
colorizedLines.push(
|
|
8165
|
+
colorizedLines.push(chalk7.hex(contextColor)(" ") + line);
|
|
8169
8166
|
}
|
|
8170
8167
|
}
|
|
8171
8168
|
const addText = additions === 1 ? "1 line" : `${additions} lines`;
|
|
8172
8169
|
const delText = deletions === 1 ? "1 line" : `${deletions} lines`;
|
|
8173
|
-
const statsLine =
|
|
8170
|
+
const statsLine = chalk7.hex(contextColor)(` Added ${chalk7.hex(addedColor)(addText)}, removed ${chalk7.hex(removedColor)(delText)}
|
|
8174
8171
|
`);
|
|
8175
8172
|
return statsLine + colorizedLines.join("\n");
|
|
8176
8173
|
}
|
|
@@ -8196,7 +8193,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8196
8193
|
}
|
|
8197
8194
|
return void 0;
|
|
8198
8195
|
} catch (error) {
|
|
8199
|
-
console.log(
|
|
8196
|
+
console.log(chalk7.yellow("\n[WARN] Could not scan for secrets (git diff failed)"));
|
|
8200
8197
|
return void 0;
|
|
8201
8198
|
}
|
|
8202
8199
|
}
|
|
@@ -8220,7 +8217,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8220
8217
|
if (theme) {
|
|
8221
8218
|
console.log(theme.fg("muted", ` Added ${theme.fg("diffAdded", addText)}, removed ${theme.fg("diffRemoved", delText)}`));
|
|
8222
8219
|
} else {
|
|
8223
|
-
console.log(
|
|
8220
|
+
console.log(chalk7.gray(` Added ${chalk7.green(addText)}, removed ${chalk7.red(delText)}`));
|
|
8224
8221
|
}
|
|
8225
8222
|
const hunks = [];
|
|
8226
8223
|
let currentHunk = null;
|
|
@@ -8307,31 +8304,31 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8307
8304
|
const bgR = addedRgb ? Math.floor(addedRgb.r * 0.15) : 30;
|
|
8308
8305
|
const bgG = addedRgb ? Math.floor(addedRgb.g * 0.2) : 50;
|
|
8309
8306
|
const bgB = addedRgb ? Math.floor(addedRgb.b * 0.15) : 30;
|
|
8310
|
-
const prefix =
|
|
8311
|
-
const content =
|
|
8307
|
+
const prefix = chalk7.bgHex(addedColor).black(` ${lineNumStr} + `);
|
|
8308
|
+
const content = chalk7.bgRgb(bgR, bgG, bgB)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
|
|
8312
8309
|
console.log(prefix + content);
|
|
8313
8310
|
} else if (change.type === "remove") {
|
|
8314
8311
|
const removedRgb = hexToRgb(removedColor);
|
|
8315
8312
|
const bgR = removedRgb ? Math.floor(removedRgb.r * 0.25) : 60;
|
|
8316
8313
|
const bgG = removedRgb ? Math.floor(removedRgb.g * 0.15) : 30;
|
|
8317
8314
|
const bgB = removedRgb ? Math.floor(removedRgb.b * 0.15) : 30;
|
|
8318
|
-
const prefix =
|
|
8319
|
-
const content =
|
|
8315
|
+
const prefix = chalk7.bgHex(removedColor).white(` ${lineNumStr} - `);
|
|
8316
|
+
const content = chalk7.bgRgb(bgR, bgG, bgB)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
|
|
8320
8317
|
console.log(prefix + content);
|
|
8321
8318
|
} else {
|
|
8322
|
-
console.log(
|
|
8319
|
+
console.log(chalk7.hex(contextColor)(` ${lineNumStr} `) + ` ${highlighted}`);
|
|
8323
8320
|
}
|
|
8324
8321
|
} else {
|
|
8325
8322
|
if (change.type === "add") {
|
|
8326
|
-
const prefix =
|
|
8327
|
-
const content =
|
|
8323
|
+
const prefix = chalk7.bgGreen.black(` ${lineNumStr} + `);
|
|
8324
|
+
const content = chalk7.bgRgb(30, 50, 30)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
|
|
8328
8325
|
console.log(prefix + content);
|
|
8329
8326
|
} else if (change.type === "remove") {
|
|
8330
|
-
const prefix =
|
|
8331
|
-
const content =
|
|
8327
|
+
const prefix = chalk7.bgRed.white(` ${lineNumStr} - `);
|
|
8328
|
+
const content = chalk7.bgRgb(60, 30, 30)(` ${highlighted} `.padEnd(Math.max(termWidth - 10, change.line.length + 2)));
|
|
8332
8329
|
console.log(prefix + content);
|
|
8333
8330
|
} else {
|
|
8334
|
-
console.log(
|
|
8331
|
+
console.log(chalk7.gray(` ${lineNumStr} `) + ` ${highlighted}`);
|
|
8335
8332
|
}
|
|
8336
8333
|
}
|
|
8337
8334
|
}
|
|
@@ -8341,7 +8338,7 @@ ${result.removed.map((p) => ` - ${p}`).join("\n")}`;
|
|
|
8341
8338
|
};
|
|
8342
8339
|
|
|
8343
8340
|
// src/core/slashCommandHandler.ts
|
|
8344
|
-
import
|
|
8341
|
+
import chalk8 from "chalk";
|
|
8345
8342
|
import terminalLink from "terminal-link";
|
|
8346
8343
|
var SlashCommandHandler = class {
|
|
8347
8344
|
constructor(ctx, commands) {
|
|
@@ -8368,24 +8365,24 @@ var SlashCommandHandler = class {
|
|
|
8368
8365
|
try {
|
|
8369
8366
|
switch (command) {
|
|
8370
8367
|
case "/model": {
|
|
8371
|
-
const { model } = await import("./model-
|
|
8368
|
+
const { model } = await import("./model-HKEFSH5E.js");
|
|
8372
8369
|
return model(this.ctx);
|
|
8373
8370
|
}
|
|
8374
8371
|
case "/init": {
|
|
8375
|
-
const { init } = await import("./init-
|
|
8372
|
+
const { init } = await import("./init-DML7AOII.js");
|
|
8376
8373
|
return init(this.ctx);
|
|
8377
8374
|
}
|
|
8378
8375
|
case "/quit": {
|
|
8379
|
-
const { quit } = await import("./quit-
|
|
8376
|
+
const { quit } = await import("./quit-RSYIERO5.js");
|
|
8380
8377
|
return quit();
|
|
8381
8378
|
}
|
|
8382
8379
|
case "/help":
|
|
8383
8380
|
case "/?": {
|
|
8384
|
-
const { help } = await import("./help-
|
|
8381
|
+
const { help } = await import("./help-PKC6QCNG.js");
|
|
8385
8382
|
return help();
|
|
8386
8383
|
}
|
|
8387
8384
|
case "/agents": {
|
|
8388
|
-
const { handler } = await import("./agents-
|
|
8385
|
+
const { handler } = await import("./agents-B33IAATH.js");
|
|
8389
8386
|
const output = await handler();
|
|
8390
8387
|
if (output) {
|
|
8391
8388
|
console.log(output);
|
|
@@ -8394,27 +8391,27 @@ var SlashCommandHandler = class {
|
|
|
8394
8391
|
}
|
|
8395
8392
|
case "/agents new":
|
|
8396
8393
|
case "/agents-new": {
|
|
8397
|
-
const { createAgent } = await import("./agents-new-
|
|
8394
|
+
const { createAgent } = await import("./agents-new-KTXJFC5E.js");
|
|
8398
8395
|
return createAgent(this.ctx);
|
|
8399
8396
|
}
|
|
8400
8397
|
case "/feedback": {
|
|
8401
|
-
const { feedback } = await import("./feedback-
|
|
8398
|
+
const { feedback } = await import("./feedback-PZ2PINDU.js");
|
|
8402
8399
|
return feedback(this.ctx);
|
|
8403
8400
|
}
|
|
8404
8401
|
case "/resume": {
|
|
8405
|
-
const { resume } = await import("./resume-
|
|
8402
|
+
const { resume } = await import("./resume-2NERFSTD.js");
|
|
8406
8403
|
return resume({ sessionManager: this.ctx.sessionManager, args });
|
|
8407
8404
|
}
|
|
8408
8405
|
case "/sessions": {
|
|
8409
|
-
const { sessions } = await import("./sessions-
|
|
8406
|
+
const { sessions } = await import("./sessions-4KXIT76T.js");
|
|
8410
8407
|
return sessions({ sessionManager: this.ctx.sessionManager, args });
|
|
8411
8408
|
}
|
|
8412
8409
|
case "/session": {
|
|
8413
|
-
const { session } = await import("./session-
|
|
8410
|
+
const { session } = await import("./session-H5QWKE5E.js");
|
|
8414
8411
|
return session({ sessionManager: this.ctx.sessionManager });
|
|
8415
8412
|
}
|
|
8416
8413
|
case "/undo": {
|
|
8417
|
-
const { undo } = await import("./undo-
|
|
8414
|
+
const { undo } = await import("./undo-7QJBXARS.js");
|
|
8418
8415
|
return undo({
|
|
8419
8416
|
workspaceRoot: this.ctx.workspaceRoot,
|
|
8420
8417
|
undoFileMutation: this.ctx.undoFileMutation ?? (async () => {
|
|
@@ -8424,7 +8421,7 @@ var SlashCommandHandler = class {
|
|
|
8424
8421
|
});
|
|
8425
8422
|
}
|
|
8426
8423
|
case "/new": {
|
|
8427
|
-
const { newConversation } = await import("./new-
|
|
8424
|
+
const { newConversation } = await import("./new-EEZC4XXV.js");
|
|
8428
8425
|
return newConversation({
|
|
8429
8426
|
resetConversation: this.ctx.resetConversation,
|
|
8430
8427
|
sessionManager: this.ctx.sessionManager,
|
|
@@ -8433,26 +8430,26 @@ var SlashCommandHandler = class {
|
|
|
8433
8430
|
});
|
|
8434
8431
|
}
|
|
8435
8432
|
case "/memory": {
|
|
8436
|
-
const { memory } = await import("./memory-
|
|
8433
|
+
const { memory } = await import("./memory-4GSP7NKV.js");
|
|
8437
8434
|
return memory({ memoryManager: this.ctx.memoryManager });
|
|
8438
8435
|
}
|
|
8439
8436
|
case "/formatters": {
|
|
8440
|
-
const { execute } = await import("./formatters-
|
|
8437
|
+
const { execute } = await import("./formatters-UG6VZJJ5.js");
|
|
8441
8438
|
await execute();
|
|
8442
8439
|
return null;
|
|
8443
8440
|
}
|
|
8444
8441
|
case "/lint": {
|
|
8445
|
-
const { execute } = await import("./lint-
|
|
8442
|
+
const { execute } = await import("./lint-TA2ZHVLM.js");
|
|
8446
8443
|
await execute();
|
|
8447
8444
|
return null;
|
|
8448
8445
|
}
|
|
8449
8446
|
case "/completion": {
|
|
8450
|
-
const { execute } = await import("./completion-
|
|
8447
|
+
const { execute } = await import("./completion-Y42FKDT3.js");
|
|
8451
8448
|
await execute(args.join(" "));
|
|
8452
8449
|
return null;
|
|
8453
8450
|
}
|
|
8454
8451
|
case "/export": {
|
|
8455
|
-
const { execute } = await import("./export-
|
|
8452
|
+
const { execute } = await import("./export-WJ5P6E5Z.js");
|
|
8456
8453
|
await execute(args.join(" "), {
|
|
8457
8454
|
sessionManager: this.ctx.sessionManager,
|
|
8458
8455
|
currentSession: this.ctx.currentSession,
|
|
@@ -8461,30 +8458,30 @@ var SlashCommandHandler = class {
|
|
|
8461
8458
|
return null;
|
|
8462
8459
|
}
|
|
8463
8460
|
case "/status": {
|
|
8464
|
-
const { status } = await import("./status-
|
|
8461
|
+
const { status } = await import("./status-ROTJZEKU.js");
|
|
8465
8462
|
return status(this.ctx);
|
|
8466
8463
|
}
|
|
8467
8464
|
case "/login": {
|
|
8468
|
-
const { login } = await import("./login-
|
|
8465
|
+
const { login } = await import("./login-BZ7J4Z4M.js");
|
|
8469
8466
|
return login({ config: this.ctx.config });
|
|
8470
8467
|
}
|
|
8471
8468
|
case "/logout": {
|
|
8472
|
-
const { logout } = await import("./logout-
|
|
8469
|
+
const { logout } = await import("./logout-BZKEMNHB.js");
|
|
8473
8470
|
return logout({ config: this.ctx.config });
|
|
8474
8471
|
}
|
|
8475
8472
|
case "/permissions": {
|
|
8476
|
-
const { permissions } = await import("./permissions-
|
|
8473
|
+
const { permissions } = await import("./permissions-5MTH22EF.js");
|
|
8477
8474
|
return permissions({ permissionManager: this.ctx.permissionManager });
|
|
8478
8475
|
}
|
|
8479
8476
|
case "/hooks": {
|
|
8480
|
-
const { hooks } = await import("./hooks-
|
|
8477
|
+
const { hooks } = await import("./hooks-LN4A6NQL.js");
|
|
8481
8478
|
if (!this.ctx.hookManager) {
|
|
8482
8479
|
return "Hook manager not available.";
|
|
8483
8480
|
}
|
|
8484
8481
|
return hooks({ hookManager: this.ctx.hookManager });
|
|
8485
8482
|
}
|
|
8486
8483
|
case "/skills": {
|
|
8487
|
-
const { skills } = await import("./skills-
|
|
8484
|
+
const { skills } = await import("./skills-CRFOVWEQ.js");
|
|
8488
8485
|
if (!this.ctx.skillsRegistry) {
|
|
8489
8486
|
return "Skills registry not available.";
|
|
8490
8487
|
}
|
|
@@ -8494,7 +8491,7 @@ var SlashCommandHandler = class {
|
|
|
8494
8491
|
}, args);
|
|
8495
8492
|
}
|
|
8496
8493
|
case "/skills install": {
|
|
8497
|
-
const { skillsInstall } = await import("./skills-install-
|
|
8494
|
+
const { skillsInstall } = await import("./skills-install-RMPXN6RK.js");
|
|
8498
8495
|
if (!this.ctx.skillsRegistry) {
|
|
8499
8496
|
return "Skills registry not available.";
|
|
8500
8497
|
}
|
|
@@ -8506,7 +8503,7 @@ var SlashCommandHandler = class {
|
|
|
8506
8503
|
}
|
|
8507
8504
|
case "/skills new":
|
|
8508
8505
|
case "/skills-new": {
|
|
8509
|
-
const { createSkill } = await import("./skills-new-
|
|
8506
|
+
const { createSkill } = await import("./skills-new-S2YPO635.js");
|
|
8510
8507
|
if (!this.ctx.skillsRegistry) {
|
|
8511
8508
|
return "Skills registry not available.";
|
|
8512
8509
|
}
|
|
@@ -8517,15 +8514,15 @@ var SlashCommandHandler = class {
|
|
|
8517
8514
|
});
|
|
8518
8515
|
}
|
|
8519
8516
|
case "/theme": {
|
|
8520
|
-
const { theme } = await import("./theme-
|
|
8517
|
+
const { theme } = await import("./theme-JAMJSCKR.js");
|
|
8521
8518
|
if (!this.ctx.config) {
|
|
8522
|
-
console.log(
|
|
8519
|
+
console.log(chalk8.yellow("Config not available for theme selection."));
|
|
8523
8520
|
return null;
|
|
8524
8521
|
}
|
|
8525
8522
|
return theme({ config: this.ctx.config });
|
|
8526
8523
|
}
|
|
8527
8524
|
case "/automode": {
|
|
8528
|
-
const { automode } = await import("./automode-
|
|
8525
|
+
const { automode } = await import("./automode-QCRJSBRT.js");
|
|
8529
8526
|
return automode({
|
|
8530
8527
|
automodeManager: this.ctx.automodeManager,
|
|
8531
8528
|
workspaceRoot: this.ctx.workspaceRoot
|
|
@@ -8536,20 +8533,20 @@ var SlashCommandHandler = class {
|
|
|
8536
8533
|
return null;
|
|
8537
8534
|
}
|
|
8538
8535
|
} catch (error) {
|
|
8539
|
-
console.error(
|
|
8536
|
+
console.error(chalk8.red(`Error executing command ${command}:`), error);
|
|
8540
8537
|
return null;
|
|
8541
8538
|
}
|
|
8542
8539
|
}
|
|
8543
8540
|
printUnsupported(command) {
|
|
8544
8541
|
const docLink = terminalLink("docs.autohand.ai", "https://docs.autohand.ai");
|
|
8545
8542
|
console.log(
|
|
8546
|
-
|
|
8543
|
+
chalk8.yellow(`Command ${command} is not supported. Please visit ${docLink} for supported actions or type -help.`)
|
|
8547
8544
|
);
|
|
8548
8545
|
}
|
|
8549
8546
|
printUnimplemented(command) {
|
|
8550
|
-
console.log(
|
|
8547
|
+
console.log(chalk8.yellow(`Command ${command.command} is not implemented yet.`));
|
|
8551
8548
|
if (command.prd) {
|
|
8552
|
-
console.log(
|
|
8549
|
+
console.log(chalk8.gray(`PRD: ${command.prd}`));
|
|
8553
8550
|
}
|
|
8554
8551
|
}
|
|
8555
8552
|
};
|
|
@@ -8754,10 +8751,10 @@ var ProjectManager = class {
|
|
|
8754
8751
|
};
|
|
8755
8752
|
|
|
8756
8753
|
// src/core/agents/AgentDelegator.ts
|
|
8757
|
-
import
|
|
8754
|
+
import chalk10 from "chalk";
|
|
8758
8755
|
|
|
8759
8756
|
// src/core/agents/SubAgent.ts
|
|
8760
|
-
import
|
|
8757
|
+
import chalk9 from "chalk";
|
|
8761
8758
|
var DELEGATION_TOOL_DEFINITIONS = [
|
|
8762
8759
|
{
|
|
8763
8760
|
name: "delegate_task",
|
|
@@ -8865,7 +8862,7 @@ var SubAgent = class {
|
|
|
8865
8862
|
return `- ${def.name}(${params}): ${def.description}`;
|
|
8866
8863
|
}
|
|
8867
8864
|
async run(task) {
|
|
8868
|
-
console.log(
|
|
8865
|
+
console.log(chalk9.cyan(`
|
|
8869
8866
|
\u{1F916} Sub-agent '${this.name}' starting task... (depth ${this.options.depth}/${this.options.maxDepth})`));
|
|
8870
8867
|
this.conversation.addMessage({ role: "user", content: task });
|
|
8871
8868
|
const tools = this.toolManager.toFunctionDefinitions();
|
|
@@ -8888,7 +8885,7 @@ var SubAgent = class {
|
|
|
8888
8885
|
this.conversation.addMessage({ role: "assistant", content: completion.content });
|
|
8889
8886
|
}
|
|
8890
8887
|
if (payload.thought) {
|
|
8891
|
-
console.log(
|
|
8888
|
+
console.log(chalk9.gray(`[${this.name}] ${payload.thought}`));
|
|
8892
8889
|
}
|
|
8893
8890
|
if (payload.toolCalls && payload.toolCalls.length > 0) {
|
|
8894
8891
|
const results = await this.toolManager.execute(payload.toolCalls);
|
|
@@ -8903,13 +8900,13 @@ var SubAgent = class {
|
|
|
8903
8900
|
tool_call_id: toolCall?.id
|
|
8904
8901
|
});
|
|
8905
8902
|
if (!result.success) {
|
|
8906
|
-
console.log(
|
|
8903
|
+
console.log(chalk9.red(`[${this.name}] Tool ${result.tool} failed: ${content}`));
|
|
8907
8904
|
}
|
|
8908
8905
|
}
|
|
8909
8906
|
continue;
|
|
8910
8907
|
}
|
|
8911
8908
|
const response = payload.finalResponse ?? payload.response ?? completion.content;
|
|
8912
|
-
console.log(
|
|
8909
|
+
console.log(chalk9.cyan(`[${this.name}] Finished.`));
|
|
8913
8910
|
return response;
|
|
8914
8911
|
}
|
|
8915
8912
|
return `[${this.name}] Failed to complete task within ${maxIterations} iterations.`;
|
|
@@ -9095,7 +9092,7 @@ ${result}`;
|
|
|
9095
9092
|
}
|
|
9096
9093
|
});
|
|
9097
9094
|
const results = await Promise.all(promises);
|
|
9098
|
-
return results.join("\n\n" +
|
|
9095
|
+
return results.join("\n\n" + chalk10.gray("\u2500".repeat(40)) + "\n\n");
|
|
9099
9096
|
}
|
|
9100
9097
|
/**
|
|
9101
9098
|
* Get the current delegation depth
|
|
@@ -9194,7 +9191,7 @@ var ErrorLogger = class {
|
|
|
9194
9191
|
// src/feedback/FeedbackManager.ts
|
|
9195
9192
|
import fs14 from "fs-extra";
|
|
9196
9193
|
import path14 from "path";
|
|
9197
|
-
import
|
|
9194
|
+
import chalk11 from "chalk";
|
|
9198
9195
|
import Enquirer from "enquirer";
|
|
9199
9196
|
|
|
9200
9197
|
// src/feedback/FeedbackApiClient.ts
|
|
@@ -9593,10 +9590,10 @@ var FeedbackManager = class {
|
|
|
9593
9590
|
this.state.lastPromptedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
9594
9591
|
this.saveState();
|
|
9595
9592
|
console.log();
|
|
9596
|
-
console.log(
|
|
9597
|
-
console.log(
|
|
9598
|
-
console.log(
|
|
9599
|
-
console.log(
|
|
9593
|
+
console.log(chalk11.cyan("\u2501".repeat(50)));
|
|
9594
|
+
console.log(chalk11.cyan.bold(" Quick Feedback"));
|
|
9595
|
+
console.log(chalk11.gray(" Help us improve Autohand (takes 10 seconds)"));
|
|
9596
|
+
console.log(chalk11.cyan("\u2501".repeat(50)));
|
|
9600
9597
|
console.log();
|
|
9601
9598
|
const safePrompt = async (config) => {
|
|
9602
9599
|
try {
|
|
@@ -9614,12 +9611,12 @@ var FeedbackManager = class {
|
|
|
9614
9611
|
name: "score",
|
|
9615
9612
|
message: "How would you rate your experience?",
|
|
9616
9613
|
choices: [
|
|
9617
|
-
{ name: "5", message: `${
|
|
9618
|
-
{ name: "4", message: `${
|
|
9619
|
-
{ name: "3", message: `${
|
|
9620
|
-
{ name: "2", message: `${
|
|
9621
|
-
{ name: "1", message: `${
|
|
9622
|
-
{ name: "skip", message: `${
|
|
9614
|
+
{ name: "5", message: `${chalk11.green("5")} - Excellent` },
|
|
9615
|
+
{ name: "4", message: `${chalk11.green("4")} - Good` },
|
|
9616
|
+
{ name: "3", message: `${chalk11.yellow("3")} - Okay` },
|
|
9617
|
+
{ name: "2", message: `${chalk11.red("2")} - Poor` },
|
|
9618
|
+
{ name: "1", message: `${chalk11.red("1")} - Very Poor` },
|
|
9619
|
+
{ name: "skip", message: `${chalk11.gray("Skip")}` }
|
|
9623
9620
|
]
|
|
9624
9621
|
});
|
|
9625
9622
|
if (!npsResult) {
|
|
@@ -9630,7 +9627,7 @@ var FeedbackManager = class {
|
|
|
9630
9627
|
if (npsResult.score === "skip") {
|
|
9631
9628
|
this.state.dismissed++;
|
|
9632
9629
|
this.saveState();
|
|
9633
|
-
console.log(
|
|
9630
|
+
console.log(chalk11.gray("\nNo problem! You can always use /feedback later.\n"));
|
|
9634
9631
|
return false;
|
|
9635
9632
|
}
|
|
9636
9633
|
const npsScore = parseInt(npsResult.score, 10);
|
|
@@ -9677,11 +9674,11 @@ var FeedbackManager = class {
|
|
|
9677
9674
|
this.state.averageNps = this.state.npsScores.reduce((a, b) => a + b, 0) / this.state.npsScores.length;
|
|
9678
9675
|
this.saveState();
|
|
9679
9676
|
console.log();
|
|
9680
|
-
console.log(
|
|
9677
|
+
console.log(chalk11.green("Thank you for your feedback!"));
|
|
9681
9678
|
if (npsScore >= 4) {
|
|
9682
|
-
console.log(
|
|
9679
|
+
console.log(chalk11.gray("Your support helps us build a better tool."));
|
|
9683
9680
|
} else {
|
|
9684
|
-
console.log(
|
|
9681
|
+
console.log(chalk11.gray("We'll work hard to improve your experience."));
|
|
9685
9682
|
}
|
|
9686
9683
|
console.log();
|
|
9687
9684
|
return true;
|
|
@@ -9691,7 +9688,7 @@ var FeedbackManager = class {
|
|
|
9691
9688
|
}
|
|
9692
9689
|
this.state.dismissed++;
|
|
9693
9690
|
this.saveState();
|
|
9694
|
-
console.log(
|
|
9691
|
+
console.log(chalk11.gray("\nFeedback skipped.\n"));
|
|
9695
9692
|
return false;
|
|
9696
9693
|
}
|
|
9697
9694
|
}
|
|
@@ -9703,10 +9700,10 @@ var FeedbackManager = class {
|
|
|
9703
9700
|
async quickRating() {
|
|
9704
9701
|
console.log();
|
|
9705
9702
|
console.log(
|
|
9706
|
-
|
|
9703
|
+
chalk11.cyan("Quick rating: ") + chalk11.gray("Press ") + chalk11.bold("1-5") + chalk11.gray(" to rate your experience (or ") + chalk11.bold("Enter") + chalk11.gray(" to skip)")
|
|
9707
9704
|
);
|
|
9708
9705
|
console.log(
|
|
9709
|
-
|
|
9706
|
+
chalk11.gray(" 1=Poor 2=Fair 3=Good 4=Great 5=Excellent")
|
|
9710
9707
|
);
|
|
9711
9708
|
return new Promise((resolve) => {
|
|
9712
9709
|
const stdin = process.stdin;
|
|
@@ -9738,7 +9735,7 @@ var FeedbackManager = class {
|
|
|
9738
9735
|
const num = parseInt(key, 10);
|
|
9739
9736
|
if (num >= 1 && num <= 5) {
|
|
9740
9737
|
cleanup();
|
|
9741
|
-
console.log(
|
|
9738
|
+
console.log(chalk11.green(` ${num}`));
|
|
9742
9739
|
this.state.npsScores.push(num);
|
|
9743
9740
|
this.state.feedbackCount++;
|
|
9744
9741
|
this.state.lastFeedbackAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -9746,7 +9743,7 @@ var FeedbackManager = class {
|
|
|
9746
9743
|
this.hasPromptedThisSession = true;
|
|
9747
9744
|
this.state.lastPromptedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
9748
9745
|
this.saveState();
|
|
9749
|
-
console.log(
|
|
9746
|
+
console.log(chalk11.green("Thanks!"));
|
|
9750
9747
|
console.log();
|
|
9751
9748
|
resolve(num);
|
|
9752
9749
|
}
|
|
@@ -10665,12 +10662,12 @@ var CommunitySkillsClient = class {
|
|
|
10665
10662
|
};
|
|
10666
10663
|
|
|
10667
10664
|
// src/ui/persistentInput.ts
|
|
10668
|
-
import
|
|
10665
|
+
import chalk13 from "chalk";
|
|
10669
10666
|
import readline3 from "readline";
|
|
10670
10667
|
import EventEmitter from "events";
|
|
10671
10668
|
|
|
10672
10669
|
// src/ui/terminalRegions.ts
|
|
10673
|
-
import
|
|
10670
|
+
import chalk12 from "chalk";
|
|
10674
10671
|
var ESC = "\x1B";
|
|
10675
10672
|
var CSI = `${ESC}[`;
|
|
10676
10673
|
var TerminalRegions = class {
|
|
@@ -10734,15 +10731,15 @@ var TerminalRegions = class {
|
|
|
10734
10731
|
this.output.write(`${CSI}s`);
|
|
10735
10732
|
this.output.write(`${CSI}${height - 2};1H`);
|
|
10736
10733
|
this.output.write(`${CSI}K`);
|
|
10737
|
-
this.output.write(
|
|
10734
|
+
this.output.write(chalk12.gray("\u2500".repeat(width)));
|
|
10738
10735
|
this.output.write(`${CSI}${height - 1};1H`);
|
|
10739
10736
|
this.output.write(`${CSI}K`);
|
|
10740
|
-
const queueStatus = queueCount > 0 ?
|
|
10737
|
+
const queueStatus = queueCount > 0 ? chalk12.cyan(` [${queueCount} queued]`) : "";
|
|
10741
10738
|
const statusText = status || "type to queue \xB7 Enter to submit";
|
|
10742
|
-
this.output.write(
|
|
10739
|
+
this.output.write(chalk12.gray(statusText) + queueStatus);
|
|
10743
10740
|
this.output.write(`${CSI}${height};1H`);
|
|
10744
10741
|
this.output.write(`${CSI}K`);
|
|
10745
|
-
this.output.write(
|
|
10742
|
+
this.output.write(chalk12.gray("\u203A") + " " + input);
|
|
10746
10743
|
this.output.write(`${CSI}u`);
|
|
10747
10744
|
}
|
|
10748
10745
|
/**
|
|
@@ -10754,7 +10751,7 @@ var TerminalRegions = class {
|
|
|
10754
10751
|
this.output.write(`${CSI}s`);
|
|
10755
10752
|
this.output.write(`${CSI}${height};1H`);
|
|
10756
10753
|
this.output.write(`${CSI}K`);
|
|
10757
|
-
this.output.write(
|
|
10754
|
+
this.output.write(chalk12.gray("\u203A") + " " + input);
|
|
10758
10755
|
this.output.write(`${CSI}u`);
|
|
10759
10756
|
}
|
|
10760
10757
|
/**
|
|
@@ -10766,8 +10763,8 @@ var TerminalRegions = class {
|
|
|
10766
10763
|
this.output.write(`${CSI}s`);
|
|
10767
10764
|
this.output.write(`${CSI}${height - 1};1H`);
|
|
10768
10765
|
this.output.write(`${CSI}K`);
|
|
10769
|
-
const queueStatus = queueCount > 0 ?
|
|
10770
|
-
this.output.write(
|
|
10766
|
+
const queueStatus = queueCount > 0 ? chalk12.cyan(` [${queueCount} queued]`) : "";
|
|
10767
|
+
this.output.write(chalk12.gray(status) + queueStatus);
|
|
10771
10768
|
this.output.write(`${CSI}u`);
|
|
10772
10769
|
}
|
|
10773
10770
|
/**
|
|
@@ -11009,7 +11006,7 @@ var PersistentInput = class extends EventEmitter {
|
|
|
11009
11006
|
if (this.silentMode) {
|
|
11010
11007
|
this.emit("queue-full", this.maxQueueSize);
|
|
11011
11008
|
} else {
|
|
11012
|
-
this.regions.writeAbove(
|
|
11009
|
+
this.regions.writeAbove(chalk13.yellow(`
|
|
11013
11010
|
\u26A0 Queue full (max ${this.maxQueueSize})
|
|
11014
11011
|
`));
|
|
11015
11012
|
}
|
|
@@ -11021,7 +11018,7 @@ var PersistentInput = class extends EventEmitter {
|
|
|
11021
11018
|
});
|
|
11022
11019
|
const preview = text.length > 40 ? text.slice(0, 37) + "..." : text;
|
|
11023
11020
|
if (!this.silentMode) {
|
|
11024
|
-
this.regions.writeAbove(
|
|
11021
|
+
this.regions.writeAbove(chalk13.cyan(`
|
|
11025
11022
|
\u2713 Queued: "${preview}" (${this.queue.length} pending)
|
|
11026
11023
|
`));
|
|
11027
11024
|
this.regions.updateStatus(this.statusLine, this.queue.length);
|
|
@@ -12109,10 +12106,10 @@ var AutohandAgent = class {
|
|
|
12109
12106
|
},
|
|
12110
12107
|
onHookOutput: (result) => {
|
|
12111
12108
|
if (result.stdout && !result.response) {
|
|
12112
|
-
console.log(
|
|
12109
|
+
console.log(chalk14.dim(`[hook:${result.hook.event}] ${result.stdout}`));
|
|
12113
12110
|
}
|
|
12114
12111
|
if (result.stderr && !result.blockingError) {
|
|
12115
|
-
console.error(
|
|
12112
|
+
console.error(chalk14.yellow(`[hook:${result.hook.event}] ${result.stderr}`));
|
|
12116
12113
|
}
|
|
12117
12114
|
}
|
|
12118
12115
|
});
|
|
@@ -12278,7 +12275,7 @@ var AutohandAgent = class {
|
|
|
12278
12275
|
this.inkRenderer.addQueuedInstruction(text);
|
|
12279
12276
|
} else if (this.runtime.spinner) {
|
|
12280
12277
|
const originalText = this.runtime.spinner.text;
|
|
12281
|
-
this.runtime.spinner.text =
|
|
12278
|
+
this.runtime.spinner.text = chalk14.cyan(`\u2713 Queued: "${preview}" (${count} pending)`);
|
|
12282
12279
|
setTimeout(() => {
|
|
12283
12280
|
if (this.runtime.spinner) {
|
|
12284
12281
|
this.runtime.spinner.text = originalText;
|
|
@@ -12391,17 +12388,17 @@ var AutohandAgent = class {
|
|
|
12391
12388
|
const info = getAutoCommitInfo(this.runtime.workspaceRoot);
|
|
12392
12389
|
if (!info.canCommit) {
|
|
12393
12390
|
if (info.error !== "No changes to commit") {
|
|
12394
|
-
console.log(
|
|
12391
|
+
console.log(chalk14.yellow(`
|
|
12395
12392
|
\u26A0 Cannot auto-commit: ${info.error}`));
|
|
12396
12393
|
}
|
|
12397
12394
|
return;
|
|
12398
12395
|
}
|
|
12399
|
-
console.log(
|
|
12396
|
+
console.log(chalk14.cyan("\n\u{1F9E0} Auto-commit: Changes detected"));
|
|
12400
12397
|
info.filesChanged.slice(0, 5).forEach((file) => {
|
|
12401
|
-
console.log(
|
|
12398
|
+
console.log(chalk14.gray(` ${file}`));
|
|
12402
12399
|
});
|
|
12403
12400
|
if (info.filesChanged.length > 5) {
|
|
12404
|
-
console.log(
|
|
12401
|
+
console.log(chalk14.gray(` ... and ${info.filesChanged.length - 5} more files`));
|
|
12405
12402
|
}
|
|
12406
12403
|
const autoCommitPrompt = `You have uncommitted changes in the repository. Please perform the following steps:
|
|
12407
12404
|
|
|
@@ -12423,11 +12420,11 @@ Diff summary:
|
|
|
12423
12420
|
${info.diffSummary || "Use git diff to see changes"}
|
|
12424
12421
|
|
|
12425
12422
|
If lint or tests fail, report the issues but do NOT commit.`;
|
|
12426
|
-
console.log(
|
|
12423
|
+
console.log(chalk14.cyan("\n\u{1F504} Running lint, test, and generating commit message...\n"));
|
|
12427
12424
|
try {
|
|
12428
12425
|
await this.runInstruction(autoCommitPrompt);
|
|
12429
12426
|
} catch (error) {
|
|
12430
|
-
console.log(
|
|
12427
|
+
console.log(chalk14.red(`
|
|
12431
12428
|
\u2717 Auto-commit failed: ${error.message}`));
|
|
12432
12429
|
}
|
|
12433
12430
|
}
|
|
@@ -12468,7 +12465,7 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12468
12465
|
}
|
|
12469
12466
|
await this.injectProjectKnowledge();
|
|
12470
12467
|
this.updateContextUsage(this.conversation.history());
|
|
12471
|
-
console.log(
|
|
12468
|
+
console.log(chalk14.cyan(`
|
|
12472
12469
|
\u{1F4C2} Resumed session ${sessionId}`));
|
|
12473
12470
|
await this.telemetryManager.startSession(
|
|
12474
12471
|
sessionId,
|
|
@@ -12477,7 +12474,7 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12477
12474
|
);
|
|
12478
12475
|
await this.runInteractiveLoop();
|
|
12479
12476
|
} catch (error) {
|
|
12480
|
-
console.error(
|
|
12477
|
+
console.error(chalk14.red(`Failed to resume session: ${error.message}`));
|
|
12481
12478
|
await this.telemetryManager.trackError({
|
|
12482
12479
|
type: "session_resume_failed",
|
|
12483
12480
|
message: error.message,
|
|
@@ -12496,31 +12493,31 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12496
12493
|
if (this.pendingInkInstructions.length > 0) {
|
|
12497
12494
|
instruction = this.pendingInkInstructions.shift() ?? null;
|
|
12498
12495
|
if (instruction) {
|
|
12499
|
-
console.log(
|
|
12496
|
+
console.log(chalk14.cyan(`
|
|
12500
12497
|
\u25B6 Processing queued request: "${instruction.slice(0, 50)}${instruction.length > 50 ? "..." : ""}"`));
|
|
12501
12498
|
const remaining = this.pendingInkInstructions.length;
|
|
12502
12499
|
if (remaining > 0) {
|
|
12503
|
-
console.log(
|
|
12500
|
+
console.log(chalk14.gray(` ${remaining} more request(s) queued`));
|
|
12504
12501
|
}
|
|
12505
12502
|
}
|
|
12506
12503
|
} else if (this.inkRenderer?.hasQueuedInstructions()) {
|
|
12507
12504
|
instruction = this.inkRenderer.dequeueInstruction() ?? null;
|
|
12508
12505
|
if (instruction) {
|
|
12509
|
-
console.log(
|
|
12506
|
+
console.log(chalk14.cyan(`
|
|
12510
12507
|
\u25B6 Processing queued request: "${instruction.slice(0, 50)}${instruction.length > 50 ? "..." : ""}"`));
|
|
12511
12508
|
const remaining = this.inkRenderer.getQueueCount();
|
|
12512
12509
|
if (remaining > 0) {
|
|
12513
|
-
console.log(
|
|
12510
|
+
console.log(chalk14.gray(` ${remaining} more request(s) queued`));
|
|
12514
12511
|
}
|
|
12515
12512
|
}
|
|
12516
12513
|
} else if (this.persistentInput.hasQueued()) {
|
|
12517
12514
|
const queued = this.persistentInput.dequeue();
|
|
12518
12515
|
if (queued) {
|
|
12519
12516
|
instruction = queued.text;
|
|
12520
|
-
console.log(
|
|
12517
|
+
console.log(chalk14.cyan(`
|
|
12521
12518
|
\u25B6 Processing queued request: "${instruction.slice(0, 50)}${instruction.length > 50 ? "..." : ""}"`));
|
|
12522
12519
|
if (this.persistentInput.hasQueued()) {
|
|
12523
|
-
console.log(
|
|
12520
|
+
console.log(chalk14.gray(` ${this.persistentInput.getQueueLength()} more request(s) queued`));
|
|
12524
12521
|
}
|
|
12525
12522
|
}
|
|
12526
12523
|
}
|
|
@@ -12596,9 +12593,9 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12596
12593
|
await session.save();
|
|
12597
12594
|
}
|
|
12598
12595
|
const errorMessage = error.message || "Unknown error occurred";
|
|
12599
|
-
console.error(
|
|
12600
|
-
console.error(
|
|
12601
|
-
console.error(
|
|
12596
|
+
console.error(chalk14.red("\n\u274C An error occurred:"));
|
|
12597
|
+
console.error(chalk14.red(errorMessage));
|
|
12598
|
+
console.error(chalk14.gray(`Error logged to: ${this.errorLogger.getLogPath()}
|
|
12602
12599
|
`));
|
|
12603
12600
|
continue;
|
|
12604
12601
|
}
|
|
@@ -12626,7 +12623,7 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12626
12623
|
return null;
|
|
12627
12624
|
}
|
|
12628
12625
|
if (normalized === "/") {
|
|
12629
|
-
console.log(
|
|
12626
|
+
console.log(chalk14.gray("Type a slash command name (e.g. /diff) and press Enter."));
|
|
12630
12627
|
return null;
|
|
12631
12628
|
}
|
|
12632
12629
|
const looksLikeFilePath = (text) => {
|
|
@@ -12663,8 +12660,8 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12663
12660
|
}
|
|
12664
12661
|
async handleMemoryStore(content) {
|
|
12665
12662
|
if (!content) {
|
|
12666
|
-
console.log(
|
|
12667
|
-
console.log(
|
|
12663
|
+
console.log(chalk14.gray("Usage: # <text to remember>"));
|
|
12664
|
+
console.log(chalk14.gray("Example: # Always use TypeScript strict mode"));
|
|
12668
12665
|
return;
|
|
12669
12666
|
}
|
|
12670
12667
|
try {
|
|
@@ -12681,8 +12678,8 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12681
12678
|
const similar = await this.memoryManager.findSimilar(content, level);
|
|
12682
12679
|
if (similar && similar.score >= 0.6) {
|
|
12683
12680
|
console.log();
|
|
12684
|
-
console.log(
|
|
12685
|
-
console.log(
|
|
12681
|
+
console.log(chalk14.yellow("Found similar existing memory:"));
|
|
12682
|
+
console.log(chalk14.gray(` "${similar.entry.content}"`));
|
|
12686
12683
|
const { Confirm } = enquirer3;
|
|
12687
12684
|
const confirmPrompt = new Confirm({
|
|
12688
12685
|
name: "update",
|
|
@@ -12691,23 +12688,23 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12691
12688
|
const shouldUpdate = await confirmPrompt.run();
|
|
12692
12689
|
if (shouldUpdate) {
|
|
12693
12690
|
await this.memoryManager.updateMemory(similar.entry.id, content, level);
|
|
12694
|
-
console.log(
|
|
12691
|
+
console.log(chalk14.green("Memory updated."));
|
|
12695
12692
|
return;
|
|
12696
12693
|
}
|
|
12697
12694
|
}
|
|
12698
12695
|
await this.memoryManager.store(content, level);
|
|
12699
|
-
console.log(
|
|
12696
|
+
console.log(chalk14.green(`Memory saved to ${level} level.`));
|
|
12700
12697
|
} catch (error) {
|
|
12701
12698
|
if (error.isCanceled) {
|
|
12702
12699
|
return;
|
|
12703
12700
|
}
|
|
12704
|
-
console.error(
|
|
12701
|
+
console.error(chalk14.red("Failed to store memory:"), error.message);
|
|
12705
12702
|
}
|
|
12706
12703
|
}
|
|
12707
12704
|
async listWorkspaceFiles() {
|
|
12708
12705
|
const entries = await fs19.readdir(this.runtime.workspaceRoot);
|
|
12709
12706
|
const sorted = entries.sort((a, b) => a.localeCompare(b));
|
|
12710
|
-
console.log("\n" +
|
|
12707
|
+
console.log("\n" + chalk14.cyan("Workspace files:"));
|
|
12711
12708
|
console.log(sorted.map((entry) => ` - ${entry}`).join("\n"));
|
|
12712
12709
|
console.log();
|
|
12713
12710
|
}
|
|
@@ -12764,7 +12761,7 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12764
12761
|
encoding: "utf8"
|
|
12765
12762
|
});
|
|
12766
12763
|
if (status.status === 0 && status.stdout) {
|
|
12767
|
-
console.log("\n" +
|
|
12764
|
+
console.log("\n" + chalk14.cyan("Git status:"));
|
|
12768
12765
|
console.log(status.stdout.trim() + "\n");
|
|
12769
12766
|
}
|
|
12770
12767
|
const diff = spawnSync5("git", ["diff", "--color=always"], {
|
|
@@ -12772,18 +12769,18 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12772
12769
|
encoding: "utf8"
|
|
12773
12770
|
});
|
|
12774
12771
|
if (diff.status === 0) {
|
|
12775
|
-
console.log(
|
|
12776
|
-
console.log(diff.stdout ||
|
|
12772
|
+
console.log(chalk14.cyan("Git diff:"));
|
|
12773
|
+
console.log(diff.stdout || chalk14.gray("No diff."));
|
|
12777
12774
|
} else {
|
|
12778
|
-
console.log(
|
|
12775
|
+
console.log(chalk14.yellow("Unable to compute git diff. Is this a git repository?"));
|
|
12779
12776
|
}
|
|
12780
12777
|
}
|
|
12781
12778
|
async undoLastMutation() {
|
|
12782
12779
|
try {
|
|
12783
12780
|
await this.files.undoLast();
|
|
12784
|
-
console.log(
|
|
12781
|
+
console.log(chalk14.green("Reverted last mutation."));
|
|
12785
12782
|
} catch (error) {
|
|
12786
|
-
console.log(
|
|
12783
|
+
console.log(chalk14.yellow(error.message));
|
|
12787
12784
|
}
|
|
12788
12785
|
}
|
|
12789
12786
|
async promptModelSelection() {
|
|
@@ -12791,8 +12788,8 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12791
12788
|
const allProviders = ["openrouter", "ollama", "llamacpp", "openai"];
|
|
12792
12789
|
const providerChoices = allProviders.map((name) => {
|
|
12793
12790
|
const isConfigured = this.isProviderConfigured(name);
|
|
12794
|
-
const indicator = isConfigured ?
|
|
12795
|
-
const current = name === this.activeProvider ?
|
|
12791
|
+
const indicator = isConfigured ? chalk14.green("\u25CF") : chalk14.red("\u25CB");
|
|
12792
|
+
const current = name === this.activeProvider ? chalk14.cyan(" (current)") : "";
|
|
12796
12793
|
return {
|
|
12797
12794
|
name,
|
|
12798
12795
|
message: `${indicator} ${name}${current}`,
|
|
@@ -12809,7 +12806,7 @@ If lint or tests fail, report the issues but do NOT commit.`;
|
|
|
12809
12806
|
]);
|
|
12810
12807
|
const selectedProvider = providerAnswer.provider;
|
|
12811
12808
|
if (!this.isProviderConfigured(selectedProvider)) {
|
|
12812
|
-
console.log(
|
|
12809
|
+
console.log(chalk14.yellow(`
|
|
12813
12810
|
${selectedProvider} is not configured yet. Let's set it up!
|
|
12814
12811
|
`));
|
|
12815
12812
|
await this.configureProvider(selectedProvider);
|
|
@@ -12818,7 +12815,7 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12818
12815
|
await this.changeProviderModel(selectedProvider);
|
|
12819
12816
|
} catch (error) {
|
|
12820
12817
|
if (error.name === "ExitPromptError" || error.message?.includes("canceled")) {
|
|
12821
|
-
console.log(
|
|
12818
|
+
console.log(chalk14.gray("\nConfiguration cancelled."));
|
|
12822
12819
|
return;
|
|
12823
12820
|
}
|
|
12824
12821
|
throw error;
|
|
@@ -12850,8 +12847,8 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12850
12847
|
}
|
|
12851
12848
|
async configureOpenRouter() {
|
|
12852
12849
|
try {
|
|
12853
|
-
console.log(
|
|
12854
|
-
console.log(
|
|
12850
|
+
console.log(chalk14.cyan("OpenRouter Configuration"));
|
|
12851
|
+
console.log(chalk14.gray("Get your API key at: https://openrouter.ai/keys\n"));
|
|
12855
12852
|
const answers = await enquirer3.prompt([
|
|
12856
12853
|
{
|
|
12857
12854
|
type: "password",
|
|
@@ -12874,10 +12871,10 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12874
12871
|
this.runtime.options.model = answers.model;
|
|
12875
12872
|
await saveConfig(this.runtime.config);
|
|
12876
12873
|
this.resetLlmClient("openrouter", answers.model);
|
|
12877
|
-
console.log(
|
|
12874
|
+
console.log(chalk14.green("\n\u2713 OpenRouter configured successfully!"));
|
|
12878
12875
|
} catch (error) {
|
|
12879
12876
|
if (error.name === "ExitPromptError" || error.message?.includes("canceled")) {
|
|
12880
|
-
console.log(
|
|
12877
|
+
console.log(chalk14.gray("\nConfiguration cancelled."));
|
|
12881
12878
|
return;
|
|
12882
12879
|
}
|
|
12883
12880
|
throw error;
|
|
@@ -12885,8 +12882,8 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12885
12882
|
}
|
|
12886
12883
|
async configureOllama() {
|
|
12887
12884
|
try {
|
|
12888
|
-
console.log(
|
|
12889
|
-
console.log(
|
|
12885
|
+
console.log(chalk14.cyan("Ollama Configuration"));
|
|
12886
|
+
console.log(chalk14.gray("Make sure Ollama is running: ollama serve\n"));
|
|
12890
12887
|
const ollamaUrl = "http://localhost:11434";
|
|
12891
12888
|
let availableModels = [];
|
|
12892
12889
|
try {
|
|
@@ -12896,11 +12893,11 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12896
12893
|
availableModels = data.models?.map((m) => m.name) || [];
|
|
12897
12894
|
}
|
|
12898
12895
|
} catch {
|
|
12899
|
-
console.log(
|
|
12896
|
+
console.log(chalk14.yellow("\u26A0 Could not connect to Ollama. Make sure it's running.\n"));
|
|
12900
12897
|
}
|
|
12901
12898
|
let modelAnswer;
|
|
12902
12899
|
if (availableModels.length > 0) {
|
|
12903
|
-
console.log(
|
|
12900
|
+
console.log(chalk14.green(`Found ${availableModels.length} model(s)
|
|
12904
12901
|
`));
|
|
12905
12902
|
modelAnswer = await enquirer3.prompt([
|
|
12906
12903
|
{
|
|
@@ -12928,10 +12925,10 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12928
12925
|
this.runtime.options.model = modelAnswer.model;
|
|
12929
12926
|
await saveConfig(this.runtime.config);
|
|
12930
12927
|
this.resetLlmClient("ollama", modelAnswer.model);
|
|
12931
|
-
console.log(
|
|
12928
|
+
console.log(chalk14.green("\n\u2713 Ollama configured successfully!"));
|
|
12932
12929
|
} catch (error) {
|
|
12933
12930
|
if (error.name === "ExitPromptError" || error.message?.includes("canceled")) {
|
|
12934
|
-
console.log(
|
|
12931
|
+
console.log(chalk14.gray("\nConfiguration cancelled."));
|
|
12935
12932
|
return;
|
|
12936
12933
|
}
|
|
12937
12934
|
throw error;
|
|
@@ -12939,8 +12936,8 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12939
12936
|
}
|
|
12940
12937
|
async configureLlamaCpp() {
|
|
12941
12938
|
try {
|
|
12942
|
-
console.log(
|
|
12943
|
-
console.log(
|
|
12939
|
+
console.log(chalk14.cyan("llama.cpp Configuration"));
|
|
12940
|
+
console.log(chalk14.gray("Make sure llama.cpp server is running: ./server -m model.gguf\n"));
|
|
12944
12941
|
const answers = await enquirer3.prompt([
|
|
12945
12942
|
{
|
|
12946
12943
|
type: "input",
|
|
@@ -12964,10 +12961,10 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12964
12961
|
this.runtime.options.model = answers.model;
|
|
12965
12962
|
await saveConfig(this.runtime.config);
|
|
12966
12963
|
this.resetLlmClient("llamacpp", answers.model);
|
|
12967
|
-
console.log(
|
|
12964
|
+
console.log(chalk14.green("\n\u2713 llama.cpp configured successfully!"));
|
|
12968
12965
|
} catch (error) {
|
|
12969
12966
|
if (error.name === "ExitPromptError" || error.message?.includes("canceled")) {
|
|
12970
|
-
console.log(
|
|
12967
|
+
console.log(chalk14.gray("\nConfiguration cancelled."));
|
|
12971
12968
|
return;
|
|
12972
12969
|
}
|
|
12973
12970
|
throw error;
|
|
@@ -12975,8 +12972,8 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
12975
12972
|
}
|
|
12976
12973
|
async configureOpenAI() {
|
|
12977
12974
|
try {
|
|
12978
|
-
console.log(
|
|
12979
|
-
console.log(
|
|
12975
|
+
console.log(chalk14.cyan("OpenAI Configuration"));
|
|
12976
|
+
console.log(chalk14.gray("Get your API key at: https://platform.openai.com/api-keys\n"));
|
|
12980
12977
|
const modelChoices = [
|
|
12981
12978
|
"gpt-4o",
|
|
12982
12979
|
"gpt-4o-mini",
|
|
@@ -13006,10 +13003,10 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
13006
13003
|
this.runtime.options.model = answers.model;
|
|
13007
13004
|
await saveConfig(this.runtime.config);
|
|
13008
13005
|
this.resetLlmClient("openai", answers.model);
|
|
13009
|
-
console.log(
|
|
13006
|
+
console.log(chalk14.green("\n\u2713 OpenAI configured successfully!"));
|
|
13010
13007
|
} catch (error) {
|
|
13011
13008
|
if (error.name === "ExitPromptError" || error.message?.includes("canceled")) {
|
|
13012
|
-
console.log(
|
|
13009
|
+
console.log(chalk14.gray("\nConfiguration cancelled."));
|
|
13013
13010
|
return;
|
|
13014
13011
|
}
|
|
13015
13012
|
throw error;
|
|
@@ -13067,7 +13064,7 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
13067
13064
|
await this.applyModelChange(provider, answer.model?.trim(), currentModel);
|
|
13068
13065
|
} catch (error) {
|
|
13069
13066
|
if (error.name === "ExitPromptError" || error.message?.includes("canceled")) {
|
|
13070
|
-
console.log(
|
|
13067
|
+
console.log(chalk14.gray("\nModel change cancelled."));
|
|
13071
13068
|
return;
|
|
13072
13069
|
}
|
|
13073
13070
|
throw error;
|
|
@@ -13075,7 +13072,7 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
13075
13072
|
}
|
|
13076
13073
|
async applyModelChange(provider, newModel, currentModel) {
|
|
13077
13074
|
if (!newModel || newModel === currentModel && provider === this.activeProvider) {
|
|
13078
|
-
console.log(
|
|
13075
|
+
console.log(chalk14.gray("Model unchanged."));
|
|
13079
13076
|
return;
|
|
13080
13077
|
}
|
|
13081
13078
|
const previousModel = this.runtime.options.model;
|
|
@@ -13092,7 +13089,7 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
13092
13089
|
toModel: newModel,
|
|
13093
13090
|
provider
|
|
13094
13091
|
});
|
|
13095
|
-
console.log(
|
|
13092
|
+
console.log(chalk14.green(`\u2713 Using ${provider} model ${newModel}`));
|
|
13096
13093
|
}
|
|
13097
13094
|
async promptApprovalMode() {
|
|
13098
13095
|
const answer = await enquirer3.prompt([
|
|
@@ -13109,13 +13106,13 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
13109
13106
|
]);
|
|
13110
13107
|
this.runtime.options.yes = answer.mode === "prompt";
|
|
13111
13108
|
console.log(
|
|
13112
|
-
answer.mode === "prompt" ?
|
|
13109
|
+
answer.mode === "prompt" ? chalk14.yellow("Auto-confirm enabled. Use responsibly.") : chalk14.green("Manual approvals required before risky writes.")
|
|
13113
13110
|
);
|
|
13114
13111
|
}
|
|
13115
13112
|
async createAgentsFile() {
|
|
13116
13113
|
const target = path18.join(this.runtime.workspaceRoot, "AGENTS.md");
|
|
13117
13114
|
if (await fs19.pathExists(target)) {
|
|
13118
|
-
console.log(
|
|
13115
|
+
console.log(chalk14.gray("AGENTS.md already exists in this workspace."));
|
|
13119
13116
|
return;
|
|
13120
13117
|
}
|
|
13121
13118
|
const template = `# Project Autopilot
|
|
@@ -13123,7 +13120,7 @@ ${selectedProvider} is not configured yet. Let's set it up!
|
|
|
13123
13120
|
Describe how Autohand should work in this repo. Include framework commands, testing requirements, and any constraints.
|
|
13124
13121
|
`;
|
|
13125
13122
|
await fs19.writeFile(target, template, "utf8");
|
|
13126
|
-
console.log(
|
|
13123
|
+
console.log(chalk14.green("Created AGENTS.md template. Customize it to guide the agent."));
|
|
13127
13124
|
}
|
|
13128
13125
|
/**
|
|
13129
13126
|
* Detect if instruction is simple chat that doesn't need tools
|
|
@@ -13165,7 +13162,7 @@ Describe how Autohand should work in this repo. Include framework commands, test
|
|
|
13165
13162
|
return true;
|
|
13166
13163
|
} catch (error) {
|
|
13167
13164
|
if (error instanceof Error) {
|
|
13168
|
-
console.error(
|
|
13165
|
+
console.error(chalk14.red(error.message));
|
|
13169
13166
|
}
|
|
13170
13167
|
return false;
|
|
13171
13168
|
} finally {
|
|
@@ -13184,7 +13181,7 @@ Describe how Autohand should work in this repo. Include framework commands, test
|
|
|
13184
13181
|
if (intentResult.intent === "implementation") {
|
|
13185
13182
|
const bootstrapResult = await this.runEnvironmentBootstrap();
|
|
13186
13183
|
if (!bootstrapResult.success) {
|
|
13187
|
-
console.log(
|
|
13184
|
+
console.log(chalk14.red("\n[BLOCKED] Environment setup failed. Fix issues before proceeding."));
|
|
13188
13185
|
this.isInstructionActive = false;
|
|
13189
13186
|
return false;
|
|
13190
13187
|
}
|
|
@@ -13197,7 +13194,7 @@ Describe how Autohand should work in this repo. Include framework commands, test
|
|
|
13197
13194
|
canceledByUser = true;
|
|
13198
13195
|
this.stopStatusUpdates();
|
|
13199
13196
|
this.stopUI();
|
|
13200
|
-
console.log("\n" +
|
|
13197
|
+
console.log("\n" + chalk14.yellow("Request canceled by user (ESC)."));
|
|
13201
13198
|
}
|
|
13202
13199
|
});
|
|
13203
13200
|
const cleanupEsc = this.useInkRenderer ? () => {
|
|
@@ -13206,7 +13203,7 @@ Describe how Autohand should work in this repo. Include framework commands, test
|
|
|
13206
13203
|
canceledByUser = true;
|
|
13207
13204
|
this.stopStatusUpdates();
|
|
13208
13205
|
this.stopUI();
|
|
13209
|
-
console.log("\n" +
|
|
13206
|
+
console.log("\n" + chalk14.yellow("Request canceled by user (ESC)."));
|
|
13210
13207
|
}
|
|
13211
13208
|
}, true);
|
|
13212
13209
|
const stopPreparation = this.startPreparationStatus(instruction);
|
|
@@ -13228,7 +13225,7 @@ Describe how Autohand should work in this repo. Include framework commands, test
|
|
|
13228
13225
|
}
|
|
13229
13226
|
if (error instanceof ProviderNotConfiguredError) {
|
|
13230
13227
|
this.cleanupUI();
|
|
13231
|
-
console.log(
|
|
13228
|
+
console.log(chalk14.yellow(`
|
|
13232
13229
|
No provider is configured yet. Let's set one up!
|
|
13233
13230
|
`));
|
|
13234
13231
|
await this.promptModelSelection();
|
|
@@ -13240,9 +13237,9 @@ No provider is configured yet. Let's set one up!
|
|
|
13240
13237
|
if (this.isRetryableSessionError(err) && this.sessionRetryCount < maxRetries) {
|
|
13241
13238
|
this.sessionRetryCount++;
|
|
13242
13239
|
await this.submitSessionFailureBugReport(err, this.sessionRetryCount, maxRetries);
|
|
13243
|
-
console.log(
|
|
13240
|
+
console.log(chalk14.yellow(`
|
|
13244
13241
|
\u26A0 Session encountered an error: ${err.message}`));
|
|
13245
|
-
console.log(
|
|
13242
|
+
console.log(chalk14.cyan(` Attempting recovery (${this.sessionRetryCount}/${maxRetries})...`));
|
|
13246
13243
|
const delay = baseDelay * Math.pow(1.5, this.sessionRetryCount - 1);
|
|
13247
13244
|
await this.sleep(delay);
|
|
13248
13245
|
this.injectContinuationMessage(err, this.sessionRetryCount);
|
|
@@ -13265,7 +13262,7 @@ No provider is configured yet. Let's set one up!
|
|
|
13265
13262
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
13266
13263
|
this.emitOutput({ type: "error", content: errorMessage });
|
|
13267
13264
|
if (error instanceof Error) {
|
|
13268
|
-
console.error(
|
|
13265
|
+
console.error(chalk14.red(error.message));
|
|
13269
13266
|
} else {
|
|
13270
13267
|
console.error(error);
|
|
13271
13268
|
}
|
|
@@ -13279,7 +13276,7 @@ No provider is configured yet. Let's set one up!
|
|
|
13279
13276
|
const tokens = this.formatTokens(this.totalTokensUsed);
|
|
13280
13277
|
const queueCount = this.pendingInkInstructions.length + (this.inkRenderer?.getQueueCount() ?? 0) + this.persistentInput.getQueueLength();
|
|
13281
13278
|
const queueStatus = queueCount > 0 ? ` \xB7 ${queueCount} queued` : "";
|
|
13282
|
-
console.log(
|
|
13279
|
+
console.log(chalk14.gray(`
|
|
13283
13280
|
Completed in ${elapsed} \xB7 ${tokens} used${queueStatus}`));
|
|
13284
13281
|
}
|
|
13285
13282
|
this.sessionTokensUsed += this.totalTokensUsed;
|
|
@@ -13355,7 +13352,7 @@ Completed in ${elapsed} \xB7 ${tokens} used${queueStatus}`));
|
|
|
13355
13352
|
duration: sessionDuration
|
|
13356
13353
|
});
|
|
13357
13354
|
if (!session) {
|
|
13358
|
-
console.log(
|
|
13355
|
+
console.log(chalk14.gray("Ending Autohand session."));
|
|
13359
13356
|
await this.telemetryManager.shutdown();
|
|
13360
13357
|
return;
|
|
13361
13358
|
}
|
|
@@ -13375,12 +13372,12 @@ Completed in ${elapsed} \xB7 ${tokens} used${queueStatus}`));
|
|
|
13375
13372
|
await this.telemetryManager.endSession("completed");
|
|
13376
13373
|
await this.telemetryManager.shutdown();
|
|
13377
13374
|
await this.sessionManager.closeSession(summary);
|
|
13378
|
-
console.log(
|
|
13379
|
-
console.log(
|
|
13375
|
+
console.log(chalk14.gray("\nEnding Autohand session.\n"));
|
|
13376
|
+
console.log(chalk14.cyan(`\u{1F4BE} Session saved: ${session.metadata.sessionId}`));
|
|
13380
13377
|
if (syncResult.success) {
|
|
13381
|
-
console.log(
|
|
13378
|
+
console.log(chalk14.gray(` Synced to cloud: ${syncResult.id}`));
|
|
13382
13379
|
}
|
|
13383
|
-
console.log(
|
|
13380
|
+
console.log(chalk14.gray(` Resume with: autohand resume ${session.metadata.sessionId}
|
|
13384
13381
|
`));
|
|
13385
13382
|
}
|
|
13386
13383
|
async runReactLoop(abortController) {
|
|
@@ -13408,7 +13405,7 @@ Completed in ${elapsed} \xB7 ${tokens} used${queueStatus}`));
|
|
|
13408
13405
|
);
|
|
13409
13406
|
if (contextUsage.isCritical) {
|
|
13410
13407
|
this.runtime.spinner?.stop();
|
|
13411
|
-
console.log(
|
|
13408
|
+
console.log(chalk14.yellow("\n\u26A0 Context at critical level, auto-cropping old messages..."));
|
|
13412
13409
|
const targetTokens = Math.floor(contextUsage.contextWindow * 0.7);
|
|
13413
13410
|
const tokensToRemove = contextUsage.totalTokens - targetTokens;
|
|
13414
13411
|
const avgMessageTokens = 200;
|
|
@@ -13421,12 +13418,12 @@ Completed in ${elapsed} \xB7 ${tokens} used${queueStatus}`));
|
|
|
13421
13418
|
Summary of removed content:
|
|
13422
13419
|
${summary}`
|
|
13423
13420
|
);
|
|
13424
|
-
console.log(
|
|
13425
|
-
console.log(
|
|
13421
|
+
console.log(chalk14.gray(` Removed ${removed.length} messages to free up context space`));
|
|
13422
|
+
console.log(chalk14.gray(` Summary preserved in context`));
|
|
13426
13423
|
}
|
|
13427
13424
|
this.updateContextUsage(this.conversation.history(), tools);
|
|
13428
13425
|
} else if (contextUsage.isWarning && iteration === 0) {
|
|
13429
|
-
console.log(
|
|
13426
|
+
console.log(chalk14.yellow(`
|
|
13430
13427
|
\u26A0 Context at ${Math.round(contextUsage.usagePercent * 100)}% - approaching limit`));
|
|
13431
13428
|
}
|
|
13432
13429
|
if (iteration >= 10 && iteration % 10 === 0) {
|
|
@@ -13475,12 +13472,12 @@ ${summary}`
|
|
|
13475
13472
|
await this.saveAssistantMessage(completion.content, payload.toolCalls);
|
|
13476
13473
|
this.updateContextUsage(this.conversation.history(), tools);
|
|
13477
13474
|
if (debugMode) {
|
|
13478
|
-
console.log(
|
|
13475
|
+
console.log(chalk14.yellow(`
|
|
13479
13476
|
[DEBUG] Iteration ${iteration}:`));
|
|
13480
|
-
console.log(
|
|
13481
|
-
console.log(
|
|
13482
|
-
console.log(
|
|
13483
|
-
console.log(
|
|
13477
|
+
console.log(chalk14.yellow(` - toolCalls: ${payload.toolCalls?.length ?? 0}`));
|
|
13478
|
+
console.log(chalk14.yellow(` - thought: ${payload.thought?.slice(0, 100) || "(none)"}`));
|
|
13479
|
+
console.log(chalk14.yellow(` - finalResponse: ${payload.finalResponse?.slice(0, 100) || "(none)"}`));
|
|
13480
|
+
console.log(chalk14.yellow(` - raw content: ${completion.content?.slice(0, 200) || "(empty)"}`));
|
|
13484
13481
|
}
|
|
13485
13482
|
const toolCount = payload.toolCalls?.length ?? 0;
|
|
13486
13483
|
const hasResponse = Boolean(payload.finalResponse || payload.response || !toolCount && payload.thought);
|
|
@@ -13497,7 +13494,7 @@ ${summary}`
|
|
|
13497
13494
|
} else {
|
|
13498
13495
|
if (iteration > 0) {
|
|
13499
13496
|
const status = toolCount > 0 ? `\u2192 Step ${iteration + 1}: calling ${toolCount} tool(s)` : hasResponse ? `\u2192 Step ${iteration + 1}: preparing response` : `\u2192 Step ${iteration + 1}: thinking...`;
|
|
13500
|
-
console.log(
|
|
13497
|
+
console.log(chalk14.gray(status));
|
|
13501
13498
|
}
|
|
13502
13499
|
}
|
|
13503
13500
|
if (payload.toolCalls && payload.toolCalls.length > 0) {
|
|
@@ -13516,8 +13513,8 @@ ${summary}`
|
|
|
13516
13513
|
});
|
|
13517
13514
|
await this.saveToolMessage("smart_context_cropper", content, call.id);
|
|
13518
13515
|
this.updateContextUsage(this.conversation.history(), tools);
|
|
13519
|
-
outputLines.push(`${
|
|
13520
|
-
outputLines.push(
|
|
13516
|
+
outputLines.push(`${chalk14.cyan("\u2702 smart_context_cropper")}`);
|
|
13517
|
+
outputLines.push(chalk14.gray(content));
|
|
13521
13518
|
outputLines.push("");
|
|
13522
13519
|
}
|
|
13523
13520
|
}
|
|
@@ -13653,7 +13650,7 @@ ${summary}`
|
|
|
13653
13650
|
if (consecutiveEmpty >= 3) {
|
|
13654
13651
|
if (debugMode) process.stderr.write(`[AGENT DEBUG] Exiting after 3 consecutive empty responses
|
|
13655
13652
|
`);
|
|
13656
|
-
console.log(
|
|
13653
|
+
console.log(chalk14.yellow("\n\u26A0 Model not providing response after multiple attempts. Showing available context."));
|
|
13657
13654
|
const fallback = payload.thought || "The model did not provide a clear response. Please try rephrasing your question.";
|
|
13658
13655
|
if (this.inkRenderer) {
|
|
13659
13656
|
this.inkRenderer.setWorking(false);
|
|
@@ -13687,7 +13684,7 @@ ${summary}`
|
|
|
13687
13684
|
} else {
|
|
13688
13685
|
this.runtime.spinner?.stop();
|
|
13689
13686
|
if (showThinking && payload.thought && !payload.thought.trim().startsWith("{")) {
|
|
13690
|
-
console.log(
|
|
13687
|
+
console.log(chalk14.gray(`Thinking: ${payload.thought}`));
|
|
13691
13688
|
console.log();
|
|
13692
13689
|
}
|
|
13693
13690
|
console.log(response);
|
|
@@ -13696,10 +13693,10 @@ ${summary}`
|
|
|
13696
13693
|
}
|
|
13697
13694
|
this.stopStatusUpdates();
|
|
13698
13695
|
this.runtime.spinner?.stop();
|
|
13699
|
-
console.log(
|
|
13696
|
+
console.log(chalk14.yellow(`
|
|
13700
13697
|
\u26A0 Task exceeded ${maxIterations} tool iterations without completing.`));
|
|
13701
|
-
console.log(
|
|
13702
|
-
console.log(
|
|
13698
|
+
console.log(chalk14.gray("This usually means the task is too complex for a single turn."));
|
|
13699
|
+
console.log(chalk14.gray("Try breaking it into smaller steps or use /new to start fresh."));
|
|
13703
13700
|
throw new Error(`Reached maximum iterations (${maxIterations}) while processing. Try a simpler request or break the task into smaller steps.`);
|
|
13704
13701
|
}
|
|
13705
13702
|
/**
|
|
@@ -13728,8 +13725,8 @@ ${summary}`
|
|
|
13728
13725
|
toolCalls: completion.toolCalls.map((tc) => {
|
|
13729
13726
|
const rawArgs = tc.function.arguments;
|
|
13730
13727
|
if (!rawArgs || rawArgs === "{}" || rawArgs === "") {
|
|
13731
|
-
console.error(
|
|
13732
|
-
console.error(
|
|
13728
|
+
console.error(chalk14.yellow(`\u26A0 Tool "${tc.function.name}" has empty/missing arguments`));
|
|
13729
|
+
console.error(chalk14.gray(` Raw arguments: "${rawArgs}"`));
|
|
13733
13730
|
}
|
|
13734
13731
|
return {
|
|
13735
13732
|
id: tc.id,
|
|
@@ -13746,7 +13743,7 @@ ${summary}`
|
|
|
13746
13743
|
*/
|
|
13747
13744
|
safeParseToolArgs(json) {
|
|
13748
13745
|
if (!json || typeof json !== "string") {
|
|
13749
|
-
console.error(
|
|
13746
|
+
console.error(chalk14.yellow("\u26A0 Tool arguments empty or not a string"));
|
|
13750
13747
|
return void 0;
|
|
13751
13748
|
}
|
|
13752
13749
|
try {
|
|
@@ -13754,11 +13751,11 @@ ${summary}`
|
|
|
13754
13751
|
if (parsed && typeof parsed === "object") {
|
|
13755
13752
|
return parsed;
|
|
13756
13753
|
}
|
|
13757
|
-
console.error(
|
|
13754
|
+
console.error(chalk14.yellow(`\u26A0 Tool arguments parsed but not an object: ${typeof parsed}`));
|
|
13758
13755
|
return void 0;
|
|
13759
13756
|
} catch (err) {
|
|
13760
|
-
console.error(
|
|
13761
|
-
console.error(
|
|
13757
|
+
console.error(chalk14.yellow(`\u26A0 Failed to parse tool arguments: ${err instanceof Error ? err.message : String(err)}`));
|
|
13758
|
+
console.error(chalk14.gray(` Raw JSON: ${json.slice(0, 200)}${json.length > 200 ? "..." : ""}`));
|
|
13762
13759
|
return void 0;
|
|
13763
13760
|
}
|
|
13764
13761
|
}
|
|
@@ -14274,7 +14271,7 @@ ${toolSignatures}
|
|
|
14274
14271
|
const contents = await this.files.readFile(file);
|
|
14275
14272
|
this.mentionContexts.push({ path: file, contents: this.trimContext(contents) });
|
|
14276
14273
|
} catch (error) {
|
|
14277
|
-
console.log(
|
|
14274
|
+
console.log(chalk14.yellow(`Unable to read ${file} for context: ${error.message}`));
|
|
14278
14275
|
}
|
|
14279
14276
|
}
|
|
14280
14277
|
trimContext(content) {
|
|
@@ -14394,11 +14391,11 @@ ${ctx.contents}`).join("\n\n");
|
|
|
14394
14391
|
return;
|
|
14395
14392
|
}
|
|
14396
14393
|
if (!this.hasPrintedExplorationHeader) {
|
|
14397
|
-
console.log("\n" +
|
|
14394
|
+
console.log("\n" + chalk14.bold("* Explored"));
|
|
14398
14395
|
this.hasPrintedExplorationHeader = true;
|
|
14399
14396
|
}
|
|
14400
14397
|
const label = this.formatExplorationLabel(event.kind);
|
|
14401
|
-
console.log(` ${
|
|
14398
|
+
console.log(` ${chalk14.cyan(label)} ${event.target}`);
|
|
14402
14399
|
}
|
|
14403
14400
|
clearExplorationLog() {
|
|
14404
14401
|
this.hasPrintedExplorationHeader = false;
|
|
@@ -14420,7 +14417,7 @@ ${ctx.contents}`).join("\n\n");
|
|
|
14420
14417
|
formatToolResultsBatch(results, charLimit, toolCalls, thought) {
|
|
14421
14418
|
const lines = [];
|
|
14422
14419
|
if (thought && !thought.trim().startsWith("{")) {
|
|
14423
|
-
lines.push(
|
|
14420
|
+
lines.push(chalk14.white(thought));
|
|
14424
14421
|
lines.push("");
|
|
14425
14422
|
}
|
|
14426
14423
|
for (let i = 0; i < results.length; i++) {
|
|
@@ -14431,15 +14428,15 @@ ${ctx.contents}`).join("\n\n");
|
|
|
14431
14428
|
const command = call?.args?.command;
|
|
14432
14429
|
const commandArgs = call?.args?.args;
|
|
14433
14430
|
const display = result.success ? formatToolOutputForDisplay({ tool: result.tool, content, charLimit, filePath, command, commandArgs }) : { output: content, truncated: false, totalChars: content.length };
|
|
14434
|
-
const icon = result.success ?
|
|
14435
|
-
lines.push(`${icon} ${
|
|
14431
|
+
const icon = result.success ? chalk14.green("\u2714") : chalk14.red("\u2716");
|
|
14432
|
+
lines.push(`${icon} ${chalk14.bold(result.tool)}`);
|
|
14436
14433
|
if (content) {
|
|
14437
14434
|
if (result.success) {
|
|
14438
|
-
lines.push(
|
|
14435
|
+
lines.push(chalk14.gray(display.output));
|
|
14439
14436
|
} else {
|
|
14440
|
-
lines.push(
|
|
14441
|
-
lines.push(
|
|
14442
|
-
lines.push(
|
|
14437
|
+
lines.push(chalk14.red("\u250C\u2500 Error \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
14438
|
+
lines.push(chalk14.red("\u2502 ") + chalk14.white(content));
|
|
14439
|
+
lines.push(chalk14.red("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
14443
14440
|
}
|
|
14444
14441
|
}
|
|
14445
14442
|
lines.push("");
|
|
@@ -14652,7 +14649,7 @@ ${parts.join("\n")}`
|
|
|
14652
14649
|
controller.abort();
|
|
14653
14650
|
onCancel();
|
|
14654
14651
|
} else {
|
|
14655
|
-
console.log(
|
|
14652
|
+
console.log(chalk14.gray("Press Ctrl+C again to exit."));
|
|
14656
14653
|
}
|
|
14657
14654
|
return;
|
|
14658
14655
|
}
|
|
@@ -14668,7 +14665,7 @@ ${parts.join("\n")}`
|
|
|
14668
14665
|
queue.push({ text, timestamp: Date.now() });
|
|
14669
14666
|
const preview = text.length > 30 ? text.slice(0, 27) + "..." : text;
|
|
14670
14667
|
if (this.runtime.spinner) {
|
|
14671
|
-
this.runtime.spinner.text =
|
|
14668
|
+
this.runtime.spinner.text = chalk14.cyan(`\u2713 Queued: "${preview}" (${this.persistentInput.getQueueLength()} pending)`);
|
|
14672
14669
|
}
|
|
14673
14670
|
}
|
|
14674
14671
|
return;
|
|
@@ -14827,7 +14824,7 @@ ${parts.join("\n")}`
|
|
|
14827
14824
|
workspace: this.runtime.workspaceRoot
|
|
14828
14825
|
});
|
|
14829
14826
|
} catch (reportError) {
|
|
14830
|
-
console.error(
|
|
14827
|
+
console.error(chalk14.gray(`[Debug] Failed to submit bug report: ${reportError.message}`));
|
|
14831
14828
|
}
|
|
14832
14829
|
}
|
|
14833
14830
|
/**
|
|
@@ -14838,16 +14835,16 @@ ${parts.join("\n")}`
|
|
|
14838
14835
|
return;
|
|
14839
14836
|
}
|
|
14840
14837
|
if (result.intent === "diagnostic") {
|
|
14841
|
-
console.log(
|
|
14838
|
+
console.log(chalk14.blue("[DIAG] Mode: Diagnostic (read-only analysis)"));
|
|
14842
14839
|
if (result.keywords.length > 0) {
|
|
14843
14840
|
const kws = result.keywords.slice(0, 3).join('", "');
|
|
14844
|
-
console.log(
|
|
14841
|
+
console.log(chalk14.gray(` Detected: "${kws}"`));
|
|
14845
14842
|
}
|
|
14846
14843
|
} else {
|
|
14847
|
-
console.log(
|
|
14844
|
+
console.log(chalk14.yellow("[IMPL] Mode: Implementation"));
|
|
14848
14845
|
if (result.keywords.length > 0) {
|
|
14849
14846
|
const kws = result.keywords.slice(0, 3).join('", "');
|
|
14850
|
-
console.log(
|
|
14847
|
+
console.log(chalk14.gray(` Detected: "${kws}"`));
|
|
14851
14848
|
}
|
|
14852
14849
|
}
|
|
14853
14850
|
console.log();
|
|
@@ -14858,22 +14855,22 @@ ${parts.join("\n")}`
|
|
|
14858
14855
|
async runEnvironmentBootstrap() {
|
|
14859
14856
|
const isDebug = process.env.AUTOHAND_DEBUG === "1";
|
|
14860
14857
|
if (isDebug) {
|
|
14861
|
-
console.log(
|
|
14858
|
+
console.log(chalk14.cyan("[BOOTSTRAP] Running environment setup..."));
|
|
14862
14859
|
}
|
|
14863
14860
|
const result = await this.environmentBootstrap.run(this.runtime.workspaceRoot);
|
|
14864
14861
|
for (const step of result.steps) {
|
|
14865
|
-
const status = step.status === "success" ?
|
|
14866
|
-
const duration = step.duration ?
|
|
14867
|
-
const detail = step.detail ?
|
|
14862
|
+
const status = step.status === "success" ? chalk14.green("[OK]") : step.status === "failed" ? chalk14.red("[FAIL]") : step.status === "skipped" ? chalk14.gray("[SKIP]") : chalk14.gray("[...]");
|
|
14863
|
+
const duration = step.duration ? chalk14.gray(`(${(step.duration / 1e3).toFixed(1)}s)`) : "";
|
|
14864
|
+
const detail = step.detail ? chalk14.gray(` ${step.detail}`) : "";
|
|
14868
14865
|
if (step.status === "failed" || isDebug) {
|
|
14869
14866
|
console.log(` ${status} ${step.name.padEnd(14)} ${duration}${detail}`);
|
|
14870
14867
|
}
|
|
14871
14868
|
if (step.error) {
|
|
14872
|
-
console.log(
|
|
14869
|
+
console.log(chalk14.red(` Error: ${step.error}`));
|
|
14873
14870
|
}
|
|
14874
14871
|
}
|
|
14875
14872
|
if (result.success && isDebug) {
|
|
14876
|
-
console.log(
|
|
14873
|
+
console.log(chalk14.green(`
|
|
14877
14874
|
[READY] Environment ready (${(result.duration / 1e3).toFixed(1)}s)
|
|
14878
14875
|
`));
|
|
14879
14876
|
}
|
|
@@ -14883,26 +14880,26 @@ ${parts.join("\n")}`
|
|
|
14883
14880
|
* Run code quality pipeline after file modifications
|
|
14884
14881
|
*/
|
|
14885
14882
|
async runQualityPipeline() {
|
|
14886
|
-
console.log(
|
|
14883
|
+
console.log(chalk14.cyan("\n[QUALITY] Running quality checks..."));
|
|
14887
14884
|
const result = await this.codeQualityPipeline.run(this.runtime.workspaceRoot);
|
|
14888
14885
|
for (const check of result.checks) {
|
|
14889
|
-
const status = check.status === "passed" ?
|
|
14890
|
-
const duration = check.duration ?
|
|
14886
|
+
const status = check.status === "passed" ? chalk14.green("[OK]") : check.status === "failed" ? chalk14.red("[FAIL]") : check.status === "skipped" ? chalk14.gray("[SKIP]") : chalk14.gray("[...]");
|
|
14887
|
+
const duration = check.duration ? chalk14.gray(`(${(check.duration / 1e3).toFixed(1)}s)`) : "";
|
|
14891
14888
|
console.log(` ${status} ${check.name.padEnd(8)} ${check.command.padEnd(20)} ${duration}`);
|
|
14892
14889
|
if (check.status === "failed" && check.output) {
|
|
14893
14890
|
const errorLines = check.output.split("\n").slice(0, 3);
|
|
14894
14891
|
for (const line of errorLines) {
|
|
14895
14892
|
if (line.trim()) {
|
|
14896
|
-
console.log(
|
|
14893
|
+
console.log(chalk14.red(` ${line}`));
|
|
14897
14894
|
}
|
|
14898
14895
|
}
|
|
14899
14896
|
}
|
|
14900
14897
|
}
|
|
14901
14898
|
if (result.passed) {
|
|
14902
|
-
console.log(
|
|
14899
|
+
console.log(chalk14.green(`
|
|
14903
14900
|
[PASS] ${result.summary} (${(result.duration / 1e3).toFixed(1)}s)`));
|
|
14904
14901
|
} else {
|
|
14905
|
-
console.log(
|
|
14902
|
+
console.log(chalk14.red(`
|
|
14906
14903
|
[FAIL] ${result.summary}`));
|
|
14907
14904
|
}
|
|
14908
14905
|
}
|
|
@@ -15045,7 +15042,7 @@ ${parts.join("\n")}`
|
|
|
15045
15042
|
if (!this.runtime.spinner) return;
|
|
15046
15043
|
const inputPreview = this.queueInput.length > 40 ? "..." + this.queueInput.slice(-37) : this.queueInput;
|
|
15047
15044
|
const inputLine = `
|
|
15048
|
-
${
|
|
15045
|
+
${chalk14.gray("\u203A")} ${inputPreview}${chalk14.gray("\u258B")}`;
|
|
15049
15046
|
const fullText = statusLine + inputLine;
|
|
15050
15047
|
const cacheKey = `${statusLine}|${inputPreview}`;
|
|
15051
15048
|
if (cacheKey === this.lastRenderedStatus) return;
|
|
@@ -15228,7 +15225,7 @@ ${chalk13.gray("\u203A")} ${inputPreview}${chalk13.gray("\u258B")}`;
|
|
|
15228
15225
|
import fs20 from "fs-extra";
|
|
15229
15226
|
import os8 from "os";
|
|
15230
15227
|
import path19 from "path";
|
|
15231
|
-
import
|
|
15228
|
+
import chalk15 from "chalk";
|
|
15232
15229
|
var AVAILABLE_TOOLS = {
|
|
15233
15230
|
file: [
|
|
15234
15231
|
"read_file",
|
|
@@ -15659,7 +15656,7 @@ async function runAutoSkillGeneration(workspaceRoot, llm) {
|
|
|
15659
15656
|
skillsGenerated: 0,
|
|
15660
15657
|
skills: []
|
|
15661
15658
|
};
|
|
15662
|
-
console.log(
|
|
15659
|
+
console.log(chalk15.cyan("Analyzing project structure..."));
|
|
15663
15660
|
const analyzer = new ProjectAnalyzer(workspaceRoot);
|
|
15664
15661
|
let analysis;
|
|
15665
15662
|
try {
|
|
@@ -15669,17 +15666,17 @@ async function runAutoSkillGeneration(workspaceRoot, llm) {
|
|
|
15669
15666
|
return result;
|
|
15670
15667
|
}
|
|
15671
15668
|
if (analysis.languages.length === 0 && analysis.frameworks.length === 0) {
|
|
15672
|
-
console.log(
|
|
15669
|
+
console.log(chalk15.yellow("Could not detect project type. No skills generated."));
|
|
15673
15670
|
result.error = "Could not detect project type";
|
|
15674
15671
|
return result;
|
|
15675
15672
|
}
|
|
15676
15673
|
const detected = [...analysis.languages, ...analysis.frameworks, ...analysis.patterns].join(", ");
|
|
15677
|
-
console.log(
|
|
15678
|
-
console.log(
|
|
15679
|
-
console.log(
|
|
15674
|
+
console.log(chalk15.gray(`Detected: ${detected}`));
|
|
15675
|
+
console.log(chalk15.gray(`Platform: ${analysis.platform}`));
|
|
15676
|
+
console.log(chalk15.cyan("Generating skills..."));
|
|
15680
15677
|
const skills = await generateAutoSkills(analysis, llm);
|
|
15681
15678
|
if (skills.length === 0) {
|
|
15682
|
-
console.log(
|
|
15679
|
+
console.log(chalk15.yellow("No skills generated."));
|
|
15683
15680
|
result.error = "No skills generated";
|
|
15684
15681
|
return result;
|
|
15685
15682
|
}
|
|
@@ -15689,17 +15686,17 @@ async function runAutoSkillGeneration(workspaceRoot, llm) {
|
|
|
15689
15686
|
if (saved) {
|
|
15690
15687
|
result.skillsGenerated++;
|
|
15691
15688
|
result.skills.push(skill.name);
|
|
15692
|
-
console.log(
|
|
15689
|
+
console.log(chalk15.green(` \u2713 ${skill.name}`));
|
|
15693
15690
|
if (skill.allowedTools && skill.allowedTools.length > 0) {
|
|
15694
|
-
console.log(
|
|
15691
|
+
console.log(chalk15.gray(` Tools: ${skill.allowedTools.slice(0, 5).join(", ")}${skill.allowedTools.length > 5 ? "..." : ""}`));
|
|
15695
15692
|
}
|
|
15696
15693
|
}
|
|
15697
15694
|
}
|
|
15698
15695
|
if (result.skillsGenerated > 0) {
|
|
15699
15696
|
result.success = true;
|
|
15700
|
-
console.log(
|
|
15697
|
+
console.log(chalk15.green(`
|
|
15701
15698
|
\u2713 Generated ${result.skillsGenerated} skills in ${skillsDir}`));
|
|
15702
|
-
console.log(
|
|
15699
|
+
console.log(chalk15.gray(` Use "/skills" to view and "/skills use <name>" to activate`));
|
|
15703
15700
|
}
|
|
15704
15701
|
return result;
|
|
15705
15702
|
}
|
|
@@ -16776,8 +16773,8 @@ ${sel.text}
|
|
|
16776
16773
|
*/
|
|
16777
16774
|
async handleGetSkillsRegistry(requestId, params) {
|
|
16778
16775
|
try {
|
|
16779
|
-
const { CommunitySkillsCache } = await import("./CommunitySkillsCache-
|
|
16780
|
-
const { GitHubRegistryFetcher } = await import("./GitHubRegistryFetcher-
|
|
16776
|
+
const { CommunitySkillsCache } = await import("./CommunitySkillsCache-XPDVYU3K.js");
|
|
16777
|
+
const { GitHubRegistryFetcher } = await import("./GitHubRegistryFetcher-US2JJID4.js");
|
|
16781
16778
|
const cache = new CommunitySkillsCache();
|
|
16782
16779
|
const fetcher = new GitHubRegistryFetcher();
|
|
16783
16780
|
let registry;
|
|
@@ -16836,9 +16833,9 @@ ${sel.text}
|
|
|
16836
16833
|
};
|
|
16837
16834
|
}
|
|
16838
16835
|
const workspaceRoot = this.workspace;
|
|
16839
|
-
const { CommunitySkillsCache } = await import("./CommunitySkillsCache-
|
|
16840
|
-
const { GitHubRegistryFetcher } = await import("./GitHubRegistryFetcher-
|
|
16841
|
-
const { AUTOHAND_PATHS: AUTOHAND_PATHS2, PROJECT_DIR_NAME: PROJECT_DIR_NAME2 } = await import("./constants-
|
|
16836
|
+
const { CommunitySkillsCache } = await import("./CommunitySkillsCache-XPDVYU3K.js");
|
|
16837
|
+
const { GitHubRegistryFetcher } = await import("./GitHubRegistryFetcher-US2JJID4.js");
|
|
16838
|
+
const { AUTOHAND_PATHS: AUTOHAND_PATHS2, PROJECT_DIR_NAME: PROJECT_DIR_NAME2 } = await import("./constants-QYBEF3DB.js");
|
|
16842
16839
|
const path20 = await import("path");
|
|
16843
16840
|
const cache = new CommunitySkillsCache();
|
|
16844
16841
|
const fetcher = new GitHubRegistryFetcher();
|
|
@@ -17311,7 +17308,7 @@ async function handleSingleRequest(request, adapter) {
|
|
|
17311
17308
|
process.title = "autohand";
|
|
17312
17309
|
function getGitCommit() {
|
|
17313
17310
|
if (true) {
|
|
17314
|
-
return "
|
|
17311
|
+
return "f92e70a";
|
|
17315
17312
|
}
|
|
17316
17313
|
try {
|
|
17317
17314
|
return execSync3("git rev-parse --short HEAD", { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }).trim();
|
|
@@ -17415,11 +17412,11 @@ async function runCLI(options) {
|
|
|
17415
17412
|
const providerConfig = getProviderConfig(config, providerName);
|
|
17416
17413
|
if (!providerConfig) {
|
|
17417
17414
|
if (config.isNewConfig) {
|
|
17418
|
-
console.log(
|
|
17419
|
-
console.log(
|
|
17415
|
+
console.log(chalk16.cyan("\n\u2728 Welcome to Autohand!\n"));
|
|
17416
|
+
console.log(chalk16.gray(`Config created at: ${config.configPath}
|
|
17420
17417
|
`));
|
|
17421
17418
|
}
|
|
17422
|
-
console.log(
|
|
17419
|
+
console.log(chalk16.yellow(`No ${providerName} API key configured.
|
|
17423
17420
|
`));
|
|
17424
17421
|
let apiKey;
|
|
17425
17422
|
try {
|
|
@@ -17437,7 +17434,7 @@ async function runCLI(options) {
|
|
|
17437
17434
|
apiKey = result.apiKey;
|
|
17438
17435
|
} catch (error) {
|
|
17439
17436
|
if (error?.code === "ERR_USE_AFTER_CLOSE" || error?.message?.includes("cancelled")) {
|
|
17440
|
-
console.log(
|
|
17437
|
+
console.log(chalk16.gray("\nSetup cancelled."));
|
|
17441
17438
|
process.exit(0);
|
|
17442
17439
|
}
|
|
17443
17440
|
throw error;
|
|
@@ -17457,7 +17454,7 @@ async function runCLI(options) {
|
|
|
17457
17454
|
};
|
|
17458
17455
|
}
|
|
17459
17456
|
await saveConfig(config);
|
|
17460
|
-
console.log(
|
|
17457
|
+
console.log(chalk16.green("\u2713 API key saved to config\n"));
|
|
17461
17458
|
}
|
|
17462
17459
|
const workspaceRoot = resolveWorkspaceRoot(config, options.path);
|
|
17463
17460
|
const safetyCheck = checkWorkspaceSafety(workspaceRoot);
|
|
@@ -17479,7 +17476,7 @@ async function runCLI(options) {
|
|
|
17479
17476
|
const checkResults = await runStartupChecks(workspaceRoot);
|
|
17480
17477
|
printStartupCheckResults(checkResults);
|
|
17481
17478
|
if (!checkResults.allRequiredMet) {
|
|
17482
|
-
console.log(
|
|
17479
|
+
console.log(chalk16.yellow("Continuing anyway, but some features may not work correctly.\n"));
|
|
17483
17480
|
}
|
|
17484
17481
|
if (options.model) {
|
|
17485
17482
|
const providerName2 = config.provider ?? "openrouter";
|
|
@@ -17494,10 +17491,10 @@ async function runCLI(options) {
|
|
|
17494
17491
|
const llmProvider = ProviderFactory.create(config);
|
|
17495
17492
|
const files = new FileActionManager(workspaceRoot);
|
|
17496
17493
|
if (options.autoSkill) {
|
|
17497
|
-
console.log(
|
|
17494
|
+
console.log(chalk16.cyan("\nAuto-generating skills for this project...\n"));
|
|
17498
17495
|
const result = await runAutoSkillGeneration(workspaceRoot, llmProvider);
|
|
17499
17496
|
if (!result.success) {
|
|
17500
|
-
console.log(
|
|
17497
|
+
console.log(chalk16.yellow(result.error || "Failed to generate skills"));
|
|
17501
17498
|
}
|
|
17502
17499
|
return;
|
|
17503
17500
|
}
|
|
@@ -17511,7 +17508,7 @@ async function runCLI(options) {
|
|
|
17511
17508
|
}
|
|
17512
17509
|
} catch (error) {
|
|
17513
17510
|
if (error instanceof Error) {
|
|
17514
|
-
console.error(
|
|
17511
|
+
console.error(chalk16.red(error.message));
|
|
17515
17512
|
} else {
|
|
17516
17513
|
console.error(error);
|
|
17517
17514
|
}
|
|
@@ -17523,7 +17520,7 @@ function printBanner() {
|
|
|
17523
17520
|
return;
|
|
17524
17521
|
}
|
|
17525
17522
|
if (process.stdout.isTTY) {
|
|
17526
|
-
console.log(
|
|
17523
|
+
console.log(chalk16.gray(ASCII_FRIEND));
|
|
17527
17524
|
} else {
|
|
17528
17525
|
console.log("autohand");
|
|
17529
17526
|
}
|
|
@@ -17541,28 +17538,28 @@ function printWelcome(runtime, authUser, versionCheck) {
|
|
|
17541
17538
|
}
|
|
17542
17539
|
})();
|
|
17543
17540
|
const dir = runtime.workspaceRoot;
|
|
17544
|
-
let versionLine = `${
|
|
17541
|
+
let versionLine = `${chalk16.bold("> Autohand")} v${getVersionString()}`;
|
|
17545
17542
|
if (versionCheck) {
|
|
17546
17543
|
if (versionCheck.isUpToDate) {
|
|
17547
|
-
versionLine +=
|
|
17544
|
+
versionLine += chalk16.green(" \u2713 Up to date");
|
|
17548
17545
|
} else if (versionCheck.updateAvailable && versionCheck.latestVersion) {
|
|
17549
|
-
versionLine +=
|
|
17546
|
+
versionLine += chalk16.yellow(` \u2B06 Update available: v${versionCheck.latestVersion}`);
|
|
17550
17547
|
}
|
|
17551
17548
|
}
|
|
17552
17549
|
console.log(versionLine);
|
|
17553
17550
|
if (versionCheck?.updateAvailable) {
|
|
17554
|
-
console.log(
|
|
17551
|
+
console.log(chalk16.gray(" \u21B3 Run: ") + chalk16.cyan("curl -fsSL https://autohand.ai/install.sh | sh"));
|
|
17555
17552
|
}
|
|
17556
17553
|
if (authUser) {
|
|
17557
|
-
console.log(
|
|
17554
|
+
console.log(chalk16.green(`Welcome back, ${authUser.name || authUser.email}!`));
|
|
17558
17555
|
}
|
|
17559
|
-
console.log(`${
|
|
17556
|
+
console.log(`${chalk16.gray("model:")} ${chalk16.cyan(model)} ${chalk16.gray("| directory:")} ${chalk16.cyan(dir)}`);
|
|
17560
17557
|
console.log();
|
|
17561
|
-
console.log(
|
|
17562
|
-
console.log(
|
|
17563
|
-
console.log(
|
|
17558
|
+
console.log(chalk16.gray("To get started, describe a task or try one of these commands:"));
|
|
17559
|
+
console.log(chalk16.cyan("/init ") + chalk16.gray("create an AGENTS.md file with instructions for Autohand"));
|
|
17560
|
+
console.log(chalk16.cyan("/help ") + chalk16.gray("review my current changes and find issues"));
|
|
17564
17561
|
if (!authUser) {
|
|
17565
|
-
console.log(
|
|
17562
|
+
console.log(chalk16.cyan("/login ") + chalk16.gray("sign in to your Autohand account"));
|
|
17566
17563
|
}
|
|
17567
17564
|
console.log();
|
|
17568
17565
|
}
|
|
@@ -17574,9 +17571,9 @@ async function runSkillInstall(opts) {
|
|
|
17574
17571
|
printDangerousWorkspaceWarning(workspaceRoot, safetyCheck);
|
|
17575
17572
|
process.exit(1);
|
|
17576
17573
|
}
|
|
17577
|
-
const { SkillsRegistry: SkillsRegistry2 } = await import("./SkillsRegistry-
|
|
17578
|
-
const { AUTOHAND_PATHS: AUTOHAND_PATHS2 } = await import("./constants-
|
|
17579
|
-
const { skillsInstall } = await import("./skills-install-
|
|
17574
|
+
const { SkillsRegistry: SkillsRegistry2 } = await import("./SkillsRegistry-7NICF6FY.js");
|
|
17575
|
+
const { AUTOHAND_PATHS: AUTOHAND_PATHS2 } = await import("./constants-QYBEF3DB.js");
|
|
17576
|
+
const { skillsInstall } = await import("./skills-install-RMPXN6RK.js");
|
|
17580
17577
|
const skillsRegistry = new SkillsRegistry2(AUTOHAND_PATHS2.skills);
|
|
17581
17578
|
await skillsRegistry.initialize();
|
|
17582
17579
|
await skillsRegistry.setWorkspace(workspaceRoot);
|
|
@@ -17594,8 +17591,8 @@ async function displayPermissions(opts) {
|
|
|
17594
17591
|
printDangerousWorkspaceWarning(workspaceRoot, safetyCheck);
|
|
17595
17592
|
process.exit(1);
|
|
17596
17593
|
}
|
|
17597
|
-
const { PermissionManager: PermissionManager2 } = await import("./PermissionManager-
|
|
17598
|
-
const { loadLocalProjectSettings } = await import("./localProjectPermissions-
|
|
17594
|
+
const { PermissionManager: PermissionManager2 } = await import("./PermissionManager-YFZI4ZZ6.js");
|
|
17595
|
+
const { loadLocalProjectSettings } = await import("./localProjectPermissions-DURCNDZG.js");
|
|
17599
17596
|
const localSettings = await loadLocalProjectSettings(workspaceRoot);
|
|
17600
17597
|
const mergedSettings = {
|
|
17601
17598
|
mode: localSettings?.permissions?.mode ?? config.permissions?.mode ?? "interactive",
|
|
@@ -17617,48 +17614,48 @@ async function displayPermissions(opts) {
|
|
|
17617
17614
|
const blacklist = manager.getBlacklist();
|
|
17618
17615
|
const settings = manager.getSettings();
|
|
17619
17616
|
console.log();
|
|
17620
|
-
console.log(
|
|
17621
|
-
console.log(
|
|
17617
|
+
console.log(chalk16.bold.cyan("Autohand Permissions"));
|
|
17618
|
+
console.log(chalk16.gray("\u2500".repeat(60)));
|
|
17622
17619
|
console.log();
|
|
17623
|
-
console.log(
|
|
17620
|
+
console.log(chalk16.bold("Mode:"), chalk16.cyan(settings.mode || "interactive"));
|
|
17624
17621
|
console.log();
|
|
17625
|
-
console.log(
|
|
17626
|
-
console.log(
|
|
17622
|
+
console.log(chalk16.bold("Workspace:"), chalk16.gray(workspaceRoot));
|
|
17623
|
+
console.log(chalk16.bold("Config:"), chalk16.gray(config.configPath));
|
|
17627
17624
|
console.log();
|
|
17628
|
-
console.log(
|
|
17625
|
+
console.log(chalk16.bold.green("Approved (Whitelist)"));
|
|
17629
17626
|
if (whitelist.length === 0) {
|
|
17630
|
-
console.log(
|
|
17627
|
+
console.log(chalk16.gray(" No approved patterns"));
|
|
17631
17628
|
} else {
|
|
17632
17629
|
whitelist.forEach((pattern, index) => {
|
|
17633
|
-
console.log(
|
|
17630
|
+
console.log(chalk16.green(` ${index + 1}. ${pattern}`));
|
|
17634
17631
|
});
|
|
17635
17632
|
}
|
|
17636
17633
|
console.log();
|
|
17637
|
-
console.log(
|
|
17634
|
+
console.log(chalk16.bold.red("Denied (Blacklist)"));
|
|
17638
17635
|
if (blacklist.length === 0) {
|
|
17639
|
-
console.log(
|
|
17636
|
+
console.log(chalk16.gray(" No denied patterns"));
|
|
17640
17637
|
} else {
|
|
17641
17638
|
blacklist.forEach((pattern, index) => {
|
|
17642
|
-
console.log(
|
|
17639
|
+
console.log(chalk16.red(` ${index + 1}. ${pattern}`));
|
|
17643
17640
|
});
|
|
17644
17641
|
}
|
|
17645
17642
|
console.log();
|
|
17646
|
-
console.log(
|
|
17647
|
-
console.log(
|
|
17643
|
+
console.log(chalk16.gray("\u2500".repeat(60)));
|
|
17644
|
+
console.log(chalk16.bold("Summary:"), `${whitelist.length} approved, ${blacklist.length} denied`);
|
|
17648
17645
|
console.log();
|
|
17649
|
-
console.log(
|
|
17650
|
-
console.log(
|
|
17651
|
-
console.log(
|
|
17646
|
+
console.log(chalk16.gray("Use /permissions in interactive mode to manage permissions."));
|
|
17647
|
+
console.log(chalk16.gray("Use --unrestricted to skip all approval prompts."));
|
|
17648
|
+
console.log(chalk16.gray("Use --restricted to deny all dangerous operations."));
|
|
17652
17649
|
console.log();
|
|
17653
17650
|
}
|
|
17654
17651
|
async function runPatchMode(opts) {
|
|
17655
17652
|
if (!opts.prompt) {
|
|
17656
|
-
console.error(
|
|
17657
|
-
console.error(
|
|
17653
|
+
console.error(chalk16.red("Error: --patch requires --prompt to specify the instruction"));
|
|
17654
|
+
console.error(chalk16.gray('Usage: autohand --prompt "your instruction" --patch'));
|
|
17658
17655
|
process.exit(1);
|
|
17659
17656
|
}
|
|
17660
17657
|
const fs21 = await import("fs-extra");
|
|
17661
|
-
const { generateUnifiedPatch, formatChangeSummary } = await import("./patch-
|
|
17658
|
+
const { generateUnifiedPatch, formatChangeSummary } = await import("./patch-BAAQIYSW.js");
|
|
17662
17659
|
const config = await loadConfig(opts.config);
|
|
17663
17660
|
const workspaceRoot = resolveWorkspaceRoot(config, opts.path);
|
|
17664
17661
|
const safetyCheck = checkWorkspaceSafety(workspaceRoot);
|
|
@@ -17688,23 +17685,23 @@ async function runPatchMode(opts) {
|
|
|
17688
17685
|
workspaceRoot,
|
|
17689
17686
|
options: patchOptions
|
|
17690
17687
|
};
|
|
17691
|
-
console.error(
|
|
17688
|
+
console.error(chalk16.cyan("Patch Mode: Changes will be captured without modifying files\n"));
|
|
17692
17689
|
try {
|
|
17693
17690
|
const agent = new AutohandAgent(llmProvider, files, runtime);
|
|
17694
17691
|
await agent.runCommandMode(opts.prompt);
|
|
17695
17692
|
const changes = files.getPendingChanges();
|
|
17696
17693
|
if (changes.length === 0) {
|
|
17697
|
-
console.error(
|
|
17694
|
+
console.error(chalk16.yellow("\nNo changes were made."));
|
|
17698
17695
|
process.exit(0);
|
|
17699
17696
|
}
|
|
17700
17697
|
const patch = generateUnifiedPatch(changes);
|
|
17701
|
-
console.error(
|
|
17698
|
+
console.error(chalk16.green(`
|
|
17702
17699
|
\u2713 ${formatChangeSummary(changes)}`));
|
|
17703
17700
|
if (opts.output) {
|
|
17704
17701
|
await fs21.default.ensureDir((await import("path")).dirname(opts.output));
|
|
17705
17702
|
await fs21.default.writeFile(opts.output, patch);
|
|
17706
|
-
console.error(
|
|
17707
|
-
console.error(
|
|
17703
|
+
console.error(chalk16.green(`\u2713 Patch written to ${opts.output}`));
|
|
17704
|
+
console.error(chalk16.gray("\nTo apply: git apply " + opts.output));
|
|
17708
17705
|
} else {
|
|
17709
17706
|
process.stdout.write(patch);
|
|
17710
17707
|
}
|
|
@@ -17712,14 +17709,14 @@ async function runPatchMode(opts) {
|
|
|
17712
17709
|
process.exit(0);
|
|
17713
17710
|
} catch (error) {
|
|
17714
17711
|
files.exitPreviewMode();
|
|
17715
|
-
console.error(
|
|
17712
|
+
console.error(chalk16.red(`
|
|
17716
17713
|
Error: ${error.message}`));
|
|
17717
17714
|
process.exit(1);
|
|
17718
17715
|
}
|
|
17719
17716
|
}
|
|
17720
17717
|
async function runAutoMode(opts) {
|
|
17721
17718
|
if (!opts.autoMode) {
|
|
17722
|
-
console.error(
|
|
17719
|
+
console.error(chalk16.red("Error: --auto-mode requires a task prompt"));
|
|
17723
17720
|
process.exit(1);
|
|
17724
17721
|
}
|
|
17725
17722
|
const config = await loadConfig(opts.config);
|
|
@@ -17739,10 +17736,10 @@ async function runAutoMode(opts) {
|
|
|
17739
17736
|
config.agent = config.agent ?? {};
|
|
17740
17737
|
config.agent.debug = true;
|
|
17741
17738
|
}
|
|
17742
|
-
const { AutomodeManager, getAutomodeOptions } = await import("./AutomodeManager-
|
|
17743
|
-
const { HookManager: HookManager2 } = await import("./HookManager-
|
|
17744
|
-
const { SessionManager: SessionManager2 } = await import("./SessionManager-
|
|
17745
|
-
const { MemoryManager: MemoryManager2 } = await import("./MemoryManager-
|
|
17739
|
+
const { AutomodeManager, getAutomodeOptions } = await import("./AutomodeManager-WIMHLG4W.js");
|
|
17740
|
+
const { HookManager: HookManager2 } = await import("./HookManager-VIX56KFU.js");
|
|
17741
|
+
const { SessionManager: SessionManager2 } = await import("./SessionManager-IMW2HGR3.js");
|
|
17742
|
+
const { MemoryManager: MemoryManager2 } = await import("./MemoryManager-UVHILGV5.js");
|
|
17746
17743
|
const readline5 = await import("readline");
|
|
17747
17744
|
const llmProvider = ProviderFactory.create(config);
|
|
17748
17745
|
const files = new FileActionManager(workspaceRoot);
|
|
@@ -17761,26 +17758,26 @@ async function runAutoMode(opts) {
|
|
|
17761
17758
|
const automodeManager = new AutomodeManager(config, workspaceRoot, hookManager, session, memoryManager);
|
|
17762
17759
|
const automodeOptions = getAutomodeOptions(opts, config);
|
|
17763
17760
|
if (!automodeOptions) {
|
|
17764
|
-
console.error(
|
|
17761
|
+
console.error(chalk16.red("Error: Failed to parse auto-mode options"));
|
|
17765
17762
|
process.exit(1);
|
|
17766
17763
|
}
|
|
17767
17764
|
printBanner();
|
|
17768
|
-
console.log(
|
|
17769
|
-
console.log(
|
|
17770
|
-
console.log(
|
|
17771
|
-
console.log(
|
|
17772
|
-
console.log(
|
|
17765
|
+
console.log(chalk16.bold.cyan("\n\u{1F504} Auto-Mode: Autonomous Development Loop\n"));
|
|
17766
|
+
console.log(chalk16.gray("Task:"), chalk16.white(opts.autoMode));
|
|
17767
|
+
console.log(chalk16.gray("Max Iterations:"), chalk16.cyan(automodeOptions.maxIterations ?? 50));
|
|
17768
|
+
console.log(chalk16.gray("Completion Marker:"), chalk16.cyan(automodeOptions.completionPromise ?? "DONE"));
|
|
17769
|
+
console.log(chalk16.gray("Worktree Isolation:"), chalk16.cyan(automodeOptions.useWorktree !== false ? "enabled" : "disabled"));
|
|
17773
17770
|
console.log();
|
|
17774
17771
|
if (process.stdin.isTTY) {
|
|
17775
17772
|
readline5.emitKeypressEvents(process.stdin);
|
|
17776
17773
|
process.stdin.setRawMode(true);
|
|
17777
17774
|
process.stdin.on("keypress", (_str, key) => {
|
|
17778
17775
|
if (key && key.name === "escape") {
|
|
17779
|
-
console.log(
|
|
17776
|
+
console.log(chalk16.yellow("\n\u26A0\uFE0F Cancelling auto-mode..."));
|
|
17780
17777
|
automodeManager.cancel("user_escape");
|
|
17781
17778
|
}
|
|
17782
17779
|
if (key && key.ctrl && key.name === "c") {
|
|
17783
|
-
console.log(
|
|
17780
|
+
console.log(chalk16.yellow("\n\u26A0\uFE0F Cancelling auto-mode..."));
|
|
17784
17781
|
automodeManager.cancel("user_escape");
|
|
17785
17782
|
if (process.stdin.isTTY) {
|
|
17786
17783
|
process.stdin.setRawMode(false);
|
|
@@ -17812,7 +17809,7 @@ async function runAutoMode(opts) {
|
|
|
17812
17809
|
} catch (err) {
|
|
17813
17810
|
success = false;
|
|
17814
17811
|
error = err.message;
|
|
17815
|
-
console.error(
|
|
17812
|
+
console.error(chalk16.red(`Iteration error: ${error}`));
|
|
17816
17813
|
}
|
|
17817
17814
|
return {
|
|
17818
17815
|
success,
|
|
@@ -17830,7 +17827,7 @@ async function runAutoMode(opts) {
|
|
|
17830
17827
|
session.metadata.automodeIterations = finalState.currentIteration;
|
|
17831
17828
|
const statusText = finalState.status === "completed" ? "completed" : `ended (${finalState.status})`;
|
|
17832
17829
|
await sessionManager.closeSession(`Auto-mode ${statusText} after ${finalState.currentIteration} iterations: ${opts.autoMode?.slice(0, 50)}...`);
|
|
17833
|
-
console.log(
|
|
17830
|
+
console.log(chalk16.gray(`
|
|
17834
17831
|
\u{1F4C1} Session saved: ${session.metadata.sessionId}`));
|
|
17835
17832
|
}
|
|
17836
17833
|
process.exit(finalState?.status === "completed" ? 0 : 1);
|
|
@@ -17839,7 +17836,7 @@ async function runAutoMode(opts) {
|
|
|
17839
17836
|
process.stdin.setRawMode(false);
|
|
17840
17837
|
}
|
|
17841
17838
|
await sessionManager.closeSession(`Auto-mode failed: ${error.message}`);
|
|
17842
|
-
console.error(
|
|
17839
|
+
console.error(chalk16.red(`
|
|
17843
17840
|
Auto-mode error: ${error.message}`));
|
|
17844
17841
|
process.exit(1);
|
|
17845
17842
|
}
|