Skip to content

add a SlashCommand enum with /help, and highlight commands in the prompt - #3

Merged
Revantark merged 4 commits into
Revantark:mainfrom
azeemshaik025:feat/slash-commands
Aug 22, 2026
Merged

add a SlashCommand enum with /help, and highlight commands in the prompt#3
Revantark merged 4 commits into
Revantark:mainfrom
azeemshaik025:feat/slash-commands

Conversation

@azeemshaik025

Copy link
Copy Markdown
Collaborator
  • /login was a string comparison, so a typo in the literal compiled fine and failed at runtime. Commands are now a SlashCommand enum: adding one fails to compile until it is both handled and described. /help is generated from the variants, so it cannot drift from what actually parses. /plan came along free — it toggles the same state as Shift+Tab, which nothing in the UI mentioned.

  • A recognised command is coloured in the prompt, so you can see it will run before pressing Enter. The highlight asks the same parse the controller dispatches on, rather than re-deriving the rule, so it cannot colour something that would not run.

  • /help output goes to a new Entry::Info rather than Entry::Response. Streamed text merges into a trailing Response, so running /help while the agent was replying appended the model's text onto the help output. Info is never merged into, so the fix is structural rather than a guard.

  • A command is now the whole input: one line, starting with /. Previously " /plan" ran with no highlight to match, and "/plan\nmore text" ran the command and discarded the rest without saying so.

  • Unrelated one-liner: crates/agent/src/agent.rs was failing cargo fmt on main, which reddens CI for every open PR.

Verified with cargo fmt, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace (74 passing). Both behaviour changes above have regression tests.

Comment thread crates/alan/src/views/mod.rs
Comment thread Cargo.toml Outdated
editor_text joined the whole buffer to inspect its first line, so a
large paste made every keystroke O(buffer). Only line 0 can be a
command, and it is O(1) to reach.

Also bumps strum to 0.28 and drops two tautological tests: help is
generated by iterating the variants, so asserting it contains them
tests nothing, and name/parse are both derived from the same strum
attribute.
Rust 1.98 added the drain_collect lint, which fails the workspace under
-D warnings. Draining into a new Vec to join it allocates twice.
# Conflicts:
#	crates/alan/src/core/controller.rs
#	crates/alan/src/core/mod.rs
#	crates/alan/src/views/mod.rs
@Revantark
Revantark merged commit fbca18b into Revantark:main Aug 22, 2026
1 check passed
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