Files
ccpm-claude-code-pm/ccpm/commands/pm/epic-refresh.md
Ran Aroussi 3c8e0e7f67 Fix: Resolve bash command truncation and syntax errors (#958)
* fix: resolve bash command truncation and syntax errors

- Convert long one-liner bash commands to multiline format to prevent truncation
- Fix awk syntax errors in epic-sync.md (replace literal \n with proper newlines)
- Add missing directory separators in file path patterns
- Replace chained && operators with proper if-then blocks
- Break down complex pipe chains into step-by-step operations

Key changes:
* ccpm/scripts/pm/*.sh: Convert complex dependency parsing from one-liners to readable multiline blocks
* ccpm/ccpm.config: Break down repository URL processing into clear steps
* ccpm/commands/pm/epic-sync.md: Fix awk print statements for proper newline handling

Fixes command truncation errors like:
- Error: (eval):1: parse error near ')'
- awk: syntax error at source line 1
- command not found: !

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

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: additional bash syntax fixes in command documentation

- epic-merge.md: Convert complex nested commands to multiline format
  - Fix feature list generation with proper error handling
  - Break down epic issue number extraction
  - Add proper file existence checks
- epic-refresh.md: Fix task issue extraction with error handling
- epic-sync.md: Re-fix awk syntax for proper newline handling
- test-runner.md: Remove MUXI-specific reference

Prevents additional command truncation in:
- Complex subshell operations with cd and loops
- Chained grep operations for GitHub issue extraction
- Nested command substitution patterns

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

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address CodeRabbit feedback on dependency parsing and SSH URL handling

- ccpm.config: Add support for ssh://git@github.com/ and ssh://github.com/ URL schemes
  - Ensures all GitHub URL variants are properly normalized
- All PM scripts: Fix dependency parsing to handle whitespace-only cases
  - Trim leading/trailing whitespace after bracket removal
  - Properly handle empty dependency lists like "depends_on: [ ]"
  - Normalize whitespace-only strings to empty strings
  - Prevents false positive dependency detection

Fixes issues where:
- SSH URLs starting with ssh://git@github.com/ would fail parsing
- Empty dependency arrays with whitespace were treated as non-empty
- Tasks with "depends_on: [ ]" were incorrectly blocked

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-24 22:32:39 +01:00

2.4 KiB

allowed-tools
allowed-tools
Read, Write, LS

Epic Refresh

Update epic progress based on task states.

Usage

/pm:epic-refresh <epic_name>

Instructions

1. Count Task Status

Scan all task files in .claude/epics/$ARGUMENTS/:

  • Count total tasks
  • Count tasks with status: closed
  • Count tasks with status: open
  • Count tasks with work in progress

2. Calculate Progress

progress = (closed_tasks / total_tasks) * 100

Round to nearest integer.

3. Update GitHub Task List

If epic has GitHub issue, sync task checkboxes:

# Get epic issue number from epic.md frontmatter
epic_issue={extract_from_github_field}

if [ ! -z "$epic_issue" ]; then
  # Get current epic body
  gh issue view $epic_issue --json body -q .body > /tmp/epic-body.md
  
  # For each task, check its status and update checkbox
  for task_file in .claude/epics/$ARGUMENTS/[0-9]*.md; do
    # Extract task issue number
    task_github_line=$(grep 'github:' "$task_file" 2>/dev/null || true)
    if [ -n "$task_github_line" ]; then
      task_issue=$(echo "$task_github_line" | grep -oE '[0-9]+$' || true)
    else
      task_issue=""
    fi
    task_status=$(grep 'status:' $task_file | cut -d: -f2 | tr -d ' ')
    
    if [ "$task_status" = "closed" ]; then
      # Mark as checked
      sed -i "s/- \[ \] #$task_issue/- [x] #$task_issue/" /tmp/epic-body.md
    else
      # Ensure unchecked (in case manually checked)
      sed -i "s/- \[x\] #$task_issue/- [ ] #$task_issue/" /tmp/epic-body.md
    fi
  done
  
  # Update epic issue
  gh issue edit $epic_issue --body-file /tmp/epic-body.md
fi

4. Determine Epic Status

  • If progress = 0% and no work started: backlog
  • If progress > 0% and < 100%: in-progress
  • If progress = 100%: completed

5. Update Epic

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

Update epic.md frontmatter:

status: {calculated_status}
progress: {calculated_progress}%
updated: {current_datetime}

6. Output

🔄 Epic refreshed: $ARGUMENTS

Tasks:
  Closed: {closed_count}
  Open: {open_count}
  Total: {total_count}
  
Progress: {old_progress}% → {new_progress}%
Status: {old_status} → {new_status}
GitHub: Task list updated ✓

{If complete}: Run /pm:epic-close $ARGUMENTS to close epic
{If in progress}: Run /pm:next to see priority tasks

Important Notes

This is useful after manual task edits or GitHub sync. Don't modify task files, only epic status. Preserve all other frontmatter fields.