adhdev 0.6.18 → 0.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +251 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +123 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4990,6 +4990,15 @@ var init_handler = __esm({
|
|
|
4990
4990
|
return handleExtensionScript(this, args, "listModes");
|
|
4991
4991
|
case "set_extension_mode":
|
|
4992
4992
|
return handleExtensionScript(this, args, "setMode");
|
|
4993
|
+
// ─── Provider Auto-Fix / Clone (DevServer proxy) ──────────
|
|
4994
|
+
case "provider_auto_fix":
|
|
4995
|
+
return this.proxyDevServerPost(args, "auto-implement");
|
|
4996
|
+
case "provider_auto_fix_cancel":
|
|
4997
|
+
return this.proxyDevServerPost(args, "auto-implement/cancel");
|
|
4998
|
+
case "provider_auto_fix_status":
|
|
4999
|
+
return this.proxyDevServerGet(args, "auto-implement/status");
|
|
5000
|
+
case "provider_clone":
|
|
5001
|
+
return this.proxyDevServerScaffold(args);
|
|
4993
5002
|
default:
|
|
4994
5003
|
return { success: false, error: `Unknown command: ${cmd}` };
|
|
4995
5004
|
}
|
|
@@ -5017,6 +5026,95 @@ var init_handler = __esm({
|
|
|
5017
5026
|
}
|
|
5018
5027
|
return { success: false, error: "ProviderLoader not initialized" };
|
|
5019
5028
|
}
|
|
5029
|
+
// ─── DevServer HTTP proxy helpers ─────────────────
|
|
5030
|
+
// These bridge WS commands to the DevServer REST API (localhost:19280)
|
|
5031
|
+
async proxyDevServerPost(args, endpoint) {
|
|
5032
|
+
const { providerType, ...body } = args || {};
|
|
5033
|
+
if (!providerType) return { success: false, error: "providerType required" };
|
|
5034
|
+
try {
|
|
5035
|
+
const http3 = await import("http");
|
|
5036
|
+
const postData = JSON.stringify(body);
|
|
5037
|
+
const result = await new Promise((resolve8, reject) => {
|
|
5038
|
+
const req = http3.request({
|
|
5039
|
+
hostname: "127.0.0.1",
|
|
5040
|
+
port: 19280,
|
|
5041
|
+
path: `/api/providers/${providerType}/${endpoint}`,
|
|
5042
|
+
method: "POST",
|
|
5043
|
+
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
|
|
5044
|
+
}, (res) => {
|
|
5045
|
+
let data = "";
|
|
5046
|
+
res.on("data", (chunk) => data += chunk);
|
|
5047
|
+
res.on("end", () => {
|
|
5048
|
+
try {
|
|
5049
|
+
resolve8(JSON.parse(data));
|
|
5050
|
+
} catch {
|
|
5051
|
+
resolve8({ raw: data });
|
|
5052
|
+
}
|
|
5053
|
+
});
|
|
5054
|
+
});
|
|
5055
|
+
req.on("error", reject);
|
|
5056
|
+
req.write(postData);
|
|
5057
|
+
req.end();
|
|
5058
|
+
});
|
|
5059
|
+
return { success: true, ...result };
|
|
5060
|
+
} catch (e) {
|
|
5061
|
+
return { success: false, error: `DevServer unreachable: ${e.message}. Start daemon with --dev flag.` };
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
async proxyDevServerGet(args, endpoint) {
|
|
5065
|
+
const { providerType } = args || {};
|
|
5066
|
+
if (!providerType) return { success: false, error: "providerType required" };
|
|
5067
|
+
try {
|
|
5068
|
+
const http3 = await import("http");
|
|
5069
|
+
const result = await new Promise((resolve8, reject) => {
|
|
5070
|
+
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
5071
|
+
let data = "";
|
|
5072
|
+
res.on("data", (chunk) => data += chunk);
|
|
5073
|
+
res.on("end", () => {
|
|
5074
|
+
try {
|
|
5075
|
+
resolve8(JSON.parse(data));
|
|
5076
|
+
} catch {
|
|
5077
|
+
resolve8({ raw: data });
|
|
5078
|
+
}
|
|
5079
|
+
});
|
|
5080
|
+
}).on("error", reject);
|
|
5081
|
+
});
|
|
5082
|
+
return { success: true, ...result };
|
|
5083
|
+
} catch (e) {
|
|
5084
|
+
return { success: false, error: `DevServer unreachable: ${e.message}. Start daemon with --dev flag.` };
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
async proxyDevServerScaffold(args) {
|
|
5088
|
+
try {
|
|
5089
|
+
const http3 = await import("http");
|
|
5090
|
+
const postData = JSON.stringify(args || {});
|
|
5091
|
+
const result = await new Promise((resolve8, reject) => {
|
|
5092
|
+
const req = http3.request({
|
|
5093
|
+
hostname: "127.0.0.1",
|
|
5094
|
+
port: 19280,
|
|
5095
|
+
path: "/api/scaffold",
|
|
5096
|
+
method: "POST",
|
|
5097
|
+
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
|
|
5098
|
+
}, (res) => {
|
|
5099
|
+
let data = "";
|
|
5100
|
+
res.on("data", (chunk) => data += chunk);
|
|
5101
|
+
res.on("end", () => {
|
|
5102
|
+
try {
|
|
5103
|
+
resolve8(JSON.parse(data));
|
|
5104
|
+
} catch {
|
|
5105
|
+
resolve8({ raw: data });
|
|
5106
|
+
}
|
|
5107
|
+
});
|
|
5108
|
+
});
|
|
5109
|
+
req.on("error", reject);
|
|
5110
|
+
req.write(postData);
|
|
5111
|
+
req.end();
|
|
5112
|
+
});
|
|
5113
|
+
return { success: true, ...result };
|
|
5114
|
+
} catch (e) {
|
|
5115
|
+
return { success: false, error: `DevServer unreachable: ${e.message}. Start daemon with --dev flag.` };
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5020
5118
|
};
|
|
5021
5119
|
}
|
|
5022
5120
|
});
|
|
@@ -26896,7 +26994,7 @@ var init_dev_server = __esm({
|
|
|
26896
26994
|
this.json(res, 400, { error: `Script '${scriptName}' not found in provider '${type}'`, available: provider.scripts ? Object.keys(provider.scripts) : [] });
|
|
26897
26995
|
return;
|
|
26898
26996
|
}
|
|
26899
|
-
const cdp = this.getCdp(scriptIdeType);
|
|
26997
|
+
const cdp = this.getCdp(scriptIdeType || type);
|
|
26900
26998
|
if (!cdp) {
|
|
26901
26999
|
this.json(res, 503, { error: "No CDP connection available" });
|
|
26902
27000
|
return;
|
|
@@ -28411,7 +28509,7 @@ var init_dev_server = __esm({
|
|
|
28411
28509
|
// ─── Phase 2: Auto-Implement Backend ───
|
|
28412
28510
|
async handleAutoImplement(type, req, res) {
|
|
28413
28511
|
const body = await this.readBody(req);
|
|
28414
|
-
const { agent = "claude-cli", functions, reference = "antigravity", model } = body;
|
|
28512
|
+
const { agent = "claude-cli", functions, reference = "antigravity", model, comment } = body;
|
|
28415
28513
|
if (!functions || !Array.isArray(functions) || functions.length === 0) {
|
|
28416
28514
|
this.json(res, 400, { error: 'functions[] is required (e.g. ["readChat", "sendMessage"])' });
|
|
28417
28515
|
return;
|
|
@@ -28460,7 +28558,7 @@ var init_dev_server = __esm({
|
|
|
28460
28558
|
}
|
|
28461
28559
|
}
|
|
28462
28560
|
}
|
|
28463
|
-
const prompt = this.buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts);
|
|
28561
|
+
const prompt = this.buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts, comment);
|
|
28464
28562
|
const tmpDir = path12.join(os14.tmpdir(), "adhdev-autoimpl");
|
|
28465
28563
|
if (!fs9.existsSync(tmpDir)) fs9.mkdirSync(tmpDir, { recursive: true });
|
|
28466
28564
|
const promptFile = path12.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
|
|
@@ -28615,9 +28713,11 @@ var init_dev_server = __esm({
|
|
|
28615
28713
|
const baseArgs = [...spawn3.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
28616
28714
|
let shellCmd;
|
|
28617
28715
|
if (command === "claude") {
|
|
28618
|
-
const args = [...baseArgs, "--
|
|
28716
|
+
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
28717
|
+
if (model) args.push("--model", model);
|
|
28619
28718
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28620
|
-
|
|
28719
|
+
const metaPrompt = `Read the file at ${promptFile} and follow ALL the instructions. Implement the specific function requested, then test it via CDP curl targeting 127.0.0.1:19280, wait for confirmation of success, and then close. DO NOT start working on other features not listed in the prompt constraint.`;
|
|
28720
|
+
shellCmd = `${command} ${escapedArgs} -p "${metaPrompt}"`;
|
|
28621
28721
|
} else if (command === "gemini") {
|
|
28622
28722
|
const args = [...baseArgs, "-y", "-s", "false"];
|
|
28623
28723
|
if (model) args.push("-m", model);
|
|
@@ -28633,7 +28733,7 @@ var init_dev_server = __esm({
|
|
|
28633
28733
|
}
|
|
28634
28734
|
if (model) args.push("--model", model);
|
|
28635
28735
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28636
|
-
const metaPrompt = `Read the file at ${promptFile} and follow ALL
|
|
28736
|
+
const metaPrompt = `Read the file at ${promptFile} and follow ALL instructions recursively. You have full authority to implement ALL required script files, update provider.json configurations based on the reference patterns, and independently test them against 127.0.0.1:19280 via CDP CURL. Upon complete validation of ALL assigned files, print exactly "AUTO_IMPLEMENT_FINISHED" to gracefully close the pipeline. DO NOT WAIT FOR APPROVAL, execute completely autonomously.`;
|
|
28637
28737
|
shellCmd = `${command} ${escapedArgs} "${metaPrompt}"`;
|
|
28638
28738
|
} else {
|
|
28639
28739
|
const escapedArgs = baseArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
@@ -28641,6 +28741,7 @@ var init_dev_server = __esm({
|
|
|
28641
28741
|
}
|
|
28642
28742
|
this.sendAutoImplSSE({ event: "progress", data: { function: "_init", status: "spawning", message: `\uC5D0\uC774\uC804\uD2B8 \uC2E4\uD589 \uC911: ${shellCmd.substring(0, 200)}... (prompt: ${prompt.length} chars)` } });
|
|
28643
28743
|
this.autoImplStatus = { running: true, type, progress: [] };
|
|
28744
|
+
const spawnedAt = Date.now();
|
|
28644
28745
|
let child;
|
|
28645
28746
|
let isPty = false;
|
|
28646
28747
|
const { spawn: spawnFn } = await import("child_process");
|
|
@@ -28693,8 +28794,9 @@ var init_dev_server = __esm({
|
|
|
28693
28794
|
const checkAutoApproval = (chunk, writeFn) => {
|
|
28694
28795
|
const cleanData = chunk.replace(/\x1B\[\d*[A-HJKSTfG]/g, " ").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B\][^\x1B]*\x1B\\/g, "").replace(/ +/g, " ");
|
|
28695
28796
|
approvalBuffer = (approvalBuffer + cleanData).slice(-1500);
|
|
28696
|
-
|
|
28697
|
-
|
|
28797
|
+
const elapsed = Date.now() - spawnedAt;
|
|
28798
|
+
if (elapsed > 15e3 && approvalBuffer.includes("AUTO_IMPLEMENT_FINISHED")) {
|
|
28799
|
+
this.log(`Agent finished task after ${Math.round(elapsed / 1e3)}s. Terminating interactive CLI session to unblock pipeline.`);
|
|
28698
28800
|
this.sendAutoImplSSE({ event: "output", data: { chunk: `
|
|
28699
28801
|
[\u{1F916} ADHDev Pipeline] Completion token detected. Proceeding...
|
|
28700
28802
|
`, stream: "stdout" } });
|
|
@@ -28796,7 +28898,7 @@ var init_dev_server = __esm({
|
|
|
28796
28898
|
this.json(res, 500, { error: `Auto-implement failed: ${e.message}` });
|
|
28797
28899
|
}
|
|
28798
28900
|
}
|
|
28799
|
-
buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts) {
|
|
28901
|
+
buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts, userComment) {
|
|
28800
28902
|
const lines = [];
|
|
28801
28903
|
lines.push("You are implementing browser automation scripts for an IDE provider.");
|
|
28802
28904
|
lines.push("Be concise. Do NOT explain your reasoning. Just edit files directly.");
|
|
@@ -28912,6 +29014,10 @@ var init_dev_server = __esm({
|
|
|
28912
29014
|
lines.push("1. Edit the script files to implement working code");
|
|
28913
29015
|
lines.push("2. After editing, TEST each function using the DevConsole API (see below)");
|
|
28914
29016
|
lines.push("3. If a test fails, fix the implementation and re-test");
|
|
29017
|
+
lines.push("4. **IMPORTANT VERIFICATION LOGIC**: When verifying your implementation, beware of state contamination! You MUST perform strict Integration Testing:");
|
|
29018
|
+
lines.push(" - `openPanel`: Toggle buttons are usually located in the top header, sidebar, or activity bar. Prefer finding and clicking these native UI buttons over extreme CSS injection hacks if possible.");
|
|
29019
|
+
lines.push(" - `listSessions`: If sessions are unmounted when the panel is closed, try to explicitly interact with the UI to open the history/sessions view (e.g., clicking a history icon usually found near the chat header) BEFORE scraping.");
|
|
29020
|
+
lines.push(" - `switchSession`: Prove your switch was successful by subsequently calling `readChat` and explicitly checking that the chat context has actually changed.");
|
|
28915
29021
|
lines.push("");
|
|
28916
29022
|
lines.push("## YOU MUST EXPLORE THE DOM YOURSELF!");
|
|
28917
29023
|
lines.push("I have NOT provided you with the DOM snapshot. You MUST use your command-line tools to discover the IDE structure dynamically!");
|
|
@@ -28946,6 +29052,13 @@ var init_dev_server = __esm({
|
|
|
28946
29052
|
lines.push("3. Use CDP evaluate to deeply inspect the DOM structure of the newly generated tables, code blocks, thought blocks, and tool calls.");
|
|
28947
29053
|
lines.push("4. Ensure `readChat` extracts `content` with precise markdown formatting (especially for tables/code) and assigns correct `kind` tags (`thought`, `tool`, `terminal`).");
|
|
28948
29054
|
lines.push("");
|
|
29055
|
+
if (userComment) {
|
|
29056
|
+
lines.push("## \u26A0\uFE0F User Instructions (HIGH PRIORITY)");
|
|
29057
|
+
lines.push("The user has provided the following additional instructions. Follow them strictly:");
|
|
29058
|
+
lines.push("");
|
|
29059
|
+
lines.push(userComment);
|
|
29060
|
+
lines.push("");
|
|
29061
|
+
}
|
|
28949
29062
|
lines.push("Start NOW. Do not ask for permission. Explore the DOM -> Code -> Test.");
|
|
28950
29063
|
return lines.join("\n");
|
|
28951
29064
|
}
|
|
@@ -31014,7 +31127,7 @@ var init_adhdev_daemon = __esm({
|
|
|
31014
31127
|
fs11 = __toESM(require("fs"));
|
|
31015
31128
|
path14 = __toESM(require("path"));
|
|
31016
31129
|
import_chalk2 = __toESM(require("chalk"));
|
|
31017
|
-
pkgVersion = "0.6.
|
|
31130
|
+
pkgVersion = "0.6.21";
|
|
31018
31131
|
if (pkgVersion === "unknown") {
|
|
31019
31132
|
try {
|
|
31020
31133
|
const possiblePaths = [
|
|
@@ -32613,17 +32726,108 @@ function registerProviderCommands(program2) {
|
|
|
32613
32726
|
process.exit(1);
|
|
32614
32727
|
}
|
|
32615
32728
|
});
|
|
32616
|
-
provider.command("fix
|
|
32729
|
+
provider.command("fix [type] [scripts...]").description("Auto-implement provider scripts using AI reading the target IDE DOM").option("-a, --agent <agent>", "AI agent to use (e.g. claude-cli, gemini-cli, codex-cli, or any ACP provider like cline-acp)", "codex-cli").option("-m, --model <model>", "Model override (e.g. claude-sonnet-3.5, gemini-2.0-pro)").option("-r, --reference <ref>", "Reference provider to learn from", "antigravity").option("-c, --comment <text>", 'Additional instructions for the AI agent (e.g. "focus on shadow DOM handling")').action(async (typeArg, scripts, options) => {
|
|
32617
32730
|
try {
|
|
32618
32731
|
const http3 = await import("http");
|
|
32619
|
-
const
|
|
32732
|
+
const inquirer2 = (await import("inquirer")).default;
|
|
32733
|
+
const { ProviderLoader: ProviderLoader2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
32734
|
+
const loader = new ProviderLoader2();
|
|
32735
|
+
loader.loadAll();
|
|
32736
|
+
const allProviders = loader.getAll();
|
|
32737
|
+
const osMod = await import("os");
|
|
32738
|
+
const pathMod = await import("path");
|
|
32739
|
+
const fsMod = await import("fs");
|
|
32740
|
+
const userProviderDir = pathMod.join(osMod.homedir(), ".adhdev", "providers");
|
|
32741
|
+
const isUserProvider = (p) => {
|
|
32742
|
+
const dir = pathMod.join(userProviderDir, p.type);
|
|
32743
|
+
return fsMod.existsSync(dir) && !dir.includes(".upstream");
|
|
32744
|
+
};
|
|
32745
|
+
let type = typeArg;
|
|
32746
|
+
if (!type) {
|
|
32747
|
+
const ideProviders = allProviders.filter((p) => p.category === "ide");
|
|
32748
|
+
if (ideProviders.length === 0) {
|
|
32749
|
+
console.log(import_chalk6.default.red("\n\u2717 No IDE providers found.\n"));
|
|
32750
|
+
process.exit(1);
|
|
32751
|
+
}
|
|
32752
|
+
const typeAnswer = await inquirer2.prompt([{
|
|
32753
|
+
type: "list",
|
|
32754
|
+
name: "selected",
|
|
32755
|
+
message: "Select the IDE provider you want to fix:",
|
|
32756
|
+
choices: ideProviders.map((p) => ({
|
|
32757
|
+
name: `${p.name} ${isUserProvider(p) ? import_chalk6.default.yellow("[user]") : import_chalk6.default.gray("[upstream]")}`,
|
|
32758
|
+
value: p.type
|
|
32759
|
+
}))
|
|
32760
|
+
}]);
|
|
32761
|
+
type = typeAnswer.selected;
|
|
32762
|
+
}
|
|
32763
|
+
if (!type) {
|
|
32764
|
+
console.log(import_chalk6.default.red("\n\u2717 Provider type is required.\n"));
|
|
32765
|
+
process.exit(1);
|
|
32766
|
+
}
|
|
32767
|
+
const providerToFix = allProviders.find((p) => p.type === type);
|
|
32768
|
+
if (providerToFix && !isUserProvider(providerToFix)) {
|
|
32769
|
+
console.log(import_chalk6.default.yellow(`
|
|
32770
|
+
\u26A0\uFE0F [${type}] is an upstream provider.`));
|
|
32771
|
+
console.log(import_chalk6.default.yellow(` Any local modifications will be permanently OVERWRITTEN by the next auto-update!`));
|
|
32772
|
+
const confirmClone = await inquirer2.prompt([{
|
|
32773
|
+
type: "confirm",
|
|
32774
|
+
name: "doClone",
|
|
32775
|
+
message: `Do you want to safely clone it to a custom user provider ('my-${type}') and fix that instead?`,
|
|
32776
|
+
default: true
|
|
32777
|
+
}]);
|
|
32778
|
+
if (confirmClone.doClone) {
|
|
32779
|
+
const pathMod2 = await import("path");
|
|
32780
|
+
const fsMod2 = await import("fs");
|
|
32781
|
+
const osMod2 = await import("os");
|
|
32782
|
+
const newType = `my-${type}`;
|
|
32783
|
+
const builtinSrc = pathMod2.resolve(__dirname, "../../providers/_builtin", providerToFix.category, type);
|
|
32784
|
+
const downloadedSrc = pathMod2.join(osMod2.homedir(), ".adhdev", "providers", ".upstream", providerToFix.category, type);
|
|
32785
|
+
const sourceDir = fsMod2.existsSync(builtinSrc) ? builtinSrc : downloadedSrc;
|
|
32786
|
+
const targetDir = pathMod2.join(osMod2.homedir(), ".adhdev", "providers", newType);
|
|
32787
|
+
if (fsMod2.existsSync(targetDir)) {
|
|
32788
|
+
console.log(import_chalk6.default.red(`
|
|
32789
|
+
\u2717 Target directory already exists: ${targetDir}. Please delete it or fix it directly.`));
|
|
32790
|
+
process.exit(1);
|
|
32791
|
+
}
|
|
32792
|
+
fsMod2.cpSync(sourceDir, targetDir, { recursive: true });
|
|
32793
|
+
const pJsonPath = pathMod2.join(targetDir, "provider.json");
|
|
32794
|
+
if (fsMod2.existsSync(pJsonPath)) {
|
|
32795
|
+
const pJson = JSON.parse(fsMod2.readFileSync(pJsonPath, "utf8"));
|
|
32796
|
+
pJson.type = newType;
|
|
32797
|
+
pJson.name = `My ${providerToFix.name}`;
|
|
32798
|
+
fsMod2.writeFileSync(pJsonPath, JSON.stringify(pJson, null, 2));
|
|
32799
|
+
}
|
|
32800
|
+
console.log(import_chalk6.default.green(`
|
|
32801
|
+
\u2713 Successfully cloned to [${newType}]`));
|
|
32802
|
+
type = newType;
|
|
32803
|
+
} else {
|
|
32804
|
+
console.log(import_chalk6.default.red(`
|
|
32805
|
+
\u2757 Proceeding with upstream modification. Changes WILL BE WIPED on next sync.
|
|
32806
|
+
`));
|
|
32807
|
+
}
|
|
32808
|
+
}
|
|
32809
|
+
let agentName = options.agent || "codex-cli";
|
|
32620
32810
|
const modelName = options.model;
|
|
32621
32811
|
const reference = options.reference || "antigravity";
|
|
32812
|
+
if (!typeArg && agentName === "codex-cli") {
|
|
32813
|
+
const agentAnswer = await inquirer2.prompt([{
|
|
32814
|
+
type: "list",
|
|
32815
|
+
name: "selected",
|
|
32816
|
+
message: "Select the AI agent to use for auto-fix:",
|
|
32817
|
+
choices: [
|
|
32818
|
+
{ name: `${import_chalk6.default.green("Codex CLI")} ${import_chalk6.default.gray("(OpenAI o3/gpt-5.4)")}`, value: "codex-cli" },
|
|
32819
|
+
{ name: `${import_chalk6.default.magenta("Claude Code")} ${import_chalk6.default.gray("(Anthropic Claude)")}`, value: "claude-cli" },
|
|
32820
|
+
{ name: `${import_chalk6.default.blue("Gemini CLI")} ${import_chalk6.default.gray("(Google Gemini)")}`, value: "gemini-cli" }
|
|
32821
|
+
],
|
|
32822
|
+
default: "codex-cli"
|
|
32823
|
+
}]);
|
|
32824
|
+
agentName = agentAnswer.selected;
|
|
32825
|
+
}
|
|
32622
32826
|
console.log(import_chalk6.default.bold(`
|
|
32623
32827
|
\u{1F916} Starting Auto-Implement Agent for [${import_chalk6.default.cyan(type)}]`));
|
|
32624
32828
|
console.log(import_chalk6.default.gray(` Agent: ${agentName}${modelName ? ` (model: ${modelName})` : ""} | Reference: ${reference}
|
|
32625
32829
|
`));
|
|
32626
|
-
const
|
|
32830
|
+
const allFunctions = [
|
|
32627
32831
|
"openPanel",
|
|
32628
32832
|
"sendMessage",
|
|
32629
32833
|
"readChat",
|
|
@@ -32637,14 +32841,42 @@ function registerProviderCommands(program2) {
|
|
|
32637
32841
|
"setMode",
|
|
32638
32842
|
"focusEditor"
|
|
32639
32843
|
];
|
|
32844
|
+
let functionsToFix = scripts;
|
|
32845
|
+
if (!scripts || scripts.length === 0) {
|
|
32846
|
+
const inquirer3 = (await import("inquirer")).default;
|
|
32847
|
+
const answer = await inquirer3.prompt([{
|
|
32848
|
+
type: "checkbox",
|
|
32849
|
+
name: "selected",
|
|
32850
|
+
message: "Select the scripts you want to fix (Space to toggle, Enter to confirm):",
|
|
32851
|
+
choices: allFunctions.map((f) => ({ name: f, value: f, checked: false }))
|
|
32852
|
+
}]);
|
|
32853
|
+
functionsToFix = answer.selected;
|
|
32854
|
+
if (!functionsToFix || functionsToFix.length === 0) {
|
|
32855
|
+
console.log(import_chalk6.default.yellow("\n\u26A0\uFE0F No scripts selected. Aborting Auto-Implement.\n"));
|
|
32856
|
+
process.exit(0);
|
|
32857
|
+
}
|
|
32858
|
+
}
|
|
32859
|
+
let userComment = options.comment || "";
|
|
32860
|
+
if (!typeArg && !userComment) {
|
|
32861
|
+
const commentAnswer = await inquirer2.prompt([{
|
|
32862
|
+
type: "input",
|
|
32863
|
+
name: "comment",
|
|
32864
|
+
message: "Additional instructions for the agent (press Enter to skip):"
|
|
32865
|
+
}]);
|
|
32866
|
+
userComment = commentAnswer.comment || "";
|
|
32867
|
+
}
|
|
32640
32868
|
let consecutiveFailures = 0;
|
|
32641
32869
|
console.log(import_chalk6.default.bold(`
|
|
32642
|
-
\u25B6\uFE0F Generating
|
|
32870
|
+
\u25B6\uFE0F Generating [${functionsToFix.length}] function(s) natively via autonomous agent for ${type}...`));
|
|
32871
|
+
if (userComment) {
|
|
32872
|
+
console.log(import_chalk6.default.gray(` \u{1F4AC} Comment: ${userComment}`));
|
|
32873
|
+
}
|
|
32643
32874
|
try {
|
|
32644
32875
|
const postData = JSON.stringify({
|
|
32645
32876
|
functions: functionsToFix,
|
|
32646
32877
|
agent: agentName,
|
|
32647
32878
|
...modelName ? { model: modelName } : {},
|
|
32879
|
+
...userComment ? { comment: userComment } : {},
|
|
32648
32880
|
reference
|
|
32649
32881
|
});
|
|
32650
32882
|
const startResult = await new Promise((resolve8, reject) => {
|
|
@@ -32679,11 +32911,11 @@ function registerProviderCommands(program2) {
|
|
|
32679
32911
|
if (!startResult.started || !startResult.sseUrl) {
|
|
32680
32912
|
throw new Error(`Unexpected response: ${JSON.stringify(startResult)}`);
|
|
32681
32913
|
}
|
|
32682
|
-
const
|
|
32914
|
+
const pathMod2 = await import("path");
|
|
32683
32915
|
const osPaths = await import("os");
|
|
32684
|
-
const targetDir =
|
|
32916
|
+
const targetDir = pathMod2.join(osPaths.homedir(), ".adhdev", "providers", type);
|
|
32685
32917
|
const fsMock = await import("fs");
|
|
32686
|
-
const logFile2 =
|
|
32918
|
+
const logFile2 = pathMod2.join(targetDir, `auto-impl.log`);
|
|
32687
32919
|
fsMock.writeFileSync(logFile2, `=== Auto-Impl Started ===
|
|
32688
32920
|
`);
|
|
32689
32921
|
console.log(import_chalk6.default.gray(` Agent logs: ${logFile2}`));
|
|
@@ -32747,6 +32979,7 @@ function registerProviderCommands(program2) {
|
|
|
32747
32979
|
}
|
|
32748
32980
|
console.log(import_chalk6.default.gray(` Please run: adhdev provider verify ${type}
|
|
32749
32981
|
`));
|
|
32982
|
+
process.exit(0);
|
|
32750
32983
|
} catch (e) {
|
|
32751
32984
|
console.error(import_chalk6.default.red(`
|
|
32752
32985
|
\u2717 ${e.message}
|
|
@@ -32790,6 +33023,7 @@ function registerProviderCommands(program2) {
|
|
|
32790
33023
|
const http3 = await import("http");
|
|
32791
33024
|
const postData = JSON.stringify({
|
|
32792
33025
|
script,
|
|
33026
|
+
ideType: type,
|
|
32793
33027
|
params: options.param ? { text: options.param, sessionId: options.param, buttonText: options.param } : {}
|
|
32794
33028
|
});
|
|
32795
33029
|
const result = await new Promise((resolve8, reject) => {
|