feat: init 创建空配置文件,内置策略走代码默认值
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { stringify as stringifyYaml } from "yaml";
|
||||
import { defaultConfig } from "../defaults/config.ts";
|
||||
import { CHANGES_DIR, ARCHIVE_DIR, RUNE_DIR, CONFIG_FILE } from "../types.ts";
|
||||
import { injectOpenCode } from "../adapters/opencode.ts";
|
||||
import { injectClaudeCode } from "../adapters/claude-code.ts";
|
||||
@@ -29,8 +27,7 @@ export async function runInit(
|
||||
|
||||
const configPath = join(runeDir, CONFIG_FILE);
|
||||
if (!existsSync(configPath)) {
|
||||
const yaml = stringifyYaml(defaultConfig);
|
||||
await writeFile(configPath, yaml, "utf-8");
|
||||
await writeFile(configPath, "stages: {}\n", "utf-8");
|
||||
}
|
||||
|
||||
for (const tool of tools) {
|
||||
|
||||
@@ -15,7 +15,7 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe("runInit", () => {
|
||||
it("创建 .rune 目录和默认 config.yaml", async () => {
|
||||
it("创建 .rune 目录和空 config.yaml", async () => {
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
|
||||
expect(existsSync(join(TMP_DIR, ".rune"))).toBe(true);
|
||||
@@ -25,10 +25,7 @@ describe("runInit", () => {
|
||||
join(TMP_DIR, ".rune", "config.yaml"),
|
||||
"utf-8",
|
||||
);
|
||||
expect(content).toContain("discuss");
|
||||
expect(content).toContain("plan");
|
||||
expect(content).toContain("build");
|
||||
expect(content).toContain("archive");
|
||||
expect(content.trim()).toBe("stages: {}");
|
||||
});
|
||||
|
||||
it("创建 .rune/changes 和 .rune/archive 目录", async () => {
|
||||
|
||||
Reference in New Issue
Block a user