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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 0.13.0 — 2026-11-13

Several projects of one organization in one connection.

- Fixed: adding a second project of the same Azure DevOps (login, the settings window, `adolens login`) replaced the
first one, without a word - the connection is named after the organization. Another project is now added to the
connection; the default stays.
- A connection holds a default project and others (`moreProjects`): `adolens config --add-project / --remove-project`,
`--project` makes one the default (the previous default stays among the others), the settings window has a field
"Other projects of this organization", and `adolens connections`, `ado_settings` show them.
- Without `project=`, `ado_search` (work items, wiki, code), `ado_file`, `ado_pr` (lists, merged), `ado_pipeline`
(builds, deployments, artifacts, runs), `ado_label` and finding the environments look in every project of the
connection: lists under each project's name, a build, file or pipeline in the first project that has it. Creating
work items, sprints, boards and backlogs use the default project unless one is named; Claude gets the list of
projects in its instructions.

## 0.12.2 — 2026-11-04

- Fixed: newer Claude Desktop versions keep their configuration in `%LOCALAPPDATA%\Claude-Data\<app>\` and leave only a
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ when a project has more than one active repository, and leave out work branches
adolens config --connection contoso --env "ERP:dev=DEV (sbx01)" --env "ERP:staging=UAT (sbx03)" --env "ERP:master=PROD" --env "Common:master=PROD"
```

