feat(omo-codex): install through sisyphuslabs marketplace
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
export async function makeTempDir() {
|
||||
return mkdtemp(join(tmpdir(), "omo-codex-install-"));
|
||||
}
|
||||
|
||||
export async function writeJson(path, value) {
|
||||
await mkdir(dirname(path), { recursive: true });
|
||||
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
|
||||
}
|
||||
|
||||
export async function writePlugin(root, name, version) {
|
||||
const pluginRoot = join(root, "plugins", name);
|
||||
await mkdir(join(pluginRoot, ".codex-plugin"), { recursive: true });
|
||||
await mkdir(join(pluginRoot, "dist"), { recursive: true });
|
||||
await mkdir(join(pluginRoot, "hooks"), { recursive: true });
|
||||
await mkdir(join(pluginRoot, "skills", name), { recursive: true });
|
||||
await writeJson(join(pluginRoot, ".codex-plugin", "plugin.json"), {
|
||||
name,
|
||||
version,
|
||||
description: `${name} test plugin`,
|
||||
mcpServers: "./.mcp.json",
|
||||
hooks: "./hooks/hooks.json",
|
||||
skills: "./skills/",
|
||||
});
|
||||
await writeJson(join(pluginRoot, ".mcp.json"), {
|
||||
mcpServers: {
|
||||
[name]: {
|
||||
command: "node",
|
||||
args: ["./dist/cli.js", "mcp"],
|
||||
cwd: ".",
|
||||
},
|
||||
},
|
||||
});
|
||||
await writeJson(join(pluginRoot, "hooks", "hooks.json"), { hooks: {} });
|
||||
await writeFile(join(pluginRoot, "skills", name, "SKILL.md"), "---\nname: test\n---\n");
|
||||
await writeJson(join(pluginRoot, "package.json"), {
|
||||
name: `@example/${name}`,
|
||||
version,
|
||||
bin: {
|
||||
[name]: "./dist/cli.js",
|
||||
},
|
||||
scripts: {
|
||||
build: "node -e \"require('fs').writeFileSync('dist/cli.js', 'console.log(1)')\"",
|
||||
},
|
||||
dependencies: {},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user