From 486bc4630507c3ecd8e0fc50eb0ab254642b0e12 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 30 May 2026 19:12:03 +0900 Subject: [PATCH] test(builtin-commands): batch 10 (2 files) --- .../init-deep-migration.test.ts | 16 ++++++ src/shared-skills-package.test.ts | 53 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 src/features/builtin-commands/init-deep-migration.test.ts create mode 100644 src/shared-skills-package.test.ts diff --git a/src/features/builtin-commands/init-deep-migration.test.ts b/src/features/builtin-commands/init-deep-migration.test.ts new file mode 100644 index 000000000..dd8c36c03 --- /dev/null +++ b/src/features/builtin-commands/init-deep-migration.test.ts @@ -0,0 +1,16 @@ +/// + +import { describe, expect, test } from "bun:test" +import { loadBuiltinCommands } from "./commands" + +describe("init-deep skill migration", () => { + test("#given builtin commands #when loaded #then init-deep no longer ships as a command", () => { + // given + + // when + const commands = loadBuiltinCommands() + + // then + expect(commands["init-deep"]).toBeUndefined() + }) +}) diff --git a/src/shared-skills-package.test.ts b/src/shared-skills-package.test.ts new file mode 100644 index 000000000..21df60a73 --- /dev/null +++ b/src/shared-skills-package.test.ts @@ -0,0 +1,53 @@ +import { describe, expect, test } from "bun:test" +import { stat } from "node:fs/promises" + +describe("shared skills package manifest", () => { + test("#given root package metadata #when shared-skills package is required #then workspace and tarball entries include it", async () => { + // given + const rootPackageJson = await Bun.file("package.json").json() + + // when + const workspaces = rootPackageJson.workspaces + const files = rootPackageJson.files + const devDependency = rootPackageJson.devDependencies["@oh-my-opencode/shared-skills"] + const sharedPackageJson = await Bun.file("packages/shared-skills/package.json").json() + + // then + expect(workspaces).toContain("packages/shared-skills") + expect(files).toContain("packages/shared-skills/skills") + expect(devDependency).toBe("workspace:*") + expect(sharedPackageJson).toEqual({ + name: "@oh-my-opencode/shared-skills", + version: "0.1.0", + type: "module", + private: true, + description: "Cross-harness SKILL.md files shared between OMO and Codex", + exports: { + ".": "./index.mjs", + }, + files: ["index.mjs", "skills"], + }) + }) + + test("#given shared user skills #when copied into the package #then frontmatter and resource directories are preserved", async () => { + // given + const copiedSkills = ["debugging", "programming", "refactor", "remove-ai-slops", "ulw-plan"] as const + + // when + const skillFiles = await Promise.all( + copiedSkills.map(async (skillName) => ({ + name: skillName, + content: await Bun.file(`packages/shared-skills/skills/${skillName}/SKILL.md`).text(), + })), + ) + + // then + for (const skill of skillFiles) { + expect(skill.content.startsWith("---\n")).toBe(true) + expect(skill.content).toContain(`name: ${skill.name}`) + } + expect((await stat("packages/shared-skills/skills/debugging/references")).isDirectory()).toBe(true) + expect((await stat("packages/shared-skills/skills/programming/references")).isDirectory()).toBe(true) + expect((await stat("packages/shared-skills/skills/programming/scripts")).isDirectory()).toBe(true) + }) +})