**Several projects of one organization.** A connection holds a default project and as many others as needed (work
items and code in both, e.g. one for X++ and one for C# applications): signing in again with another project of the same
organization adds it, `adolens config --connection contoso --add-project Apps` too, and the settings window has a field
for them. Search, files, pull requests, pipelines and finding the environments look in all of them, each answer under its
project's name; creating work items and sprints, boards and backlogs use the default unless Claude passes `project=`
(it gets the list of projects).

**Code in another project.** When the work items live in one project and the code, pull requests and pipelines in
another, set it once: `adolens config --connection contoso --code-project ERP` (or ask Claude: `ado_settings
codeProject=ERP`). `ado_file`, `ado_search` (code), `ado_pr`, `ado_pipeline` and `ado_label` then look there.
Expand Down
7 changes: 7 additions & 0 deletions README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ więcej niż jedno aktywne repozytorium, i pomijają gałęzie robocze (`000000_
adolens config --connection contoso --env "ERP:dev=DEV (sbx01)" --env "ERP:staging=UAT (sbx03)" --env "ERP:master=PROD" --env "Common:master=PROD"
```

**Kilka projektów jednej organizacji.** Połączenie ma projekt domyślny i dowolnie wiele innych (work itemy i kod w
obu, np. jeden na X++, drugi na aplikacje w C#): ponowne zalogowanie z innym projektem tej samej organizacji dopisuje go,
tak samo `adolens config --connection contoso --add-project Aplikacje`, a okno ustawień ma na nie pole. Wyszukiwanie,
pliki, pull requesty, pipeline'y i wykrywanie środowisk patrzą we wszystkie, każda odpowiedź pod nazwą swojego projektu;
tworzenie work itemów oraz sprinty, tablice i backlogi używają domyślnego, chyba że Claude poda `project=` (dostaje listę
projektów).

**Kod w innym projekcie.** Gdy work itemy są w jednym projekcie, a kod, pull requesty i pipeline'y w innym, ustaw to
raz: `adolens config --connection contoso --code-project ERP` (albo poproś Claude'a: `ado_settings codeProject=ERP`).
Wtedy `ado_file`, `ado_search` (kod), `ado_pr`, `ado_pipeline` i `ado_label` szukają tam.
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.2</Version>
<Version>0.13.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 13 additions & 4 deletions src/AdoLens/Cli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ logout remove the stored PAT of a connection --connection <name>
connections list the connections
config show or change settings
--connection <name> --project <name> --team <name> (defaults of a connection)
--add-project <name> / --remove-project <name> (more projects of the organization; --project sets the default)
--code-project <name> (code, pull requests and pipelines in another project; "" clears)
--default-connection <name> --mode po|dev|full --usage-log true|false
--show-tokens true|false --tool-loading auto|demand|all --add-toolset <set> --remove-toolset <set> --confirm-above <n>
Expand Down Expand Up @@ -172,7 +173,10 @@ public async Task<int> LoginAsync()
project = PickProject(projects);
if (project is not null && projects.Count > 0 && !projects.Contains(project, StringComparer.OrdinalIgnoreCase))
Console.WriteLine($"note: project '{project}' is not visible with this PAT");
conn.Project = project is null ? null : projects.FirstOrDefault(p => p.Equals(project, StringComparison.OrdinalIgnoreCase)) ?? project;
project = project is null ? null : projects.FirstOrDefault(p => p.Equals(project, StringComparison.OrdinalIgnoreCase)) ?? project;
// Another project of the same organization is added to the connection, never put in place of its default.
var added = project is not null && stored?.Project is { } before && !before.Equals(project, StringComparison.OrdinalIgnoreCase);
if (project is not null) conn.AddProject(project);
if (cl.Opt("team") is { } team) conn.Team = NullIfEmpty(team);

CredentialStore.Write(name, org, pat);
Expand All @@ -183,7 +187,10 @@ public async Task<int> LoginAsync()

Console.WriteLine($"connection '{name}' saved{(settings.DefaultConnection == name ? " (default)" : "")}: {SettingsPath}");
Console.WriteLine($"PAT saved in Windows Credential Manager: {CredentialStore.TargetFor(name)}");
if (conn.Project is { } p)
if (added)
Console.WriteLine($"project {project} added to connection '{name}' (projects: {string.Join(", ", conn.AllProjects())}; default {conn.Project} - " +
$"change with 'adolens config --connection {name} --project {project}')");
else if (conn.Project is { } p)
Console.WriteLine($"default project: {p}");
return 0;
}
Expand Down Expand Up @@ -245,7 +252,7 @@ public int Connections()
{
var pat = CredentialStore.Read(name) is not null ? "PAT stored" : "no stored PAT";
Console.WriteLine($"{(name.Equals(settings.DefaultConnection, StringComparison.OrdinalIgnoreCase) ? "*" : " ")} {name,-16} " +
$"https://dev.azure.com/{c.Organization} project {c.Project ?? "-"}{(c.CodeProject is { } cp ? $" code in {cp}" : "")} team {c.Team ?? "-"} ({pat})" +
$"https://dev.azure.com/{c.Organization} project {c.Project ?? "-"}{(c.MoreProjects.Count > 0 ? $" (+ {string.Join(", ", c.MoreProjects)})" : "")}{(c.CodeProject is { } cp ? $" code in {cp}" : "")} team {c.Team ?? "-"} ({pat})" +
(c.Environments.Count > 0 ? $"\n {"",-16} environments: {string.Join(", ", c.Environments.Select(e => $"{e.Key} = {e.Value}"))}" : "") +
(c.LabelLanguages.Count > 0 ? $"\n {"",-16} label languages: {string.Join(", ", c.LabelLanguages)}" : ""));
}
Expand All @@ -262,7 +269,9 @@ public int Config()
{
if (!settings.Connections.TryGetValue(name, out var conn))
throw new ArgumentException($"no connection named '{name}' - add it with 'adolens login --connection {name}'");
if (cl.Opt("project") is { } p) { conn.Project = NullIfEmpty(p); changed = true; }
if (cl.Opt("project") is { } p) { conn.SetDefaultProject(p); changed = true; }
while (cl.Opt("add-project") is { } ap) { conn.AddProject(ap); changed = true; }
while (cl.Opt("remove-project") is { } rp) { conn.MoreProjects.RemoveAll(x => x.Equals(rp.Trim(), StringComparison.OrdinalIgnoreCase)); changed = true; }
if (cl.Opt("team") is { } t) { conn.Team = NullIfEmpty(t); changed = true; }
if (cl.Opt("code-project") is { } cp) { conn.CodeProject = NullIfEmpty(cp); changed = true; }
while (cl.Opt("env") is { } e)
Expand Down
2 changes: 1 addition & 1 deletion src/AdoLens/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed partial class CommandLine
["pr"] = ["connection=", "project=", "repo=", "list=", "detail=", "merged=", "since=", "top="],
["pipeline"] = ["connection=", "project=", "definition=", "branch=", "top=", "detail=", "artifacts", "artifact=", "part=", "save", "to=", "deployments", "stage="],
["changes"] = ["connection=", "repo=", "file=", "detail="],
["config"] = ["env=", "remove-env=", "connection=", "default-connection=", "project=", "code-project=", "team=", "mode=", "usage-log=", "add-toolset=", "remove-toolset=", "confirm-above=", "show-tokens=", "tool-loading=", "language=", "label-languages=", "download-dir="],
["config"] = ["env=", "remove-env=", "connection=", "default-connection=", "project=", "add-project=", "remove-project=", "code-project=", "team=", "mode=", "usage-log=", "add-toolset=", "remove-toolset=", "confirm-above=", "show-tokens=", "tool-loading=", "language=", "label-languages=", "download-dir="],
["item"] = ["connection=", "include=", "detail="],
["query"] = ["connection=", "project=", "wiql=", "query=", "top="],
["create"] = ["connection=", "project=", "type=", "title=", "description=", "criteria=", "assign=", "parent=", "iteration=", "area=", "tags=", "state=", "field=", "template="],
Expand Down
2 changes: 1 addition & 1 deletion src/AdoLens/EnvironmentFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void From(string key, string source)
if (!list.Contains(source)) list.Add(source);
}
static string Day(DateTime? d) => d?.ToLocalTime().ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) ?? "?";
var projects = new[] { session.Config.CodeProject, project }.Where(p => !string.IsNullOrWhiteSpace(p)).Select(p => p!)
var projects = new[] { session.Config.CodeProject, project }.Concat(session.Config.Projects).Where(p => !string.IsNullOrWhiteSpace(p)).Select(p => p!)
.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
var keys = new List<string>();
// Long-lived branches of the repositories in use (a commit in the last half year); feature and work branches are
Expand Down
6 changes: 6 additions & 0 deletions src/AdoLens/Knowledge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public static partial class Knowledge
/// <summary>One search over work items, wiki pages and code of a project, grouped; each part fails on its own.</summary>
public static async Task<string> SearchAsync(Lens lens, string? connection, string? project, string text, string? scope, int top, CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.EachAsync(projects, p => SearchAsync(lens, connection, p, text, scope, top, ct));
if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("text is required");
var session = lens.For(connection);
var name = session.Project(project);
Expand Down Expand Up @@ -284,6 +287,9 @@ sealed record FileRef(bool Tfvc, string Path, string? RepoId, string? RepoName,
public static async Task<string> FileAsync(Lens lens, string? connection, string? project, string path, string? repo, string? version,
string? part, bool history, int top, string? detail, CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.FirstAsync(projects, p => FileAsync(lens, connection, p, path, repo, version, part, history, top, detail, ct));
var session = lens.For(connection);
var name = session.CodeProject(project);
var (file, choices) = await ResolveAsync(session, name, path, repo, ct);
Expand Down
3 changes: 3 additions & 0 deletions src/AdoLens/Labels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ internal static string SearchWords(string seen) =>

public static async Task<string> FindAsync(Lens lens, string? connection, string? project, string text, string? branch, CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.FirstAsync(projects, p => FindAsync(lens, connection, p, text, branch, ct));
if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("give the text of the message (as seen on screen) or a label id like @Model:Id");
var session = lens.For(connection);
var name = session.CodeProject(project);
Expand Down
8 changes: 8 additions & 0 deletions src/AdoLens/Lens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public sealed record Session(Config Config, AdoClient Client, MetadataService Me
public string CodeProject(string? project) =>
!string.IsNullOrWhiteSpace(project) ? project.Trim() : Config.CodeProject ?? Project(null);

/// <summary>
/// The projects to look in when none is named: all of the connection, the code project first. One project (or one
/// named): just that one.
/// </summary>
public IReadOnlyList<string> SearchProjects(string? project) =>
!string.IsNullOrWhiteSpace(project) || Config.Projects.Count < 2 ? [CodeProject(project)]
: Config.Projects.OrderBy(p => p.Equals(Config.CodeProject, StringComparison.OrdinalIgnoreCase) ? 0 : 1).ToList();

/// <summary>The project given, else the connection's default project.</summary>
public string Project(string? project) =>
!string.IsNullOrWhiteSpace(project) ? project.Trim()
Expand Down
15 changes: 14 additions & 1 deletion src/AdoLens/McpTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,20 @@ public static class McpTools
public static string Instructions(Settings settings)
{
var groups = settings.ToolLoading == "demand" ? Toolsets.Loaded(settings) : Toolsets.Active(settings);
return Intro + (settings.ToolLoading == "all" ? "" : Groups) + string.Concat(Lines.Where(l => groups.Contains(l.Key)).Select(l => l.Value));
return Intro + (settings.ToolLoading == "all" ? "" : Groups) + string.Concat(Lines.Where(l => groups.Contains(l.Key)).Select(l => l.Value))
+ Projects(settings);
}

/// <summary>
/// Connections with several projects of one organization: search, files, pull requests and pipelines look in all;
/// creating and boards need project= for any but the default.
/// </summary>
internal static string Projects(Settings settings)
{
var many = settings.Connections.Where(c => c.Value.AllProjects().Count > 1)
.Select(c => $"{c.Key}: {string.Join(", ", c.Value.AllProjects())}").ToList();
return many.Count == 0 ? "" : "\n- Projects (the first is the default): " + string.Join("; ", many) +
". Search, files, pull requests and pipelines look in all of them; to create work items or read a sprint, board or backlog of another, pass project=.";
}

/// <summary>The writing and usage hints of a group, returned when the group is loaded during a conversation.</summary>
Expand Down
15 changes: 15 additions & 0 deletions src/AdoLens/Pipelines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ static string Line(JsonElement b) =>

public static async Task<string> ListAsync(Lens lens, string? connection, string? project, string? definition, string? branch, int top, CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.EachAsync(projects, p => ListAsync(lens, connection, p, definition, branch, top, ct));
var session = lens.For(connection);
var name = session.CodeProject(project);
var query = new List<string> { $"$top={Math.Clamp(top, 1, 100)}", "queryOrder=queueTimeDescending" };
Expand Down Expand Up @@ -81,6 +84,9 @@ internal static string Excerpt(string log, int max)
public static async Task<string> DeploymentsAsync(Lens lens, string? connection, string? project, string? definition, string? stage, int top,
CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.EachAsync(projects, p => DeploymentsAsync(lens, connection, p, definition, stage, top, ct));
var session = lens.For(connection);
var name = session.CodeProject(project);
var vsrm = session.Client.ServiceUrl("vsrm") + Uri.EscapeDataString(name) + "/";
Expand Down Expand Up @@ -120,6 +126,9 @@ public static async Task<string> DeploymentsAsync(Lens lens, string? connection,
public static async Task<string> ArtifactsAsync(Lens lens, string? connection, string? project, int build, string? artifact, string? part, bool save,
CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.FirstAsync(projects, p => ArtifactsAsync(lens, connection, p, build, artifact, part, save, ct));
var session = lens.For(connection);
var scope = AdoClient.Scope(session.CodeProject(project));
var list = await session.Client.GetListAsync($"{scope}_apis/build/builds/{build}/artifacts", ct);
Expand Down Expand Up @@ -148,6 +157,9 @@ public static async Task<string> ArtifactsAsync(Lens lens, string? connection, s

public static async Task<string> BuildAsync(Lens lens, string? connection, string? project, int id, string? detail, CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.FirstAsync(projects, p => BuildAsync(lens, connection, p, id, detail, ct));
var session = lens.For(connection);
var name = session.CodeProject(project);
var scope = AdoClient.Scope(name);
Expand Down Expand Up @@ -184,6 +196,9 @@ public static async Task<string> BuildAsync(Lens lens, string? connection, strin

public static async Task<string> RunAsync(Lens lens, string? connection, string? project, string definition, string? branch, string? parameters, CancellationToken ct = default)
{
// Several projects in the connection and none named: ask each one.
if (project is null && lens.For(connection).SearchProjects(null) is { Count: > 1 } projects)
return await ProjectFanOut.FirstAsync(projects, p => RunAsync(lens, connection, p, definition, branch, parameters, ct));
var session = lens.For(connection);
var name = session.CodeProject(project);
var def = await DefinitionAsync(session, name, definition, ct);
Expand Down
Loading