LogoSkills

dev:batch

ZenHub issue sequential processing automation (hierarchical branch strategy)

항ëŠĐë‚īėšĐ
Categorypetmedi-workflow
MCP Serverszenhub, sequential

/dev:batch#

Sequentially processes child issues of an Epic/Story using a hierarchical branch strategy. Stories are merged into the Epic branch, and Sub-tasks are merged into the Story branch.

Usage#

/dev:batch {epic_number}

Hierarchical Branch Strategy#

development
 └── epic/{epic_number}-{slug}              ← Created in Phase 1
      ├── feature/{story_1}-{slug}          ← Sequentially processed in Phase 2
      │    ├── feature/{subtask_1}-{slug}   ← Sub-tasks processed sequentially within Story
      │    └── feature/{subtask_2}-{slug}
      ├── feature/{story_2}-{slug}
      └── feature/{story_3}-{slug}
                                             ← Epic → development PR in Phase 3

Workflow#

Phase 1: Epic Branch Creation#

1. Query Epic issue info (ZenHub)
2. Update development branch to latest
3. Create Epic branch: epic/{epic_number}-{slug}
4. Move Epic to In Progress pipeline

Phase 2: Sequential Story Processing (Per-Story Cycle)#

Executes the /dev:run cycle for each Story. Base branch is automatically set to the Epic branch.

Per-Story Cycle:
1. Move Pipeline to  " In Progress " 
 2. Create Story branch: feature/{story_number}-{slug} (based on Epic branch)
3. If Sub-tasks exist → execute Per-Sub-task Cycle
4. If no Sub-tasks → implement directly
5. Write and run tests
6. Pre-push verification (lint + DCM)
7. Code Review Gate
8. Create PR → targeting Epic branch (base: epic/{epic_number}-{slug})
9. Squash merge → integrated into Epic branch
10. Move to next Story

Phase 2.5: Sequential Sub-task Processing (Optional)#

When a Story has Sub-tasks, process them with the same pattern.

Per-Sub-task Cycle:
1. Create Sub-task branch: feature/{subtask_number}-{slug} (based on Story branch)
2. Implementation work
3. Write and run tests
4. Verification gate
5. Create PR → targeting Story branch (base: feature/{story_number}-{slug})
6. Squash merge → integrated into Story branch
7. Move to next Sub-task

Phase 3: Epic PR Creation#

After all Stories are complete:

1. Verify all Stories are integrated into Epic branch
2. Review changes against development
3. Create Epic PR → targeting development
4. Conduct code review
5. Squash merge after user approval
6. Epic issue auto-Close

Flow Diagram#

┌─────────────────────────────────────────────────────────────┐
│  /dev:batch {epic_number}                                    │
├─────────────────────────────────────────────────────────────â”Ī
│                                                              │
│  Phase 1: Epic Branch Creation                               │
│  ├── Query Epic issue (ZenHub)                               │
│  ├── git checkout development  & &   git pull                   │
│  ├── git checkout -b epic/{number}-{slug}                   │
│  └── git push -u origin epic/{number}-{slug}                │
│                                                              │
│  Phase 2: Sequential Story Processing                        │
│  ├── Query Story list (child issues)                         │
│  ├── for each Story:                                         │
│  │   ├── /dev:run --base epic/{number}-{slug} {story_num}   │
│  │   │   ├── Branch: feature/{story}-{slug}                  │
│  │   │   ├── [If Sub-tasks exist]                            │
│  │   │   │   └── Per-Sub-task Cycle                          │
│  │   │   │       ├── feature/{subtask}-{slug} (Story-based)  │
│  │   │   │       ├── Implement → Test → Verify               │
│  │   │   │       └── PR → Merge into Story branch            │
│  │   │   ├── Implement → Test → Verification Gate            │
│  │   │   └── PR → Merge into Epic branch                     │
│  │   └── Next Story                                          │
│  │                                                           │
│  Phase 3: Epic PR Creation                                    │
│  ├── Create Epic branch → development PR                     │
│  ├── Review full changes                                     │
│  ├── Wait for user approval                                  │
│  └── Squash merge → Epic Close                               │
│                                                              │
└─────────────────────────────────────────────────────────────┘

MCP Call Order#

// Phase 1: Initialization
const workspace = await mcp__zenhub__getWorkspacePipelinesAndRepositories();
const epic = await mcp__zenhub__searchLatestIssues({ query: `#${epicNumber}` });
const stories = await mcp__zenhub__searchLatestIssues({
  query: `parent:${epic[0].id}`,
});

// Phase 2: Per-Story processing
for (const story of stories) {
  // Check Sub-tasks
  const subtasks = await mcp__zenhub__searchLatestIssues({
    query: `parent:${story.id}`,
  });

  if (subtasks.length  >   0) {
    // Story with Sub-tasks → create Story branch first
    // Process Sub-tasks sequentially, then integrate into Story branch
    for (const subtask of subtasks) {
      // /dev:run --base feature/{story_number}-{slug} {subtask.number}
    }
    // PR Story branch to Epic branch
  } else {
    // Story without Sub-tasks → implement directly
    // /dev:run --base epic/{epic_number}-{slug} {story.number}
  }
}

// Phase 3: Epic PR
// gh pr create --base development --title  " [Epic] ... "

Pipeline Query#

Pipeline IDs differ per workspace. Dynamic query at session start:

const workspace = await mcp__zenhub__getWorkspacePipelinesAndRepositories();
const pipelines = workspace.pipelines;
// Find by name in pipelines:  " New Issues " ,  " In Progress " ,  " Review/QA " , etc.
// Done pipeline is not used (auto Close via GitHub  " Closes # "   keyword on merge)

PR Creation Templates#

Story PR (→ Epic branch)#

gh pr create --base  " epic/{epic_number}-{slug} "   \
  --title  " {story.title} "   --body  " $(cat  < < ' EOF ' 
 ## Summary
- {Change summary}

## Related Issue
- Closes #{story.number}
- Parent Epic: #{epic_number}

## Test Plan
- [ ] UseCase unit tests passed
- [ ] BLoC unit tests passed

ðŸĪ– Generated with [Claude Code](https://claude.ai/claude-code)
EOF
) "

Epic PR (→ development)#

gh pr create --base  " development "   \
  --title  " [Epic] {epic.title} "   --body  " $(cat  < < ' EOF ' 
 ## Summary
- {Epic full change summary}

## Included Stories
- ✅ #{story_1} - {title}
- ✅ #{story_2} - {title}
- ✅ #{story_3} - {title}

## Related Issue
- Closes #{epic_number}

## Test Plan
- [ ] Full integration tests passed
- [ ] Manual testing complete

ðŸĪ– Generated with [Claude Code](https://claude.ai/claude-code)
EOF
) "

Verification Checklist#

  • Epic branch correctly branched from development
  • Each Story branch branched from Epic branch
  • Sub-task branches branched from Story branch
  • Story PR base is Epic branch
  • Epic PR base is development
  • Epic PR created after all Stories are merged
  • BDD scenarios vs actual implementation comparison
  • Code conventions followed
  • Lint 0 issues + DCM error 0 issues