Add --prune option to remove defunct route files when OpenAPI spec changes#1550
Merged
pmcelhaney merged 5 commits intomainfrom Mar 20, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 2fc3033 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…anges Co-authored-by: pmcelhaney <51504+pmcelhaney@users.noreply.github.com>
…t.js Co-authored-by: pmcelhaney <51504+pmcelhaney@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add prune option for clearing out defunct paths and endpoints
Add --prune option to remove defunct route files when OpenAPI spec changes
Mar 20, 2026
Collaborator
|
@copilot add a changes |
Co-authored-by: pmcelhaney <51504+pmcelhaney@users.noreply.github.com> Agent-Logs-Url: https://github.com/pmcelhaney/counterfact/sessions/e3e0d52e-2ea8-42bb-880a-56a5013c5fa3
Collaborator
Pull Request Test Coverage Report for Build 23353533229Details
💛 - Coveralls |
Contributor
Author
Added a changeset file ( |
Collaborator
|
@copilot add a changeset |
Contributor
Author
The changeset was already added in commit |
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.
When an OpenAPI spec renames a path parameter (e.g.,
{Name}→{nickname}), both the old and new route files coexist, creating wildcard ambiguity inModuleTreeresolution. The--pruneflag removes route files that no longer exist in the spec before generating new ones.Changes
src/typescript-generator/prune.js— NewpruneRoutes(destination, openApiPaths)function: walksroutes/, deletes.tsfiles with no matching spec path, removes empty directories post-prune._.context.tsfiles are always preserved.src/typescript-generator/generate.js— CallspruneRoutes()whengenerateOptions.prune && generateOptions.routes, before writing new files.src/server/config.ts— Adds optionalprune?: booleanto thegenerateconfig shape.src/typescript-generator/code-generator.ts— Updates constructor/field types to acceptprune?.bin/counterfact.js— Adds--pruneCLI flag wired intoconfig.generate.prune.test/typescript-generator/prune.test.js— 7 tests covering file deletion, context file preservation, empty-dir cleanup, root path (/→index.ts), no-op when all files match, and missingroutes/directory..changeset/add-prune-option.md— Changeset entry documenting this as a minor release.Example
Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.