Skip to content

Commit 52e72c8

Browse files
nang-devnang-dev2
andcommitted
Aider added updating and not using url (#194)
* Fixed build * Added working * Added --no-detect-urls --------- Co-authored-by: nang-dev <[email protected]>
1 parent 331ae26 commit 52e72c8

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

extensions/vscode/src/integrations/aider/aiderProcess.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as cp from "child_process";
22
import * as vscode from "vscode";
33
import * as os from "os";
4-
import { execSync } from "child_process";
4+
import { execSync, exec } from "child_process";
55
import { AiderState } from "./types/aiderTypes";
66
import { PearAICredentials } from "core/pearaiServer/PearAICredentials";
77
import {
@@ -28,20 +28,52 @@ export const AIDER_QUESTION_MARKER = "[Yes]\\:";
2828
export const AIDER_END_MARKER = "─────────────────────────────────────";
2929
export const COMPLETION_DELAY = 1500; // 1.5 seconds wait time
3030

31+
function getAiderVersion(): string {
32+
try {
33+
const versionOutput = execSync('aider --version').toString().trim();
34+
// Extract version number from output (e.g., "aider v0.64.2" -> "0.64.2")
35+
const match = versionOutput.match(/v?(\d+\.\d+\.\d+)/);
36+
return match ? match[1] : "0.0.0";
37+
} catch (error) {
38+
console.error("Error getting aider version:", error);
39+
return "0.0.0";
40+
}
41+
}
42+
43+
function compareVersions(v1: string, v2: string): number {
44+
const parts1 = v1.split('.').map(Number);
45+
const parts2 = v2.split('.').map(Number);
46+
47+
for (let i = 0; i < 3; i++) {
48+
if (parts1[i] > parts2[i]) return 1;
49+
if (parts1[i] < parts2[i]) return -1;
50+
}
51+
return 0;
52+
}
53+
3154
export function buildAiderCommand(model: string, accessToken: string | undefined, apiKey: string | undefined): string[] {
3255
const aiderCommand = ["aider"];
3356

57+
const currentVersion = getAiderVersion();
58+
console.dir("CURRENT VERSION")
59+
console.dir(currentVersion)
60+
const minVersionForNoDetectUrls = "0.64.2";
61+
3462
let aiderFlags = [
3563
"--no-pretty",
3664
"--yes-always",
3765
"--no-auto-commits",
3866
"--no-suggest-shell-commands",
39-
"--no-check-update",
4067
"--no-auto-lint",
4168
"--map-tokens", "2048",
42-
"--subtree-only"
69+
"--subtree-only",
4370
];
4471

72+
// Add --no-detect-urls flag if version is >= 0.64.2
73+
if (compareVersions(currentVersion, minVersionForNoDetectUrls) >= 0) {
74+
aiderFlags.push("--no-detect-urls");
75+
}
76+
4577
aiderCommand.push(...aiderFlags);
4678

4779
if (model === "pearai_model") {

extensions/vscode/src/integrations/aider/aiderUtil.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export async function startAiderProcess(core: Core) {
5050
await aiderModel.setAiderState({state: "uninstalled"});
5151
return;
5252
}
53+
5354

5455
try {
5556
await aiderModel.startAiderChat(aiderModel.model, aiderModel.apiKey);

0 commit comments

Comments
 (0)