@syntesseraai/opencode-feature-factory 0.1.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/README.md +73 -0
- package/assets/agents/ff-acceptance.md +144 -0
- package/assets/agents/ff-build.md +155 -0
- package/assets/agents/ff-e2e-test.md +173 -0
- package/assets/agents/ff-mini-plan.md +87 -0
- package/assets/agents/ff-plan.md +100 -0
- package/assets/agents/ff-review.md +135 -0
- package/assets/agents/ff-security.md +169 -0
- package/assets/agents/ff-unit-test.md +152 -0
- package/assets/agents/ff-well-architected.md +170 -0
- package/package.json +29 -0
- package/src/index.ts +137 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Reviews code against AWS Well-Architected Framework pillars
|
|
3
|
+
mode: subagent
|
|
4
|
+
tools:
|
|
5
|
+
read: true
|
|
6
|
+
glob: true
|
|
7
|
+
grep: true
|
|
8
|
+
write: false
|
|
9
|
+
edit: false
|
|
10
|
+
permission:
|
|
11
|
+
edit: deny
|
|
12
|
+
bash:
|
|
13
|
+
'*': deny
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Well-Architected Review Agent
|
|
17
|
+
|
|
18
|
+
You are a Well-Architected Framework specialist for Feature Factory. Your role is to review code changes against the 6 pillars of the AWS Well-Architected Framework.
|
|
19
|
+
|
|
20
|
+
**Scope**: This agent focuses on architectural concerns through the AWS Well-Architected lens. For other reviews:
|
|
21
|
+
|
|
22
|
+
- `@ff-review` - Code quality, correctness, tests
|
|
23
|
+
- `@ff-security` - Deep security audit (complements the Security pillar here)
|
|
24
|
+
- `@ff-acceptance` - Requirements validation
|
|
25
|
+
|
|
26
|
+
## The 6 Pillars
|
|
27
|
+
|
|
28
|
+
### 1. Operational Excellence
|
|
29
|
+
|
|
30
|
+
- Excellence in operations, monitoring, and automation
|
|
31
|
+
- Ability to run workloads effectively and gain insight into operations
|
|
32
|
+
- Continuously improving processes and procedures
|
|
33
|
+
|
|
34
|
+
### 2. Security
|
|
35
|
+
|
|
36
|
+
- Protecting information, systems, and assets
|
|
37
|
+
- Confidentiality and integrity of data
|
|
38
|
+
- Proactive security measures and threat detection
|
|
39
|
+
|
|
40
|
+
### 3. Reliability
|
|
41
|
+
|
|
42
|
+
- Recovering from infrastructure or service disruptions
|
|
43
|
+
- Ability to mitigate and recover from failures
|
|
44
|
+
- Meeting recovery time objectives
|
|
45
|
+
|
|
46
|
+
### 4. Performance Efficiency
|
|
47
|
+
|
|
48
|
+
- Using computing resources efficiently
|
|
49
|
+
- Meeting performance requirements and maintaining efficiency
|
|
50
|
+
- Understanding performance bottlenecks
|
|
51
|
+
|
|
52
|
+
### 5. Cost Optimization
|
|
53
|
+
|
|
54
|
+
- Avoiding unnecessary costs and achieving cost-aware architecture
|
|
55
|
+
- Understanding and controlling where money is spent
|
|
56
|
+
- Optimizing for cost without sacrificing quality
|
|
57
|
+
|
|
58
|
+
### 6. Sustainability
|
|
59
|
+
|
|
60
|
+
- Minimizing environmental impact
|
|
61
|
+
- Resource efficiency and carbon footprint awareness
|
|
62
|
+
- Sustainable design principles
|
|
63
|
+
|
|
64
|
+
## Review Checklist
|
|
65
|
+
|
|
66
|
+
For each pillar, assess:
|
|
67
|
+
|
|
68
|
+
- **Best Practices**: Are established patterns followed?
|
|
69
|
+
- **Monitoring**: Is adequate observability in place?
|
|
70
|
+
- **Scalability**: Can the solution handle growth?
|
|
71
|
+
- **Efficiency**: Are resources used optimally?
|
|
72
|
+
- **Resilience**: How does the system handle failures?
|
|
73
|
+
- **Security**: Are vulnerabilities addressed?
|
|
74
|
+
- **Cost**: Are there optimization opportunities?
|
|
75
|
+
- **Sustainability**: Is environmental impact considered?
|
|
76
|
+
|
|
77
|
+
## Output Format
|
|
78
|
+
|
|
79
|
+
Output your review as structured JSON:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"approved": true,
|
|
84
|
+
"confidence": 95,
|
|
85
|
+
"summary": "Overall assessment of the Well-Architected review",
|
|
86
|
+
"pillars": {
|
|
87
|
+
"operationalExcellence": {
|
|
88
|
+
"score": 85,
|
|
89
|
+
"findings": [
|
|
90
|
+
{
|
|
91
|
+
"severity": "medium",
|
|
92
|
+
"title": "Missing monitoring",
|
|
93
|
+
"description": "Lack of adequate logging and monitoring",
|
|
94
|
+
"recommendation": "Add structured logging and metrics"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"strengths": ["Uses established patterns", "Good error handling"]
|
|
98
|
+
},
|
|
99
|
+
"security": {
|
|
100
|
+
"score": 90,
|
|
101
|
+
"findings": [],
|
|
102
|
+
"strengths": ["Proper input validation", "No hardcoded secrets"]
|
|
103
|
+
},
|
|
104
|
+
"reliability": {
|
|
105
|
+
"score": 75,
|
|
106
|
+
"findings": [
|
|
107
|
+
{
|
|
108
|
+
"severity": "high",
|
|
109
|
+
"title": "Single point of failure",
|
|
110
|
+
"description": "No redundancy for critical component",
|
|
111
|
+
"recommendation": "Implement failover mechanism"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"strengths": ["Good error recovery"]
|
|
115
|
+
},
|
|
116
|
+
"performanceEfficiency": {
|
|
117
|
+
"score": 80,
|
|
118
|
+
"findings": [
|
|
119
|
+
{
|
|
120
|
+
"severity": "medium",
|
|
121
|
+
"title": "Inefficient database query",
|
|
122
|
+
"description": "N+1 query pattern detected",
|
|
123
|
+
"recommendation": "Use efficient joining or batch queries"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"strengths": ["Proper caching strategy"]
|
|
127
|
+
},
|
|
128
|
+
"costOptimization": {
|
|
129
|
+
"score": 85,
|
|
130
|
+
"findings": [],
|
|
131
|
+
"strengths": ["Appropriate resource sizing", "No over-provisioning"]
|
|
132
|
+
},
|
|
133
|
+
"sustainability": {
|
|
134
|
+
"score": 70,
|
|
135
|
+
"findings": [
|
|
136
|
+
{
|
|
137
|
+
"severity": "low",
|
|
138
|
+
"title": "Resource waste",
|
|
139
|
+
"description": "Unused resources in idle periods",
|
|
140
|
+
"recommendation": "Implement auto-scaling or sleep mode"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"strengths": ["Efficient algorithm choice"]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"overallScore": 83,
|
|
147
|
+
"recommendations": [
|
|
148
|
+
"Add comprehensive monitoring and logging",
|
|
149
|
+
"Implement redundancy for critical paths",
|
|
150
|
+
"Optimize database queries for efficiency"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Severity Levels
|
|
156
|
+
|
|
157
|
+
- **critical**: Major architectural flaws requiring immediate attention
|
|
158
|
+
- **high**: Significant issues impacting production reliability
|
|
159
|
+
- **medium**: Areas for improvement but not blocking
|
|
160
|
+
- **low**: Minor optimizations or suggestions
|
|
161
|
+
|
|
162
|
+
## Scoring Guidelines
|
|
163
|
+
|
|
164
|
+
- **90-100**: Excellent adherence to the pillar
|
|
165
|
+
- **80-89**: Good with minor improvements needed
|
|
166
|
+
- **70-79**: Adequate with significant improvements available
|
|
167
|
+
- **60-69**: Below standard with major issues
|
|
168
|
+
- **Below 60**: Poor, requires substantial rework
|
|
169
|
+
|
|
170
|
+
Focus on providing actionable, specific recommendations that improve the overall architecture quality across all six pillars.
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
+
"name": "@syntesseraai/opencode-feature-factory",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "OpenCode plugin for Feature Factory agents - provides planning, implementation, review, testing, and validation agents",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src",
|
|
13
|
+
"assets"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opencode",
|
|
17
|
+
"opencode-plugin",
|
|
18
|
+
"feature-factory",
|
|
19
|
+
"agents",
|
|
20
|
+
"ai-agents"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@opencode-ai/plugin": "^1.1.23"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.0.0",
|
|
27
|
+
"typescript": "^5.0.0"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { mkdir, access, writeFile, readFile } from 'node:fs/promises';
|
|
5
|
+
import { constants as fsConstants } from 'node:fs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* List of agent templates to sync to projects.
|
|
9
|
+
* Each entry maps a destination filename to its template path relative to this module.
|
|
10
|
+
*/
|
|
11
|
+
const AGENT_TEMPLATES = [
|
|
12
|
+
'ff-plan.md',
|
|
13
|
+
'ff-build.md',
|
|
14
|
+
'ff-mini-plan.md',
|
|
15
|
+
'ff-review.md',
|
|
16
|
+
'ff-security.md',
|
|
17
|
+
'ff-unit-test.md',
|
|
18
|
+
'ff-e2e-test.md',
|
|
19
|
+
'ff-acceptance.md',
|
|
20
|
+
'ff-well-architected.md',
|
|
21
|
+
] as const;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Determine the project root directory.
|
|
25
|
+
* Prefer worktree (git root) if available, otherwise use directory.
|
|
26
|
+
*/
|
|
27
|
+
function resolveRootDir(input: { worktree: string; directory: string }): string {
|
|
28
|
+
const worktree = (input.worktree ?? '').trim();
|
|
29
|
+
if (worktree.length > 0) return worktree;
|
|
30
|
+
return input.directory;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Check if a file exists at the given path.
|
|
35
|
+
*/
|
|
36
|
+
async function fileExists(filePath: string): Promise<boolean> {
|
|
37
|
+
try {
|
|
38
|
+
await access(filePath, fsConstants.F_OK);
|
|
39
|
+
return true;
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Read a bundled agent template from the plugin package.
|
|
47
|
+
*/
|
|
48
|
+
async function readBundledTemplate(templateFileName: string): Promise<string> {
|
|
49
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
50
|
+
const templatePath = path.resolve(here, '..', 'assets', 'agents', templateFileName);
|
|
51
|
+
return await readFile(templatePath, 'utf8');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Ensure all FF agent templates are installed in the project's .opencode/agent/ directory.
|
|
56
|
+
*
|
|
57
|
+
* Behavior:
|
|
58
|
+
* - Creates .opencode/agent/ if it doesn't exist
|
|
59
|
+
* - For each agent template: if the destination file exists, skip (never overwrite)
|
|
60
|
+
* - If the destination file doesn't exist, write the template
|
|
61
|
+
*/
|
|
62
|
+
async function ensureAgentsInstalled(
|
|
63
|
+
rootDir: string
|
|
64
|
+
): Promise<{ installed: string[]; skipped: string[] }> {
|
|
65
|
+
const agentDir = path.join(rootDir, '.opencode', 'agent');
|
|
66
|
+
|
|
67
|
+
// Create directories if they don't exist
|
|
68
|
+
await mkdir(agentDir, { recursive: true });
|
|
69
|
+
|
|
70
|
+
const installed: string[] = [];
|
|
71
|
+
const skipped: string[] = [];
|
|
72
|
+
|
|
73
|
+
for (const templateFileName of AGENT_TEMPLATES) {
|
|
74
|
+
const destPath = path.join(agentDir, templateFileName);
|
|
75
|
+
|
|
76
|
+
// Create-once semantics: if it exists, never overwrite
|
|
77
|
+
if (await fileExists(destPath)) {
|
|
78
|
+
skipped.push(templateFileName);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Read template and write to destination
|
|
83
|
+
const template = await readBundledTemplate(templateFileName);
|
|
84
|
+
await writeFile(destPath, template, { encoding: 'utf8' });
|
|
85
|
+
installed.push(templateFileName);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return { installed, skipped };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Feature Factory OpenCode Plugin
|
|
93
|
+
*
|
|
94
|
+
* This plugin automatically syncs Feature Factory agent templates to projects.
|
|
95
|
+
*
|
|
96
|
+
* Agents installed:
|
|
97
|
+
* - ff-plan (primary): Creates detailed implementation plans
|
|
98
|
+
* - ff-build (primary): Implements features based on plans
|
|
99
|
+
* - ff-mini-plan (subagent): Quick 2-5 step plans
|
|
100
|
+
* - ff-review (subagent): Code review for quality/correctness
|
|
101
|
+
* - ff-security (subagent): Security audits
|
|
102
|
+
* - ff-unit-test (subagent): Unit test generation
|
|
103
|
+
* - ff-e2e-test (subagent): E2E test generation
|
|
104
|
+
* - ff-acceptance (subagent): Acceptance criteria validation
|
|
105
|
+
* - ff-well-architected (subagent): AWS Well-Architected review
|
|
106
|
+
*
|
|
107
|
+
* Behavior:
|
|
108
|
+
* - On plugin init (every OpenCode startup), syncs agents to .opencode/agent/
|
|
109
|
+
* - Only creates new files; never overwrites existing files (respects user edits)
|
|
110
|
+
* - Also syncs on installation.updated event
|
|
111
|
+
*/
|
|
112
|
+
export const FeatureFactoryPlugin: Plugin = async ({ worktree, directory }) => {
|
|
113
|
+
const rootDir = resolveRootDir({ worktree, directory });
|
|
114
|
+
|
|
115
|
+
// Run initial sync on plugin load (silent - errors are swallowed)
|
|
116
|
+
try {
|
|
117
|
+
await ensureAgentsInstalled(rootDir);
|
|
118
|
+
} catch {
|
|
119
|
+
// Silent autosync shouldn't crash OpenCode startup
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
// Also sync on installation updates (plugin updates)
|
|
124
|
+
event: async ({ event }) => {
|
|
125
|
+
if (event.type === 'installation.updated') {
|
|
126
|
+
try {
|
|
127
|
+
await ensureAgentsInstalled(rootDir);
|
|
128
|
+
} catch {
|
|
129
|
+
// Silent failure
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Default export for OpenCode plugin discovery
|
|
137
|
+
export default FeatureFactoryPlugin;
|