adhdev 0.6.18 → 0.6.19
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 +126 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -26896,7 +26896,7 @@ var init_dev_server = __esm({
|
|
|
26896
26896
|
this.json(res, 400, { error: `Script '${scriptName}' not found in provider '${type}'`, available: provider.scripts ? Object.keys(provider.scripts) : [] });
|
|
26897
26897
|
return;
|
|
26898
26898
|
}
|
|
26899
|
-
const cdp = this.getCdp(scriptIdeType);
|
|
26899
|
+
const cdp = this.getCdp(scriptIdeType || type);
|
|
26900
26900
|
if (!cdp) {
|
|
26901
26901
|
this.json(res, 503, { error: "No CDP connection available" });
|
|
26902
26902
|
return;
|
|
@@ -28615,9 +28615,11 @@ var init_dev_server = __esm({
|
|
|
28615
28615
|
const baseArgs = [...spawn3.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
28616
28616
|
let shellCmd;
|
|
28617
28617
|
if (command === "claude") {
|
|
28618
|
-
const args = [...baseArgs, "--
|
|
28618
|
+
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
28619
|
+
if (model) args.push("--model", model);
|
|
28619
28620
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28620
|
-
|
|
28621
|
+
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.`;
|
|
28622
|
+
shellCmd = `${command} ${escapedArgs} -p "${metaPrompt}"`;
|
|
28621
28623
|
} else if (command === "gemini") {
|
|
28622
28624
|
const args = [...baseArgs, "-y", "-s", "false"];
|
|
28623
28625
|
if (model) args.push("-m", model);
|
|
@@ -28633,7 +28635,7 @@ var init_dev_server = __esm({
|
|
|
28633
28635
|
}
|
|
28634
28636
|
if (model) args.push("--model", model);
|
|
28635
28637
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28636
|
-
const metaPrompt = `Read the file at ${promptFile} and follow ALL
|
|
28638
|
+
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
28639
|
shellCmd = `${command} ${escapedArgs} "${metaPrompt}"`;
|
|
28638
28640
|
} else {
|
|
28639
28641
|
const escapedArgs = baseArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
@@ -28912,6 +28914,10 @@ var init_dev_server = __esm({
|
|
|
28912
28914
|
lines.push("1. Edit the script files to implement working code");
|
|
28913
28915
|
lines.push("2. After editing, TEST each function using the DevConsole API (see below)");
|
|
28914
28916
|
lines.push("3. If a test fails, fix the implementation and re-test");
|
|
28917
|
+
lines.push("4. **IMPORTANT VERIFICATION LOGIC**: When verifying your implementation, beware of state contamination! You MUST perform strict Integration Testing:");
|
|
28918
|
+
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.");
|
|
28919
|
+
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.");
|
|
28920
|
+
lines.push(" - `switchSession`: Prove your switch was successful by subsequently calling `readChat` and explicitly checking that the chat context has actually changed.");
|
|
28915
28921
|
lines.push("");
|
|
28916
28922
|
lines.push("## YOU MUST EXPLORE THE DOM YOURSELF!");
|
|
28917
28923
|
lines.push("I have NOT provided you with the DOM snapshot. You MUST use your command-line tools to discover the IDE structure dynamically!");
|
|
@@ -31014,7 +31020,7 @@ var init_adhdev_daemon = __esm({
|
|
|
31014
31020
|
fs11 = __toESM(require("fs"));
|
|
31015
31021
|
path14 = __toESM(require("path"));
|
|
31016
31022
|
import_chalk2 = __toESM(require("chalk"));
|
|
31017
|
-
pkgVersion = "0.6.
|
|
31023
|
+
pkgVersion = "0.6.19";
|
|
31018
31024
|
if (pkgVersion === "unknown") {
|
|
31019
31025
|
try {
|
|
31020
31026
|
const possiblePaths = [
|
|
@@ -32613,17 +32619,108 @@ function registerProviderCommands(program2) {
|
|
|
32613
32619
|
process.exit(1);
|
|
32614
32620
|
}
|
|
32615
32621
|
});
|
|
32616
|
-
provider.command("fix
|
|
32622
|
+
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").action(async (typeArg, scripts, options) => {
|
|
32617
32623
|
try {
|
|
32618
32624
|
const http3 = await import("http");
|
|
32619
|
-
const
|
|
32625
|
+
const inquirer2 = (await import("inquirer")).default;
|
|
32626
|
+
const { ProviderLoader: ProviderLoader2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
32627
|
+
const loader = new ProviderLoader2();
|
|
32628
|
+
loader.loadAll();
|
|
32629
|
+
const allProviders = loader.getAll();
|
|
32630
|
+
const osMod = await import("os");
|
|
32631
|
+
const pathMod = await import("path");
|
|
32632
|
+
const fsMod = await import("fs");
|
|
32633
|
+
const userProviderDir = pathMod.join(osMod.homedir(), ".adhdev", "providers");
|
|
32634
|
+
const isUserProvider = (p) => {
|
|
32635
|
+
const dir = pathMod.join(userProviderDir, p.type);
|
|
32636
|
+
return fsMod.existsSync(dir) && !dir.includes(".upstream");
|
|
32637
|
+
};
|
|
32638
|
+
let type = typeArg;
|
|
32639
|
+
if (!type) {
|
|
32640
|
+
const ideProviders = allProviders.filter((p) => p.category === "ide");
|
|
32641
|
+
if (ideProviders.length === 0) {
|
|
32642
|
+
console.log(import_chalk6.default.red("\n\u2717 No IDE providers found.\n"));
|
|
32643
|
+
process.exit(1);
|
|
32644
|
+
}
|
|
32645
|
+
const typeAnswer = await inquirer2.prompt([{
|
|
32646
|
+
type: "list",
|
|
32647
|
+
name: "selected",
|
|
32648
|
+
message: "Select the IDE provider you want to fix:",
|
|
32649
|
+
choices: ideProviders.map((p) => ({
|
|
32650
|
+
name: `${p.name} ${isUserProvider(p) ? import_chalk6.default.yellow("[user]") : import_chalk6.default.gray("[upstream]")}`,
|
|
32651
|
+
value: p.type
|
|
32652
|
+
}))
|
|
32653
|
+
}]);
|
|
32654
|
+
type = typeAnswer.selected;
|
|
32655
|
+
}
|
|
32656
|
+
if (!type) {
|
|
32657
|
+
console.log(import_chalk6.default.red("\n\u2717 Provider type is required.\n"));
|
|
32658
|
+
process.exit(1);
|
|
32659
|
+
}
|
|
32660
|
+
const providerToFix = allProviders.find((p) => p.type === type);
|
|
32661
|
+
if (providerToFix && !isUserProvider(providerToFix)) {
|
|
32662
|
+
console.log(import_chalk6.default.yellow(`
|
|
32663
|
+
\u26A0\uFE0F [${type}] is an upstream provider.`));
|
|
32664
|
+
console.log(import_chalk6.default.yellow(` Any local modifications will be permanently OVERWRITTEN by the next auto-update!`));
|
|
32665
|
+
const confirmClone = await inquirer2.prompt([{
|
|
32666
|
+
type: "confirm",
|
|
32667
|
+
name: "doClone",
|
|
32668
|
+
message: `Do you want to safely clone it to a custom user provider ('my-${type}') and fix that instead?`,
|
|
32669
|
+
default: true
|
|
32670
|
+
}]);
|
|
32671
|
+
if (confirmClone.doClone) {
|
|
32672
|
+
const pathMod2 = await import("path");
|
|
32673
|
+
const fsMod2 = await import("fs");
|
|
32674
|
+
const osMod2 = await import("os");
|
|
32675
|
+
const newType = `my-${type}`;
|
|
32676
|
+
const builtinSrc = pathMod2.resolve(__dirname, "../../providers/_builtin", providerToFix.category, type);
|
|
32677
|
+
const downloadedSrc = pathMod2.join(osMod2.homedir(), ".adhdev", "providers", ".upstream", providerToFix.category, type);
|
|
32678
|
+
const sourceDir = fsMod2.existsSync(builtinSrc) ? builtinSrc : downloadedSrc;
|
|
32679
|
+
const targetDir = pathMod2.join(osMod2.homedir(), ".adhdev", "providers", newType);
|
|
32680
|
+
if (fsMod2.existsSync(targetDir)) {
|
|
32681
|
+
console.log(import_chalk6.default.red(`
|
|
32682
|
+
\u2717 Target directory already exists: ${targetDir}. Please delete it or fix it directly.`));
|
|
32683
|
+
process.exit(1);
|
|
32684
|
+
}
|
|
32685
|
+
fsMod2.cpSync(sourceDir, targetDir, { recursive: true });
|
|
32686
|
+
const pJsonPath = pathMod2.join(targetDir, "provider.json");
|
|
32687
|
+
if (fsMod2.existsSync(pJsonPath)) {
|
|
32688
|
+
const pJson = JSON.parse(fsMod2.readFileSync(pJsonPath, "utf8"));
|
|
32689
|
+
pJson.type = newType;
|
|
32690
|
+
pJson.name = `My ${providerToFix.name}`;
|
|
32691
|
+
fsMod2.writeFileSync(pJsonPath, JSON.stringify(pJson, null, 2));
|
|
32692
|
+
}
|
|
32693
|
+
console.log(import_chalk6.default.green(`
|
|
32694
|
+
\u2713 Successfully cloned to [${newType}]`));
|
|
32695
|
+
type = newType;
|
|
32696
|
+
} else {
|
|
32697
|
+
console.log(import_chalk6.default.red(`
|
|
32698
|
+
\u2757 Proceeding with upstream modification. Changes WILL BE WIPED on next sync.
|
|
32699
|
+
`));
|
|
32700
|
+
}
|
|
32701
|
+
}
|
|
32702
|
+
let agentName = options.agent || "codex-cli";
|
|
32620
32703
|
const modelName = options.model;
|
|
32621
32704
|
const reference = options.reference || "antigravity";
|
|
32705
|
+
if (!typeArg && agentName === "codex-cli") {
|
|
32706
|
+
const agentAnswer = await inquirer2.prompt([{
|
|
32707
|
+
type: "list",
|
|
32708
|
+
name: "selected",
|
|
32709
|
+
message: "Select the AI agent to use for auto-fix:",
|
|
32710
|
+
choices: [
|
|
32711
|
+
{ name: `${import_chalk6.default.green("Codex CLI")} ${import_chalk6.default.gray("(OpenAI o3/gpt-5.4)")}`, value: "codex-cli" },
|
|
32712
|
+
{ name: `${import_chalk6.default.magenta("Claude Code")} ${import_chalk6.default.gray("(Anthropic Claude)")}`, value: "claude-cli" },
|
|
32713
|
+
{ name: `${import_chalk6.default.blue("Gemini CLI")} ${import_chalk6.default.gray("(Google Gemini)")}`, value: "gemini-cli" }
|
|
32714
|
+
],
|
|
32715
|
+
default: "codex-cli"
|
|
32716
|
+
}]);
|
|
32717
|
+
agentName = agentAnswer.selected;
|
|
32718
|
+
}
|
|
32622
32719
|
console.log(import_chalk6.default.bold(`
|
|
32623
32720
|
\u{1F916} Starting Auto-Implement Agent for [${import_chalk6.default.cyan(type)}]`));
|
|
32624
32721
|
console.log(import_chalk6.default.gray(` Agent: ${agentName}${modelName ? ` (model: ${modelName})` : ""} | Reference: ${reference}
|
|
32625
32722
|
`));
|
|
32626
|
-
const
|
|
32723
|
+
const allFunctions = [
|
|
32627
32724
|
"openPanel",
|
|
32628
32725
|
"sendMessage",
|
|
32629
32726
|
"readChat",
|
|
@@ -32637,9 +32734,24 @@ function registerProviderCommands(program2) {
|
|
|
32637
32734
|
"setMode",
|
|
32638
32735
|
"focusEditor"
|
|
32639
32736
|
];
|
|
32737
|
+
let functionsToFix = scripts;
|
|
32738
|
+
if (!scripts || scripts.length === 0) {
|
|
32739
|
+
const inquirer3 = (await import("inquirer")).default;
|
|
32740
|
+
const answer = await inquirer3.prompt([{
|
|
32741
|
+
type: "checkbox",
|
|
32742
|
+
name: "selected",
|
|
32743
|
+
message: "Select the scripts you want to fix (Space to toggle, Enter to confirm):",
|
|
32744
|
+
choices: allFunctions.map((f) => ({ name: f, value: f, checked: false }))
|
|
32745
|
+
}]);
|
|
32746
|
+
functionsToFix = answer.selected;
|
|
32747
|
+
if (!functionsToFix || functionsToFix.length === 0) {
|
|
32748
|
+
console.log(import_chalk6.default.yellow("\n\u26A0\uFE0F No scripts selected. Aborting Auto-Implement.\n"));
|
|
32749
|
+
process.exit(0);
|
|
32750
|
+
}
|
|
32751
|
+
}
|
|
32640
32752
|
let consecutiveFailures = 0;
|
|
32641
32753
|
console.log(import_chalk6.default.bold(`
|
|
32642
|
-
\u25B6\uFE0F Generating
|
|
32754
|
+
\u25B6\uFE0F Generating [${functionsToFix.length}] function(s) natively via autonomous agent for ${type}...`));
|
|
32643
32755
|
try {
|
|
32644
32756
|
const postData = JSON.stringify({
|
|
32645
32757
|
functions: functionsToFix,
|
|
@@ -32679,11 +32791,11 @@ function registerProviderCommands(program2) {
|
|
|
32679
32791
|
if (!startResult.started || !startResult.sseUrl) {
|
|
32680
32792
|
throw new Error(`Unexpected response: ${JSON.stringify(startResult)}`);
|
|
32681
32793
|
}
|
|
32682
|
-
const
|
|
32794
|
+
const pathMod2 = await import("path");
|
|
32683
32795
|
const osPaths = await import("os");
|
|
32684
|
-
const targetDir =
|
|
32796
|
+
const targetDir = pathMod2.join(osPaths.homedir(), ".adhdev", "providers", type);
|
|
32685
32797
|
const fsMock = await import("fs");
|
|
32686
|
-
const logFile2 =
|
|
32798
|
+
const logFile2 = pathMod2.join(targetDir, `auto-impl.log`);
|
|
32687
32799
|
fsMock.writeFileSync(logFile2, `=== Auto-Impl Started ===
|
|
32688
32800
|
`);
|
|
32689
32801
|
console.log(import_chalk6.default.gray(` Agent logs: ${logFile2}`));
|
|
@@ -32747,6 +32859,7 @@ function registerProviderCommands(program2) {
|
|
|
32747
32859
|
}
|
|
32748
32860
|
console.log(import_chalk6.default.gray(` Please run: adhdev provider verify ${type}
|
|
32749
32861
|
`));
|
|
32862
|
+
process.exit(0);
|
|
32750
32863
|
} catch (e) {
|
|
32751
32864
|
console.error(import_chalk6.default.red(`
|
|
32752
32865
|
\u2717 ${e.message}
|
|
@@ -32790,6 +32903,7 @@ function registerProviderCommands(program2) {
|
|
|
32790
32903
|
const http3 = await import("http");
|
|
32791
32904
|
const postData = JSON.stringify({
|
|
32792
32905
|
script,
|
|
32906
|
+
ideType: type,
|
|
32793
32907
|
params: options.param ? { text: options.param, sessionId: options.param, buttonText: options.param } : {}
|
|
32794
32908
|
});
|
|
32795
32909
|
const result = await new Promise((resolve8, reject) => {
|