From 49f523146ff53112ae975f6922515c29bc9b1b84 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Wed, 10 Jun 2026 13:11:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20help=20=E6=96=B0=E5=A2=9E=20create=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=B8=AE=E5=8A=A9=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=98=B6=E6=AE=B5=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cli/help.ts | 11 ++++++++++- tests/cli/help.test.ts | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cli/help.ts b/src/cli/help.ts index 9db5823..11a9a23 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -27,6 +27,15 @@ const COMMANDS: Record = { detail: "生成 SDD 流程中讨论阶段的提示词,输出到标准输出。需要先运行 init 初始化项目。", exampleArgs: ["discuss"], }, + create: { + name: "create", + alias: "create <变更>", + description: "创建:创建变更目录", + usageTemplate: "create ", + args: [{ name: "", desc: '变更名称,如 "add-login"' }], + detail: "在 .rune/changes/ 下创建以变更名称命名的目录,并生成创建阶段提示词。", + exampleArgs: ["create add-user-auth", "create fix-memory-leak"], + }, plan: { name: "plan", alias: "plan <变更> <文档>", @@ -46,7 +55,7 @@ const COMMANDS: Record = { description: "构建:生成构建阶段提示词", usageTemplate: "build ", args: [{ name: "", desc: '变更名称,如 "add-login"' }], - detail: "生成构建阶段的提示词。变更目录需已存在(通过 plan 创建)。", + detail: "生成构建阶段的提示词。变更目录需已存在(通过 create 创建)。", exampleArgs: ["build add-user-auth", "build fix-memory-leak"], }, archive: { diff --git a/tests/cli/help.test.ts b/tests/cli/help.test.ts index 139b7a4..8bb1707 100644 --- a/tests/cli/help.test.ts +++ b/tests/cli/help.test.ts @@ -18,6 +18,7 @@ describe("showGlobalHelp", () => { const output = showGlobalHelp("rune"); expect(output).toContain("init <工具...>"); expect(output).toContain("discuss"); + expect(output).toContain("create <变更>"); expect(output).toContain("plan <变更> <文档>"); expect(output).toContain("build <名称>"); expect(output).toContain("archive <名称>"); @@ -48,6 +49,13 @@ describe("showCommandHelp", () => { expect(output).toContain("opencode"); }); + it("create 命令包含变更名参数", () => { + const output = showCommandHelp("create", "rune"); + expect(output).toContain("rune create "); + expect(output).toContain("变更名称"); + expect(output).toContain("rune create add-user-auth"); + }); + it("不存在的命令返回 null", () => { const output = showCommandHelp("nonexistent", "rune"); expect(output).toBeNull();