feat: init 命令检测包管理器并写入 metadata.command
This commit is contained in:
@@ -41,13 +41,13 @@ describe("runInit", () => {
|
||||
expect(existsSync(join(TMP_DIR, ".opencode", "skills", "rune-discuss", "SKILL.md"))).toBe(true);
|
||||
});
|
||||
|
||||
it("重复 init 不覆盖 config.yaml", async () => {
|
||||
it("重复 init 不覆盖 config.yaml 已有内容", async () => {
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
await writeFile(join(TMP_DIR, ".rune", "config.yaml"), "自定义内容");
|
||||
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
const content = await readFile(join(TMP_DIR, ".rune", "config.yaml"), "utf-8");
|
||||
expect(content).toBe("自定义内容");
|
||||
expect(content).toContain("自定义内容");
|
||||
});
|
||||
|
||||
it("不支持的工具名抛出 CommandError", async () => {
|
||||
@@ -59,4 +59,12 @@ describe("runInit", () => {
|
||||
expect((e as CommandError).message).toContain("不支持的工具: unknown-tool");
|
||||
}
|
||||
});
|
||||
|
||||
it("首次 init 时 config.yaml 包含 metadata.command", async () => {
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
|
||||
const content = await readFile(join(TMP_DIR, ".rune", "config.yaml"), "utf-8");
|
||||
expect(content).toContain("metadata:");
|
||||
expect(content).toContain("command:");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user