Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
63 changes: 56 additions & 7 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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'
}
Expand Down
2 changes: 1 addition & 1 deletion src/AdoLens/AdoLens.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<AssemblyTitle>ADO Lens for Azure DevOps</AssemblyTitle>
<Description>Azure DevOps (work items, boards, wiki, Git and TFVC, pipelines) served to AI assistants over MCP</Description>
<Copyright>Copyright © 2026 WillowDev</Copyright>
<Version>0.12.0</Version>
<Version>0.12.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
23 changes: 17 additions & 6 deletions src/AdoLens/ClaudeConfigs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,24 @@ public static List<string> EntriesWithPlainTextPat(string path)
}

/// <summary>Claude Desktop keeps its configuration in memory and writes it back, so entries must change while it is closed.</summary>
public static bool IsClaudeDesktopRunning()
public static bool IsClaudeDesktopRunning() => ClaudeDesktopProcesses().Count > 0;

/// <summary>
/// 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.
/// </summary>
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)
{
Expand All @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/AdoLens/Cli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
9 changes: 9 additions & 0 deletions tests/AdoLens.Tests/ImprovementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down