mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-04 01:40:45 +08:00
- Implemented CliCommandNode component for executing CLI tools with AI models. - Implemented PromptNode component for constructing AI prompts with context. - Added styling for mode and tool badges in both components. - Enhanced user experience with command and argument previews, execution status, and error handling. test: add comprehensive tests for ask_question tool - Created direct test for ask_question tool execution. - Developed end-to-end tests to validate ask_question tool integration with WebSocket and A2UI surfaces. - Implemented simple and integrated WebSocket tests to ensure proper message handling and surface reception. - Added tool registration test to verify ask_question tool is correctly registered. chore: add WebSocket listener and simulation tests - Added WebSocket listener for A2UI surfaces to facilitate testing. - Implemented frontend simulation test to validate complete flow from backend to frontend. - Created various test scripts to ensure robust testing of ask_question tool functionality.
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
"use strict";(globalThis.webpackChunkccw_docs=globalThis.webpackChunkccw_docs||[]).push([[954],{1184(e,i,n){n.d(i,{R:()=>t,x:()=>d});var r=n(3696);const s={},c=r.createContext(s);function t(e){const i=r.useContext(c);return r.useMemo(function(){return"function"==typeof e?e(i):{...i,...e}},[i,e])}function d(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),r.createElement(c.Provider,{value:i},e.children)}},1517(e,i,n){n.r(i),n.d(i,{assets:()=>l,contentTitle:()=>d,default:()=>h,frontMatter:()=>t,metadata:()=>r,toc:()=>o});const r=JSON.parse('{"id":"commands/cli/codex-review","title":"/cli:codex-review","description":"Interactive code review using Codex CLI with configurable review targets","source":"@site/docs/commands/cli/codex-review.mdx","sourceDirName":"commands/cli","slug":"/commands/cli/codex-review","permalink":"/docs/docs/commands/cli/codex-review","draft":false,"unlisted":false,"editUrl":"https://github.com/ccw/docs/tree/main/docs/commands/cli/codex-review.mdx","tags":[],"version":"current","sidebarPosition":2,"frontMatter":{"title":"/cli:codex-review","sidebar_label":"/cli:codex-review","sidebar_position":2,"description":"Interactive code review using Codex CLI with configurable review targets"},"sidebar":"docs","previous":{"title":"/cli:cli-init","permalink":"/docs/docs/commands/cli/cli-init"},"next":{"title":"/memory:update-full","permalink":"/docs/docs/commands/memory/memory-update-full"}}');var s=n(2540),c=n(1184);const t={title:"/cli:codex-review",sidebar_label:"/cli:codex-review",sidebar_position:2,description:"Interactive code review using Codex CLI with configurable review targets"},d="/cli",l={},o=[{value:"Overview",id:"overview",level:2},{value:"Review Parameters",id:"review-parameters",level:2},{value:"Usage",id:"usage",level:2},{value:"Direct Execution (No Interaction)",id:"direct-execution-no-interaction",level:3},{value:"Interactive Mode",id:"interactive-mode",level:3},{value:"Review Targets",id:"review-targets",level:2},{value:"Focus Areas",id:"focus-areas",level:2},{value:"Execution Flow",id:"execution-flow",level:2},{value:"Interactive Mode",id:"interactive-mode-1",level:3},{value:"Command Construction",id:"command-construction",level:3},{value:"Prompt Template",id:"prompt-template",level:2},{value:"Validation Constraints",id:"validation-constraints",level:2},{value:"Valid Combinations",id:"valid-combinations",level:3},{value:"Invalid Combinations",id:"invalid-combinations",level:3},{value:"Error Handling",id:"error-handling",level:2},{value:"No Changes to Review",id:"no-changes-to-review",level:3},{value:"Invalid Branch",id:"invalid-branch",level:3},{value:"Invalid Commit",id:"invalid-commit",level:3},{value:"Examples",id:"examples",level:2},{value:"Pre-Commit Review",id:"pre-commit-review",level:3},{value:"Branch Comparison",id:"branch-comparison",level:3},{value:"Security-Focused Review",id:"security-focused-review",level:3},{value:"Related Commands",id:"related-commands",level:2},{value:"Integration Notes",id:"integration-notes",level:2}];function a(e){const i={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,c.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.header,{children:(0,s.jsxs)(i.h1,{id:"cli",children:["/cli",":codex-review"]})}),"\n",(0,s.jsxs)(i.p,{children:["Interactive code review command that invokes ",(0,s.jsx)(i.code,{children:"codex review"})," via CCW CLI endpoint with guided parameter selection."]}),"\n",(0,s.jsx)(i.h2,{id:"overview",children:"Overview"}),"\n",(0,s.jsxs)(i.p,{children:["The ",(0,s.jsx)(i.code,{children:"/cli:codex-review"})," command provides an interface to Codex's powerful code review capabilities, supporting multiple review targets and customizable review parameters."]}),"\n",(0,s.jsx)(i.h2,{id:"review-parameters",children:"Review Parameters"}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Parameter"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsxs)(i.tbody,{children:[(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"[PROMPT]"})}),(0,s.jsx)(i.td,{children:"Custom review instructions (positional)"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"-c model=<model>"})}),(0,s.jsx)(i.td,{children:"Override model via config"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"--uncommitted"})}),(0,s.jsx)(i.td,{children:"Review staged, unstaged, and untracked changes"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"--base <BRANCH>"})}),(0,s.jsx)(i.td,{children:"Review changes against base branch"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"--commit <SHA>"})}),(0,s.jsx)(i.td,{children:"Review changes introduced by a commit"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"--title <TITLE>"})}),(0,s.jsx)(i.td,{children:"Optional commit title for review summary"})]})]})]}),"\n",(0,s.jsx)(i.h2,{id:"usage",children:"Usage"}),"\n",(0,s.jsx)(i.h3,{id:"direct-execution-no-interaction",children:"Direct Execution (No Interaction)"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:'# Review uncommitted changes\r\n/cli:codex-review --uncommitted\r\n\r\n# Review against main branch\r\n/cli:codex-review --base main\r\n\r\n# Review specific commit\r\n/cli:codex-review --commit abc123\r\n\r\n# Review with custom model\r\n/cli:codex-review --uncommitted --model o3\r\n\r\n# Review with security focus\r\n/cli:codex-review --uncommitted security\r\n\r\n# Full options\r\n/cli:codex-review --base main --model o3 --title "Auth Feature" security\n'})}),"\n",(0,s.jsx)(i.h3,{id:"interactive-mode",children:"Interactive Mode"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:"# Start interactive selection (guided flow)\r\n/cli:codex-review\n"})}),"\n",(0,s.jsx)(i.h2,{id:"review-targets",children:"Review Targets"}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Target"}),(0,s.jsx)(i.th,{children:"Description"}),(0,s.jsx)(i.th,{children:"Use Case"})]})}),(0,s.jsxs)(i.tbody,{children:[(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"Uncommitted"})}),(0,s.jsx)(i.td,{children:"Reviews staged, unstaged, and untracked changes"}),(0,s.jsx)(i.td,{children:"Quick pre-commit review"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"Base Branch"})}),(0,s.jsx)(i.td,{children:"Reviews changes against specified branch"}),(0,s.jsx)(i.td,{children:"PR review, branch comparison"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"Commit"})}),(0,s.jsx)(i.td,{children:"Reviews changes introduced by specific commit"}),(0,s.jsx)(i.td,{children:"Historical commit review"})]})]})]}),"\n",(0,s.jsx)(i.h2,{id:"focus-areas",children:"Focus Areas"}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Focus"}),(0,s.jsx)(i.th,{children:"Description"}),(0,s.jsx)(i.th,{children:"Key Checks"})]})}),(0,s.jsxs)(i.tbody,{children:[(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"General"})}),(0,s.jsx)(i.td,{children:"Comprehensive review"}),(0,s.jsx)(i.td,{children:"Correctness, style, bugs, documentation"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"Security"})}),(0,s.jsx)(i.td,{children:"Security-first review"}),(0,s.jsx)(i.td,{children:"Injection vulnerabilities, auth issues, validation, data exposure"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"Performance"})}),(0,s.jsx)(i.td,{children:"Optimization review"}),(0,s.jsx)(i.td,{children:"Complexity analysis, memory usage, query optimization, caching"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.strong,{children:"Code Quality"})}),(0,s.jsx)(i.td,{children:"Maintainability review"}),(0,s.jsx)(i.td,{children:"SOLID principles, code duplication, naming conventions, test coverage"})]})]})]}),"\n",(0,s.jsx)(i.h2,{id:"execution-flow",children:"Execution Flow"}),"\n",(0,s.jsx)(i.h3,{id:"interactive-mode-1",children:"Interactive Mode"}),"\n",(0,s.jsxs)(i.ol,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.strong,{children:"Select Review Target"})," - Choose uncommitted, base branch, or commit"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.strong,{children:"Select Focus Area"})," - Choose general, security, performance, or code quality"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.strong,{children:"Configure Options"})," - Set model, title, and custom instructions"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.strong,{children:"Execute Review"})," - Runs Codex review with selected parameters"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.strong,{children:"Display Results"})," - Shows structured review findings"]}),"\n"]}),"\n",(0,s.jsx)(i.h3,{id:"command-construction",children:"Command Construction"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:'# Base structure\r\nccw cli -p "<PROMPT>" --tool codex --mode review [OPTIONS]\r\n\r\n# Example with custom prompt\r\nccw cli -p "\r\nPURPOSE: Comprehensive code review to identify issues and improve quality\r\nTASK: \u2022 Review correctness and logic \u2022 Check standards compliance \u2022 Identify bugs\r\nMODE: review\r\nCONTEXT: Reviewing uncommitted changes\r\nCONSTRAINTS: Actionable feedback\r\n" --tool codex --mode review --rule analysis-review-code-quality\r\n\r\n# Example with target flag only\r\nccw cli --tool codex --mode review --uncommitted\n'})}),"\n",(0,s.jsx)(i.h2,{id:"prompt-template",children:"Prompt Template"}),"\n",(0,s.jsx)(i.p,{children:"Follow the standard CCW CLI prompt template:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:"PURPOSE: [what] + [why] + [success criteria]\r\nTASK: \u2022 [step 1] \u2022 [step 2] \u2022 [step 3]\r\nMODE: review\r\nCONTEXT: [target description] | Memory: [project context]\r\nEXPECTED: [deliverable format] + [quality criteria]\r\nCONSTRAINTS: [domain constraints]\n"})}),"\n",(0,s.jsx)(i.h2,{id:"validation-constraints",children:"Validation Constraints"}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.strong,{children:"IMPORTANT"}),": Target flags (",(0,s.jsx)(i.code,{children:"--uncommitted"}),", ",(0,s.jsx)(i.code,{children:"--base"}),", ",(0,s.jsx)(i.code,{children:"--commit"}),") and custom prompt are ",(0,s.jsx)(i.strong,{children:"mutually exclusive"}),"."]}),"\n",(0,s.jsx)(i.h3,{id:"valid-combinations",children:"Valid Combinations"}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Command"}),(0,s.jsx)(i.th,{children:"Result"})]})}),(0,s.jsxs)(i.tbody,{children:[(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:'codex review "Focus on security"'})}),(0,s.jsx)(i.td,{children:"\u2713 Custom prompt, reviews uncommitted (default)"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"codex review --uncommitted"})}),(0,s.jsx)(i.td,{children:"\u2713 No prompt, uses default review"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"codex review --base main"})}),(0,s.jsx)(i.td,{children:"\u2713 No prompt, uses default review"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:"codex review --commit abc123"})}),(0,s.jsx)(i.td,{children:"\u2713 No prompt, uses default review"})]})]})]}),"\n",(0,s.jsx)(i.h3,{id:"invalid-combinations",children:"Invalid Combinations"}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Command"}),(0,s.jsx)(i.th,{children:"Result"})]})}),(0,s.jsxs)(i.tbody,{children:[(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:'codex review --uncommitted "prompt"'})}),(0,s.jsx)(i.td,{children:"\u2717 Mutually exclusive"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:'codex review --base main "prompt"'})}),(0,s.jsx)(i.td,{children:"\u2717 Mutually exclusive"})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:(0,s.jsx)(i.code,{children:'codex review --commit abc123 "prompt"'})}),(0,s.jsx)(i.td,{children:"\u2717 Mutually exclusive"})]})]})]}),"\n",(0,s.jsx)(i.h2,{id:"error-handling",children:"Error Handling"}),"\n",(0,s.jsx)(i.h3,{id:"no-changes-to-review",children:"No Changes to Review"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{children:"No changes found for review target. Suggestions:\r\n- For --uncommitted: Make some code changes first\r\n- For --base: Ensure branch exists and has diverged\r\n- For --commit: Verify commit SHA exists\n"})}),"\n",(0,s.jsx)(i.h3,{id:"invalid-branch",children:"Invalid Branch"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:"# Show available branches\r\ngit branch -a --list | head -20\n"})}),"\n",(0,s.jsx)(i.h3,{id:"invalid-commit",children:"Invalid Commit"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:"# Show recent commits\r\ngit log --oneline -10\n"})}),"\n",(0,s.jsx)(i.h2,{id:"examples",children:"Examples"}),"\n",(0,s.jsx)(i.h3,{id:"pre-commit-review",children:"Pre-Commit Review"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:"# Quick review before committing\r\n/cli:codex-review --uncommitted\r\n\r\n# Output:\r\n# Reviewing 3 files with 45 changes\r\n# - src/auth/login.ts: 2 issues found\r\n# - src/user/profile.ts: 1 issue found\r\n# - tests/auth.test.ts: No issues\n"})}),"\n",(0,s.jsx)(i.h3,{id:"branch-comparison",children:"Branch Comparison"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:"# Review feature branch against main\r\n/cli:codex-review --base feature-auth\r\n\r\n# Shows all differences between branches\n"})}),"\n",(0,s.jsx)(i.h3,{id:"security-focused-review",children:"Security-Focused Review"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-bash",children:'# Security review of uncommitted changes\r\n/cli:codex-review --uncommitted "Focus on security vulnerabilities, injection risks, authentication issues"\r\n\r\n# Prioritizes security-related findings\n'})}),"\n",(0,s.jsx)(i.h2,{id:"related-commands",children:"Related Commands"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsxs)(i.strong,{children:["/cli",":cli-init"]})," - Initialize CLI configuration"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsxs)(i.strong,{children:["/workflow",":review-session-cycle"]})," - Session-based code review"]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsxs)(i.strong,{children:["/workflow",":review-module-cycle"]})," - Module-specific code review"]}),"\n"]}),"\n",(0,s.jsx)(i.h2,{id:"integration-notes",children:"Integration Notes"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:["Uses ",(0,s.jsx)(i.code,{children:"ccw cli --tool codex --mode review"})," endpoint"]}),"\n",(0,s.jsxs)(i.li,{children:["Model passed via prompt (codex uses ",(0,s.jsx)(i.code,{children:"-c model="})," internally)"]}),"\n",(0,s.jsx)(i.li,{children:"Target flags passed through to codex"}),"\n",(0,s.jsx)(i.li,{children:"Prompt follows standard CCW CLI template format"}),"\n",(0,s.jsxs)(i.li,{children:["Results include severity levels, file",":line"," references, and remediation suggestions"]}),"\n"]})]})}function h(e={}){const{wrapper:i}={...(0,c.R)(),...e.components};return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(a,{...e})}):a(e)}}}]); |