Skip to content

CLI overhaul: command classes, upgrade, doctor, completions, build progress, COMPILER_VERSION - #286

Merged
blacktrs merged 31 commits into
mainfrom
cli-progress
Oct 16, 2026
Merged

blacktrs merged 31 commits into
mainfrom
cli-progress

Conversation

@blacktrs

Copy link
Copy Markdown
Contributor

Summary

A CLI overhaul in five stacked steps, delivered as one PR. Every command is now a class with declared options, the compiler can update and diagnose itself, shells get completions, and long builds report progress.

Fixes #174
Fixes #176

What changes for users

Area Change
manticore upgrade [--check] [--version X] Updates an installed compiler from the shipped install.sh. Mandatory checksum, staged swap with rollback, previous binary kept as bin/.manticore.prev, foreign installs (package manager, container image) are refused with the likely owner named. --check exits 0 current / 1 update available / 2 error.
manticore doctor [--offline] [--no-smoke] [ OK ] / [WARN] / [FAIL] per check: clang >= 15, cc, stdlib/.sig/prelude found, pcre2/openssl/zlib, a hello-world compile+run, update availability. Exit 1 only on FAIL.
manticore version --check Same output and exit codes as upgrade --check.
manticore completions bash|zsh|fish Generated from the declared command/option metadata, so it cannot drift from the CLI.
Build progress on compile / build --progress=auto|live|plain|json|off, --quiet, --timings, --color=auto|always|never. Live line on a terminal; piped output stays silent unless CI is set (so existing stderr consumers are unchanged); JSON events for tools; real counters only where the total is known (files, functions, clang n/N for split builds). stdout is never touched.
COMPILER_VERSION New single source of the version. bin/build regenerates the committed src/Manticore/Version.php from it; tools/check_version.sh (CI job version-source) and the release workflow enforce it. A release now means: edit COMPILER_VERSION + docs, run bin/build, commit both.
CLI structure Main.php lost ~1100 lines. One Cli\Commands\*Command class per command, options declared via Cli\Option, --help generated.

Behaviour changes to be aware of

  • Arg-parse errors now read <command>: <error> (exit code still 64).
  • -h / --help print help on every command; version --anything now exits 64 (it used to ignore its arguments); split-ir arguments that start with - are rejected.
  • install.sh: a SHA256SUMS file with no entry for the tarball used to be accepted silently; strict mode (used by upgrade) now aborts. The plain installer's behaviour is unchanged.
  • --quiet silences progress and timings only; analyzer advisories and errors stay.
  • Colour order: never > NO_COLOR non-empty > TERM=dumb > always > terminal, so NO_COLOR wins over --color=always.

How it was built and checked

Each step was implemented by a fresh agent and reviewed twice (per task, then per branch), with a golden test (tests/cli/run.sh) pinning command behaviour before the restructure and offline mock-release tests (tools/install_smoke.sh, no network) for upgrade/version --check. The progress tests were mutation-checked: they fail when Progress::clear() or the stats fallback is removed.

Checked on macOS arm64 against the merged tree: bin/build (twice, self-host), analyze src --only undefined.,parse.error, bash tests/cli/run.sh, bash tools/install_smoke.sh, bash tools/check_version.sh.

Not run: the full AOT suite, tools/difftest.sh, the Linux gate. bootstrap-from-pin in CI is the proof that the pinned release still builds this tree.

Notes for reviewers

  • origin/main was merged in (7f2be542, Compile and serve a Symfony app natively: ownership/inference fixes, leak fixes, reflection and dispatch gaps #165): clean. Three golden checksums in tests/cli/behaviour.txt (dump-mir, dump-llvm-mir, dump-llvm) were re-baselined; a pristine build of origin/main produces the same values, so this is upstream codegen drift, not this PR.
  • Progress-on split builds poll marker files for clang n/N; with progress off the original command strings are byte-identical. Known limitation: Ctrl-C of a progress-on split build can leave clang jobs running until they finish by themselves (no portable setsid on macOS). Documented in the code.
  • Deferred, non-blocking: bash/zsh completions do not offer --help on the completions command itself; Apple clang 14 (= LLVM 15) is reported as too old by doctor; doctor's compile check assumes the binary file is named manticore; no tests for doctor's update-check branches.
  • Commit history keeps the five steps (cli-restructure, upgrade, cli-doctor, compiler-version, cli-progress) in order; squash-merge is fine.

@blacktrs
blacktrs merged commit cecbe16 into main Oct 16, 2026
9 checks passed
@blacktrs
blacktrs deleted the cli-progress branch October 16, 2026 14:55
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.

Show compilation progress: stages, counters and timings Add manticore upgrade to update an installed compiler

1 participant