Your task is to fix the version bump tool so that every command updates the data correctly and prints the correct success message or error reason. It reads the state from data/versions.json, processes the change, release and yank commands, and writes the updated state back.
├── data/
│ └── versions.json # Persistent release state (version, pending changes, releases)
├── src/
│ ├── main/java/com/versions/
│ │ ├── Commands.java # Command handlers
│ │ ├── FileIo.java # State file load and save
│ │ ├── Main.java # CLI entry point
│ │ ├── Models.java # Data models
│ │ └── Parser.java # JSON parsing
│ └── test/java/com/versions/
│ └── CommandsTest.java # Unit tests
├── versions # CLI launcher script
├── pom.xml # Maven project configuration
├── run.sh # Setup and run script
├── reset.sh # Restore data/versions.json to its initial state
├── test.sh # Test script (writes junit.xml)
└── README.md
mvn -B -ntp -DskipTests packagebash run.shbash test.shRestore data/versions.json to its initial state.
bash reset.shEach example below runs independently against the initial data/versions.json and shows only the records it changes.
Command:
./versions change minor "add saml login"Output:
Noted minor: add saml login (7 pending)
Changed records in data/versions.json:
{"type":"minor","note":"add saml login"}Command:
./versions change hotfix "urgent fix"Output:
Error: INVALID_TYPE
data/versions.json: unchanged.
Command:
./versions change minor ""Output:
Error: EMPTY_NOTE
data/versions.json: unchanged.
Command:
./versions releaseOutput:
Released 2.0.0 (6 changes)
Changed records in data/versions.json:
"version": "2.0.0"
"pending": []
{"version":"2.0.0","notes":["fix the duplicate invite email","export the audit log","drop the v1 api","stop the retry loop on a 404","add a per-team webhook","handle the expired invite link"],"yanked":false}Command:
./versions yank 1.4.10Output:
Yanked 1.4.10; current version 1.5.2
Changed records in data/versions.json:
{"version":"1.4.10","notes":["speed up the dashboard query","cache the team list","log slow requests"],"yanked":true}