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