From ab0bdfbc1fcbd7ddbe1a01b82d1aaf9f29673ccd Mon Sep 17 00:00:00 2001 From: WillowDev <216433317+willowdev-code@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:39:17 +0100 Subject: [PATCH] ADO Lens 0.12.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed: the install (`get.ps1` / `install.ps1`) could wait for Claude Desktop to close forever, although it was closed: - only Claude Desktop of your own Windows session counts now - on a server with remote desktop sessions another user's Claude was seen too (in an elevated window even with its path), and it never closes for you; - the Claude Code CLI shipped with Claude Desktop (claude.exe under …\claude-code\…) no longer counts as Claude Desktop; - while waiting it names what is still running (PID and path) every 20 seconds; **S** skips the registration (`adolens register` later), and after 10 minutes it is skipped by itself; - run from a terminal inside Claude (e.g. its Code tab, or `ado_upgrade` of a ZIP install), it installs the program and says to register it from a regular window, instead of waiting for Claude to close itself. - `adolens register`, when Claude Desktop runs, lists its processes in this session. - README: run the one-line install in a regular PowerShell window, not as administrator and not inside Claude. --- CHANGELOG.md | 15 ++++++ README.md | 8 +++- README.pl.md | 8 +++- install.ps1 | 63 ++++++++++++++++++++++--- src/AdoLens/AdoLens.csproj | 2 +- src/AdoLens/ClaudeConfigs.cs | 23 ++++++--- src/AdoLens/Cli.cs | 3 +- tests/AdoLens.Tests/ImprovementTests.cs | 9 ++++ 8 files changed, 112 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b5e8a8..6de8adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.12.1 — 2026-11-04 + +- Fixed: the install (`get.ps1` / `install.ps1`) could wait for Claude Desktop to close forever, although it was + closed: + - only Claude Desktop of your own Windows session counts now - on a server with remote desktop sessions another + user's Claude was seen too (in an elevated window even with its path), and it never closes for you; + - the Claude Code CLI shipped with Claude Desktop (claude.exe under …\claude-code\…) no longer counts as Claude + Desktop; + - while waiting it names what is still running (PID and path) every 20 seconds; **S** skips the registration + (`adolens register` later), and after 10 minutes it is skipped by itself; + - run from a terminal inside Claude (e.g. its Code tab, or `ado_upgrade` of a ZIP install), it installs the program + and says to register it from a regular window, instead of waiting for Claude to close itself. +- `adolens register`, when Claude Desktop runs, lists its processes in this session. +- README: run the one-line install in a regular PowerShell window, not as administrator and not inside Claude. + ## 0.12.0 — 2026-11-04 Comments can be fixed and removed, and any change can be undone. diff --git a/README.md b/README.md index 8ad9ad5..26c8c1a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ Azure DevOps is a trademark of Microsoft. ## Installing -**The easy way — one line.** In a regular PowerShell window (not as administrator) paste: +**The easy way — one line.** In a regular PowerShell window (Start menu → Windows PowerShell; not as administrator, not +a terminal inside Claude) paste: ```powershell irm https://raw.githubusercontent.com/willowdev-code/ado-lens/main/get.ps1 | iex @@ -96,7 +97,10 @@ The installer, in six steps with a default for every question (Enter accepts it) 6. registers the `ado-lens` server in Claude Desktop and Claude Code. Questions are in Polish on a Polish Windows, in English otherwise. When the registration has to change while Claude Desktop runs, it asks you to quit Claude, waits and starts it -again. Running `install.ps1` from a newer package updates the program and keeps settings, PATs and metadata; an +again. While it waits it names what is still running (PID and path, to find in Task Manager → Details); only your own +Windows session counts, so other people's Claude on a shared server does not hold it up. **S** skips the registration +(register later with `adolens register`), and after 10 minutes it is skipped by itself. Run from a terminal inside +Claude, it installs the program and tells you to register it from a regular window. Running `install.ps1` from a newer package updates the program and keeps settings, PATs and metadata; an `adolens.exe` used by an open session is renamed to `*.old`, so that session keeps working. Useful parameters: diff --git a/README.pl.md b/README.pl.md index 1f4b610..c55e981 100644 --- a/README.pl.md +++ b/README.pl.md @@ -33,7 +33,8 @@ Azure DevOps jest znakiem towarowym Microsoftu. ## Instalacja -**Najprościej — jedna linijka.** W zwykłym oknie PowerShella (nie jako administrator) wklej: +**Najprościej — jedna linijka.** W zwykłym oknie PowerShella (menu Start → Windows PowerShell; nie jako administrator, +nie w terminalu wewnątrz Claude'a) wklej: ```powershell irm https://raw.githubusercontent.com/willowdev-code/ado-lens/main/get.ps1 | iex @@ -99,7 +100,10 @@ Instalator działa w sześciu krokach, każde pytanie ma odpowiedź domyślną ( Na polskim Windowsie pytania są po polsku, w innym przypadku po angielsku. Jeśli rejestracja musi się zmienić, a Claude Desktop działa, instalator prosi o zamknięcie Claude'a, czeka i uruchamia go -ponownie. Uruchomienie `install.ps1` z nowszej paczki aktualizuje program i zostawia ustawienia, PAT-y i metadane; +ponownie. W trakcie czekania pokazuje, co jeszcze działa (PID i ścieżka, do znalezienia w Menedżerze zadań → Szczegóły); +liczy się tylko twoja sesja Windows, więc Claude innych osób na wspólnym serwerze go nie blokuje. **S** pomija +rejestrację (później: `adolens register`), a po 10 minutach pomija ją sam. Uruchomiony z terminala wewnątrz Claude'a +instaluje program i mówi, żeby zarejestrować go ze zwykłego okna. Uruchomienie `install.ps1` z nowszej paczki aktualizuje program i zostawia ustawienia, PAT-y i metadane; `adolens.exe` używany przez otwartą sesję dostaje nazwę `*.old`, więc ta sesja działa dalej. Przydatne parametry: diff --git a/install.ps1 b/install.ps1 index 2b5c8d6..ff83538 100644 --- a/install.ps1 +++ b/install.ps1 @@ -33,9 +33,26 @@ param( $ErrorActionPreference = 'Stop' function Say($m) { Write-Host " $m" } function Head($m) { Write-Host "`n$m" -ForegroundColor Cyan } +# Claude Desktop of this Windows session only: on a server with remote desktop sessions other people's Claude runs too +# (and an elevated window sees their paths). The Claude Code CLI is also claude.exe, also under the Claude folders +# (...\claude-code\...), but it is not the desktop app and does not need to be closed. +$mySession = (Get-Process -Id $PID).SessionId +function Test-DesktopPath([string] $path) { + $path -and $path -notlike '*\claude-code\*' -and ($path -like '*\WindowsApps\Claude_*' -or $path -like '*\AnthropicClaude\*') +} function Get-ClaudeDesktop { - Get-Process -Name claude -ErrorAction SilentlyContinue | - Where-Object { $_.Path -like '*\WindowsApps\Claude_*' -or $_.Path -like '*\AnthropicClaude\*' } + Get-Process -Name claude -ErrorAction SilentlyContinue | Where-Object { $_.SessionId -eq $mySession -and (Test-DesktopPath $_.Path) } +} +# Run from a terminal inside Claude (e.g. its Code tab): Claude cannot be closed without closing this script too. +function Test-InsideClaude { + $id = $PID + for ($i = 0; $i -lt 15 -and $id; $i++) { + $p = Get-CimInstance Win32_Process -Filter "ProcessId=$id" -ErrorAction SilentlyContinue + if (-not $p) { break } + if ($p.Name -ieq 'claude.exe' -and (Test-DesktopPath $p.ExecutablePath)) { return $true } + $id = $p.ParentProcessId + } + return $false } function Start-ClaudeDesktop { $pkg = Get-AppxPackage -Name Claude -ErrorAction SilentlyContinue | Select-Object -First 1 @@ -63,13 +80,42 @@ else { $needsRegister = ($LASTEXITCODE -eq 3) } $closedClaude = $false +$skippedRegister = $false if ($needsRegister -and (Get-ClaudeDesktop)) { Write-Host ' The Claude registration has to change and Claude Desktop is running.' -ForegroundColor Yellow - Write-Host ' Quit Claude now: tray icon (next to the clock) -> right click -> Quit. Waiting...' -ForegroundColor Yellow - while (Get-ClaudeDesktop) { Start-Sleep -Seconds 1 } - Start-Sleep -Seconds 2 - $closedClaude = $true - Say 'Claude is closed' + if (Test-InsideClaude) { + Write-Host ' This window runs inside Claude, which cannot be closed while it runs this script.' -ForegroundColor Yellow + Write-Host ' The program is installed now; to register it, quit Claude and run in a regular PowerShell window:' -ForegroundColor Yellow + Write-Host " & `"$exe`" register" + $needsRegister = $false + $skippedRegister = $true + } + else { + Write-Host ' Quit Claude now: tray icon (next to the clock) -> right click -> Quit.' -ForegroundColor Yellow + Write-Host ' Waiting... (S = skip the registration now and register later with: adolens register)' -ForegroundColor Yellow + $waited = 0 + while (Get-ClaudeDesktop) { + # Every 20 seconds: what is still running, so it can be found in Task Manager (Details tab, by PID). + if ($waited % 20 -eq 0) { + foreach ($p in Get-ClaudeDesktop) { Say "still running: PID $($p.Id) $($p.Path)" } + } + $key = $null + try { if ([Console]::KeyAvailable) { $key = [Console]::ReadKey($true).Key } } catch { } + if ($key -eq 'S' -or $waited -ge 600) { + if ($waited -ge 600) { Say 'Claude is still running after 10 minutes - skipping the registration' } + $needsRegister = $false + $skippedRegister = $true + break + } + Start-Sleep -Seconds 1 + $waited++ + } + if (-not $skippedRegister) { + Start-Sleep -Seconds 2 + $closedClaude = $true + Say 'Claude is closed' + } + } } Head "2/6 Copying files to $InstallDir" @@ -161,6 +207,9 @@ if ($needsRegister) { elseif ($NoRegister) { Say "skipped (-NoRegister). Later: `"$exe`" register" } +elseif ($skippedRegister) { + Write-Host " skipped - quit Claude Desktop, then run: & `"$exe`" register" -ForegroundColor Yellow +} else { Say 'already registered' } diff --git a/src/AdoLens/AdoLens.csproj b/src/AdoLens/AdoLens.csproj index f1a7600..32960db 100644 --- a/src/AdoLens/AdoLens.csproj +++ b/src/AdoLens/AdoLens.csproj @@ -25,7 +25,7 @@ ADO Lens for Azure DevOps Azure DevOps (work items, boards, wiki, Git and TFVC, pipelines) served to AI assistants over MCP Copyright © 2026 WillowDev - 0.12.0 + 0.12.1 diff --git a/src/AdoLens/ClaudeConfigs.cs b/src/AdoLens/ClaudeConfigs.cs index fd4a1b9..9d36cab 100644 --- a/src/AdoLens/ClaudeConfigs.cs +++ b/src/AdoLens/ClaudeConfigs.cs @@ -104,17 +104,24 @@ public static List EntriesWithPlainTextPat(string path) } /// Claude Desktop keeps its configuration in memory and writes it back, so entries must change while it is closed. - public static bool IsClaudeDesktopRunning() + public static bool IsClaudeDesktopRunning() => ClaudeDesktopProcesses().Count > 0; + + /// + /// The Claude Desktop processes of this Windows session: on a server with remote desktop sessions other people's + /// Claude runs too, and it does not hold this user's configuration. The Claude Code CLI is also claude.exe, also under + /// the Claude folders (…\claude-code\…), but it is not the desktop app. + /// + public static List<(int Id, string Path)> ClaudeDesktopProcesses() { + var session = Process.GetCurrentProcess().SessionId; + var found = new List<(int, string)>(); foreach (var p in Process.GetProcessesByName("claude")) { try { + if (p.SessionId != session) continue; var file = p.MainModule?.FileName ?? ""; - // The Claude Code CLI is also claude.exe; only the desktop app lives in these folders. - if (file.Contains(@"\WindowsApps\Claude_", StringComparison.OrdinalIgnoreCase) - || file.Contains(@"\AnthropicClaude\", StringComparison.OrdinalIgnoreCase)) - return true; + if (IsDesktopPath(file)) found.Add((p.Id, file)); } catch (Exception ex) when (ex is System.ComponentModel.Win32Exception or InvalidOperationException) { @@ -125,9 +132,13 @@ public static bool IsClaudeDesktopRunning() p.Dispose(); } } - return false; + return found; } + internal static bool IsDesktopPath(string file) => + !file.Contains(@"\claude-code\", StringComparison.OrdinalIgnoreCase) + && (file.Contains(@"\WindowsApps\Claude_", StringComparison.OrdinalIgnoreCase) || file.Contains(@"\AnthropicClaude\", StringComparison.OrdinalIgnoreCase)); + static bool IsSecretVar(string key) => key.Contains("PAT", StringComparison.OrdinalIgnoreCase) || key.Contains("TOKEN", StringComparison.OrdinalIgnoreCase); diff --git a/src/AdoLens/Cli.cs b/src/AdoLens/Cli.cs index e7fceb2..11c5e50 100644 --- a/src/AdoLens/Cli.cs +++ b/src/AdoLens/Cli.cs @@ -402,7 +402,8 @@ public int Register() if (pending.Any(t => t.IsDesktop) && !cl.Flag("force") && ClaudeConfigs.IsClaudeDesktopRunning()) { Console.Error.WriteLine("Claude Desktop is running and would overwrite the change. Quit it (tray icon -> Quit) and run this again,"); - Console.Error.WriteLine("or use install.ps1, which waits for Claude to close and starts it again."); + Console.Error.WriteLine("or use install.ps1, which waits for Claude to close and starts it again. Still running in this session:"); + foreach (var (pid, file) in ClaudeConfigs.ClaudeDesktopProcesses()) Console.Error.WriteLine($" PID {pid} {file}"); return ClaudeRunning; } diff --git a/tests/AdoLens.Tests/ImprovementTests.cs b/tests/AdoLens.Tests/ImprovementTests.cs index 084a222..39f989b 100644 --- a/tests/AdoLens.Tests/ImprovementTests.cs +++ b/tests/AdoLens.Tests/ImprovementTests.cs @@ -51,6 +51,15 @@ public void Code_can_live_in_another_project_than_the_work_items() } } + [Theory] + [InlineData(@"C:\Program Files\WindowsApps\Claude_4.1_x64__abc\app\Claude.exe", true)] + [InlineData(@"C:\Users\x\AppData\Local\AnthropicClaude\app-1.2.3\claude.exe", true)] + [InlineData(@"C:\Users\x\AppData\Local\AnthropicClaude\app-1.2.3\resources\claude-code\claude.exe", false)] + [InlineData(@"C:\Users\x\AppData\Local\Claude-Data\claude_abc\claude-code\2.1\claude.exe", false)] + [InlineData(@"C:\Users\x\.local\bin\claude.exe", false)] + public void Only_the_desktop_app_counts_as_a_running_Claude_Desktop(string path, bool desktop) => + Assert.Equal(desktop, ClaudeConfigs.IsDesktopPath(path)); + [Theory] [InlineData("Main", "DEV")] [InlineData("SIT", "UAT")]