diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index cd5b950e..6801a3ca 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -1563,6 +1563,28 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo } return; } + else if (commandName === 'review' && currentSessionId) { + try { + await sessionActions.waitForConnectionOrThrow(); + const visibleText = await renderMagicPrompt('session.review.visible'); + const instructionsText = await renderMagicPrompt('session.review.instructions'); + await sendMessage( + visibleText, + currentProviderId, + currentModelId, + currentAgentName, + [], + agentMentionName, + [{ text: instructionsText, synthetic: true }], + currentVariant, + inputMode, + ); + scrollToBottom?.({ instant: true, force: true }); + } catch (error) { + toast.error(error instanceof Error ? error.message : 'Failed to review changes'); + } + return; + } } // Collect all attachments for error recovery diff --git a/packages/ui/src/components/chat/CommandAutocomplete.tsx b/packages/ui/src/components/chat/CommandAutocomplete.tsx index 07255f76..20076bf2 100644 --- a/packages/ui/src/components/chat/CommandAutocomplete.tsx +++ b/packages/ui/src/components/chat/CommandAutocomplete.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { RiCommandLine, RiFileLine, RiFlashlightLine, RiRefreshLine, RiScissorsLine, RiTerminalBoxLine, RiArrowGoBackLine, RiArrowGoForwardLine } from '@remixicon/react'; +import { RiCommandLine, RiFileLine, RiFlashlightLine, RiRefreshLine, RiScissorsLine, RiTerminalBoxLine, RiArrowGoBackLine, RiArrowGoForwardLine, RiSearchEyeLine } from '@remixicon/react'; import { cn, fuzzyMatch } from '@/lib/utils'; import { useSessionUIStore } from '@/sync/session-ui-store'; import { useSessionMessages } from '@/sync/sync-context'; @@ -122,6 +122,10 @@ export const CommandAutocomplete = React.forwardRef; case 'compact': return ; + case 'review': + return ; case 'test': case 'build': case 'run': diff --git a/packages/ui/src/components/sections/magic-prompts/MagicPromptsPage.tsx b/packages/ui/src/components/sections/magic-prompts/MagicPromptsPage.tsx index d5858b85..5dc07fe2 100644 --- a/packages/ui/src/components/sections/magic-prompts/MagicPromptsPage.tsx +++ b/packages/ui/src/components/sections/magic-prompts/MagicPromptsPage.tsx @@ -131,6 +131,14 @@ const PROMPT_PAGE_MAP: Record = { { id: 'session.summary.instructions', title: 'Instructions' }, ], }, + 'session.review': { + title: 'Workspace Review', + description: 'Prompts used by the /review slash command: visible user message + hidden instructions. Reviews current workspace changes for high-signal issues only.', + blocks: [ + { id: 'session.review.visible', title: 'Visible Prompt' }, + { id: 'session.review.instructions', title: 'Instructions' }, + ], + }, }; const hasOwn = (input: Record, key: string) => Object.prototype.hasOwnProperty.call(input, key); diff --git a/packages/ui/src/components/sections/magic-prompts/MagicPromptsSidebar.tsx b/packages/ui/src/components/sections/magic-prompts/MagicPromptsSidebar.tsx index 751a2a17..5691581f 100644 --- a/packages/ui/src/components/sections/magic-prompts/MagicPromptsSidebar.tsx +++ b/packages/ui/src/components/sections/magic-prompts/MagicPromptsSidebar.tsx @@ -44,6 +44,7 @@ export const MagicPromptsSidebar: React.FC = ({ onItem group: 'Session', items: [ { id: 'session.summary', title: 'Session Summary' }, + { id: 'session.review', title: 'Workspace Review' }, ], }, ] as const; diff --git a/packages/ui/src/lib/magicPrompts.ts b/packages/ui/src/lib/magicPrompts.ts index 20765a8c..780417d0 100644 --- a/packages/ui/src/lib/magicPrompts.ts +++ b/packages/ui/src/lib/magicPrompts.ts @@ -24,7 +24,9 @@ export type MagicPromptId = | 'plan.implement.visible' | 'plan.implement.instructions' | 'session.summary.visible' - | 'session.summary.instructions'; + | 'session.summary.instructions' + | 'session.review.visible' + | 'session.review.instructions'; export interface MagicPromptDefinition { id: MagicPromptId; @@ -506,6 +508,56 @@ Formatting: Respond in the same language the user used most in the conversation.`, }, + { + id: 'session.review.visible', + title: 'Workspace Review Visible Prompt', + group: 'Session', + description: 'Visible user message sent by the /review command.', + template: 'Review the changes made in this workspace.', + }, + { + id: 'session.review.instructions', + title: 'Workspace Review Instructions', + group: 'Session', + description: 'Hidden instructions attached to the /review command. Reviews current workspace changes for high-signal issues only.', + template: ` +Report only real, high-signal issues introduced by these changes. + +The diff is the source of truth. Use the local repo only as ancillary context when you need to validate a specific claim or check an applicable rule. + +Focus on: +- runtime bugs +- incorrect logic +- broken assumptions in the changed code +- clear regressions introduced by the changes +- missing implementations across affected modules or targets when the diff clearly introduced the gap +- clear CLAUDE.md or AGENTS.md violations that apply to the changed files + +Do not report: +- pre-existing issues unrelated to the diff +- pedantic nitpicks a senior engineer would not flag +- issues a linter would catch +- subjective style preferences not explicitly required by CLAUDE.md or AGENTS.md +- speculative concerns or anything you cannot verify with high confidence +- missing tests or coverage gaps unless an applicable CLAUDE.md or AGENTS.md explicitly requires them for the changed area +- rules mentioned in CLAUDE.md or AGENTS.md but explicitly silenced in the code + +Validation pass: +- Before reporting an issue, re-check it against the diff plus only the local context you actually needed to read. +- For CLAUDE.md or AGENTS.md violations, verify the rule applies to the affected file path and cite the exact rule. +- If you are not certain an issue is real, omit it. + +Output: +- If no high-signal issues are found, respond with exactly: No high-signal issues found. +- Otherwise, return a concise numbered list. +- For each issue include: + - short title + - why it is a real problem + - affected file path + - category: bug or rule violation + +Keep the review concise and practical.`, + }, ] as const; const MAGIC_PROMPT_DEFINITION_BY_ID = new Map(