awesome-slash 2.4.4 → 2.5.1
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.
- package/.claude-plugin/marketplace.json +6 -6
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +123 -1
- package/README.md +186 -159
- package/SECURITY.md +25 -81
- package/adapters/codex/install.sh +58 -16
- package/adapters/opencode/install.sh +92 -23
- package/lib/index.js +47 -4
- package/lib/patterns/review-patterns.js +58 -11
- package/lib/patterns/slop-patterns.js +154 -147
- package/lib/platform/detect-platform.js +99 -350
- package/lib/platform/detection-configs.js +93 -0
- package/lib/platform/state-dir.js +122 -0
- package/lib/platform/verify-tools.js +10 -78
- package/lib/schemas/README.md +195 -0
- package/lib/schemas/validator.js +247 -0
- package/lib/sources/custom-handler.js +199 -0
- package/lib/sources/policy-questions.js +239 -0
- package/lib/sources/source-cache.js +164 -0
- package/lib/state/workflow-state.js +368 -665
- package/lib/types/README.md +292 -0
- package/lib/types/agent-frontmatter.d.ts +134 -0
- package/lib/types/command-frontmatter.d.ts +107 -0
- package/lib/types/hook-frontmatter.d.ts +115 -0
- package/lib/types/index.d.ts +84 -0
- package/lib/types/plugin-manifest.d.ts +102 -0
- package/lib/types/skill-frontmatter.d.ts +89 -0
- package/lib/utils/cache-manager.js +154 -0
- package/lib/utils/context-optimizer.js +5 -36
- package/lib/utils/deprecation.js +37 -0
- package/lib/utils/shell-escape.js +88 -0
- package/mcp-server/index.js +513 -22
- package/package.json +6 -2
- package/plugins/deslop-around/.claude-plugin/plugin.json +1 -1
- package/plugins/deslop-around/lib/index.js +170 -0
- package/plugins/deslop-around/lib/patterns/review-patterns.js +58 -11
- package/plugins/deslop-around/lib/patterns/slop-patterns.js +169 -129
- package/plugins/deslop-around/lib/platform/detect-platform.js +162 -316
- package/plugins/deslop-around/lib/platform/detection-configs.js +93 -0
- package/plugins/deslop-around/lib/platform/state-dir.js +122 -0
- package/plugins/deslop-around/lib/platform/verify-tools.js +10 -78
- package/plugins/deslop-around/lib/schemas/README.md +195 -0
- package/plugins/deslop-around/lib/schemas/validator.js +247 -0
- package/plugins/deslop-around/lib/sources/custom-handler.js +199 -0
- package/plugins/deslop-around/lib/sources/policy-questions.js +239 -0
- package/plugins/deslop-around/lib/sources/source-cache.js +164 -0
- package/plugins/deslop-around/lib/state/workflow-state.js +387 -484
- package/plugins/deslop-around/lib/types/README.md +292 -0
- package/plugins/deslop-around/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/deslop-around/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/deslop-around/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/deslop-around/lib/types/index.d.ts +84 -0
- package/plugins/deslop-around/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/deslop-around/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/deslop-around/lib/utils/cache-manager.js +154 -0
- package/plugins/deslop-around/lib/utils/context-optimizer.js +115 -37
- package/plugins/deslop-around/lib/utils/deprecation.js +37 -0
- package/plugins/deslop-around/lib/utils/shell-escape.js +88 -0
- package/plugins/next-task/.claude-plugin/plugin.json +1 -1
- package/plugins/next-task/agents/delivery-validator.md +2 -2
- package/plugins/next-task/agents/implementation-agent.md +3 -4
- package/plugins/next-task/agents/planning-agent.md +77 -19
- package/plugins/next-task/agents/review-orchestrator.md +21 -122
- package/plugins/next-task/agents/task-discoverer.md +164 -23
- package/plugins/next-task/commands/next-task.md +180 -14
- package/plugins/next-task/lib/index.js +170 -0
- package/plugins/next-task/lib/patterns/review-patterns.js +58 -11
- package/plugins/next-task/lib/patterns/slop-patterns.js +169 -129
- package/plugins/next-task/lib/platform/detect-platform.js +162 -316
- package/plugins/next-task/lib/platform/detection-configs.js +93 -0
- package/plugins/next-task/lib/platform/state-dir.js +122 -0
- package/plugins/next-task/lib/platform/verify-tools.js +10 -78
- package/plugins/next-task/lib/schemas/README.md +195 -0
- package/plugins/next-task/lib/schemas/validator.js +247 -0
- package/plugins/next-task/lib/sources/custom-handler.js +199 -0
- package/plugins/next-task/lib/sources/policy-questions.js +239 -0
- package/plugins/next-task/lib/sources/source-cache.js +164 -0
- package/plugins/next-task/lib/state/workflow-state.js +387 -484
- package/plugins/next-task/lib/types/README.md +292 -0
- package/plugins/next-task/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/next-task/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/next-task/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/next-task/lib/types/index.d.ts +84 -0
- package/plugins/next-task/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/next-task/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/next-task/lib/utils/cache-manager.js +154 -0
- package/plugins/next-task/lib/utils/context-optimizer.js +115 -37
- package/plugins/next-task/lib/utils/deprecation.js +37 -0
- package/plugins/next-task/lib/utils/shell-escape.js +88 -0
- package/plugins/project-review/.claude-plugin/plugin.json +1 -1
- package/plugins/project-review/lib/index.js +170 -0
- package/plugins/project-review/lib/patterns/review-patterns.js +58 -11
- package/plugins/project-review/lib/patterns/slop-patterns.js +169 -129
- package/plugins/project-review/lib/platform/detect-platform.js +162 -316
- package/plugins/project-review/lib/platform/detection-configs.js +93 -0
- package/plugins/project-review/lib/platform/state-dir.js +122 -0
- package/plugins/project-review/lib/platform/verify-tools.js +10 -78
- package/plugins/project-review/lib/schemas/README.md +195 -0
- package/plugins/project-review/lib/schemas/validator.js +247 -0
- package/plugins/project-review/lib/sources/custom-handler.js +199 -0
- package/plugins/project-review/lib/sources/policy-questions.js +239 -0
- package/plugins/project-review/lib/sources/source-cache.js +164 -0
- package/plugins/project-review/lib/state/workflow-state.js +387 -484
- package/plugins/project-review/lib/types/README.md +292 -0
- package/plugins/project-review/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/project-review/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/project-review/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/project-review/lib/types/index.d.ts +84 -0
- package/plugins/project-review/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/project-review/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/project-review/lib/utils/cache-manager.js +154 -0
- package/plugins/project-review/lib/utils/context-optimizer.js +115 -37
- package/plugins/project-review/lib/utils/deprecation.js +37 -0
- package/plugins/project-review/lib/utils/shell-escape.js +88 -0
- package/plugins/reality-check/.claude-plugin/plugin.json +1 -1
- package/plugins/reality-check/agents/code-explorer.md +1 -1
- package/plugins/ship/.claude-plugin/plugin.json +1 -1
- package/plugins/ship/lib/index.js +170 -0
- package/plugins/ship/lib/patterns/review-patterns.js +58 -11
- package/plugins/ship/lib/patterns/slop-patterns.js +169 -129
- package/plugins/ship/lib/platform/detect-platform.js +162 -316
- package/plugins/ship/lib/platform/detection-configs.js +93 -0
- package/plugins/ship/lib/platform/state-dir.js +122 -0
- package/plugins/ship/lib/platform/verify-tools.js +10 -78
- package/plugins/ship/lib/schemas/README.md +195 -0
- package/plugins/ship/lib/schemas/validator.js +247 -0
- package/plugins/ship/lib/sources/custom-handler.js +199 -0
- package/plugins/ship/lib/sources/policy-questions.js +239 -0
- package/plugins/ship/lib/sources/source-cache.js +164 -0
- package/plugins/ship/lib/state/workflow-state.js +387 -484
- package/plugins/ship/lib/types/README.md +292 -0
- package/plugins/ship/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/ship/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/ship/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/ship/lib/types/index.d.ts +84 -0
- package/plugins/ship/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/ship/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/ship/lib/utils/cache-manager.js +154 -0
- package/plugins/ship/lib/utils/context-optimizer.js +115 -37
- package/plugins/ship/lib/utils/deprecation.js +37 -0
- package/plugins/ship/lib/utils/shell-escape.js +88 -0
- package/scripts/install/codex.sh +216 -72
- package/scripts/install/opencode.sh +197 -21
- package/lib/state/workflow-state.schema.json +0 -282
- package/plugins/deslop-around/lib/state/workflow-state.schema.json +0 -282
- package/plugins/next-task/agents/policy-selector.md +0 -248
- package/plugins/next-task/lib/state/tasks-registry.schema.json +0 -85
- package/plugins/next-task/lib/state/workflow-state.schema.json +0 -282
- package/plugins/next-task/lib/state/worktree-status.schema.json +0 -219
- package/plugins/project-review/lib/state/workflow-state.schema.json +0 -282
- 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
|
+
};
|
|
@@ -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.
|
|
46
|
+
const state = workflowState.readFlow();
|
|
47
47
|
const task = state.task;
|
|
48
|
-
const reviewResults = state.
|
|
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.
|
|
48
|
+
const state = workflowState.readFlow();
|
|
49
49
|
|
|
50
|
-
|
|
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 =
|
|
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.
|
|
4
|
-
tools: Read, Glob, Grep, Bash(git:*), Task
|
|
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.
|
|
38
|
+
const state = workflowState.readFlow();
|
|
25
39
|
|
|
26
40
|
const task = state.task;
|
|
27
|
-
const explorationResults = state.
|
|
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:
|
|
178
|
+
## Phase 7: Output Structured Plan
|
|
165
179
|
|
|
166
|
-
|
|
180
|
+
**CRITICAL**: Output your plan as JSON for the orchestrator to parse.
|
|
167
181
|
|
|
168
182
|
```javascript
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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:
|
|
235
|
+
## Phase 8: Complete
|
|
177
236
|
|
|
178
|
-
|
|
237
|
+
Mark completion:
|
|
179
238
|
|
|
180
239
|
```javascript
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
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.
|
|
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:
|
|
159
|
+
## Phase 5: Log Results
|
|
228
160
|
|
|
229
161
|
```javascript
|
|
230
|
-
|
|
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
|
-
|
|
284
|
-
|
|
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
|
-
//
|
|
326
|
-
|
|
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
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
}
|
|
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
|