adhdev 0.1.45 → 0.1.47
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/index.js +656 -613
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -658,413 +658,6 @@ var init_provider_loader = __esm({
|
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
660
|
|
|
661
|
-
// src/cli-detector.ts
|
|
662
|
-
async function detectCLIs() {
|
|
663
|
-
const platform7 = os2.platform();
|
|
664
|
-
const whichCmd = platform7 === "win32" ? "where" : "which";
|
|
665
|
-
const results = [];
|
|
666
|
-
for (const cli of KNOWN_CLIS) {
|
|
667
|
-
try {
|
|
668
|
-
const pathResult = (0, import_child_process3.execSync)(`${whichCmd} ${cli.command} 2>/dev/null`, {
|
|
669
|
-
encoding: "utf-8",
|
|
670
|
-
timeout: 5e3,
|
|
671
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
672
|
-
}).trim().split("\n")[0];
|
|
673
|
-
if (!pathResult) throw new Error("Not found");
|
|
674
|
-
let version;
|
|
675
|
-
try {
|
|
676
|
-
const versionResult = (0, import_child_process3.execSync)(`${cli.command} --version 2>/dev/null`, {
|
|
677
|
-
encoding: "utf-8",
|
|
678
|
-
timeout: 5e3,
|
|
679
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
680
|
-
}).trim();
|
|
681
|
-
const match = versionResult.match(/(\d+\.\d+[\.\d]*)/);
|
|
682
|
-
version = match ? match[1] : versionResult.split("\n")[0].slice(0, 30);
|
|
683
|
-
} catch {
|
|
684
|
-
}
|
|
685
|
-
results.push({ ...cli, installed: true, version, path: pathResult });
|
|
686
|
-
} catch {
|
|
687
|
-
results.push({ ...cli, installed: false });
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return results;
|
|
691
|
-
}
|
|
692
|
-
async function detectCLI(cliId) {
|
|
693
|
-
const normalizedId = cliId === "claude-cli" ? "claude-code" : cliId;
|
|
694
|
-
const all = await detectCLIs();
|
|
695
|
-
return all.find((c) => c.id === normalizedId && c.installed) || null;
|
|
696
|
-
}
|
|
697
|
-
var import_child_process3, os2, KNOWN_CLIS;
|
|
698
|
-
var init_cli_detector = __esm({
|
|
699
|
-
"src/cli-detector.ts"() {
|
|
700
|
-
"use strict";
|
|
701
|
-
import_child_process3 = require("child_process");
|
|
702
|
-
os2 = __toESM(require("os"));
|
|
703
|
-
KNOWN_CLIS = [
|
|
704
|
-
{ id: "gemini-cli", displayName: "Gemini CLI", icon: "\u264A", command: "gemini" },
|
|
705
|
-
{ id: "claude-code", displayName: "Claude Code", icon: "\u{1F916}", command: "claude" },
|
|
706
|
-
{ id: "codex-cli", displayName: "Codex CLI", icon: "\u{1F9E0}", command: "codex" }
|
|
707
|
-
];
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
|
|
711
|
-
// src/launch.ts
|
|
712
|
-
function getProviderLoader() {
|
|
713
|
-
if (!_providerLoader) {
|
|
714
|
-
_providerLoader = new ProviderLoader({ logFn: () => {
|
|
715
|
-
} });
|
|
716
|
-
_providerLoader.loadAll();
|
|
717
|
-
_providerLoader.registerToDetector();
|
|
718
|
-
}
|
|
719
|
-
return _providerLoader;
|
|
720
|
-
}
|
|
721
|
-
function getCdpPorts() {
|
|
722
|
-
return getProviderLoader().getCdpPortMap();
|
|
723
|
-
}
|
|
724
|
-
function getMacAppIdentifiers() {
|
|
725
|
-
return getProviderLoader().getMacAppIdentifiers();
|
|
726
|
-
}
|
|
727
|
-
function getWinProcessNames() {
|
|
728
|
-
return getProviderLoader().getWinProcessNames();
|
|
729
|
-
}
|
|
730
|
-
async function findFreePort(ports) {
|
|
731
|
-
for (const port2 of ports) {
|
|
732
|
-
const free = await checkPortFree(port2);
|
|
733
|
-
if (free) return port2;
|
|
734
|
-
}
|
|
735
|
-
let port = ports[1] + 1;
|
|
736
|
-
while (port < ports[1] + 10) {
|
|
737
|
-
if (await checkPortFree(port)) return port;
|
|
738
|
-
port++;
|
|
739
|
-
}
|
|
740
|
-
throw new Error("No free port found");
|
|
741
|
-
}
|
|
742
|
-
function checkPortFree(port) {
|
|
743
|
-
return new Promise((resolve5) => {
|
|
744
|
-
const server = net.createServer();
|
|
745
|
-
server.unref();
|
|
746
|
-
server.on("error", () => resolve5(false));
|
|
747
|
-
server.listen(port, "127.0.0.1", () => {
|
|
748
|
-
server.close(() => resolve5(true));
|
|
749
|
-
});
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
async function isCdpActive(port) {
|
|
753
|
-
return new Promise((resolve5) => {
|
|
754
|
-
const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
755
|
-
timeout: 2e3
|
|
756
|
-
}, (res) => {
|
|
757
|
-
let data = "";
|
|
758
|
-
res.on("data", (c) => data += c);
|
|
759
|
-
res.on("end", () => {
|
|
760
|
-
try {
|
|
761
|
-
const info = JSON.parse(data);
|
|
762
|
-
resolve5(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
763
|
-
} catch {
|
|
764
|
-
resolve5(false);
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
});
|
|
768
|
-
req.on("error", () => resolve5(false));
|
|
769
|
-
req.on("timeout", () => {
|
|
770
|
-
req.destroy();
|
|
771
|
-
resolve5(false);
|
|
772
|
-
});
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
async function killIdeProcess(ideId) {
|
|
776
|
-
const plat = os3.platform();
|
|
777
|
-
const appName = getMacAppIdentifiers()[ideId];
|
|
778
|
-
const winProcesses = getWinProcessNames()[ideId];
|
|
779
|
-
try {
|
|
780
|
-
if (plat === "darwin" && appName) {
|
|
781
|
-
try {
|
|
782
|
-
(0, import_child_process4.execSync)(`osascript -e 'tell application "${appName}" to quit' 2>/dev/null`, {
|
|
783
|
-
timeout: 5e3
|
|
784
|
-
});
|
|
785
|
-
} catch {
|
|
786
|
-
try {
|
|
787
|
-
(0, import_child_process4.execSync)(`pkill -f "${appName}" 2>/dev/null`);
|
|
788
|
-
} catch {
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
} else if (plat === "win32" && winProcesses) {
|
|
792
|
-
for (const proc of winProcesses) {
|
|
793
|
-
try {
|
|
794
|
-
(0, import_child_process4.execSync)(`taskkill /IM "${proc}" /F 2>nul`, { timeout: 5e3 });
|
|
795
|
-
} catch {
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
try {
|
|
799
|
-
const exeName = winProcesses[0].replace(".exe", "");
|
|
800
|
-
(0, import_child_process4.execSync)(`powershell -Command "Get-Process -Name '${exeName}' -ErrorAction SilentlyContinue | Stop-Process -Force"`, {
|
|
801
|
-
timeout: 1e4
|
|
802
|
-
});
|
|
803
|
-
} catch {
|
|
804
|
-
}
|
|
805
|
-
} else {
|
|
806
|
-
try {
|
|
807
|
-
(0, import_child_process4.execSync)(`pkill -f "${ideId}" 2>/dev/null`);
|
|
808
|
-
} catch {
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
for (let i = 0; i < 30; i++) {
|
|
812
|
-
await new Promise((r) => setTimeout(r, 500));
|
|
813
|
-
if (!isIdeRunning(ideId)) return true;
|
|
814
|
-
}
|
|
815
|
-
if (plat === "darwin" && appName) {
|
|
816
|
-
try {
|
|
817
|
-
(0, import_child_process4.execSync)(`pkill -9 -f "${appName}" 2>/dev/null`);
|
|
818
|
-
} catch {
|
|
819
|
-
}
|
|
820
|
-
} else if (plat === "win32" && winProcesses) {
|
|
821
|
-
for (const proc of winProcesses) {
|
|
822
|
-
try {
|
|
823
|
-
(0, import_child_process4.execSync)(`taskkill /IM "${proc}" /F 2>nul`);
|
|
824
|
-
} catch {
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
await new Promise((r) => setTimeout(r, 2e3));
|
|
829
|
-
return !isIdeRunning(ideId);
|
|
830
|
-
} catch {
|
|
831
|
-
return false;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
function isIdeRunning(ideId) {
|
|
835
|
-
const plat = os3.platform();
|
|
836
|
-
try {
|
|
837
|
-
if (plat === "darwin") {
|
|
838
|
-
const appName = getMacAppIdentifiers()[ideId];
|
|
839
|
-
if (!appName) return false;
|
|
840
|
-
const result = (0, import_child_process4.execSync)(`pgrep -f "${appName}" 2>/dev/null`, { encoding: "utf-8" });
|
|
841
|
-
return result.trim().length > 0;
|
|
842
|
-
} else if (plat === "win32") {
|
|
843
|
-
const winProcesses = getWinProcessNames()[ideId];
|
|
844
|
-
if (!winProcesses) return false;
|
|
845
|
-
for (const proc of winProcesses) {
|
|
846
|
-
try {
|
|
847
|
-
const result = (0, import_child_process4.execSync)(`tasklist /FI "IMAGENAME eq ${proc}" /NH 2>nul`, { encoding: "utf-8" });
|
|
848
|
-
if (result.includes(proc)) return true;
|
|
849
|
-
} catch {
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
try {
|
|
853
|
-
const exeName = winProcesses[0].replace(".exe", "");
|
|
854
|
-
const result = (0, import_child_process4.execSync)(
|
|
855
|
-
`powershell -Command "(Get-Process -Name '${exeName}' -ErrorAction SilentlyContinue).Count"`,
|
|
856
|
-
{ encoding: "utf-8", timeout: 5e3 }
|
|
857
|
-
);
|
|
858
|
-
return parseInt(result.trim()) > 0;
|
|
859
|
-
} catch {
|
|
860
|
-
}
|
|
861
|
-
return false;
|
|
862
|
-
} else {
|
|
863
|
-
const result = (0, import_child_process4.execSync)(`pgrep -f "${ideId}" 2>/dev/null`, { encoding: "utf-8" });
|
|
864
|
-
return result.trim().length > 0;
|
|
865
|
-
}
|
|
866
|
-
} catch {
|
|
867
|
-
return false;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
function detectCurrentWorkspace(ideId) {
|
|
871
|
-
const plat = os3.platform();
|
|
872
|
-
if (plat === "darwin") {
|
|
873
|
-
try {
|
|
874
|
-
const appName = getMacAppIdentifiers()[ideId];
|
|
875
|
-
if (!appName) return void 0;
|
|
876
|
-
const result = (0, import_child_process4.execSync)(
|
|
877
|
-
`lsof -c "${appName}" 2>/dev/null | grep cwd | head -1 | awk '{print $NF}'`,
|
|
878
|
-
{ encoding: "utf-8", timeout: 3e3 }
|
|
879
|
-
);
|
|
880
|
-
const dir = result.trim();
|
|
881
|
-
if (dir && dir !== "/") return dir;
|
|
882
|
-
} catch {
|
|
883
|
-
}
|
|
884
|
-
} else if (plat === "win32") {
|
|
885
|
-
try {
|
|
886
|
-
const fs7 = require("fs");
|
|
887
|
-
const appNameMap = getMacAppIdentifiers();
|
|
888
|
-
const appName = appNameMap[ideId];
|
|
889
|
-
if (appName) {
|
|
890
|
-
const storagePath = path2.join(
|
|
891
|
-
process.env.APPDATA || path2.join(os3.homedir(), "AppData", "Roaming"),
|
|
892
|
-
appName,
|
|
893
|
-
"storage.json"
|
|
894
|
-
);
|
|
895
|
-
if (fs7.existsSync(storagePath)) {
|
|
896
|
-
const data = JSON.parse(fs7.readFileSync(storagePath, "utf-8"));
|
|
897
|
-
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
898
|
-
if (workspaces.length > 0) {
|
|
899
|
-
const recent = workspaces[0];
|
|
900
|
-
const uri = typeof recent === "string" ? recent : recent?.folderUri;
|
|
901
|
-
if (uri?.startsWith("file:///")) {
|
|
902
|
-
return decodeURIComponent(uri.replace("file:///", ""));
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
} catch {
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
return void 0;
|
|
911
|
-
}
|
|
912
|
-
async function launchWithCdp(options = {}) {
|
|
913
|
-
const platform7 = os3.platform();
|
|
914
|
-
let targetIde;
|
|
915
|
-
const ides = await detectIDEs();
|
|
916
|
-
if (options.ideId) {
|
|
917
|
-
targetIde = ides.find((i) => i.id === options.ideId && i.installed);
|
|
918
|
-
if (!targetIde) {
|
|
919
|
-
return {
|
|
920
|
-
success: false,
|
|
921
|
-
ideId: options.ideId,
|
|
922
|
-
ideName: options.ideId,
|
|
923
|
-
port: 0,
|
|
924
|
-
action: "failed",
|
|
925
|
-
message: "",
|
|
926
|
-
error: `IDE '${options.ideId}' not found or not installed`
|
|
927
|
-
};
|
|
928
|
-
}
|
|
929
|
-
} else {
|
|
930
|
-
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
931
|
-
const config = loadConfig2();
|
|
932
|
-
if (config.selectedIde) {
|
|
933
|
-
targetIde = ides.find((i) => i.id === config.selectedIde && i.installed);
|
|
934
|
-
}
|
|
935
|
-
if (!targetIde) {
|
|
936
|
-
targetIde = ides.find((i) => i.installed);
|
|
937
|
-
}
|
|
938
|
-
if (!targetIde) {
|
|
939
|
-
return {
|
|
940
|
-
success: false,
|
|
941
|
-
ideId: "unknown",
|
|
942
|
-
ideName: "Unknown",
|
|
943
|
-
port: 0,
|
|
944
|
-
action: "failed",
|
|
945
|
-
message: "",
|
|
946
|
-
error: "No IDE found. Install VS Code, Cursor, or Antigravity first."
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
const portPair = getCdpPorts()[targetIde.id] || [9333, 9334];
|
|
951
|
-
for (const port2 of portPair) {
|
|
952
|
-
if (await isCdpActive(port2)) {
|
|
953
|
-
return {
|
|
954
|
-
success: true,
|
|
955
|
-
ideId: targetIde.id,
|
|
956
|
-
ideName: targetIde.displayName,
|
|
957
|
-
port: port2,
|
|
958
|
-
action: "reused",
|
|
959
|
-
message: `CDP already active on port ${port2}`
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
const alreadyRunning = isIdeRunning(targetIde.id);
|
|
964
|
-
const workspace = options.workspace || (alreadyRunning ? detectCurrentWorkspace(targetIde.id) : void 0);
|
|
965
|
-
if (alreadyRunning) {
|
|
966
|
-
const killed = await killIdeProcess(targetIde.id);
|
|
967
|
-
if (!killed) {
|
|
968
|
-
return {
|
|
969
|
-
success: false,
|
|
970
|
-
ideId: targetIde.id,
|
|
971
|
-
ideName: targetIde.displayName,
|
|
972
|
-
port: 0,
|
|
973
|
-
action: "failed",
|
|
974
|
-
message: "",
|
|
975
|
-
error: `Could not stop ${targetIde.displayName}. Close it manually and try again.`
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
await new Promise((r) => setTimeout(r, 3e3));
|
|
979
|
-
}
|
|
980
|
-
const port = await findFreePort(portPair);
|
|
981
|
-
try {
|
|
982
|
-
if (platform7 === "darwin") {
|
|
983
|
-
await launchMacOS(targetIde, port, workspace, options.newWindow);
|
|
984
|
-
} else if (platform7 === "win32") {
|
|
985
|
-
await launchWindows(targetIde, port, workspace, options.newWindow);
|
|
986
|
-
} else {
|
|
987
|
-
await launchLinux(targetIde, port, workspace, options.newWindow);
|
|
988
|
-
}
|
|
989
|
-
let cdpReady = false;
|
|
990
|
-
for (let i = 0; i < 30; i++) {
|
|
991
|
-
await new Promise((r) => setTimeout(r, 500));
|
|
992
|
-
if (await isCdpActive(port)) {
|
|
993
|
-
cdpReady = true;
|
|
994
|
-
break;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
return {
|
|
998
|
-
success: true,
|
|
999
|
-
ideId: targetIde.id,
|
|
1000
|
-
ideName: targetIde.displayName,
|
|
1001
|
-
port,
|
|
1002
|
-
action: alreadyRunning ? "restarted" : "started",
|
|
1003
|
-
message: cdpReady ? `${targetIde.displayName} launched with CDP on port ${port}` : `${targetIde.displayName} launched (CDP may take a moment to initialize)`
|
|
1004
|
-
};
|
|
1005
|
-
} catch (e) {
|
|
1006
|
-
return {
|
|
1007
|
-
success: false,
|
|
1008
|
-
ideId: targetIde.id,
|
|
1009
|
-
ideName: targetIde.displayName,
|
|
1010
|
-
port,
|
|
1011
|
-
action: "failed",
|
|
1012
|
-
message: "",
|
|
1013
|
-
error: e?.message || String(e)
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
async function launchMacOS(ide, port, workspace, newWindow) {
|
|
1018
|
-
const appName = getMacAppIdentifiers()[ide.id];
|
|
1019
|
-
const args = ["--remote-debugging-port=" + port];
|
|
1020
|
-
if (newWindow) args.push("--new-window");
|
|
1021
|
-
if (workspace) args.push(workspace);
|
|
1022
|
-
if (appName) {
|
|
1023
|
-
const openArgs = ["-a", appName, "--args", ...args];
|
|
1024
|
-
(0, import_child_process4.spawn)("open", openArgs, { detached: true, stdio: "ignore" }).unref();
|
|
1025
|
-
} else if (ide.cliCommand) {
|
|
1026
|
-
(0, import_child_process4.spawn)(ide.cliCommand, args, { detached: true, stdio: "ignore" }).unref();
|
|
1027
|
-
} else {
|
|
1028
|
-
throw new Error(`No app identifier or CLI for ${ide.displayName}`);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
async function launchWindows(ide, port, workspace, newWindow) {
|
|
1032
|
-
const cli = ide.cliCommand;
|
|
1033
|
-
if (!cli) {
|
|
1034
|
-
throw new Error(`No CLI command for ${ide.displayName}. Please add it to PATH.`);
|
|
1035
|
-
}
|
|
1036
|
-
const parts = [`"${cli}"`, `--remote-debugging-port=${port}`];
|
|
1037
|
-
if (newWindow) parts.push("--new-window");
|
|
1038
|
-
if (workspace) parts.push(`"${workspace}"`);
|
|
1039
|
-
const fullCmd = parts.join(" ");
|
|
1040
|
-
const { exec: execCmd } = require("child_process");
|
|
1041
|
-
execCmd(fullCmd, { windowsHide: true }, () => {
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
|
-
async function launchLinux(ide, port, workspace, newWindow) {
|
|
1045
|
-
const cli = ide.cliCommand;
|
|
1046
|
-
if (!cli) {
|
|
1047
|
-
throw new Error(`No CLI command for ${ide.displayName}. Make sure it's in PATH.`);
|
|
1048
|
-
}
|
|
1049
|
-
const args = ["--remote-debugging-port=" + port];
|
|
1050
|
-
if (newWindow) args.push("--new-window");
|
|
1051
|
-
if (workspace) args.push(workspace);
|
|
1052
|
-
(0, import_child_process4.spawn)(cli, args, { detached: true, stdio: "ignore" }).unref();
|
|
1053
|
-
}
|
|
1054
|
-
var import_child_process4, net, os3, path2, _providerLoader;
|
|
1055
|
-
var init_launch = __esm({
|
|
1056
|
-
"src/launch.ts"() {
|
|
1057
|
-
"use strict";
|
|
1058
|
-
import_child_process4 = require("child_process");
|
|
1059
|
-
net = __toESM(require("net"));
|
|
1060
|
-
os3 = __toESM(require("os"));
|
|
1061
|
-
path2 = __toESM(require("path"));
|
|
1062
|
-
init_detector();
|
|
1063
|
-
init_provider_loader();
|
|
1064
|
-
_providerLoader = null;
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
|
|
1068
661
|
// src/cli-bridge.ts
|
|
1069
662
|
var import_ws, CliBridgeConnection;
|
|
1070
663
|
var init_cli_bridge = __esm({
|
|
@@ -1552,6 +1145,363 @@ var init_local_server = __esm({
|
|
|
1552
1145
|
}
|
|
1553
1146
|
});
|
|
1554
1147
|
|
|
1148
|
+
// src/launch.ts
|
|
1149
|
+
function getProviderLoader() {
|
|
1150
|
+
if (!_providerLoader) {
|
|
1151
|
+
_providerLoader = new ProviderLoader({ logFn: () => {
|
|
1152
|
+
} });
|
|
1153
|
+
_providerLoader.loadAll();
|
|
1154
|
+
_providerLoader.registerToDetector();
|
|
1155
|
+
}
|
|
1156
|
+
return _providerLoader;
|
|
1157
|
+
}
|
|
1158
|
+
function getCdpPorts() {
|
|
1159
|
+
return getProviderLoader().getCdpPortMap();
|
|
1160
|
+
}
|
|
1161
|
+
function getMacAppIdentifiers() {
|
|
1162
|
+
return getProviderLoader().getMacAppIdentifiers();
|
|
1163
|
+
}
|
|
1164
|
+
function getWinProcessNames() {
|
|
1165
|
+
return getProviderLoader().getWinProcessNames();
|
|
1166
|
+
}
|
|
1167
|
+
async function findFreePort(ports) {
|
|
1168
|
+
for (const port2 of ports) {
|
|
1169
|
+
const free = await checkPortFree(port2);
|
|
1170
|
+
if (free) return port2;
|
|
1171
|
+
}
|
|
1172
|
+
let port = ports[1] + 1;
|
|
1173
|
+
while (port < ports[1] + 10) {
|
|
1174
|
+
if (await checkPortFree(port)) return port;
|
|
1175
|
+
port++;
|
|
1176
|
+
}
|
|
1177
|
+
throw new Error("No free port found");
|
|
1178
|
+
}
|
|
1179
|
+
function checkPortFree(port) {
|
|
1180
|
+
return new Promise((resolve5) => {
|
|
1181
|
+
const server = net.createServer();
|
|
1182
|
+
server.unref();
|
|
1183
|
+
server.on("error", () => resolve5(false));
|
|
1184
|
+
server.listen(port, "127.0.0.1", () => {
|
|
1185
|
+
server.close(() => resolve5(true));
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
async function isCdpActive(port) {
|
|
1190
|
+
return new Promise((resolve5) => {
|
|
1191
|
+
const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
1192
|
+
timeout: 2e3
|
|
1193
|
+
}, (res) => {
|
|
1194
|
+
let data = "";
|
|
1195
|
+
res.on("data", (c) => data += c);
|
|
1196
|
+
res.on("end", () => {
|
|
1197
|
+
try {
|
|
1198
|
+
const info = JSON.parse(data);
|
|
1199
|
+
resolve5(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
1200
|
+
} catch {
|
|
1201
|
+
resolve5(false);
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
req.on("error", () => resolve5(false));
|
|
1206
|
+
req.on("timeout", () => {
|
|
1207
|
+
req.destroy();
|
|
1208
|
+
resolve5(false);
|
|
1209
|
+
});
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
async function killIdeProcess(ideId) {
|
|
1213
|
+
const plat = os2.platform();
|
|
1214
|
+
const appName = getMacAppIdentifiers()[ideId];
|
|
1215
|
+
const winProcesses = getWinProcessNames()[ideId];
|
|
1216
|
+
try {
|
|
1217
|
+
if (plat === "darwin" && appName) {
|
|
1218
|
+
try {
|
|
1219
|
+
(0, import_child_process3.execSync)(`osascript -e 'tell application "${appName}" to quit' 2>/dev/null`, {
|
|
1220
|
+
timeout: 5e3
|
|
1221
|
+
});
|
|
1222
|
+
} catch {
|
|
1223
|
+
try {
|
|
1224
|
+
(0, import_child_process3.execSync)(`pkill -f "${appName}" 2>/dev/null`);
|
|
1225
|
+
} catch {
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
} else if (plat === "win32" && winProcesses) {
|
|
1229
|
+
for (const proc of winProcesses) {
|
|
1230
|
+
try {
|
|
1231
|
+
(0, import_child_process3.execSync)(`taskkill /IM "${proc}" /F 2>nul`, { timeout: 5e3 });
|
|
1232
|
+
} catch {
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
try {
|
|
1236
|
+
const exeName = winProcesses[0].replace(".exe", "");
|
|
1237
|
+
(0, import_child_process3.execSync)(`powershell -Command "Get-Process -Name '${exeName}' -ErrorAction SilentlyContinue | Stop-Process -Force"`, {
|
|
1238
|
+
timeout: 1e4
|
|
1239
|
+
});
|
|
1240
|
+
} catch {
|
|
1241
|
+
}
|
|
1242
|
+
} else {
|
|
1243
|
+
try {
|
|
1244
|
+
(0, import_child_process3.execSync)(`pkill -f "${ideId}" 2>/dev/null`);
|
|
1245
|
+
} catch {
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
for (let i = 0; i < 30; i++) {
|
|
1249
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
1250
|
+
if (!isIdeRunning(ideId)) return true;
|
|
1251
|
+
}
|
|
1252
|
+
if (plat === "darwin" && appName) {
|
|
1253
|
+
try {
|
|
1254
|
+
(0, import_child_process3.execSync)(`pkill -9 -f "${appName}" 2>/dev/null`);
|
|
1255
|
+
} catch {
|
|
1256
|
+
}
|
|
1257
|
+
} else if (plat === "win32" && winProcesses) {
|
|
1258
|
+
for (const proc of winProcesses) {
|
|
1259
|
+
try {
|
|
1260
|
+
(0, import_child_process3.execSync)(`taskkill /IM "${proc}" /F 2>nul`);
|
|
1261
|
+
} catch {
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
await new Promise((r) => setTimeout(r, 2e3));
|
|
1266
|
+
return !isIdeRunning(ideId);
|
|
1267
|
+
} catch {
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
function isIdeRunning(ideId) {
|
|
1272
|
+
const plat = os2.platform();
|
|
1273
|
+
try {
|
|
1274
|
+
if (plat === "darwin") {
|
|
1275
|
+
const appName = getMacAppIdentifiers()[ideId];
|
|
1276
|
+
if (!appName) return false;
|
|
1277
|
+
const result = (0, import_child_process3.execSync)(`pgrep -f "${appName}" 2>/dev/null`, { encoding: "utf-8" });
|
|
1278
|
+
return result.trim().length > 0;
|
|
1279
|
+
} else if (plat === "win32") {
|
|
1280
|
+
const winProcesses = getWinProcessNames()[ideId];
|
|
1281
|
+
if (!winProcesses) return false;
|
|
1282
|
+
for (const proc of winProcesses) {
|
|
1283
|
+
try {
|
|
1284
|
+
const result = (0, import_child_process3.execSync)(`tasklist /FI "IMAGENAME eq ${proc}" /NH 2>nul`, { encoding: "utf-8" });
|
|
1285
|
+
if (result.includes(proc)) return true;
|
|
1286
|
+
} catch {
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
try {
|
|
1290
|
+
const exeName = winProcesses[0].replace(".exe", "");
|
|
1291
|
+
const result = (0, import_child_process3.execSync)(
|
|
1292
|
+
`powershell -Command "(Get-Process -Name '${exeName}' -ErrorAction SilentlyContinue).Count"`,
|
|
1293
|
+
{ encoding: "utf-8", timeout: 5e3 }
|
|
1294
|
+
);
|
|
1295
|
+
return parseInt(result.trim()) > 0;
|
|
1296
|
+
} catch {
|
|
1297
|
+
}
|
|
1298
|
+
return false;
|
|
1299
|
+
} else {
|
|
1300
|
+
const result = (0, import_child_process3.execSync)(`pgrep -f "${ideId}" 2>/dev/null`, { encoding: "utf-8" });
|
|
1301
|
+
return result.trim().length > 0;
|
|
1302
|
+
}
|
|
1303
|
+
} catch {
|
|
1304
|
+
return false;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
function detectCurrentWorkspace(ideId) {
|
|
1308
|
+
const plat = os2.platform();
|
|
1309
|
+
if (plat === "darwin") {
|
|
1310
|
+
try {
|
|
1311
|
+
const appName = getMacAppIdentifiers()[ideId];
|
|
1312
|
+
if (!appName) return void 0;
|
|
1313
|
+
const result = (0, import_child_process3.execSync)(
|
|
1314
|
+
`lsof -c "${appName}" 2>/dev/null | grep cwd | head -1 | awk '{print $NF}'`,
|
|
1315
|
+
{ encoding: "utf-8", timeout: 3e3 }
|
|
1316
|
+
);
|
|
1317
|
+
const dir = result.trim();
|
|
1318
|
+
if (dir && dir !== "/") return dir;
|
|
1319
|
+
} catch {
|
|
1320
|
+
}
|
|
1321
|
+
} else if (plat === "win32") {
|
|
1322
|
+
try {
|
|
1323
|
+
const fs7 = require("fs");
|
|
1324
|
+
const appNameMap = getMacAppIdentifiers();
|
|
1325
|
+
const appName = appNameMap[ideId];
|
|
1326
|
+
if (appName) {
|
|
1327
|
+
const storagePath = path2.join(
|
|
1328
|
+
process.env.APPDATA || path2.join(os2.homedir(), "AppData", "Roaming"),
|
|
1329
|
+
appName,
|
|
1330
|
+
"storage.json"
|
|
1331
|
+
);
|
|
1332
|
+
if (fs7.existsSync(storagePath)) {
|
|
1333
|
+
const data = JSON.parse(fs7.readFileSync(storagePath, "utf-8"));
|
|
1334
|
+
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
1335
|
+
if (workspaces.length > 0) {
|
|
1336
|
+
const recent = workspaces[0];
|
|
1337
|
+
const uri = typeof recent === "string" ? recent : recent?.folderUri;
|
|
1338
|
+
if (uri?.startsWith("file:///")) {
|
|
1339
|
+
return decodeURIComponent(uri.replace("file:///", ""));
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
} catch {
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return void 0;
|
|
1348
|
+
}
|
|
1349
|
+
async function launchWithCdp(options = {}) {
|
|
1350
|
+
const platform7 = os2.platform();
|
|
1351
|
+
let targetIde;
|
|
1352
|
+
const ides = await detectIDEs();
|
|
1353
|
+
if (options.ideId) {
|
|
1354
|
+
targetIde = ides.find((i) => i.id === options.ideId && i.installed);
|
|
1355
|
+
if (!targetIde) {
|
|
1356
|
+
return {
|
|
1357
|
+
success: false,
|
|
1358
|
+
ideId: options.ideId,
|
|
1359
|
+
ideName: options.ideId,
|
|
1360
|
+
port: 0,
|
|
1361
|
+
action: "failed",
|
|
1362
|
+
message: "",
|
|
1363
|
+
error: `IDE '${options.ideId}' not found or not installed`
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
} else {
|
|
1367
|
+
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
1368
|
+
const config = loadConfig2();
|
|
1369
|
+
if (config.selectedIde) {
|
|
1370
|
+
targetIde = ides.find((i) => i.id === config.selectedIde && i.installed);
|
|
1371
|
+
}
|
|
1372
|
+
if (!targetIde) {
|
|
1373
|
+
targetIde = ides.find((i) => i.installed);
|
|
1374
|
+
}
|
|
1375
|
+
if (!targetIde) {
|
|
1376
|
+
return {
|
|
1377
|
+
success: false,
|
|
1378
|
+
ideId: "unknown",
|
|
1379
|
+
ideName: "Unknown",
|
|
1380
|
+
port: 0,
|
|
1381
|
+
action: "failed",
|
|
1382
|
+
message: "",
|
|
1383
|
+
error: "No IDE found. Install VS Code, Cursor, or Antigravity first."
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
const portPair = getCdpPorts()[targetIde.id] || [9333, 9334];
|
|
1388
|
+
for (const port2 of portPair) {
|
|
1389
|
+
if (await isCdpActive(port2)) {
|
|
1390
|
+
return {
|
|
1391
|
+
success: true,
|
|
1392
|
+
ideId: targetIde.id,
|
|
1393
|
+
ideName: targetIde.displayName,
|
|
1394
|
+
port: port2,
|
|
1395
|
+
action: "reused",
|
|
1396
|
+
message: `CDP already active on port ${port2}`
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
const alreadyRunning = isIdeRunning(targetIde.id);
|
|
1401
|
+
const workspace = options.workspace || (alreadyRunning ? detectCurrentWorkspace(targetIde.id) : void 0);
|
|
1402
|
+
if (alreadyRunning) {
|
|
1403
|
+
const killed = await killIdeProcess(targetIde.id);
|
|
1404
|
+
if (!killed) {
|
|
1405
|
+
return {
|
|
1406
|
+
success: false,
|
|
1407
|
+
ideId: targetIde.id,
|
|
1408
|
+
ideName: targetIde.displayName,
|
|
1409
|
+
port: 0,
|
|
1410
|
+
action: "failed",
|
|
1411
|
+
message: "",
|
|
1412
|
+
error: `Could not stop ${targetIde.displayName}. Close it manually and try again.`
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
await new Promise((r) => setTimeout(r, 3e3));
|
|
1416
|
+
}
|
|
1417
|
+
const port = await findFreePort(portPair);
|
|
1418
|
+
try {
|
|
1419
|
+
if (platform7 === "darwin") {
|
|
1420
|
+
await launchMacOS(targetIde, port, workspace, options.newWindow);
|
|
1421
|
+
} else if (platform7 === "win32") {
|
|
1422
|
+
await launchWindows(targetIde, port, workspace, options.newWindow);
|
|
1423
|
+
} else {
|
|
1424
|
+
await launchLinux(targetIde, port, workspace, options.newWindow);
|
|
1425
|
+
}
|
|
1426
|
+
let cdpReady = false;
|
|
1427
|
+
for (let i = 0; i < 30; i++) {
|
|
1428
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
1429
|
+
if (await isCdpActive(port)) {
|
|
1430
|
+
cdpReady = true;
|
|
1431
|
+
break;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
return {
|
|
1435
|
+
success: true,
|
|
1436
|
+
ideId: targetIde.id,
|
|
1437
|
+
ideName: targetIde.displayName,
|
|
1438
|
+
port,
|
|
1439
|
+
action: alreadyRunning ? "restarted" : "started",
|
|
1440
|
+
message: cdpReady ? `${targetIde.displayName} launched with CDP on port ${port}` : `${targetIde.displayName} launched (CDP may take a moment to initialize)`
|
|
1441
|
+
};
|
|
1442
|
+
} catch (e) {
|
|
1443
|
+
return {
|
|
1444
|
+
success: false,
|
|
1445
|
+
ideId: targetIde.id,
|
|
1446
|
+
ideName: targetIde.displayName,
|
|
1447
|
+
port,
|
|
1448
|
+
action: "failed",
|
|
1449
|
+
message: "",
|
|
1450
|
+
error: e?.message || String(e)
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
async function launchMacOS(ide, port, workspace, newWindow) {
|
|
1455
|
+
const appName = getMacAppIdentifiers()[ide.id];
|
|
1456
|
+
const args = ["--remote-debugging-port=" + port];
|
|
1457
|
+
if (newWindow) args.push("--new-window");
|
|
1458
|
+
if (workspace) args.push(workspace);
|
|
1459
|
+
if (appName) {
|
|
1460
|
+
const openArgs = ["-a", appName, "--args", ...args];
|
|
1461
|
+
(0, import_child_process3.spawn)("open", openArgs, { detached: true, stdio: "ignore" }).unref();
|
|
1462
|
+
} else if (ide.cliCommand) {
|
|
1463
|
+
(0, import_child_process3.spawn)(ide.cliCommand, args, { detached: true, stdio: "ignore" }).unref();
|
|
1464
|
+
} else {
|
|
1465
|
+
throw new Error(`No app identifier or CLI for ${ide.displayName}`);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
async function launchWindows(ide, port, workspace, newWindow) {
|
|
1469
|
+
const cli = ide.cliCommand;
|
|
1470
|
+
if (!cli) {
|
|
1471
|
+
throw new Error(`No CLI command for ${ide.displayName}. Please add it to PATH.`);
|
|
1472
|
+
}
|
|
1473
|
+
const parts = [`"${cli}"`, `--remote-debugging-port=${port}`];
|
|
1474
|
+
if (newWindow) parts.push("--new-window");
|
|
1475
|
+
if (workspace) parts.push(`"${workspace}"`);
|
|
1476
|
+
const fullCmd = parts.join(" ");
|
|
1477
|
+
const { exec: execCmd } = require("child_process");
|
|
1478
|
+
execCmd(fullCmd, { windowsHide: true }, () => {
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
async function launchLinux(ide, port, workspace, newWindow) {
|
|
1482
|
+
const cli = ide.cliCommand;
|
|
1483
|
+
if (!cli) {
|
|
1484
|
+
throw new Error(`No CLI command for ${ide.displayName}. Make sure it's in PATH.`);
|
|
1485
|
+
}
|
|
1486
|
+
const args = ["--remote-debugging-port=" + port];
|
|
1487
|
+
if (newWindow) args.push("--new-window");
|
|
1488
|
+
if (workspace) args.push(workspace);
|
|
1489
|
+
(0, import_child_process3.spawn)(cli, args, { detached: true, stdio: "ignore" }).unref();
|
|
1490
|
+
}
|
|
1491
|
+
var import_child_process3, net, os2, path2, _providerLoader;
|
|
1492
|
+
var init_launch = __esm({
|
|
1493
|
+
"src/launch.ts"() {
|
|
1494
|
+
"use strict";
|
|
1495
|
+
import_child_process3 = require("child_process");
|
|
1496
|
+
net = __toESM(require("net"));
|
|
1497
|
+
os2 = __toESM(require("os"));
|
|
1498
|
+
path2 = __toESM(require("path"));
|
|
1499
|
+
init_detector();
|
|
1500
|
+
init_provider_loader();
|
|
1501
|
+
_providerLoader = null;
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1555
1505
|
// src/daemon-cdp.ts
|
|
1556
1506
|
var import_ws3, http, DaemonCdpManager;
|
|
1557
1507
|
var init_daemon_cdp = __esm({
|
|
@@ -1579,6 +1529,7 @@ var init_daemon_cdp = __esm({
|
|
|
1579
1529
|
agentSessions = /* @__PURE__ */ new Map();
|
|
1580
1530
|
logFn;
|
|
1581
1531
|
extensionProviders = [];
|
|
1532
|
+
_lastDiscoverSig = "";
|
|
1582
1533
|
constructor(port = 9333, logFn) {
|
|
1583
1534
|
this.port = port;
|
|
1584
1535
|
this.logFn = logFn || ((msg) => {
|
|
@@ -1960,13 +1911,17 @@ var init_daemon_cdp = __esm({
|
|
|
1960
1911
|
typeMap.set(t.type, (typeMap.get(t.type) || 0) + 1);
|
|
1961
1912
|
}
|
|
1962
1913
|
const typeSummary = [...typeMap.entries()].map(([k, v]) => `${k}:${v}`).join(",");
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1914
|
+
const sig = `${allTargets.length}:${iframes.length}:${typeSummary}`;
|
|
1915
|
+
if (sig !== this._lastDiscoverSig) {
|
|
1916
|
+
this._lastDiscoverSig = sig;
|
|
1917
|
+
this.log(`[CDP] discoverAgentWebviews: ${allTargets.length} total [${typeSummary}], ${iframes.length} iframes (browser=${this._browserConnected})`);
|
|
1918
|
+
for (const t of allTargets) {
|
|
1919
|
+
if (t.type !== "page" && t.type !== "worker" && t.type !== "service_worker") {
|
|
1920
|
+
this.log(`[CDP] target: type=${t.type} url=${(t.url || "").substring(0, 120)}`);
|
|
1921
|
+
}
|
|
1922
|
+
if ((t.url || "").includes("vscode-webview")) {
|
|
1923
|
+
this.log(`[CDP] webview: type=${t.type} url=${(t.url || "").substring(0, 150)}`);
|
|
1924
|
+
}
|
|
1970
1925
|
}
|
|
1971
1926
|
}
|
|
1972
1927
|
const agents = [];
|
|
@@ -2370,14 +2325,14 @@ var require_lib = __commonJS({
|
|
|
2370
2325
|
});
|
|
2371
2326
|
|
|
2372
2327
|
// src/daemon-p2p.ts
|
|
2373
|
-
var fs2, path3,
|
|
2328
|
+
var fs2, path3, os3, logFile, log, DaemonP2PSender;
|
|
2374
2329
|
var init_daemon_p2p = __esm({
|
|
2375
2330
|
"src/daemon-p2p.ts"() {
|
|
2376
2331
|
"use strict";
|
|
2377
2332
|
fs2 = __toESM(require("fs"));
|
|
2378
2333
|
path3 = __toESM(require("path"));
|
|
2379
|
-
|
|
2380
|
-
logFile = path3.join(
|
|
2334
|
+
os3 = __toESM(require("os"));
|
|
2335
|
+
logFile = path3.join(os3.tmpdir(), "adhdev_daemon_p2p.log");
|
|
2381
2336
|
log = (msg) => {
|
|
2382
2337
|
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] [P2P] ${msg}`;
|
|
2383
2338
|
console.log(line);
|
|
@@ -2499,7 +2454,7 @@ var init_daemon_p2p = __esm({
|
|
|
2499
2454
|
async fetchTurnCredentials() {
|
|
2500
2455
|
try {
|
|
2501
2456
|
const serverUrl = "https://api.adhf.dev";
|
|
2502
|
-
const configPath = path3.join(
|
|
2457
|
+
const configPath = path3.join(os3.homedir(), ".adhdev", "config.json");
|
|
2503
2458
|
let token = "";
|
|
2504
2459
|
try {
|
|
2505
2460
|
const config = JSON.parse(fs2.readFileSync(configPath, "utf-8"));
|
|
@@ -2663,7 +2618,9 @@ var init_daemon_p2p = __esm({
|
|
|
2663
2618
|
const text = typeof msg === "string" ? msg : msg.toString("utf-8");
|
|
2664
2619
|
try {
|
|
2665
2620
|
const parsed = JSON.parse(text);
|
|
2666
|
-
|
|
2621
|
+
if (parsed.type !== "command" && parsed.type !== "pty_input" && parsed.type !== "pty_resize") {
|
|
2622
|
+
log(`Files message from peer ${peerId}: type=${parsed.type}`);
|
|
2623
|
+
}
|
|
2667
2624
|
if (parsed.type === "screenshot_start") {
|
|
2668
2625
|
const peer = this.peers.get(peerId);
|
|
2669
2626
|
if (peer) {
|
|
@@ -3078,14 +3035,14 @@ var init_scaffold_template = __esm({
|
|
|
3078
3035
|
});
|
|
3079
3036
|
|
|
3080
3037
|
// src/daemon/dev-server.ts
|
|
3081
|
-
var http2, fs3, path4,
|
|
3038
|
+
var http2, fs3, path4, os4, DEV_SERVER_PORT, DevServer;
|
|
3082
3039
|
var init_dev_server = __esm({
|
|
3083
3040
|
"src/daemon/dev-server.ts"() {
|
|
3084
3041
|
"use strict";
|
|
3085
3042
|
http2 = __toESM(require("http"));
|
|
3086
3043
|
fs3 = __toESM(require("fs"));
|
|
3087
3044
|
path4 = __toESM(require("path"));
|
|
3088
|
-
|
|
3045
|
+
os4 = __toESM(require("os"));
|
|
3089
3046
|
init_scaffold_template();
|
|
3090
3047
|
DEV_SERVER_PORT = 19280;
|
|
3091
3048
|
DevServer = class _DevServer {
|
|
@@ -3508,7 +3465,7 @@ var init_dev_server = __esm({
|
|
|
3508
3465
|
return;
|
|
3509
3466
|
}
|
|
3510
3467
|
const builtinDir = path4.resolve(__dirname, "../providers/_builtin");
|
|
3511
|
-
const userDir = path4.join(
|
|
3468
|
+
const userDir = path4.join(os4.homedir(), ".adhdev", "providers");
|
|
3512
3469
|
const possiblePaths = [
|
|
3513
3470
|
path4.join(userDir, type, "provider.js"),
|
|
3514
3471
|
path4.join(builtinDir, "ide", type, "provider.js"),
|
|
@@ -3533,7 +3490,7 @@ var init_dev_server = __esm({
|
|
|
3533
3490
|
return;
|
|
3534
3491
|
}
|
|
3535
3492
|
const builtinDir = path4.resolve(__dirname, "../providers/_builtin");
|
|
3536
|
-
const userDir = path4.join(
|
|
3493
|
+
const userDir = path4.join(os4.homedir(), ".adhdev", "providers");
|
|
3537
3494
|
const possiblePaths = [
|
|
3538
3495
|
path4.join(userDir, type, "provider.js"),
|
|
3539
3496
|
path4.join(builtinDir, "ide", type, "provider.js"),
|
|
@@ -3571,7 +3528,7 @@ var init_dev_server = __esm({
|
|
|
3571
3528
|
return;
|
|
3572
3529
|
}
|
|
3573
3530
|
const builtinDir = path4.resolve(__dirname, "../providers/_builtin");
|
|
3574
|
-
const userDir = path4.join(
|
|
3531
|
+
const userDir = path4.join(os4.homedir(), ".adhdev", "providers");
|
|
3575
3532
|
const possiblePaths = [
|
|
3576
3533
|
path4.join(userDir, type, "provider.js"),
|
|
3577
3534
|
path4.join(builtinDir, "ide", type, "provider.js"),
|
|
@@ -3694,7 +3651,7 @@ var init_dev_server = __esm({
|
|
|
3694
3651
|
const template = this.generateTemplate(type, name, category, { cdpPorts, cli, processName, installPath, binary, extensionId });
|
|
3695
3652
|
let targetDir;
|
|
3696
3653
|
if (location === "user") {
|
|
3697
|
-
targetDir = path4.join(
|
|
3654
|
+
targetDir = path4.join(os4.homedir(), ".adhdev", "providers", type);
|
|
3698
3655
|
} else {
|
|
3699
3656
|
const builtinDir = path4.resolve(__dirname, "../providers/_builtin");
|
|
3700
3657
|
targetDir = path4.join(builtinDir, category, type);
|
|
@@ -4184,14 +4141,14 @@ var init_daemon_cdp_devtools = __esm({
|
|
|
4184
4141
|
});
|
|
4185
4142
|
|
|
4186
4143
|
// src/daemon-commands.ts
|
|
4187
|
-
var fs4, path5,
|
|
4144
|
+
var fs4, path5, os5, DaemonCommandHandler;
|
|
4188
4145
|
var init_daemon_commands = __esm({
|
|
4189
4146
|
"src/daemon-commands.ts"() {
|
|
4190
4147
|
"use strict";
|
|
4191
4148
|
init_daemon_cdp_devtools();
|
|
4192
4149
|
fs4 = __toESM(require("fs"));
|
|
4193
4150
|
path5 = __toESM(require("path"));
|
|
4194
|
-
|
|
4151
|
+
os5 = __toESM(require("os"));
|
|
4195
4152
|
init_config();
|
|
4196
4153
|
DaemonCommandHandler = class {
|
|
4197
4154
|
ctx;
|
|
@@ -4203,12 +4160,10 @@ var init_daemon_commands = __esm({
|
|
|
4203
4160
|
getCdp(ideType) {
|
|
4204
4161
|
const key = ideType || this._currentIdeType;
|
|
4205
4162
|
if (!key) {
|
|
4206
|
-
console.log(`[getCdp] \u26A0 No ideType specified, cannot resolve CDP`);
|
|
4207
4163
|
return null;
|
|
4208
4164
|
}
|
|
4209
4165
|
const m = this.ctx.cdpManagers.get(key.toLowerCase());
|
|
4210
4166
|
if (m?.isConnected) return m;
|
|
4211
|
-
console.log(`[getCdp] \u26A0 Target IDE "${key}" CDP not available`);
|
|
4212
4167
|
return null;
|
|
4213
4168
|
}
|
|
4214
4169
|
/** Current IDE type extracted from command args (per-request) */
|
|
@@ -4314,7 +4269,12 @@ var init_daemon_commands = __esm({
|
|
|
4314
4269
|
async handle(cmd, args) {
|
|
4315
4270
|
this._currentIdeType = this.extractIdeType(args);
|
|
4316
4271
|
this._currentProviderType = args?.agentType || args?.providerType || this._currentIdeType;
|
|
4317
|
-
|
|
4272
|
+
if (!this._currentIdeType && !this._currentProviderType) {
|
|
4273
|
+
const cdpCommands = ["send_chat", "read_chat", "list_chats", "new_chat", "switch_chat", "set_mode", "change_model", "resolve_action"];
|
|
4274
|
+
if (cdpCommands.includes(cmd)) {
|
|
4275
|
+
return { success: false, error: "No ideType specified \u2014 cannot route command" };
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4318
4278
|
switch (cmd) {
|
|
4319
4279
|
// ─── CDP 직접 처리 ───────────────────
|
|
4320
4280
|
case "read_chat":
|
|
@@ -4935,7 +4895,7 @@ var init_daemon_commands = __esm({
|
|
|
4935
4895
|
return this.handleFileList(args);
|
|
4936
4896
|
}
|
|
4937
4897
|
resolveSafePath(requestedPath) {
|
|
4938
|
-
const home =
|
|
4898
|
+
const home = os5.homedir();
|
|
4939
4899
|
let resolved;
|
|
4940
4900
|
if (requestedPath.startsWith("~")) {
|
|
4941
4901
|
resolved = path5.join(home, requestedPath.slice(1));
|
|
@@ -4958,7 +4918,7 @@ var init_daemon_commands = __esm({
|
|
|
4958
4918
|
const config = loadConfig();
|
|
4959
4919
|
const cliRecent = config.recentCliWorkspaces || [];
|
|
4960
4920
|
try {
|
|
4961
|
-
const storageDir = path5.join(
|
|
4921
|
+
const storageDir = path5.join(os5.homedir(), "Library", "Application Support");
|
|
4962
4922
|
const candidates = ["Cursor", "Code", "VSCodium"];
|
|
4963
4923
|
for (const app of candidates) {
|
|
4964
4924
|
const stateFile = path5.join(storageDir, app, "User", "globalStorage", "state.vscdb");
|
|
@@ -5539,11 +5499,11 @@ var init_agent_stream = __esm({
|
|
|
5539
5499
|
});
|
|
5540
5500
|
|
|
5541
5501
|
// src/daemon-status.ts
|
|
5542
|
-
var
|
|
5502
|
+
var os6, path6, DaemonStatusReporter;
|
|
5543
5503
|
var init_daemon_status = __esm({
|
|
5544
5504
|
"src/daemon-status.ts"() {
|
|
5545
5505
|
"use strict";
|
|
5546
|
-
|
|
5506
|
+
os6 = __toESM(require("os"));
|
|
5547
5507
|
path6 = __toESM(require("path"));
|
|
5548
5508
|
init_config();
|
|
5549
5509
|
DaemonStatusReporter = class {
|
|
@@ -5694,15 +5654,15 @@ var init_daemon_status = __esm({
|
|
|
5694
5654
|
daemonMode: true,
|
|
5695
5655
|
machineNickname: loadConfig().machineNickname || null,
|
|
5696
5656
|
machine: {
|
|
5697
|
-
hostname:
|
|
5698
|
-
platform:
|
|
5699
|
-
release:
|
|
5700
|
-
arch:
|
|
5701
|
-
cpus:
|
|
5702
|
-
totalMem:
|
|
5703
|
-
freeMem:
|
|
5704
|
-
loadavg:
|
|
5705
|
-
uptime:
|
|
5657
|
+
hostname: os6.hostname(),
|
|
5658
|
+
platform: os6.platform(),
|
|
5659
|
+
release: os6.release(),
|
|
5660
|
+
arch: os6.arch(),
|
|
5661
|
+
cpus: os6.cpus().length,
|
|
5662
|
+
totalMem: os6.totalmem(),
|
|
5663
|
+
freeMem: os6.freemem(),
|
|
5664
|
+
loadavg: os6.loadavg(),
|
|
5665
|
+
uptime: os6.uptime()
|
|
5706
5666
|
},
|
|
5707
5667
|
managedIdes,
|
|
5708
5668
|
managedClis,
|
|
@@ -5738,7 +5698,7 @@ var init_daemon_status = __esm({
|
|
|
5738
5698
|
activeChat: managedClis[0]?.activeChat || managedIdes[0]?.activeChat || null,
|
|
5739
5699
|
agentStreams: managedIdes.flatMap((ide) => ide.agentStreams || []),
|
|
5740
5700
|
connectedExtensions: extSummary.connectedIdes,
|
|
5741
|
-
system: { platform:
|
|
5701
|
+
system: { platform: os6.platform(), hostname: os6.hostname() }
|
|
5742
5702
|
};
|
|
5743
5703
|
const p2pSent = this.sendP2PPayload(payload);
|
|
5744
5704
|
if (p2pSent) {
|
|
@@ -5751,11 +5711,11 @@ var init_daemon_status = __esm({
|
|
|
5751
5711
|
daemonMode: true,
|
|
5752
5712
|
machineNickname: payload.machineNickname,
|
|
5753
5713
|
machine: {
|
|
5754
|
-
hostname:
|
|
5755
|
-
platform:
|
|
5756
|
-
arch:
|
|
5757
|
-
cpus:
|
|
5758
|
-
totalMem:
|
|
5714
|
+
hostname: os6.hostname(),
|
|
5715
|
+
platform: os6.platform(),
|
|
5716
|
+
arch: os6.arch(),
|
|
5717
|
+
cpus: os6.cpus().length,
|
|
5718
|
+
totalMem: os6.totalmem()
|
|
5759
5719
|
},
|
|
5760
5720
|
managedIdes: managedIdes.map((ide) => ({
|
|
5761
5721
|
ideType: ide.ideType,
|
|
@@ -5814,20 +5774,20 @@ function stripAnsi(str) {
|
|
|
5814
5774
|
return str.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B\][^\x1B]*\x1B\\/g, "");
|
|
5815
5775
|
}
|
|
5816
5776
|
function findBinary(name) {
|
|
5817
|
-
const isWin =
|
|
5777
|
+
const isWin = os7.platform() === "win32";
|
|
5818
5778
|
try {
|
|
5819
5779
|
const cmd = isWin ? `where ${name}` : `which ${name}`;
|
|
5820
|
-
return (0,
|
|
5780
|
+
return (0, import_child_process4.execSync)(cmd, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n")[0].trim();
|
|
5821
5781
|
} catch {
|
|
5822
5782
|
return isWin ? `${name}.cmd` : name;
|
|
5823
5783
|
}
|
|
5824
5784
|
}
|
|
5825
|
-
var
|
|
5785
|
+
var os7, import_child_process4, pty, ProviderCliAdapter;
|
|
5826
5786
|
var init_provider_cli_adapter = __esm({
|
|
5827
5787
|
"src/cli-adapters/provider-cli-adapter.ts"() {
|
|
5828
5788
|
"use strict";
|
|
5829
|
-
|
|
5830
|
-
|
|
5789
|
+
os7 = __toESM(require("os"));
|
|
5790
|
+
import_child_process4 = require("child_process");
|
|
5831
5791
|
try {
|
|
5832
5792
|
pty = require("node-pty");
|
|
5833
5793
|
} catch {
|
|
@@ -5839,7 +5799,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
5839
5799
|
this.provider = provider2;
|
|
5840
5800
|
this.cliType = provider2.type;
|
|
5841
5801
|
this.cliName = provider2.name;
|
|
5842
|
-
this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/,
|
|
5802
|
+
this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/, os7.homedir()) : workingDir;
|
|
5843
5803
|
const t = provider2.timeouts || {};
|
|
5844
5804
|
this.timeouts = {
|
|
5845
5805
|
ptyFlush: t.ptyFlush ?? 50,
|
|
@@ -5897,7 +5857,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
5897
5857
|
if (!pty) throw new Error("node-pty is not installed");
|
|
5898
5858
|
const { spawn: spawnConfig } = this.provider;
|
|
5899
5859
|
const binaryPath = findBinary(spawnConfig.command);
|
|
5900
|
-
const isWin =
|
|
5860
|
+
const isWin = os7.platform() === "win32";
|
|
5901
5861
|
const allArgs = [...spawnConfig.args, ...this.extraArgs];
|
|
5902
5862
|
console.log(`[${this.cliType}] Spawning in ${this.workingDir}`);
|
|
5903
5863
|
let shellCmd;
|
|
@@ -6137,14 +6097,64 @@ var init_provider_cli_adapter = __esm({
|
|
|
6137
6097
|
}
|
|
6138
6098
|
});
|
|
6139
6099
|
|
|
6100
|
+
// src/cli-detector.ts
|
|
6101
|
+
async function detectCLIs() {
|
|
6102
|
+
const platform7 = os8.platform();
|
|
6103
|
+
const whichCmd = platform7 === "win32" ? "where" : "which";
|
|
6104
|
+
const results = [];
|
|
6105
|
+
for (const cli of KNOWN_CLIS) {
|
|
6106
|
+
try {
|
|
6107
|
+
const pathResult = (0, import_child_process5.execSync)(`${whichCmd} ${cli.command} 2>/dev/null`, {
|
|
6108
|
+
encoding: "utf-8",
|
|
6109
|
+
timeout: 5e3,
|
|
6110
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6111
|
+
}).trim().split("\n")[0];
|
|
6112
|
+
if (!pathResult) throw new Error("Not found");
|
|
6113
|
+
let version;
|
|
6114
|
+
try {
|
|
6115
|
+
const versionResult = (0, import_child_process5.execSync)(`${cli.command} --version 2>/dev/null`, {
|
|
6116
|
+
encoding: "utf-8",
|
|
6117
|
+
timeout: 5e3,
|
|
6118
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6119
|
+
}).trim();
|
|
6120
|
+
const match = versionResult.match(/(\d+\.\d+[\.\d]*)/);
|
|
6121
|
+
version = match ? match[1] : versionResult.split("\n")[0].slice(0, 30);
|
|
6122
|
+
} catch {
|
|
6123
|
+
}
|
|
6124
|
+
results.push({ ...cli, installed: true, version, path: pathResult });
|
|
6125
|
+
} catch {
|
|
6126
|
+
results.push({ ...cli, installed: false });
|
|
6127
|
+
}
|
|
6128
|
+
}
|
|
6129
|
+
return results;
|
|
6130
|
+
}
|
|
6131
|
+
async function detectCLI(cliId) {
|
|
6132
|
+
const normalizedId = cliId === "claude-cli" ? "claude-code" : cliId;
|
|
6133
|
+
const all = await detectCLIs();
|
|
6134
|
+
return all.find((c) => c.id === normalizedId && c.installed) || null;
|
|
6135
|
+
}
|
|
6136
|
+
var import_child_process5, os8, KNOWN_CLIS;
|
|
6137
|
+
var init_cli_detector = __esm({
|
|
6138
|
+
"src/cli-detector.ts"() {
|
|
6139
|
+
"use strict";
|
|
6140
|
+
import_child_process5 = require("child_process");
|
|
6141
|
+
os8 = __toESM(require("os"));
|
|
6142
|
+
KNOWN_CLIS = [
|
|
6143
|
+
{ id: "gemini-cli", displayName: "Gemini CLI", icon: "\u264A", command: "gemini" },
|
|
6144
|
+
{ id: "claude-code", displayName: "Claude Code", icon: "\u{1F916}", command: "claude" },
|
|
6145
|
+
{ id: "codex-cli", displayName: "Codex CLI", icon: "\u{1F9E0}", command: "codex" }
|
|
6146
|
+
];
|
|
6147
|
+
}
|
|
6148
|
+
});
|
|
6149
|
+
|
|
6140
6150
|
// src/daemon-cli.ts
|
|
6141
|
-
var os9, path7,
|
|
6151
|
+
var os9, path7, import_chalk, DaemonCliManager;
|
|
6142
6152
|
var init_daemon_cli = __esm({
|
|
6143
6153
|
"src/daemon-cli.ts"() {
|
|
6144
6154
|
"use strict";
|
|
6145
6155
|
os9 = __toESM(require("os"));
|
|
6146
6156
|
path7 = __toESM(require("path"));
|
|
6147
|
-
|
|
6157
|
+
import_chalk = __toESM(require("chalk"));
|
|
6148
6158
|
init_provider_cli_adapter();
|
|
6149
6159
|
init_cli_detector();
|
|
6150
6160
|
init_config();
|
|
@@ -6169,10 +6179,10 @@ var init_daemon_cli = __esm({
|
|
|
6169
6179
|
const normalizedType = typeMap[cliType] || cliType;
|
|
6170
6180
|
const provider2 = this.providerLoader.get(normalizedType);
|
|
6171
6181
|
if (provider2 && provider2.category === "cli" && provider2.patterns && provider2.spawn) {
|
|
6172
|
-
console.log(
|
|
6182
|
+
console.log(import_chalk.default.cyan(` \u{1F4E6} Using provider: ${provider2.name} (${provider2.type})`));
|
|
6173
6183
|
return new ProviderCliAdapter(provider2, workingDir, cliArgs);
|
|
6174
6184
|
}
|
|
6175
|
-
console.log(
|
|
6185
|
+
console.log(import_chalk.default.yellow(` \u26A0 No CLI provider for '${cliType}', falling back to generic`));
|
|
6176
6186
|
const fallbackProvider = this.providerLoader.get("gemini-cli");
|
|
6177
6187
|
if (fallbackProvider) {
|
|
6178
6188
|
return new ProviderCliAdapter(fallbackProvider, workingDir, cliArgs);
|
|
@@ -6187,10 +6197,10 @@ var init_daemon_cli = __esm({
|
|
|
6187
6197
|
if (!cliInfo) throw new Error(`${cliType} not found`);
|
|
6188
6198
|
const key = this.getCliKey(cliType, resolvedDir);
|
|
6189
6199
|
if (this.adapters.has(key)) {
|
|
6190
|
-
console.log(
|
|
6200
|
+
console.log(import_chalk.default.yellow(` \u26A1 CLI ${cliType} already running in ${resolvedDir}`));
|
|
6191
6201
|
return;
|
|
6192
6202
|
}
|
|
6193
|
-
console.log(
|
|
6203
|
+
console.log(import_chalk.default.yellow(` \u26A1 Starting CLI ${cliType} in ${resolvedDir}...`));
|
|
6194
6204
|
const adapter = this.createAdapter(cliType, resolvedDir, cliArgs);
|
|
6195
6205
|
await adapter.spawn();
|
|
6196
6206
|
const bridge = this.deps.getBridge();
|
|
@@ -6205,7 +6215,7 @@ var init_daemon_cli = __esm({
|
|
|
6205
6215
|
if (this.adapters.get(key) === adapter) {
|
|
6206
6216
|
this.adapters.delete(key);
|
|
6207
6217
|
this.deps.removeAgentTracking(key);
|
|
6208
|
-
console.log(
|
|
6218
|
+
console.log(import_chalk.default.yellow(` \u{1F9F9} Auto-cleaned stopped CLI: ${adapter.cliType}`));
|
|
6209
6219
|
this.deps.onStatusChange();
|
|
6210
6220
|
}
|
|
6211
6221
|
}, 3e3);
|
|
@@ -6217,7 +6227,7 @@ var init_daemon_cli = __esm({
|
|
|
6217
6227
|
});
|
|
6218
6228
|
}
|
|
6219
6229
|
this.adapters.set(key, adapter);
|
|
6220
|
-
console.log(
|
|
6230
|
+
console.log(import_chalk.default.green(` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
6221
6231
|
try {
|
|
6222
6232
|
addCliHistory({ cliType, dir: resolvedDir, cliArgs });
|
|
6223
6233
|
} catch (e) {
|
|
@@ -6231,7 +6241,7 @@ var init_daemon_cli = __esm({
|
|
|
6231
6241
|
adapter.shutdown();
|
|
6232
6242
|
this.adapters.delete(key);
|
|
6233
6243
|
this.deps.removeAgentTracking(key);
|
|
6234
|
-
console.log(
|
|
6244
|
+
console.log(import_chalk.default.yellow(` \u{1F6D1} CLI Agent stopped: ${adapter.cliType} in ${adapter.workingDir}`));
|
|
6235
6245
|
this.deps.onStatusChange();
|
|
6236
6246
|
}
|
|
6237
6247
|
}
|
|
@@ -6265,15 +6275,15 @@ var init_daemon_cli = __esm({
|
|
|
6265
6275
|
await this.startSession(cliType, dir, args?.cliArgs);
|
|
6266
6276
|
try {
|
|
6267
6277
|
const config = loadConfig();
|
|
6268
|
-
console.log(
|
|
6278
|
+
console.log(import_chalk.default.cyan(` \u{1F4C2} Saving recent workspace: ${dir}`));
|
|
6269
6279
|
const recent = config.recentCliWorkspaces || [];
|
|
6270
6280
|
if (!recent.includes(dir)) {
|
|
6271
6281
|
const updated = [dir, ...recent].slice(0, 10);
|
|
6272
6282
|
saveConfig({ ...config, recentCliWorkspaces: updated });
|
|
6273
|
-
console.log(
|
|
6283
|
+
console.log(import_chalk.default.green(` \u2713 Recent workspace saved: ${dir}`));
|
|
6274
6284
|
}
|
|
6275
6285
|
} catch (e) {
|
|
6276
|
-
console.error(
|
|
6286
|
+
console.error(import_chalk.default.red(` \u2717 Failed to save recent workspace: ${e}`));
|
|
6277
6287
|
}
|
|
6278
6288
|
}
|
|
6279
6289
|
return { success: true, cliType, dir, id: key };
|
|
@@ -6294,7 +6304,7 @@ var init_daemon_cli = __esm({
|
|
|
6294
6304
|
break;
|
|
6295
6305
|
}
|
|
6296
6306
|
}
|
|
6297
|
-
if (!found) console.log(
|
|
6307
|
+
if (!found) console.log(import_chalk.default.yellow(` \u26A0 No adapter found for ${cliType} (key: ${key})`));
|
|
6298
6308
|
}
|
|
6299
6309
|
return { success: true, cliType, dir, stopped: true };
|
|
6300
6310
|
}
|
|
@@ -7099,7 +7109,7 @@ function stopDaemon() {
|
|
|
7099
7109
|
return false;
|
|
7100
7110
|
}
|
|
7101
7111
|
}
|
|
7102
|
-
var os12, fs6, path9, crypto2,
|
|
7112
|
+
var os12, fs6, path9, crypto2, import_chalk2, DANGEROUS_PATTERNS, AdhdevDaemon;
|
|
7103
7113
|
var init_adhdev_daemon = __esm({
|
|
7104
7114
|
"src/adhdev-daemon.ts"() {
|
|
7105
7115
|
"use strict";
|
|
@@ -7123,7 +7133,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7123
7133
|
fs6 = __toESM(require("fs"));
|
|
7124
7134
|
path9 = __toESM(require("path"));
|
|
7125
7135
|
crypto2 = __toESM(require("crypto"));
|
|
7126
|
-
|
|
7136
|
+
import_chalk2 = __toESM(require("chalk"));
|
|
7127
7137
|
DANGEROUS_PATTERNS = [
|
|
7128
7138
|
/\brm\s+(-[a-z]*f|-[a-z]*r|--force|--recursive)/i,
|
|
7129
7139
|
/\bsudo\b/i,
|
|
@@ -7175,22 +7185,22 @@ var init_adhdev_daemon = __esm({
|
|
|
7175
7185
|
this.localPort = options.localPort || DEFAULT_DAEMON_PORT;
|
|
7176
7186
|
const workingDir = options.workingDir || process.cwd();
|
|
7177
7187
|
if (isDaemonRunning()) {
|
|
7178
|
-
console.log(
|
|
7179
|
-
console.log(
|
|
7188
|
+
console.log(import_chalk2.default.yellow("\n\u26A0 ADHDev Daemon is already running."));
|
|
7189
|
+
console.log(import_chalk2.default.gray(` Stop with: adhdev daemon:stop
|
|
7180
7190
|
`));
|
|
7181
7191
|
return;
|
|
7182
7192
|
}
|
|
7183
7193
|
writeDaemonPid(process.pid);
|
|
7184
7194
|
const config = loadConfig();
|
|
7185
7195
|
if (!config.connectionToken) {
|
|
7186
|
-
console.log(
|
|
7187
|
-
console.log(
|
|
7196
|
+
console.log(import_chalk2.default.red("\n\u2717 No connection token found."));
|
|
7197
|
+
console.log(import_chalk2.default.gray(" Run `adhdev setup` first.\n"));
|
|
7188
7198
|
process.exit(1);
|
|
7189
7199
|
}
|
|
7190
7200
|
this.localServer = new LocalServer({
|
|
7191
7201
|
port: this.localPort,
|
|
7192
7202
|
onExtensionConnected: (ext) => {
|
|
7193
|
-
console.log(
|
|
7203
|
+
console.log(import_chalk2.default.green(` \u{1F4CE} Extension connected: ${ext.ideType} v${ext.ideVersion}`));
|
|
7194
7204
|
this.localServer?.notifyServerState(
|
|
7195
7205
|
this.bridge?.isConnected() || false,
|
|
7196
7206
|
config.serverUrl
|
|
@@ -7198,7 +7208,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7198
7208
|
setTimeout(() => this.statusReporter?.throttledReport(), 500);
|
|
7199
7209
|
},
|
|
7200
7210
|
onExtensionDisconnected: (ext) => {
|
|
7201
|
-
console.log(
|
|
7211
|
+
console.log(import_chalk2.default.yellow(` \u{1F4CE} Extension disconnected: ${ext.ideType}`));
|
|
7202
7212
|
setTimeout(() => this.statusReporter?.throttledReport(), 500);
|
|
7203
7213
|
},
|
|
7204
7214
|
onExtensionStatus: () => {
|
|
@@ -7206,7 +7216,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7206
7216
|
},
|
|
7207
7217
|
onExtensionEvent: (ext, event, data) => {
|
|
7208
7218
|
if (event === "token_updated" && data.token) {
|
|
7209
|
-
console.log(
|
|
7219
|
+
console.log(import_chalk2.default.green(` \u{1F511} Token updated from Extension (${ext.ideType})`));
|
|
7210
7220
|
const cfg = loadConfig();
|
|
7211
7221
|
cfg.connectionToken = data.token;
|
|
7212
7222
|
saveConfig(cfg);
|
|
@@ -7214,7 +7224,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7214
7224
|
this.bridge.disconnect();
|
|
7215
7225
|
this.bridge.token = data.token;
|
|
7216
7226
|
this.bridge.connect().catch((e) => {
|
|
7217
|
-
console.error(
|
|
7227
|
+
console.error(import_chalk2.default.red(` \u2717 Reconnect failed: ${e.message}`));
|
|
7218
7228
|
});
|
|
7219
7229
|
}
|
|
7220
7230
|
}
|
|
@@ -7234,7 +7244,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7234
7244
|
try {
|
|
7235
7245
|
await this.localServer.start();
|
|
7236
7246
|
} catch (err) {
|
|
7237
|
-
console.error(
|
|
7247
|
+
console.error(import_chalk2.default.red(`
|
|
7238
7248
|
\u2717 Failed to start local server: ${err.message}`));
|
|
7239
7249
|
removeDaemonPid();
|
|
7240
7250
|
process.exit(1);
|
|
@@ -7270,7 +7280,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7270
7280
|
});
|
|
7271
7281
|
this.p2p = new DaemonP2PSender(this.bridge);
|
|
7272
7282
|
if (this.p2p.isAvailable) {
|
|
7273
|
-
console.log(
|
|
7283
|
+
console.log(import_chalk2.default.green(" \u{1F517} P2P available (node-datachannel)"));
|
|
7274
7284
|
this.p2p.onInput(async (event) => {
|
|
7275
7285
|
if (!this.commandHandler) throw new Error("No command handler");
|
|
7276
7286
|
return this.commandHandler.handle("cdp_remote_action", event);
|
|
@@ -7345,16 +7355,16 @@ var init_adhdev_daemon = __esm({
|
|
|
7345
7355
|
}
|
|
7346
7356
|
}, 200);
|
|
7347
7357
|
} else {
|
|
7348
|
-
console.log(
|
|
7358
|
+
console.log(import_chalk2.default.gray(" \u26A0 P2P unavailable \u2014 using server relay"));
|
|
7349
7359
|
}
|
|
7350
7360
|
this.registerServerHandlers();
|
|
7351
7361
|
this.bridge.onStateChange((state) => {
|
|
7352
7362
|
if (state === "connected") {
|
|
7353
|
-
console.log(
|
|
7363
|
+
console.log(import_chalk2.default.green(" \u{1F4E1} Connected to ADHDev server"));
|
|
7354
7364
|
this.localServer?.notifyServerState(true, config.serverUrl);
|
|
7355
7365
|
this.statusReporter?.sendUnifiedStatusReport();
|
|
7356
7366
|
} else if (state === "disconnected") {
|
|
7357
|
-
console.log(
|
|
7367
|
+
console.log(import_chalk2.default.yellow(" \u26A0 Server disconnected, will reconnect..."));
|
|
7358
7368
|
this.localServer?.notifyServerState(false, config.serverUrl);
|
|
7359
7369
|
}
|
|
7360
7370
|
});
|
|
@@ -7390,16 +7400,16 @@ var init_adhdev_daemon = __esm({
|
|
|
7390
7400
|
}
|
|
7391
7401
|
printBanner(options, serverUrl) {
|
|
7392
7402
|
console.log();
|
|
7393
|
-
console.log(
|
|
7394
|
-
console.log(` ${
|
|
7395
|
-
console.log(` ${
|
|
7403
|
+
console.log(import_chalk2.default.bold(" \u{1F309} ADHDev Daemon"));
|
|
7404
|
+
console.log(` ${import_chalk2.default.bold("Local:")} ws://127.0.0.1:${this.localPort}/ipc`);
|
|
7405
|
+
console.log(` ${import_chalk2.default.bold("Server:")} ${serverUrl}`);
|
|
7396
7406
|
const cdpStatus = this.cdpManagers.size > 0 ? `\u2705 ${[...this.cdpManagers.entries()].map(([k, m]) => `${k}:${m.getPort()}`).join(", ")}` : "\u274C not connected";
|
|
7397
|
-
console.log(` ${
|
|
7398
|
-
console.log(` ${
|
|
7399
|
-
console.log(` ${
|
|
7407
|
+
console.log(` ${import_chalk2.default.bold("CDP:")} ${cdpStatus}`);
|
|
7408
|
+
console.log(` ${import_chalk2.default.bold("P2P:")} ${this.p2p?.isAvailable ? "\u2705 available" : "\u274C unavailable"}`);
|
|
7409
|
+
console.log(` ${import_chalk2.default.bold("Providers:")} ${this.providerLoader.getAll().length > 0 ? `\u2705 ${this.providerLoader.getAll().map((p) => p.type).join(", ")}` : "\u274C not loaded"}`);
|
|
7400
7410
|
console.log();
|
|
7401
|
-
console.log(
|
|
7402
|
-
console.log(
|
|
7411
|
+
console.log(import_chalk2.default.gray(" Extensions can connect to the local server."));
|
|
7412
|
+
console.log(import_chalk2.default.gray(" Press Ctrl+C to stop.\n"));
|
|
7403
7413
|
}
|
|
7404
7414
|
// ─── 서버 명령 핸들러 ───────────────────────────
|
|
7405
7415
|
registerServerHandlers() {
|
|
@@ -7484,9 +7494,9 @@ var init_adhdev_daemon = __esm({
|
|
|
7484
7494
|
}
|
|
7485
7495
|
}
|
|
7486
7496
|
async handleCommand(msg, cmd, args) {
|
|
7487
|
-
console.log(
|
|
7497
|
+
console.log(import_chalk2.default.magenta(` \u2699 Command: ${cmd}`));
|
|
7488
7498
|
if (cmd.startsWith("agent_stream") && args?._targetInstance) {
|
|
7489
|
-
console.log(
|
|
7499
|
+
console.log(import_chalk2.default.yellow(` \u{1F3AF} Target: ${args._targetType}:${args._targetInstance.split("_")[0]} agent=${args.agentType || ""}`));
|
|
7490
7500
|
}
|
|
7491
7501
|
try {
|
|
7492
7502
|
switch (cmd) {
|
|
@@ -7539,7 +7549,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7539
7549
|
this.sendResult(msg, false, { error: `Command handler not initialized: ${cmd}` });
|
|
7540
7550
|
}
|
|
7541
7551
|
} catch (e) {
|
|
7542
|
-
console.error(
|
|
7552
|
+
console.error(import_chalk2.default.red(` \u2717 Command failed: ${e.message}`));
|
|
7543
7553
|
this.sendResult(msg, false, { error: e.message });
|
|
7544
7554
|
}
|
|
7545
7555
|
}
|
|
@@ -7605,15 +7615,15 @@ var init_adhdev_daemon = __esm({
|
|
|
7605
7615
|
console.log(`[launch_ide] target=${ideKey || "auto"}`);
|
|
7606
7616
|
const result = await launchWithCdp(launchArgs);
|
|
7607
7617
|
if (result.success && result.port && result.ideId && !this.cdpManagers.has(result.ideId)) {
|
|
7608
|
-
console.log(
|
|
7618
|
+
console.log(import_chalk2.default.cyan(`[launch_ide] Connecting CDP for ${result.ideId} on port ${result.port}...`));
|
|
7609
7619
|
const manager = new DaemonCdpManager(result.port, (msg) => {
|
|
7610
7620
|
console.log(`[CDP:${result.ideId}] ${msg}`);
|
|
7611
7621
|
});
|
|
7612
7622
|
const connected = await manager.connect();
|
|
7613
7623
|
if (connected) {
|
|
7614
7624
|
this.cdpManagers.set(result.ideId, manager);
|
|
7615
|
-
console.log(
|
|
7616
|
-
console.log(
|
|
7625
|
+
console.log(import_chalk2.default.green(` \u{1F50D} CDP connected: ${result.ideId} (port ${result.port})`));
|
|
7626
|
+
console.log(import_chalk2.default.green(` \u{1F4E1} CDP: ${this.cdpManagers.size} IDE(s) connected`));
|
|
7617
7627
|
}
|
|
7618
7628
|
}
|
|
7619
7629
|
this.startAgentStreamPolling();
|
|
@@ -7650,7 +7660,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7650
7660
|
async stop() {
|
|
7651
7661
|
if (!this.running) return;
|
|
7652
7662
|
this.running = false;
|
|
7653
|
-
console.log(
|
|
7663
|
+
console.log(import_chalk2.default.yellow("\n Shutting down ADHDev Daemon..."));
|
|
7654
7664
|
this.cliManager.shutdownAll();
|
|
7655
7665
|
this.instanceManager.disposeAll();
|
|
7656
7666
|
if (this.statusReporter) {
|
|
@@ -7670,7 +7680,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7670
7680
|
this.localServer?.stop();
|
|
7671
7681
|
this.bridge?.disconnect();
|
|
7672
7682
|
removeDaemonPid();
|
|
7673
|
-
console.log(
|
|
7683
|
+
console.log(import_chalk2.default.green(" \u2713 ADHDev Daemon stopped.\n"));
|
|
7674
7684
|
process.exit(0);
|
|
7675
7685
|
}
|
|
7676
7686
|
// ─── CDP 관리 ───────────────────────────────────
|
|
@@ -7753,7 +7763,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7753
7763
|
const actualPort = manager.getPort();
|
|
7754
7764
|
const actualIde = Object.entries(cdpPortMap).find(([, p]) => p === actualPort)?.[0] || ide;
|
|
7755
7765
|
this.cdpManagers.set(actualIde, manager);
|
|
7756
|
-
console.log(
|
|
7766
|
+
console.log(import_chalk2.default.green(` \u{1F50D} CDP connected: ${actualIde} (port ${actualPort})`));
|
|
7757
7767
|
if (this.ideType === "unknown") {
|
|
7758
7768
|
this.ideType = actualIde;
|
|
7759
7769
|
}
|
|
@@ -7776,7 +7786,7 @@ var init_adhdev_daemon = __esm({
|
|
|
7776
7786
|
}
|
|
7777
7787
|
}
|
|
7778
7788
|
if (this.cdpManagers.size > 0) {
|
|
7779
|
-
console.log(
|
|
7789
|
+
console.log(import_chalk2.default.green(` \u{1F4E1} CDP: ${this.cdpManagers.size} IDE(s) connected`));
|
|
7780
7790
|
this.cdpDiscoveryTimer = setInterval(async () => {
|
|
7781
7791
|
for (const m of this.cdpManagers.values()) {
|
|
7782
7792
|
if (m.isConnected) {
|
|
@@ -7785,8 +7795,8 @@ var init_adhdev_daemon = __esm({
|
|
|
7785
7795
|
}
|
|
7786
7796
|
}, 3e4);
|
|
7787
7797
|
} else {
|
|
7788
|
-
console.log(
|
|
7789
|
-
console.log(
|
|
7798
|
+
console.log(import_chalk2.default.yellow(` \u26A0 CDP not available \u2014 tried ports: ${portsToTry.map((p) => `${p.ide}:${p.port}`).join(", ")}`));
|
|
7799
|
+
console.log(import_chalk2.default.yellow(` IDE may need relaunch with --remote-debugging-port`));
|
|
7790
7800
|
}
|
|
7791
7801
|
}
|
|
7792
7802
|
};
|
|
@@ -7798,7 +7808,7 @@ var import_commander = require("commander");
|
|
|
7798
7808
|
var import_chalk4 = __toESM(require("chalk"));
|
|
7799
7809
|
|
|
7800
7810
|
// src/wizard.ts
|
|
7801
|
-
var
|
|
7811
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
7802
7812
|
var import_inquirer = __toESM(require("inquirer"));
|
|
7803
7813
|
var import_ora = __toESM(require("ora"));
|
|
7804
7814
|
var import_open = __toESM(require("open"));
|
|
@@ -8004,27 +8014,17 @@ async function installExtensions(ide, extensions, onProgress) {
|
|
|
8004
8014
|
function getAIExtensions() {
|
|
8005
8015
|
return EXTENSION_CATALOG.filter((e) => e.category === "ai-agent");
|
|
8006
8016
|
}
|
|
8007
|
-
function launchIDE(ide, workspacePath) {
|
|
8008
|
-
if (!ide.cliCommand) return false;
|
|
8009
|
-
try {
|
|
8010
|
-
const args = workspacePath ? `"${workspacePath}"` : "";
|
|
8011
|
-
(0, import_child_process2.exec)(`"${ide.cliCommand}" ${args}`, { timeout: 1e4 });
|
|
8012
|
-
return true;
|
|
8013
|
-
} catch {
|
|
8014
|
-
return false;
|
|
8015
|
-
}
|
|
8016
|
-
}
|
|
8017
8017
|
|
|
8018
8018
|
// src/wizard.ts
|
|
8019
8019
|
init_config();
|
|
8020
8020
|
var SERVER_URL = "https://api.adhf.dev";
|
|
8021
8021
|
var LOGO = `
|
|
8022
|
-
${
|
|
8023
|
-
${
|
|
8024
|
-
${
|
|
8025
|
-
${
|
|
8022
|
+
${import_chalk3.default.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}
|
|
8023
|
+
${import_chalk3.default.cyan("\u2551")} ${import_chalk3.default.bold.white("\u{1F309} ADHDev Setup Wizard")} ${import_chalk3.default.cyan("\u2551")}
|
|
8024
|
+
${import_chalk3.default.cyan("\u2551")} ${import_chalk3.default.gray("Agent Dashboard Hub for your IDE")} ${import_chalk3.default.cyan("\u2551")}
|
|
8025
|
+
${import_chalk3.default.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}
|
|
8026
8026
|
`;
|
|
8027
|
-
var DIVIDER =
|
|
8027
|
+
var DIVIDER = import_chalk3.default.gray("\u2500".repeat(44));
|
|
8028
8028
|
async function runWizard(options = {}) {
|
|
8029
8029
|
const loader = new ProviderLoader({ logFn: () => {
|
|
8030
8030
|
} });
|
|
@@ -8033,11 +8033,11 @@ async function runWizard(options = {}) {
|
|
|
8033
8033
|
console.log(LOGO);
|
|
8034
8034
|
if (isSetupComplete() && !options.force) {
|
|
8035
8035
|
const config = loadConfig();
|
|
8036
|
-
console.log(
|
|
8036
|
+
console.log(import_chalk3.default.green("\u2713") + " ADHDev is already set up!");
|
|
8037
8037
|
const ides = config.configuredIdes?.length ? config.configuredIdes.join(", ") : config.selectedIde || "none";
|
|
8038
|
-
console.log(
|
|
8039
|
-
console.log(
|
|
8040
|
-
console.log(
|
|
8038
|
+
console.log(import_chalk3.default.gray(` IDEs: ${ides}`));
|
|
8039
|
+
console.log(import_chalk3.default.gray(` User: ${config.userEmail || "not logged in"}`));
|
|
8040
|
+
console.log(import_chalk3.default.gray(` Extensions: ${config.installedExtensions.length} installed`));
|
|
8041
8041
|
console.log();
|
|
8042
8042
|
const { action } = await import_inquirer.default.prompt([
|
|
8043
8043
|
{
|
|
@@ -8045,6 +8045,7 @@ async function runWizard(options = {}) {
|
|
|
8045
8045
|
name: "action",
|
|
8046
8046
|
message: "What would you like to do?",
|
|
8047
8047
|
choices: [
|
|
8048
|
+
{ name: "\u{1F680} Start Daemon (connect IDEs & monitor agents)", value: "start-daemon" },
|
|
8048
8049
|
{ name: "\u{1F504} Reconfigure (run setup again)", value: "reconfigure" },
|
|
8049
8050
|
{ name: "\u{1F527} Install/Update CLI (adhdev command)", value: "install-cli" },
|
|
8050
8051
|
{ name: "\u{1F510} Re-login", value: "relogin" },
|
|
@@ -8053,6 +8054,10 @@ async function runWizard(options = {}) {
|
|
|
8053
8054
|
}
|
|
8054
8055
|
]);
|
|
8055
8056
|
if (action === "exit") return;
|
|
8057
|
+
if (action === "start-daemon") {
|
|
8058
|
+
await startDaemonFlow();
|
|
8059
|
+
return;
|
|
8060
|
+
}
|
|
8056
8061
|
if (action === "relogin") {
|
|
8057
8062
|
await loginFlow();
|
|
8058
8063
|
return;
|
|
@@ -8068,9 +8073,9 @@ async function runWizard(options = {}) {
|
|
|
8068
8073
|
name: "mode",
|
|
8069
8074
|
message: "Setup mode:",
|
|
8070
8075
|
choices: [
|
|
8071
|
-
{ name: `\u{1F680} ${
|
|
8072
|
-
{ name: `\u2699\uFE0F ${
|
|
8073
|
-
{ name: `\u{1F527} ${
|
|
8076
|
+
{ name: `\u{1F680} ${import_chalk3.default.bold("Quick Setup")} \u2014 Auto-detect IDEs, install bridge, login ${import_chalk3.default.gray("(recommended)")}`, value: "quick" },
|
|
8077
|
+
{ name: `\u2699\uFE0F ${import_chalk3.default.bold("Custom Setup")} \u2014 Choose IDE, AI extensions, and more`, value: "custom" },
|
|
8078
|
+
{ name: `\u{1F527} ${import_chalk3.default.bold("CLI Only")} \u2014 Install adhdev command globally`, value: "cli-only" }
|
|
8074
8079
|
]
|
|
8075
8080
|
}
|
|
8076
8081
|
]);
|
|
@@ -8083,27 +8088,27 @@ async function runWizard(options = {}) {
|
|
|
8083
8088
|
}
|
|
8084
8089
|
}
|
|
8085
8090
|
async function quickSetup() {
|
|
8086
|
-
console.log(
|
|
8091
|
+
console.log(import_chalk3.default.bold("\n\u{1F680} Quick Setup\n"));
|
|
8087
8092
|
const spinner = (0, import_ora.default)("Detecting installed IDEs...").start();
|
|
8088
8093
|
const ides = await detectIDEs();
|
|
8089
8094
|
const installedIDEs = ides.filter((i) => i.installed && i.cliCommand);
|
|
8090
8095
|
spinner.stop();
|
|
8091
8096
|
if (installedIDEs.length === 0) {
|
|
8092
|
-
console.log(
|
|
8093
|
-
console.log(
|
|
8097
|
+
console.log(import_chalk3.default.red("\u2717 No supported IDE with CLI found."));
|
|
8098
|
+
console.log(import_chalk3.default.gray(" Supported: VS Code, Cursor, Antigravity, Windsurf, VSCodium"));
|
|
8094
8099
|
return;
|
|
8095
8100
|
}
|
|
8096
|
-
console.log(
|
|
8101
|
+
console.log(import_chalk3.default.green(`Found ${installedIDEs.length} IDE(s):
|
|
8097
8102
|
`));
|
|
8098
8103
|
installedIDEs.forEach((ide) => {
|
|
8099
|
-
const version = ide.version ?
|
|
8100
|
-
console.log(` ${
|
|
8104
|
+
const version = ide.version ? import_chalk3.default.gray(` v${ide.version}`) : "";
|
|
8105
|
+
console.log(` ${import_chalk3.default.green("\u2713")} ${ide.icon} ${import_chalk3.default.bold(ide.displayName)}${version}`);
|
|
8101
8106
|
});
|
|
8102
8107
|
console.log();
|
|
8103
8108
|
let selectedIDEs;
|
|
8104
8109
|
if (installedIDEs.length === 1) {
|
|
8105
8110
|
selectedIDEs = installedIDEs;
|
|
8106
|
-
console.log(
|
|
8111
|
+
console.log(import_chalk3.default.gray(` Auto-selected: ${installedIDEs[0].displayName}
|
|
8107
8112
|
`));
|
|
8108
8113
|
} else {
|
|
8109
8114
|
const { selectedIdeIds } = await import_inquirer.default.prompt([
|
|
@@ -8112,7 +8117,7 @@ async function quickSetup() {
|
|
|
8112
8117
|
name: "selectedIdeIds",
|
|
8113
8118
|
message: "Select IDEs to set up (Space to toggle, Enter to confirm):",
|
|
8114
8119
|
choices: installedIDEs.map((ide) => ({
|
|
8115
|
-
name: `${ide.icon} ${ide.displayName}${ide.version ?
|
|
8120
|
+
name: `${ide.icon} ${ide.displayName}${ide.version ? import_chalk3.default.gray(` v${ide.version}`) : ""}`,
|
|
8116
8121
|
value: ide.id,
|
|
8117
8122
|
checked: true
|
|
8118
8123
|
// 기본 모두 선택
|
|
@@ -8135,7 +8140,7 @@ async function quickSetup() {
|
|
|
8135
8140
|
console.log(DIVIDER);
|
|
8136
8141
|
const loginResult = await loginFlow();
|
|
8137
8142
|
if (!loginResult) {
|
|
8138
|
-
console.log(
|
|
8143
|
+
console.log(import_chalk3.default.yellow("\u26A0 Setup completed without login. You can login later with `adhdev setup`."));
|
|
8139
8144
|
}
|
|
8140
8145
|
if (loginResult?.connectionToken) {
|
|
8141
8146
|
for (const ide of selectedIDEs) {
|
|
@@ -8152,57 +8157,59 @@ async function quickSetup() {
|
|
|
8152
8157
|
});
|
|
8153
8158
|
}
|
|
8154
8159
|
console.log(DIVIDER);
|
|
8155
|
-
console.log(
|
|
8160
|
+
console.log(import_chalk3.default.bold("\n\u{1F389} Setup Complete!\n"));
|
|
8156
8161
|
if (selectedIDEs.length === 1) {
|
|
8157
|
-
console.log(` ${
|
|
8162
|
+
console.log(` ${import_chalk3.default.bold("IDE:")} ${selectedIDEs[0].icon} ${selectedIDEs[0].displayName}`);
|
|
8158
8163
|
} else {
|
|
8159
|
-
console.log(` ${
|
|
8164
|
+
console.log(` ${import_chalk3.default.bold("IDEs:")} ${selectedIDEs.map((i) => `${i.icon} ${i.displayName}`).join(", ")}`);
|
|
8160
8165
|
}
|
|
8161
|
-
console.log(` ${
|
|
8162
|
-
console.log(` ${
|
|
8166
|
+
console.log(` ${import_chalk3.default.bold("User:")} ${loginResult?.email || "not logged in"}`);
|
|
8167
|
+
console.log(` ${import_chalk3.default.bold("Status:")} ${import_chalk3.default.green("Ready to connect")}`);
|
|
8163
8168
|
console.log();
|
|
8164
|
-
console.log(
|
|
8165
|
-
console.log(
|
|
8166
|
-
console.log(
|
|
8167
|
-
console.log(
|
|
8168
|
-
console.log(
|
|
8169
|
+
console.log(import_chalk3.default.gray(" Commands:"));
|
|
8170
|
+
console.log(import_chalk3.default.gray(" adhdev daemon \u2014 Start daemon (IDE monitor + agent hub)"));
|
|
8171
|
+
console.log(import_chalk3.default.gray(" adhdev launch cursor \u2014 Launch IDE with CDP"));
|
|
8172
|
+
console.log(import_chalk3.default.gray(" adhdev launch gemini \u2014 Start CLI agent via daemon"));
|
|
8173
|
+
console.log(import_chalk3.default.gray(" adhdev status \u2014 Check setup status"));
|
|
8174
|
+
console.log(import_chalk3.default.gray(" adhdev setup \u2014 Reconfigure"));
|
|
8169
8175
|
console.log();
|
|
8170
8176
|
await installCliOnly();
|
|
8177
|
+
await startDaemonFlow();
|
|
8171
8178
|
}
|
|
8172
8179
|
async function customSetup() {
|
|
8173
|
-
console.log(
|
|
8180
|
+
console.log(import_chalk3.default.bold("\n\u{1F4CD} Step 1/4 \u2014 Detecting installed IDEs...\n"));
|
|
8174
8181
|
const spinner = (0, import_ora.default)("Scanning your system...").start();
|
|
8175
8182
|
const ides = await detectIDEs();
|
|
8176
8183
|
const installedIDEs = ides.filter((i) => i.installed);
|
|
8177
8184
|
spinner.stop();
|
|
8178
8185
|
if (installedIDEs.length === 0) {
|
|
8179
|
-
console.log(
|
|
8186
|
+
console.log(import_chalk3.default.yellow("\u26A0 No supported IDEs found."));
|
|
8180
8187
|
return;
|
|
8181
8188
|
}
|
|
8182
|
-
console.log(
|
|
8189
|
+
console.log(import_chalk3.default.green(`Found ${installedIDEs.length} IDE(s):
|
|
8183
8190
|
`));
|
|
8184
8191
|
installedIDEs.forEach((ide) => {
|
|
8185
|
-
const version = ide.version ?
|
|
8186
|
-
const cli = ide.cliCommand ?
|
|
8187
|
-
console.log(` ${ide.icon} ${
|
|
8192
|
+
const version = ide.version ? import_chalk3.default.gray(` v${ide.version}`) : "";
|
|
8193
|
+
const cli = ide.cliCommand ? import_chalk3.default.gray(` (CLI: \u2713)`) : import_chalk3.default.yellow(` (CLI: \u2717 manual install)`);
|
|
8194
|
+
console.log(` ${ide.icon} ${import_chalk3.default.bold(ide.displayName)}${version}${cli}`);
|
|
8188
8195
|
});
|
|
8189
8196
|
console.log();
|
|
8190
8197
|
console.log(DIVIDER);
|
|
8191
|
-
console.log(
|
|
8198
|
+
console.log(import_chalk3.default.bold("\n\u{1F4CD} Step 2/4 \u2014 Select your primary IDE\n"));
|
|
8192
8199
|
const { selectedIdeId } = await import_inquirer.default.prompt([
|
|
8193
8200
|
{
|
|
8194
8201
|
type: "list",
|
|
8195
8202
|
name: "selectedIdeId",
|
|
8196
8203
|
message: "Which IDE?",
|
|
8197
8204
|
choices: installedIDEs.map((ide) => ({
|
|
8198
|
-
name: `${ide.icon} ${ide.displayName}${ide.version ?
|
|
8205
|
+
name: `${ide.icon} ${ide.displayName}${ide.version ? import_chalk3.default.gray(` v${ide.version}`) : ""}`,
|
|
8199
8206
|
value: ide.id
|
|
8200
8207
|
}))
|
|
8201
8208
|
}
|
|
8202
8209
|
]);
|
|
8203
8210
|
const selectedIDE = installedIDEs.find((i) => i.id === selectedIdeId);
|
|
8204
8211
|
console.log(DIVIDER);
|
|
8205
|
-
console.log(
|
|
8212
|
+
console.log(import_chalk3.default.bold("\n\u{1F4CD} Step 3/4 \u2014 Choose AI extensions\n"));
|
|
8206
8213
|
const aiExtensions = getAIExtensions();
|
|
8207
8214
|
const { selectedExtIds } = await import_inquirer.default.prompt([
|
|
8208
8215
|
{
|
|
@@ -8210,7 +8217,7 @@ async function customSetup() {
|
|
|
8210
8217
|
name: "selectedExtIds",
|
|
8211
8218
|
message: "Select AI extensions:",
|
|
8212
8219
|
choices: aiExtensions.map((ext) => ({
|
|
8213
|
-
name: `${ext.icon} ${ext.displayName} \u2014 ${
|
|
8220
|
+
name: `${ext.icon} ${ext.displayName} \u2014 ${import_chalk3.default.gray(ext.description)}`,
|
|
8214
8221
|
value: ext.id,
|
|
8215
8222
|
checked: ext.recommended
|
|
8216
8223
|
}))
|
|
@@ -8219,20 +8226,20 @@ async function customSetup() {
|
|
|
8219
8226
|
const bridgeExt = EXTENSION_CATALOG.find((e) => e.category === "bridge");
|
|
8220
8227
|
const selectedAIExts = aiExtensions.filter((e) => selectedExtIds.includes(e.id));
|
|
8221
8228
|
const allExtensions = [bridgeExt, ...selectedAIExts];
|
|
8222
|
-
console.log(
|
|
8229
|
+
console.log(import_chalk3.default.bold("\n\u{1F4CD} Step 4/4 \u2014 Installing extensions\n"));
|
|
8223
8230
|
if (selectedIDE.cliCommand) {
|
|
8224
8231
|
await installExtensions(
|
|
8225
8232
|
selectedIDE,
|
|
8226
8233
|
allExtensions,
|
|
8227
8234
|
(current, total, ext, result) => {
|
|
8228
|
-
const status = result.alreadyInstalled ?
|
|
8235
|
+
const status = result.alreadyInstalled ? import_chalk3.default.blue("already installed") : result.success ? import_chalk3.default.green("installed \u2713") : import_chalk3.default.red(`failed \u2717`);
|
|
8229
8236
|
console.log(` [${current}/${total}] ${ext.icon} ${ext.displayName} \u2014 ${status}`);
|
|
8230
8237
|
}
|
|
8231
8238
|
);
|
|
8232
8239
|
} else {
|
|
8233
|
-
console.log(
|
|
8240
|
+
console.log(import_chalk3.default.yellow("\u26A0 No CLI \u2014 install manually:"));
|
|
8234
8241
|
allExtensions.forEach((ext) => {
|
|
8235
|
-
console.log(
|
|
8242
|
+
console.log(import_chalk3.default.gray(` ${ext.icon} ${ext.displayName}: ${ext.marketplaceId}`));
|
|
8236
8243
|
});
|
|
8237
8244
|
}
|
|
8238
8245
|
console.log(DIVIDER);
|
|
@@ -8249,34 +8256,17 @@ async function customSetup() {
|
|
|
8249
8256
|
});
|
|
8250
8257
|
}
|
|
8251
8258
|
console.log(DIVIDER);
|
|
8252
|
-
console.log(
|
|
8253
|
-
console.log(` ${
|
|
8254
|
-
console.log(` ${
|
|
8255
|
-
console.log(` ${
|
|
8256
|
-
console.log(` ${
|
|
8259
|
+
console.log(import_chalk3.default.bold("\n\u{1F389} Setup Complete!\n"));
|
|
8260
|
+
console.log(` ${import_chalk3.default.bold("IDE:")} ${selectedIDE.icon} ${selectedIDE.displayName}`);
|
|
8261
|
+
console.log(` ${import_chalk3.default.bold("Extensions:")} ${allExtensions.length} installed`);
|
|
8262
|
+
console.log(` ${import_chalk3.default.bold("User:")} ${loginResult?.email || "not logged in"}`);
|
|
8263
|
+
console.log(` ${import_chalk3.default.bold("Status:")} ${import_chalk3.default.green("Ready to connect")}`);
|
|
8257
8264
|
console.log();
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
type: "confirm",
|
|
8261
|
-
name: "shouldLaunch",
|
|
8262
|
-
message: `Launch ${selectedIDE.displayName} now?`,
|
|
8263
|
-
default: true
|
|
8264
|
-
}
|
|
8265
|
-
]);
|
|
8266
|
-
if (shouldLaunch) {
|
|
8267
|
-
const launched = launchIDE(selectedIDE);
|
|
8268
|
-
if (launched) {
|
|
8269
|
-
console.log(import_chalk.default.green(`
|
|
8270
|
-
\u2713 ${selectedIDE.displayName} is starting...`));
|
|
8271
|
-
} else {
|
|
8272
|
-
console.log(import_chalk.default.yellow(`
|
|
8273
|
-
\u26A0 Could not launch automatically.`));
|
|
8274
|
-
}
|
|
8275
|
-
}
|
|
8276
|
-
console.log(import_chalk.default.gray("\nThank you for using ADHDev! \u{1F309}\n"));
|
|
8265
|
+
await startDaemonFlow();
|
|
8266
|
+
console.log(import_chalk3.default.gray("\nThank you for using ADHDev! \u{1F309}\n"));
|
|
8277
8267
|
}
|
|
8278
8268
|
async function loginFlow() {
|
|
8279
|
-
console.log(
|
|
8269
|
+
console.log(import_chalk3.default.bold("\n\u{1F510} Login to ADHDev\n"));
|
|
8280
8270
|
const { wantLogin } = await import_inquirer.default.prompt([
|
|
8281
8271
|
{
|
|
8282
8272
|
type: "confirm",
|
|
@@ -8306,17 +8296,17 @@ async function loginFlow() {
|
|
|
8306
8296
|
return null;
|
|
8307
8297
|
}
|
|
8308
8298
|
console.log();
|
|
8309
|
-
console.log(
|
|
8310
|
-
console.log(
|
|
8311
|
-
console.log(
|
|
8299
|
+
console.log(import_chalk3.default.cyan(" \u250C\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\u2510"));
|
|
8300
|
+
console.log(import_chalk3.default.cyan(" \u2502") + ` Your code: ${import_chalk3.default.bold.white(userCode)} ` + import_chalk3.default.cyan("\u2502"));
|
|
8301
|
+
console.log(import_chalk3.default.cyan(" \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\u2518"));
|
|
8312
8302
|
console.log();
|
|
8313
|
-
console.log(
|
|
8303
|
+
console.log(import_chalk3.default.gray(` Opening: ${verificationUrl}`));
|
|
8314
8304
|
console.log();
|
|
8315
8305
|
try {
|
|
8316
8306
|
await (0, import_open.default)(verificationUrl);
|
|
8317
|
-
console.log(
|
|
8307
|
+
console.log(import_chalk3.default.green(" \u2713 Browser opened \u2014 please sign in and approve"));
|
|
8318
8308
|
} catch {
|
|
8319
|
-
console.log(
|
|
8309
|
+
console.log(import_chalk3.default.yellow(` \u26A0 Could not open browser. Visit: ${verificationUrl}`));
|
|
8320
8310
|
}
|
|
8321
8311
|
const pollSpinner = (0, import_ora.default)("Waiting for authentication...").start();
|
|
8322
8312
|
const startTime = Date.now();
|
|
@@ -8335,7 +8325,7 @@ async function loginFlow() {
|
|
|
8335
8325
|
}
|
|
8336
8326
|
const data = await res.json();
|
|
8337
8327
|
if (data.status === "completed" && data.connectionToken) {
|
|
8338
|
-
pollSpinner.succeed(`Authenticated as ${
|
|
8328
|
+
pollSpinner.succeed(`Authenticated as ${import_chalk3.default.bold(data.user?.email || "user")}`);
|
|
8339
8329
|
return {
|
|
8340
8330
|
connectionToken: data.connectionToken,
|
|
8341
8331
|
email: data.user?.email,
|
|
@@ -8385,10 +8375,62 @@ async function injectTokenToIDE(ide, connectionToken) {
|
|
|
8385
8375
|
settings["adhdev.connectionToken"] = connectionToken;
|
|
8386
8376
|
settings["adhdev.autoConnect"] = true;
|
|
8387
8377
|
fs7.writeFileSync(settingsPath, JSON.stringify(settings, null, 4), "utf-8");
|
|
8388
|
-
console.log(
|
|
8378
|
+
console.log(import_chalk3.default.green(" \u2713 Connection token saved to IDE settings"));
|
|
8379
|
+
} catch (e) {
|
|
8380
|
+
console.log(import_chalk3.default.yellow(` \u26A0 Could not inject token: ${e.message}`));
|
|
8381
|
+
console.log(import_chalk3.default.gray(` You can set it manually: adhdev.connectionToken = ${connectionToken}`));
|
|
8382
|
+
}
|
|
8383
|
+
}
|
|
8384
|
+
async function startDaemonFlow() {
|
|
8385
|
+
const { isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
8386
|
+
if (isDaemonRunning2()) {
|
|
8387
|
+
console.log(import_chalk3.default.green(" \u2713 Daemon is already running"));
|
|
8388
|
+
console.log(import_chalk3.default.gray(" Dashboard: https://app.adhf.dev/dashboard\n"));
|
|
8389
|
+
return;
|
|
8390
|
+
}
|
|
8391
|
+
const { startDaemon } = await import_inquirer.default.prompt([
|
|
8392
|
+
{
|
|
8393
|
+
type: "confirm",
|
|
8394
|
+
name: "startDaemon",
|
|
8395
|
+
message: "Start ADHDev Daemon now? (IDE monitor + agent hub)",
|
|
8396
|
+
default: true
|
|
8397
|
+
}
|
|
8398
|
+
]);
|
|
8399
|
+
if (!startDaemon) {
|
|
8400
|
+
console.log(import_chalk3.default.gray(" Start later: adhdev daemon\n"));
|
|
8401
|
+
return;
|
|
8402
|
+
}
|
|
8403
|
+
const daemonSpinner = (0, import_ora.default)("Starting daemon...").start();
|
|
8404
|
+
try {
|
|
8405
|
+
const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
8406
|
+
const daemon = new AdhdevDaemon2();
|
|
8407
|
+
const { execSync: execSync6 } = await import("child_process");
|
|
8408
|
+
const os13 = await import("os");
|
|
8409
|
+
const path10 = await import("path");
|
|
8410
|
+
const logPath = path10.join(os13.homedir(), ".adhdev", "daemon.log");
|
|
8411
|
+
try {
|
|
8412
|
+
execSync6(`nohup adhdev daemon > "${logPath}" 2>&1 &`, {
|
|
8413
|
+
timeout: 3e3,
|
|
8414
|
+
stdio: "ignore"
|
|
8415
|
+
});
|
|
8416
|
+
} catch {
|
|
8417
|
+
daemon.start({ localPort: 19222, foreground: false }).catch(() => {
|
|
8418
|
+
});
|
|
8419
|
+
}
|
|
8420
|
+
await new Promise((r) => setTimeout(r, 2e3));
|
|
8421
|
+
if (isDaemonRunning2()) {
|
|
8422
|
+
daemonSpinner.succeed("Daemon started");
|
|
8423
|
+
console.log(import_chalk3.default.gray(" Dashboard: https://app.adhf.dev/dashboard"));
|
|
8424
|
+
console.log(import_chalk3.default.gray(` Logs: ${logPath}`));
|
|
8425
|
+
} else {
|
|
8426
|
+
daemonSpinner.succeed("Daemon starting in background");
|
|
8427
|
+
console.log(import_chalk3.default.gray(" Dashboard: https://app.adhf.dev/dashboard"));
|
|
8428
|
+
console.log(import_chalk3.default.gray(` Logs: ${logPath}`));
|
|
8429
|
+
}
|
|
8430
|
+
console.log();
|
|
8389
8431
|
} catch (e) {
|
|
8390
|
-
|
|
8391
|
-
console.log(
|
|
8432
|
+
daemonSpinner.fail(`Daemon start failed: ${e?.message || "Unknown"}`);
|
|
8433
|
+
console.log(import_chalk3.default.gray(" Manual: adhdev daemon\n"));
|
|
8392
8434
|
}
|
|
8393
8435
|
}
|
|
8394
8436
|
async function installCliOnly() {
|
|
@@ -8405,14 +8447,15 @@ async function installCliOnly() {
|
|
|
8405
8447
|
} catch {
|
|
8406
8448
|
}
|
|
8407
8449
|
const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
|
|
8408
|
-
console.log(
|
|
8409
|
-
console.log(
|
|
8410
|
-
console.log(
|
|
8411
|
-
console.log(
|
|
8412
|
-
console.log(
|
|
8450
|
+
console.log(import_chalk3.default.bold("\n\u{1F527} ADHDev CLI\n"));
|
|
8451
|
+
console.log(import_chalk3.default.gray(" The `adhdev` command lets you:"));
|
|
8452
|
+
console.log(import_chalk3.default.gray(" \u2022 Start daemon \u2014 IDE monitor + agent hub (adhdev daemon)"));
|
|
8453
|
+
console.log(import_chalk3.default.gray(" \u2022 Launch IDE with CDP (adhdev launch cursor)"));
|
|
8454
|
+
console.log(import_chalk3.default.gray(" \u2022 Start CLI agents (adhdev launch gemini)"));
|
|
8455
|
+
console.log(import_chalk3.default.gray(" \u2022 Check status (adhdev status)"));
|
|
8413
8456
|
console.log();
|
|
8414
8457
|
if (currentVersion) {
|
|
8415
|
-
console.log(
|
|
8458
|
+
console.log(import_chalk3.default.green(` \u2713 Currently installed: v${currentVersion}`));
|
|
8416
8459
|
if (!isNpx) {
|
|
8417
8460
|
const { doUpdate } = await import_inquirer.default.prompt([{
|
|
8418
8461
|
type: "confirm",
|
|
@@ -8422,10 +8465,10 @@ async function installCliOnly() {
|
|
|
8422
8465
|
}]);
|
|
8423
8466
|
if (!doUpdate) return;
|
|
8424
8467
|
} else {
|
|
8425
|
-
console.log(
|
|
8468
|
+
console.log(import_chalk3.default.gray(" Updating to latest..."));
|
|
8426
8469
|
}
|
|
8427
8470
|
} else {
|
|
8428
|
-
console.log(
|
|
8471
|
+
console.log(import_chalk3.default.yellow(" \u2717 Not installed globally"));
|
|
8429
8472
|
if (!isNpx) {
|
|
8430
8473
|
const { doInstall } = await import_inquirer.default.prompt([{
|
|
8431
8474
|
type: "confirm",
|
|
@@ -8434,11 +8477,11 @@ async function installCliOnly() {
|
|
|
8434
8477
|
default: true
|
|
8435
8478
|
}]);
|
|
8436
8479
|
if (!doInstall) {
|
|
8437
|
-
console.log(
|
|
8480
|
+
console.log(import_chalk3.default.gray("\n You can install later: npm install -g adhdev\n"));
|
|
8438
8481
|
return;
|
|
8439
8482
|
}
|
|
8440
8483
|
} else {
|
|
8441
|
-
console.log(
|
|
8484
|
+
console.log(import_chalk3.default.gray(" Installing globally..."));
|
|
8442
8485
|
}
|
|
8443
8486
|
}
|
|
8444
8487
|
const installSpinner = (0, import_ora.default)("Installing adhdev CLI...").start();
|
|
@@ -8458,17 +8501,17 @@ async function installCliOnly() {
|
|
|
8458
8501
|
} catch {
|
|
8459
8502
|
}
|
|
8460
8503
|
installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
|
|
8461
|
-
console.log(
|
|
8462
|
-
console.log(
|
|
8504
|
+
console.log(import_chalk3.default.gray(" Try: adhdev daemon"));
|
|
8505
|
+
console.log(import_chalk3.default.gray(" adhdev status"));
|
|
8463
8506
|
console.log();
|
|
8464
8507
|
} catch (e) {
|
|
8465
8508
|
installSpinner.fail("Install failed");
|
|
8466
|
-
console.log(
|
|
8509
|
+
console.log(import_chalk3.default.yellow(` Error: ${e?.message?.split("\n")[0] || "Unknown"}`));
|
|
8467
8510
|
const osModule = await import("os");
|
|
8468
8511
|
if (osModule.platform() === "win32") {
|
|
8469
|
-
console.log(
|
|
8512
|
+
console.log(import_chalk3.default.gray(" On Windows, run PowerShell as Administrator"));
|
|
8470
8513
|
}
|
|
8471
|
-
console.log(
|
|
8514
|
+
console.log(import_chalk3.default.gray(" Manual: npm install -g adhdev@latest"));
|
|
8472
8515
|
console.log();
|
|
8473
8516
|
}
|
|
8474
8517
|
}
|
|
@@ -8505,10 +8548,10 @@ _cliProviderLoader.loadAll();
|
|
|
8505
8548
|
_cliProviderLoader.registerToDetector();
|
|
8506
8549
|
var program = new import_commander.Command();
|
|
8507
8550
|
program.name("adhdev").description("\u{1F309} ADHDev \u2014 Agent Dashboard Hub for your IDE").version(pkgVersion);
|
|
8508
|
-
program.command("setup").description("Run the interactive setup wizard").option("-f, --force", "Force re-run setup even if already configured").action(async (options) => {
|
|
8551
|
+
program.command("setup").description("Run the interactive setup wizard (detect IDEs, install bridge, login)").option("-f, --force", "Force re-run setup even if already configured").action(async (options) => {
|
|
8509
8552
|
await runWizard({ force: options.force });
|
|
8510
8553
|
});
|
|
8511
|
-
program.command("launch [target]").description("Launch IDE with CDP or start CLI agent (
|
|
8554
|
+
program.command("launch [target]").description("Launch IDE with CDP or start CLI agent (e.g. cursor, gemini, claude)").option("-w, --workspace <path>", "Workspace/folder to open").option("-n, --new-window", "Open in a new window").option("-d, --dir <path>", "Working directory for CLI agent", process.cwd()).action(async (targetArg, options) => {
|
|
8512
8555
|
const CLI_ALIASES = {
|
|
8513
8556
|
"claude": "claude-code",
|
|
8514
8557
|
"claude-code": "claude-code",
|
|
@@ -8753,7 +8796,7 @@ program.command("reset").description("Reset ADHDev configuration").action(async
|
|
|
8753
8796
|
console.log(import_chalk4.default.gray(" Run `adhdev setup` to reconfigure.\n"));
|
|
8754
8797
|
}
|
|
8755
8798
|
});
|
|
8756
|
-
program.command("daemon").description("Start ADHDev Daemon \u2014 unified
|
|
8799
|
+
program.command("daemon").description("\u{1F680} Start ADHDev Daemon \u2014 unified hub for IDE monitoring, agent management, and remote control").option("-p, --port <port>", "Local WS server port", "19222").option("--server <url>", "Override server URL for testing").option("--dev", "Enable Dev Mode \u2014 HTTP API on :19280 for script debugging").action(async (options) => {
|
|
8757
8800
|
const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
8758
8801
|
const daemon = new AdhdevDaemon2();
|
|
8759
8802
|
await daemon.start({
|