awesome-slash 2.4.3 → 2.5.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 (146) hide show
  1. package/.claude-plugin/marketplace.json +6 -6
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +99 -1
  4. package/README.md +173 -161
  5. package/SECURITY.md +25 -81
  6. package/adapters/codex/install.sh +58 -16
  7. package/adapters/opencode/install.sh +92 -23
  8. package/lib/index.js +47 -4
  9. package/lib/patterns/review-patterns.js +58 -11
  10. package/lib/patterns/slop-patterns.js +154 -147
  11. package/lib/platform/detect-platform.js +99 -350
  12. package/lib/platform/detection-configs.js +93 -0
  13. package/lib/platform/verify-tools.js +10 -78
  14. package/lib/schemas/README.md +195 -0
  15. package/lib/schemas/validator.js +247 -0
  16. package/lib/sources/custom-handler.js +199 -0
  17. package/lib/sources/policy-questions.js +239 -0
  18. package/lib/sources/source-cache.js +149 -0
  19. package/lib/state/workflow-state.js +363 -665
  20. package/lib/types/README.md +292 -0
  21. package/lib/types/agent-frontmatter.d.ts +134 -0
  22. package/lib/types/command-frontmatter.d.ts +107 -0
  23. package/lib/types/hook-frontmatter.d.ts +115 -0
  24. package/lib/types/index.d.ts +84 -0
  25. package/lib/types/plugin-manifest.d.ts +102 -0
  26. package/lib/types/skill-frontmatter.d.ts +89 -0
  27. package/lib/utils/cache-manager.js +154 -0
  28. package/lib/utils/context-optimizer.js +5 -36
  29. package/lib/utils/deprecation.js +37 -0
  30. package/lib/utils/shell-escape.js +88 -0
  31. package/mcp-server/index.js +513 -18
  32. package/package.json +6 -2
  33. package/plugins/deslop-around/.claude-plugin/plugin.json +1 -1
  34. package/plugins/deslop-around/lib/index.js +170 -0
  35. package/plugins/deslop-around/lib/patterns/review-patterns.js +58 -11
  36. package/plugins/deslop-around/lib/patterns/slop-patterns.js +170 -129
  37. package/plugins/deslop-around/lib/platform/detect-platform.js +212 -123
  38. package/plugins/deslop-around/lib/platform/detection-configs.js +93 -0
  39. package/plugins/deslop-around/lib/platform/verify-tools.js +10 -1
  40. package/plugins/deslop-around/lib/schemas/README.md +195 -0
  41. package/plugins/deslop-around/lib/schemas/validator.js +205 -0
  42. package/plugins/deslop-around/lib/sources/custom-handler.js +199 -0
  43. package/plugins/deslop-around/lib/sources/policy-questions.js +239 -0
  44. package/plugins/deslop-around/lib/sources/source-cache.js +149 -0
  45. package/plugins/deslop-around/lib/state/workflow-state.js +382 -484
  46. package/plugins/deslop-around/lib/types/README.md +292 -0
  47. package/plugins/deslop-around/lib/types/agent-frontmatter.d.ts +134 -0
  48. package/plugins/deslop-around/lib/types/command-frontmatter.d.ts +107 -0
  49. package/plugins/deslop-around/lib/types/hook-frontmatter.d.ts +115 -0
  50. package/plugins/deslop-around/lib/types/index.d.ts +84 -0
  51. package/plugins/deslop-around/lib/types/plugin-manifest.d.ts +102 -0
  52. package/plugins/deslop-around/lib/types/skill-frontmatter.d.ts +89 -0
  53. package/plugins/deslop-around/lib/utils/cache-manager.js +154 -0
  54. package/plugins/deslop-around/lib/utils/context-optimizer.js +115 -37
  55. package/plugins/deslop-around/lib/utils/deprecation.js +37 -0
  56. package/plugins/deslop-around/lib/utils/shell-escape.js +88 -0
  57. package/plugins/next-task/.claude-plugin/plugin.json +1 -1
  58. package/plugins/next-task/agents/ci-monitor.md +19 -0
  59. package/plugins/next-task/agents/delivery-validator.md +2 -2
  60. package/plugins/next-task/agents/implementation-agent.md +3 -4
  61. package/plugins/next-task/agents/planning-agent.md +77 -19
  62. package/plugins/next-task/agents/review-orchestrator.md +21 -122
  63. package/plugins/next-task/agents/task-discoverer.md +164 -23
  64. package/plugins/next-task/commands/next-task.md +180 -14
  65. package/plugins/next-task/lib/index.js +170 -0
  66. package/plugins/next-task/lib/patterns/review-patterns.js +58 -11
  67. package/plugins/next-task/lib/patterns/slop-patterns.js +170 -129
  68. package/plugins/next-task/lib/platform/detect-platform.js +212 -123
  69. package/plugins/next-task/lib/platform/detection-configs.js +93 -0
  70. package/plugins/next-task/lib/platform/verify-tools.js +10 -1
  71. package/plugins/next-task/lib/schemas/README.md +195 -0
  72. package/plugins/next-task/lib/schemas/validator.js +205 -0
  73. package/plugins/next-task/lib/sources/custom-handler.js +199 -0
  74. package/plugins/next-task/lib/sources/policy-questions.js +239 -0
  75. package/plugins/next-task/lib/sources/source-cache.js +149 -0
  76. package/plugins/next-task/lib/state/workflow-state.js +382 -484
  77. package/plugins/next-task/lib/types/README.md +292 -0
  78. package/plugins/next-task/lib/types/agent-frontmatter.d.ts +134 -0
  79. package/plugins/next-task/lib/types/command-frontmatter.d.ts +107 -0
  80. package/plugins/next-task/lib/types/hook-frontmatter.d.ts +115 -0
  81. package/plugins/next-task/lib/types/index.d.ts +84 -0
  82. package/plugins/next-task/lib/types/plugin-manifest.d.ts +102 -0
  83. package/plugins/next-task/lib/types/skill-frontmatter.d.ts +89 -0
  84. package/plugins/next-task/lib/utils/cache-manager.js +154 -0
  85. package/plugins/next-task/lib/utils/context-optimizer.js +115 -37
  86. package/plugins/next-task/lib/utils/deprecation.js +37 -0
  87. package/plugins/next-task/lib/utils/shell-escape.js +88 -0
  88. package/plugins/project-review/.claude-plugin/plugin.json +1 -1
  89. package/plugins/project-review/lib/index.js +170 -0
  90. package/plugins/project-review/lib/patterns/review-patterns.js +58 -11
  91. package/plugins/project-review/lib/patterns/slop-patterns.js +170 -129
  92. package/plugins/project-review/lib/platform/detect-platform.js +212 -123
  93. package/plugins/project-review/lib/platform/detection-configs.js +93 -0
  94. package/plugins/project-review/lib/platform/verify-tools.js +10 -1
  95. package/plugins/project-review/lib/schemas/README.md +195 -0
  96. package/plugins/project-review/lib/schemas/validator.js +205 -0
  97. package/plugins/project-review/lib/sources/custom-handler.js +199 -0
  98. package/plugins/project-review/lib/sources/policy-questions.js +239 -0
  99. package/plugins/project-review/lib/sources/source-cache.js +149 -0
  100. package/plugins/project-review/lib/state/workflow-state.js +382 -484
  101. package/plugins/project-review/lib/types/README.md +292 -0
  102. package/plugins/project-review/lib/types/agent-frontmatter.d.ts +134 -0
  103. package/plugins/project-review/lib/types/command-frontmatter.d.ts +107 -0
  104. package/plugins/project-review/lib/types/hook-frontmatter.d.ts +115 -0
  105. package/plugins/project-review/lib/types/index.d.ts +84 -0
  106. package/plugins/project-review/lib/types/plugin-manifest.d.ts +102 -0
  107. package/plugins/project-review/lib/types/skill-frontmatter.d.ts +89 -0
  108. package/plugins/project-review/lib/utils/cache-manager.js +154 -0
  109. package/plugins/project-review/lib/utils/context-optimizer.js +115 -37
  110. package/plugins/project-review/lib/utils/deprecation.js +37 -0
  111. package/plugins/project-review/lib/utils/shell-escape.js +88 -0
  112. package/plugins/reality-check/.claude-plugin/plugin.json +1 -1
  113. package/plugins/reality-check/agents/code-explorer.md +1 -1
  114. package/plugins/ship/.claude-plugin/plugin.json +1 -1
  115. package/plugins/ship/commands/ship-ci-review-loop.md +19 -0
  116. package/plugins/ship/lib/index.js +170 -0
  117. package/plugins/ship/lib/patterns/review-patterns.js +58 -11
  118. package/plugins/ship/lib/patterns/slop-patterns.js +170 -129
  119. package/plugins/ship/lib/platform/detect-platform.js +212 -123
  120. package/plugins/ship/lib/platform/detection-configs.js +93 -0
  121. package/plugins/ship/lib/platform/verify-tools.js +10 -1
  122. package/plugins/ship/lib/schemas/README.md +195 -0
  123. package/plugins/ship/lib/schemas/validator.js +205 -0
  124. package/plugins/ship/lib/sources/custom-handler.js +199 -0
  125. package/plugins/ship/lib/sources/policy-questions.js +239 -0
  126. package/plugins/ship/lib/sources/source-cache.js +149 -0
  127. package/plugins/ship/lib/state/workflow-state.js +382 -484
  128. package/plugins/ship/lib/types/README.md +292 -0
  129. package/plugins/ship/lib/types/agent-frontmatter.d.ts +134 -0
  130. package/plugins/ship/lib/types/command-frontmatter.d.ts +107 -0
  131. package/plugins/ship/lib/types/hook-frontmatter.d.ts +115 -0
  132. package/plugins/ship/lib/types/index.d.ts +84 -0
  133. package/plugins/ship/lib/types/plugin-manifest.d.ts +102 -0
  134. package/plugins/ship/lib/types/skill-frontmatter.d.ts +89 -0
  135. package/plugins/ship/lib/utils/cache-manager.js +154 -0
  136. package/plugins/ship/lib/utils/context-optimizer.js +115 -37
  137. package/plugins/ship/lib/utils/deprecation.js +37 -0
  138. package/plugins/ship/lib/utils/shell-escape.js +88 -0
  139. package/lib/state/workflow-state.schema.json +0 -282
  140. package/plugins/deslop-around/lib/state/workflow-state.schema.json +0 -282
  141. package/plugins/next-task/agents/policy-selector.md +0 -248
  142. package/plugins/next-task/lib/state/tasks-registry.schema.json +0 -85
  143. package/plugins/next-task/lib/state/workflow-state.schema.json +0 -282
  144. package/plugins/next-task/lib/state/worktree-status.schema.json +0 -219
  145. package/plugins/project-review/lib/state/workflow-state.schema.json +0 -282
  146. package/plugins/ship/lib/state/workflow-state.schema.json +0 -282
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Deprecation Warning Utility
3
+ * Centralized utility for handling deprecation warnings across the codebase
4
+ *
5
+ * @author Avi Fenesh
6
+ * @license MIT
7
+ */
8
+
9
+ // Track which functions have already shown deprecation warnings (once per function)
10
+ const _deprecationWarned = new Set();
11
+
12
+ /**
13
+ * Show deprecation warning for sync functions (once per function name)
14
+ * @param {string} funcName - Name of the deprecated sync function
15
+ * @param {string} asyncAlt - Name of the async alternative
16
+ */
17
+ function warnDeprecation(funcName, asyncAlt) {
18
+ if (_deprecationWarned.has(funcName)) return;
19
+ _deprecationWarned.add(funcName);
20
+ console.warn(
21
+ `DEPRECATED: ${funcName}() is synchronous and blocks the event loop. ` +
22
+ `Use ${asyncAlt}() instead. Will be removed in v3.0.0.`
23
+ );
24
+ }
25
+
26
+ /**
27
+ * Reset deprecation warnings (for testing only)
28
+ * @private
29
+ */
30
+ function _resetDeprecationWarnings() {
31
+ _deprecationWarned.clear();
32
+ }
33
+
34
+ module.exports = {
35
+ warnDeprecation,
36
+ _resetDeprecationWarnings
37
+ };
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Shell Escaping Utilities
3
+ * Centralized string escaping functions for safe shell command construction
4
+ *
5
+ * @module lib/utils/shell-escape
6
+ * @author Avi Fenesh
7
+ * @license MIT
8
+ */
9
+
10
+ /**
11
+ * Escape shell special characters for safe command interpolation
12
+ * Handles all dangerous shell metacharacters including command injection vectors
13
+ * Optimized: uses single regex test instead of multiple .includes() calls
14
+ * @param {string} str - String to escape
15
+ * @returns {string} Escaped string safe for shell use
16
+ * @throws {Error} If string contains null bytes or newlines
17
+ */
18
+ function escapeShell(str) {
19
+ if (typeof str !== 'string') return '';
20
+
21
+ // Reject null bytes and newlines which could be used for injection
22
+ // Optimized: single regex test instead of 3 separate .includes() scans
23
+ // Use \x00 instead of \0 for better portability across JS engines
24
+ if (/[\x00\n\r]/.test(str)) {
25
+ throw new Error('Input contains invalid characters (null bytes or newlines)');
26
+ }
27
+
28
+ // Escape all shell metacharacters: " $ ` \ ! ; | & > < ( ) { } [ ] * ? ~ # ' space tab
29
+ return str.replace(/["\$`\\!;|&><(){}[\]*?~#'\s]/g, '\\$&');
30
+ }
31
+
32
+ /**
33
+ * Escape single quotes for shell (replace ' with '\''
34
+ * Use this for strings that will be wrapped in single quotes
35
+ * @param {string} str - String to escape
36
+ * @returns {string} Escaped string safe for single-quoted shell use
37
+ */
38
+ function escapeSingleQuotes(str) {
39
+ if (typeof str !== 'string') return '';
40
+ return str.replace(/'/g, "'\\''");
41
+ }
42
+
43
+ /**
44
+ * Validate and sanitize file extension
45
+ * Removes all non-alphanumeric characters
46
+ * @param {string} ext - Extension to validate
47
+ * @returns {string} Safe extension (alphanumeric only), defaults to 'ts' if empty
48
+ */
49
+ function sanitizeExtension(ext) {
50
+ if (typeof ext !== 'string') return 'ts';
51
+ const safe = ext.replace(/[^a-zA-Z0-9]/g, '');
52
+ return safe || 'ts';
53
+ }
54
+
55
+ /**
56
+ * Escape a string for use in a double-quoted shell context
57
+ * More permissive than escapeShell but still safe
58
+ * @param {string} str - String to escape
59
+ * @returns {string} Escaped string safe for double-quoted shell use
60
+ */
61
+ function escapeDoubleQuotes(str) {
62
+ if (typeof str !== 'string') return '';
63
+
64
+ // In double quotes, we need to escape: $ ` " \ and newlines
65
+ return str.replace(/[$`"\\\n]/g, '\\$&');
66
+ }
67
+
68
+ /**
69
+ * Quote a string for safe shell use
70
+ * Wraps in single quotes and escapes any embedded single quotes
71
+ * This is often safer than escapeShell for complex strings
72
+ * @param {string} str - String to quote
73
+ * @returns {string} Safely quoted string
74
+ */
75
+ function quoteShell(str) {
76
+ if (typeof str !== 'string') return "''";
77
+
78
+ // Wrap in single quotes and escape any embedded single quotes
79
+ return "'" + str.replace(/'/g, "'\\''") + "'";
80
+ }
81
+
82
+ module.exports = {
83
+ escapeShell,
84
+ escapeSingleQuotes,
85
+ sanitizeExtension,
86
+ escapeDoubleQuotes,
87
+ quoteShell
88
+ };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-task",
3
- "version": "2.3.1",
3
+ "version": "2.5.0",
4
4
  "description": "Master workflow orchestrator with autonomous task-to-production automation, quality gates, and multi-agent review",
5
5
  "author": {
6
6
  "name": "Avi Fenesh",
@@ -15,6 +15,25 @@ and focused on observation and coordination, not complex reasoning.
15
15
  - This agent (haiku): Poll status, detect issues, report findings
16
16
  - ci-fixer (sonnet): Diagnose and fix CI failures, address PR comments
17
17
 
18
+ ## PR Auto-Review Process
19
+
20
+ > **CRITICAL**: Every PR receives automatic reviews from **4 agents**:
21
+ > - **Copilot** - GitHub's AI reviewer
22
+ > - **Claude** - Anthropic's AI reviewer
23
+ > - **Gemini** - Google's AI reviewer
24
+ > - **Codex** - OpenAI's AI reviewer
25
+
26
+ **Mandatory workflow:**
27
+ 1. After PR creation, wait **at least 3 minutes** for first review round
28
+ 2. Read **ALL comments** from all 4 reviewers
29
+ 3. Address **EVERY comment** - no exceptions
30
+ 4. Iterate until **zero unresolved threads** (typically 2-4 rounds)
31
+
32
+ **Rules:**
33
+ - ALWAYS address all comments, including "minor" or "nit" suggestions
34
+ - NEVER skip a comment unless factually wrong or user-approved
35
+ - Treat all feedback as **required changes**, not suggestions
36
+
18
37
  ## Configuration
19
38
 
20
39
  ```javascript
@@ -43,9 +43,9 @@ NO human in the loop - either pass validation or fail and return to implementati
43
43
  ```javascript
44
44
  const workflowState = require('${CLAUDE_PLUGIN_ROOT}/lib/state/workflow-state.js');
45
45
 
46
- const state = workflowState.readState();
46
+ const state = workflowState.readFlow();
47
47
  const task = state.task;
48
- const reviewResults = state.phases.history.find(p => p.phase === 'review-loop')?.result;
48
+ const reviewResults = state.reviewResult;
49
49
  ```
50
50
 
51
51
  ## Phase 2: Validation Checks
@@ -45,14 +45,13 @@ Before implementation:
45
45
 
46
46
  ```javascript
47
47
  const workflowState = require('${CLAUDE_PLUGIN_ROOT}/lib/state/workflow-state.js');
48
- const state = workflowState.readState();
48
+ const state = workflowState.readFlow();
49
49
 
50
- const planPhase = state.phases.history.find(p => p.phase === 'planning');
51
- if (!planPhase?.result?.planApproved) {
50
+ if (!state.plan?.approved) {
52
51
  throw new Error('Plan not approved - cannot proceed with implementation');
53
52
  }
54
53
 
55
- const plan = planPhase.result.plan;
54
+ const plan = state.plan;
56
55
  console.log(`Implementing: ${plan.title}`);
57
56
  console.log(`Steps: ${plan.steps.length}`);
58
57
  ```
@@ -1,12 +1,26 @@
1
1
  ---
2
2
  name: planning-agent
3
- description: Design detailed implementation plans for tasks. Use this agent after exploration to create a comprehensive, step-by-step plan for user approval.
4
- tools: Read, Glob, Grep, Bash(git:*), Task, EnterPlanMode
3
+ description: Design detailed implementation plans for tasks. Create comprehensive step-by-step plans and output as structured JSON. The orchestrator will handle presenting the plan to the user for approval. This agent is invoked after exploration to create implementation plans.
4
+ tools: Read, Glob, Grep, Bash(git:*), Task
5
5
  model: opus
6
6
  ---
7
7
 
8
8
  # Planning Agent
9
9
 
10
+ **YOUR ROLE**: Create a detailed implementation plan and return it as structured output.
11
+
12
+ **NOT YOUR ROLE**: Entering plan mode or getting user approval. The orchestrator handles that.
13
+
14
+ **Flow**:
15
+ 1. You create the plan
16
+ 2. You output the plan as structured JSON at the end
17
+ 3. You return (agent completes)
18
+ 4. Orchestrator receives your plan
19
+ 5. Orchestrator enters plan mode and presents it to user
20
+ 6. User approves/rejects via the orchestrator
21
+
22
+ **Output Format**: JSON structure that is context-efficient and easy to parse.
23
+
10
24
  You create detailed, well-reasoned implementation plans for tasks.
11
25
  This requires deep understanding of the codebase and careful architectural thinking.
12
26
 
@@ -21,10 +35,10 @@ Before planning, you should have:
21
35
 
22
36
  ```javascript
23
37
  const workflowState = require('${CLAUDE_PLUGIN_ROOT}/lib/state/workflow-state.js');
24
- const state = workflowState.readState();
38
+ const state = workflowState.readFlow();
25
39
 
26
40
  const task = state.task;
27
- const explorationResults = state.phases.history.find(p => p.phase === 'exploration')?.result;
41
+ const explorationResults = state.exploration;
28
42
 
29
43
  console.log(`Planning for: #${task.id} - ${task.title}`);
30
44
  console.log(`Key files identified: ${explorationResults?.keyFiles?.join(', ')}`);
@@ -161,29 +175,73 @@ Provide honest assessment:
161
175
  **Reasoning**: [Why this confidence level]
162
176
  ```
163
177
 
164
- ## Phase 7: Enter Plan Mode
178
+ ## Phase 7: Output Structured Plan
165
179
 
166
- Use EnterPlanMode to get user approval:
180
+ **CRITICAL**: Output your plan as JSON for the orchestrator to parse.
167
181
 
168
182
  ```javascript
169
- // Enter plan mode for formal approval
170
- EnterPlanMode();
171
-
172
- // Write plan to plan file
173
- // Wait for user approval via ExitPlanMode
183
+ const plan = {
184
+ task: {
185
+ id: task.id,
186
+ title: task.title
187
+ },
188
+ overview: "2-3 sentence summary of the approach",
189
+ architecture: "Why this approach over alternatives",
190
+ steps: [
191
+ {
192
+ title: "First logical unit of work",
193
+ goal: "What this step achieves",
194
+ files: [
195
+ { path: "path/to/file.ts", changes: "What changes" }
196
+ ],
197
+ details: [
198
+ "Specific change 1",
199
+ "Specific change 2"
200
+ ],
201
+ risks: ["What could go wrong"]
202
+ },
203
+ {
204
+ title: "Add Tests",
205
+ goal: "Ensure code quality",
206
+ files: [
207
+ { path: "tests/feature.test.ts", changes: "Unit tests" }
208
+ ],
209
+ details: [
210
+ "Happy path test",
211
+ "Edge case test",
212
+ "Error handling test"
213
+ ]
214
+ }
215
+ ],
216
+ critical: {
217
+ highRisk: ["File/function - Why it's risky"],
218
+ needsReview: ["Area - Why"],
219
+ performance: ["If applicable"],
220
+ security: ["If applicable"]
221
+ },
222
+ complexity: {
223
+ overall: "Low|Medium|High",
224
+ confidence: "High|Medium|Low",
225
+ reasoning: "Why this confidence level"
226
+ }
227
+ };
228
+
229
+ // Output as JSON for orchestrator
230
+ console.log("\n=== PLAN_START ===");
231
+ console.log(JSON.stringify(plan, null, 2));
232
+ console.log("=== PLAN_END ===\n");
174
233
  ```
175
234
 
176
- ## Phase 8: Update State
235
+ ## Phase 8: Complete
177
236
 
178
- After approval:
237
+ Mark completion:
179
238
 
180
239
  ```javascript
181
- workflowState.completePhase({
182
- planApproved: true,
183
- stepsCount: plan.steps.length,
184
- estimatedComplexity: plan.complexity,
185
- criticalPaths: plan.criticalPaths
186
- });
240
+ console.log(`✓ Plan created with ${plan.steps.length} steps`);
241
+ console.log(`✓ Complexity: ${plan.complexity.overall}`);
242
+ console.log(`✓ Returning to orchestrator for user approval`);
243
+
244
+ // Agent completes here - orchestrator will parse the JSON output
187
245
  ```
188
246
 
189
247
  ## Output Format
@@ -13,75 +13,10 @@ and iterate until all critical and high-severity issues are resolved.
13
13
  ## Configuration
14
14
 
15
15
  ```javascript
16
- const MAX_ITERATIONS = 3; // From policy.maxReviewIterations
16
+ // No max iterations - review until approved
17
17
  const workflowState = require('${CLAUDE_PLUGIN_ROOT}/lib/state/workflow-state.js');
18
18
  ```
19
19
 
20
- ## ⚠️ MANDATORY STATE UPDATES
21
-
22
- ```
23
- ╔══════════════════════════════════════════════════════════════════════════╗
24
- ║ YOU MUST UPDATE STATE AFTER EACH ITERATION ║
25
- ╠══════════════════════════════════════════════════════════════════════════╣
26
- ║ ║
27
- ║ After EACH review iteration, update: ║
28
- ║ ║
29
- ║ 1. .claude/workflow-status.json (in worktree): ║
30
- ║ - Current iteration number ║
31
- ║ - Issues found/fixed counts ║
32
- ║ - lastActivityAt timestamp ║
33
- ║ ║
34
- ║ 2. .claude/tasks.json (in main repo): ║
35
- ║ - lastActivityAt timestamp ║
36
- ║ - currentStep: 'review-iteration-N' ║
37
- ║ ║
38
- ║ FAILURE TO UPDATE = RESUME WILL FAIL ║
39
- ║ ║
40
- ╚══════════════════════════════════════════════════════════════════════════╝
41
- ```
42
-
43
- ### State Update After Each Iteration
44
-
45
- ```javascript
46
- function updateStateAfterIteration(iteration, findings) {
47
- const fs = require('fs');
48
-
49
- // 1. Update worktree status
50
- const statusPath = '.claude/workflow-status.json';
51
- const status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
52
-
53
- status.steps.push({
54
- step: `review-iteration-${iteration}`,
55
- status: 'completed',
56
- completedAt: new Date().toISOString(),
57
- result: {
58
- issuesFound: findings.totals.critical + findings.totals.high,
59
- issuesFixed: findings.issuesFixed || 0
60
- }
61
- });
62
-
63
- status.workflow.lastActivityAt = new Date().toISOString();
64
- status.agents.reviewIterations = iteration;
65
- status.agents.issuesFound = (status.agents.issuesFound || 0) + findings.totals.critical + findings.totals.high;
66
-
67
- fs.writeFileSync(statusPath, JSON.stringify(status, null, 2));
68
- console.log(`✓ Updated workflow-status.json: review-iteration-${iteration}`);
69
-
70
- // 2. Update main repo tasks.json
71
- if (status.git?.mainRepoPath) {
72
- const mainTasksPath = status.git.mainRepoPath + '/.claude/tasks.json';
73
- if (fs.existsSync(mainTasksPath)) {
74
- const registry = JSON.parse(fs.readFileSync(mainTasksPath, 'utf8'));
75
- const idx = registry.tasks.findIndex(t => t.id === status.task.id);
76
- if (idx >= 0) {
77
- registry.tasks[idx].lastActivityAt = new Date().toISOString();
78
- registry.tasks[idx].currentStep = `review-iteration-${iteration}`;
79
- fs.writeFileSync(mainTasksPath, JSON.stringify(registry, null, 2));
80
- }
81
- }
82
- }
83
- }
84
- ```
85
20
 
86
21
  ## Phase 1: Get Changed Files
87
22
 
@@ -100,10 +35,7 @@ git diff --stat HEAD~1..HEAD 2>/dev/null || git diff --stat
100
35
  ## Phase 2: Start Review Phase
101
36
 
102
37
  ```javascript
103
- workflowState.startPhase('review-loop');
104
- workflowState.updateState({
105
- phases: { currentIteration: 0 }
106
- });
38
+ workflowState.setPhase('review-loop');
107
39
  ```
108
40
 
109
41
  ## Phase 3: Launch Review Agents (Parallel)
@@ -224,35 +156,10 @@ function aggregateFindings(results) {
224
156
  const findings = aggregateFindings(results);
225
157
  ```
226
158
 
227
- ## Phase 5: Update Agent Results in State
159
+ ## Phase 5: Log Results
228
160
 
229
161
  ```javascript
230
- workflowState.updateState({
231
- agents: {
232
- lastRun: {
233
- codeReviewer: {
234
- status: 'completed',
235
- issues: results[0].summary?.total || 0,
236
- critical: results[0].summary?.critical || 0,
237
- high: results[0].summary?.high || 0
238
- },
239
- silentFailureHunter: {
240
- status: 'completed',
241
- issues: results[1].summary?.total || 0,
242
- critical: results[1].summary?.critical || 0,
243
- high: results[1].summary?.high || 0
244
- },
245
- testAnalyzer: {
246
- status: 'completed',
247
- issues: results[2].summary?.total || 0,
248
- critical: results[2].summary?.critical || 0,
249
- high: results[2].summary?.high || 0
250
- }
251
- },
252
- totalIssuesFound: findings.totals.critical + findings.totals.high +
253
- findings.totals.medium + findings.totals.low
254
- }
255
- });
162
+ console.log(`Found: ${findings.totals.critical} critical, ${findings.totals.high} high, ${findings.totals.medium} medium, ${findings.totals.low} low`);
256
163
  ```
257
164
 
258
165
  ## Phase 6: Report Findings
@@ -275,13 +182,14 @@ ${criticalIssues.map(i => `- **${i.file}:${i.line}** - ${i.description}`).join('
275
182
  ${highIssues.map(i => `- **${i.file}:${i.line}** - ${i.description}`).join('\n')}
276
183
  ```
277
184
 
278
- ## Phase 7: Iteration Loop
185
+ ## Phase 7: Iteration Loop (Until Approved)
279
186
 
280
187
  ```javascript
281
188
  let iteration = 1;
282
189
 
283
- while (iteration <= MAX_ITERATIONS && findings.needsIteration) {
284
- console.log(`\n## Review Iteration ${iteration}/${MAX_ITERATIONS}`);
190
+ // Loop until all critical/high issues are resolved - no arbitrary limit
191
+ while (findings.needsIteration) {
192
+ console.log(`\n## Review Iteration ${iteration}`);
285
193
  console.log(`Fixing ${findings.totals.critical} critical and ${findings.totals.high} high issues...`);
286
194
 
287
195
  // Fix critical issues first
@@ -322,10 +230,8 @@ Do NOT auto-fix - just report for the next iteration.`
322
230
  });
323
231
  // =========================================================
324
232
 
325
- // Increment iteration in state
326
- workflowState.incrementIteration({
327
- fixed: findings.totals.critical + findings.totals.high
328
- });
233
+ // Log iteration progress
234
+ console.log(`Iteration ${iteration} complete. Fixed ${findings.totals.critical + findings.totals.high} issues.`);
329
235
 
330
236
  // Re-run review agents on changed files
331
237
  const changedInIteration = await exec('git diff --name-only HEAD~1');
@@ -339,30 +245,23 @@ Do NOT auto-fix - just report for the next iteration.`
339
245
  ## Phase 8: Final Status
340
246
 
341
247
  ```javascript
342
- if (findings.totals.critical === 0 && findings.totals.high === 0) {
343
- console.log("\n## ✓ Review Approved");
344
- console.log("All critical and high-priority issues resolved.");
345
- console.log(`Medium: ${findings.totals.medium}, Low: ${findings.totals.low} (noted in PR)`);
346
-
347
- workflowState.completePhase({
248
+ // When we exit the loop, all critical/high issues are resolved
249
+ console.log("\n## ✓ Review Approved");
250
+ console.log("All critical and high-priority issues resolved.");
251
+ console.log(`Medium: ${findings.totals.medium}, Low: ${findings.totals.low} (noted in PR)`);
252
+ console.log(`Completed after ${iteration - 1} iteration(s).`);
253
+
254
+ // Update flow with review result
255
+ workflowState.updateFlow({
256
+ reviewResult: {
348
257
  approved: true,
349
258
  iterations: iteration - 1,
350
259
  remainingIssues: {
351
260
  medium: findings.totals.medium,
352
261
  low: findings.totals.low
353
262
  }
354
- });
355
- } else {
356
- console.log("\n## ✗ Review Failed");
357
- console.log(`Unable to resolve all issues after ${MAX_ITERATIONS} iterations.`);
358
- console.log(`Remaining: ${findings.totals.critical} critical, ${findings.totals.high} high`);
359
-
360
- workflowState.failPhase("Review iteration limit reached", {
361
- remainingCritical: findings.totals.critical,
362
- remainingHigh: findings.totals.high,
363
- iterations: iteration - 1
364
- });
365
- }
263
+ }
264
+ });
366
265
  ```
367
266
 
368
267
  ## Fix Issue Helper