feat(commands): add /explain slash command with /screen and image support#159
Merged
Conversation
…port Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/explainslash command: explains any concept, term, or code snippet in plain language with a concrete example/screen+ utility command combos: utility commands (e.g./screen /explain) now build a composed prompt override so the screenshot is used as$INPUTinstead of sending raw trigger strings to the model/explain(and other non-translate utility commands) with only an attached image build a synthetic prompt using"the attached image"as$INPUTwhen no text is presentChanges
src/config/commands.ts— new/explainentry in theCOMMANDSregistry with prompt template, docs, and prompt help metadatasrc/components/CommandSuggestion.tsx—EXPLAIN_ICONSVG andiconForTriggercase for/explainsrc/App.tsx—handleScreenSubmitacceptspromptOverride?; submit handler buildsscreenPromptOverridefor/screen+ utility combos; image fallback for utility commands;CONTROL_CHARSextracted to module-level constant (DRY fix)src/__tests__/App.test.tsx— tests for/screen /explain, no-text image fallback, and/screen /translatepassthrough behaviordocs/commands.mdandsrc-tauri/prompts/generated/slash_commands.txt— documentation and prompt metadata updatedFixes #134
Test plan
/explain what is a closure?— returns plain-language explanation with example/explainwith highlighted code selected — uses selected text as$INPUT/screen /explainwith no other text — captures screen, explains screenshot content/screen /explain this error— captures screen, uses "this error" as additional instruction/explainwith attached image and no text — uses"the attached image"as synthetic input/explainwith 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)/explainin suggestion list with correct icon and description