chore: 添加 .oxfmtrc.json 并格式化全部代码

This commit is contained in:
2026-06-09 14:22:33 +08:00
parent ebd5bb4051
commit b82f1caf0b
23 changed files with 209 additions and 373 deletions

View File

@@ -8,7 +8,8 @@ import { parseTasks } from "./task-parser.ts";
export function assembleDiscussPrompt(config: RuneConfig): string {
const discuss = config.stages.discuss;
if (!discuss) throw new CommandError("讨论阶段未配置", {
if (!discuss)
throw new CommandError("讨论阶段未配置", {
hint: "请在 .rune/config.yaml 中配置 stages.discuss",
});
return discuss.prompt;
@@ -21,7 +22,8 @@ export async function assemblePlanPrompt(
documentName: string,
): Promise<string> {
const plan = config.stages.plan;
if (!plan) throw new CommandError("规划阶段未配置", {
if (!plan)
throw new CommandError("规划阶段未配置", {
hint: "请在 .rune/config.yaml 中配置 stages.plan",
});
@@ -110,9 +112,7 @@ export async function assembleBuildPrompt(
for (const task of pendingTasks) {
parts.push(`- [ ] ${task.text}`);
}
parts.push(
`\n请从第一个待执行任务开始。完成后更新 ${taskPath} 中的 checkbox。`,
);
parts.push(`\n请从第一个待执行任务开始。完成后更新 ${taskPath} 中的 checkbox。`);
return parts.join("\n");
}
@@ -123,7 +123,8 @@ export async function assembleArchivePrompt(
changeName: string,
): Promise<string> {
const archive = config.stages.archive;
if (!archive) throw new CommandError("归档阶段未配置", {
if (!archive)
throw new CommandError("归档阶段未配置", {
hint: "请在 .rune/config.yaml 中配置 stages.archive",
});

View File

@@ -7,9 +7,7 @@ import { ConfigError } from "../cli/errors.ts";
import type { RuneConfig } from "../types.ts";
import { RUNE_DIR, CONFIG_FILE, CHANGES_DIR, ARCHIVE_DIR } from "../types.ts";
export function findProjectRoot(
startDir: string = process.cwd(),
): string | null {
export function findProjectRoot(startDir: string = process.cwd()): string | null {
let dir = startDir;
while (true) {
if (existsSync(join(dir, RUNE_DIR))) {
@@ -49,9 +47,7 @@ export function validateConfig(config: RuneConfig): void {
throw new ConfigError(`文档 "${doc.name}" 不能依赖自身`);
}
if (!docNames.has(dep)) {
throw new ConfigError(
`文档 "${doc.name}" 依赖 "${dep}" 不存在于 plan.documents 中`,
);
throw new ConfigError(`文档 "${doc.name}" 依赖 "${dep}" 不存在于 plan.documents 中`);
}
}
}
@@ -81,9 +77,7 @@ export function validateConfig(config: RuneConfig): void {
for (const doc of plan.documents) {
path.length = 0;
if (hasCycle(doc.name)) {
throw new ConfigError(
`文档间存在循环依赖:${path.join(" → ")}`,
);
throw new ConfigError(`文档间存在循环依赖:${path.join(" → ")}`);
}
}
}

View File

@@ -29,9 +29,7 @@ export async function scanChanges(
const fileName = `${docConfig.name}.md`;
const completed = mdFiles.has(fileName);
const deps = docConfig.depend ?? [];
const dependMet =
deps.length === 0 ||
deps.every((dep) => mdFiles.has(`${dep}.md`));
const dependMet = deps.length === 0 || deps.every((dep) => mdFiles.has(`${dep}.md`));
return { name: docConfig.name, completed, dependMet };
});
} else {
@@ -64,8 +62,7 @@ export async function scanChanges(
taskProgress,
});
}
} catch {
}
} catch {}
return results;
}