Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 17:55:18 +08:00
commit f33f21dd79
19 changed files with 3530 additions and 0 deletions

99
commands/checkpoint.md Normal file
View File

@@ -0,0 +1,99 @@
---
description: Create session checkpoint with automatic state capture
---
# Checkpoint Workflow
Execute the session-management skill's checkpoint workflow to save progress.
## Step 1: Analyze Current State
The checkpoint manager will automatically analyze:
- Git changes (modified, added, deleted files)
- TDD metrics (if TDD mode active)
- Session metrics (time elapsed, objectives completed)
## Step 2: Gather Optional Inputs (if desired)
Use `AskUserQuestion` to ask if the user wants to provide additional context:
Ask: "Would you like to add notes or create a git commit with this checkpoint?"
Options:
- **Just save checkpoint** - Create checkpoint document only
- **Add notes** - Prompt for checkpoint notes (proceed to Question 2a)
- **Add notes and commit** - Prompt for notes and create git commit (proceed to Question 2a and 2b)
- **Commit without notes** - Skip notes, create commit with auto-generated message (proceed to Question 2b)
### Question 2a: Checkpoint Notes (if requested)
Ask: "What notes would you like to add to this checkpoint?"
Options:
- **"Completed [feature/task]"** - Standard completion note
- **"Work in progress on [area]"** - WIP note
- **"Blocked on [issue]"** - Blocker note
- **Other** - Let user type custom notes
### Question 2b: Git Commit (if requested)
Ask: "Should we create a git commit for this checkpoint?"
Options:
- **Auto-generate commit message** - Use checkpoint analysis to create message
- **Custom commit message** - Let user type custom message
- **Skip commit** - Just save checkpoint, no git commit
## Step 3: Execute Checkpoint
Based on collected inputs, execute the checkpoint command:
```bash
cd ${CLAUDE_PLUGIN_ROOT}/skills/session-management/scripts
# Basic checkpoint (no notes, no commit)
python session.py checkpoint
# With notes
python session.py checkpoint --notes "[user notes]"
# With notes and commit
python session.py checkpoint --notes "[user notes]" --commit
# With commit and custom message
python session.py checkpoint --commit --message "[custom message]"
# With TDD phase tracking
python session.py checkpoint --tdd-phase [RED|GREEN|REFACTOR]
```
The script will:
- Analyze git diff for changes
- Capture current metrics
- Generate checkpoint document
- Save to `.sessions/checkpoints/checkpoint_[timestamp].md`
- Optionally create git commit
## Step 4: Confirm Checkpoint Saved
Report to user:
- Checkpoint file location
- Summary of changes captured
- Git commit hash (if commit created)
- Current session progress
---
## Use This Command
At logical milestones during work:
- After completing a sub-task
- Before switching contexts
- When you want to save progress
- After each TDD cycle (RED, GREEN, REFACTOR)
## Integration Notes
- Integrates with **tdd-workflow** for automatic phase tracking
- Checkpoints saved to `.sessions/checkpoints/` directory
- Git commits tagged with checkpoint metadata

128
commands/session-end.md Normal file
View File

@@ -0,0 +1,128 @@
---
description: End session with comprehensive handoff generation
---
# Session End Workflow
Execute the session-management skill's finish workflow to create a comprehensive handoff.
## Step 1: Create Final Checkpoint
First, automatically create a final checkpoint to capture the current state:
```bash
cd ${CLAUDE_PLUGIN_ROOT}/skills/session-management/scripts
python session.py checkpoint --label "session-end"
```
This captures all uncommitted work and current metrics.
## Step 2: Gather Handoff Information
Use `AskUserQuestion` to collect information for the handoff document:
### Question 1: What Did You Accomplish?
Ask: "What did you accomplish in this session?"
Options:
- Analyze the session checkpoints and git commits to suggest:
- **"Completed [feature/task from objectives]"**
- **"Fixed [issues addressed]"**
- **"Implemented [components created]"**
- **"Refactored [areas improved]"**
- **Other** - Let user type custom accomplishments
### Question 2: What Decisions Were Made?
Ask: "Were there any important decisions or trade-offs made during this session?"
Options:
- **"Chose [technology/approach] because [reason]"** - Technical decision
- **"Decided to defer [feature] due to [constraint]"** - Scope decision
- **"No major decisions"** - Skip this section
- **Other** - Let user type custom decisions
### Question 3: What Should Next Session Remember?
Ask: "What context or next steps should be documented for the next session?"
Options:
- **"Continue with [specific task]"** - Next task note
- **"Watch out for [potential issue]"** - Warning note
- **"Remember to [action item]"** - Action reminder
- **"Review [code/docs] before proceeding"** - Review reminder
- **Other** - Let user type custom notes
### Question 4: Git Push Options
Ask: "Should we push commits to the remote repository?"
Options:
- **Yes, push to remote** - Push all commits (proceed with confirmation)
- **No, keep local** - Don't push (useful for WIP)
- **Ask for confirmation first** - Show what will be pushed, then confirm
## Step 3: Generate Handoff Document
Based on collected inputs, execute the session end command:
```bash
cd ${CLAUDE_PLUGIN_ROOT}/skills/session-management/scripts
# Generate handoff and push
python session.py end --push
# Generate handoff without push
python session.py end --no-push
# With merge to main
python session.py end --merge-to main --push
```
The script will:
- Generate comprehensive handoff document with:
- Session summary (start time, duration, objectives)
- Accomplishments (from collected inputs)
- Decisions made (from collected inputs)
- Context for next session (from collected inputs)
- Metrics (commits, files changed, tests added)
- Git status (branch, uncommitted changes)
- Save to `.sessions/handoffs/handoff_[timestamp].md`
- Optionally push commits to remote
- Update session state to "ended"
## Step 4: Confirm and Finalize
Report to user:
- Handoff document location
- Session summary (time spent, accomplishments)
- Git status (commits pushed, branch state)
- Next session recommendations
Optionally ask:
Ask: "Would you like to merge this branch?"
Options:
- **Merge to main** - Merge current branch to main
- **Merge to develop** - Merge to develop branch
- **Create pull request** - Guide PR creation
- **Keep branch** - Don't merge, keep for next session
---
## Use This Command
When ending a work session:
- End of day or before extended break
- After completing feature or fix
- Before context switching to different project
- When wrapping up and need handoff for future you or teammates
## Integration Notes
- Integrates with **tdd-workflow** for test metrics in handoff
- Uses checkpoint system for comprehensive state capture
- Handoffs saved to `.sessions/handoffs/` directory
- Session state preserved in `.sessions/state.json`

