feat: opencode command 文件加 rune- 前缀

This commit is contained in:
2026-06-08 18:36:13 +08:00
parent 0f356bc201
commit 97d64e48db
2 changed files with 5 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ export async function injectOpenCode(projectRoot: string): Promise<void> {
const commandDir = join(projectRoot, COMMANDS_DIR);
await mkdir(commandDir, { recursive: true });
const commandPath = join(commandDir, `${stage}.md`);
const commandPath = join(commandDir, `rune-${stage}.md`);
if (!existsSync(commandPath)) {
await writeFile(commandPath, generateCommand(stage, hasChangeName));
}

View File

@@ -22,7 +22,7 @@ describe("injectOpenCode", () => {
const skills = await readdir(join(TMP_DIR, ".opencode", "skills"));
for (const stage of ["discuss", "plan", "build", "archive"]) {
expect(commands).toContain(`${stage}.md`);
expect(commands).toContain(`rune-${stage}.md`);
expect(skills).toContain(`rune-${stage}.md`);
}
});
@@ -40,7 +40,7 @@ describe("injectOpenCode", () => {
it("command 文件包含 skill 调用指令", async () => {
await injectOpenCode(TMP_DIR);
const content = await readFile(
join(TMP_DIR, ".opencode", "commands", "discuss.md"),
join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"),
"utf-8",
);
expect(content).toContain("rune-discuss");
@@ -71,13 +71,13 @@ describe("injectOpenCode", () => {
it("重复注入时不覆盖已存在的文件", async () => {
await injectOpenCode(TMP_DIR);
const originalContent = await readFile(
join(TMP_DIR, ".opencode", "commands", "discuss.md"),
join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"),
"utf-8",
);
await injectOpenCode(TMP_DIR);
const content = await readFile(
join(TMP_DIR, ".opencode", "commands", "discuss.md"),
join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"),
"utf-8",
);
expect(content).toBe(originalContent);