opencode-manifold 0.4.3 → 0.4.4
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/dist/index.js +42 -4
- package/package.json +1 -1
- package/src/templates/config/opencode.json +5 -0
package/dist/index.js
CHANGED
|
@@ -50,10 +50,48 @@ async function mergeOpencodeConfig(projectDir) {
|
|
|
50
50
|
}
|
|
51
51
|
const existing = JSON.parse(await readFile(configPath, "utf-8"));
|
|
52
52
|
let changed = false;
|
|
53
|
-
if (templateConfig.agent?.manifold
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (templateConfig.agent?.manifold?.skill) {
|
|
54
|
+
if (!existing.agent) {
|
|
55
|
+
existing.agent = {};
|
|
56
|
+
}
|
|
57
|
+
if (!existing.agent.manifold) {
|
|
58
|
+
existing.agent.manifold = {};
|
|
59
|
+
}
|
|
60
|
+
if (!existing.agent.manifold.skill) {
|
|
61
|
+
existing.agent.manifold.skill = templateConfig.agent.manifold.skill;
|
|
62
|
+
changed = true;
|
|
63
|
+
} else if (Array.isArray(existing.agent.manifold.skill) && Array.isArray(templateConfig.agent.manifold.skill)) {
|
|
64
|
+
const existingSkills = new Set(existing.agent.manifold.skill);
|
|
65
|
+
let addedSkill = false;
|
|
66
|
+
for (const skill of templateConfig.agent.manifold.skill) {
|
|
67
|
+
if (!existingSkills.has(skill)) {
|
|
68
|
+
existing.agent.manifold.skill.push(skill);
|
|
69
|
+
addedSkill = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (addedSkill) {
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (templateConfig.agent?.manifold?.skill) {
|
|
78
|
+
const skillsToAdd = templateConfig.agent.manifold.skill;
|
|
79
|
+
if (!existing.permission) {
|
|
80
|
+
existing.permission = {};
|
|
81
|
+
}
|
|
82
|
+
if (!existing.permission.skill) {
|
|
83
|
+
existing.permission.skill = {};
|
|
84
|
+
}
|
|
85
|
+
let permissionChanged = false;
|
|
86
|
+
for (const skill of skillsToAdd) {
|
|
87
|
+
if (existing.permission.skill[skill] === undefined) {
|
|
88
|
+
existing.permission.skill[skill] = "allow";
|
|
89
|
+
permissionChanged = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (permissionChanged) {
|
|
93
|
+
changed = true;
|
|
94
|
+
}
|
|
57
95
|
}
|
|
58
96
|
if (changed) {
|
|
59
97
|
await writeFile(configPath, JSON.stringify(existing, null, 2));
|
package/package.json
CHANGED