agentsys 5.3.4 → 5.3.6

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 (74) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +11 -0
  4. package/bin/cli.js +40 -28
  5. package/lib/adapter-transforms.js +3 -3
  6. package/package.json +1 -1
  7. package/site/content.json +32 -8
  8. package/.cursor/commands/audit-project-agents.md +0 -454
  9. package/.cursor/commands/audit-project-github.md +0 -141
  10. package/.cursor/commands/audit-project.md +0 -330
  11. package/.cursor/commands/consult.md +0 -417
  12. package/.cursor/commands/debate.md +0 -381
  13. package/.cursor/commands/delivery-approval.md +0 -334
  14. package/.cursor/commands/deslop.md +0 -142
  15. package/.cursor/commands/drift-detect.md +0 -259
  16. package/.cursor/commands/enhance.md +0 -172
  17. package/.cursor/commands/learn.md +0 -165
  18. package/.cursor/commands/next-task.md +0 -519
  19. package/.cursor/commands/perf.md +0 -464
  20. package/.cursor/commands/repo-map.md +0 -124
  21. package/.cursor/commands/ship-ci-review-loop.md +0 -468
  22. package/.cursor/commands/ship-deployment.md +0 -348
  23. package/.cursor/commands/ship-error-handling.md +0 -265
  24. package/.cursor/commands/ship.md +0 -517
  25. package/.cursor/commands/sync-docs.md +0 -171
  26. package/.cursor/commands/web-ctl.md +0 -101
  27. package/.cursor/skills/consult/SKILL.md +0 -425
  28. package/.cursor/skills/debate/SKILL.md +0 -316
  29. package/.cursor/skills/deslop/SKILL.md +0 -204
  30. package/.cursor/skills/discover-tasks/SKILL.md +0 -297
  31. package/.cursor/skills/drift-analysis/SKILL.md +0 -324
  32. package/.cursor/skills/enhance-agent-prompts/SKILL.md +0 -277
  33. package/.cursor/skills/enhance-claude-memory/SKILL.md +0 -387
  34. package/.cursor/skills/enhance-cross-file/SKILL.md +0 -110
  35. package/.cursor/skills/enhance-docs/SKILL.md +0 -298
  36. package/.cursor/skills/enhance-hooks/SKILL.md +0 -554
  37. package/.cursor/skills/enhance-orchestrator/SKILL.md +0 -255
  38. package/.cursor/skills/enhance-plugins/SKILL.md +0 -319
  39. package/.cursor/skills/enhance-prompts/SKILL.md +0 -340
  40. package/.cursor/skills/enhance-skills/SKILL.md +0 -436
  41. package/.cursor/skills/learn/SKILL.md +0 -349
  42. package/.cursor/skills/orchestrate-review/SKILL.md +0 -260
  43. package/.cursor/skills/perf-analyzer/SKILL.md +0 -37
  44. package/.cursor/skills/perf-baseline-manager/SKILL.md +0 -30
  45. package/.cursor/skills/perf-benchmarker/SKILL.md +0 -52
  46. package/.cursor/skills/perf-code-paths/SKILL.md +0 -32
  47. package/.cursor/skills/perf-investigation-logger/SKILL.md +0 -41
  48. package/.cursor/skills/perf-profiler/SKILL.md +0 -42
  49. package/.cursor/skills/perf-theory-gatherer/SKILL.md +0 -35
  50. package/.cursor/skills/perf-theory-tester/SKILL.md +0 -36
  51. package/.cursor/skills/repo-mapping/SKILL.md +0 -83
  52. package/.cursor/skills/sync-docs/SKILL.md +0 -351
  53. package/.cursor/skills/validate-delivery/SKILL.md +0 -186
  54. package/.cursor/skills/web-auth/SKILL.md +0 -177
  55. package/.cursor/skills/web-browse/SKILL.md +0 -516
  56. package/.kiro/steering/audit-project-agents.md +0 -459
  57. package/.kiro/steering/audit-project-github.md +0 -146
  58. package/.kiro/steering/audit-project.md +0 -330
  59. package/.kiro/steering/consult.md +0 -422
  60. package/.kiro/steering/debate.md +0 -386
  61. package/.kiro/steering/delivery-approval.md +0 -339
  62. package/.kiro/steering/deslop.md +0 -149
  63. package/.kiro/steering/drift-detect.md +0 -264
  64. package/.kiro/steering/enhance.md +0 -177
  65. package/.kiro/steering/learn.md +0 -166
  66. package/.kiro/steering/next-task.md +0 -481
  67. package/.kiro/steering/perf.md +0 -469
  68. package/.kiro/steering/repo-map.md +0 -126
  69. package/.kiro/steering/ship-ci-review-loop.md +0 -473
  70. package/.kiro/steering/ship-deployment.md +0 -353
  71. package/.kiro/steering/ship-error-handling.md +0 -270
  72. package/.kiro/steering/ship.md +0 -522
  73. package/.kiro/steering/sync-docs.md +0 -178
  74. package/.kiro/steering/web-ctl.md +0 -106
