feat(install): drop completions and a man page during install#1674
Conversation
A CLI shipped via wheels + curl|sh + self-update should offer tab-completion and a man page; this one had the CommandFactory plumbing but exposed neither. Add a user-facing `mergify completions <bash|zsh|fish|…>` that prints the completion script to stdout (clap_complete), and a hidden `mergify _internal man` that renders the roff man page to stdout (clap_mangen) for packaging to install. Both are pure introspection over the clap command tree, handled before the tokio runtime starts — so now that `stack` is a real subcommand group (not the old shim), completions cover it correctly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Change-Id: I4c27238bee92725e28116717f7eb47d05bff120f
The CLI's contract (every flag, subcommand, value-hint, help string, exit code) was only spot-checked structurally, so a dropped flag or renamed leaf could regress unnoticed. Add an `insta` JSON golden of the full generated schema (version redacted, since it's release-stamped) — intentional CLI changes are accepted with `cargo insta review`, accidental drift shows as a red diff. Also assert directly that the stack subcommands in the schema equal the `NATIVE_COMMANDS` registry, closing the two-list drift that the old shim allowed (a deleted leaf used to vanish silently). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Change-Id: I25a9400f84da784eba19583965376de221ed5370
`run_native` resolved the running binary's path with the same eight-line `std::env::current_exe().map_err(…)` block copy-pasted eight times across the rebase-family stack arms. Extract it into `mergify_self_exe()`, which also preserves the underlying I/O error as a `caused by:` source via `CliError::wrap`. Drop the leftover Python-port narration: the `stack new` "the rest still shim to Python" doc, and push.rs's "Python uses asyncio fan-out" comments. Restate push's design positively — async is incidental (reqwest's client is async-only); upserts run sequentially because Depends-On needs the predecessor's PR number and stacks are small. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Change-Id: I22a6f2928524ae6d1f5924063a8b7956000b8d3a
The file was Python-era: it mandated `console_error`, `click`,
`DYMGroup`, and a `crates/mergify-py-shim` that no longer exists, so an
agent following it emitted uncompilable code. The port is complete.
Replace it with the real Rust contracts: typed `CliError` + the
`mergify: {err}` + `caused by:` sink (and `CliError::wrap`/`Source`,
no anyhow); the no-panic-in-library policy; clap + `NATIVE_COMMANDS`
conventions; stdout/stderr/`--json`/color discipline (the single-width
glyph vocabulary, `--color`, `mergify_tui::theme`); `tracing` to
stderr; HTTP rules; testing with insta goldens + assert/wiremock
fidelity; the `[workspace.dependencies]` rule and cargo-deny;
the clippy-pedantic / `-D warnings` / MSRV-1.88 bar; and the
stack-push commit discipline. Complements (doesn't duplicate) the
global behavioral preferences.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Change-Id: If56ea725541b059e77ce235399859b6445ebefd7
Route `stack squash` argument validation through `clap::Error` (ValueValidation) so failures render with the usage line and the standard exit code, like other parse errors, instead of a bare `eprintln!` + `exit(2)`. Also correct the `--debug` dispatch comment: the flag is consumed by `init_tracing()` at startup, not by command impls. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Change-Id: I86663735cc017dca638ff66ae0336d1e6d7b1b31
After placing the binary, generate a completion script for the detected shell ($SHELL) and the man page by invoking the binary's own `completions <shell>` / `_internal man`, then write them into that shell's completion dir and $XDG_DATA_HOME/man. zsh lands in ~/.zfunc with a one-line $fpath hint; an unrecognized shell is pointed at the command instead of guessing a path. Best-effort and non-fatal since the binary is already installed, and skipped on Windows. No new release assets — the binary generates both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Change-Id: I09d1664b7fda38aaaf2e573f70c0a68d48d2375a
This was referenced Jun 23, 2026
Contributor
Author
|
This pull request is part of a Mergify stack:
|
Contributor
Merge Protections🔴 3 of 7 protections blocking · waiting on 👀 reviews and 🙋 you
🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
Show 4 satisfied protections🟢 🤖 Continuous Integration
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
d443840 to
bf0cbee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After placing the binary, generate a completion script for the
detected shell ($SHELL) and the man page by invoking the binary's own
completions <shell>/_internal man, then write them into thatshell's completion dir and $XDG_DATA_HOME/man. zsh lands in ~/.zfunc
with a one-line $fpath hint; an unrecognized shell is pointed at the
command instead of guessing a path.
Best-effort and non-fatal since the binary is already installed, and
skipped on Windows. No new release assets — the binary generates both.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Depends-On: #1671