1.6 KiB
1.6 KiB
Step 10: CLI Commands
Prerequisites: steps 04, 05, 06.
Read README.md and 00-legacy-analysis.md first.
Goal
CLI parity for interactive use without the server.
Design
New picocli subcommands (Spring components in commands/, wired like the existing ones):
status— print the latest build per branch as a table (branch, status, commit, time, duration);--historyfor all builds. ReadsBuildResultRepositorydirectly; works while a server instance runs (file-based store, read-only).build [<branch>]— one-shot: fetch, checkout, build the given branch (default: current), print the log to the console, exit with the build's exit code. Replaces legacy--stayand explicit branch arguments. Support the legacy partial-name matching: resolve unique branch-name fragments, list candidates on ambiguity (legacyresolve_branch_name).retry— re-enqueue/build branches whose latest build failed (legacy--retry).- Update the root command's subcommand list and
--helptexts.
Exit codes: 0 on success, 1 on build failure, 2 on usage/config errors (align with CliRunner's ExitCodeGenerator contract).
Out of Scope
- Talking to a running server over HTTP; direct file/executor access is sufficient for now.
- Shell completion.
Tests
- Command unit tests with MockK-ed services (pattern of
InitCommandTest). - Branch fragment resolution: unique match, ambiguity handling, no match.
- Exit code assertions.
Acceptance Criteria
./gradlew ktlintFormatthen./gradlew buildis green.java -jar ... statusandjava -jar ... buildwork in this repository (manual smoke test; document in this file).