Skip to content

fix: Hide -c/--command on min session attach from the CLI help surface - #1071

Merged
norrietaylor merged 3 commits into
mainfrom
inbox-patch/hide-attach-command-flag-532408bd4710eb24
Jul 29, 2026
Merged

fix: Hide -c/--command on min session attach from the CLI help surface#1071
norrietaylor merged 3 commits into
mainfrom
inbox-patch/hide-attach-command-flag-532408bd4710eb24

Conversation

@gominimal-aw-bot

@gominimal-aw-bot gominimal-aw-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1062
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKsZxwQ

AttachArgs::command in crates/minimal/src/lib.rs carried #[arg(long, short)] with no hide, so -c / --command appeared in min session attach --help, -h, and shell completions — advertising a general remote exec the flag cannot deliver (no PTY, only three daemon commands accepted). Adding hide = true removes it from the visible surface while keeping it functional for existing scripted callers. The one coupled judgment call: the non-TTY attach error in ensure_interactive_attach_tty still names --command; rather than drop the reference (which would strip the only forward path for non-TTY callers and break its existing test), I reworded it to frame the flag as a deliberate hidden escape hatch, keeping the advice actionable and self-contained.

Verification

cargo fmt --all --check --manifest-path target/Cargo.toml — clean, no drift
cargo clippy --workspace --locked -- -D warnings — 0 warnings, finished ok
cargo build --workspace --locked — exit 0
cargo test --workspace --locked — all suites passed (exit 0), incl. interactive_attach_requires_a_tty

Generated by inbox-patch ·

Note

Hide -c/--command flag from min session attach CLI help and remove --force from min init

  • Marks the --command flag on min session attach as hidden in lib.rs so it no longer appears in help output, but remains functional for scripted callers.
  • Removes the --force flag from min init; run_init_flow now always overwrites minimal.toml if it exists, requiring only the --yes flag for non-interactive use.
  • Removes SHELL=/bin/sh override and SendEnv forwarding of LANG/LC_*/TZ from the SSH attach helper; only MINIMAL_SESSION_ID continues to be forwarded.
  • Behavioral Change: min init will overwrite an existing minimal.toml without --force; any callers relying on that guard will no longer be protected.

Macroscope summarized c0f9a4f. (Automatic summaries will resume when PR exits draft mode or review begins).

Summary by CodeRabbit

  • Bug Fixes

    • Improved the guidance shown when session attachment is attempted without an interactive terminal.
    • Clarified the scripted attachment option using the hidden --command flag.
  • CLI Improvements

    • The --command option is now hidden from standard help output while remaining available for scripted use.

Add `hide = true` to the `#[arg(long, short)]` attribute on
`AttachArgs::command` so `-c` / `--command` no longer appear in
`min session attach --help`, `-h`, or shell completions. The flag
stays functional for existing scripted callers; the option promises a
general remote exec it cannot deliver (no PTY, only three daemon
commands accepted), so it should not be advertised for discovery.

The non-TTY attach error still points stuck callers at `--command`;
reword it to frame the flag as a deliberate hidden escape hatch rather
than drop the reference, keeping the advice actionable now that the
flag is off the help surface.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The min session attach command flag is hidden from Clap help output, while non-TTY error guidance continues to identify --command <cmd> for scripted callers.

Changes

Attach CLI surface

Layer / File(s) Summary
Hide command flag and update non-TTY guidance
crates/minimal/src/lib.rs
AttachArgs.command now hides -c and --command from help output, and ensure_interactive_attach_tty describes the hidden scripted escape hatch.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

  • gominimal/inbox#416 — Directly covers hiding AttachArgs::command and updating its non-TTY guidance.

Possibly related PRs

Suggested reviewers: norrietaylor, evanspearman, twitchyliquid64

Poem

