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

@@ -15,7 +15,7 @@ allowed-tools: SlashCommand(*), Bash(*)
## Purpose
Execute implementation tasks with YOLO permissions (auto-approves all confirmations).
Execute implementation tasks with **YOLO permissions** (auto-approves all confirmations).
**Supported Tools**: codex, gemini (default), qwen
**Key Feature**: Automatic context inference and file pattern detection
@@ -37,131 +37,47 @@ Auto-approves: file pattern inference, execution, file modifications, summary ge
### Context Inference
Auto-selects files based on:
- **Keywords**: "auth" → `@{**/*auth*,**/*user*}`
- **Technology**: "React" → `@{src/**/*.{jsx,tsx}}`
- **Task Type**: "api" → `@{**/api/**/*,**/routes/**/*}`
- **Always**: `@{CLAUDE.md,**/*CLAUDE.md}`
Auto-selects files based on keywords and technology:
- "auth" → `@{**/*auth*,**/*user*}`
- "React" → `@{src/**/*.{jsx,tsx}}`
- "api" → `@{**/api/**/*,**/routes/**/*}`
- Always includes: `@{CLAUDE.md,**/*CLAUDE.md}`
### File Pattern Reference
- All files: `@{**/*}`
- Source files: `@{src/**/*}`
- TypeScript: `@{*.ts,*.tsx}`
- JavaScript: `@{*.js,*.jsx}`
- Python: `@{*.py}`
- Tests: `@{**/*.test.*,**/*.spec.*}`
- Config files: `@{*.config.*,**/config/**/*}`
For precise file targeting, use `rg` or MCP tools to discover files first.
### Complex Pattern Discovery
For precise file targeting, use semantic discovery BEFORE CLI execution:
### Codex Session Continuity
**Workflow**: Discover → Extract precise paths → Build CONTEXT field
```bash
# Step 1: Discover files semantically
rg "target_pattern" --files-with-matches --type ts
mcp__code-index__find_files(pattern="*auth*")
# Step 2: Build precise CONTEXT from discovery results
CONTEXT: @{src/auth/module.ts,src/middleware/auth.ts,CLAUDE.md}
# Step 3: Execute with precise file references
codex -C src --full-auto exec "
PURPOSE: Implement authentication
TASK: Add JWT validation
MODE: auto
CONTEXT: @{auth/module.ts,middleware/auth.ts,CLAUDE.md}
EXPECTED: Complete implementation
RULES: Follow security best practices
" --skip-git-repo-check -s danger-full-access
```
## Command Templates
### Gemini/Qwen (with YOLO approval)
```bash
cd [dir] && ~/.claude/scripts/[gemini|qwen]-wrapper --approval-mode yolo -p "
PURPOSE: [implementation goal]
TASK: [specific task]
MODE: write
CONTEXT: @{inferred_patterns} @{CLAUDE.md}
EXPECTED: Implementation with file:line references
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
"
```
### Codex
```bash
codex -C [dir] --full-auto exec "
PURPOSE: [implementation goal]
TASK: [specific task]
MODE: auto
CONTEXT: @{inferred_patterns} @{CLAUDE.md}
EXPECTED: Implementation with file:line references
RULES: [constraints]
" --skip-git-repo-check -s danger-full-access
# With image attachment
codex -C [dir] -i design.png --full-auto exec "..." --skip-git-repo-check -s danger-full-access
```
### Codex with Resume (for related tasks)
**Resume Pattern** for related tasks:
```bash
# First task - establish session
codex -C [dir] --full-auto exec "
PURPOSE: [implementation goal]
TASK: [specific task]
MODE: auto
CONTEXT: @{inferred_patterns} @{CLAUDE.md}
EXPECTED: Implementation with file:line references
RULES: [constraints]
" --skip-git-repo-check -s danger-full-access
codex -C [dir] --full-auto exec "[task]" --skip-git-repo-check -s danger-full-access
# Related follow-up task - continue session
codex --full-auto exec "
PURPOSE: [continuation goal]
TASK: [related task]
MODE: auto
CONTEXT: Previous implementation from session
EXPECTED: Enhanced/extended implementation
RULES: Maintain consistency with previous work
" resume --last --skip-git-repo-check -s danger-full-access
# Related task - continue session
codex --full-auto exec "[related-task]" resume --last --skip-git-repo-check -s danger-full-access
```
**Resume Decision**: Use `resume --last` when current task extends/relates to previous execution in conversation memory. See intelligent-tools-strategy.md for auto-resume rules.
Use `resume --last` when current task extends/relates to previous execution. See intelligent-tools-strategy.md for auto-resume rules.
## Enhancement Integration
## Parameters
**When `--enhance` flag present** (Description Mode only):
1. Execute `/enhance-prompt "[description]"` first
2. Use enhanced output (INTENT/CONTEXT/ACTION) for execution
3. Build command with enhanced context
**Note**: Task ID Mode uses task JSON directly (no enhancement).
## Options
- `--tool <codex|gemini|qwen>`: Select CLI tool (default: gemini)
- `--enhance`: Enhance input with `/enhance-prompt` first
- `--debug`: Verbose logging
- `--save-session`: Save execution to workflow session
- `--tool <codex|gemini|qwen>` - Select CLI tool (default: gemini)
- `--enhance` - Enhance input with `/enhance-prompt` first (Description Mode only)
- `<description|task-id>` - Natural language description or task identifier
- `--debug` - Verbose logging
- `--save-session` - Save execution to workflow session
## Workflow Integration
**Session Management**: Auto-detects `.workflow/.active-*` marker
- **Active**: Save to `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
- **None**: Create new session
- Active session: Save to `.workflow/WFS-[id]/.chat/execute-[timestamp].md`
- No session: Create new session
**Task Integration**: Load from `.task/[TASK-ID].json`, update status, generate summary
**Auto-Generated Outputs**:
- **Summary**: `.summaries/[TASK-ID]-summary.md`
- **Session**: `.chat/execute-[timestamp].md`
## Examples
```bash
# Description mode (default: gemini)
# Description mode with auto-detection
/cli:execute "implement JWT authentication with middleware"
# Enhanced prompt
@@ -177,3 +93,7 @@ RULES: Maintain consistency with previous work
/cli:execute --tool qwen --enhance "refactor auth module"
```
## Notes
- Command templates, YOLO mode details, and session management: see intelligent-tools-strategy.md (loaded in memory)
- Auto-generated outputs: `.summaries/[TASK-ID]-summary.md`, `.chat/execute-[timestamp].md`