@eskoubar95/spec 0.1.0 → 0.1.3

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 (98) hide show
  1. package/dist/commands/help.d.ts +5 -0
  2. package/dist/commands/help.d.ts.map +1 -0
  3. package/dist/commands/help.js +23 -0
  4. package/dist/commands/help.js.map +1 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +30 -14
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/install.d.ts +5 -0
  9. package/dist/commands/install.d.ts.map +1 -0
  10. package/dist/commands/install.js +88 -0
  11. package/dist/commands/install.js.map +1 -0
  12. package/dist/commands/update.d.ts +5 -0
  13. package/dist/commands/update.d.ts.map +1 -0
  14. package/dist/commands/update.js +72 -0
  15. package/dist/commands/update.js.map +1 -0
  16. package/dist/commands/workspace.d.ts +5 -0
  17. package/dist/commands/workspace.d.ts.map +1 -0
  18. package/dist/commands/workspace.js +17 -0
  19. package/dist/commands/workspace.js.map +1 -0
  20. package/dist/index.js +42 -9
  21. package/dist/index.js.map +1 -1
  22. package/dist/lib/backup-cursor.d.ts +16 -0
  23. package/dist/lib/backup-cursor.d.ts.map +1 -0
  24. package/dist/lib/backup-cursor.js +50 -0
  25. package/dist/lib/backup-cursor.js.map +1 -0
  26. package/dist/lib/copy-template.d.ts +9 -1
  27. package/dist/lib/copy-template.d.ts.map +1 -1
  28. package/dist/lib/copy-template.js +94 -3
  29. package/dist/lib/copy-template.js.map +1 -1
  30. package/dist/lib/cursor-detection.d.ts +6 -0
  31. package/dist/lib/cursor-detection.d.ts.map +1 -0
  32. package/dist/lib/cursor-detection.js +31 -0
  33. package/dist/lib/cursor-detection.js.map +1 -0
  34. package/dist/lib/detection.d.ts +25 -0
  35. package/dist/lib/detection.d.ts.map +1 -0
  36. package/dist/lib/detection.js +186 -0
  37. package/dist/lib/detection.js.map +1 -0
  38. package/dist/lib/install-existing.d.ts +6 -0
  39. package/dist/lib/install-existing.d.ts.map +1 -0
  40. package/dist/lib/install-existing.js +63 -0
  41. package/dist/lib/install-existing.js.map +1 -0
  42. package/dist/lib/project-name.d.ts +7 -0
  43. package/dist/lib/project-name.d.ts.map +1 -0
  44. package/dist/lib/project-name.js +13 -0
  45. package/dist/lib/project-name.js.map +1 -0
  46. package/dist/lib/prompts.d.ts +6 -5
  47. package/dist/lib/prompts.d.ts.map +1 -1
  48. package/dist/lib/prompts.js +114 -0
  49. package/dist/lib/prompts.js.map +1 -1
  50. package/dist/lib/version-check.d.ts +21 -0
  51. package/dist/lib/version-check.d.ts.map +1 -0
  52. package/dist/lib/version-check.js +49 -0
  53. package/dist/lib/version-check.js.map +1 -0
  54. package/dist/lib/workspace.d.ts +7 -0
  55. package/dist/lib/workspace.d.ts.map +1 -0
  56. package/dist/lib/workspace.js +38 -0
  57. package/dist/lib/workspace.js.map +1 -0
  58. package/dist/types.d.ts +32 -0
  59. package/dist/types.d.ts.map +1 -0
  60. package/dist/types.js +2 -0
  61. package/dist/types.js.map +1 -0
  62. package/package.json +2 -2
  63. package/template/.cursor/commands/_shared/activation.md +220 -0
  64. package/template/.cursor/commands/_shared/coderabbit-integration.md +278 -0
  65. package/template/.cursor/commands/_shared/command-stacks.md +124 -0
  66. package/template/.cursor/commands/_shared/deployment-detection.md +294 -0
  67. package/template/.cursor/commands/_shared/detection.md +277 -0
  68. package/template/.cursor/commands/_shared/documentation-lookup.md +321 -0
  69. package/template/.cursor/commands/_shared/git-workflow.md +288 -0
  70. package/template/.cursor/commands/_shared/github-helpers.md +337 -0
  71. package/template/.cursor/commands/_shared/github-workflows.md +351 -0
  72. package/template/.cursor/commands/_shared/helper-metadata.md +481 -0
  73. package/template/.cursor/commands/_shared/linear-automation.md +388 -0
  74. package/template/.cursor/commands/_shared/linear-helpers.md +254 -0
  75. package/template/.cursor/commands/_shared/performance-monitoring.md +369 -0
  76. package/template/.cursor/commands/_shared/pr-description.md +279 -0
  77. package/template/.cursor/commands/_shared/retrospective-spec-creation.md +977 -0
  78. package/template/.cursor/commands/_shared/scaling.md +264 -0
  79. package/template/.cursor/commands/_shared/state-assertions.md +174 -0
  80. package/template/.cursor/commands/_shared/test-automation.md +388 -0
  81. package/template/.cursor/commands/_shared/verification-checkpoints.md +145 -0
  82. package/template/.cursor/commands/spec/audit.md +240 -0
  83. package/template/.cursor/commands/spec/evolve.md +163 -0
  84. package/template/.cursor/commands/spec/sync.md +196 -0
  85. package/template/.cursor/commands/tools/refactor.md +555 -0
  86. package/template/.cursor/rules/10-engineering.mdc +149 -0
  87. package/template/.cursor/rules/11-design.mdc +129 -0
  88. package/template/.cursor/rules/12-business.mdc +132 -0
  89. package/template/.cursor/rules/20-nextjs.mdc +146 -0
  90. package/template/.cursor/rules/21-api-design.mdc +176 -0
  91. package/template/.cursor/rules/30-database.mdc +183 -0
  92. package/template/.cursor/rules/31-testing.mdc +191 -0
  93. package/template/.cursor/scripts/validate-helpers.js +254 -0
  94. package/template/.sdd/detection-cache.json +1 -0
  95. package/template/.sdd/install-info.json +1 -0
  96. package/template/.sdd/version +1 -0
  97. package/template/spec/00-root-spec.md +8 -1
  98. package/template/work/backlog/tasks.local.md +92 -0
