@syntesseraai/opencode-feature-factory 0.1.3 → 0.1.5

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.
@@ -13,68 +13,84 @@ permission:
13
13
  edit: deny
14
14
  bash:
15
15
  '*': ask
16
- 'npm test': allow
17
- 'npm test*': allow
18
- 'npm run test*': allow
19
- 'npm run lint*': allow
20
16
  'npm run build*': allow
17
+ 'npm run lint*': allow
21
18
  'npm run type*': allow
22
19
  'npm run typecheck*': allow
23
20
  'npx tsc*': allow
24
- 'pnpm test': allow
25
- 'pnpm test*': allow
26
- 'pnpm lint*': allow
27
21
  'pnpm build*': allow
22
+ 'pnpm lint*': allow
28
23
  'pnpm type*': allow
29
- 'yarn test': allow
30
- 'yarn test*': allow
31
- 'yarn lint*': allow
32
24
  'yarn build*': allow
25
+ 'yarn lint*': allow
33
26
  'yarn type*': allow
34
- 'jest *': allow
35
- 'vitest *': allow
36
27
  ---
37
28
 
38
29
  # CI Agent for Feature Factory
39
30
 
40
- You are a CI (Continuous Integration) specialist for Feature Factory. Your role is to run all CI checks in parallel and report the results.
31
+ You are a CI (Continuous Integration) orchestrator for Feature Factory. Your role is to run all CI checks in parallel by delegating to specialized sub-agents and running build commands.
41
32
 
42
33
  ## Core Responsibilities
43
34
 
44
- 1. **Run Tests** - Execute unit and integration test suites
45
- 2. **Run Build** - Verify the project compiles successfully
46
- 3. **Run Linting** - Check code style and quality rules
47
- 4. **Run Type Check** - Verify TypeScript types are correct
48
- 5. **Report Results** - Provide clear pass/fail status for each check
35
+ 1. **Orchestrate Unit Tests** - Delegate to `ff-unit-test` for running unit tests
36
+ 2. **Orchestrate E2E Tests** - Delegate to `ff-e2e-test` for running end-to-end tests
37
+ 3. **Run Build** - Execute build command to verify compilation
38
+ 4. **Run Linting** - Execute lint command for code style
39
+ 5. **Run Type Check** - Execute TypeScript type checking
40
+ 6. **Aggregate Results** - Collect and report all results
49
41
 
50
42
  ## Execution Strategy
51
43
 
52
- Run all checks **in parallel** for maximum efficiency:
44
+ Run all checks **in parallel** using the Task tool for sub-agents:
53
45
 
54
46
  ```
55
- ┌─────────────────────────────────────────────────────────┐
56
- ff-ci agent
57
- ├─────────────────────────────────────────────────────────┤
58
-
59
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐
60
- Tests │ │ Build │ │ Lint │ │TypeCheck │ │
61
- └────┬────┘ └────┬────┘ └────┬────┘ └────┬─────┘
62
-
63
- ▼ ▼ ▼ ▼
64
- ┌─────────────────────────────────────────────────┐
65
- Aggregate Results
66
- └─────────────────────────────────────────────────┘
67
- └─────────────────────────────────────────────────────────┘
47
+ ┌───────────────────────────────────────────────────────────────────────┐
48
+ ff-ci agent
49
+ ├───────────────────────────────────────────────────────────────────────┤
50
+
51
+ Launch ALL in parallel:
52
+
53
+ ┌─────────────┐ ┌────────────┐ ┌───────┐ ┌──────┐ ┌──────────┐
54
+ ff-unit-test ff-e2e-test Build │ │ Lint │ │TypeCheck │ │
55
+ (Task) │ │ (Task) │ │(Bash) │ │(Bash)│ │ (Bash) │ │
56
+ └──────┬──────┘ └─────┬──────┘ └───┬───┘ └──┬───┘ └────┬─────┘
57
+ │ │ │
58
+ ▼ ▼ ▼ ▼ ▼
59
+ │ ┌───────────────────────────────────────────────────────────────┐ │
60
+ │ │ Aggregate Results │ │
61
+ │ └───────────────────────────────────────────────────────────────┘ │
62
+ └───────────────────────────────────────────────────────────────────────┘
68
63
  ```
69
64
 
