opencode-manifold 0.4.5 → 0.4.6
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
CHANGED
|
@@ -38,65 +38,6 @@ async function copyMissingFiles(src, dest) {
|
|
|
38
38
|
}
|
|
39
39
|
return copied;
|
|
40
40
|
}
|
|
41
|
-
async function mergeOpencodeConfig(projectDir) {
|
|
42
|
-
const configPath = join(projectDir, "opencode.json");
|
|
43
|
-
const templateConfigPath = join(globalTemplatesDir, "config", "opencode.json");
|
|
44
|
-
if (!existsSync(templateConfigPath))
|
|
45
|
-
return;
|
|
46
|
-
const templateConfig = JSON.parse(await readFile(templateConfigPath, "utf-8"));
|
|
47
|
-
if (!existsSync(configPath)) {
|
|
48
|
-
await writeFile(configPath, JSON.stringify(templateConfig, null, 2));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const existing = JSON.parse(await readFile(configPath, "utf-8"));
|
|
52
|
-
let changed = false;
|
|
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
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (changed) {
|
|
97
|
-
await writeFile(configPath, JSON.stringify(existing, null, 2));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
41
|
async function ensureGlobalTemplates(ctx) {
|
|
101
42
|
await ctx.client.app.log({
|
|
102
43
|
body: {
|
|
@@ -160,11 +101,6 @@ async function initProject(directory, client) {
|
|
|
160
101
|
if (manifoldCopied.length > 0) {
|
|
161
102
|
initialized.push(`Manifold/ (${manifoldCopied.join(", ")})`);
|
|
162
103
|
}
|
|
163
|
-
const configPath = join(directory, "opencode.json");
|
|
164
|
-
if (!existsSync(configPath) || !JSON.parse(await readFile(configPath, "utf-8")).agent?.manifold) {
|
|
165
|
-
await mergeOpencodeConfig(directory);
|
|
166
|
-
initialized.push("opencode.json");
|
|
167
|
-
}
|
|
168
104
|
await client.app.log({
|
|
169
105
|
body: {
|
|
170
106
|
service: "opencode-manifold",
|
package/package.json
CHANGED