refactor: 移除 Claude Code adapter 中 create 独立生成块
This commit is contained in:
@@ -6,7 +6,7 @@ import { writeIfChanged } from "./utils.ts";
|
|||||||
|
|
||||||
const COMMANDS_DIR = ".claude/commands";
|
const COMMANDS_DIR = ".claude/commands";
|
||||||
|
|
||||||
const STAGES_WITH_CHANGE_NAME = new Set(["create", "plan", "build", "archive"]);
|
const STAGES_WITH_CHANGE_NAME = new Set(["plan", "build", "archive"]);
|
||||||
|
|
||||||
function buildSmartGuide(command: string): string {
|
function buildSmartGuide(command: string): string {
|
||||||
return `如果用户没有指定变更名称,请按以下步骤智能识别:
|
return `如果用户没有指定变更名称,请按以下步骤智能识别:
|
||||||
@@ -36,22 +36,6 @@ export async function injectClaudeCode(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create 是工具命令,不是 SDD 阶段,但仍需生成对应的 command 文件
|
|
||||||
{
|
|
||||||
const stage = "create";
|
|
||||||
const cmd = `${command} ${stage} <变更名>`;
|
|
||||||
const smartGuide = `\n${buildSmartGuide(command)}\n`;
|
|
||||||
const commandDir = join(projectRoot, COMMANDS_DIR);
|
|
||||||
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`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const introCommandPath = join(projectRoot, COMMANDS_DIR, "rune-intro.md");
|
const introCommandPath = join(projectRoot, COMMANDS_DIR, "rune-intro.md");
|
||||||
if (!existsSync(introCommandPath)) {
|
if (!existsSync(introCommandPath)) {
|
||||||
await mkdir(join(projectRoot, COMMANDS_DIR), { recursive: true });
|
await mkdir(join(projectRoot, COMMANDS_DIR), { recursive: true });
|
||||||
@@ -75,18 +59,6 @@ export async function updateClaudeCode(
|
|||||||
await writeIfChanged(commandPath, newContent);
|
await writeIfChanged(commandPath, newContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create 是工具命令,不是 SDD 阶段,但仍需生成对应的 command 文件
|
|
||||||
{
|
|
||||||
const stage = "create";
|
|
||||||
const cmd = `${command} ${stage} <变更名>`;
|
|
||||||
const smartGuide = `\n${buildSmartGuide(command)}\n`;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
const introCommandPath = join(projectRoot, COMMANDS_DIR, "rune-intro.md");
|
const introCommandPath = join(projectRoot, COMMANDS_DIR, "rune-intro.md");
|
||||||
await writeIfChanged(introCommandPath, generateIntroCommand(command));
|
await writeIfChanged(introCommandPath, generateIntroCommand(command));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user