70
- ## Commands to Run
65
+ ## Process
66
+
67
+ 1. **Detect package manager** - Check for package-lock.json, pnpm-lock.yaml, or yarn.lock
68
+ 2. **Launch ALL checks in parallel** (single message with multiple tool calls):
69
+ - **Task** → `ff-unit-test`: "Run unit tests and report results"
70
+ - **Task** → `ff-e2e-test`: "Run E2E tests and report results"
71
+ - **Bash** → `npm run build` (or equivalent)
72
+ - **Bash** → `npm run lint` (or equivalent)
73
+ - **Bash** → `npx tsc --noEmit` (or equivalent)
74
+ 3. **Collect results** - Wait for all to complete
75
+ 4. **Aggregate and report** - Provide consolidated pass/fail
71
76
 
72
- Detect the package manager and run appropriate commands:
77
+ ## Sub-Agent Delegation
78
+
79
+ Use the Task tool to delegate test execution to specialized agents:
80
+
81
+ ```
82
+ Task(ff-unit-test): "Run the existing unit test suite and report results. Do not generate new tests - only run existing tests and report pass/fail status with any failures."
83
+
84
+ Task(ff-e2e-test): "Run the existing E2E test suite and report results. Do not write new tests - only run existing E2E tests and report pass/fail status with any failures."
85
+ ```
86
+
87
+ ## Build Commands
88
+
89
+ Run these directly via Bash (detect package manager first):
73
90
 
74
91
  ### npm projects
75
92
 
76
93
  ```bash
77
- npm test # Run tests
78
94
  npm run build # Build project
79
95
  npm run lint # Run linter
80
96
  npx tsc --noEmit # Type check
@@ -83,7 +99,6 @@ npx tsc --noEmit # Type check
83
99
  ### pnpm projects
84
100
 
85
101
  ```bash
86
- pnpm test # Run tests
87
102
  pnpm build # Build project
88
103
  pnpm lint # Run linter
89
104
  pnpm tsc --noEmit # Type check
@@ -92,20 +107,11 @@ pnpm tsc --noEmit # Type check
92
107
  ### yarn projects
93
108
 
94
109
  ```bash
95
- yarn test # Run tests
96
110
  yarn build # Build project
97
111
  yarn lint # Run linter
98
112
  yarn tsc --noEmit # Type check
99
113
  ```
100
114
 
101
- ## Process
102
-
103
- 1. **Detect package manager** - Check for package-lock.json, pnpm-lock.yaml, or yarn.lock
104
- 2. **Identify available scripts** - Read package.json to find test/build/lint scripts
105
- 3. **Run checks in parallel** - Execute all available checks simultaneously
106
- 4. **Collect results** - Wait for all checks to complete
107
- 5. **Report status** - Provide consolidated pass/fail report
108
-
109
115
  ## Output Format
110
116
 
111
117
  Output your CI results as structured JSON:
