Repository navigation
Add the api command and the verify-api action - #97
Merged
Merged
Conversation
assembly-differ api writes a build's public API as .api files (-o), prints it, or prints it as JSON with every part of each declaration as a field (-f json). It takes a .dll, a directory or a .nupkg, or without a path the solution's libraries for every framework they target, the way the projects command picks them; --split namespace and --split top-level-namespace write a file per chunk for large assemblies. An assembly whose frameworks share an API gets one file, otherwise one per framework. api --verify checks committed files against the build and exits with 5 when they differ, listing each change by path, file and line, who it breaks and how, the suggested version change, and the command that updates the files. The verify-api composite action installs the tool and runs api --verify after the caller's checkout and build; with comment: true it keeps a pull request comment with the report. In the library, ApiWriter.Write(assembly, split) writes the chunks, each with a header naming the types it uses from the others so it parses alone, and ApiParser.Parse reads a set of files back into one API with the file and line of every declaration. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 4 of the public API files: the CLI and the action, on top of the reader, parser and comparison from #94 to #96.
assembly-differ api.dll, a directory, a.nupkg, or nothing. With nothing, it reads the solution's libraries for every target framework, skipping test and unpackable projects the wayprojectsdoes. It doesn't build.MyLib.net8.0.api.--split namespaceor--split top-level-namespacewritesMyLib/<namespace>.api. Each file's header names the types it uses from the other files, so every file parses on its own.-oremoves.apifiles the API no longer has. It only touches files that start withassembly.--verifylists each change by path,file:line, who it breaks and how, and the bump, then prints the command that updates the files:nullean/assembly-differ/verify-api@v1A composite action that installs the tool and runs
api --verify. Checkout and the build are the caller's own steps, as the README documents.contents: read.comment: trueandpull-requests: write, it keeps one comment on the pull request throughgh api, holding the report and the update command. When the files match again it updates that comment, and it never posts one for a pull request that always matched.matchesandsuggested-change.Library
ApiWriter.Write(assembly, split)returns the chunks.ApiParser.Parse(files)reads them back into one API.ApiDocument.LocationOf(node)gives each declaration's file and line.ApiChange.OldScopelocates an addition in the old file.Tests
ApiFileTests,ProjectsTests): print, JSON, write then verify, five kinds of change under--verify, a split write/verify/rewrite cycle, a missing directory, solution mode and the help text.--verifythat never reports a match makes two tests fail.gh. The outputs, exit code 5 and the comment body came out right. It has not run on GitHub. It installs the released tool, which doesn't haveapiyet, so it can only work after the next release.Not in this PR
.apifiles as a baseline forfiles,releaseandpull-request. Those commands report through the JustAssembly-compatible engine, which compares assemblies. Taking.apifiles means moving them to the new comparison, which is the deliberate switch we agreed on: behind a flag first, the default in 2.0.🤖 Generated with Claude Code