chore: 添加 .oxfmtrc.json 并格式化全部代码

This commit is contained in:
2026-06-09 14:22:33 +08:00
parent ebd5bb4051
commit b82f1caf0b
23 changed files with 209 additions and 373 deletions

View File

@@ -2,10 +2,7 @@ export class CliError extends Error {
readonly hint?: string;
readonly usage?: string;
constructor(
message: string,
opts?: { hint?: string; usage?: string },
) {
constructor(message: string, opts?: { hint?: string; usage?: string }) {
super(message);
this.name = this.constructor.name;
this.hint = opts?.hint;

View File

@@ -16,10 +16,7 @@ const COMMANDS: Record<string, CommandHelpDef> = {
usage: "rune init <工具...>",
args: [{ name: "<工具...>", desc: "要注入的 AI 工具,如 opencode、claude-code" }],
detail: "在当前项目中创建 .rune 目录结构,并注入指定 AI 工具的 command 和 skill 配置文件。",
examples: [
"rune init opencode",
"rune init opencode claude-code",
],
examples: ["rune init opencode", "rune init opencode claude-code"],
},
discuss: {
name: "discuss",
@@ -36,38 +33,30 @@ const COMMANDS: Record<string, CommandHelpDef> = {
description: "规划:生成指定文档的规划提示词",
usage: "rune plan <change-name> <document-name>",
args: [
{ name: "<change-name>", desc: "变更名称,如 \"add-login\"" },
{ name: "<document-name>", desc: "文档名称,如 \"design\"、\"task\"" },
],
detail: "生成规划阶段指定文档的提示词。依赖的前置文档必须已完成。可用文档由配置中的 plan.documents 定义。",
examples: [
"rune plan add-user-auth design",
"rune plan add-user-auth task",
{ name: "<change-name>", desc: '变更名称,如 "add-login"' },
{ name: "<document-name>", desc: '文档名称,如 "design"、"task"' },
],
detail:
"生成规划阶段指定文档的提示词。依赖的前置文档必须已完成。可用文档由配置中的 plan.documents 定义。",
examples: ["rune plan add-user-auth design", "rune plan add-user-auth task"],
},
build: {
name: "build",
alias: "build <名称>",
description: "构建:生成构建阶段提示词",
usage: "rune build <change-name>",
args: [{ name: "<change-name>", desc: "变更名称,如 \"add-login\"" }],
args: [{ name: "<change-name>", desc: '变更名称,如 "add-login"' }],
detail: "生成构建阶段的提示词。变更目录需已存在(通过 rune plan 创建)。",
examples: [
"rune build add-user-auth",
"rune build fix-memory-leak",
],
examples: ["rune build add-user-auth", "rune build fix-memory-leak"],
},
archive: {
name: "archive",
alias: "archive <名称>",
description: "归档:归档变更并生成提示词",
usage: "rune archive <change-name>",
args: [{ name: "<change-name>", desc: "变更名称,如 \"add-login\"" }],
args: [{ name: "<change-name>", desc: '变更名称,如 "add-login"' }],
detail: "将变更目录从 .rune/changes/ 移动到 .rune/archive/,并生成归档阶段提示词。",
examples: [
"rune archive add-user-auth",
"rune archive fix-memory-leak",
],
examples: ["rune archive add-user-auth", "rune archive fix-memory-leak"],
},
update: {
name: "update",
@@ -75,11 +64,9 @@ const COMMANDS: Record<string, CommandHelpDef> = {
description: "更新:更新已注入的编辑器配置",
usage: "rune update <工具...>",
args: [{ name: "<工具...>", desc: "要更新的 AI 工具,如 opencode、claude-code" }],
detail: "对比已注入的命令和 skill 文件,与内置版本不一致时覆盖,不存在时新建。用于升级 Rune 后同步编辑器配置。",
examples: [
"rune update opencode",
"rune update opencode claude-code",
],
detail:
"对比已注入的命令和 skill 文件,与内置版本不一致时覆盖,不存在时新建。用于升级 Rune 后同步编辑器配置。",
examples: ["rune update opencode", "rune update opencode claude-code"],
},
status: {
name: "status",
@@ -88,10 +75,7 @@ const COMMANDS: Record<string, CommandHelpDef> = {
usage: "rune status [change-name]",
args: [{ name: "[change-name]", desc: "可选,指定查看的变更名称" }],
detail: "展示各文档完成状态、依赖满足情况、规划进度和下一步建议。不传参数则显示所有变更。",
examples: [
"rune status",
"rune status add-user-auth",
],
examples: ["rune status", "rune status add-user-auth"],
},
};
@@ -118,7 +102,7 @@ export function showGlobalHelp(): string {
lines.push("示例:");
lines.push(" rune init opencode 初始化并注入 OpenCode 配置");
lines.push(" rune update opencode 更新 OpenCode 配置");
lines.push(" rune plan add-login design 规划 \"add-login\" 的设计文档");
lines.push(' rune plan add-login design 规划 "add-login" 的设计文档');
lines.push(" rune status 查看当前变更状态");
return lines.join("\n");
@@ -128,12 +112,7 @@ export function showCommandHelp(name: string): string | null {
const cmd = COMMANDS[name];
if (!cmd) return null;
const lines: string[] = [
`rune ${cmd.name}${cmd.description}`,
"",
"用法:",
` ${cmd.usage}`,
];
const lines: string[] = [`rune ${cmd.name}${cmd.description}`, "", "用法:", ` ${cmd.usage}`];
if (cmd.args.length > 0) {
lines.push("");