mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
Refactor workflow directory structure to improve clarity and robustness by introducing dedicated sessions/ subdirectory for active sessions. ## Directory Structure Changes ### Before (Old Structure) ``` .workflow/ ├── .active-WFS-session-1 # Marker files (fragile) ├── WFS-session-1/ # Active sessions mixed with config ├── WFS-session-2/ ├── project.json └── .archives/ # Archived sessions ``` ### After (New Structure) ``` .workflow/ ├── project.json # Project metadata ├── sessions/ # [NEW] All active sessions │ └── WFS-session-1/ └── archives/ # Archived sessions (removed dot prefix) ``` ## Key Improvements 1. **Physical Isolation**: Active sessions now in dedicated sessions/ subdirectory 2. **No Marker Files**: Removed fragile .active-* marker file mechanism 3. **Directory-Based State**: Session state determined by directory location - In sessions/ = active - In archives/ = archived 4. **Simpler Discovery**: `ls .workflow/sessions/` instead of `find .workflow/ -name ".active-*"` 5. **Cleaner Root**: .workflow/ root now only contains project.json, sessions/, archives/ ## Path Transformations | Old Pattern | New Pattern | |-------------|-------------| | `find .workflow/ -name ".active-*"` | `find .workflow/sessions/ -name "WFS-*" -type d` | | `.workflow/WFS-[slug]/` | `.workflow/sessions/WFS-[slug]/` | | `.workflow/.archives/` | `.workflow/archives/` | | `touch .workflow/.active-*` | *Removed* | | `rm .workflow/.active-*` | *Removed* | ## Modified Commands ### session/start.md - Update session creation path to .workflow/sessions/WFS-*/ - Remove .active-* marker file creation - Update session discovery to use directory listing - Updated all 3 modes: Discovery, Auto, Force New ### session/complete.md - Update session move from sessions/ to archives/ - Remove .active-* marker file deletion - Update manifest path to archives/manifest.json - Update agent prompts with new paths ### status.md - Update session discovery to find .workflow/sessions/ - Update all session file path references - Update archive query examples ### execute.md - Update session discovery logic - Update all task file paths to include sessions/ prefix - Update context package paths - Update error handling documentation ## Benefits - **Robustness**: Eliminates marker file state inconsistency risk - **Clarity**: Clear separation between active and archived sessions - **Simplicity**: Session discovery is straightforward directory listing - **Alignment**: Closer to OpenSpec's three-layer structure (specs/changes/archive) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
195 lines
5.2 KiB
Markdown
195 lines
5.2 KiB
Markdown
---
|
|
name: workflow:status
|
|
description: Generate on-demand views for project overview and workflow tasks with optional task-id filtering for detailed view
|
|
argument-hint: "[optional: --project|task-id|--validate]"
|
|
---
|
|
|
|
# Workflow Status Command (/workflow:status)
|
|
|
|
## Overview
|
|
Generates on-demand views from project and session data. Supports two modes:
|
|
1. **Project Overview** (`--project`): Shows completed features and project statistics
|
|
2. **Workflow Tasks** (default): Shows current session task progress
|
|
|
|
No synchronization needed - all views are calculated from current JSON state.
|
|
|
|
## Usage
|
|
```bash
|
|
/workflow:status # Show current workflow session overview
|
|
/workflow:status --project # Show project-level feature registry
|
|
/workflow:status impl-1 # Show specific task details
|
|
/workflow:status --validate # Validate workflow integrity
|
|
```
|
|
|
|
## Implementation Flow
|
|
|
|
### Mode Selection
|
|
|
|
**Check for --project flag**:
|
|
- If `--project` flag present → Execute **Project Overview Mode**
|
|
- Otherwise → Execute **Workflow Session Mode** (default)
|
|
|
|
## Project Overview Mode
|
|
|
|
### Step 1: Check Project State
|
|
```bash
|
|
bash(test -f .workflow/project.json && echo "EXISTS" || echo "NOT_FOUND")
|
|
```
|
|
|
|
**If NOT_FOUND**:
|
|
```
|
|
No project state found.
|
|
Run /workflow:session:start to initialize project.
|
|
```
|
|
|
|
### Step 2: Read Project Data
|
|
```bash
|
|
bash(cat .workflow/project.json)
|
|
```
|
|
|
|
### Step 3: Parse and Display
|
|
|
|
**Data Processing**:
|
|
```javascript
|
|
const projectData = JSON.parse(Read('.workflow/project.json'));
|
|
const features = projectData.features || [];
|
|
const stats = projectData.statistics || {};
|
|
const overview = projectData.overview || null;
|
|
|
|
// Sort features by implementation date (newest first)
|
|
const sortedFeatures = features.sort((a, b) =>
|
|
new Date(b.implemented_at) - new Date(a.implemented_at)
|
|
);
|
|
```
|
|
|
|
**Output Format** (with extended overview):
|
|
```
|
|
## Project: ${projectData.project_name}
|
|
Initialized: ${projectData.initialized_at}
|
|
|
|
${overview ? `
|
|
### Overview
|
|
${overview.description}
|
|
|
|
**Technology Stack**:
|
|
${overview.technology_stack.languages.map(l => `- ${l.name}${l.primary ? ' (primary)' : ''}: ${l.file_count} files`).join('\n')}
|
|
Frameworks: ${overview.technology_stack.frameworks.join(', ')}
|
|
|
|
**Architecture**:
|
|
Style: ${overview.architecture.style}
|
|
Patterns: ${overview.architecture.patterns.join(', ')}
|
|
|
|
**Key Components** (${overview.key_components.length}):
|
|
${overview.key_components.map(c => `- ${c.name} (${c.path})\n ${c.description}`).join('\n')}
|
|
|
|
**Metrics**:
|
|
- Files: ${overview.metrics.total_files}
|
|
- Lines of Code: ${overview.metrics.lines_of_code}
|
|
- Complexity: ${overview.metrics.complexity}
|
|
|
|
---
|
|
` : ''}
|
|
|
|
### Completed Features (${stats.total_features})
|
|
|
|
${sortedFeatures.map(f => `
|
|
- ${f.title} (${f.timeline?.implemented_at || f.implemented_at})
|
|
${f.description}
|
|
Tags: ${f.tags?.join(', ') || 'none'}
|
|
Session: ${f.traceability?.session_id || f.session_id}
|
|
Archive: ${f.traceability?.archive_path || 'unknown'}
|
|
${f.traceability?.commit_hash ? `Commit: ${f.traceability.commit_hash}` : ''}
|
|
`).join('\n')}
|
|
|
|
### Project Statistics
|
|
- Total Features: ${stats.total_features}
|
|
- Total Sessions: ${stats.total_sessions}
|
|
- Last Updated: ${stats.last_updated}
|
|
|
|
### Quick Access
|
|
- View session details: /workflow:status
|
|
- Archive query: jq '.archives[] | select(.session_id == "SESSION_ID")' .workflow/archives/manifest.json
|
|
- Documentation: .workflow/docs/${projectData.project_name}/
|
|
|
|
### Query Commands
|
|
# Find by tag
|
|
cat .workflow/project.json | jq '.features[] | select(.tags[] == "auth")'
|
|
|
|
# View archive
|
|
cat ${feature.traceability.archive_path}/IMPL_PLAN.md
|
|
|
|
# List all tags
|
|
cat .workflow/project.json | jq -r '.features[].tags[]' | sort -u
|
|
```
|
|
|
|
**Empty State**:
|
|
```
|
|
## Project: ${projectData.project_name}
|
|
Initialized: ${projectData.initialized_at}
|
|
|
|
No features completed yet.
|
|
|
|
Complete your first workflow session to add features:
|
|
1. /workflow:plan "feature description"
|
|
2. /workflow:execute
|
|
3. /workflow:session:complete
|
|
```
|
|
|
|
### Step 4: Show Recent Sessions (Optional)
|
|
|
|
```bash
|
|
# List 5 most recent archived sessions
|
|
bash(ls -1t .workflow/archives/WFS-* 2>/dev/null | head -5 | xargs -I {} basename {})
|
|
```
|
|
|
|
**Output**:
|
|
```
|
|
### Recent Sessions
|
|
- WFS-auth-system (archived)
|
|
- WFS-payment-flow (archived)
|
|
- WFS-user-dashboard (archived)
|
|
|
|
Use /workflow:session:complete to archive current session.
|
|
```
|
|
|
|
## Workflow Session Mode (Default)
|
|
|
|
### Step 1: Find Active Session
|
|
```bash
|
|
find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | head -1
|
|
```
|
|
|
|
### Step 2: Load Session Data
|
|
```bash
|
|
cat .workflow/sessions/WFS-session/workflow-session.json
|
|
```
|
|
|
|
### Step 3: Scan Task Files
|
|
```bash
|
|
find .workflow/sessions/WFS-session/.task/ -name "*.json" -type f 2>/dev/null
|
|
```
|
|
|
|
### Step 4: Generate Task Status
|
|
```bash
|
|
cat .workflow/sessions/WFS-session/.task/impl-1.json | jq -r '.status'
|
|
```
|
|
|
|
### Step 5: Count Task Progress
|
|
```bash
|
|
find .workflow/sessions/WFS-session/.task/ -name "*.json" -type f | wc -l
|
|
find .workflow/sessions/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l
|
|
```
|
|
|
|
### Step 6: Display Overview
|
|
```markdown
|
|
# Workflow Overview
|
|
**Session**: WFS-session-name
|
|
**Progress**: 3/8 tasks completed
|
|
|
|
## Active Tasks
|
|
- [IN PROGRESS] impl-1: Current task in progress
|
|
- [ ] impl-2: Next pending task
|
|
|
|
## Completed Tasks
|
|
- [COMPLETED] impl-0: Setup completed
|
|
``` |