@syntesseraai/opencode-feature-factory 0.1.4 → 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.
- package/package.json +1 -1
- package/src/index.ts +13 -14
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.
|
|
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:
|
|
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[];
|
|
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
|
|
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
|
-
//
|
|
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
|
-
|
|
81
|
+
|
|
82
|
+
if (existed) {
|
|
83
|
+
updated.push(templateFileName);
|
|
84
|
+
} else {
|
|
85
|
+
installed.push(templateFileName);
|
|
86
|
+
}
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
return { installed,
|
|
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
|
-
* -
|
|
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 }) => {
|