@@ -1,522 +0,0 @@
1
- ---
2
- inclusion: manual
3
- name: "ship"
4
- description: "Use when user asks to \"ship this\", \"create PR\", \"merge to main\", \"deploy changes\", \"push to production\". Complete PR workflow: commit, create PR, monitor CI, merge, deploy, validate."
5
- ---
6
-
7
- # /ship - Complete PR Workflow
8
-
9
- End-to-end workflow: commit - PR - CI - review - merge - deploy - validate - production.
10
-
11
- Auto-adapts to your project's CI platform, deployment platform, and branch strategy.
12
-
13
- ---
14
-
15
- <mandatory-steps>
16
- ## Mandatory Steps - No Shortcuts
17
-
18
- Phase 4 (CI & Review Monitor Loop) is mandatory even when called from /next-task.
19
-
20
- | Step | Requirement | Why It Matters |
21
- |------|-------------|----------------|
22
- | 3-minute initial wait | Must wait after PR creation | Auto-reviewers need time to analyze |
23
- | Monitor loop iterations | Must run the full loop | Catches issues humans miss |
24
- | Address all comments | Zero unresolved threads | Quality gate, blocks merge otherwise |
25
-
26
- ### Forbidden Actions
27
- - Checking CI once and proceeding to merge
28
- - Skipping the 3-minute initial wait for auto-reviewers
29
- - Ignoring "minor" or "nit" comments
30
- - Merging with unresolved comment threads
31
- - Rationalizing "no comments yet means ready to merge"
32
-
33
- ### Required Verification Output
34
-
35
- Before proceeding to merge, output:
36
- ```
37
- [VERIFIED] Phase 4: wait=180s, iterations=N, unresolved=0
38
- ```
39
- </mandatory-steps>
40
-
41
- ---
42
-
43
- ## Quick Reference
44
-
45
- | Phase | Description | Details |
46
- |-------|-------------|---------|
47
- | 1-3 | Pre-flight, Commit, Create PR | This file |
48
- | 4 | CI & Review Monitor Loop | See `ship-ci-review-loop.md` |
49
- | 5 | Subagent Review (standalone) | This file |
50
- | 6 | Merge PR | This file |
51
- | 7-10 | Deploy & Validate | See `ship-deployment.md` |
52
- | 11-12 | Cleanup & Report | This file |
53
- | Errors | Error handling & rollback | See `ship-error-handling.md` |
54
-
55
- ## Integration with /next-task
56
-
57
- When called from `/next-task` workflow (via `--state-file`):
58
- - **SKIPS Phase 5** internal review agents (already done by Phase 9 review loop)
59
- - **SKIPS deslop/docs** (already done by deslop-agent, sync-docs-agent)
60
- - **Trusts** that all quality gates passed
61
-
62
- **CRITICAL: Phase 4 ALWAYS runs** - even from /next-task. External auto-reviewers (Gemini, Copilot, CodeRabbit) comment AFTER PR creation and must be addressed.
63
-
64
- When called standalone, runs full workflow including review.
65
-
66
- ## Arguments
67
-
68
- Parse from $ARGUMENTS:
69
- - **--strategy**: Merge strategy: `squash` (default) | `merge` | `rebase`
70
- - **--skip-tests**: Skip test validation (dangerous)
71
- - **--dry-run**: Show what would happen without executing
72
- - **--state-file**: Path to workflow state file (for /next-task integration)
73
-
74
- ## State Integration
75
-
76
- ```javascript
77
-
78
- const pluginRoot = getPluginRoot('ship');
79
- if (!pluginRoot) { console.error('Error: Could not locate ship plugin root'); process.exit(1); }
80
-
81
- const args = '$ARGUMENTS'.split(' ');
82
- const stateIdx = args.indexOf('--state-file');
83
- let workflowState = null;
84
- if (stateIdx >= 0) {
85
- workflowState = require(`${pluginRoot}/lib/state/workflow-state.js`);
86
- }
87
-
88
- function updatePhase(phase, result) {
89
- if (!workflowState) return;
90
- workflowState.startPhase(phase);
91
- if (result) workflowState.completePhase(result);
92
- }
93
- ```
94
-
95
- ## Phase 1: Pre-flight Checks
96
-
97
- ```bash
98
- # Detect platform and project configuration
99
- PLUGIN_PATH=$(node -e " const root = getPluginRoot('ship'); if (!root) { console.error('Error: Could not locate ship plugin root'); process.exit(1); } console.log(normalizePathForRequire(root));")
100
- PLATFORM=$(node "$PLUGIN_PATH/lib/platform/detect-platform.js")
101
- TOOLS=$(node "$PLUGIN_PATH/lib/platform/verify-tools.js")
102
-
103
- # Extract critical info
104
- CI_PLATFORM=$(echo $PLATFORM | jq -r '.ci')
105
- DEPLOYMENT=$(echo $PLATFORM | jq -r '.deployment')
106
- BRANCH_STRATEGY=$(echo $PLATFORM | jq -r '.branchStrategy')
107
- MAIN_BRANCH=$(echo $PLATFORM | jq -r '.mainBranch')
108
-
109
- # Check required tools
110
- GH_AVAILABLE=$(echo $TOOLS | jq -r '.gh.available')
111
- if [ "$GH_AVAILABLE" != "true" ]; then
112
- echo "ERROR: GitHub CLI (gh) required for PR workflow"
113
- exit 1
114
- fi
115
-
116
- # Determine workflow type
117
- if [ "$BRANCH_STRATEGY" = "multi-branch" ]; then
118
- WORKFLOW="dev-prod"
119
- PROD_BRANCH="stable"
120
- else
121
- WORKFLOW="single-branch"
122
- fi
123
- ```
124
-
125
- ### Verify Git Status
126
-
127
- ```bash
128
- # Check for uncommitted changes
129
- if [ -n "$(git status --porcelain)" ]; then
130
- NEEDS_COMMIT="true"
131
- else
132
- NEEDS_COMMIT="false"
133
- fi
134
-
135
- # Must be on feature branch
136
- CURRENT_BRANCH=$(git branch --show-current)
137
- if [ "$CURRENT_BRANCH" = "$MAIN_BRANCH" ]; then
138
- echo "ERROR: Cannot ship from $MAIN_BRANCH, must be on feature branch"
139
- exit 1
140
- fi
141
- ```
142
-
143
- ### Dry Run Mode
144
-
145
- If `--dry-run` provided, show plan and exit:
146
- ```markdown
147
- ## Dry Run: What Would Happen
148
- **Branch**: ${CURRENT_BRANCH} → **Target**: ${MAIN_BRANCH}
149
- **Workflow**: ${WORKFLOW} | **CI**: ${CI_PLATFORM} | **Deploy**: ${DEPLOYMENT}
150
- ```
151
-
152
- ## Phase 2: Commit Current Work
153
-
154
- Only if `NEEDS_COMMIT=true`:
155
-
156
- ```bash
157
- # Stage relevant files (exclude secrets)
158
- git status --porcelain | awk '{print $2}' | grep -v '\.env' | xargs git add
159
-
160
- # Generate semantic commit message
161
- # Format: <type>(<scope>): <subject>
162
- # Types: feat, fix, docs, refactor, test, chore
163
-
164
- git commit -m "$(cat <<'EOF'
165
- ${COMMIT_MESSAGE}
166
- EOF
167
- )"
168
-
169
- COMMIT_SHA=$(git rev-parse HEAD)
170
- echo "[OK] Committed: $COMMIT_SHA"
171
- ```
172
-
173
- ## Phase 3: Create Pull Request
174
-
175
- ```bash
176
- # Push to remote
177
- git push -u origin $CURRENT_BRANCH
178
-
179
- # Create PR
180
- PR_URL=$(gh pr create \
181
- --base "$MAIN_BRANCH" \
182
- --title "$PR_TITLE" \
183
- --body "$(cat <<'EOF'
184
- ## Summary
185
- - Bullet points of changes
186
-
187
- ## Test Plan
188
- - How to test
189
-
190
- ## Related Issues
191
- Closes #X
192
- EOF
193
- )")
194
-
195
- PR_NUMBER=$(echo $PR_URL | grep -oP '/pull/\K\d+')
196
- echo "[OK] Created PR #$PR_NUMBER: $PR_URL"
197
- ```
198
-
199
- <phase-4>
200
- ## Phase 4: CI & Review Monitor Loop
201
-
202
- **Blocking gate** - This phase is mandatory. Cannot proceed to merge without completing.
203
-
204
- See `ship-ci-review-loop.md` for full implementation details.
205
-
206
- ### Summary
207
-
208
- The monitor loop must:
209
- 1. Wait for CI to pass
210
- 2. Wait 3 minutes for auto-reviewers (mandatory on first iteration)
211
- 3. Address all comments (zero unresolved threads)
212
- 4. Iterate until clean
213
-
214
- **Every comment must be addressed:**
215
- - Critical/High issues: Fix immediately
216
- - Medium/Minor issues: Fix (shows quality)
217
- - Questions: Answer with explanation
218
- - False positives: Reply explaining why, then resolve
219
-
220
- Do not ignore comments. Do not leave comments unresolved.
221
- Do not skip the 3-minute wait. Do not check CI once and merge.
222
-
223
- ### Loop Structure
224
-
225
- ```bash
226
- MAX_ITERATIONS=10
227
- INITIAL_WAIT=180 # 3 minutes - do not reduce or skip
228
-
229
- iteration=0
230
- while [ $iteration -lt $MAX_ITERATIONS ]; do
231
- iteration=$((iteration + 1))
232
- echo "[CI Monitor] Iteration $iteration"
233
-
234
- # 1. Wait for CI to complete
235
- wait_for_ci || { fix_ci_failures; continue; }
236
-
237
- # 2. First iteration must wait for auto-reviews
238
- if [ $iteration -eq 1 ]; then
239
- echo "Waiting ${INITIAL_WAIT}s for auto-reviewers..."
240
- sleep $INITIAL_WAIT
241
- echo "[DONE] Initial wait complete"
242
- fi
243
-
244
- # 3. Check feedback
245
- FEEDBACK=$(check_pr_feedback $PR_NUMBER)
246
- UNRESOLVED=$(echo "$FEEDBACK" | jq -r '.unresolvedThreads')
247
-
248
- echo "Unresolved threads: $UNRESOLVED"
249
-
250
- # 4. Exit only if zero unresolved
251
- if [ "$UNRESOLVED" -eq 0 ]; then
252
- echo "[OK] All comments resolved - ready to merge"
253
- break
254
- fi
255
-
256
- # 5. Address all feedback (see ship-ci-review-loop.md)
257
- address_all_feedback $PR_NUMBER
258
-
259
- # 6. Commit and push fixes
260
- commit_and_push_fixes "fix: address review feedback (iteration $iteration)"
261
-
262
- # 7. Wait before next iteration
263
- sleep 30
264
- done
265
-
266
- # Verification output - mandatory
267
- echo "[VERIFIED] Phase 4: wait=180s, iterations=$iteration, unresolved=0"
268
- ```
269
-
270
- ### Forbidden Actions in Phase 4
271
- - `sleep 0` or removing the initial wait
272
- - Checking CI once without running the loop
273
- - Breaking out of loop with unresolved comments
274
- - Skipping to Phase 6 (merge) without verification output
275
- </phase-4>
276
-
277
- ## Phase 5: Review Loop (Standalone Only)
278
-
279
- **Skip if called from /next-task** (review already done).
280
-
281
- ```javascript
282
- if (workflowState) {
283
- const state = workflowState.readState();
284
- const reviewPhase = state?.phases?.history?.find(p => p.phase === 'review-loop');
285
- if (reviewPhase?.result?.approved) {
286
- SKIP_REVIEW = true; // Skip to Phase 6
287
- }
288
- }
289
- ```
290
-
291
- When running standalone, launch core review passes in parallel (error handling is part of code quality):
292
-
293
- ```javascript
294
- const reviewPasses = [
295
- { id: 'code-quality', role: 'code quality reviewer' },
296
- { id: 'security', role: 'security reviewer' },
297
- { id: 'performance', role: 'performance reviewer' },
298
- { id: 'test-coverage', role: 'test coverage reviewer' }
299
- ];
300
-
301
- // Add specialists based on repo signals (db, architecture, api, frontend, backend, devops)
302
- // Then launch in parallel:
303
- reviewPasses.map(pass => Task({
304
- subagent_type: "review",
305
- prompt: `Role: ${pass.role}. Review PR #${PR_NUMBER} and return JSON findings.`
306
- }));
307
- ```
308
-
309
- Iterate until no open (non-false-positive) issues remain (max 3 iterations if running standalone).
310
-
311
- <phase-6>
312
- ## Phase 6: Merge PR
313
-
314
- Pre-merge checks (do not skip):
315
-
316
- ```bash
317
- # 1. Verify mergeable status
318
- MERGEABLE=$(gh pr view $PR_NUMBER --json mergeable --jq '.mergeable')
319
- [ "$MERGEABLE" != "MERGEABLE" ] && { echo "[ERROR] PR not mergeable"; exit 1; }
320
-
321
- # 2. Verify all comments resolved (zero unresolved threads)
322
- # Use separate gh calls for cleaner extraction (avoids cut parsing issues)
323
- OWNER=$(gh repo view --json owner --jq '.owner.login')
324
- REPO=$(gh repo view --json name --jq '.name')
325
-
326
- # NOTE: Fetches first 100 threads. For PRs with >100 comment threads (rare),
327
- # implement pagination using pageInfo.hasNextPage and pageInfo.endCursor.
328
- # This covers 99.9% of PRs - pagination is left as a future enhancement.
329
- UNRESOLVED=$(gh api graphql -f query='
330
- query($owner: String!, $repo: String!, $pr: Int!) {
331
- repository(owner: $owner, name: $repo) {
332
- pullRequest(number: $pr) {
333
- reviewThreads(first: 100) {
334
- nodes { isResolved }
335
- }
336
- }
337
- }
338
- }
339
- ' -f owner="$OWNER" -f repo="$REPO" -F pr=$PR_NUMBER \
340
- --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)] | length')
341
-
342
- if [ "$UNRESOLVED" -gt 0 ]; then
343
- echo "[ERROR] Cannot merge: $UNRESOLVED unresolved comment threads"
344
- echo "Go back to Phase 4 and address all comments"
345
- exit 1
346
- fi
347
-
348
- echo "[OK] All comments resolved"
349
-
350
- # 3. Detect if running from a worktree
351
- IS_WORKTREE="false"
352
- if [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.git" ]; then
353
- IS_WORKTREE="true"
354
- echo "[INFO] Running from worktree - using remote-only merge strategy"
355
- fi
356
-
357
- # 4. Merge with strategy (default: squash)
358
- STRATEGY=${STRATEGY:-squash}
359
- if [ -z "$OWNER" ] || [ -z "$REPO" ]; then
360
- echo "[ERROR] Failed to extract repo owner/name"
361
- exit 1
362
- fi
363
-
364
- if [ "$IS_WORKTREE" = "true" ]; then
365
- # In worktree: merge without --delete-branch (it tries to checkout main locally)
366
- gh pr merge $PR_NUMBER --$STRATEGY --repo "$OWNER/$REPO"
367
- # Delete remote branch separately
368
- git push origin --delete "$CURRENT_BRANCH" 2>&1 || echo "[WARN] Remote branch deletion failed - may need manual cleanup"
369
- # Get merge SHA from the PR metadata (avoids race condition with fetch)
370
- MERGE_SHA=$(gh pr view $PR_NUMBER --repo "$OWNER/$REPO" --json mergeCommit --jq '.mergeCommit.oid')
371
- else
372
- gh pr merge $PR_NUMBER --$STRATEGY --delete-branch
373
- # Update local
374
- git checkout $MAIN_BRANCH
375
- git pull origin $MAIN_BRANCH
376
- MERGE_SHA=$(git rev-parse HEAD)
377
- fi
378
-
379
- # Update repo-map if it exists (non-blocking)
380
- node -e " const pluginRoot = getPluginRoot('ship'); if (!pluginRoot) { console.log('Plugin root not found, skipping repo-map'); process.exit(0); } if (repoMap.exists(process.cwd())) { repoMap.update(process.cwd(), {}).then(() => console.log('[OK] Repo-map updated')).catch((e) => console.log('[WARN] Repo-map update failed: ' + e.message)); } else { console.log('Repo-map not found, skipping'); }" || true
381
- echo "[OK] Merged PR #$PR_NUMBER at $MERGE_SHA"
382
- ```
383
- </phase-6>
384
-
385
- ## Phases 7-10: Deploy & Validate
386
-
387
- **Skip if `WORKFLOW="single-branch"`**
388
-
389
- See `ship-deployment.md` for platform-specific details:
390
- - Phase 7: Deploy to Development (Railway, Vercel, Netlify)
391
- - Phase 8: Validate Development (health checks, smoke tests)
392
- - Phase 9: Deploy to Production (merge to prod branch)
393
- - Phase 10: Validate Production (with auto-rollback on failure)
394
-
395
- ## Phase 11: Cleanup
396
-
397
- ```bash
398
- # Clean up worktrees
399
- git worktree list --porcelain | grep "worktree" | grep -v "$(git rev-parse --show-toplevel)" | while read -r wt; do
400
- WORKTREE_PATH=$(echo $wt | awk '{print $2}')
401
- git worktree remove $WORKTREE_PATH --force 2>/dev/null || true
402
- done
403
- ```
404
-
405
- ### Close GitHub Issue (if applicable)
406
-
407
- If the task came from a GitHub issue, close it with a completion comment:
408
-
409
- ```bash
410
- if [ -n "$TASK_ID" ] && [ "$TASK_SOURCE" = "github" ]; then
411
- # Post completion comment
412
- gh issue comment "$TASK_ID" --body "$(cat <<'EOF'
413
- [DONE] **Task Completed Successfully**
414
-
415
- **PR**: #${PR_NUMBER}
416
- **Status**: Merged to ${MAIN_BRANCH}
417
- **Commit**: ${MERGE_SHA}
418
-
419
- ### Summary
420
- - Implementation completed as planned
421
- - All review comments addressed
422
- - CI checks passed
423
- - Merged successfully
424
-
425
- ---
426
- _This issue was automatically processed by AgentSys /next-task workflow._
427
- _Closing issue as the work has been completed and merged._
428
- EOF
429
- )"
430
-
431
- # Close the issue
432
- gh issue close "$TASK_ID" --reason completed
433
-
434
- echo "[OK] Closed issue #$TASK_ID with completion comment"
435
- fi
436
- ```
437
-
438
- ### Remove Task from Registry
439
-
440
- ```javascript
441
- // Remove completed task from ${STATE_DIR}/tasks.json
442
- if (workflowState) {
443
- const state = workflowState.readState();
444
- const mainRepoPath = state?.git?.mainRepoPath || process.cwd();
445
- const taskId = state?.task?.id;
446
-
447
- if (taskId) {
448
- const registryPath = path.join(mainRepoPath, '.claude', 'tasks.json');
449
- const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
450
- registry.tasks = registry.tasks.filter(t => t.id !== taskId);
451
- fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2));
452
- console.log(`[OK] Removed task #${taskId} from registry`);
453
- }
454
- }
455
- ```
456
-
457
- ### Local Branch Cleanup
458
-
459
- ```bash
460
- # Re-detect worktree in case Phase 6 was skipped or run separately
461
- if [ -z "$IS_WORKTREE" ]; then
462
- IS_WORKTREE="false"
463
- if [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.git" ]; then
464
- IS_WORKTREE="true"
465
- fi
466
- fi
467
-
468
- if [ "$IS_WORKTREE" = "true" ]; then
469
- echo "[OK] Local branch cleanup deferred (worktree mode - cleaned when worktree is removed)"
470
- else
471
- git checkout $MAIN_BRANCH
472
- git branch -D $CURRENT_BRANCH 2>/dev/null || true
473
- fi
474
- ```
475
-
476
- ## Phase 12: Completion Report
477
-
478
- ```markdown
479
- # Deployment Complete
480
-
481
- ## Pull Request
482
- **Number**: #${PR_NUMBER} | **Status**: Merged to ${MAIN_BRANCH}
483
-
484
- ## Review Results
485
- - Code Quality: [OK] | Error Handling: [OK] | Test Coverage: [OK] | CI: [OK]
486
-
487
- ## Deployments
488
- ${WORKFLOW === 'dev-prod' ?
489
- `Development: ${DEV_URL} [OK] | Production: ${PROD_URL} [OK]` :
490
- `Production: Deployed to ${MAIN_BRANCH}`}
491
-
492
- [OK] Successfully shipped!
493
- ```
494
-
495
- ### Workflow Hook Response
496
-
497
- After displaying the completion report, output JSON for the SubagentStop hook:
498
-
499
- ```json
500
- {"ok": true, "nextPhase": "completed", "status": "shipped"}
501
- ```
502
-
503
- This allows the `/next-task` workflow to detect that `/ship` completed successfully.
504
-
505
- ## Error Handling
506
-
507
- See `ship-error-handling.md` for detailed error handling:
508
- - GitHub CLI not available
509
- - CI failures
510
- - Merge conflicts
511
- - Deployment failures
512
- - Production validation failures with rollback
513
-
514
- ## Important Notes
515
-
516
- - Requires GitHub CLI (gh) for PR workflow
517
- - Auto-adapts to single-branch or multi-branch workflow
518
- - Platform-specific CI and deployment monitoring
519
- - Automatic rollback on production failures
520
- - Respects project conventions (commit style, PR format)
521
-
522
- Begin Phase 1 now.
@@ -1,178 +0,0 @@
1
- ---
2
- inclusion: manual
3
- name: "sync-docs"
4
- description: "Use when user asks to \"update docs\", \"sync documentation\", \"fix outdated docs\", \"refresh README\". Compares documentation to actual code and fixes discrepancies."
5
- ---
6
-
7
- # /sync-docs - Documentation Sync
8
-
9
- Sync documentation with actual code state. Finds docs that reference changed files, updates CHANGELOG, and flags outdated examples.
10
-
11
- ## Architecture
12
-
13
- ```
14
- /sync-docs command (you are here)
15
- |
16
- v
17
- sync-docs-agent (sonnet)
18
- |-- Invoke sync-docs skill
19
- |-- Return structured results
20
- |
21
- v
22
- Command processes results
23
- |-- If apply mode + fixes: spawn simple-fixer
24
- |-- Present final results
25
- ```
26
-
27
- ## Constraints
28
-
29
- 1. **Preserve existing content** - Update references, don't rewrite sections
30
- 2. **Minimal changes** - Only fix what's actually outdated
31
- 3. **Evidence-based** - Every change linked to a specific code change
32
- 4. **Safe defaults** - Report mode by default
33
-
34
- ## Arguments
35
-
36
- Parse from $ARGUMENTS:
37
-
38
- - **Mode**: `report` (default) or `apply`
39
- - **Scope**:
40
- - `--scope=recent` (default): Files changed since last commit to main
41
- - `--scope=all`: Scan all docs against all code
42
- - `--scope=before-pr`: Files in current branch (for /next-task integration)
43
- - `path`: Specific file or directory
44
-
45
- ## Execution
46
-
47
- ### Step 1: Parse Arguments
48
-
49
- ```javascript
50
- const args = '$ARGUMENTS'.split(' ').filter(Boolean);
51
- const mode = args.includes('apply') ? 'apply' : 'report';
52
- const scopeArg = args.find(a => a.startsWith('--scope='));
53
- const scope = scopeArg ? scopeArg.split('=')[1] : 'recent';
54
- const pathArg = args.find(a => !a.startsWith('--') && a !== 'report' && a !== 'apply');
55
- ```
56
-
57
- ### Step 2: Spawn sync-docs-agent
58
-
59
- ```javascript
60
- const agentOutput = await Task({
61
- subagent_type: "sync-docs-agent",
62
- model: "sonnet",
63
- prompt: `Sync documentation with code state.
64
- Mode: ${mode}
65
- Scope: ${scope}
66
- ${pathArg ? `Path: ${pathArg}` : ''}
67
-
68
- Execute the sync-docs skill and return structured results.`
69
- });
70
- ```
71
-
72
- ### Step 3: Process Results
73
-
74
- Parse the structured JSON from between `=== SYNC_DOCS_RESULT ===` markers:
75
-
76
- ```javascript
77
- // Helper to extract JSON result from agent output
78
- function parseSyncDocsResult(output) {
79
- const match = output.match(/=== SYNC_DOCS_RESULT ===[\s\S]*?({[\s\S]*?})[\s\S]*?=== END_RESULT ===/);
80
- if (!match) {
81
- throw new Error('No SYNC_DOCS_RESULT found in agent output');
82
- }
83
- return JSON.parse(match[1]);
84
- }
85
-
86
- const result = parseSyncDocsResult(agentOutput);
87
- // result now contains: { mode, scope, validation, discovery, issues, fixes, changelog, summary }
88
- ```
89
-
90
- ### Step 4: Apply Fixes (if apply mode)
91
-
92
- If mode is `apply` and fixes array is non-empty:
93
-
94
- ```javascript
95
- if (mode === 'apply' && result.fixes.length > 0) {
96
- Delegate to the `simple-fixer` subagent:
97
- > Apply these documentation fixes:
98
- }
99
- ```
100
-
101
- ### Step 5: Present Results
102
-
103
- ```markdown
104
- ## Documentation Sync ${mode === 'apply' ? 'Applied' : 'Report'}
105
-
106
- ### Scope
107
- - Mode: ${mode}
108
- - Scope: ${scope}
109
- - Changed files analyzed: ${result.discovery.changedFilesCount}
110
- - Related docs found: ${result.discovery.relatedDocsCount}
111
-
112
- ### Validation Results
113
-
114
- **Count/Version Validation**
115
- ${result.validation.counts.status === 'ok' ? '[OK] Counts and versions aligned' : `[WARN] ${result.validation.counts.summary.issueCount} issues found`}
116
-
117
- **Cross-Platform Validation**
118
- ${result.validation.crossPlatform.status === 'ok' ? '[OK] Cross-platform docs valid' : `[WARN] ${result.validation.crossPlatform.summary.issueCount} issues found`}
119
-
120
- ### Documentation Issues
121
-
122
- ${result.issues.length === 0 ? '[OK] No documentation issues detected' :
123
- result.issues.map(i => `- **${i.doc}:${i.line || '?'}** (${i.severity}): ${i.suggestion || i.type}`).join('\n')}
124
-
125
- ### CHANGELOG Status
126
-
127
- ${result.changelog.status === 'ok' ? '[OK] All changes documented' :
128
- `[WARN] ${result.changelog.undocumented.length} commits may need entries:\n${result.changelog.undocumented.map(c => ` - ${c}`).join('\n')}`}
129
-
130
- ${mode === 'apply' && result.fixes.length > 0 ? `
131
- ### Fixes Applied
132
-
133
- ${result.fixes.map(f => `- **${f.file}**: ${f.type}`).join('\n')}
134
- ` : ''}
135
-
136
- ${mode === 'report' && result.fixes.length > 0 ? `
137
- ## Do Next
138
-
139
- - [ ] Run \`/sync-docs apply\` to fix ${result.fixes.length} auto-fixable issues
140
- - [ ] Review flagged items manually
141
- ` : ''}
142
- ```
143
-
144
- ## Examples
145
-
146
- ```bash
147
- # Check what docs might need updates (safe, no changes)
148
- /sync-docs
149
-
150
- # Check docs related to specific path
151
- /sync-docs report src/auth/
152
-
153
- # Apply safe fixes
154
- /sync-docs apply
155
-
156
- # Full codebase scan
157
- /sync-docs report --scope=all
158
-
159
- # For PR preparation
160
- /sync-docs apply --scope=before-pr
161
- ```
162
-
163
- ## Integration
164
-
165
- This command is also used by `/next-task` Phase 11:
166
-
167
- ```javascript
168
- // Phase 11 invocation
169
- Delegate to the `sync-docs-agent` subagent:
170
- > Sync docs for PR. Mode: apply, Scope: before-pr
171
- ```
172
-
173
- ## Error Handling
174
-
175
- - **No git**: Exit with "Git required for change detection"
176
- - **No changed files**: "No changes detected. Use --scope=all to scan entire codebase"
177
- - **No docs found**: "No documentation files found"
178
- - **Agent failure**: Report error, suggest manual review