Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,12 @@ Specialized agents implement tasks while maintaining progress updates and an aud

### Epic Commands
- `/pm:epic-decompose` - Break epic into task files
- `/pm:epic-sync` - Push epic and tasks to GitHub
- `/pm:epic-sync` - Bidirectional sync between local epics/tasks and GitHub issues
- `/pm:epic-oneshot` - Decompose and sync in one command
- `/pm:epic-list` - List all epics
- `/pm:epic-show` - Display epic and its tasks
- `/pm:epic-close` - Mark epic as complete
- `/pm:epic-edit` - Edit epic details
- `/pm:epic-refresh` - Update epic progress from tasks

### Issue Commands
- `/pm:issue-show` - Display issue and sub-issues
Expand Down
2 changes: 1 addition & 1 deletion ccpm/agents/test-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ model: inherit
color: blue
---

You are an expert test execution and analysis specialist for the MUXI Runtime system. Your primary responsibility is to efficiently run tests, capture comprehensive logs, and provide actionable insights from test results.
You are an expert test execution and analysis specialist. Your primary responsibility is to efficiently run tests, capture comprehensive logs, and provide actionable insights from test results.

## Core Responsibilities

Expand Down
11 changes: 9 additions & 2 deletions ccpm/ccpm.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ get_github_repo() {
return 1
fi

# Handle both SSH and HTTPS, with or without .git extension
local repo=$(echo "$remote_url" | sed -E 's#^(https://|git@)github\.com[:/]##; s#\.git$##')
# Handle HTTPS, SSH, and SCP-style URLs
local repo="$remote_url"
# Remove various GitHub URL prefixes
repo=$(echo "$repo" | sed -E 's#^https://github\.com/##')
repo=$(echo "$repo" | sed -E 's#^git@github\.com:##')
repo=$(echo "$repo" | sed -E 's#^ssh://git@github\.com/##')
repo=$(echo "$repo" | sed -E 's#^ssh://github\.com/##')
# Remove .git suffix if present
repo=$(echo "$repo" | sed 's#\.git$##')

# Validate format
if [[ ! "$repo" =~ ^[^/]+/[^/]+$ ]]; then
Expand Down
97 changes: 18 additions & 79 deletions ccpm/commands/pm/clean.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
allowed-tools: Bash, Read, Write, LS
allowed-tools: Bash
---

# Clean
Expand All @@ -8,95 +8,34 @@ Clean up completed work and archive old epics.

## Usage
```
/pm:clean [--dry-run]
/pm:clean [--dry-run] [--verbose]
```

Options:
- `--dry-run` - Show what would be cleaned without doing it
- `--verbose` - Show detailed output during cleanup

## Instructions

### 1. Identify Completed Epics
Run the system cleanup script:

Find epics with:
- `status: completed` in frontmatter
- All tasks closed
- Last update > 30 days ago

### 2. Identify Stale Work

Find:
- Progress files for closed issues
- Update directories for completed work
- Orphaned task files (epic deleted)
- Empty directories

### 3. Show Cleanup Plan

```
🧹 Cleanup Plan

Completed Epics to Archive:
{epic_name} - Completed {days} days ago
{epic_name} - Completed {days} days ago

Stale Progress to Remove:
{count} progress files for closed issues

Empty Directories:
{list_of_empty_dirs}

Space to Recover: ~{size}KB

{If --dry-run}: This is a dry run. No changes made.
{Otherwise}: Proceed with cleanup? (yes/no)
```

### 4. Execute Cleanup

If user confirms:

**Archive Epics:**
```bash
mkdir -p .claude/epics/.archived
mv .claude/epics/{completed_epic} .claude/epics/.archived/
```

**Remove Stale Files:**
- Delete progress files for closed issues > 30 days
- Remove empty update directories
- Clean up orphaned files

**Create Archive Log:**
Create `.claude/epics/.archived/archive-log.md`:
```markdown
# Archive Log

## {current_date}
- Archived: {epic_name} (completed {date})
- Removed: {count} stale progress files
- Cleaned: {count} empty directories
bash ccpm/scripts/pm/clean.sh $ARGUMENTS
```

### 5. Output

```
βœ… Cleanup Complete

Archived:
{count} completed epics

Removed:
{count} stale files
{count} empty directories

Space recovered: {size}KB

System is clean and organized.
```
The cleanup script will:
1. Scan for completed epics (status: completed, all tasks closed, >30 days old)
2. Find stale progress files for closed issues
3. Identify empty directories
4. Show cleanup plan and ask for confirmation
5. Archive completed epics to `.claude/epics/.archived/`
6. Remove stale files and empty directories
7. Create detailed archive log
Comment on lines +31 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Archive path inconsistent with scripts (.archived vs archived)

Docs say .claude/epics/.archived/ but scripts (e.g., cleanup-worktree.sh) use .claude/epics/archived/. Align to avoid confusion.

-5. Archive completed epics to `.claude/epics/.archived/`
+5. Archive completed epics to `.claude/epics/archived/`

Run to confirm all archive path usages and update docs/scripts uniformly:


🏁 Script executed:

#!/bin/bash
rg -n -C1 -e '\.claude/epics/\.archived/' -e '\.claude/epics/archived/' ccpm | sed 's/^/HIT: /'

Length of output: 1517


Unify archive directory naming to .claude/epics/archived/

  • ccpm/commands/pm/clean.md line 31: change .claude/epics/.archived/ β†’ .claude/epics/archived/
  • ccpm/scripts/pm/close-epic.sh line 352: change
    local archived_path=".claude/epics/.archived/$epic_name"
    to
    local archived_path=".claude/epics/archived/$epic_name"

8. Report space recovered

## Important Notes

Always offer --dry-run to preview changes.
Never delete PRDs or incomplete work.
Keep archive log for history.
- Always previews changes before making them
- Never deletes PRDs or incomplete work
- Maintains complete archive log for history
- Can be run safely with `--dry-run` to preview changes
69 changes: 24 additions & 45 deletions ccpm/commands/pm/epic-close.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
allowed-tools: Bash, Read, Write, LS
allowed-tools: Bash
---

# Epic Close
Expand All @@ -8,62 +8,41 @@ Mark an epic as complete when all tasks are done.

## Usage
```
/pm:epic-close <epic_name>
/pm:epic-close <epic_name> [--archive]
```

## Instructions

### 1. Verify All Tasks Complete

Check all task files in `.claude/epics/$ARGUMENTS/`:
- Verify all have `status: closed` in frontmatter
- If any open tasks found: "❌ Cannot close epic. Open tasks remain: {list}"

### 2. Update Epic Status

Get current datetime: `date -u +"%Y-%m-%dT%H:%M:%SZ"`

Update epic.md frontmatter:
```yaml
status: completed
progress: 100%
updated: {current_datetime}
completed: {current_datetime}
```
Options:
- `--archive` - Automatically archive epic after closing

### 3. Update PRD Status

If epic references a PRD, update its status to "complete".
## Instructions

### 4. Close Epic on GitHub
Close the epic using the epic management script:

If epic has GitHub issue:
```bash
gh issue close {epic_issue_number} --comment "βœ… Epic completed - all tasks done"
bash ccpm/scripts/pm/close-epic.sh close $ARGUMENTS
```

### 5. Archive Option

Ask user: "Archive completed epic? (yes/no)"
The script will:
1. Verify all tasks in the epic are closed (exits with error if not)
2. Update epic status to completed with 100% progress and completion timestamp
3. Update linked PRD status to complete (if referenced)
4. Close the epic issue on GitHub with completion comment
5. Calculate and display epic duration
6. Offer to archive the completed epic (or auto-archive with --archive flag)
7. Create detailed archive summary if archived

If yes:
- Move epic directory to `.claude/epics/.archived/{epic_name}/`
- Create archive summary with completion date
## Alternative: Reopen Epic

### 6. Output
To reopen a closed epic for additional work:

```
βœ… Epic closed: $ARGUMENTS
Tasks completed: {count}
Duration: {days_from_created_to_completed}

{If archived}: Archived to .claude/epics/.archived/

Next epic: Run /pm:next to see priority work
```bash
bash ccpm/scripts/pm/close-epic.sh reopen $ARGUMENTS
```

## Important Notes

Only close epics with all tasks complete.
Preserve all data when archiving.
Update related PRD status.
- Only closes epics when all tasks are complete
- Automatically updates linked PRD status
- Preserves all data when archiving
- Creates detailed completion and archive logs
- Can unarchive and reopen epics if needed
Loading