A bunny tucked the command from sight,
While keeping its scripted path alight.
“Use the hidden flag,” errors say,
“When terminals hop away.”
CLI help now feels just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies #1062 by hiding -c/--command in clap while preserving the non-TTY hint and existing functionality.
Out of Scope Changes check ✅ Passed The final diff only touches the attach CLI surface and error message, with no unrelated code changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly and concisely describes the main change: hiding the attach command flag from help output.
Description check ✅ Passed The description includes a clear summary and verification steps, but it does not follow the template headings exactly and omits the checklist.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

norrietaylor and others added 2 commits July 29, 2026 12:41
The merge commit c0f9a4f resolved conflicts in crates/minimal/src/lib.rs
by taking the pre-merge side, silently reverting two fixes that had
landed on main:

- #1053 — the `min init` refuse-to-overwrite guard: `InitArgs::force`,
  the bail on an existing `minimal.toml`, and the Updated/Created
  wording. Without it `min init` overwrites an existing `minimal.toml`
  with no backup and no prompt, which is the data loss #1032 was filed
  for.
- #1060 — the `SHELL=/bin/sh` pin on the ssh ProxyCommand and the
  `SendEnv` forwarding of LANG/LC_*/TZ. Without the pin, attach dies at
  "banner exchange ... Broken pipe" for any user whose $SHELL is a bare
  name (fish) or absent from the ssh context.

Neither revert was caught by the suite: there is no test for the init
guard, and `interactive_attach_requires_a_tty_on_stdin` only asserts the
error contains "not a TTY" and "--command", which holds either way.

Rebuilt lib.rs from main and reapplied only the intended change, so the
diff against main is now exactly the `hide = true` on
`AttachArgs::command` plus the non-TTY error reword: +4/-3, was +9/-51.

Verified: rustfmt clean; `cargo build -p minimal --locked` ok;
`min session attach --help` no longer lists `-c`/`--command` while
`--command` still parses; `min init --help` lists `--force` again.
`cargo test -p minimal` cannot run on macOS (dev-deps pull minimald ->
procfs/caps, Linux-only), so the suite is left to CI.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@norrietaylor

Copy link
Copy Markdown
Member

Corrected: the merge commit was reverting two fixes that landed on main

Pushed d681e4d. The diff against main is now +4/-3 — it was +9/-51.

What was wrong

c0f9a4f ("Merge branch 'main' into inbox-patch/…") resolved the conflict in crates/minimal/src/lib.rs by taking the pre-merge side of the whole file. That silently reverted two commits that had landed on main in the meantime:

Reverted What it protected
f36045f9 #1053 InitArgs::force, the bail on an existing minimal.toml, and the Updated/Created wording
12c81c3f #1060 the SHELL=/bin/sh pin on the ssh ProxyCommand, and SendEnv forwarding of LANG/LC_*/TZ

Consequences had it merged:

Verified by fetching the file at both ends of the PR:

