Skip to content

feat(installer): setup PATH and shell completions - #711

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/installer
Jul 10, 2026
Merged

feat(installer): setup PATH and shell completions#711
twitchyliquid64 merged 1 commit into
mainfrom
tom/installer

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • The CLI is now invoked as min (including shell completion/help text).
    • The installer sets up PATH integration and tab completion for Bash, Zsh, Fish, and POSIX shells.
  • Bug Fixes

    • Shell integration and completions are now generated post-install and are removed cleanly on uninstall, preserving unrelated shell rc content.
    • If completion generation can’t run, the installer warns instead of failing.
  • Documentation

    • Expanded documentation covers shell integration, completion generation, and uninstall cleanup behavior (including idempotent rc changes).

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5c796e26-3643-4044-8a01-bce32eac369a

📥 Commits

Reviewing files that changed from the base of the PR and between b375fb0 and ac69403.

📒 Files selected for processing (5)
  • crates/minimal/src/lib.rs
  • docs/specs/07-spec-installer/07-spec-installer.md
  • scripts/install.sh
  • scripts/install_test.sh
  • scripts/stage-release.sh
✅ Files skipped from review due to trivial changes (1)
  • docs/specs/07-spec-installer/07-spec-installer.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • crates/minimal/src/lib.rs
  • scripts/stage-release.sh
  • scripts/install.sh
  • scripts/install_test.sh

📝 Walkthrough

Walkthrough

The CLI now uses min, while the installer generates shell initialization and completion files, hooks supported shell startup files, and removes these artifacts during uninstall. Specifications, release metadata, fixtures, and integration tests are updated for Units 1–9.

Changes

Installer shell integration

Layer / File(s) Summary
min command and release contract
crates/minimal/src/lib.rs, docs/specs/07-spec-installer/..., scripts/stage-release.sh
The CLI and release metadata identify the installed command as min at bin/min, while artifact names remain rooted at minimal.
Shell initialization and completion generation
scripts/install.sh, docs/specs/07-spec-installer/...
The installer generates per-shell initialization and completion files, invokes the installed min binary for completions, records generated files, and treats generation failures as warnings.
RC hooking, uninstall teardown, and validation
scripts/install.sh, scripts/install_test.sh, docs/specs/07-spec-installer/...
Marker-fenced shell startup blocks are added idempotently and removed during uninstall alongside generated files and empty integration directories; tests cover shell selection, completion behavior, naming, and teardown.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant MinBinary
  participant ShellFiles
  participant ShellRC
  Installer->>MinBinary: execute min completions shell
  MinBinary->>Installer: return completion content
  Installer->>ShellFiles: write init and completion files
  Installer->>ShellRC: append marker-fenced source block
  Installer->>ShellFiles: remove generated files during uninstall
  Installer->>ShellRC: strip marker-fenced block
Loading

Possibly related PRs

  • gominimal/minimal#645: Earlier installer and test harness implementation used by these shell integration changes.

Suggested reviewers: norrietaylor, msample

Poem

I twitch my nose: min is bright,
Completions bloom for shells at night.
Init paths hop into place,
RC markers leave no trace.
Uninstall cleans the burrow floor—
A tidy hop, then one hop more!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main installer change: PATH setup and shell completion support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/minimal/src/lib.rs (1)

60-85: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Stale minimal command in other help-text examples.

The completions example was updated to min (line 101), but the ssh-forward example at line 63 (minimal ssh-forward dev 18080:127.0.0.1:80) and the login examples at lines 80-84 (minimal login, ~/.config/minimal/...) still show the old command name. Since the CLI is now invoked as min, users copy-pasting these examples get a stale/incorrect command.

✏️ Suggested fix
-    ///   minimal ssh-forward dev 18080:127.0.0.1:80
+    ///   min ssh-forward dev 18080:127.0.0.1:80
-    ///   minimal login
+    ///   min login
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/minimal/src/lib.rs` around lines 60 - 85, Update the help-text
examples in the SshForward and Login command documentation to use the current
`min` command name instead of `minimal`, including the login command and all
referenced configuration paths. Keep the examples consistent with the updated
completions example.
🧹 Nitpick comments (1)
scripts/install.sh (1)

509-527: 🚀 Performance & Scalability | 🔵 Trivial

zsh.sh runs compinit unconditionally on every shell startup.

compinit without a cache-aware guard (e.g. checking .zcompdump freshness, compinit -C) rescans the whole fpath on every new shell, adding noticeable startup latency for zsh users. Since this file is regenerated on every install run anyway, consider emitting a cached-init pattern.

♻️ Optional caching pattern
 if [ -d "$zsh_comp_dir" ]; then
     fpath=("$zsh_comp_dir" \$fpath)
-    autoload -Uz compinit
-    compinit
+    autoload -Uz compinit
+    for dump in "\${ZDOTDIR:-\$HOME}"/.zcompdump(N.mh+24); do
+        compinit
+    done
+    compinit -C
 fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` around lines 509 - 527, Update the generated zsh init
template in the heredoc that emits zsh.sh so compinit uses a cache-aware
approach instead of unconditionally rescanning fpath on every startup; preserve
the fpath setup and use an appropriate .zcompdump freshness check or compinit -C
guard before invoking compinit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@crates/minimal/src/lib.rs`:
- Around line 60-85: Update the help-text examples in the SshForward and Login
command documentation to use the current `min` command name instead of
`minimal`, including the login command and all referenced configuration paths.
Keep the examples consistent with the updated completions example.

---

Nitpick comments:
In `@scripts/install.sh`:
- Around line 509-527: Update the generated zsh init template in the heredoc
that emits zsh.sh so compinit uses a cache-aware approach instead of
unconditionally rescanning fpath on every startup; preserve the fpath setup and
use an appropriate .zcompdump freshness check or compinit -C guard before
invoking compinit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 02ed5f81-c698-433c-ba47-2871f650f2c8

📥 Commits

Reviewing files that changed from the base of the PR and between fa0e499 and b375fb0.

📒 Files selected for processing (5)
  • crates/minimal/src/lib.rs
  • docs/specs/07-spec-installer/07-spec-installer.md
  • scripts/install.sh
  • scripts/install_test.sh
  • scripts/stage-release.sh

@bryan-minimal bryan-minimal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants