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

@@ -74,7 +74,7 @@ ccw cli exec "<PROMPT>" --tool <gemini|qwen|codex> --mode <analysis|write>
- **Mode is MANDATORY** - ALWAYS explicitly specify `--mode analysis|write` (no implicit defaults)
- **One template required** - ALWAYS reference exactly ONE template in RULES (use universal fallback if no specific match)
- **Write protection** - Require EXPLICIT `--mode write` for file operations
- **No escape characters** - NEVER use `\$`, `\"`, `\'` in CLI commands
- **Use double quotes for shell expansion** - Always wrap prompts in double quotes `"..."` to enable `$(cat ...)` command substitution; NEVER use single quotes or escape characters (`\$`, `\"`, `\'`)
---
@@ -276,9 +276,22 @@ ccw cli exec "..." --tool gemini --mode analysis --cd src
- `universal/00-universal-creative-style.txt` - For exploratory tasks
**Command Substitution Rules**:
- Use `$(cat ...)` directly - do NOT read template content first
- NEVER use escape characters: `\$`, `\"`, `\'`
- Tilde expands correctly in prompt context
- Use `$(cat ...)` directly in **double quotes** - command substitution executes in your local shell BEFORE passing to ccw
- Shell expands `$(cat ...)` into file content automatically - do NOT read template content first
- NEVER use escape characters (`\$`, `\"`, `\'`) or single quotes - these prevent shell expansion
- Tilde (`~`) expands correctly in prompt context
**Critical**: Use double quotes `"..."` around the entire prompt to enable `$(cat ...)` expansion:
```bash
# ✓ CORRECT - double quotes allow shell expansion
ccw cli exec "RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ..." --tool gemini
# ✗ WRONG - single quotes prevent expansion
ccw cli exec 'RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ...' --tool gemini
# ✗ WRONG - escaped $ prevents expansion
ccw cli exec "RULES: \$(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) ..." --tool gemini
```
**Examples**:
```bash