devflow-kit 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +61 -9
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +160 -176
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/uninstall.d.ts.map +1 -1
  7. package/dist/commands/uninstall.js +73 -48
  8. package/dist/commands/uninstall.js.map +1 -1
  9. package/dist/utils/git.d.ts +11 -0
  10. package/dist/utils/git.d.ts.map +1 -0
  11. package/dist/utils/git.js +36 -0
  12. package/dist/utils/git.js.map +1 -0
  13. package/dist/utils/paths.d.ts +32 -0
  14. package/dist/utils/paths.d.ts.map +1 -0
  15. package/dist/utils/paths.js +86 -0
  16. package/dist/utils/paths.js.map +1 -0
  17. package/package.json +1 -1
  18. package/src/claude/agents/devflow/audit-architecture.md +92 -110
  19. package/src/claude/agents/devflow/audit-complexity.md +94 -130
  20. package/src/claude/agents/devflow/audit-database.md +95 -136
  21. package/src/claude/agents/devflow/audit-dependencies.md +94 -136
  22. package/src/claude/agents/devflow/audit-documentation.md +82 -323
  23. package/src/claude/agents/devflow/audit-performance.md +212 -107
  24. package/src/claude/agents/devflow/audit-security.md +201 -83
  25. package/src/claude/agents/devflow/audit-tests.md +82 -471
  26. package/src/claude/agents/devflow/audit-typescript.md +83 -311
  27. package/src/claude/agents/devflow/pull-request.md +423 -0
  28. package/src/claude/commands/devflow/code-review.md +297 -248
  29. package/src/claude/commands/devflow/plan-next-steps.md +1 -1
  30. package/src/claude/commands/devflow/plan.md +485 -0
  31. package/src/claude/commands/devflow/pull-request.md +269 -0
  32. package/src/claude/commands/devflow/resolve-comments.md +583 -0
  33. package/src/claude/scripts/statusline.sh +0 -36
