feat: opencode command 文件加 rune- 前缀
This commit is contained in:
@@ -12,7 +12,7 @@ export async function injectOpenCode(projectRoot: string): Promise<void> {
|
|||||||
|
|
||||||
const commandDir = join(projectRoot, COMMANDS_DIR);
|
const commandDir = join(projectRoot, COMMANDS_DIR);
|
||||||
await mkdir(commandDir, { recursive: true });
|
await mkdir(commandDir, { recursive: true });
|
||||||
const commandPath = join(commandDir, `${stage}.md`);
|
const commandPath = join(commandDir, `rune-${stage}.md`);
|
||||||
if (!existsSync(commandPath)) {
|
if (!existsSync(commandPath)) {
|
||||||
await writeFile(commandPath, generateCommand(stage, hasChangeName));
|
await writeFile(commandPath, generateCommand(stage, hasChangeName));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe("injectOpenCode", () => {
|
|||||||
const skills = await readdir(join(TMP_DIR, ".opencode", "skills"));
|
const skills = await readdir(join(TMP_DIR, ".opencode", "skills"));
|
||||||
|
|
||||||
for (const stage of ["discuss", "plan", "build", "archive"]) {
|
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`);
|
expect(skills).toContain(`rune-${stage}.md`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -40,7 +40,7 @@ describe("injectOpenCode", () => {
|
|||||||
it("command 文件包含 skill 调用指令", async () => {
|
it("command 文件包含 skill 调用指令", async () => {
|
||||||
await injectOpenCode(TMP_DIR);
|
await injectOpenCode(TMP_DIR);
|
||||||
const content = await readFile(
|
const content = await readFile(
|
||||||
join(TMP_DIR, ".opencode", "commands", "discuss.md"),
|
join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"),
|
||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
expect(content).toContain("rune-discuss");
|
expect(content).toContain("rune-discuss");
|
||||||
@@ -71,13 +71,13 @@ describe("injectOpenCode", () => {
|
|||||||
it("重复注入时不覆盖已存在的文件", async () => {
|
it("重复注入时不覆盖已存在的文件", async () => {
|
||||||
await injectOpenCode(TMP_DIR);
|
await injectOpenCode(TMP_DIR);
|
||||||
const originalContent = await readFile(
|
const originalContent = await readFile(
|
||||||
join(TMP_DIR, ".opencode", "commands", "discuss.md"),
|
join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"),
|
||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
|
|
||||||
await injectOpenCode(TMP_DIR);
|
await injectOpenCode(TMP_DIR);
|
||||||
const content = await readFile(
|
const content = await readFile(
|
||||||
join(TMP_DIR, ".opencode", "commands", "discuss.md"),
|
join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"),
|
||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
expect(content).toBe(originalContent);
|
expect(content).toBe(originalContent);
|
||||||
|
|||||||
Reference in New Issue
Block a user