Skip to content

feat: slash command popup, /feedback, and collection pre-allocation#219

Open
jexShain wants to merge 1 commit into
AI-Shell-Team:mainfrom
jexShain:esc-to-main
Open

feat: slash command popup, /feedback, and collection pre-allocation#219
jexShain wants to merge 1 commit into
AI-Shell-Team:mainfrom
jexShain:esc-to-main

Conversation

@jexShain
Copy link
Copy Markdown
Collaborator

@jexShain jexShain commented Jun 1, 2026

Summary

  • Add interactive slash command popup triggered by typing / on empty line, with search/filter support
  • Add /feedback command that opens GitHub Issues in the browser via the open crate
  • Replace Vec::new()/HashMap::new()/String::new() with with_capacity() across context, llm, memory, pty, security, and tools crates for reduced reallocation overhead
  • Set max readline history size to 500 entries

Test plan

  • Type / on an empty input line — popup should appear with all slash commands
  • Search/filter in the popup, select a command with Enter
  • Run /feedback — browser should open GitHub Issues page
  • Verify cargo test passes

Summary by CodeRabbit

  • New Features

    • Interactive slash-command picker: press / on an empty line to browse and insert commands
    • New /feedback command: opens the project's Issues page in your browser
    • Slash-command completions: slash-commands appear in readline completions for faster discovery
  • Chores

    • Performance and memory usage improvements across various subsystems (reduced reallocations)
    • Added a new direct dependency to support opening URLs from the shell

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Thanks for the pull request. A maintainer will review it when available.

Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review.

Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

This pull request description looks incomplete. Please update the missing sections below before review.

Missing items:

  • User-visible Changes
  • Compatibility
  • Testing
  • Change Type
  • Scope

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

Warning

Review limit reached

@jexShain, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 3 minutes and 32 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a81bab82-0328-4285-8708-9e29f893a059

📥 Commits

Reviewing files that changed from the base of the PR and between df2fbf7 and 7ede400.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • crates/aish-cli/src/update.rs
  • crates/aish-context/src/manager.rs
  • crates/aish-llm/src/session.rs
  • crates/aish-memory/src/manager.rs
  • crates/aish-pty/src/offload.rs
  • crates/aish-pty/src/persistent.rs
  • crates/aish-security/src/policy.rs
  • crates/aish-shell/Cargo.toml
  • crates/aish-shell/src/app.rs
  • crates/aish-shell/src/input.rs
  • crates/aish-shell/src/readline.rs
  • crates/aish-tools/src/glob_tool.rs
  • crates/aish-tools/src/grep_tool.rs
📝 Walkthrough

Walkthrough

This PR adds memory pre-allocation optimizations across seven crates (cli, context, llm, memory, pty, security, tools) to reduce runtime reallocation overhead, and introduces an interactive slash-command feature allowing shell users to press / to browse and select available commands, including a new /feedback command that opens the GitHub issues URL.

Changes

Memory allocation optimizations

Layer / File(s) Summary
Capacity pre-allocation across crates
crates/aish-cli/src/update.rs, crates/aish-context/src/manager.rs, crates/aish-llm/src/session.rs, crates/aish-memory/src/manager.rs, crates/aish-pty/src/offload.rs, crates/aish-pty/src/persistent.rs, crates/aish-security/src/policy.rs, crates/aish-tools/src/glob_tool.rs, crates/aish-tools/src/grep_tool.rs
CLI progress i18n args, context message buffers, LLM tools/stream buffers, memory persistence output buffer, PTY spill/combined buffers and control buffer, security rule parsing buffers, and tool match collections now use with_capacity(...)/String::with_capacity(...)/HashMap::with_capacity(...) instead of empty constructors; behavior and APIs unchanged.

Interactive slash-command feature

Layer / File(s) Summary
Readline slash-command infrastructure
crates/aish-shell/src/readline.rs
Adds public SLASH_COMMANDS, SlashHandler detecting / on empty lines, SLASH_REQUESTED flag, integration into start-of-line completion with dedupe, set_max_history_size(500), and ShellReadline::was_slash_requested() / read_line_with_initial() plus unit tests validating SLASH_COMMANDS.
Shell app slash-command integration
crates/aish-shell/Cargo.toml, crates/aish-shell/src/app.rs, crates/aish-shell/src/input.rs
Adds open = "5" dependency, implements AishShell::show_slash_command_popup(), hooks slash-request handling in the REPL to re-seed input with the selected command, recognizes /feedback in classify_input, and implements /feedback to open the GitHub issues URL with a textual fallback on error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • AI-Shell-Team/aish#125: Touches download progress rendering and i18n argument construction in crates/aish-cli/src/update.rs, related to progress output changes.

Suggested labels

size: L

Poem

🐰 I pre-alloc'd my carrots, snug in rows,

No resizing panics where the burrow grows.
A slash blooms bright — press / to pick your tool,
Feedback hops to GitHub, quick as a mule.
Cheerful shell, leaner vectors — hop, we rule!

🚥 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 all three main changes: the slash command popup, the /feedback command, and collection pre-allocation optimizations across multiple crates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
crates/aish-shell/src/readline.rs (1)

220-284: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't let slash completions mask absolute-path completion.

