agent-state-machine 2.5.0 → 2.6.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/lib/llm.js +14 -3
- package/lib/runtime/prompt.js +1 -1
- package/lib/runtime/runtime.js +14 -2
- package/lib/runtime/track-changes.js +84 -0
- package/package.json +1 -1
- package/templates/project-builder/agents/{code-writer.md → code-write.md} +18 -12
- package/templates/project-builder/agents/{assumptions-clarifier.md → intake-assumptions.md} +1 -0
- package/templates/project-builder/agents/{requirements-clarifier.md → intake-requirements.md} +1 -0
- package/templates/project-builder/agents/{scope-clarifier.md → intake-scope.md} +1 -0
- package/templates/project-builder/agents/{security-clarifier.md → intake-security.md} +1 -0
- package/templates/project-builder/agents/{roadmap-generator.md → plan-roadmap.md} +1 -0
- package/templates/project-builder/agents/{task-planner.md → plan-tasks.md} +1 -0
- package/templates/project-builder/agents/post-code-fix.md +59 -0
- package/templates/project-builder/agents/{code-reviewer.md → post-code-review.md} +10 -0
- package/templates/project-builder/agents/post-code-security.md +55 -0
- package/templates/project-builder/agents/{security-reviewer.md → pre-code-security.md} +8 -11
- package/templates/project-builder/agents/{test-planner.md → pre-code-tests.md} +1 -0
- package/templates/project-builder/agents/response-interpreter.md +1 -0
- package/templates/project-builder/agents/verify-commit-msg.md +64 -0
- package/templates/project-builder/agents/{sanity-checker.md → verify-sanity.md} +1 -12
- package/templates/project-builder/config.js +15 -4
- package/templates/project-builder/scripts/safeguard-recovery.js +40 -0
- package/templates/project-builder/scripts/validate-changes.js +61 -0
- package/templates/project-builder/scripts/workflow-helpers.js +87 -35
- package/templates/project-builder/workflow.js +231 -93
- package/vercel-server/public/remote/assets/{index-BSL55rdk.js → index-BnuR91vD.js} +1 -1
- package/vercel-server/public/remote/index.html +1 -1
- package/vercel-server/ui/src/components/ContentCard.jsx +7 -7
- package/vercel-server/ui/src/components/SettingsModal.jsx +19 -4
- package/templates/project-builder/agents/code-fixer.md +0 -50
- /package/templates/project-builder/{agents → scripts}/sanity-runner.js +0 -0
package/lib/llm.js
CHANGED
|
@@ -354,15 +354,21 @@ async function executeCLI(command, promptText, options = {}, apiKeys = {}) {
|
|
|
354
354
|
|
|
355
355
|
if (baseCmd === 'claude') {
|
|
356
356
|
args.push('--print');
|
|
357
|
-
|
|
357
|
+
const permissionMode = options.cliPermissions?.claude || 'acceptEdits';
|
|
358
|
+
args.push('--permission-mode', permissionMode);
|
|
358
359
|
args.push('--output-format', 'json');
|
|
359
360
|
// Input via stdin
|
|
360
361
|
} else if (baseCmd === 'gemini') {
|
|
361
|
-
|
|
362
|
+
const approvalMode = options.cliPermissions?.gemini || 'auto_edit';
|
|
363
|
+
args.push('--approval-mode', approvalMode);
|
|
362
364
|
args.push('--output-format', 'json');
|
|
363
365
|
// Input via stdin
|
|
364
366
|
} else if (baseCmd === 'codex') {
|
|
365
367
|
ensureCodexExec();
|
|
368
|
+
const bypassMode = options.cliPermissions?.codex;
|
|
369
|
+
if (bypassMode === 'bypass') {
|
|
370
|
+
args.push('--dangerously-bypass-approvals-and-sandbox');
|
|
371
|
+
}
|
|
366
372
|
args.push('--json');
|
|
367
373
|
args.push('-'); // Explicitly read from stdin
|
|
368
374
|
} else {
|
|
@@ -581,7 +587,12 @@ export async function llm(context, options) {
|
|
|
581
587
|
result = await executeAPI(provider, model, fullPrompt, apiKey, options);
|
|
582
588
|
} else {
|
|
583
589
|
// CLI execution - pass fullPrompt string directly
|
|
584
|
-
|
|
590
|
+
// Include cliPermissions from config if available
|
|
591
|
+
const cliOptions = {
|
|
592
|
+
...options,
|
|
593
|
+
cliPermissions: config.cliPermissions || {}
|
|
594
|
+
};
|
|
595
|
+
result = await executeCLI(modelConfig, fullPrompt, cliOptions, apiKeys);
|
|
585
596
|
}
|
|
586
597
|
|
|
587
598
|
// Record usage in agent tracker (if active)
|
package/lib/runtime/prompt.js
CHANGED
|
@@ -105,7 +105,7 @@ export async function askHuman(question, options = {}) {
|
|
|
105
105
|
await runtime.prependHistory({
|
|
106
106
|
event: 'PROMPT_ANSWERED',
|
|
107
107
|
slug,
|
|
108
|
-
answer: normalizedAnswer
|
|
108
|
+
answer: normalizedAnswer
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
return normalizedAnswer;
|
package/lib/runtime/runtime.js
CHANGED
|
@@ -87,7 +87,14 @@ export class WorkflowRuntime {
|
|
|
87
87
|
// Full-auto mode (auto-select first option for choice interactions)
|
|
88
88
|
fullAuto: false,
|
|
89
89
|
maxQuickFixAttempts: 10,
|
|
90
|
-
autoSelectDelay: 20 // seconds before auto-selecting in full-auto mode
|
|
90
|
+
autoSelectDelay: 20, // seconds before auto-selecting in full-auto mode
|
|
91
|
+
// CLI permission modes (configurable per tool)
|
|
92
|
+
cliPermissions: {
|
|
93
|
+
claude: 'acceptEdits',
|
|
94
|
+
gemini: 'auto_edit'
|
|
95
|
+
},
|
|
96
|
+
// Protected paths - prevents DELETION only (modifications allowed)
|
|
97
|
+
protectedPaths: []
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
// Load steering
|
|
@@ -384,6 +391,7 @@ export class WorkflowRuntime {
|
|
|
384
391
|
const cfg = configModule.config || configModule.default || {};
|
|
385
392
|
// Preserve CLI-set fullAuto (it takes precedence over config.js)
|
|
386
393
|
const cliFullAuto = this.workflowConfig.fullAuto;
|
|
394
|
+
const defaultCliPermissions = { claude: 'acceptEdits', gemini: 'auto_edit' };
|
|
387
395
|
this.workflowConfig = {
|
|
388
396
|
models: cfg.models || {},
|
|
389
397
|
apiKeys: cfg.apiKeys || {},
|
|
@@ -396,7 +404,11 @@ export class WorkflowRuntime {
|
|
|
396
404
|
// Full-auto mode: CLI flag takes precedence, then config.js, then default false
|
|
397
405
|
fullAuto: cliFullAuto || cfg.fullAuto || false,
|
|
398
406
|
maxQuickFixAttempts: cfg.maxQuickFixAttempts ?? 10,
|
|
399
|
-
autoSelectDelay: cfg.autoSelectDelay ?? this.workflowConfig.autoSelectDelay // seconds before auto-selecting
|
|
407
|
+
autoSelectDelay: cfg.autoSelectDelay ?? this.workflowConfig.autoSelectDelay, // seconds before auto-selecting
|
|
408
|
+
// CLI permission modes (merge with defaults)
|
|
409
|
+
cliPermissions: { ...defaultCliPermissions, ...(cfg.cliPermissions || {}) },
|
|
410
|
+
// Protected paths - prevents DELETION only (modifications allowed)
|
|
411
|
+
protectedPaths: cfg.protectedPaths || []
|
|
400
412
|
};
|
|
401
413
|
|
|
402
414
|
// Import workflow module
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import path from 'path';
|
|
10
|
+
import { execSync } from 'child_process';
|
|
10
11
|
import {
|
|
11
12
|
captureBaseline,
|
|
12
13
|
detectChanges,
|
|
@@ -38,9 +39,52 @@ export async function withChangeTracking(runtime, agentName, fn) {
|
|
|
38
39
|
// Detect changes made during agent execution
|
|
39
40
|
const changes = await detectChanges(projectRoot, baseline, ignorePatterns);
|
|
40
41
|
|
|
42
|
+
// Validate protected paths (only checks deletions)
|
|
43
|
+
const validation = validateProtectedPaths(runtime, changes);
|
|
44
|
+
if (!validation.valid) {
|
|
45
|
+
console.warn(`[protected-paths] Violations detected by agent '${agentName}':`);
|
|
46
|
+
validation.violations.forEach(v => console.warn(` - ${v}`));
|
|
47
|
+
throw new Error(`Protected path violations: ${validation.violations.join(', ')}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
// Update fileTree with detected changes
|
|
42
51
|
applyChangesToFileTree(runtime, changes, agentName);
|
|
43
52
|
|
|
53
|
+
// Log git diff to history when files change
|
|
54
|
+
if (changes.created.length || changes.modified.length || changes.deleted.length) {
|
|
55
|
+
try {
|
|
56
|
+
const diff = execSync('git diff HEAD', {
|
|
57
|
+
cwd: projectRoot,
|
|
58
|
+
encoding: 'utf-8',
|
|
59
|
+
maxBuffer: 1024 * 1024 // 1MB limit
|
|
60
|
+
}).trim();
|
|
61
|
+
|
|
62
|
+
if (diff) {
|
|
63
|
+
await runtime.prependHistory({
|
|
64
|
+
type: 'file_changes',
|
|
65
|
+
agent: agentName,
|
|
66
|
+
summary: {
|
|
67
|
+
created: changes.created.length,
|
|
68
|
+
modified: changes.modified.length,
|
|
69
|
+
deleted: changes.deleted.length
|
|
70
|
+
},
|
|
71
|
+
diff: diff.slice(0, 50000) // Truncate if too large
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
} catch (e) {
|
|
75
|
+
// Git diff failed, log summary only
|
|
76
|
+
await runtime.prependHistory({
|
|
77
|
+
type: 'file_changes',
|
|
78
|
+
agent: agentName,
|
|
79
|
+
summary: {
|
|
80
|
+
created: changes.created.length,
|
|
81
|
+
modified: changes.modified.length,
|
|
82
|
+
deleted: changes.deleted.length
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
44
88
|
// Merge _files annotations if present (preserves existing data unless explicitly overwritten)
|
|
45
89
|
if (result && typeof result === 'object' && Array.isArray(result._files)) {
|
|
46
90
|
mergeAnnotations(runtime, result._files);
|
|
@@ -49,6 +93,46 @@ export async function withChangeTracking(runtime, agentName, fn) {
|
|
|
49
93
|
return result;
|
|
50
94
|
}
|
|
51
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Validate that protected paths were not deleted.
|
|
98
|
+
* Only checks for DELETIONS - modifications are allowed.
|
|
99
|
+
*
|
|
100
|
+
* @param {Object} runtime - The workflow runtime instance
|
|
101
|
+
* @param {Object} changes - Detected changes { created, modified, deleted, renamed }
|
|
102
|
+
* @returns {{ valid: boolean, violations: string[] }}
|
|
103
|
+
*/
|
|
104
|
+
export function validateProtectedPaths(runtime, changes) {
|
|
105
|
+
const protectedPaths = runtime.workflowConfig.protectedPaths || [];
|
|
106
|
+
const violations = [];
|
|
107
|
+
|
|
108
|
+
// Only check DELETED files - modifications are allowed
|
|
109
|
+
for (const deleted of changes.deleted || []) {
|
|
110
|
+
for (const pattern of protectedPaths) {
|
|
111
|
+
if (matchesPattern(deleted, pattern)) {
|
|
112
|
+
violations.push(`Cannot delete protected file: ${deleted}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return { valid: violations.length === 0, violations };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Simple pattern matching for protected paths.
|
|
122
|
+
* Supports exact match and prefix wildcards (e.g., '.env*' matches '.env', '.env.local')
|
|
123
|
+
*/
|
|
124
|
+
function matchesPattern(filePath, pattern) {
|
|
125
|
+
// Normalize both for comparison
|
|
126
|
+
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
127
|
+
const normalizedPattern = pattern.replace(/\\/g, '/');
|
|
128
|
+
|
|
129
|
+
if (normalizedPattern.endsWith('*')) {
|
|
130
|
+
// Prefix wildcard: '.env*' matches '.env', '.env.local', etc.
|
|
131
|
+
return normalizedPath.startsWith(normalizedPattern.slice(0, -1));
|
|
132
|
+
}
|
|
133
|
+
return normalizedPath === normalizedPattern;
|
|
134
|
+
}
|
|
135
|
+
|
|
52
136
|
/**
|
|
53
137
|
* Apply detected file changes to the runtime's fileTree.
|
|
54
138
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
model: high
|
|
3
3
|
format: json
|
|
4
|
+
description: "Code phase: Implements the task by writing production code and tests"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Code Writer Agent
|
|
@@ -9,6 +10,11 @@ You are a senior software developer. Implement the task according to specificati
|
|
|
9
10
|
|
|
10
11
|
## Instructions
|
|
11
12
|
|
|
13
|
+
**IMPORTANT: Use your file tools to create and write files directly to disk.** Do not embed code in JSON. Use your native file creation capabilities to:
|
|
14
|
+
1. Create directories as needed
|
|
15
|
+
2. Write each file with full production code
|
|
16
|
+
3. Report what files you created
|
|
17
|
+
|
|
12
18
|
Implement the task following these principles:
|
|
13
19
|
|
|
14
20
|
**Code Quality:**
|
|
@@ -33,22 +39,14 @@ Implement the task following these principles:
|
|
|
33
39
|
|
|
34
40
|
## Output Format
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
After writing all files to disk using your file tools, return a valid JSON object:
|
|
37
43
|
|
|
38
44
|
{
|
|
39
45
|
"implementation": {
|
|
40
46
|
"summary": "Brief description of what was implemented",
|
|
41
|
-
"
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
"purpose": "Main implementation",
|
|
45
|
-
"code": "// Full code content here\nfunction example() {\n return 'hello';\n}"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "src/feature.test.js",
|
|
49
|
-
"purpose": "Test file",
|
|
50
|
-
"code": "// Test code here\ndescribe('feature', () => {\n it('works', () => {});\n});"
|
|
51
|
-
}
|
|
47
|
+
"filesWritten": [
|
|
48
|
+
{"path": "src/feature.js", "purpose": "Main implementation"},
|
|
49
|
+
{"path": "src/feature.test.js", "purpose": "Test file"}
|
|
52
50
|
],
|
|
53
51
|
"dependencies": [
|
|
54
52
|
{"name": "lodash", "version": "^4.17.21", "reason": "Utility functions"}
|
|
@@ -65,3 +63,11 @@ Return a valid JSON object:
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
Write production-quality code. This is not a prototype.
|
|
66
|
+
|
|
67
|
+
## Safeguards
|
|
68
|
+
|
|
69
|
+
**NEVER modify or remove:**
|
|
70
|
+
- `.env` or `.env.*` files
|
|
71
|
+
- The `agent-state-machine` dependency in `package.json`
|
|
72
|
+
|
|
73
|
+
You may add new dependencies but must preserve existing critical ones.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: high
|
|
3
|
+
format: json
|
|
4
|
+
description: "Post-code phase: Fixes issues found during review or sanity checks"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Fixer Agent
|
|
8
|
+
|
|
9
|
+
You fix specific issues in existing code based on sanity check failures.
|
|
10
|
+
|
|
11
|
+
## How to Fix
|
|
12
|
+
|
|
13
|
+
**IMPORTANT: Use your file tools to read and write files directly.**
|
|
14
|
+
|
|
15
|
+
1. Read the file(s) that need fixing using your file tools
|
|
16
|
+
2. Analyze the error and identify the root cause
|
|
17
|
+
3. Apply the fix by writing the corrected file back to disk
|
|
18
|
+
4. Report what you fixed
|
|
19
|
+
|
|
20
|
+
## Critical Guidelines
|
|
21
|
+
|
|
22
|
+
**DO NOT** disable, skip, or remove failing tests to make them pass.
|
|
23
|
+
Your fixes must address the actual underlying code issues that cause tests to fail.
|
|
24
|
+
|
|
25
|
+
- Never add `.skip()`, `.todo()`, or comment out tests
|
|
26
|
+
- Never modify test expectations to match broken behavior
|
|
27
|
+
- Never delete test files or test cases
|
|
28
|
+
- Never wrap tests in `try/catch` to swallow errors
|
|
29
|
+
- Fix the implementation code to pass existing tests
|
|
30
|
+
- Fix test setup/teardown issues if the tests themselves are misconfigured
|
|
31
|
+
- Update tests ONLY if the original requirements were misunderstood
|
|
32
|
+
|
|
33
|
+
If the issue truly cannot be fixed within the current architecture, set `"confidence": "low"` and explain why in the analysis.
|
|
34
|
+
|
|
35
|
+
## Input
|
|
36
|
+
- task: Task definition
|
|
37
|
+
- failedChecks: Failed checks with specific errors
|
|
38
|
+
- filePaths: Paths to files that may need fixing
|
|
39
|
+
|
|
40
|
+
## Output Format
|
|
41
|
+
|
|
42
|
+
After fixing the files using your file tools, return:
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
"analysis": {
|
|
46
|
+
"rootCauses": ["What caused each failure"],
|
|
47
|
+
"fixApproach": "Strategy for fixing"
|
|
48
|
+
},
|
|
49
|
+
"fixesApplied": [
|
|
50
|
+
{
|
|
51
|
+
"path": "src/feature.js",
|
|
52
|
+
"description": "Fixed the validation logic to handle edge case"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"expectedResolutions": ["Which checks should now pass"],
|
|
56
|
+
"confidence": "high|medium|low"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Focus on minimal, targeted fixes. Don't rewrite entire files unless necessary.
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
model: high
|
|
3
3
|
format: json
|
|
4
|
+
description: "Post-code phase: Reviews implementation for quality and correctness"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Code Reviewer Agent
|
|
7
8
|
|
|
8
9
|
You are a senior code reviewer. Review implementations for quality, correctness, and best practices.
|
|
9
10
|
|
|
11
|
+
## How to Review
|
|
12
|
+
|
|
13
|
+
**Use your file tools to read the files that need reviewing.** You will receive a list of file paths to review. Read each file's contents directly from disk to perform your review.
|
|
14
|
+
|
|
10
15
|
## Instructions
|
|
11
16
|
|
|
12
17
|
Perform a thorough code review covering:
|
|
@@ -33,6 +38,11 @@ Perform a thorough code review covering:
|
|
|
33
38
|
- Are tests meaningful (not just coverage padding)?
|
|
34
39
|
- Are edge cases tested?
|
|
35
40
|
|
|
41
|
+
## Input
|
|
42
|
+
- task: Task definition with title and description
|
|
43
|
+
- filesToReview: Array of file paths to review
|
|
44
|
+
- implementationSummary: Brief description of what was implemented
|
|
45
|
+
|
|
36
46
|
## Output Format
|
|
37
47
|
|
|
38
48
|
Return a valid JSON object:
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: med
|
|
3
|
+
format: json
|
|
4
|
+
description: "Post-code phase: Audits implementation for security vulnerabilities"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Post-Code Security Auditor Agent
|
|
8
|
+
|
|
9
|
+
You are a security auditor. Review implemented code to identify security vulnerabilities and verify secure coding practices.
|
|
10
|
+
|
|
11
|
+
## How to Audit
|
|
12
|
+
|
|
13
|
+
**Use your file tools to read the files that need auditing.** You will receive a list of file paths. Read each file's contents directly from disk to perform your security audit.
|
|
14
|
+
|
|
15
|
+
## Instructions
|
|
16
|
+
|
|
17
|
+
Perform a post-implementation security audit:
|
|
18
|
+
|
|
19
|
+
- Review the implementation for security issues
|
|
20
|
+
- Check for common vulnerabilities (OWASP Top 10)
|
|
21
|
+
- Verify secure coding practices
|
|
22
|
+
- Identify any remaining security debt
|
|
23
|
+
- Verify pre-code security recommendations were followed
|
|
24
|
+
|
|
25
|
+
## Output Format
|
|
26
|
+
|
|
27
|
+
Return a valid JSON object:
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
"riskLevel": "low",
|
|
31
|
+
"findings": [
|
|
32
|
+
{
|
|
33
|
+
"type": "vulnerability",
|
|
34
|
+
"severity": "high",
|
|
35
|
+
"location": "src/auth.js:42",
|
|
36
|
+
"description": "User input not sanitized before database query",
|
|
37
|
+
"recommendation": "Use parameterized query instead"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"checklistResults": [
|
|
41
|
+
{"item": "Input validation implemented", "status": "passed"},
|
|
42
|
+
{"item": "SQL injection prevented", "status": "passed"},
|
|
43
|
+
{"item": "Authentication tokens secured", "status": "failed"}
|
|
44
|
+
],
|
|
45
|
+
"securityDebt": [
|
|
46
|
+
"Consider adding rate limiting in future iteration"
|
|
47
|
+
],
|
|
48
|
+
"approved": true,
|
|
49
|
+
"blockers": []
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
**Severity levels:** critical, high, medium, low, info
|
|
53
|
+
**Status values:** passed, failed, na
|
|
54
|
+
|
|
55
|
+
Critical and high severity findings should set approved: false and be listed in blockers.
|
|
@@ -1,34 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
model: med
|
|
3
3
|
format: json
|
|
4
|
+
description: "Pre-code phase: Analyzes security risks before implementation starts"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Security Reviewer Agent
|
|
7
|
+
# Pre-Code Security Reviewer Agent
|
|
7
8
|
|
|
8
|
-
You are a security
|
|
9
|
+
You are a security threat analyst. Analyze tasks BEFORE implementation to identify security risks and recommend secure patterns.
|
|
9
10
|
|
|
10
11
|
## Instructions
|
|
11
12
|
|
|
12
|
-
Perform a security
|
|
13
|
+
Perform a pre-implementation security analysis:
|
|
13
14
|
|
|
14
|
-
**Pre-Implementation Review (stage: pre-implementation):**
|
|
15
15
|
- Identify potential security concerns for the task
|
|
16
16
|
- Recommend secure implementation patterns
|
|
17
17
|
- Flag any high-risk areas requiring extra attention
|
|
18
18
|
- Suggest security tests to include
|
|
19
19
|
|
|
20
|
-
**Post-Implementation Review (stage: post-implementation):**
|
|
21
|
-
- Review the implementation for security issues
|
|
22
|
-
- Check for common vulnerabilities (OWASP Top 10)
|
|
23
|
-
- Verify secure coding practices
|
|
24
|
-
- Identify any remaining security debt
|
|
25
|
-
|
|
26
20
|
## Output Format
|
|
27
21
|
|
|
28
22
|
Return a valid JSON object:
|
|
29
23
|
|
|
30
24
|
{
|
|
31
|
-
"stage": "pre-implementation",
|
|
32
25
|
"riskLevel": "low",
|
|
33
26
|
"findings": [
|
|
34
27
|
{
|
|
@@ -43,6 +36,10 @@ Return a valid JSON object:
|
|
|
43
36
|
{"item": "Use parameterized queries", "status": "pending"},
|
|
44
37
|
{"item": "Implement rate limiting", "status": "na"}
|
|
45
38
|
],
|
|
39
|
+
"suggestedTests": [
|
|
40
|
+
"Test for SQL injection with malicious input",
|
|
41
|
+
"Verify authentication token validation"
|
|
42
|
+
],
|
|
46
43
|
"approved": true,
|
|
47
44
|
"blockers": []
|
|
48
45
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
model: fast
|
|
3
|
+
format: json
|
|
4
|
+
description: "Verify phase: Generates conventional commit message after task completion"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Commit Message Generator Agent
|
|
8
|
+
|
|
9
|
+
You generate conventional commit messages for completed tasks.
|
|
10
|
+
|
|
11
|
+
## Input
|
|
12
|
+
- task: { title, description }
|
|
13
|
+
- filesWritten: Array of { path, purpose } for files created/modified
|
|
14
|
+
|
|
15
|
+
## Output Format
|
|
16
|
+
|
|
17
|
+
Return a valid JSON object:
|
|
18
|
+
|
|
19
|
+
{
|
|
20
|
+
"type": "feat",
|
|
21
|
+
"scope": "auth",
|
|
22
|
+
"message": "add user login functionality",
|
|
23
|
+
"body": "Implements login form with email/password validation.\nAdds JWT token storage and refresh logic."
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
## Commit Type Guidelines
|
|
27
|
+
|
|
28
|
+
- **feat**: New feature for the user
|
|
29
|
+
- **fix**: Bug fix for the user
|
|
30
|
+
- **refactor**: Code change that neither fixes a bug nor adds a feature
|
|
31
|
+
- **test**: Adding or updating tests
|
|
32
|
+
- **docs**: Documentation only changes
|
|
33
|
+
- **style**: Formatting, missing semicolons, etc (no code change)
|
|
34
|
+
- **chore**: Updating build tasks, configs, etc
|
|
35
|
+
|
|
36
|
+
## Message Guidelines
|
|
37
|
+
|
|
38
|
+
- Use imperative mood ("add" not "added" or "adds")
|
|
39
|
+
- Keep first line under 72 characters
|
|
40
|
+
- Scope is optional but recommended (component/module name)
|
|
41
|
+
- Body should explain what and why, not how
|
|
42
|
+
- Reference file changes in body when helpful
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
Task: "Implement user authentication"
|
|
47
|
+
Files: [{ path: "src/auth.js", purpose: "Auth module" }]
|
|
48
|
+
Output:
|
|
49
|
+
{
|
|
50
|
+
"type": "feat",
|
|
51
|
+
"scope": "auth",
|
|
52
|
+
"message": "implement user authentication",
|
|
53
|
+
"body": "Adds login/logout functionality with JWT tokens.\n\nFiles:\n- src/auth.js: Core auth module"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Task: "Fix login validation bug"
|
|
57
|
+
Files: [{ path: "src/auth.js", purpose: "Fix validation" }]
|
|
58
|
+
Output:
|
|
59
|
+
{
|
|
60
|
+
"type": "fix",
|
|
61
|
+
"scope": "auth",
|
|
62
|
+
"message": "correct email validation regex",
|
|
63
|
+
"body": "Email validation was rejecting valid addresses with + symbols."
|
|
64
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
model: fast
|
|
3
3
|
format: json
|
|
4
|
+
description: "Verify phase: Generates executable sanity checks to validate implementation"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
You generate executable sanity checks for the implemented task.
|
|
@@ -37,15 +38,3 @@ Guidelines:
|
|
|
37
38
|
- Include at least one file_exists or file_contains check when files are created/modified.
|
|
38
39
|
- If tests exist (from testPlan or implementation), include a type "test_suite" check.
|
|
39
40
|
- Use testFramework.command for running tests (optionally target specific files when possible).
|
|
40
|
-
|
|
41
|
-
Task:
|
|
42
|
-
{{task}}
|
|
43
|
-
|
|
44
|
-
Implementation:
|
|
45
|
-
{{implementation}}
|
|
46
|
-
|
|
47
|
-
Test Plan:
|
|
48
|
-
{{testPlan}}
|
|
49
|
-
|
|
50
|
-
Test Framework:
|
|
51
|
-
{{testFramework}}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const config = {
|
|
2
2
|
models: {
|
|
3
|
-
fast: "gemini
|
|
4
|
-
low: "gemini
|
|
5
|
-
med: "gemini
|
|
6
|
-
high: "gemini
|
|
3
|
+
fast: "gemini-2.5-flash",
|
|
4
|
+
low: "gemini-2.5-flash",
|
|
5
|
+
med: "gemini-2.5-flash",
|
|
6
|
+
high: "gemini-2.5-flash",
|
|
7
7
|
},
|
|
8
8
|
apiKeys: {
|
|
9
9
|
gemini: process.env.GEMINI_API_KEY,
|
|
@@ -11,6 +11,17 @@ export const config = {
|
|
|
11
11
|
openai: process.env.OPENAI_API_KEY,
|
|
12
12
|
},
|
|
13
13
|
|
|
14
|
+
// CLI permission modes - enables native file access for agents
|
|
15
|
+
cliPermissions: {
|
|
16
|
+
claude: 'bypassPermissions', // --permission-mode bypassPermissions
|
|
17
|
+
gemini: 'full', // --approval-mode full
|
|
18
|
+
codex: 'bypass' // --dangerously-bypass-approvals-and-sandbox
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Protected paths - prevents DELETION only (modifications allowed)
|
|
22
|
+
// Files matching these patterns cannot be deleted by agents
|
|
23
|
+
protectedPaths: ['.env', '.env.*', 'package.json'],
|
|
24
|
+
|
|
14
25
|
// File tracking (all optional - shown with defaults)
|
|
15
26
|
// projectRoot: process.env.PROJECT_ROOT, // Defaults to ../.. from workflow
|
|
16
27
|
// fileTracking: true, // Enable/disable file tracking
|