@@ -0,0 +1,288 @@
1
+ ---
2
+ helper_id: git-workflow
3
+ load_when:
4
+ - task_start
5
+ - task_validate
6
+ - commit_needed
7
+ - pr_creation_needed
8
+ sections:
9
+ commit_generation:
10
+ title: "Commit Message Generation"
11
+ lines: [13, 80]
12
+ state_detection:
13
+ title: "State Detection"
14
+ lines: [81, 150]
15
+ next_steps:
16
+ title: "Next Step Logic"
17
+ lines: [151, 220]
18
+ always_load: false
19
+ ---
20
+
21
+ # Git Workflow Automation
22
+
23
+ This helper provides logic for automatic commit message generation, state detection, and next step determination for Git/GitHub workflows.
24
+
25
+ ## Purpose
26
+
27
+ Automate Git workflow operations:
28
+ - Generate meaningful commit messages based on changes
29
+ - Detect current state (branch, PR, deployment)
30
+ - Determine next steps automatically
31
+ - Track state transitions
32
+
33
+ ## Commit Message Generation
34
+
35
+ ### Format
36
+
37
+ **Standard format:** `[task-id] type: description`
38
+
39
+ **Examples:**
40
+ - `[T1.2] feat: add user authentication`
41
+ - `[T2.3] fix: resolve database connection issue`
42
+ - `[T3.1] refactor: extract payment logic to service`
43
+ - `[T4.5] docs: update API documentation`
44
+
45
+ ### Commit Types
46
+
47
+ **feat:** New feature
48
+ - New functionality added
49
+ - New components, pages, features
50
+ - New API endpoints
51
+
52
+ **fix:** Bug fix
53
+ - Fixes existing bugs
54
+ - Resolves errors or issues
55
+ - Corrects broken functionality
56
+
57
+ **refactor:** Code refactoring
58
+ - Code restructuring without changing functionality
59
+ - Improving code organization
60
+ - Extracting logic to services/utilities
61
+
62
+ **docs:** Documentation
63
+ - Documentation updates
64
+ - README changes
65
+ - Code comments
66
+
67
+ **test:** Tests
68
+ - Adding or updating tests
69
+ - Test infrastructure changes
70
+
71
+ **chore:** Maintenance
72
+ - Dependency updates
73
+ - Build configuration changes
74
+ - Tooling changes
75
+
76
+ **style:** Code style
77
+ - Formatting changes
78
+ - Linting fixes
79
+ - Code style improvements
80
+
81
+ ### Type Detection Logic
82
+
83
+ **Analyze git diff to determine type:**
84
+
85
+ 1. **Check file patterns:**
86
+ - `*.test.ts`, `*.spec.ts` → `test`
87
+ - `*.md`, `README*`, `docs/*` → `docs`
88
+ - `package.json`, `*.config.*` → `chore`
89
+
90
+ 2. **Check diff content:**
91
+ - New files with `export function`, `export class` → `feat`
92
+ - Changes to error handling, try-catch → `fix`
93
+ - Large structural changes → `refactor`
94
+ - Formatting-only changes → `style`
95
+
96
+ 3. **Check commit context:**
97
+ - If task description mentions "fix" or "bug" → `fix`
98
+ - If task description mentions "refactor" → `refactor`
99
+ - If task description mentions "add" or "implement" → `feat`
100
+
101
+ ### Description Generation
102
+
103
+ **From task spec:**
104
+ - Use task description as base
105
+ - Extract key action: "Add user authentication" → "add user authentication"
106
+ - Keep concise (max 72 characters for first line)
107
+
108
+ **From git diff:**
109
+ - Summarize changed files
110
+ - Identify main change: "Modified 3 files: added auth service, updated routes, added tests"
111
+ - Extract key functionality added/changed
112
+
113
+ **Combined:**
114
+ - Task description + key changes
115
+ - Format: `[task-id] type: task description (key changes)`
116
+
117
+ ## State Detection
118
+
119
+ ### State Structure
120
+
121
+ **State file:** `.sdd/git-state.json`
122
+
123
+ **State format:**
124
+ ```json
125
+ {
126
+ "branch": {
127
+ "name": "task/t1.2-setup-database",
128
+ "exists": true,
129
+ "pushed": false,
130
+ "commits": 3,
131
+ "last_commit": "abc123"
132
+ },
133
+ "pr": {
134
+ "exists": false,
135
+ "number": null,
136
+ "url": null,
137
+ "status": null,
138
+ "merged": false
139
+ },
140
+ "deployment": {
141
+ "provider": null,
142
+ "preview_url": null,
143
+ "status": null
144
+ },
145
+ "validated": false,
146
+ "last_updated": "2026-01-07T12:00:00Z"
147
+ }
148
+ ```
149
+
150
+ ### Branch State Detection
151
+
152
+ **Check branch status:**
153
+ 1. Get current branch: `git branch --show-current`
154
+ 2. Check if branch exists: `git rev-parse --verify <branch-name>`
155
+ 3. Check if pushed: `git ls-remote --heads origin <branch-name>`
156
+ 4. Count commits: `git rev-list --count main..<branch-name>`
157
+ 5. Get last commit: `git rev-parse HEAD`
158
+
159
+ ### PR State Detection
160
+
161
+ **Priority 1: GitHub MCP**
162
+ - Use `mcp_github_list_pull_requests` to find PR for branch
163
+ - Check if PR exists and get PR number/URL
164
+
165
+ **Priority 2: GitHub CLI**
166
+ - Use `gh pr list --head <branch-name> --json number,url,state`
167
+ - Parse JSON output for PR info
168
+
169
+ **Priority 3: Local Mode**
170
+ - Check state file for cached PR info
171
+ - If not found → assume no PR exists
172
+
173
+ ### Deployment State Detection
174
+
175
+ **Check deployment provider:**
176
+ - Use deployment detection helper (see `deployment-detection.md`)
177
+ - Check provider-specific status
178
+ - Get preview URL if available
179
+
180
+ ## Next Step Detection
181
+
182
+ ### Decision Logic
183
+
184
+ **Based on current state, determine next action:**
185
+
186
+ 1. **Branch created, no commits:**
187
+ - Next step: "Start implementing task"
188
+ - State: `{branch: exists, commits: 0, pr: null}`
189
+
190
+ 2. **Commits made, not validated:**
191
+ - Next step: "Run validation (/task/validate)"
192
+ - State: `{branch: exists, commits: N, pr: null, validated: false}`
193
+
194
+ 3. **Validated, no PR:**
195
+ - Next step: "Create PR"
196
+ - State: `{branch: exists, commits: N, pr: null, validated: true}`
197
+
198
+ 4. **PR created, not pushed:**
199
+ - Next step: "Push branch to remote"
200
+ - State: `{branch: exists, pushed: false, pr: null}`
201
+
202
+ 5. **PR exists, not deployed:**
203
+ - Next step: "Deploy to preview (if available)"
204
+ - State: `{branch: exists, pr: {exists: true}, deployed: false}`
205
+
206
+ 6. **PR merged:**
207
+ - Next step: "Cleanup branch"
208
+ - State: `{pr: {merged: true}}`
209
+
210
+ ### State Transitions
211
+
212
+ **Track transitions:**
213
+ 1. Branch created → Initialize state
214
+ 2. First commit → Update commit count
215
+ 3. Validation passed → Set validated: true
216
+ 4. PR created → Update PR info
217
+ 5. Deployment triggered → Update deployment info
218
+ 6. PR merged → Update merged status
219
+ 7. Branch deleted → Mark branch as deleted
220
+
221
+ ## Integration Points
222
+
223
+ ### In `/task/start`:
224
+
225
+ **After branch creation:**
226
+ 1. Initialize state tracking
227
+ 2. Set state: `{branch: {exists: true, commits: 0}, pr: null, validated: false}`
228
+ 3. Store in `.sdd/git-state.json`
229
+
230
+ ### In `/task/validate`:
231
+
232
+ **Before validation:**
233
+ 1. Read current state
234
+ 2. Check if branch exists and has commits
235
+ 3. If no commits → suggest committing changes first
236
+
237
+ **After validation:**
238
+ 1. Update state: `validated: true`
239
+ 2. Determine next step based on state
240
+ 3. If validated and no PR → suggest creating PR
241
+ 4. Update state file
242
+
243
+ ### When Committing:
244
+
245
+ **Generate commit message:**
246
+ 1. Analyze git diff
247
+ 2. Determine commit type
248
+ 3. Generate description from task/changes
249
+ 4. Format: `[task-id] type: description`
250
+ 5. Use generated message for commit
251
+
252
+ ## Error Handling
253
+
254
+ - **Git operations fail:** Report error, continue without state update
255
+ - **State file not writable:** Continue without state tracking (degraded mode)
256
+ - **PR detection fails:** Assume no PR exists, continue workflow
257
+ - **Deployment detection fails:** Skip deployment, continue workflow
258
+
259
+ ## Best Practices
260
+
261
+ 1. **Always check state before actions:** Avoid duplicate operations
262
+ 2. **Update state after each transition:** Keep state file current
263
+ 3. **Generate meaningful messages:** Commit messages should be clear and descriptive
264
+ 4. **Graceful degradation:** Work even if state tracking unavailable
265
+ 5. **Auto-detect everything:** Minimize manual state management
266
+
267
+ ## Examples
268
+
269
+ ### Example 1: First Commit
270
+
271
+ **State before:** `{branch: exists, commits: 0}`
272
+ **Changes:** Added `src/auth/service.ts`
273
+ **Generated message:** `[T1.2] feat: add user authentication service`
274
+ **State after:** `{branch: exists, commits: 1}`
275
+
276
+ ### Example 2: Bug Fix
277
+
278
+ **State before:** `{branch: exists, commits: 2, validated: false}`
279
+ **Changes:** Fixed database connection error
280
+ **Generated message:** `[T2.3] fix: resolve database connection timeout`
281
+ **State after:** `{branch: exists, commits: 3, validated: false}`
282
+
283
+ ### Example 3: Ready for PR
284
+
285
+ **State:** `{branch: exists, commits: 3, validated: true, pr: null}`
286
+ **Next step:** "Create PR"
287
+ **Action:** Generate PR description and create PR
288
+
@@ -0,0 +1,337 @@
1
+ ---
2
+ helper_id: github-helpers
3
+ load_when:
4
+ - pr_exists
5
+ - github_operation_needed
6
+ - coderabbit_integration
7
+ sections:
8
+ detection:
9
+ title: "GitHub Integration Detection"
10
+ lines: [1, 50]
11
+ pr_comments:
12
+ title: "Read PR Conversations"
13
+ lines: [51, 100]
14
+ resolve:
15
+ title: "Resolve Conversations"
16
+ lines: [101, 150]
17
+ always_load: false
18
+ ---
19
+
20
+ # GitHub Helpers
21
+
22
+ This helper provides logic for GitHub PR conversation resolution and argumentation logging, with fallback support for GitHub CLI and local mode.
23
+
24
+ ## Purpose
25
+
26
+ Handle GitHub PR operations with fallback strategy:
27
+ - Detect GitHub integration availability (MCP → CLI → Local)
28
+ - Read PR conversations
29
+ - Resolve conversations
30
+ - Track resolved issues
31
+ - Log argumentation when issues shouldn't be resolved
32
+
33
+ ## GitHub Integration Detection
34
+
35
+ ### Detection Process
36
+
37
+ **Step 1: Check GitHub MCP**
38
+ 1. Try to call GitHub MCP function (e.g., `mcp_github_get_pull_request_comments`)
39
+ 2. If function available → MCP is available
40
+ 3. If function not available → proceed to Step 2
41
+
42
+ **Step 2: Check GitHub CLI**
43
+ 1. Check if `gh` is installed: `gh --version`
44
+ 2. If installed → CLI is available
45
+ 3. If not installed → proceed to Step 3
46
+
47
+ **Step 3: Local Mode**
48
+ 1. If both MCP and CLI unavailable → use local mode
49
+ 2. Log operations to `work/backlog/tasks.local.md`
50
+
51
+ ### Integration Priority
52
+
53
+ **Priority 1: GitHub MCP**
54
+ - Use MCP functions when available
55
+ - Most reliable and feature-rich
56
+ - Direct API access
57
+
58
+ **Priority 2: GitHub CLI**
59
+ - Use `gh` commands when MCP unavailable
60
+ - Requires CLI installation
61
+ - Parse CLI output
62
+
63
+ **Priority 3: Local Mode**
64
+ - Log to local files when both unavailable
65
+ - No GitHub integration, but workflow continues
66
+
67
+ ## Reading PR Conversations
68
+
69
+ ### Via GitHub MCP
70
+
71
+ **Function:** `mcp_github_get_pull_request_comments`
72
+
73
+ **Usage:**
74
+ - Get PR number from current branch or user input
75
+ - Call MCP function with PR number
76
+ - Parse returned comments
77
+
78
+ **Example:**
79
+ ```typescript
80
+ // Pseudo-code
81
+ const comments = await mcp_github_get_pull_request_comments({
82
+ owner: "username",
83
+ repo: "repo-name",
84
+ pull_number: 123
85
+ });
86
+ ```
87
+
88
+ ### Via GitHub CLI
89
+
90
+ **Command:** `gh pr view --comments <pr-number>`
91
+
92
+ **Usage:**
93
+ 1. Get PR number from current branch: `gh pr view --json number`
94
+ 2. Get comments: `gh pr view <pr-number> --comments`
95
+ 3. Parse JSON output for comments
96
+
97
+ **Example:**
98
+ ```bash
99
+ # Get PR number from current branch
100
+ PR_NUMBER=$(gh pr view --json number -q .number)
101
+
102
+ # Get comments
103
+ gh pr view $PR_NUMBER --comments --json comments
104
+ ```
105
+
106
+ ### Via Local Mode
107
+
108
+ **Fallback:**
109
+ - If both MCP and CLI unavailable
110
+ - Log to `work/backlog/tasks.local.md`
111
+ - Format: "CodeRabbit comment on PR #X: [comment text]"
112
+
113
+ ## Resolving Conversations
114
+
115
+ ### Via GitHub MCP
116
+
117
+ **If MCP has resolve function:**
118
+ - Use MCP function to resolve conversation
119
+ - Mark conversation as resolved with comment
120
+
121
+ **If MCP doesn't have resolve function:**
122
+ - Use review comments to mark as resolved
123
+ - Add comment: "Issue resolved in code"
124
+
125
+ ### Via GitHub CLI
126
+
127
+ **Command:** `gh pr comment <pr-number> --body "<comment>"`
128
+
129
+ **Usage:**
130
+ 1. Add comment indicating resolution
131
+ 2. Use review comments if available: `gh pr review --comment`
132
+
133
+ **Example:**
134
+ ```bash
135
+ # Add resolution comment
136
+ gh pr comment $PR_NUMBER --body "Issue resolved in code. Changes applied."
137
+
138
+ # Or use review comment
139
+ gh pr review $PR_NUMBER --comment --body "Issue resolved"
140
+ ```
141
+
142
+ ### Via Local Mode
143
+
144
+ **Fallback:**
145
+ - Log resolution to `work/backlog/tasks.local.md`
146
+ - Format: "Resolved CodeRabbit comment on PR #X: [comment text]"
147
+ - Include timestamp and resolution reason
148
+
149
+ ## Tracking Resolved Issues
150
+
151
+ ### Purpose
152
+
153
+ Avoid duplicate resolution attempts and track what's been resolved.
154
+
155
+ ### Tracking Method
156
+
157
+ **Local tracking file:** `.sdd/github-resolved-issues.json`
158
+
159
+ **Structure:**
160
+ ```json
161
+ {
162
+ "resolved": [
163
+ {
164
+ "pr_number": 123,
165
+ "comment_id": "abc123",
166
+ "resolved_at": "2026-01-07T12:00:00Z",
167
+ "resolved_by": "system",
168
+ "resolution_reason": "Issue fixed in code"
169
+ }
170
+ ]
171
+ }
172
+ ```
173
+
174
+ ### Check Before Resolution
175
+
176
+ 1. Read tracking file
177
+ 2. Check if comment already resolved
178
+ 3. If already resolved → skip
179
+ 4. If not resolved → proceed with resolution
180
+
181
+ ### Update After Resolution
182
+
183
+ 1. Add entry to tracking file
184
+ 2. Include PR number, comment ID, timestamp
185
+ 3. Save tracking file
186
+
187
+ ## Argumentation Logging
188
+
189
+ ### When Issue Shouldn't Be Resolved
190
+
191
+ **Provide argumentation:**
192
+ - Explain why issue won't be resolved
193
+ - Reference project patterns or decisions
194
+ - Include context and reasoning
195
+
196
+ ### Logging Methods
197
+
198
+ **Priority 1: Linear Issue**
199
+ - If Linear available → create issue or add comment
200
+ - Include argumentation and CodeRabbit comment reference
201
+
202
+ **Priority 2: GitHub Issue**
203
+ - If GitHub available → create issue or add comment
204
+ - Include argumentation and PR reference
205
+
206
+ **Priority 3: Local Mode**
207
+ - Log to `work/backlog/tasks.local.md`
208
+ - Format: "CodeRabbit issue deferred: [reason]"
209
+
210
+ ### Argumentation Format
211
+
212
+ **Structure:**
213
+ - **Issue:** Brief description
214
+ - **CodeRabbit suggestion:** What was suggested
215
+ - **Decision:** Why not resolving
216
+ - **Reasoning:** Detailed explanation
217
+ - **Reference:** Project patterns, decisions, or context
218
+
219
+ **Example:**
220
+ ```
221
+ Issue: CodeRabbit suggests using Map instead of Object
222
+ CodeRabbit suggestion: "Consider using Map for better performance"
223
+ Decision: Deferring this optimization
224
+ Reasoning: Current Object usage is sufficient for this use case (small dataset, infrequent access). Performance gain would be minimal and not worth the refactoring effort at this time.
225
+ Reference: spec/05-decisions.md - Performance optimization guidelines
226
+ ```
227
+
228
+ ## GitHub CLI Commands Reference
229
+
230
+ ### PR Operations
231
+
232
+ **View PR:**
233
+ ```bash
234
+ gh pr view <pr-number>
235
+ gh pr view --json number,title,comments
236
+ ```
237
+
238
+ **Get PR comments:**
239
+ ```bash
240
+ gh pr view <pr-number> --comments
241
+ gh pr view <pr-number> --comments --json comments
242
+ ```
243
+
244
+ **Add PR comment:**
245
+ ```bash
246
+ gh pr comment <pr-number> --body "<comment text>"
247
+ ```
248
+
249
+ **Create PR review:**
250
+ ```bash
251
+ gh pr review <pr-number> --approve
252
+ gh pr review <pr-number> --request-changes --body "<comment>"
253
+ gh pr review <pr-number> --comment --body "<comment>"
254
+ ```
255
+
256
+ ### Issue Operations
257
+
258
+ **Create issue:**
259
+ ```bash
260
+ gh issue create --title "<title>" --body "<body>"
261
+ ```
262
+
263
+ **Add issue comment:**
264
+ ```bash
265
+ gh issue comment <issue-number> --body "<comment>"
266
+ ```
267
+
268
+ **List issues:**
269
+ ```bash
270
+ gh issue list
271
+ gh issue list --json number,title,state
272
+ ```
273
+
274
+ ## Integration Points
275
+
276
+ ### In `/task/validate`:
277
+
278
+ **After validation:**
279
+ 1. Check if PR exists (from current branch)
280
+ 2. If PR exists → read conversations via helpers
281
+ 3. For each CodeRabbit comment:
282
+ - Check if resolved (via tracking)
283
+ - If resolved → skip
284
+ - If not resolved → check if issue fixed in code
285
+ - If fixed → resolve conversation
286
+ - If not fixed → evaluate and take action
287
+
288
+ ### In `/tools/refactor`:
289
+
290
+ **After refactoring:**
291
+ 1. Check if PR exists
292
+ 2. If PR exists → read conversations
293
+ 3. For refactoring-related comments:
294
+ - Check if refactoring applied
295
+ - If applied → resolve conversation
296
+ - If not applied → provide argumentation
297
+
298
+ ## Error Handling
299
+
300
+ - **GitHub MCP not available:** Try GitHub CLI, then local mode
301
+ - **GitHub CLI not available:** Use local mode
302
+ - **PR not found:** Skip PR integration, continue workflow
303
+ - **Comment parsing fails:** Log error, continue with next comment
304
+ - **Resolution fails:** Log error, continue workflow
305
+
306
+ ## Best Practices
307
+
308
+ 1. **Always check tracking:** Avoid duplicate resolution attempts
309
+ 2. **Provide clear argumentation:** When deferring issues, explain why
310
+ 3. **Don't block workflow:** If GitHub integration fails, continue without it
311
+ 4. **Log operations:** Track what's been resolved for future reference
312
+ 5. **Respect user decisions:** If user explicitly ignores issue, don't re-raise
313
+
314
+ ## Examples
315
+
316
+ ### Example 1: Resolve via MCP
317
+
318
+ 1. Detect MCP available
319
+ 2. Get PR comments via MCP
320
+ 3. Resolve conversation via MCP
321
+ 4. Update tracking file
322
+
323
+ ### Example 2: Resolve via CLI
324
+
325
+ 1. Detect MCP not available
326
+ 2. Check CLI available
327
+ 3. Get PR comments via CLI
328
+ 4. Add resolution comment via CLI
329
+ 5. Update tracking file
330
+
331
+ ### Example 3: Local Mode Fallback
332
+
333
+ 1. Detect MCP not available
334
+ 2. Detect CLI not available
335
+ 3. Log to `work/backlog/tasks.local.md`
336
+ 4. Continue workflow
337
+