Skip to content

Add replace-tbd command#55

Merged
jonwaldstein merged 5 commits into
mainfrom
feature/SOENG-40
Jun 5, 2026
Merged

Add replace-tbd command#55
jonwaldstein merged 5 commits into
mainfrom
feature/SOENG-40

Conversation

@jonwaldstein

@jonwaldstein jonwaldstein commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What this adds

A new pup replace-tbd <version> command — the companion to the tbd check. Where check:tbd finds TBD version placeholders, this command resolves them by replacing each with the version you provide.

It scans the same directories the tbd check uses (reusing its dirs / skip_files / skip_directories config) and replaces everything the check would flag: @since / @deprecated / @version TBD docblock tags, _deprecated_*() calls, and bare 'tbd' strings. After running it, pup check:tbd reports clean.

Handy during release prep, once you know which version the pending changes will ship in.

Usage

pup replace-tbd 1.4.0            # replace all TBD placeholders with 1.4.0
pup replace-tbd 1.4.0 --dry-run  # preview what would change, write nothing

Notes

  • The shared file-walk + TBD detection logic was extracted into a new Check\TbdScanner so the check and the command stay in sync. The tbd check now uses it; its behavior is unchanged.
  • Writes changes in place and does not auto-restore them — use --dry-run to preview, or git to undo.
  • Includes docs and CLI tests.
  • Follow-up issue outlining proposed update to .puprc paths that replace-tbd can use

🤖 Generated with Claude Code

DEMO

Screen.Recording.2026-06-05.at.10.27.32.AM.mov

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>
@linear

linear Bot commented Jun 5, 2026

Copy link
Copy Markdown

SOENG-40

- 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>
Comment thread src/Commands/Checks/Tbd.php
Comment thread src/Commands/ReplaceTbd.php Outdated
Comment thread src/Check/TbdScanner.php
@jonwaldstein jonwaldstein requested a review from d4mation June 5, 2026 18:19
@jonwaldstein jonwaldstein merged commit 91fb6b8 into main Jun 5, 2026
2 checks passed
@jonwaldstein jonwaldstein deleted the feature/SOENG-40 branch June 5, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants