feat: plan/discuss skill/command 中嵌入 create 引导

This commit is contained in:
2026-06-10 15:21:46 +08:00
parent 4d30604bf0
commit 277e78812c
2 changed files with 21 additions and 7 deletions

View File

@@ -29,10 +29,14 @@ export async function injectClaudeCode(
await mkdir(commandDir, { recursive: true });
const commandPath = join(commandDir, `rune-${stage}.md`);
if (!existsSync(commandPath)) {
await writeFile(
commandPath,
`执行以下命令,将输出作为当前阶段的工作指引:\n\`\`\`bash\n${cmd}\n\`\`\`${smartGuide}\n`,
);
let content = `执行以下命令,将输出作为当前阶段的工作指引:\n\`\`\`bash\n${cmd}\n\`\`\`${smartGuide}`;
if (stage === "plan") {
content += `\n如果变更目录尚不存在新变更请先运行 \`${command} create <变更名>\` 创建目录,再开始规划。`;
}
if (stage === "discuss") {
content += `\n讨论结束后如果确定了变更方向请运行 \`${command} create <变更名>\` 创建变更目录,然后进入规划阶段。`;
}
await writeFile(commandPath, content + "\n");
}
}
@@ -55,8 +59,14 @@ export async function updateClaudeCode(
const commandDir = join(projectRoot, COMMANDS_DIR);
await mkdir(commandDir, { recursive: true });
const commandPath = join(commandDir, `rune-${stage}.md`);
const newContent = `执行以下命令,将输出作为当前阶段的工作指引:\n\`\`\`bash\n${cmd}\n\`\`\`${smartGuide}\n`;
await writeIfChanged(commandPath, newContent);
let newContent = `执行以下命令,将输出作为当前阶段的工作指引:\n\`\`\`bash\n${cmd}\n\`\`\`${smartGuide}`;
if (stage === "plan") {
newContent += `\n如果变更目录尚不存在新变更请先运行 \`${command} create <变更名>\` 创建目录,再开始规划。`;
}
if (stage === "discuss") {
newContent += `\n讨论结束后如果确定了变更方向请运行 \`${command} create <变更名>\` 创建变更目录,然后进入规划阶段。`;
}
await writeIfChanged(commandPath, newContent + "\n");
}
const introCommandPath = join(projectRoot, COMMANDS_DIR, "rune-intro.md");

View File

@@ -64,7 +64,11 @@ function generateSkill(stage: string, command: string): string {
let extraGuide = "";
if (stage === "plan") {
extraGuide = `\n规划阶段应先运行 \`${command} status <变更名>\` 获取当前有哪些文档需要编写,再按依赖顺序逐个生成。\n`;
extraGuide = `\n规划阶段应先运行 \`${command} status <变更名>\` 获取当前有哪些文档需要编写,再按依赖顺序逐个生成。\n\n如果变更目录尚不存在新变更请先运行 \`${command} create <变更名>\` 创建目录,再开始规划。\n`;
}
if (stage === "discuss") {
extraGuide = `\n讨论结束后如果确定了变更方向请运行 \`${command} create <变更名>\` 创建变更目录,然后进入规划阶段。\n`;
}
const descriptionMap: Record<string, string> = {