MARKER (from #1053 / #1060)                base     HEAD(before fix)
refusing to overwrite existing             1        0
ssh.env("SHELL", "/bin/sh")                1        0
SendEnv=LANG                               1        0
SendEnv=LC_*                               1        0
SendEnv=TZ                                 1        0

Why the green suite did not catch it

The PR body reports cargo test --workspace --locked passing, and that is consistent — no test covers either reverted behaviour:

  • There is no test for the min init overwrite guard.
  • interactive_attach_requires_a_tty_on_stdin asserts only err.contains("not a TTY") && err.contains("--command"), which holds for the old message, the reworded one, and the reverted one.

So the suite was never going to fail here. Worth adding a test for the init guard, given it has now been broken once and silently re-broken once.

What I changed

Rebuilt crates/minimal/src/lib.rs from origin/main (byte-identical, confirmed by an empty diff) and reapplied only the intended change:

Verification

  • rustfmt --check on the changed file — clean
  • cargo build -p minimal --lockedFinished dev profile in 3m05s
  • min session attach --help — no -c/--command line; min session attach --command still errors with a value is required for '--command <COMMAND>', so the flag remains functional
  • min init --help--force is listed again
  • cargo test -p minimal cannot run on macOS (dev-deps pull minimaldprocfs/caps, both Linux-only, exactly as AGENTS.md documents). The suite is left to CI.

For the inbox-patch workflow

This is a merge-conflict-resolution failure, not a bad patch — c4231296, the generated commit, was correct on its own. The failure mode is worth guarding: when the bot merges main into a patch branch and the target file has moved, whole-file resolution reverts everything that landed in between, and the PR body still describes only the intended change. A git diff origin/main --stat sanity check against the expected footprint would have caught it.

@twitchyliquid64
twitchyliquid64 marked this pull request as ready for review July 29, 2026 21:06
@norrietaylor
norrietaylor enabled auto-merge (squash) July 29, 2026 21:09
@norrietaylor
norrietaylor merged commit 0e25232 into main Jul 29, 2026
29 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/hide-attach-command-flag-532408bd4710eb24 branch July 29, 2026 21:21
norrietaylor added a commit that referenced this pull request Jul 30, 2026
hide = true on AttachArgs::command (#1071) was silently reverted by
commit 64a0764, an unrelated help-text reformat -- the same
collateral-clobber pattern #1071 itself had to repair once already.
Restore it, along with the "hidden escape hatch" non-TTY error wording
that shipped with it.

This PR went the opposite direction from a hidden flag: it documented
the full min run/min package build/min check allowlist in
docs/concepts/sessions.md, docs/guide/agents.md, and
docs/reference/cli-min.md. Since -c/--command is a hidden legacy
escape hatch and not a general remote shell, remove those mentions
instead of expanding them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
norrietaylor added a commit that referenced this pull request Jul 30, 2026
…cs (#1110)

* docs: name full exec-channel allowlist for session attach -c

Three docs stated that the non-interactive `min session attach -c`
channel accepts only `min run` invocations. The daemon's exec handler
also accepts `min package build [args...]` and `min check [args...]`
(crates/minimald/src/exec.rs), so the docs understated the allowlist.
List all three accepted forms in cli-min.md, agents.md, and sessions.md.

Fixes #1067

* chore: no-op to restart ci

* fix: keep session attach -c hidden, restore the dropped hide=true

hide = true on AttachArgs::command (#1071) was silently reverted by
commit 64a0764, an unrelated help-text reformat -- the same
collateral-clobber pattern #1071 itself had to repair once already.
Restore it, along with the "hidden escape hatch" non-TTY error wording
that shipped with it.

This PR went the opposite direction from a hidden flag: it documented
the full min run/min package build/min check allowlist in
docs/concepts/sessions.md, docs/guide/agents.md, and
docs/reference/cli-min.md. Since -c/--command is a hidden legacy
escape hatch and not a general remote shell, remove those mentions
instead of expanding them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs: stop enumerating the -c/--command allowlist in AGENTS.md too

The footgun note still spelled out the exact min run/min package
build/min check allowlist, which is itself advertising a hidden flag.
Keep the warning (don't treat -c as a general shell) and the source
pointer, drop the enumerated command list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix: stop pointing the non-TTY attach error at --command

The non-TTY error was still advertising the hidden --command escape
hatch to every interactive caller who hit it -- inconsistent with
hiding the flag everywhere else. Drop the mention; it only ever fires
on the interactive path (command.is_none()), so it was pushing
newcomers toward a flag we deliberately don't document. Update the
one test that asserted on the old wording.

Also drop the AGENTS.md footgun bullet entirely per feedback -- no
partial version, just remove it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: gominimal-aw-bot[bot] <281738952+gominimal-aw-bot[bot]@users.noreply.github.com>
Co-authored-by: bryan <bryan@minimal.dev>
Co-authored-by: Norrie Taylor <norrie@minimal.dev>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

Hide min session attach -c/--command from the CLI help surface

2 participants