feat(claude): добавлен запуск Desktop через прокси
- Зачем: - нужен отдельный запуск Claude Desktop через hproxy.local без системного прокси. - Что: - добавлен PowerShell-скрипт с переменными прокси и параметрами Electron. - добавлено идемпотентное создание ярлыка Claude Proxy через chezmoi. - описано правило полного закрытия уже запущенного Claude. - Проверка: - проверены PowerShell-синтаксис, аргументы запуска и WSLENV через подмену Start-Process. - двумя прогонами с подменой COM проверена идемпотентность создания ярлыка. - выполнены chezmoi managed и git diff --cached --check.
This commit is contained in:
1 parent
051801efbe
commit
5286859533
3 files changed
+143
No files matched your search
@@ -64,6 +64,7 @@ Chezmoi использует отдельный source dir `chezmoi/` внутр
|
||||
- **WezTerm** — `~/.wezterm.lua` как живая ссылка на `wezterm/.wezterm.lua` в репозитории
|
||||
- **UTF-8** — `chcp 65001` + `Console.InputEncoding/OutputEncoding` только для pwsh 7, не для PS 5.1
|
||||
- **Codex Proxy shortcut** — Start Menu ярлык для запуска Codex GUI с proxy-переменными
|
||||
- **Claude Proxy** — ярлык меню «Пуск» для запуска Claude Desktop с переменными прокси
|
||||
- **Extension points** — `~/.config/powershell/profile.extra.ps1` и `profile.d/*.ps1` для локальных добавок
|
||||
|
||||
### AI-инструменты (кросс-платформа)
|
||||
@@ -106,6 +107,11 @@ Linux/Bash-интерфейс `proxy-client` поддерживает внешн
|
||||
описаны рядом с пакетом. Windows PowerShell и ярлык `Codex Proxy` сохраняют
|
||||
прежнюю интеграцию с `hproxy.local:12334`.
|
||||
|
||||
`Claude Proxy` передаёт переменные прокси и параметры Electron
|
||||
`--proxy-server` и `--proxy-bypass-list`, чтобы прокси применялся ко всему
|
||||
трафику Claude Desktop. Если Claude уже запущен обычным способом, его нужно
|
||||
полностью закрыть перед запуском через `Claude Proxy`.
|
||||
|
||||
### Git baseline
|
||||
|
||||
На всех платформах фиксируются настройки для предсказуемого поведения:
|
||||
@@ -171,6 +177,7 @@ Linux/Bash-интерфейс `proxy-client` поддерживает внешн
|
||||
| `~/.env.secrets` | API-ключи, подгружается bash и VS Code Server |
|
||||
| `~/.bash_aliases` | Персональные алиасы bash |
|
||||
| `~/.gitconfig.local` | Персональные Git-настройки (`user.name`, `core.editor` и т.д.) |
|
||||
| `~/.local/bin/start-claude-proxy.ps1` | Скрипт запуска Claude Desktop для Windows с переменными прокси и параметрами Electron |
|
||||
| `~/.local/bin/start-codex-proxy.ps1` | Windows launcher для Codex GUI с proxy-переменными |
|
||||
| `~/.config/powershell/profile.extra.ps1` | Локальные дополнения к pwsh-профилю |
|
||||
| `~/.config/powershell/profile.d/*.ps1` | Фрагменты, загружаемые по алфавиту |
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if (-not ($IsWindows -or $PSVersionTable.PSEdition -eq 'Desktop')) {
|
||||
return
|
||||
}
|
||||
|
||||
$LauncherPath = Join-Path $HOME '.local\bin\start-claude-proxy.ps1'
|
||||
$ProgramsPath = [Environment]::GetFolderPath('Programs')
|
||||
if ([string]::IsNullOrWhiteSpace($ProgramsPath)) {
|
||||
Write-Warning 'Start Menu Programs folder was not found.'
|
||||
return
|
||||
}
|
||||
|
||||
$ShortcutPath = Join-Path $ProgramsPath 'Claude Proxy.lnk'
|
||||
$PwshAliasPath = Join-Path $env:LOCALAPPDATA 'Microsoft\WindowsApps\pwsh.exe'
|
||||
$PwshCommand = Get-Command pwsh -ErrorAction SilentlyContinue
|
||||
if (Test-Path -LiteralPath $PwshAliasPath) {
|
||||
$TargetPath = $PwshAliasPath
|
||||
} elseif ($null -ne $PwshCommand) {
|
||||
$TargetPath = $PwshCommand.Source
|
||||
} else {
|
||||
$TargetPath = 'pwsh.exe'
|
||||
}
|
||||
|
||||
$Arguments = "-NoLogo -NoProfile -ExecutionPolicy Bypass -File `"$LauncherPath`""
|
||||
$WorkingDirectory = $env:USERPROFILE
|
||||
$ClaudeExecutable = Join-Path $env:LOCALAPPDATA 'AnthropicClaude\claude.exe'
|
||||
if (Test-Path -LiteralPath $ClaudeExecutable) {
|
||||
$IconLocation = "$ClaudeExecutable,0"
|
||||
} else {
|
||||
$IconLocation = "$TargetPath,0"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path (Split-Path -Parent $ShortcutPath) -Force | Out-Null
|
||||
|
||||
$Shell = New-Object -ComObject WScript.Shell
|
||||
$Shortcut = $Shell.CreateShortcut($ShortcutPath)
|
||||
|
||||
$Changed = $false
|
||||
if ($Shortcut.TargetPath -ne $TargetPath) {
|
||||
$Shortcut.TargetPath = $TargetPath
|
||||
$Changed = $true
|
||||
}
|
||||
if ($Shortcut.Arguments -ne $Arguments) {
|
||||
$Shortcut.Arguments = $Arguments
|
||||
$Changed = $true
|
||||
}
|
||||
if ($Shortcut.WorkingDirectory -ne $WorkingDirectory) {
|
||||
$Shortcut.WorkingDirectory = $WorkingDirectory
|
||||
$Changed = $true
|
||||
}
|
||||
if ($Shortcut.IconLocation -ne $IconLocation) {
|
||||
$Shortcut.IconLocation = $IconLocation
|
||||
$Changed = $true
|
||||
}
|
||||
if ($Shortcut.Description -ne 'Launch Claude with hproxy.local proxy environment') {
|
||||
$Shortcut.Description = 'Launch Claude with hproxy.local proxy environment'
|
||||
$Changed = $true
|
||||
}
|
||||
|
||||
if ($Changed -or -not (Test-Path -LiteralPath $ShortcutPath)) {
|
||||
$Shortcut.Save()
|
||||
Write-Host "Claude Proxy shortcut: updated $ShortcutPath"
|
||||
} else {
|
||||
Write-Host 'Claude Proxy shortcut: already up to date.'
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$ProxyHostName = 'hproxy.local'
|
||||
$ProxyPort = 12334
|
||||
$HttpProxy = "http://${ProxyHostName}:${ProxyPort}"
|
||||
$SocksProxy = "socks5://${ProxyHostName}:${ProxyPort}"
|
||||
$NoProxy = "${ProxyHostName},localhost,127.0.0.1,::1,[::1],.concept-software.ru"
|
||||
$ProxyBypassList = "${ProxyHostName};localhost;127.0.0.1;[::1];*.concept-software.ru"
|
||||
|
||||
function Set-ProxyEnvironment {
|
||||
$env:HTTP_PROXY = $HttpProxy
|
||||
$env:HTTPS_PROXY = $HttpProxy
|
||||
$env:ALL_PROXY = $SocksProxy
|
||||
$env:NO_PROXY = $NoProxy
|
||||
|
||||
$env:http_proxy = $HttpProxy
|
||||
$env:https_proxy = $HttpProxy
|
||||
$env:all_proxy = $SocksProxy
|
||||
$env:no_proxy = $NoProxy
|
||||
}
|
||||
|
||||
function Add-WslEnvEntries {
|
||||
$RequiredEntries = @(
|
||||
'HTTP_PROXY/u',
|
||||
'HTTPS_PROXY/u',
|
||||
'ALL_PROXY/u',
|
||||
'NO_PROXY/u',
|
||||
'http_proxy/u',
|
||||
'https_proxy/u',
|
||||
'all_proxy/u',
|
||||
'no_proxy/u'
|
||||
)
|
||||
|
||||
$Entries = New-Object System.Collections.Generic.List[string]
|
||||
if (-not [string]::IsNullOrWhiteSpace($env:WSLENV)) {
|
||||
foreach ($Entry in ($env:WSLENV -split ':')) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($Entry) -and -not $Entries.Contains($Entry)) {
|
||||
[void]$Entries.Add($Entry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($Entry in $RequiredEntries) {
|
||||
if (-not $Entries.Contains($Entry)) {
|
||||
[void]$Entries.Add($Entry)
|
||||
}
|
||||
}
|
||||
|
||||
$env:WSLENV = [string]::Join(':', $Entries)
|
||||
}
|
||||
|
||||
function Get-ClaudeExecutable {
|
||||
$Executable = Join-Path $env:LOCALAPPDATA 'AnthropicClaude\claude.exe'
|
||||
if (-not (Test-Path -LiteralPath $Executable)) {
|
||||
throw "Claude Desktop executable was not found: $Executable"
|
||||
}
|
||||
|
||||
return $Executable
|
||||
}
|
||||
|
||||
Set-ProxyEnvironment
|
||||
Add-WslEnvEntries
|
||||
|
||||
$ClaudeExecutable = Get-ClaudeExecutable
|
||||
$ClaudeArguments = @(
|
||||
"--proxy-server=${HttpProxy}",
|
||||
"--proxy-bypass-list=${ProxyBypassList}"
|
||||
)
|
||||
|
||||
Start-Process -FilePath $ClaudeExecutable -ArgumentList $ClaudeArguments
|
||||
Reference in new issue
Block a user