At the start of the line, any matching slash command returns early from this branch, so absolute paths with the same prefixes stop tab-completing. For example, /, /s, /r, /m, /t, /p, and /f now prefer /setup, /resume, /model, etc. instead of filesystem entries like /usr, /root, /srv, /proc, or /tmp. Please merge file candidates into this branch or prioritize file completion for path-like tokens before returning.

🤖 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/aish-shell/src/readline.rs` around lines 220 - 284, The branch that
handles start-of-line completion currently pushes SLASH_COMMANDS and returns
before filesystem matches, causing slash commands like "/setup" to shadow
absolute-paths such as "/usr"; change the logic in the completion block so
path-like tokens are prioritized or merged: before returning, detect path-like
prefixes (word.starts_with("/") or "./" etc.), call
file_completer.complete(line, pos, ctx) to obtain file candidates, convert those
results into Pair entries and merge them into the candidates vector
(deduplicating against BUILTINS/SLASH_COMMANDS and PTY results), and only return
Ok((word_start, candidates)) after merging; use the existing functions and types
(BUILTINS, SLASH_COMMANDS, query_pty_completions, file_completer.complete, Pair)
to locate and implement this change.
🧹 Nitpick comments (1)
crates/aish-shell/src/input.rs (1)

15-20: ⚡ Quick win

Reuse the shared slash-command source here.

This hardcoded matcher now duplicates the popup/completion list and the dispatcher. The next slash command can easily show up in SLASH_COMMANDS but still classify as unknown here. Please derive this check from one shared source or helper so the popup, classifier, and handler stay in sync.

🤖 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/aish-shell/src/input.rs` around lines 15 - 20, The code in input.rs
currently hardcodes the slash-command matcher (using trimmed.starts_with and
matches!(... "/model" | "/setup" ...)) which duplicates SLASH_COMMANDS; change
it to derive the check from the shared command source by extracting the first
token (e.g., trimmed.split_whitespace().next()) and testing it against the
existing SLASH_COMMANDS collection or the shared helper used by the
popup/completion/dispatcher, so the classifier uses the same source of truth
(refer to SLASH_COMMANDS and the current classifier/dispatcher helper) and
remove the hardcoded literal list.
🤖 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.

Inline comments:
In `@crates/aish-shell/src/app.rs`:
- Around line 325-337: The code fails rustfmt; run cargo fmt --all (or cargo fmt
--all -- --check locally to verify) and reformat the hunks that include the
SearchSelectPanel instantiation and the PanelRuntime::new().run(...) match (and
the similar section around the SearchSelectPanel at 1431-1437) so the file
complies with rustfmt rules; commit the formatted changes.

---

Outside diff comments:
In `@crates/aish-shell/src/readline.rs`:
- Around line 220-284: The branch that handles start-of-line completion
currently pushes SLASH_COMMANDS and returns before filesystem matches, causing
slash commands like "/setup" to shadow absolute-paths such as "/usr"; change the
logic in the completion block so path-like tokens are prioritized or merged:
before returning, detect path-like prefixes (word.starts_with("/") or "./"
etc.), call file_completer.complete(line, pos, ctx) to obtain file candidates,
convert those results into Pair entries and merge them into the candidates
vector (deduplicating against BUILTINS/SLASH_COMMANDS and PTY results), and only
return Ok((word_start, candidates)) after merging; use the existing functions
and types (BUILTINS, SLASH_COMMANDS, query_pty_completions,
file_completer.complete, Pair) to locate and implement this change.

---

Nitpick comments:
In `@crates/aish-shell/src/input.rs`:
- Around line 15-20: The code in input.rs currently hardcodes the slash-command
matcher (using trimmed.starts_with and matches!(... "/model" | "/setup" ...))
which duplicates SLASH_COMMANDS; change it to derive the check from the shared
command source by extracting the first token (e.g.,
trimmed.split_whitespace().next()) and testing it against the existing
SLASH_COMMANDS collection or the shared helper used by the
popup/completion/dispatcher, so the classifier uses the same source of truth
(refer to SLASH_COMMANDS and the current classifier/dispatcher helper) and
remove the hardcoded literal list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ab99244-c0d6-4928-83c3-d08b367cd69a

📥 Commits

Reviewing files that changed from the base of the PR and between 5b51e46 and aee5ba5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • crates/aish-cli/src/update.rs
  • crates/aish-context/src/manager.rs
  • crates/aish-llm/src/session.rs
  • crates/aish-memory/src/manager.rs
  • crates/aish-pty/src/offload.rs
  • crates/aish-pty/src/persistent.rs
  • crates/aish-security/src/policy.rs
  • crates/aish-shell/Cargo.toml
  • crates/aish-shell/src/app.rs
  • crates/aish-shell/src/input.rs
  • crates/aish-shell/src/readline.rs
  • crates/aish-tools/src/glob_tool.rs
  • crates/aish-tools/src/grep_tool.rs

Comment thread crates/aish-shell/src/app.rs Outdated
…llections

- Add interactive slash command popup triggered by typing `/` on empty line
- Add `/feedback` command to open GitHub Issues in browser (via `open` crate)
- Replace Vec::new()/HashMap::new()/String::new() with with_capacity() across
  context, llm, memory, pty, security, and tools crates for better performance
- Set max history size to 500 entries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant