feat: 提示词拼装使用动态命令前缀
This commit is contained in:
@@ -5,6 +5,7 @@ import type { RuneConfig } from "../types.ts";
|
||||
import { CommandError } from "../cli/errors.ts";
|
||||
import { getChangeDir } from "./config.ts";
|
||||
import { parseTasks } from "./task-parser.ts";
|
||||
import { applyCommandPrefix, getPmPrefix } from "./pm.ts";
|
||||
|
||||
export function assembleDiscussPrompt(config: RuneConfig): string {
|
||||
const discuss = config.stages.discuss;
|
||||
@@ -12,7 +13,7 @@ export function assembleDiscussPrompt(config: RuneConfig): string {
|
||||
throw new CommandError("讨论阶段未配置", {
|
||||
hint: "请在 .rune/config.yaml 中配置 stages.discuss",
|
||||
});
|
||||
return discuss.prompt;
|
||||
return applyCommandPrefix(discuss.prompt, config);
|
||||
}
|
||||
|
||||
export async function assemblePlanPrompt(
|
||||
@@ -69,7 +70,7 @@ export async function assemblePlanPrompt(
|
||||
}
|
||||
|
||||
parts.push(`\n请将文档写入目录:${changeDir}`);
|
||||
return parts.join("\n");
|
||||
return applyCommandPrefix(parts.join("\n"), config);
|
||||
}
|
||||
|
||||
export async function assembleBuildPrompt(
|
||||
@@ -91,8 +92,9 @@ export async function assembleBuildPrompt(
|
||||
try {
|
||||
taskContent = await readFile(taskPath, "utf-8");
|
||||
} catch {
|
||||
const prefix = getPmPrefix(config);
|
||||
throw new CommandError(`变更 "${changeName}" 尚未完成规划,task.md 不存在`, {
|
||||
hint: `请先完成规划阶段:rune plan ${changeName} 生成所有规划文档`,
|
||||
hint: `请先完成规划阶段:${prefix} plan ${changeName} 生成所有规划文档`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -114,7 +116,7 @@ export async function assembleBuildPrompt(
|
||||
}
|
||||
parts.push(`\n请从第一个待执行任务开始。完成后更新 ${taskPath} 中的 checkbox。`);
|
||||
|
||||
return parts.join("\n");
|
||||
return applyCommandPrefix(parts.join("\n"), config);
|
||||
}
|
||||
|
||||
export async function assembleArchivePrompt(
|
||||
@@ -154,5 +156,5 @@ export async function assembleArchivePrompt(
|
||||
}
|
||||
|
||||
parts.push(archive.prompt);
|
||||
return parts.join("\n");
|
||||
return applyCommandPrefix(parts.join("\n"), config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user