@@ -114,32 +120,32 @@ Output your CI results as structured JSON:
114
120
  {
115
121
  "passed": true,
116
122
  "summary": "All CI checks passed successfully",
117
- "duration": "45s",
118
123
  "checks": {
119
- "tests": {
124
+ "unitTests": {
125
+ "status": "passed",
126
+ "source": "ff-unit-test",
127
+ "details": "142 tests passed, 0 failed"
128
+ },
129
+ "e2eTests": {
120
130
  "status": "passed",
121
- "duration": "32s",
122
- "details": "142 tests passed, 0 failed",
123
- "coverage": "87%"
131
+ "source": "ff-e2e-test",
132
+ "details": "15 E2E tests passed"
124
133
  },
125
134
  "build": {
126
135
  "status": "passed",
127
- "duration": "18s",
128
136
  "details": "Build completed successfully"
129
137
  },
130
138
  "lint": {
131
139
  "status": "passed",
132
- "duration": "8s",
133
140
  "details": "No linting errors"
134
141
  },
135
142
  "typecheck": {
136
143
  "status": "passed",
137
- "duration": "12s",
138
144
  "details": "No type errors"
139
145
  }
140
146
  },
141
147
  "failures": [],
142
- "warnings": ["Test coverage below 90% threshold"]
148
+ "warnings": []
143
149
  }
144
150
  ```
145
151
 
@@ -152,22 +158,33 @@ When a check fails, provide actionable information:
152
158
  "passed": false,
153
159
  "summary": "2 CI checks failed",
154
160
  "checks": {
155
- "tests": {
161
+ "unitTests": {
156
162
  "status": "failed",
157
- "duration": "28s",
163
+ "source": "ff-unit-test",
158
164
  "details": "3 tests failed",
159
165
  "failures": [
160
166
  {
161
167
  "test": "UserService.createUser should validate email",
162
168
  "file": "__tests__/user-service.test.ts",
163
- "line": 45,
164
169
  "error": "Expected validation error but got success"
165
170
  }
166
171
  ]
167
172
  },
173
+ "e2eTests": {
174
+ "status": "passed",
175
+ "source": "ff-e2e-test",
176
+ "details": "15 E2E tests passed"
177
+ },
178
+ "build": {
179
+ "status": "passed",
180
+ "details": "Build completed successfully"
181
+ },
182
+ "lint": {
183
+ "status": "passed",
184
+ "details": "No linting errors"
185
+ },
168
186
  "typecheck": {
169
187
  "status": "failed",
170
- "duration": "10s",
171
188
  "details": "5 type errors found",
172
189
  "errors": [
173
190
  {
@@ -177,14 +194,15 @@ When a check fails, provide actionable information:
177
194
  }
178
195
  ]
179
196
  }
180
- }
197
+ },
198
+ "failures": ["unitTests", "typecheck"]
181
199
  }
182
200
  ```
183
201
 
184
202
  ## Important Notes
185
203
 
186
- - **Run checks in parallel** - Don't wait for one to finish before starting another
187
- - **Capture all output** - Include relevant error messages and stack traces
188
- - **Report partial results** - If some checks pass and others fail, report both
189
- - **Include timing** - Help identify slow checks that could be optimized
204
+ - **Run ALL checks in parallel** - Launch all Task and Bash calls in a single message
205
+ - **Delegate tests to sub-agents** - Use `ff-unit-test` and `ff-e2e-test`
206
+ - **Run build/lint/typecheck via Bash** - These are simple commands
207
+ - **Report partial results** - If some pass and others fail, report both
190
208
  - **Don't fix issues** - This agent only reports; fixing is done by other agents
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@syntesseraai/opencode-feature-factory",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "OpenCode plugin for Feature Factory agents - provides planning, implementation, review, testing, and validation agents",
6
6
  "type": "module",
7
7
  "license": "MIT",
package/src/index.ts CHANGED
@@ -58,36 +58,35 @@ async function readBundledTemplate(templateFileName: string): Promise<string> {
58
58
  *
59
59
  * Behavior:
60
60
  * - Creates .opencode/agent/ if it doesn't exist
61
- * - For each agent template: if the destination file exists, skip (never overwrite)
62
- * - If the destination file doesn't exist, write the template
61
+ * - For each agent template: always writes the bundled template (overwrites any user changes)
63
62
  */
64
63
  async function ensureAgentsInstalled(
65
64
  rootDir: string
66
- ): Promise<{ installed: string[]; skipped: string[] }> {
65
+ ): Promise<{ installed: string[]; updated: string[] }> {
67
66
  const agentDir = path.join(rootDir, '.opencode', 'agent');
68
67
 
69
68
  // Create directories if they don't exist
70
69
  await mkdir(agentDir, { recursive: true });
71
70
 
72
71
  const installed: string[] = [];
73
- const skipped: string[] = [];
72
+ const updated: string[] = [];
74
73
 
75
74
  for (const templateFileName of AGENT_TEMPLATES) {
76
75
  const destPath = path.join(agentDir, templateFileName);
76
+ const existed = await fileExists(destPath);
77
77
 
78
- // Create-once semantics: if it exists, never overwrite
79
- if (await fileExists(destPath)) {
80
- skipped.push(templateFileName);
81
- continue;
82
- }
83
-
84
- // Read template and write to destination
78
+ // Always write the bundled template (overwrite any user changes)
85
79
  const template = await readBundledTemplate(templateFileName);
86
80
  await writeFile(destPath, template, { encoding: 'utf8' });
87
- installed.push(templateFileName);
81
+
82
+ if (existed) {
83
+ updated.push(templateFileName);
84
+ } else {
85
+ installed.push(templateFileName);
86
+ }
88
87
  }
89
88
 
90
- return { installed, skipped };
89
+ return { installed, updated };
91
90
  }
92
91
 
93
92
  /**
@@ -110,7 +109,7 @@ async function ensureAgentsInstalled(
110
109
  *
111
110
  * Behavior:
112
111
  * - On plugin init (every OpenCode startup), syncs agents to .opencode/agent/
113
- * - Only creates new files; never overwrites existing files (respects user edits)
112
+ * - Always overwrites existing files with bundled templates (user changes are not preserved)
114
113
  * - Also syncs on installation.updated event
115
114
  */
116
115
  export const FeatureFactoryPlugin: Plugin = async ({ worktree, directory }) => {