Skip to content

In a solution, show only the package changes the code uses - #81

Merged
Mpdreamz merged 1 commit into
mainfrom
uses
Nov 14, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
uses

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Inside a solution, assembly-differ nuget Polly 8.5.0 now reports only the changes to types and members your built projects reference. --all shows every change.

Prompt summary: When validating a dependency update from a solution, the tool should show what the update means for this code: "what breaks for me if I upgrade". It reads that from the built assemblies, so neither a person nor an agent has to decompile anything. This is the default inside a solution, with a flag to see everything.

Why

A package update's full diff can list hundreds of changes, and most of them touch API the code never uses. The real question, which changes break this code, took reading the whole report against the source.

What

What the code uses

UsedApi reads the built assemblies' type and member references with System.Reflection.Metadata. It keeps the ones that resolve to the package's assemblies: types by metadata full name, including nested types and generic instances, and per type the names of members called. An accessor such as get_Size counts as its property Size. Every diff item now carries its metadata name in Key, so the two can be matched.

What is kept

For a used type, UsageFilter keeps its removed and changed members that are referenced, its own declaration changes except the compiler's bookkeeping attributes, and new abstract or required members, which every implementer or object initializer must act on. New types and other new members cannot be in use yet, so they go. When nothing is left, the line says the assembly "changed, but not in API your code uses". The JSON and the suggested version come from the filtered report, so they describe the effect on this code.

Builds and limits

The tool reads each project's Release build, or Debug, for the framework it resolves the package for. Without any build it shows every change, with a warning to build first. Members match by name, so a change to one overload shows when another overload is used. A constant the code uses does not show, because the compiler copies its value into the code; --help and the README say both.

Verify

mise run test
# UsesTests: the app calls Widget.Draw(); 2.0.0 removes Draw() and changes Size.
# The default shows only Draw(); --all and an unbuilt app show both

With the member check removed from the filter on purpose, Shows_only_the_changes_the_app_uses fails.

🤖 Generated with Claude Code

A package update's full diff lists every change, while the question is
which of them affect this code. nuget in a solution now reads the types
and members the built projects reference, from their metadata, and keeps
only the changes to those, plus new abstract or required members on types
in use. --all shows everything; without a build it shows everything with
a warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mpdreamz Mpdreamz added the feature A new capability (minor bump) label Nov 14, 2026
@Mpdreamz
Mpdreamz merged commit fc8fbe6 into main Nov 14, 2026
6 of 7 checks passed
@Mpdreamz
Mpdreamz deleted the uses branch November 14, 2026 08:46
Mpdreamz added a commit that referenced this pull request Nov 14, 2026
A new content-only package, `assembly-differ.skills`, carries an agent
skill for the tool, and both READMEs now open with what the tool does
for coding agents.

**Prompt summary:** Another use of this tool is agentic coding: an agent
can run the dotnet tool to see what updating a library would do, where
today it decompiles assemblies and checks for itself. The docs and the
landing page should say so, and people should be able to install a NuGet
skills package alongside the tool.

## Why
An agent asked to update a package, or to change a library's public API,
has no direct way to see what changes. It decompiles assemblies, greps
release notes, or guesses. The tool answers exactly that, and since
[#81](#81) it limits the
answer to what the code uses, but nothing told an agent the tool exists
or how to read its output.

## What

#### The `assembly-differ.skills` package
It is a content-only package with `skills/assembly-differ/SKILL.md`, the
layout from [the .NET blog post on skills in NuGet
packages](https://devblogs.microsoft.com/dotnet/delivering-skills-in-nuget-packages/).
It ships no assembly and no dependencies, and it is a development
dependency, so it never flows on to a consumer. `generatepackages` packs
it into `build/output`, so CI publishes it with the tool.

#### The skill
The skill maps each question to a command: what updating X breaks here,
what my changes did to this repository's libraries, what a package
changes since its last release, and two versions or two builds. It
states the rules that trip agents up: the tool never builds, `nuget X`
in a solution shows only the API the code uses unless `--all` is set,
overloads match by name, and constants don't show. It describes the json
report and the exit codes, and what to do with the answer.

#### Docs
The README opens with "For coding agents", with two commands,
`api-changes.json`, and how to install the tool and the skill. The
packages table lists the new package, and the tagline and the tool's
NuGet README mention agents. AGENTS.md asks to keep the skill in step
with the CLI.

## Verify
```bash
./build.sh generatepackages -s
unzip -l build/output/assembly-differ.skills.*.nupkg   # skills/assembly-differ/SKILL.md, no lib/
```

**Out of scope:** The nullean landing page gets assembly-differ in a
pull request of its own, in nullean/nullean.github.io.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Mpdreamz added a commit that referenced this pull request Nov 14, 2026
)

`assembly-differ upgrades`, run in a solution, lists every directly
referenced package that has a newer release. For each one it shows the
change to the API your code uses and how many breaking changes hit it.

**Prompt summary:** Running the tool against a local solution should
make validating dependency updates easy, as part of the CLI designed
together with the owner: `nuget X [to]` for one package, and `upgrades`
for every package at once, both limited by default to what the code
uses.

## Why
`nuget X` answers for one package. Answering "which of my updates are
safe to take" meant listing the packages, finding their latest versions,
and running `nuget X` for each.

## What

#### One table for the solution
`upgrades` reads each project's `project.assets.json` for the packages
it references directly, and the version and `lib/` folder each framework
resolves. It compares each with its latest stable release on the
NuGet.config feeds. Packages already on their latest release are
counted, not listed. A package with no assemblies, such as a build-only
one, gets a note.

#### What the code uses
As with `nuget X` from
[#81](#81), only changes
to API the built projects reference count, so a purely additive update
shows `None` under the column "Change to what you use". `--all` counts
every change. The comparisons run quietly, one stderr line per package,
and `assembly-differ nuget <package> <version>` shows one update in
full.

#### Output and gating
Markdown by default; `-f json` writes `upgrades.json`, with `upToDate`
and per package `from`, `to`, `suggestedVersionChange`,
`breakingChanges`, `usesOnly` and `projects`. `--fail-on major` exits
`4` when any update breaks something the code uses.

## Verify
```bash
mise run test
# UpgradesTests: an app on three local-feed packages, one breaking for it, one additive, one current
cd <a solution> && dotnet build && assembly-differ upgrades
```

The fixture compiler now takes an assembly name and the test package
helper a file name, so a test can publish several packages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new capability (minor bump)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant