agentsys 5.3.0 → 5.3.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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor/commands/audit-project-agents.md +454 -0
- package/.cursor/commands/audit-project-github.md +141 -0
- package/.cursor/commands/audit-project.md +330 -0
- package/.cursor/commands/consult.md +417 -0
- package/.cursor/commands/debate.md +381 -0
- package/.cursor/commands/delivery-approval.md +334 -0
- package/.cursor/commands/deslop.md +142 -0
- package/.cursor/commands/drift-detect.md +259 -0
- package/.cursor/commands/enhance.md +172 -0
- package/.cursor/commands/learn.md +165 -0
- package/.cursor/commands/next-task.md +519 -0
- package/.cursor/commands/perf.md +464 -0
- package/.cursor/commands/repo-map.md +124 -0
- package/.cursor/commands/ship-ci-review-loop.md +468 -0
- package/.cursor/commands/ship-deployment.md +348 -0
- package/.cursor/commands/ship-error-handling.md +265 -0
- package/.cursor/commands/ship.md +517 -0
- package/.cursor/commands/sync-docs.md +171 -0
- package/.cursor/commands/web-ctl.md +101 -0
- package/.cursor/skills/consult/SKILL.md +425 -0
- package/.cursor/skills/debate/SKILL.md +316 -0
- package/.cursor/skills/deslop/SKILL.md +204 -0
- package/.cursor/skills/discover-tasks/SKILL.md +297 -0
- package/.cursor/skills/drift-analysis/SKILL.md +324 -0
- package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
- package/.cursor/skills/enhance-docs/SKILL.md +298 -0
- package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
- package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
- package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
- package/.cursor/skills/enhance-skills/SKILL.md +436 -0
- package/.cursor/skills/learn/SKILL.md +349 -0
- package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
- package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
- package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
- package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
- package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.cursor/skills/perf-profiler/SKILL.md +42 -0
- package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
- package/.cursor/skills/repo-mapping/SKILL.md +83 -0
- package/.cursor/skills/sync-docs/SKILL.md +351 -0
- package/.cursor/skills/validate-delivery/SKILL.md +186 -0
- package/.cursor/skills/web-auth/SKILL.md +177 -0
- package/.cursor/skills/web-browse/SKILL.md +516 -0
- package/.kiro/agents/agent-enhancer.json +12 -0
- package/.kiro/agents/ci-fixer.json +13 -0
- package/.kiro/agents/ci-monitor.json +12 -0
- package/.kiro/agents/claudemd-enhancer.json +12 -0
- package/.kiro/agents/consult-agent.json +13 -0
- package/.kiro/agents/cross-file-enhancer.json +12 -0
- package/.kiro/agents/debate-orchestrator.json +13 -0
- package/.kiro/agents/delivery-validator.json +12 -0
- package/.kiro/agents/deslop-agent.json +12 -0
- package/.kiro/agents/docs-enhancer.json +12 -0
- package/.kiro/agents/exploration-agent.json +12 -0
- package/.kiro/agents/hooks-enhancer.json +11 -0
- package/.kiro/agents/implementation-agent.json +13 -0
- package/.kiro/agents/learn-agent.json +12 -0
- package/.kiro/agents/map-validator.json +11 -0
- package/.kiro/agents/perf-analyzer.json +12 -0
- package/.kiro/agents/perf-code-paths.json +11 -0
- package/.kiro/agents/perf-investigation-logger.json +12 -0
- package/.kiro/agents/perf-orchestrator.json +13 -0
- package/.kiro/agents/perf-theory-gatherer.json +12 -0
- package/.kiro/agents/perf-theory-tester.json +13 -0
- package/.kiro/agents/plan-synthesizer.json +12 -0
- package/.kiro/agents/planning-agent.json +12 -0
- package/.kiro/agents/plugin-enhancer.json +12 -0
- package/.kiro/agents/prompt-enhancer.json +12 -0
- package/.kiro/agents/reviewer-perf-test.json +11 -0
- package/.kiro/agents/reviewer-quality-security.json +11 -0
- package/.kiro/agents/simple-fixer.json +13 -0
- package/.kiro/agents/skills-enhancer.json +11 -0
- package/.kiro/agents/sync-docs-agent.json +13 -0
- package/.kiro/agents/task-discoverer.json +12 -0
- package/.kiro/agents/test-coverage-checker.json +12 -0
- package/.kiro/agents/web-session.json +12 -0
- package/.kiro/agents/worktree-manager.json +13 -0
- package/.kiro/skills/consult/SKILL.md +425 -0
- package/.kiro/skills/debate/SKILL.md +316 -0
- package/.kiro/skills/deslop/SKILL.md +204 -0
- package/.kiro/skills/discover-tasks/SKILL.md +297 -0
- package/.kiro/skills/drift-analysis/SKILL.md +324 -0
- package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
- package/.kiro/skills/enhance-docs/SKILL.md +298 -0
- package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
- package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
- package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
- package/.kiro/skills/enhance-skills/SKILL.md +436 -0
- package/.kiro/skills/learn/SKILL.md +349 -0
- package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
- package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
- package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
- package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
- package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.kiro/skills/perf-profiler/SKILL.md +42 -0
- package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
- package/.kiro/skills/repo-mapping/SKILL.md +83 -0
- package/.kiro/skills/sync-docs/SKILL.md +351 -0
- package/.kiro/skills/validate-delivery/SKILL.md +186 -0
- package/.kiro/skills/web-auth/SKILL.md +177 -0
- package/.kiro/skills/web-browse/SKILL.md +516 -0
- package/.kiro/steering/audit-project-agents.md +459 -0
- package/.kiro/steering/audit-project-github.md +146 -0
- package/.kiro/steering/audit-project.md +330 -0
- package/.kiro/steering/consult.md +422 -0
- package/.kiro/steering/debate.md +386 -0
- package/.kiro/steering/delivery-approval.md +339 -0
- package/.kiro/steering/deslop.md +149 -0
- package/.kiro/steering/drift-detect.md +264 -0
- package/.kiro/steering/enhance.md +177 -0
- package/.kiro/steering/learn.md +166 -0
- package/.kiro/steering/next-task.md +481 -0
- package/.kiro/steering/perf.md +469 -0
- package/.kiro/steering/repo-map.md +126 -0
- package/.kiro/steering/ship-ci-review-loop.md +473 -0
- package/.kiro/steering/ship-deployment.md +353 -0
- package/.kiro/steering/ship-error-handling.md +270 -0
- package/.kiro/steering/ship.md +522 -0
- package/.kiro/steering/sync-docs.md +178 -0
- package/.kiro/steering/web-ctl.md +106 -0
- package/CHANGELOG.md +6 -0
- package/lib/adapter-transforms.js +28 -0
- package/package.json +1 -1
- package/site/content.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentsys",
|
|
3
3
|
"description": "14 specialized plugins for AI workflow automation - task orchestration, PR workflow, slop detection, code review, drift detection, enhancement analysis, documentation sync, repo mapping, perf investigations, topic research, agent config linting, cross-tool AI consultation, and structured AI debate",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.1",
|
|
5
5
|
"owner": {
|
|
6
6
|
"name": "Avi Fenesh",
|
|
7
7
|
"url": "https://github.com/avifenesh"
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
|
|
2
|
+
# Phase 2: Multi-Agent Review - Reference
|
|
3
|
+
|
|
4
|
+
This file contains detailed agent coordination for `/audit-project`.
|
|
5
|
+
|
|
6
|
+
**Parent document**: `audit-project.md`
|
|
7
|
+
|
|
8
|
+
**Review Pass Definitions**: See `orchestrate-review` skill for canonical pass definitions (core + conditional). This command uses the same review passes but detects signals from project structure (not just changed files).
|
|
9
|
+
|
|
10
|
+
## Agent Specialization
|
|
11
|
+
|
|
12
|
+
### File Filtering by Agent
|
|
13
|
+
|
|
14
|
+
Each agent reviews only relevant files:
|
|
15
|
+
|
|
16
|
+
| Agent | File Patterns |
|
|
17
|
+
|-------|--------------|
|
|
18
|
+
| code-quality-reviewer | All source files (includes error handling) |
|
|
19
|
+
| security-expert | Auth, validation, API endpoints, config |
|
|
20
|
+
| performance-engineer | Hot paths, algorithms, loops, queries |
|
|
21
|
+
| test-quality-guardian | Test files + missing-test signals |
|
|
22
|
+
| architecture-reviewer | Cross-module boundaries, core packages |
|
|
23
|
+
| database-specialist | Models, queries, migrations |
|
|
24
|
+
| api-designer | API routes, controllers, handlers |
|
|
25
|
+
| frontend-specialist | Components, state management |
|
|
26
|
+
| backend-specialist | Services, domain logic, queues |
|
|
27
|
+
| devops-reviewer | CI/CD configs, Dockerfiles |
|
|
28
|
+
|
|
29
|
+
## Review Queue File
|
|
30
|
+
|
|
31
|
+
Create a temporary review queue file in the platform state dir. Review passes append JSONL or return JSON for the parent to write.
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const pluginRoot = getPluginRoot('audit-project');
|
|
38
|
+
if (!pluginRoot) { console.error('Error: Could not locate audit-project plugin root'); process.exit(1); }
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const stateDirPath = getStateDirPath(process.cwd());
|
|
42
|
+
if (!fs.existsSync(stateDirPath)) {
|
|
43
|
+
fs.mkdirSync(stateDirPath, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function findLatestQueue(dirPath) {
|
|
47
|
+
const files = fs.readdirSync(dirPath)
|
|
48
|
+
.filter(name => name.startsWith('review-queue-') && name.endsWith('.json'))
|
|
49
|
+
.map(name => ({
|
|
50
|
+
name,
|
|
51
|
+
fullPath: path.join(dirPath, name),
|
|
52
|
+
mtime: fs.statSync(path.join(dirPath, name)).mtimeMs
|
|
53
|
+
}))
|
|
54
|
+
.sort((a, b) => b.mtime - a.mtime);
|
|
55
|
+
return files[0]?.fullPath || null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function safeReadJson(filePath) {
|
|
59
|
+
try {
|
|
60
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.warn(`Review queue unreadable: ${filePath}. Starting fresh.`);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const resumeRequested = typeof RESUME_MODE !== 'undefined' && RESUME_MODE === 'true';
|
|
68
|
+
let reviewQueuePath = resumeRequested ? findLatestQueue(stateDirPath) : null;
|
|
69
|
+
|
|
70
|
+
if (!reviewQueuePath) {
|
|
71
|
+
reviewQueuePath = path.join(stateDirPath, `review-queue-${Date.now()}.json`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!fs.existsSync(reviewQueuePath)) {
|
|
75
|
+
const reviewQueue = {
|
|
76
|
+
status: 'open',
|
|
77
|
+
scope: { type: 'audit', value: SCOPE },
|
|
78
|
+
passes: [],
|
|
79
|
+
items: [],
|
|
80
|
+
iteration: 0,
|
|
81
|
+
updatedAt: new Date().toISOString()
|
|
82
|
+
};
|
|
83
|
+
fs.writeFileSync(reviewQueuePath, JSON.stringify(reviewQueue, null, 2), 'utf8');
|
|
84
|
+
} else if (resumeRequested) {
|
|
85
|
+
const reviewQueue = safeReadJson(reviewQueuePath) || {
|
|
86
|
+
status: 'open',
|
|
87
|
+
scope: { type: 'audit', value: SCOPE },
|
|
88
|
+
passes: [],
|
|
89
|
+
items: [],
|
|
90
|
+
iteration: 0,
|
|
91
|
+
updatedAt: new Date().toISOString()
|
|
92
|
+
};
|
|
93
|
+
reviewQueue.status = 'open';
|
|
94
|
+
reviewQueue.resumedAt = new Date().toISOString();
|
|
95
|
+
reviewQueue.updatedAt = new Date().toISOString();
|
|
96
|
+
fs.writeFileSync(reviewQueuePath, JSON.stringify(reviewQueue, null, 2), 'utf8');
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Agent Coordination
|
|
101
|
+
|
|
102
|
+
Use Task tool to launch agents in parallel:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const agents = [];
|
|
106
|
+
|
|
107
|
+
const baseReviewPrompt = (passId, role, focus) => `Role: ${role}.
|
|
108
|
+
|
|
109
|
+
Scope: ${SCOPE}
|
|
110
|
+
Framework: ${FRAMEWORK}
|
|
111
|
+
|
|
112
|
+
Focus on:
|
|
113
|
+
${focus.map(item => `- ${item}`).join('\n')}
|
|
114
|
+
|
|
115
|
+
Write findings to ${reviewQueuePath} (append JSONL if possible). If you cannot write files, return JSON only.
|
|
116
|
+
|
|
117
|
+
Return JSON ONLY in this format:
|
|
118
|
+
{
|
|
119
|
+
"pass": "${passId}",
|
|
120
|
+
"findings": [
|
|
121
|
+
{
|
|
122
|
+
"file": "path/to/file.ts",
|
|
123
|
+
"line": 42,
|
|
124
|
+
"severity": "critical|high|medium|low",
|
|
125
|
+
"category": "${passId}",
|
|
126
|
+
"description": "Issue description",
|
|
127
|
+
"suggestion": "How to fix",
|
|
128
|
+
"confidence": "high|medium|low",
|
|
129
|
+
"falsePositive": false
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}`;
|
|
133
|
+
|
|
134
|
+
// Always active agents
|
|
135
|
+
agents.push(Task({
|
|
136
|
+
subagent_type: "review",
|
|
137
|
+
prompt: baseReviewPrompt('code-quality', 'code quality reviewer', [
|
|
138
|
+
'Code style and consistency',
|
|
139
|
+
'Best practices violations',
|
|
140
|
+
'Potential bugs and logic errors',
|
|
141
|
+
'Error handling and failure paths',
|
|
142
|
+
'Maintainability issues',
|
|
143
|
+
'Code duplication'
|
|
144
|
+
])
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
agents.push(Task({
|
|
148
|
+
subagent_type: "review",
|
|
149
|
+
prompt: baseReviewPrompt('security', 'security reviewer', [
|
|
150
|
+
'Auth/authz flaws',
|
|
151
|
+
'Input validation and output encoding',
|
|
152
|
+
'Injection risks (SQL/command/template)',
|
|
153
|
+
'Secrets exposure and unsafe configs',
|
|
154
|
+
'Insecure defaults'
|
|
155
|
+
])
|
|
156
|
+
}));
|
|
157
|
+
|
|
158
|
+
agents.push(Task({
|
|
159
|
+
subagent_type: "review",
|
|
160
|
+
prompt: baseReviewPrompt('performance', 'performance reviewer', [
|
|
161
|
+
'N+1 queries and inefficient loops',
|
|
162
|
+
'Blocking operations in async paths',
|
|
163
|
+
'Hot path inefficiencies',
|
|
164
|
+
'Memory leaks or unnecessary allocations'
|
|
165
|
+
])
|
|
166
|
+
}));
|
|
167
|
+
|
|
168
|
+
agents.push(Task({
|
|
169
|
+
subagent_type: "review",
|
|
170
|
+
prompt: baseReviewPrompt('test-coverage', 'test coverage reviewer', [
|
|
171
|
+
'New code without corresponding tests',
|
|
172
|
+
'Missing edge case coverage',
|
|
173
|
+
'Test quality (meaningful assertions)',
|
|
174
|
+
'Integration test needs',
|
|
175
|
+
'Mock/stub appropriateness',
|
|
176
|
+
HAS_TESTS ? 'Existing tests: verify coverage depth' : 'No tests detected: report missing tests'
|
|
177
|
+
])
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
// Conditional agents
|
|
181
|
+
if (FILE_COUNT > 50) {
|
|
182
|
+
agents.push(Task({
|
|
183
|
+
subagent_type: "review",
|
|
184
|
+
prompt: baseReviewPrompt('architecture', 'architecture reviewer', [
|
|
185
|
+
'Module boundaries and ownership',
|
|
186
|
+
'Dependency direction and layering',
|
|
187
|
+
'Cross-layer coupling',
|
|
188
|
+
'Consistency of patterns'
|
|
189
|
+
])
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (HAS_DB) {
|
|
194
|
+
agents.push(Task({
|
|
195
|
+
subagent_type: "review",
|
|
196
|
+
prompt: baseReviewPrompt('database', 'database specialist', [
|
|
197
|
+
'Query optimization and N+1 queries',
|
|
198
|
+
'Missing indexes',
|
|
199
|
+
'Transaction handling',
|
|
200
|
+
'Migration safety'
|
|
201
|
+
])
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (HAS_API) {
|
|
206
|
+
agents.push(Task({
|
|
207
|
+
subagent_type: "review",
|
|
208
|
+
prompt: baseReviewPrompt('api', 'api designer', [
|
|
209
|
+
'REST best practices',
|
|
210
|
+
'Error handling and status codes',
|
|
211
|
+
'Rate limiting and pagination',
|
|
212
|
+
'API versioning'
|
|
213
|
+
])
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (HAS_FRONTEND) {
|
|
218
|
+
agents.push(Task({
|
|
219
|
+
subagent_type: "review",
|
|
220
|
+
prompt: baseReviewPrompt('frontend', 'frontend specialist', [
|
|
221
|
+
'Component boundaries',
|
|
222
|
+
'State management patterns',
|
|
223
|
+
'Accessibility',
|
|
224
|
+
'Render performance'
|
|
225
|
+
])
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (HAS_BACKEND) {
|
|
230
|
+
agents.push(Task({
|
|
231
|
+
subagent_type: "review",
|
|
232
|
+
prompt: baseReviewPrompt('backend', 'backend specialist', [
|
|
233
|
+
'Service boundaries',
|
|
234
|
+
'Domain logic correctness',
|
|
235
|
+
'Concurrency and idempotency',
|
|
236
|
+
'Background job safety'
|
|
237
|
+
])
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (HAS_CICD) {
|
|
242
|
+
agents.push(Task({
|
|
243
|
+
subagent_type: "review",
|
|
244
|
+
prompt: baseReviewPrompt('devops', 'devops reviewer', [
|
|
245
|
+
'CI/CD safety',
|
|
246
|
+
'Secrets handling',
|
|
247
|
+
'Build/test pipelines',
|
|
248
|
+
'Deploy config correctness'
|
|
249
|
+
])
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Finding Consolidation
|
|
255
|
+
|
|
256
|
+
After all agents complete:
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
function consolidateFindings(agentResults) {
|
|
260
|
+
const allFindings = [];
|
|
261
|
+
|
|
262
|
+
for (const result of agentResults) {
|
|
263
|
+
const pass = result.pass || 'unknown';
|
|
264
|
+
const findings = Array.isArray(result.findings) ? result.findings : [];
|
|
265
|
+
for (const finding of findings) {
|
|
266
|
+
allFindings.push({
|
|
267
|
+
id: `${pass}:${finding.file}:${finding.line}:${finding.description}`,
|
|
268
|
+
pass,
|
|
269
|
+
...finding,
|
|
270
|
+
status: finding.falsePositive ? 'false-positive' : 'open'
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Deduplicate by pass:file:line:description
|
|
276
|
+
const seen = new Set();
|
|
277
|
+
const deduped = allFindings.filter(f => {
|
|
278
|
+
const key = `${f.pass}:${f.file}:${f.line}:${f.description}`;
|
|
279
|
+
if (seen.has(key)) return false;
|
|
280
|
+
seen.add(key);
|
|
281
|
+
return true;
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
// Sort by severity
|
|
285
|
+
const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
286
|
+
deduped.sort((a, b) => {
|
|
287
|
+
const aRank = severityOrder[a.severity] ?? 99;
|
|
288
|
+
const bRank = severityOrder[b.severity] ?? 99;
|
|
289
|
+
return aRank - bRank;
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// Update queue file
|
|
293
|
+
const queueState = safeReadJson(reviewQueuePath) || {
|
|
294
|
+
status: 'open',
|
|
295
|
+
scope: { type: 'audit', value: SCOPE },
|
|
296
|
+
passes: [],
|
|
297
|
+
items: [],
|
|
298
|
+
iteration: 0,
|
|
299
|
+
updatedAt: new Date().toISOString()
|
|
300
|
+
};
|
|
301
|
+
queueState.items = deduped;
|
|
302
|
+
queueState.passes = Array.from(new Set(deduped.map(item => item.pass)));
|
|
303
|
+
queueState.updatedAt = new Date().toISOString();
|
|
304
|
+
fs.writeFileSync(reviewQueuePath, JSON.stringify(queueState, null, 2), 'utf8');
|
|
305
|
+
|
|
306
|
+
// Group by file
|
|
307
|
+
const byFile = {};
|
|
308
|
+
for (const f of deduped) {
|
|
309
|
+
if (!byFile[f.file]) byFile[f.file] = [];
|
|
310
|
+
byFile[f.file].push(f);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return {
|
|
314
|
+
all: deduped,
|
|
315
|
+
byFile,
|
|
316
|
+
counts: {
|
|
317
|
+
critical: deduped.filter(f => f.severity === 'critical' && !f.falsePositive).length,
|
|
318
|
+
high: deduped.filter(f => f.severity === 'high' && !f.falsePositive).length,
|
|
319
|
+
medium: deduped.filter(f => f.severity === 'medium' && !f.falsePositive).length,
|
|
320
|
+
low: deduped.filter(f => f.severity === 'low' && !f.falsePositive).length
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Queue Cleanup
|
|
327
|
+
|
|
328
|
+
After fixes and re-review, remove the queue file if no open issues remain:
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
const queueState = safeReadJson(reviewQueuePath);
|
|
332
|
+
if (!queueState) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const openCount = queueState.items.filter(item => !item.falsePositive).length;
|
|
336
|
+
if (openCount === 0) {
|
|
337
|
+
if (fs.existsSync(reviewQueuePath)) {
|
|
338
|
+
try {
|
|
339
|
+
fs.unlinkSync(reviewQueuePath);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
if (error.code !== 'ENOENT') {
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Framework-Specific Patterns
|
|
350
|
+
|
|
351
|
+
### React Patterns
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
const reactPatterns = {
|
|
355
|
+
hooks_rules: {
|
|
356
|
+
description: "React hooks must be called at top level",
|
|
357
|
+
pattern: /use[A-Z]\w+\(/,
|
|
358
|
+
context: "inside conditionals or loops"
|
|
359
|
+
},
|
|
360
|
+
state_management: {
|
|
361
|
+
description: "Avoid prop drilling, use context or state management",
|
|
362
|
+
pattern: /props\.\w+\.\w+\.\w+/
|
|
363
|
+
},
|
|
364
|
+
performance: {
|
|
365
|
+
description: "Use memo/useMemo for expensive computations",
|
|
366
|
+
pattern: /\.map\(.*=>.*\.map\(/
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Express Patterns
|
|
372
|
+
|
|
373
|
+
```javascript
|
|
374
|
+
const expressPatterns = {
|
|
375
|
+
error_handling: {
|
|
376
|
+
description: "Express routes must have error handling",
|
|
377
|
+
pattern: /app\.(get|post|put|delete)\(/,
|
|
378
|
+
check: "next(err) in catch block"
|
|
379
|
+
},
|
|
380
|
+
async_handlers: {
|
|
381
|
+
description: "Async handlers need try-catch or wrapper",
|
|
382
|
+
pattern: /async\s*\(req,\s*res/
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Django Patterns
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
const djangoPatterns = {
|
|
391
|
+
n_plus_one: {
|
|
392
|
+
description: "Use select_related/prefetch_related",
|
|
393
|
+
pattern: /\.objects\.(all|filter)\(\)/
|
|
394
|
+
},
|
|
395
|
+
raw_queries: {
|
|
396
|
+
description: "Avoid raw SQL, use ORM",
|
|
397
|
+
pattern: /\.raw\(|connection\.cursor\(\)/
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Pattern Application
|
|
403
|
+
|
|
404
|
+
```javascript
|
|
405
|
+
function applyPatterns(findings, frameworkPatterns) {
|
|
406
|
+
if (!frameworkPatterns) return findings;
|
|
407
|
+
|
|
408
|
+
for (const pattern of Object.values(frameworkPatterns)) {
|
|
409
|
+
// Check each finding against framework patterns
|
|
410
|
+
for (const finding of findings) {
|
|
411
|
+
if (pattern.pattern.test(finding.codeQuote)) {
|
|
412
|
+
finding.frameworkContext = pattern.description;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return findings;
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Review Output Format
|
|
422
|
+
|
|
423
|
+
```markdown
|
|
424
|
+
## Agent Reports
|
|
425
|
+
|
|
426
|
+
### security-expert
|
|
427
|
+
**Files Reviewed**: X
|
|
428
|
+
**Issues Found**: Y (Z critical, A high)
|
|
429
|
+
|
|
430
|
+
Findings:
|
|
431
|
+
1. [Finding details with file:line]
|
|
432
|
+
2. [Finding details with file:line]
|
|
433
|
+
|
|
434
|
+
### performance-engineer
|
|
435
|
+
**Files Reviewed**: X
|
|
436
|
+
**Issues Found**: Y
|
|
437
|
+
|
|
438
|
+
Findings:
|
|
439
|
+
1. [Finding details with file:line]
|
|
440
|
+
|
|
441
|
+
[... per agent]
|
|
442
|
+
|
|
443
|
+
## Consolidated Summary
|
|
444
|
+
|
|
445
|
+
**Total Issues**: X
|
|
446
|
+
- Critical: Y (must fix)
|
|
447
|
+
- High: Z (should fix)
|
|
448
|
+
- Medium: A (consider)
|
|
449
|
+
- Low: B (nice to have)
|
|
450
|
+
|
|
451
|
+
**Top Files by Issue Count**:
|
|
452
|
+
1. src/api/users.ts: 5 issues
|
|
453
|
+
2. src/auth/session.ts: 3 issues
|
|
454
|
+
```
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
|
|
2
|
+
# Phase 8: GitHub Issue Creation - Reference
|
|
3
|
+
|
|
4
|
+
This file contains GitHub integration for `/audit-project`.
|
|
5
|
+
|
|
6
|
+
**Parent document**: `audit-project.md`
|
|
7
|
+
|
|
8
|
+
## Pre-Conditions
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Check if git and gh are available
|
|
12
|
+
GIT_AVAILABLE=$(command -v git >/dev/null 2>&1 && echo "true" || echo "false")
|
|
13
|
+
GH_AVAILABLE=$(command -v gh >/dev/null 2>&1 && echo "true" || echo "false")
|
|
14
|
+
|
|
15
|
+
# Check if this is a GitHub repository
|
|
16
|
+
IS_GITHUB_REPO="false"
|
|
17
|
+
if [ "$GIT_AVAILABLE" = "true" ]; then
|
|
18
|
+
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
|
|
19
|
+
if echo "$REMOTE_URL" | grep -q "github.com"; then
|
|
20
|
+
IS_GITHUB_REPO="true"
|
|
21
|
+
fi
|
|
22
|
+
fi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Creating GitHub Issues
|
|
26
|
+
|
|
27
|
+
If `git` and `gh` are available, create issues for **non-security** deferred items:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
if [ "$GH_AVAILABLE" = "true" ] && [ "$IS_GITHUB_REPO" = "true" ]; then
|
|
31
|
+
echo "Creating GitHub issues for deferred items..."
|
|
32
|
+
|
|
33
|
+
# DO NOT create public issues for security-sensitive findings
|
|
34
|
+
for issue in "${DEFERRED_NON_SECURITY_ISSUES[@]}"; do
|
|
35
|
+
gh issue create \
|
|
36
|
+
--title "${issue.title}" \
|
|
37
|
+
--body "${issue.body}"
|
|
38
|
+
done
|
|
39
|
+
|
|
40
|
+
echo "Created ${#DEFERRED_NON_SECURITY_ISSUES[@]} GitHub issues"
|
|
41
|
+
fi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Issue Format
|
|
45
|
+
|
|
46
|
+
Each created issue includes:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Issue from /audit-project
|
|
50
|
+
|
|
51
|
+
**Severity**: [Critical|High|Medium|Low]
|
|
52
|
+
**Category**: [Performance|Architecture|Code Quality|Enhancement]
|
|
53
|
+
**Effort**: [Small|Medium|Large] (~X hours)
|
|
54
|
+
|
|
55
|
+
### Description
|
|
56
|
+
[Description of the issue]
|
|
57
|
+
|
|
58
|
+
### Current Behavior
|
|
59
|
+
\`\`\`[language]
|
|
60
|
+
[Code showing the problem]
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
### Proposed Fix
|
|
64
|
+
[Specific remediation approach]
|
|
65
|
+
|
|
66
|
+
### Impact
|
|
67
|
+
[Why this matters]
|
|
68
|
+
|
|
69
|
+
### Files
|
|
70
|
+
- [List of affected files]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Security Issue Handling
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
[WARN] SECURITY ISSUES MUST NOT BE PUBLIC
|
|
78
|
+
|
|
79
|
+
The following must NOT be created as GitHub issues:
|
|
80
|
+
- Token/credential exposure
|
|
81
|
+
- Authentication vulnerabilities
|
|
82
|
+
- Authorization bypasses
|
|
83
|
+
- Injection vulnerabilities
|
|
84
|
+
- Any exploitable security finding
|
|
85
|
+
|
|
86
|
+
For security issues:
|
|
87
|
+
1. Fix immediately if possible
|
|
88
|
+
2. Keep documented internally only
|
|
89
|
+
3. Note in completion report (no details)
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## TECHNICAL_DEBT.md Cleanup
|
|
94
|
+
|
|
95
|
+
After all issues are handled, remove TECHNICAL_DEBT.md:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
if [ "$GH_AVAILABLE" = "true" ] && [ "$IS_GITHUB_REPO" = "true" ]; then
|
|
99
|
+
if [ -f "TECHNICAL_DEBT.md" ]; then
|
|
100
|
+
rm TECHNICAL_DEBT.md
|
|
101
|
+
git add TECHNICAL_DEBT.md
|
|
102
|
+
git commit -m "chore: remove TECHNICAL_DEBT.md - issues tracked in GitHub
|
|
103
|
+
|
|
104
|
+
Created GitHub issues for all deferred non-security items.
|
|
105
|
+
Security-sensitive issues kept internal."
|
|
106
|
+
echo "Removed TECHNICAL_DEBT.md - issues now in GitHub"
|
|
107
|
+
fi
|
|
108
|
+
else
|
|
109
|
+
echo "TECHNICAL_DEBT.md retained - no GitHub integration"
|
|
110
|
+
fi
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Cleanup Conditions
|
|
114
|
+
|
|
115
|
+
**Remove TECHNICAL_DEBT.md when ALL true:**
|
|
116
|
+
1. `git` is available
|
|
117
|
+
2. `gh` CLI is available and authenticated
|
|
118
|
+
3. Repository has GitHub remote
|
|
119
|
+
4. All non-security issues created as GitHub issues
|
|
120
|
+
|
|
121
|
+
**Keep TECHNICAL_DEBT.md when ANY true:**
|
|
122
|
+
1. No GitHub integration available
|
|
123
|
+
2. `gh` CLI not authenticated
|
|
124
|
+
3. User requested `--create-tech-debt` flag
|
|
125
|
+
4. Security issues exist
|
|
126
|
+
|
|
127
|
+
## Final Commit
|
|
128
|
+
|
|
129
|
+
If issues were created:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git add -A
|
|
133
|
+
git commit -m "chore: audit-project complete - issues tracked in GitHub
|
|
134
|
+
|
|
135
|
+
Created X GitHub issues for deferred items:
|
|
136
|
+
- #N: [issue title]
|
|
137
|
+
- #N: [issue title]
|
|
138
|
+
|
|
139
|
+
Security-sensitive issues (Y total) kept internal.
|
|
140
|
+
Fixed Z issues in this review session."
|
|
141
|
+
```
|