docs: refactor CLI command docs to eliminate redundancy

Streamlined 7 CLI command documentation files by removing duplicate
content that's already comprehensively covered in intelligent-tools-strategy.md
(loaded in memory). Established single source of truth (SSOT) pattern.

Changes:
- Removed duplicate command templates (→ strategy lines 51-118)
- Removed file pattern reference lists (→ strategy lines 324-329)
- Removed complex pattern discovery steps (→ strategy lines 331-355)
- Removed MODE field definitions (→ strategy lines 128-143)
- Removed tool feature descriptions (→ strategy lines 283-322)

Files streamlined:
- analyze.md: 117→61 lines (48% reduction)
- chat.md: 118→62 lines (47% reduction)
- execute.md: 180→100 lines (44% reduction)
- codex-execute.md: 481→473 lines (2% - preserved unique content)
- mode/bug-index.md: 144→75 lines (48% reduction)
- mode/code-analysis.md: 188→76 lines (60% reduction)
- mode/plan.md: 100→76 lines (24% reduction)

Total reduction: 681 lines removed across all files

Each doc now contains only:
- Unique purpose and parameters
- Command-specific execution flow
- Practical examples
- Brief reference to intelligent-tools-strategy.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-10-05 10:35:27 +08:00
parent a9d6de228e
commit 467963eee2
7 changed files with 203 additions and 690 deletions

View File

@@ -1,6 +1,5 @@
---
name: chat
description: Simple CLI interaction command for direct codebase analysis
usage: /cli:chat [--tool <codex|gemini|qwen>] [--enhance] "inquiry"
argument-hint: "[--tool codex|gemini|qwen] [--enhance] inquiry"
@@ -11,96 +10,39 @@ examples:
allowed-tools: SlashCommand(*), Bash(*)
---
# CLI Chat Command (/cli:chat)
## Purpose
Direct interaction with CLI tools for codebase analysis and Q&A.
Direct Q&A interaction with CLI tools for codebase analysis.
**Supported Tools**: codex, gemini (default), qwen
## Parameters
- `<inquiry>` (Required): Question or analysis request
- `--tool <codex|gemini|qwen>` (Optional): Select CLI tool (default: gemini)
- `--enhance` (Optional): Enhance inquiry with `/enhance-prompt` first
- `--all-files` (Optional): Include entire codebase in context
- `--save-session` (Optional): Save interaction to workflow session
- `<inquiry>` (Required) - Question or analysis request
- `--tool <codex|gemini|qwen>` - Select CLI tool (default: gemini)
- `--enhance` - Enhance inquiry with `/enhance-prompt` first
- `--all-files` - Include entire codebase in context
- `--save-session` - Save interaction to workflow session
## Execution Flow
1. Parse tool selection (default: gemini)
2. If `--enhance`: Execute `/enhance-prompt` first
3. Assemble context (files + CLAUDE.md)
4. Execute CLI tool
5. Optional: Save to session
## Enhancement Integration
**When `--enhance` flag present**: Execute `/enhance-prompt "[inquiry]"` first, then use enhanced output (INTENT/CONTEXT/ACTION) to build the chat command.
2. If `--enhance`: Execute `/enhance-prompt` to expand user intent
3. Assemble context: `@{CLAUDE.md}` + user-specified files or `--all-files`
4. Execute CLI tool with assembled context
5. Optionally save to workflow session
## Context Assembly
Context gathered from:
1. **Project Guidelines**: `@{CLAUDE.md,**/*CLAUDE.md}` (always)
2. **User-Explicit Files**: Files specified by user
3. **All Files Flag**: `--all-files` includes entire codebase
**Always included**: `@{CLAUDE.md,**/*CLAUDE.md}` (project guidelines)
### File Pattern Reference
- All files: `@{**/*}`
- Source files: `@{src/**/*}`
- TypeScript: `@{*.ts,*.tsx}`
- JavaScript: `@{*.js,*.jsx}`
- With docs: `@{CLAUDE.md,**/*CLAUDE.md}`
- Tests: `@{**/*.test.*,**/*.spec.*}`
- Config files: `@{*.config.*,**/config/**/*}`
**Optional**:
- User-explicit files from inquiry keywords
- `--all-files` flag includes entire codebase (`--all-files` wrapper parameter)
### Complex Pattern Discovery
For targeted analysis, use semantic discovery BEFORE CLI execution:
```bash
# Step 1: Discover relevant files
rg "specific_pattern" --files-with-matches --type ts
mcp__code-index__search_code_advanced(pattern="target_code", file_pattern="*.ts")
# Step 2: Build CONTEXT with discovered files
CONTEXT: @{CLAUDE.md} @{src/file1.ts,src/file2.ts}
# Step 3: Execute chat command
cd src && ~/.claude/scripts/gemini-wrapper -p "
PURPOSE: Answer specific inquiry
CONTEXT: @{CLAUDE.md,file1.ts,file2.ts}
EXPECTED: Detailed response
"
```
## Command Template
**Gemini/Qwen**:
```bash
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper -p "
PURPOSE: [inquiry goal]
TASK: [specific question]
CONTEXT: @{CLAUDE.md} @{target_files}
EXPECTED: [response format]
RULES: [constraints]
"
# With --all-files
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper --all-files -p "..."
```
**Codex**:
```bash
codex -C [dir] --full-auto exec "
PURPOSE: [inquiry goal]
TASK: [specific question]
CONTEXT: @{CLAUDE.md} @{target_files}
EXPECTED: [response format]
RULES: [constraints]
" --skip-git-repo-check -s danger-full-access
# With image attachment
codex -C [dir] -i screenshot.png --full-auto exec "..." --skip-git-repo-check -s danger-full-access
```
For targeted analysis, use `rg` or MCP tools to discover relevant files first, then build precise CONTEXT field.
## Examples
@@ -108,11 +50,12 @@ codex -C [dir] -i screenshot.png --full-auto exec "..." --skip-git-repo-check -s
/cli:chat "analyze the authentication flow" # Gemini (default)
/cli:chat --tool qwen "optimize React component" # Qwen
/cli:chat --tool codex "review security vulnerabilities" # Codex
/cli:chat --enhance "fix the login" # Enhanced prompt
/cli:chat --all-files "find all API endpoints" # Full codebase
/cli:chat --enhance "fix the login" # Enhanced prompt first
/cli:chat --all-files "find all API endpoints" # Full codebase context
```
## Session Persistence
## Notes
- **Active Session**: Save to `.workflow/WFS-[id]/.chat/chat-[timestamp].md`
- **No Session**: Return results directly
- Command templates and file patterns: see intelligent-tools-strategy.md (loaded in memory)
- Active workflow session: results saved to `.workflow/WFS-[id]/.chat/`
- No session: results returned directly