Skip to content

feat(commands): add /explain slash command with /screen and image support#159

Merged
quiet-node merged 1 commit into
mainfrom
worktree-zazzy-singing-hedgehog
May 11, 2026
Merged

feat(commands): add /explain slash command with /screen and image support#159
quiet-node merged 1 commit into
mainfrom
worktree-zazzy-singing-hedgehog

Conversation

@quiet-node
Copy link
Copy Markdown
Owner

@quiet-node quiet-node commented May 11, 2026

Summary

  • Adds /explain slash command: explains any concept, term, or code snippet in plain language with a concrete example
  • Extends /screen + utility command combos: utility commands (e.g. /screen /explain) now build a composed prompt override so the screenshot is used as $INPUT instead of sending raw trigger strings to the model
  • Adds image fallback for utility commands: /explain (and other non-translate utility commands) with only an attached image build a synthetic prompt using "the attached image" as $INPUT when no text is present

Changes

  • src/config/commands.ts — new /explain entry in the COMMANDS registry with prompt template, docs, and prompt help metadata
  • src/components/CommandSuggestion.tsxEXPLAIN_ICON SVG and iconForTrigger case for /explain
  • src/App.tsxhandleScreenSubmit accepts promptOverride?; submit handler builds screenPromptOverride for /screen + utility combos; image fallback for utility commands; CONTROL_CHARS extracted to module-level constant (DRY fix)
  • src/__tests__/App.test.tsx — tests for /screen /explain, no-text image fallback, and /screen /translate passthrough behavior
  • docs/commands.md and src-tauri/prompts/generated/slash_commands.txt — documentation and prompt metadata updated

Fixes #134

Test plan

  • /explain what is a closure? — returns plain-language explanation with example
  • /explain with highlighted code selected — uses selected text as $INPUT
  • /screen /explain with no other text — captures screen, explains screenshot content
  • /screen /explain this error — captures screen, uses "this error" as additional instruction
  • /explain with attached image and no text — uses "the attached image" as synthetic input
  • /explain with no text and no image — no submission (correct early exit)
  • /screen /translate French — screen captures but sends raw query (translate excluded from screenshot synthetic input by design, matches non-screen behavior)
  • Tab completion shows /explain in suggestion list with correct icon and description

…port

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node quiet-node merged commit b78e9b3 into main May 11, 2026
3 checks passed
@quiet-node quiet-node deleted the worktree-zazzy-singing-hedgehog branch May 11, 2026 22:51
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.

Feature: Add a new slash command

1 participant