Skip to content

Add replace-version command#54

Merged
jonwaldstein merged 7 commits into
mainfrom
add-replace-version-command
Jun 5, 2026
Merged

Add replace-version command#54
jonwaldstein merged 7 commits into
mainfrom
add-replace-version-command

Conversation

@jonwaldstein

@jonwaldstein jonwaldstein commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Resolves: SOENG-39

What this adds

A new pup replace-version <version> command that updates the version number in every file you've configured under .puprc paths.versions.

Until now, version replacement only happened implicitly as part of a dev build / package. This pulls that behavior into a standalone command so you can bump versions on demand — handy when prepping a release or staging a zip without running a full package.

Usage

pup replace-version 2.5.0          # write 2.5.0 into all version files
pup replace-version 2.5.0 --dev    # 2.5.0-dev-<timestamp>-<hash>

Also supports --root to run against a different directory, matching get-version and package.

Notes

  • Writes changes in place and does not auto-restore them (unlike package) — that's intentional for release prep.
  • Includes docs and CLI tests.

DEMO

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

jonwaldstein and others added 2 commits June 5, 2026 09:28
Adds a standalone `pup replace-version <version>` command that writes a
given version number into all files configured under .puprc paths.versions.
Previously this only happened implicitly during a dev build/package; this
exposes it as its own command for release/zip prep. Supports --dev and
--root, and includes docs plus CLI tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Guard preg_replace against null return (invalid regex) to avoid
  silently truncating version files, and skip files where the regex
  matches nothing instead of reporting a false "Updated".
- Extract duplicated getDevSuffix() into a shared DevSuffix trait,
  used by both replace-version and get-version.
- Add a --dev test; drop the snapshot assertion (no committed snapshot;
  explicit assertions already cover behavior).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear

linear Bot commented Jun 5, 2026

Copy link
Copy Markdown

SOENG-39

@jonwaldstein jonwaldstein requested a review from a team June 5, 2026 14:42
Comment thread docs/commands.md
Comment thread src/Commands/Traits/DevSuffix.php
@jonwaldstein jonwaldstein requested a review from d4mation June 5, 2026 17:57
@jonwaldstein jonwaldstein merged commit 8791a61 into main Jun 5, 2026
2 checks passed
@jonwaldstein jonwaldstein deleted the add-replace-version-command branch June 5, 2026 20:02
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