Skip to content

feat(install): drop completions and a man page during install#1674

Closed
JulianMaurin wants to merge 6 commits into
devs/JulianMaurin/feat/rust-cli-excellence/render-stack-squash-val-errors-via-clap--86663735from
devs/JulianMaurin/feat/rust-cli-excellence/drop-completions-man-page-install--09d1664b
Closed

feat(install): drop completions and a man page during install#1674
JulianMaurin wants to merge 6 commits into
devs/JulianMaurin/feat/rust-cli-excellence/render-stack-squash-val-errors-via-clap--86663735from
devs/JulianMaurin/feat/rust-cli-excellence/drop-completions-man-page-install--09d1664b

Conversation

@JulianMaurin

Copy link
Copy Markdown
Contributor

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

Depends-On: #1671

JulianMaurin and others added 6 commits June 23, 2026 11:10
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
@JulianMaurin

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(cli): generate shell completions and a man page #1658
2 test: golden-snapshot the CLI surface and guard schema drift #1659
3 refactor: dedupe the GIT_SEQUENCE_EDITOR lookup and drop port cruft #1660
4 docs(agents): rewrite AGENTS.md for the Rust workspace #1661
5 fix(cli): render stack-squash validation errors via clap #1671
6 feat(install): drop completions and a man page during install #1674 👈

@mergify

mergify Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 3 of 7 protections blocking · waiting on 👀 reviews and 🙋 you

Protection Waiting on
🔴 ⛓️ Depends-On Requirements 🙋 you
🔴 👀 Review Requirements 👀 reviews
🔴 🔎 Reviews 👀 reviews
🟢 🤖 Continuous Integration
🟢 Enforce conventional commit
🟢 📕 PR description
🟢 🚦 Auto-queue

🔴 ⛓️ Depends-On Requirements

Waiting for

This rule is failing.

Requirement based on the presence of Depends-On in the body of the pull request

🔴 👀 Review Requirements

Waiting for

  • #approved-reviews-by>=2
This rule is failing.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🔴 🔎 Reviews

Waiting for

  • #review-requested = 0
This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

Show 4 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify mergify Bot requested a review from a team June 23, 2026 09:33
@JulianMaurin JulianMaurin force-pushed the devs/JulianMaurin/feat/rust-cli-excellence/render-stack-squash-val-errors-via-clap--86663735 branch from d443840 to bf0cbee Compare June 23, 2026 12:10
@JulianMaurin JulianMaurin deleted the devs/JulianMaurin/feat/rust-cli-excellence/drop-completions-man-page-install--09d1664b branch June 23, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant