Add replace-tbd command#55
Merged
Merged
Conversation
Adds `pup replace-tbd <version>`, the companion to the tbd check: it scans the same directories (reusing the tbd check's dirs/skip config) and replaces every TBD placeholder the check would flag — docblock tags (@since/@deprecated/ @Version TBD), _deprecated_*() calls, and bare 'tbd' strings — with the given version. Running it makes `pup check:tbd` pass. The shared file-walk and TBD detection logic is extracted into a new Check\TbdScanner so the check and the command stay in sync; the tbd check is refactored to use it (behavior unchanged). Supports --dry-run to preview changes and --root, and includes docs and tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Replace TBD placeholders precisely instead of every \btbd\b token on a flagged line. Replacement now targets only docblock tag values (@since/@deprecated/@Version TBD) and quoted 'tbd'/"tbd" strings, so an unrelated "tbd" in prose or a trailing comment is no longer corrupted. - Escape backreference-significant characters ($, \) in the version before using it as a preg_replace replacement, so a version like "2.0$1" is written literally. - Align replace-tbd's `dirs` fallback with the tbd check ([] instead of ['src']) so it never edits files the check wouldn't examine when the tbd check is absent from a customized .puprc. - Add a regression test asserting prose/trailing-comment "tbd" is preserved; update docs to match the precise behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d4mation
reviewed
Jun 5, 2026
d4mation
approved these changes
Jun 5, 2026
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.
What this adds
A new
pup replace-tbd <version>command — the companion to thetbdcheck. Wherecheck:tbdfindsTBDversion placeholders, this command resolves them by replacing each with the version you provide.It scans the same directories the
tbdcheck uses (reusing itsdirs/skip_files/skip_directoriesconfig) and replaces everything the check would flag:@since/@deprecated/@version TBDdocblock tags,_deprecated_*()calls, and bare'tbd'strings. After running it,pup check:tbdreports clean.Handy during release prep, once you know which version the pending changes will ship in.
Usage
Notes
Check\TbdScannerso the check and the command stay in sync. Thetbdcheck now uses it; its behavior is unchanged.--dry-runto preview, or git to undo.🤖 Generated with Claude Code
DEMO
Screen.Recording.2026-06-05.at.10.27.32.AM.mov