@@ -0,0 +1,269 @@
1
+ ---
2
+ allowed-tools: Task, Bash
3
+ description: Create pull request with comprehensive analysis and smart description generation
4
+ ---
5
+
6
+ ## Your task
7
+
8
+ Create a pull request from the current branch with a comprehensive description generated by analyzing commits and code changes. This command orchestrates PR creation using the `pull-request` sub-agent for deep analysis.
9
+
10
+ ### Step 1: Parse Arguments and Detect Context
11
+
12
+ Parse the arguments to determine base branch and PR options:
13
+
14
+ ```bash
15
+ # Parse arguments
16
+ BASE_BRANCH=""
17
+ DRAFT_FLAG=""
18
+
19
+ for arg in $ARGUMENTS; do
20
+ case $arg in
21
+ --draft)
22
+ DRAFT_FLAG="--draft"
23
+ ;;
24
+ *)
25
+ if [ -z "$BASE_BRANCH" ]; then
26
+ BASE_BRANCH="$arg"
27
+ fi
28
+ ;;
29
+ esac
30
+ done
31
+
32
+ # Get current branch
33
+ CURRENT_BRANCH=$(git branch --show-current)
34
+ if [ -z "$CURRENT_BRANCH" ]; then
35
+ echo "❌ Not on a branch (detached HEAD). Checkout a feature branch first."
36
+ exit 1
37
+ fi
38
+
39
+ # Auto-detect base branch if not specified
40
+ if [ -z "$BASE_BRANCH" ]; then
41
+ for branch in main master develop; do
42
+ if git show-ref --verify --quiet refs/heads/$branch; then
43
+ BASE_BRANCH=$branch
44
+ break
45
+ fi
46
+ done
47
+ fi
48
+
49
+ if [ -z "$BASE_BRANCH" ]; then
50
+ echo "❌ Could not auto-detect base branch. Specify manually: /pull-request <base-branch>"
51
+ exit 1
52
+ fi
53
+
54
+ echo "=== PR CREATION CONTEXT ==="
55
+ echo "Current branch: $CURRENT_BRANCH"
56
+ echo "Base branch: $BASE_BRANCH"
57
+ echo "Draft mode: ${DRAFT_FLAG:-disabled}"
58
+ echo ""
59
+ ```
60
+
61
+ ### Step 2: Pre-Flight Checks
62
+
63
+ Verify the branch state and catch common issues:
64
+
65
+ ```bash
66
+ echo "=== PRE-FLIGHT CHECKS ==="
67
+
68
+ # Check if branch has commits ahead of base
69
+ COMMITS_AHEAD=$(git rev-list --count $BASE_BRANCH..HEAD)
70
+ if [ "$COMMITS_AHEAD" -eq 0 ]; then
71
+ echo "❌ No commits to create PR. Branch is up to date with $BASE_BRANCH."
72
+ exit 1
73
+ fi
74
+
75
+ # Check if PR already exists for this branch
76
+ EXISTING_PR=$(gh pr list --head "$CURRENT_BRANCH" --json number --jq '.[0].number' 2>/dev/null || echo "")
77
+ if [ -n "$EXISTING_PR" ]; then
78
+ echo "⚠️ PR #$EXISTING_PR already exists for branch $CURRENT_BRANCH"
79
+ echo "View: gh pr view $EXISTING_PR"
80
+ echo "Update: git push to update existing PR"
81
+ exit 1
82
+ fi
83
+
84
+ # Check if branch is pushed to remote
85
+ if ! git ls-remote --exit-code --heads origin "$CURRENT_BRANCH" >/dev/null 2>&1; then
86
+ echo "⚠️ Branch not pushed to remote. Pushing now..."
87
+ git push -u origin "$CURRENT_BRANCH"
88
+ fi
89
+
90
+ # Show quick summary
91
+ echo "✅ Ready to create PR"
92
+ echo " Commits: $COMMITS_AHEAD ahead of $BASE_BRANCH"
93
+ git log --oneline $BASE_BRANCH..HEAD | head -5
94
+ echo ""
95
+ ```
96
+
97
+ ### Step 3: Launch Pull Request Sub-Agent
98
+
99
+ Launch the `pull-request` sub-agent to analyze commits and generate PR content:
100
+
101
+ **IMPORTANT**: Pass these variables to the sub-agent:
102
+ - `CURRENT_BRANCH`: The branch being reviewed
103
+ - `BASE_BRANCH`: The base branch for comparison
104
+
105
+ The sub-agent will:
106
+ 1. Analyze commit history and messages
107
+ 2. Analyze code changes and impact
108
+ 3. Extract issue references
109
+ 4. Detect breaking changes
110
+ 5. Generate PR title and comprehensive description
111
+ 6. Assess PR size and suggest splits if needed
112
+
113
+ Use the Task tool to launch the sub-agent with subagent_type="pull-request":
114
+
115
+ ```
116
+ Launch pull-request sub-agent with:
117
+ - Current branch: {CURRENT_BRANCH}
118
+ - Base branch: {BASE_BRANCH}
119
+
120
+ The sub-agent will analyze all commits and changes between {BASE_BRANCH} and {CURRENT_BRANCH}, then generate:
121
+ - PR title following conventional commit format
122
+ - Comprehensive PR description with:
123
+ - Summary of changes
124
+ - Breaking changes (if any)
125
+ - Testing recommendations
126
+ - Related issues
127
+ - Size assessment and recommendations
128
+
129
+ Return the complete PR title and description ready for `gh pr create`.
130
+ ```
131
+
132
+ ### Step 4: Review Sub-Agent Output
133
+
134
+ After the sub-agent completes, extract the generated PR content and present it to the user for review:
135
+
136
+ ```markdown
137
+ 📝 GENERATED PR CONTENT
138
+
139
+ **Title:**
140
+ {generated PR title}
141
+
142
+ **Description:**
143
+ {generated PR description}
144
+
145
+ ---
146
+
147
+ **Size Assessment:**
148
+ - Files changed: {X}
149
+ - Lines changed: {Y}
150
+ - Complexity: {Simple/Medium/Complex/Too Large}
151
+
152
+ {If too large, show recommendations for splitting}
153
+
154
+ **Recommendations from analysis:**
155
+ {Any warnings or suggestions from sub-agent}
156
+ ```
157
+
158
+ ### Step 5: Create Pull Request
159
+
160
+ Create the PR using `gh pr create` with the generated content:
161
+
162
+ ```bash
163
+ # Save PR body to temp file to preserve formatting
164
+ PR_BODY=$(cat <<'EOF'
165
+ {generated PR description from sub-agent}
166
+ EOF
167
+ )
168
+
169
+ # Create the PR
170
+ gh pr create \
171
+ --base "$BASE_BRANCH" \
172
+ --head "$CURRENT_BRANCH" \
173
+ --title "{generated PR title}" \
174
+ --body "$PR_BODY" \
175
+ $DRAFT_FLAG
176
+
177
+ # Capture the PR URL
178
+ PR_URL=$(gh pr view --json url --jq '.url' 2>/dev/null || echo "")
179
+ ```
180
+
181
+ ### Step 6: Provide Success Summary
182
+
183
+ Present the final summary to the user:
184
+
185
+ ```markdown
186
+ ✅ PULL REQUEST CREATED
187
+
188
+ 🔗 **PR URL:** {PR_URL}
189
+
190
+ 📊 **Summary:**
191
+ - Branch: {CURRENT_BRANCH} → {BASE_BRANCH}
192
+ - Commits: {X} commits
193
+ - Files: {Y} files changed
194
+ - Status: {Draft/Ready for review}
195
+
196
+ 💡 **Next Steps:**
197
+ - View PR: gh pr view {PR_NUMBER}
198
+ - Request reviews: gh pr edit {PR_NUMBER} --add-reviewer @username
199
+ - Monitor CI checks: gh pr checks {PR_NUMBER}
200
+ - If changes needed, push commits or use /resolve-comments after review
201
+
202
+ 📝 **Full PR details:** {PR_URL}
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Usage Examples
208
+
209
+ ### Basic Usage
210
+ ```bash
211
+ # Create PR to main branch (auto-detected)
212
+ /pull-request
213
+
214
+ # Create PR to develop branch
215
+ /pull-request develop
216
+
217
+ # Create draft PR
218
+ /pull-request --draft
219
+
220
+ # Create draft PR to specific base
221
+ /pull-request develop --draft
222
+ ```
223
+
224
+ ### When to Use
225
+
226
+ **✅ Use /pull-request when:**
227
+ - You have commits ready for review
228
+ - Branch is ready for team review
229
+ - You want comprehensive PR description
230
+ - You want to detect breaking changes automatically
231
+
232
+ **⚠️ Before using:**
233
+ - Run `/code-review` to validate quality
234
+ - Ensure all commits are meaningful (not WIP)
235
+ - Consider if PR is too large (should it be split?)
236
+
237
+ **💡 Pro Tips:**
238
+ - For small PRs (<10 files), this generates great descriptions automatically
239
+ - For large PRs (>20 files), consider the split recommendations
240
+ - Draft PRs are great for early feedback without formal review requests
241
+ - PR description can be edited after creation with `gh pr edit`
242
+
243
+ ---
244
+
245
+ ## Command Behavior
246
+
247
+ ### Pre-Flight Validation:
248
+ - ✅ Verifies branch has commits ahead of base
249
+ - ✅ Checks for existing PRs on this branch
250
+ - ✅ Ensures branch is pushed to remote
251
+ - ✅ Validates base branch exists
252
+
253
+ ### PR Content Generation:
254
+ - ✅ Analyzes all commits since branching from base
255
+ - ✅ Groups changes by feature/fix/refactor
256
+ - ✅ Extracts issue references automatically
257
+ - ✅ Detects breaking changes from commit messages
258
+ - ✅ Generates testing recommendations
259
+
260
+ ### Safety Features:
261
+ - ⚠️ Warns if PR is too large (>500 lines changed)
262
+ - ⚠️ Suggests splitting strategy for large PRs
263
+ - ⚠️ Detects missing tests or documentation
264
+ - ⚠️ Highlights security-sensitive changes
265
+
266
+ ### Integration:
267
+ - Works seamlessly with `/code-review` (run before PR creation)
268
+ - Complements `/resolve-comments` (for handling feedback after PR)
269
+ - Follows conventional commit format for consistency