@@ -2,12 +2,30 @@ $PSDefaultParameterValues['Import-Module:Verbose'] = $false
2
2
3
3
# Auto-configure aider environment variables for .aitools directory
4
4
try {
5
- $env: AIDER_CONFIG_FILE = (Resolve-Path " $PSScriptRoot /.aider.conf.yml" ).Path
6
- $env: AIDER_ENV_FILE = (Resolve-Path " $PSScriptRoot /.env" ).Path
7
- $env: AIDER_MODEL_SETTINGS_FILE = (Resolve-Path " $PSScriptRoot /.aider.model.settings.yml" ).Path
8
- $env: AIDER_INPUT_HISTORY_FILE = (Resolve-Path " $PSScriptRoot /.aider/aider.input.history" ).Path
9
- $env: AIDER_CHAT_HISTORY_FILE = (Resolve-Path " $PSScriptRoot /.aider/aider.chat.history.md" ).Path
10
- $env: AIDER_LLM_HISTORY_FILE = (Resolve-Path " $PSScriptRoot /.aider/aider.llm.history" ).Path
5
+ # Use Join-Path instead of Resolve-Path to avoid "path does not exist" errors
6
+ $env: AIDER_CONFIG_FILE = Join-Path $PSScriptRoot " .aider.conf.yml"
7
+ $env: AIDER_ENV_FILE = Join-Path $PSScriptRoot " .env"
8
+ $env: AIDER_MODEL_SETTINGS_FILE = Join-Path $PSScriptRoot " .aider.model.settings.yml"
9
+
10
+ # Ensure .aider directory exists before setting history file paths
11
+ $aiderDir = Join-Path $PSScriptRoot " .aider"
12
+ if (-not (Test-Path $aiderDir )) {
13
+ New-Item - Path $aiderDir - ItemType Directory - Force | Out-Null
14
+ Write-Verbose " Created .aider directory: $aiderDir "
15
+ }
16
+
17
+ $env: AIDER_INPUT_HISTORY_FILE = Join-Path $aiderDir " aider.input.history"
18
+ $env: AIDER_CHAT_HISTORY_FILE = Join-Path $aiderDir " aider.chat.history.md"
19
+ $env: AIDER_LLM_HISTORY_FILE = Join-Path $aiderDir " aider.llm.history"
20
+
21
+ # Create empty history files if they don't exist
22
+ @ ($env: AIDER_INPUT_HISTORY_FILE , $env: AIDER_CHAT_HISTORY_FILE , $env: AIDER_LLM_HISTORY_FILE ) | ForEach-Object {
23
+ if (-not (Test-Path $_ )) {
24
+ New-Item - Path $_ - ItemType File - Force | Out-Null
25
+ Write-Verbose " Created aider history file: $_ "
26
+ }
27
+ }
28
+
11
29
Write-Verbose " Aider environment configured for .aitools directory"
12
30
} catch {
13
31
Write-Verbose " Could not configure aider environment: $_ "
0 commit comments