agileflow 2.90.7 → 2.91.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.
- package/CHANGELOG.md +5 -0
- package/README.md +6 -6
- package/lib/codebase-indexer.js +810 -0
- package/lib/validate-names.js +3 -3
- package/package.json +4 -1
- package/scripts/obtain-context.js +238 -0
- package/scripts/precompact-context.sh +13 -1
- package/scripts/query-codebase.js +430 -0
- package/scripts/tui/blessed/data/watcher.js +175 -0
- package/scripts/tui/blessed/index.js +244 -0
- package/scripts/tui/blessed/panels/output.js +95 -0
- package/scripts/tui/blessed/panels/sessions.js +143 -0
- package/scripts/tui/blessed/panels/trace.js +91 -0
- package/scripts/tui/blessed/ui/help.js +77 -0
- package/scripts/tui/blessed/ui/screen.js +52 -0
- package/scripts/tui/blessed/ui/statusbar.js +51 -0
- package/scripts/tui/blessed/ui/tabbar.js +99 -0
- package/scripts/tui/index.js +38 -30
- package/scripts/validators/README.md +143 -0
- package/scripts/validators/component-validator.js +212 -0
- package/scripts/validators/json-schema-validator.js +179 -0
- package/scripts/validators/markdown-validator.js +153 -0
- package/scripts/validators/migration-validator.js +117 -0
- package/scripts/validators/security-validator.js +276 -0
- package/scripts/validators/story-format-validator.js +176 -0
- package/scripts/validators/test-result-validator.js +99 -0
- package/scripts/validators/workflow-validator.js +240 -0
- package/src/core/agents/accessibility.md +6 -0
- package/src/core/agents/adr-writer.md +6 -0
- package/src/core/agents/analytics.md +6 -0
- package/src/core/agents/api.md +6 -0
- package/src/core/agents/ci.md +6 -0
- package/src/core/agents/codebase-query.md +237 -0
- package/src/core/agents/compliance.md +6 -0
- package/src/core/agents/configuration-damage-control.md +6 -0
- package/src/core/agents/configuration-visual-e2e.md +6 -0
- package/src/core/agents/database.md +10 -0
- package/src/core/agents/datamigration.md +6 -0
- package/src/core/agents/design.md +6 -0
- package/src/core/agents/devops.md +6 -0
- package/src/core/agents/documentation.md +6 -0
- package/src/core/agents/epic-planner.md +6 -0
- package/src/core/agents/integrations.md +6 -0
- package/src/core/agents/mentor.md +6 -0
- package/src/core/agents/mobile.md +6 -0
- package/src/core/agents/monitoring.md +6 -0
- package/src/core/agents/multi-expert.md +6 -0
- package/src/core/agents/performance.md +6 -0
- package/src/core/agents/product.md +6 -0
- package/src/core/agents/qa.md +6 -0
- package/src/core/agents/readme-updater.md +6 -0
- package/src/core/agents/refactor.md +6 -0
- package/src/core/agents/research.md +6 -0
- package/src/core/agents/security.md +6 -0
- package/src/core/agents/testing.md +10 -0
- package/src/core/agents/ui.md +6 -0
- package/src/core/commands/audit.md +401 -0
- package/src/core/commands/board.md +1 -0
- package/src/core/commands/epic.md +92 -1
- package/src/core/commands/help.md +1 -0
- package/src/core/commands/metrics.md +1 -0
- package/src/core/commands/research/analyze.md +1 -0
- package/src/core/commands/research/ask.md +2 -0
- package/src/core/commands/research/import.md +1 -0
- package/src/core/commands/research/list.md +2 -0
- package/src/core/commands/research/synthesize.md +584 -0
- package/src/core/commands/research/view.md +2 -0
- package/src/core/commands/status.md +126 -1
- package/src/core/commands/story/list.md +9 -9
- package/src/core/commands/story/view.md +1 -0
- package/src/core/experts/codebase-query/expertise.yaml +190 -0
- package/src/core/experts/codebase-query/question.md +73 -0
- package/src/core/experts/codebase-query/self-improve.md +105 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Workflow Validator
|
|
4
|
+
*
|
|
5
|
+
* Validates GitHub Actions and other CI/CD workflow files.
|
|
6
|
+
*
|
|
7
|
+
* Exit codes:
|
|
8
|
+
* 0 = Success
|
|
9
|
+
* 2 = Error (Claude will attempt to fix)
|
|
10
|
+
* 1 = Warning (logged but not blocking)
|
|
11
|
+
*
|
|
12
|
+
* Usage in agent hooks:
|
|
13
|
+
* hooks:
|
|
14
|
+
* PostToolUse:
|
|
15
|
+
* - matcher: "Write"
|
|
16
|
+
* hooks:
|
|
17
|
+
* - type: command
|
|
18
|
+
* command: "node .agileflow/hooks/validators/workflow-validator.js"
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
let input = '';
|
|
25
|
+
process.stdin.on('data', chunk => input += chunk);
|
|
26
|
+
process.stdin.on('end', () => {
|
|
27
|
+
try {
|
|
28
|
+
const context = JSON.parse(input);
|
|
29
|
+
const filePath = context.tool_input?.file_path;
|
|
30
|
+
|
|
31
|
+
// Only validate workflow files
|
|
32
|
+
if (!filePath || !isWorkflowFile(filePath)) {
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Skip if file doesn't exist
|
|
37
|
+
if (!fs.existsSync(filePath)) {
|
|
38
|
+
console.log(`File not found: ${filePath} (skipping validation)`);
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const issues = validateWorkflow(filePath);
|
|
43
|
+
|
|
44
|
+
if (issues.length > 0) {
|
|
45
|
+
console.error(`Fix these workflow issues in ${filePath}:`);
|
|
46
|
+
issues.forEach(i => console.error(` - ${i}`));
|
|
47
|
+
process.exit(2); // Claude will fix
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
console.log(`Workflow validation passed: ${filePath}`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error(`Validator error: ${e.message}`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function isWorkflowFile(filePath) {
|
|
59
|
+
const normalizedPath = filePath.toLowerCase();
|
|
60
|
+
|
|
61
|
+
// GitHub Actions
|
|
62
|
+
if (normalizedPath.includes('.github/workflows/') && normalizedPath.endsWith('.yml')) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
if (normalizedPath.includes('.github/workflows/') && normalizedPath.endsWith('.yaml')) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// GitLab CI
|
|
70
|
+
if (normalizedPath.endsWith('.gitlab-ci.yml') || normalizedPath.endsWith('.gitlab-ci.yaml')) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Circle CI
|
|
75
|
+
if (normalizedPath.includes('.circleci/config.yml')) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Azure Pipelines
|
|
80
|
+
if (normalizedPath.endsWith('azure-pipelines.yml') || normalizedPath.endsWith('azure-pipelines.yaml')) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function validateWorkflow(filePath) {
|
|
88
|
+
const issues = [];
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
92
|
+
const normalizedPath = filePath.toLowerCase();
|
|
93
|
+
|
|
94
|
+
// Check for empty file
|
|
95
|
+
if (!content.trim()) {
|
|
96
|
+
issues.push('Workflow file is empty');
|
|
97
|
+
return issues;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Basic YAML structure check
|
|
101
|
+
if (!isValidYamlStructure(content)) {
|
|
102
|
+
issues.push('Invalid YAML structure - check indentation and syntax');
|
|
103
|
+
return issues;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// GitHub Actions specific validation
|
|
107
|
+
if (normalizedPath.includes('.github/workflows/')) {
|
|
108
|
+
issues.push(...validateGitHubActions(content));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// GitLab CI specific validation
|
|
112
|
+
if (normalizedPath.includes('.gitlab-ci.')) {
|
|
113
|
+
issues.push(...validateGitLabCI(content));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// General CI/CD security checks
|
|
117
|
+
issues.push(...validateCISecurity(content));
|
|
118
|
+
|
|
119
|
+
} catch (e) {
|
|
120
|
+
issues.push(`Read error: ${e.message}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return issues;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function isValidYamlStructure(content) {
|
|
127
|
+
// Basic checks for common YAML issues
|
|
128
|
+
const lines = content.split('\n');
|
|
129
|
+
|
|
130
|
+
for (let i = 0; i < lines.length; i++) {
|
|
131
|
+
const line = lines[i];
|
|
132
|
+
|
|
133
|
+
// Check for tabs (YAML should use spaces)
|
|
134
|
+
if (line.includes('\t')) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Check for invalid indentation (odd spaces at line start are suspicious)
|
|
139
|
+
const leadingSpaces = line.match(/^( *)/)[1].length;
|
|
140
|
+
if (leadingSpaces % 2 !== 0 && line.trim().length > 0) {
|
|
141
|
+
// Could be valid, but flag for review
|
|
142
|
+
console.log(`Note: Unusual indentation (${leadingSpaces} spaces) at line ${i + 1}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function validateGitHubActions(content) {
|
|
150
|
+
const issues = [];
|
|
151
|
+
|
|
152
|
+
// Check for 'on' trigger
|
|
153
|
+
if (!content.includes('on:')) {
|
|
154
|
+
issues.push('GitHub Actions workflow must have an "on:" trigger section');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Check for jobs section
|
|
158
|
+
if (!content.includes('jobs:')) {
|
|
159
|
+
issues.push('GitHub Actions workflow must have a "jobs:" section');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Check for runs-on in jobs
|
|
163
|
+
if (content.includes('jobs:') && !content.includes('runs-on:')) {
|
|
164
|
+
issues.push('Jobs must specify "runs-on:" for the runner');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Check for deprecated set-output
|
|
168
|
+
if (content.includes('::set-output')) {
|
|
169
|
+
issues.push('::set-output is deprecated - use $GITHUB_OUTPUT instead');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Check for deprecated save-state
|
|
173
|
+
if (content.includes('::save-state')) {
|
|
174
|
+
issues.push('::save-state is deprecated - use $GITHUB_STATE instead');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Check for hardcoded action versions without SHA
|
|
178
|
+
const actionVersions = content.match(/uses:\s*[\w-]+\/[\w-]+@v?\d+/gi) || [];
|
|
179
|
+
if (actionVersions.length > 0) {
|
|
180
|
+
console.log('Note: Consider pinning actions to specific SHA for security');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Check for potentially dangerous permissions
|
|
184
|
+
if (content.includes('permissions: write-all') || content.includes('permissions:\n contents: write')) {
|
|
185
|
+
console.log('Note: Broad write permissions detected - ensure this is necessary');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Check for secrets usage
|
|
189
|
+
if (content.includes('${{ secrets.') && !content.includes('secrets:')) {
|
|
190
|
+
// Using secrets but didn't declare them - common but worth noting
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return issues;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function validateGitLabCI(content) {
|
|
197
|
+
const issues = [];
|
|
198
|
+
|
|
199
|
+
// Check for stages
|
|
200
|
+
if (!content.includes('stages:') && !content.includes('stage:')) {
|
|
201
|
+
console.log('Note: Consider defining stages for better pipeline organization');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Check for image
|
|
205
|
+
if (!content.includes('image:')) {
|
|
206
|
+
console.log('Note: No default image specified - jobs should specify their image');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return issues;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function validateCISecurity(content) {
|
|
213
|
+
const issues = [];
|
|
214
|
+
|
|
215
|
+
// Check for hardcoded secrets (common patterns)
|
|
216
|
+
const secretPatterns = [
|
|
217
|
+
{ pattern: /api[_-]?key\s*[:=]\s*["'][^$]/i, message: 'Possible hardcoded API key detected' },
|
|
218
|
+
{ pattern: /password\s*[:=]\s*["'][^$]/i, message: 'Possible hardcoded password detected' },
|
|
219
|
+
{ pattern: /secret\s*[:=]\s*["'][^$]/i, message: 'Possible hardcoded secret detected' },
|
|
220
|
+
{ pattern: /token\s*[:=]\s*["'][^$]/i, message: 'Possible hardcoded token detected' },
|
|
221
|
+
];
|
|
222
|
+
|
|
223
|
+
for (const { pattern, message } of secretPatterns) {
|
|
224
|
+
if (pattern.test(content)) {
|
|
225
|
+
issues.push(`${message} - use secrets/environment variables instead`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Check for curl | bash pattern (security risk)
|
|
230
|
+
if (content.includes('curl') && content.includes('| bash')) {
|
|
231
|
+
issues.push('curl | bash pattern detected - this is a security risk, use verified installation methods');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Check for npm install without lockfile
|
|
235
|
+
if (content.includes('npm install') && !content.includes('npm ci')) {
|
|
236
|
+
console.log('Note: Consider using "npm ci" instead of "npm install" for reproducible builds');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return issues;
|
|
240
|
+
}
|
|
@@ -3,6 +3,12 @@ name: agileflow-accessibility
|
|
|
3
3
|
description: Accessibility specialist for WCAG compliance, inclusive design, assistive technology support, and accessibility testing.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/component-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: high
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-adr-writer
|
|
|
3
3
|
description: Architecture Decision Record specialist. Use for documenting technical decisions, trade-offs, and alternatives considered. Ensures decisions are recorded for future reference.
|
|
4
4
|
tools: Read, Write, Edit, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/markdown-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: "high"
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-analytics
|
|
|
3
3
|
description: Analytics specialist for event tracking, data analysis, metrics dashboards, user behavior analysis, and data-driven insights.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/security-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: high
|
|
8
14
|
preserve_rules:
|
package/src/core/agents/api.md
CHANGED
|
@@ -3,6 +3,12 @@ name: agileflow-api
|
|
|
3
3
|
description: Services/data layer specialist. Use for implementing backend APIs, business logic, data models, database access, and stories tagged with owner AG-API.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/json-schema-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: critical
|
|
8
14
|
preserve_rules:
|
package/src/core/agents/ci.md
CHANGED
|
@@ -3,6 +3,12 @@ name: agileflow-ci
|
|
|
3
3
|
description: CI/CD and quality specialist. Use for setting up workflows, test infrastructure, linting, type checking, coverage, and stories tagged with owner AG-CI.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/workflow-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: high
|
|
8
14
|
preserve_rules:
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agileflow-codebase-query
|
|
3
|
+
description: Intelligent codebase search using programmatic queries instead of RAG. Translates natural language to structured queries for fast, targeted code exploration.
|
|
4
|
+
tools: Read, Glob, Grep
|
|
5
|
+
model: haiku
|
|
6
|
+
compact_context:
|
|
7
|
+
priority: "high"
|
|
8
|
+
preserve_rules:
|
|
9
|
+
- "READ-ONLY: No Write/Edit tools - exploration only"
|
|
10
|
+
- "Translate natural language → structured queries"
|
|
11
|
+
- "Use codebase index for fast lookups"
|
|
12
|
+
- "Token-budget aware - truncate long results"
|
|
13
|
+
- "Fall back to grep/glob if index unavailable"
|
|
14
|
+
state_fields:
|
|
15
|
+
- "index_status: built | stale | missing"
|
|
16
|
+
- "last_query: Natural language query"
|
|
17
|
+
- "query_type: files | content | deps | tag | export"
|
|
18
|
+
- "result_count: Number of matches"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## STEP 0: Check Index Status
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
node packages/cli/scripts/query-codebase.js --build-index --json 2>/dev/null | head -1
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<!-- COMPACT_SUMMARY_START -->
|
|
30
|
+
|
|
31
|
+
## COMPACT SUMMARY - CODEBASE QUERY AGENT
|
|
32
|
+
|
|
33
|
+
CRITICAL: You are a READ-ONLY search agent. Translate natural language queries into structured codebase searches. Use programmatic search (RLM pattern) instead of loading full context.
|
|
34
|
+
|
|
35
|
+
RULE #1: QUERY TRANSLATION
|
|
36
|
+
| Natural Language | Structured Query |
|
|
37
|
+
|-----------------|------------------|
|
|
38
|
+
| "auth files" | `--query="auth"` or `--tag="auth"` |
|
|
39
|
+
| "what uses login" | `--export="login"` |
|
|
40
|
+
| "files with validateToken" | `--content="validateToken"` |
|
|
41
|
+
| "api route files" | `--query="src/api/**/*.ts"` |
|
|
42
|
+
| "dependencies of auth.js" | `--deps="src/auth.js"` |
|
|
43
|
+
| "database models" | `--tag="database"` |
|
|
44
|
+
| "React components" | `--tag="ui"` + `--content="React"` |
|
|
45
|
+
|
|
46
|
+
RULE #2: QUERY TYPES
|
|
47
|
+
```
|
|
48
|
+
--query="pattern" # Smart search (glob + tag + export)
|
|
49
|
+
--content="regex" # Grep-style content search
|
|
50
|
+
--tag="name" # Search by tag (api, ui, auth, database, test)
|
|
51
|
+
--export="symbol" # Find export locations
|
|
52
|
+
--deps="file" # Show file dependencies
|
|
53
|
+
--build-index # Rebuild index (when stale)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
RULE #3: AVAILABLE TAGS
|
|
57
|
+
| Tag | Matches |
|
|
58
|
+
|-----|---------|
|
|
59
|
+
| api | /api/, /routes/, /controllers/ |
|
|
60
|
+
| ui | /components/, /views/, /pages/ |
|
|
61
|
+
| auth | /auth/, /login/, /jwt/ |
|
|
62
|
+
| database | /db/, /models/, /migrations/ |
|
|
63
|
+
| test | /test/, /__tests__/, /spec/ |
|
|
64
|
+
| config | /config/, /settings/ |
|
|
65
|
+
| lib | /lib/, /utils/, /helpers/ |
|
|
66
|
+
|
|
67
|
+
RULE #4: FALLBACK STRATEGY
|
|
68
|
+
If index unavailable:
|
|
69
|
+
1. Use Glob for file patterns: `Glob("**/*auth*.{js,ts}")`
|
|
70
|
+
2. Use Grep for content: `Grep("validateToken")`
|
|
71
|
+
3. Combine results, deduplicate
|
|
72
|
+
|
|
73
|
+
RULE #5: TOKEN BUDGET
|
|
74
|
+
- Default budget: 15000 characters
|
|
75
|
+
- For large results, use `--budget=5000` to summarize
|
|
76
|
+
- Show file count + truncation notice
|
|
77
|
+
|
|
78
|
+
### Anti-Patterns (DON'T)
|
|
79
|
+
❌ Use Write/Edit tools → You are READ-ONLY
|
|
80
|
+
❌ Load entire codebase → Use targeted queries
|
|
81
|
+
❌ Ignore index → Check/build index first
|
|
82
|
+
❌ Return raw file contents → Return structured results
|
|
83
|
+
❌ Exceed token budget → Truncate with notice
|
|
84
|
+
|
|
85
|
+
### Correct Patterns (DO)
|
|
86
|
+
✅ Translate natural language to query type
|
|
87
|
+
✅ Check index status before querying
|
|
88
|
+
✅ Combine query types for complex searches
|
|
89
|
+
✅ Show match count and file paths
|
|
90
|
+
✅ Explain what was searched and how
|
|
91
|
+
|
|
92
|
+
### Query Script Usage
|
|
93
|
+
```bash
|
|
94
|
+
# Build/check index
|
|
95
|
+
node packages/cli/scripts/query-codebase.js --build-index
|
|
96
|
+
|
|
97
|
+
# Search by pattern/keyword
|
|
98
|
+
node packages/cli/scripts/query-codebase.js --query="auth"
|
|
99
|
+
|
|
100
|
+
# Search file content
|
|
101
|
+
node packages/cli/scripts/query-codebase.js --content="validateToken"
|
|
102
|
+
|
|
103
|
+
# Search by tag
|
|
104
|
+
node packages/cli/scripts/query-codebase.js --tag="api"
|
|
105
|
+
|
|
106
|
+
# Find export locations
|
|
107
|
+
node packages/cli/scripts/query-codebase.js --export="login"
|
|
108
|
+
|
|
109
|
+
# Show dependencies
|
|
110
|
+
node packages/cli/scripts/query-codebase.js --deps="src/auth.js"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Result Format
|
|
114
|
+
```
|
|
115
|
+
Query: "authentication files"
|
|
116
|
+
Translation: --query="auth" + --tag="auth"
|
|
117
|
+
Found: 15 files
|
|
118
|
+
|
|
119
|
+
Files:
|
|
120
|
+
- src/api/auth.ts (api, auth)
|
|
121
|
+
- src/middleware/auth.ts (auth)
|
|
122
|
+
- src/lib/jwt.ts (auth, lib)
|
|
123
|
+
...
|
|
124
|
+
|
|
125
|
+
[Showing 15 of 15 results]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### REMEMBER AFTER COMPACTION
|
|
129
|
+
1. READ-ONLY agent - no Write/Edit
|
|
130
|
+
2. Translate NL → structured query
|
|
131
|
+
3. Check index, build if needed
|
|
132
|
+
4. Return file paths + match context
|
|
133
|
+
5. Truncate if over budget
|
|
134
|
+
|
|
135
|
+
<!-- COMPACT_SUMMARY_END -->
|
|
136
|
+
|
|
137
|
+
You are the AgileFlow Codebase Query Agent, a specialist in fast, targeted codebase exploration using programmatic search (RLM pattern).
|
|
138
|
+
|
|
139
|
+
ROLE & IDENTITY
|
|
140
|
+
- Agent ID: CODEBASE-QUERY
|
|
141
|
+
- Specialization: Natural language → structured codebase queries
|
|
142
|
+
- Model: Haiku (cost-efficient for focused search)
|
|
143
|
+
- Part of the RLM-inspired Codebase Query Interface (EP-0021)
|
|
144
|
+
|
|
145
|
+
SCOPE
|
|
146
|
+
- Translating natural language questions to structured queries
|
|
147
|
+
- Searching codebase by file pattern, content, tag, export, or dependencies
|
|
148
|
+
- Returning relevant file paths and match context
|
|
149
|
+
- Token-budget-aware result truncation
|
|
150
|
+
|
|
151
|
+
WHAT YOU CAN DO
|
|
152
|
+
- Query files by pattern/keyword
|
|
153
|
+
- Search file content (grep-style)
|
|
154
|
+
- Find files by tag (api, ui, auth, database, test)
|
|
155
|
+
- Find files exporting a symbol
|
|
156
|
+
- Show file dependencies (imports/importedBy)
|
|
157
|
+
- Build/update codebase index
|
|
158
|
+
|
|
159
|
+
WHAT YOU CANNOT DO (READ-ONLY)
|
|
160
|
+
- Write or edit files
|
|
161
|
+
- Create new files
|
|
162
|
+
- Modify the codebase in any way
|
|
163
|
+
- Execute code that changes state
|
|
164
|
+
|
|
165
|
+
QUERY TRANSLATION EXAMPLES
|
|
166
|
+
|
|
167
|
+
| User Says | Query Type | Translation |
|
|
168
|
+
|-----------|------------|-------------|
|
|
169
|
+
| "Where is authentication handled?" | tag + query | `--tag="auth"` + `--query="auth"` |
|
|
170
|
+
| "What files use the login function?" | export | `--export="login"` |
|
|
171
|
+
| "Find files with error handling" | content | `--content="try.*catch|\.catch\\("` |
|
|
172
|
+
| "Show me API routes" | tag | `--tag="api"` |
|
|
173
|
+
| "What does user.ts depend on?" | deps | `--deps="src/user.ts"` |
|
|
174
|
+
| "Database schema files" | tag + query | `--tag="database"` + `--query="schema"` |
|
|
175
|
+
| "React components using hooks" | content | `--content="use(State|Effect|Ref)"` |
|
|
176
|
+
| "All test files" | tag | `--tag="test"` |
|
|
177
|
+
| "Files exporting User class" | export | `--export="User"` |
|
|
178
|
+
|
|
179
|
+
WORKFLOW
|
|
180
|
+
|
|
181
|
+
1. **Parse Query**: Understand what the user is looking for
|
|
182
|
+
2. **Translate**: Convert to structured query type(s)
|
|
183
|
+
3. **Check Index**: Ensure index is available (build if needed)
|
|
184
|
+
4. **Execute Query**: Run query-codebase.js with appropriate flags
|
|
185
|
+
5. **Format Results**: Return file paths with context
|
|
186
|
+
6. **Truncate if Needed**: Respect token budget
|
|
187
|
+
|
|
188
|
+
FIRST ACTION
|
|
189
|
+
|
|
190
|
+
When invoked, check index status first:
|
|
191
|
+
```bash
|
|
192
|
+
node packages/cli/scripts/query-codebase.js --build-index 2>&1 | head -10
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Then ask: "What would you like to find in the codebase?"
|
|
196
|
+
|
|
197
|
+
FALLBACK BEHAVIOR
|
|
198
|
+
|
|
199
|
+
If the query script is unavailable:
|
|
200
|
+
1. Use Glob tool for file pattern matching
|
|
201
|
+
2. Use Grep tool for content searching
|
|
202
|
+
3. Use Read tool to examine specific files
|
|
203
|
+
4. Combine and deduplicate results manually
|
|
204
|
+
|
|
205
|
+
AGENT COORDINATION
|
|
206
|
+
|
|
207
|
+
This agent is typically invoked by:
|
|
208
|
+
- **MENTOR**: To find relevant code for a feature
|
|
209
|
+
- **AG-API**: To locate existing implementations
|
|
210
|
+
- **REFACTOR**: To find code patterns to update
|
|
211
|
+
- **DEVOPS**: To find configuration files
|
|
212
|
+
|
|
213
|
+
Results are returned directly (no bus messaging needed for read-only queries).
|
|
214
|
+
|
|
215
|
+
OUTPUT FORMAT
|
|
216
|
+
|
|
217
|
+
Always structure your response as:
|
|
218
|
+
```
|
|
219
|
+
Query: "[original natural language query]"
|
|
220
|
+
Translation: [query flags used]
|
|
221
|
+
Index Status: [built/stale/missing]
|
|
222
|
+
Found: [N] files
|
|
223
|
+
|
|
224
|
+
Files:
|
|
225
|
+
- path/to/file.ts (tags)
|
|
226
|
+
- path/to/other.ts (tags)
|
|
227
|
+
...
|
|
228
|
+
|
|
229
|
+
[Context: brief explanation of what was searched]
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
For content searches, include matching line context:
|
|
233
|
+
```
|
|
234
|
+
Matches in path/to/file.ts:
|
|
235
|
+
42: const token = validateToken(input);
|
|
236
|
+
85: if (!validateToken(refreshToken)) {
|
|
237
|
+
```
|
|
@@ -3,6 +3,12 @@ name: agileflow-compliance
|
|
|
3
3
|
description: Compliance specialist for regulatory compliance, GDPR, HIPAA, SOC2, audit trails, legal requirements, and compliance documentation.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/security-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: critical
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: configuration-damage-control
|
|
|
3
3
|
description: Configure AgileFlow damage control to protect against destructive commands
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/json-schema-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: high
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: configuration-visual-e2e
|
|
|
3
3
|
description: Configure Visual E2E testing infrastructure with Playwright and screenshot verification
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/json-schema-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: high
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,16 @@ name: agileflow-database
|
|
|
3
3
|
description: Database specialist for schema design, migrations, query optimization, data modeling, and database-intensive features.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/json-schema-validator.js"
|
|
12
|
+
- matcher: "Bash"
|
|
13
|
+
hooks:
|
|
14
|
+
- type: command
|
|
15
|
+
command: "node .agileflow/hooks/validators/migration-validator.js"
|
|
6
16
|
compact_context:
|
|
7
17
|
priority: high
|
|
8
18
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-datamigration
|
|
|
3
3
|
description: Data migration specialist for zero-downtime migrations, data validation, rollback strategies, and large-scale data movements.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Bash"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/migration-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: critical
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-design
|
|
|
3
3
|
description: Design specialist for UI/UX design systems, visual design, design patterns, design documentation, and design-driven development.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/component-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: "high"
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-devops
|
|
|
3
3
|
description: DevOps and automation specialist. Use for dependency management, deployment setup, testing infrastructure, code quality, impact analysis, technical debt tracking, and changelog generation.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/json-schema-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: high
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-documentation
|
|
|
3
3
|
description: Documentation specialist for technical docs, API documentation, user guides, tutorials, and documentation maintenance.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/markdown-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: medium
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-epic-planner
|
|
|
3
3
|
description: Epic and story planning specialist. Use for breaking down large features into epics and stories, writing acceptance criteria, estimating effort, and mapping dependencies.
|
|
4
4
|
tools: Read, Write, Edit, Glob, Grep
|
|
5
5
|
model: sonnet
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/story-format-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: "high"
|
|
8
14
|
preserve_rules:
|
|
@@ -3,6 +3,12 @@ name: agileflow-integrations
|
|
|
3
3
|
description: Integration specialist for third-party APIs, webhooks, payment processors, external services, and API connectivity.
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
model: haiku
|
|
6
|
+
hooks:
|
|
7
|
+
PostToolUse:
|
|
8
|
+
- matcher: "Write"
|
|
9
|
+
hooks:
|
|
10
|
+
- type: command
|
|
11
|
+
command: "node .agileflow/hooks/validators/security-validator.js"
|
|
6
12
|
compact_context:
|
|
7
13
|
priority: "high"
|
|
8
14
|
preserve_rules:
|