135
commands/session-start.md Normal file
View File

@@ -0,0 +1,135 @@
---
description: Start or resume coding session with AI-guided context loading
---
# Session Start Workflow
Execute the session-management skill's start workflow using this step-by-step process.
## Step 1: Generate Project Status Report
First, generate a comprehensive project status report to understand current state:
```bash
python ${CLAUDE_PLUGIN_ROOT}/skills/project-status-report/scripts/report.py
```
Or invoke the project-status-report skill if available.
The report will show:
- Health indicators (tests, linting, coverage)
- Git status (current branch, uncommitted changes, active branches)
- Recent session summary
- Open work items (TODOs, FIXMEs, objectives)
## Step 2: Gather User Inputs via AskUserQuestion
Use the `AskUserQuestion` tool to collect session configuration. Ask the following questions:
### Question 1: What to Work On
Ask: "What would you like to work on in this session?"
Options:
- **Resume existing work** - Continue from where you left off
- **Start new work** - Begin a new feature or task
- **Address health issues** - Fix test failures or other critical issues from the report
### Question 2: Branch Selection
Ask: "Which branch would you like to work on?"
Options should include:
- All active branches from the git status (show current branch indicator and last commit date)
- **Create new branch** option
**If user selects "Create new branch"**, proceed to Question 2a and 2b.
#### Question 2a: Branch Type (if creating new)
Ask: "What type of branch would you like to create?"
Options:
- **Hotfix branch** (hotfix/...) - For urgent bug fixes
- **Feature branch** (feature/...) - For new features
- **Bugfix branch** (fix/...) - For non-urgent bug fixes
- **Other** - Custom branch prefix
#### Question 2b: Branch Name (if creating new)
Ask: "What should we name the branch?"
Options:
- Suggest intelligent defaults based on:
- Branch type selected
- Health issues from report (e.g., "fix/test-failures")
- TODOs from report (e.g., "feature/oauth-integration")
- User's stated objective
- **Other** - Let user type custom name
### Question 3: Session Objectives
Ask: "What are your objectives for this session?"
Options:
- Suggest objectives based on context:
- "Fix [specific health issue]"
- "Implement [TODO item]"
- "Complete [work from last session]"
- **Other** - Let user type custom objectives
## Step 3: Execute Session Start
Based on the collected inputs, execute the session.py script:
```bash
cd ${CLAUDE_PLUGIN_ROOT}/skills/session-management/scripts
python session.py start [branch-name] --objective "[objectives]"
```
**Additional flags:**
- Add `--tdd` if objectives involve implementing features or fixing bugs
- Add `--resume` if user selected "Resume existing work"
The script will:
- Checkout or create the specified branch
- Initialize session state in `.sessions/state.json`
- Update plugin coordination state in `.ccmp/state.json`
- Load relevant context files (claude.md, architecture docs)
## Step 4: Load Session Context
After session initialization:
1. Check if `.sessions/state.json` was created successfully
2. Read any relevant claude.md files for the work area
3. Load previous session context if resuming
4. Present a summary to the user:
- Current branch
- Session objectives
- Relevant context loaded
- Next suggested actions
## Step 5: Ready to Work
Confirm to the user:
- Session is initialized
- Branch is ready
- Context is loaded
- Ready to begin work on stated objectives
---
## Use This Command When
- Starting work on a project after a break
- Returning after context switch between projects
- Beginning a new feature or bugfix
- Need to load full project context quickly
## Integration Notes
This command integrates with:
- **project-status-report** - For comprehensive health overview
- **claude-context-manager** - Auto-loads relevant claude.md files
- **tdd-workflow** - Enables TDD mode tracking if --tdd flag used