refactor: 移除 OpenCode adapter 中 create 独立生成块
This commit is contained in:
@@ -7,7 +7,7 @@ import { writeIfChanged } from "./utils.ts";
|
|||||||
const COMMANDS_DIR = ".opencode/commands";
|
const COMMANDS_DIR = ".opencode/commands";
|
||||||
const SKILLS_DIR = ".opencode/skills";
|
const SKILLS_DIR = ".opencode/skills";
|
||||||
|
|
||||||
const STAGES_WITH_CHANGE_NAME = new Set(["create", "plan", "build", "archive"]);
|
const STAGES_WITH_CHANGE_NAME = new Set(["plan", "build", "archive"]);
|
||||||
|
|
||||||
export async function injectOpenCode(projectRoot: string, command: string = "rune"): Promise<void> {
|
export async function injectOpenCode(projectRoot: string, command: string = "rune"): Promise<void> {
|
||||||
for (const stage of STAGES) {
|
for (const stage of STAGES) {
|
||||||
@@ -26,24 +26,6 @@ export async function injectOpenCode(projectRoot: string, command: string = "run
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create 是工具命令,不是 SDD 阶段,但仍需生成对应的 command 和 skill 文件
|
|
||||||
{
|
|
||||||
const stage = "create";
|
|
||||||
const commandDir = join(projectRoot, COMMANDS_DIR);
|
|
||||||
await mkdir(commandDir, { recursive: true });
|
|
||||||
const commandPath = join(commandDir, `rune-${stage}.md`);
|
|
||||||
if (!existsSync(commandPath)) {
|
|
||||||
await writeFile(commandPath, generateCommand(stage));
|
|
||||||
}
|
|
||||||
|
|
||||||
const skillStageDir = join(projectRoot, SKILLS_DIR, `rune-${stage}`);
|
|
||||||
await mkdir(skillStageDir, { recursive: true });
|
|
||||||
const skillPath = join(skillStageDir, "SKILL.md");
|
|
||||||
if (!existsSync(skillPath)) {
|
|
||||||
await writeFile(skillPath, generateSkill(stage, command));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const introSkillDir = join(projectRoot, SKILLS_DIR, "rune-intro");
|
const introSkillDir = join(projectRoot, SKILLS_DIR, "rune-intro");
|
||||||
await mkdir(introSkillDir, { recursive: true });
|
await mkdir(introSkillDir, { recursive: true });
|
||||||
const introSkillPath = join(introSkillDir, "SKILL.md");
|
const introSkillPath = join(introSkillDir, "SKILL.md");
|
||||||
@@ -65,20 +47,6 @@ export async function updateOpenCode(projectRoot: string, command: string = "run
|
|||||||
await writeIfChanged(skillPath, generateSkill(stage, command));
|
await writeIfChanged(skillPath, generateSkill(stage, command));
|
||||||
}
|
}
|
||||||
|
|
||||||
// create 是工具命令,不是 SDD 阶段,但仍需生成对应的 command 和 skill 文件
|
|
||||||
{
|
|
||||||
const stage = "create";
|
|
||||||
const commandDir = join(projectRoot, COMMANDS_DIR);
|
|
||||||
await mkdir(commandDir, { recursive: true });
|
|
||||||
const commandPath = join(commandDir, `rune-${stage}.md`);
|
|
||||||
await writeIfChanged(commandPath, generateCommand(stage));
|
|
||||||
|
|
||||||
const skillStageDir = join(projectRoot, SKILLS_DIR, `rune-${stage}`);
|
|
||||||
await mkdir(skillStageDir, { recursive: true });
|
|
||||||
const skillPath = join(skillStageDir, "SKILL.md");
|
|
||||||
await writeIfChanged(skillPath, generateSkill(stage, command));
|
|
||||||
}
|
|
||||||
|
|
||||||
const introSkillDir = join(projectRoot, SKILLS_DIR, "rune-intro");
|
const introSkillDir = join(projectRoot, SKILLS_DIR, "rune-intro");
|
||||||
await mkdir(introSkillDir, { recursive: true });
|
await mkdir(introSkillDir, { recursive: true });
|
||||||
const introSkillPath = join(introSkillDir, "SKILL.md");
|
const introSkillPath = join(introSkillDir, "SKILL.md");
|
||||||
@@ -101,7 +69,6 @@ function generateSkill(stage: string, command: string): string {
|
|||||||
|
|
||||||
const descriptionMap: Record<string, string> = {
|
const descriptionMap: Record<string, string> = {
|
||||||
discuss: "Use when 需要进入 SDD 讨论阶段,自由讨论需求和架构方案",
|
discuss: "Use when 需要进入 SDD 讨论阶段,自由讨论需求和架构方案",
|
||||||
create: "Use when 需要创建变更目录(plan 阶段的辅助命令,prepare workspace)",
|
|
||||||
plan: "Use when 需要进入 SDD 规划阶段,生成设计文档和任务清单",
|
plan: "Use when 需要进入 SDD 规划阶段,生成设计文档和任务清单",
|
||||||
build: "Use when 需要进入 SDD 构建阶段,按任务清单逐步实现变更",
|
build: "Use when 需要进入 SDD 构建阶段,按任务清单逐步实现变更",
|
||||||
archive: "Use when 需要进入 SDD 归档阶段,确认变更完成并归档",
|
archive: "Use when 需要进入 SDD 归档阶段,确认变更完成并归档",
|
||||||
|
|||||||
Reference in New Issue
Block a user