From 7ecc6358576bcc7746376b777239b28b925aa73d Mon Sep 17 00:00:00 2001 From: Render Engineering Date: Fri, 4 Dec 2026 14:38:35 +0100 Subject: [PATCH] Sync the reviewed opencode plugin GitOrigin-RevId: 69c280f7b85842317603bd765580251a19a72014 --- README.md | 12 +----------- assets/setup.mjs | 6 +++--- tests/setup.test.ts | 13 +++++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 50475a4..fd16029 100644 --- a/README.md +++ b/README.md @@ -181,17 +181,7 @@ You can also run: ## Maintainer workflow -Refresh bundled skills from `render-oss/skills`: - -```bash -./scripts/sync-skills.sh -``` - -Use a different source repo or subdirectory: - -```bash -./scripts/sync-skills.sh --repo https://github.com/render-oss/skills --subdir skills -``` +This repository is published automatically. Don't edit it directly; bundled skills in `assets/opencode/skills/` match [render-oss/skills](https://github.com/render-oss/skills). Report problems as issues. Verify the package before publishing: diff --git a/assets/setup.mjs b/assets/setup.mjs index 5a6d93f..06f74a6 100644 --- a/assets/setup.mjs +++ b/assets/setup.mjs @@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url" const moduleDir = dirname(fileURLToPath(import.meta.url)) const MANIFEST_NAME = ".render-opencode-manifest.json" -const ASSET_DIRECTORIES = ["skills", "commands", "agents", "plugins"] +const ASSET_DIRECTORIES = ["skills", "commands", "agents", "plugins", "shared/references"] const RENDER_MCP_CONFIG = { type: "remote", url: "https://mcp.render.com/mcp", @@ -32,7 +32,7 @@ export async function installOpenCodeAssets(options = {}) { const previous = await readManifest(manifestPath) const legacy = await readManifest(join(moduleDir, "legacy-assets.json")) const directories = ASSET_DIRECTORIES.filter((name) => name !== "plugins" || options.includePlugin) - const belongsToInstall = (path) => directories.includes(path.split("/")[0]) + const belongsToInstall = (path) => directories.some((dir) => path.startsWith(dir + "/")) const next = { ...previous.files } const bundled = new Map() @@ -128,7 +128,7 @@ async function readManifest(path) { const value = JSON.parse(await readFile(path, "utf8")) if (value?.version !== 1 || !isRecord(value.files)) throw new Error(`Invalid Render installation manifest: ${path}`) for (const [file, hash] of Object.entries(value.files)) { - if (isAbsolute(file) || file.includes("\\") || file.split("/").some((part) => part === ".." || part === "" || part === ".") || !ASSET_DIRECTORIES.includes(file.split("/")[0]) || !/^[a-f0-9]{64}$/.test(hash)) { + if (isAbsolute(file) || file.includes("\\") || file.split("/").some((part) => part === ".." || part === "" || part === ".") || !ASSET_DIRECTORIES.some((dir) => file.startsWith(dir + "/")) || !/^[a-f0-9]{64}$/.test(hash)) { throw new Error(`Invalid Render installation manifest entry: ${file}`) } } diff --git a/tests/setup.test.ts b/tests/setup.test.ts index 8da28f5..10277e8 100644 --- a/tests/setup.test.ts +++ b/tests/setup.test.ts @@ -39,6 +39,19 @@ describe("installOpenCodeAssets", () => { expect(result.skipped.length).toBe(0) }) + it("installs shared references beside skills and removes obsolete managed copies", async () => { + const targetConfigDir = await tempDir() + const sourceAssetsDir = await tempDir() + const ref = "shared/references/deployments.md" + await mkdir(join(sourceAssetsDir, "shared/references"), { recursive: true }) + await writeFile(join(sourceAssetsDir, ref), "Deployments") + await installOpenCodeAssets({ sourceAssetsDir, targetConfigDir }) + expect(await readFile(join(targetConfigDir, ref), "utf8")).toBe("Deployments") + await rm(join(sourceAssetsDir, ref)) + const result = await installOpenCodeAssets({ sourceAssetsDir, targetConfigDir }) + expect(result.removed).toContain(join(targetConfigDir, ref)) + }) + it("does not overwrite existing files unless force is enabled", async () => { const targetConfigDir = await tempDir() const sourceAssetsDir = await tempDir()