Fix session management location inference and ccw command usage

This commit addresses multiple issues in session management and command documentation:

Session Management Fixes:
- Add auto-inference of location from type parameter in session.ts
- When --type lite-plan/lite-fix is specified, automatically set location accordingly
- Preserve explicit --location parameter when provided
- Update session-manager.ts to support type-based location inference
- Fix metadata filename selection (session-metadata.json vs workflow-session.json)

Command Documentation Fixes:
- Add missing --mode analysis parameter (3 locations):
  * commands/memory/docs.md
  * commands/workflow/lite-execute.md (2 instances)
- Add missing --mode write parameter (4 locations):
  * commands/workflow/tools/task-generate-agent.md
- Remove non-existent subcommands (3 locations):
  * commands/workflow/session/complete.md (manifest, project)
- Update session command syntax to use simplified format:
  * Changed from 'ccw session manifest read' to 'test -f' checks
  * Changed from 'ccw session project read' to 'test -f' checks

Documentation Updates:
- Update lite-plan.md and lite-fix.md to use --type parameter
- Update session/start.md to document lite-plan and lite-fix types
- Sync all fixes to skills/command-guide/reference directory (84 files)

All ccw command usage across the codebase is now consistent and correct.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-17 18:09:23 +08:00
parent 74a830694c
commit c16da759b2
46 changed files with 1318 additions and 411 deletions

View File

@@ -5,40 +5,67 @@ Before implementation, always:
- Map dependencies and integration points
- Understand testing framework and coding conventions
## Context Gathering
## MCP Tools Usage
**MANDATORY**: Use `codex_lens` (MCP tool) for all code search and analysis.
### smart_search - Code Search (REQUIRED)
### codex_lens (REQUIRED)
**When**: Find code, understand codebase structure, locate implementations
**MCP Actions**: `init`, `search`, `search_files` (Advanced ops via CLI: `codexlens --help`)
**Initialize**:
```
codex_lens(action="init", path=".")
```
- Auto-generates embeddings if `fastembed` installed
- Skip with `--no-embeddings` flag
**Search** (Auto hybrid mode):
```
codex_lens(action="search", query="authentication")
```
**Search Files**:
```
codex_lens(action="search_files", query="payment")
**How**:
```javascript
smart_search(query="authentication logic") // Auto mode (recommended)
smart_search(action="init", path=".") // First-time setup
smart_search(query="LoginUser", mode="exact") // Precise matching
smart_search(query="import", mode="ripgrep") // Fast, no index
```
### read_file (MCP)
- Read files found by codex_lens
- Directory traversal with patterns
- Batch operations
**Modes**: `auto` (intelligent routing), `hybrid` (best quality), `exact` (FTS), `ripgrep` (fast)
### smart_search
- Fallback when codex_lens unavailable
- Small projects (<100 files)
---
### Exa
- External APIs, libraries, frameworks
- Recent documentation beyond knowledge cutoff
- Public implementation examples
### read_file - Read File Contents
**When**: Read files found by smart_search
**How**:
```javascript
read_file(path="/path/to/file.ts") // Single file
read_file(path="/src/**/*.config.ts") // Pattern matching
```
---
### edit_file - Modify Files
**When**: Built-in Edit tool fails or need advanced features
**How**:
```javascript
edit_file(path="/file.ts", old_string="...", new_string="...", mode="update")
edit_file(path="/file.ts", line=10, content="...", mode="insert_after")
```
**Modes**: `update` (replace text), `insert_after`, `insert_before`, `delete_line`
---
### write_file - Create/Overwrite Files
**When**: Create new files or completely replace content
**How**:
```javascript
write_file(path="/new-file.ts", content="...")
```
---
### Exa - External Search
**When**: Find documentation/examples outside codebase
**How**:
```javascript
exa(query="React hooks 2025 documentation")
exa(query="FastAPI auth example github")
```