opencode-manifold 0.4.19 → 0.4.20
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
|
@@ -69,6 +69,15 @@ async function copyFiles(src, dest) {
|
|
|
69
69
|
}
|
|
70
70
|
return copied;
|
|
71
71
|
}
|
|
72
|
+
async function copyFile(src, dest) {
|
|
73
|
+
if (!existsSync(src))
|
|
74
|
+
return;
|
|
75
|
+
const destDir = dirname(dest);
|
|
76
|
+
if (!existsSync(destDir)) {
|
|
77
|
+
await mkdir(destDir, { recursive: true });
|
|
78
|
+
}
|
|
79
|
+
await writeFile(dest, await readFile(src));
|
|
80
|
+
}
|
|
72
81
|
async function ensureGlobalTemplates(ctx) {
|
|
73
82
|
await ctx.client.app.log({
|
|
74
83
|
body: {
|
|
@@ -89,9 +98,10 @@ async function ensureGlobalTemplates(ctx) {
|
|
|
89
98
|
}
|
|
90
99
|
await copyFiles(bundledTemplatesDir, globalTemplatesDir);
|
|
91
100
|
const globalCommandsDir = join(homedir(), ".config", "opencode", "commands");
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
const initCommandSrc = join(bundledTemplatesDir, "commands", "manifold-init.md");
|
|
102
|
+
const initCommandDest = join(globalCommandsDir, "manifold-init.md");
|
|
103
|
+
if (existsSync(initCommandSrc)) {
|
|
104
|
+
await copyFile(initCommandSrc, initCommandDest);
|
|
95
105
|
}
|
|
96
106
|
await ctx.client.app.log({
|
|
97
107
|
body: {
|
|
@@ -132,6 +142,20 @@ async function initProject(directory, client) {
|
|
|
132
142
|
if (manifoldCopied.length > 0) {
|
|
133
143
|
initialized.push(`Manifold/ (${manifoldCopied.join(", ")})`);
|
|
134
144
|
}
|
|
145
|
+
const projectCommandsDir = join(directory, ".opencode", "commands");
|
|
146
|
+
const commandsToCopy = ["manifold-models.md", "manifold-update.md"];
|
|
147
|
+
const commandsInitialized = [];
|
|
148
|
+
for (const cmd of commandsToCopy) {
|
|
149
|
+
const src = join(globalTemplatesDir, "commands", cmd);
|
|
150
|
+
const dest = join(projectCommandsDir, cmd);
|
|
151
|
+
if (existsSync(src) && !existsSync(dest)) {
|
|
152
|
+
await copyFile(src, dest);
|
|
153
|
+
commandsInitialized.push(cmd);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (commandsInitialized.length > 0) {
|
|
157
|
+
initialized.push(`commands (${commandsInitialized.join(", ")})`);
|
|
158
|
+
}
|
|
135
159
|
const version = await getPluginVersion();
|
|
136
160
|
await writeFile(join(directory, "Manifold", "VERSION"), version + `
|
|
137
161
|
`);
|
package/package.json
CHANGED