@flyin-ai/alloy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +151 -0
  2. package/commands/alloy/apply.md +485 -0
  3. package/commands/alloy/archive.md +170 -0
  4. package/commands/alloy/discard.md +80 -0
  5. package/commands/alloy/finish.md +204 -0
  6. package/commands/alloy/fix.md +149 -0
  7. package/commands/alloy/plan.md +360 -0
  8. package/commands/alloy/start.md +314 -0
  9. package/commands/alloy/status.md +79 -0
  10. package/compat.yaml +10 -0
  11. package/dist/cli/commands/completion.d.ts +1 -0
  12. package/dist/cli/commands/completion.js +155 -0
  13. package/dist/cli/commands/completion.js.map +1 -0
  14. package/dist/cli/commands/doctor.d.ts +7 -0
  15. package/dist/cli/commands/doctor.js +93 -0
  16. package/dist/cli/commands/doctor.js.map +1 -0
  17. package/dist/cli/commands/init.d.ts +6 -0
  18. package/dist/cli/commands/init.js +168 -0
  19. package/dist/cli/commands/init.js.map +1 -0
  20. package/dist/cli/commands/internal/archive.d.ts +1 -0
  21. package/dist/cli/commands/internal/archive.js +91 -0
  22. package/dist/cli/commands/internal/archive.js.map +1 -0
  23. package/dist/cli/commands/internal/guard.d.ts +1 -0
  24. package/dist/cli/commands/internal/guard.js +135 -0
  25. package/dist/cli/commands/internal/guard.js.map +1 -0
  26. package/dist/cli/commands/internal/record.d.ts +1 -0
  27. package/dist/cli/commands/internal/record.js +144 -0
  28. package/dist/cli/commands/internal/record.js.map +1 -0
  29. package/dist/cli/commands/internal/state.d.ts +1 -0
  30. package/dist/cli/commands/internal/state.js +99 -0
  31. package/dist/cli/commands/internal/state.js.map +1 -0
  32. package/dist/cli/commands/status.d.ts +1 -0
  33. package/dist/cli/commands/status.js +112 -0
  34. package/dist/cli/commands/status.js.map +1 -0
  35. package/dist/cli/commands/update.d.ts +1 -0
  36. package/dist/cli/commands/update.js +162 -0
  37. package/dist/cli/commands/update.js.map +1 -0
  38. package/dist/cli/index.d.ts +2 -0
  39. package/dist/cli/index.js +291 -0
  40. package/dist/cli/index.js.map +1 -0
  41. package/dist/cli/utils/state.d.ts +6 -0
  42. package/dist/cli/utils/state.js +64 -0
  43. package/dist/cli/utils/state.js.map +1 -0
  44. package/dist/core/agents.d.ts +8 -0
  45. package/dist/core/agents.js +85 -0
  46. package/dist/core/agents.js.map +1 -0
  47. package/dist/core/claude-md.d.ts +4 -0
  48. package/dist/core/claude-md.js +47 -0
  49. package/dist/core/claude-md.js.map +1 -0
  50. package/dist/core/compat.d.ts +2 -0
  51. package/dist/core/compat.js +8 -0
  52. package/dist/core/compat.js.map +1 -0
  53. package/dist/core/detect.d.ts +2 -0
  54. package/dist/core/detect.js +22 -0
  55. package/dist/core/detect.js.map +1 -0
  56. package/dist/core/health.d.ts +22 -0
  57. package/dist/core/health.js +283 -0
  58. package/dist/core/health.js.map +1 -0
  59. package/dist/core/openspec.d.ts +2 -0
  60. package/dist/core/openspec.js +79 -0
  61. package/dist/core/openspec.js.map +1 -0
  62. package/dist/core/skills.d.ts +3 -0
  63. package/dist/core/skills.js +68 -0
  64. package/dist/core/skills.js.map +1 -0
  65. package/dist/core/superpowers.d.ts +1 -0
  66. package/dist/core/superpowers.js +31 -0
  67. package/dist/core/superpowers.js.map +1 -0
  68. package/dist/core/types.d.ts +76 -0
  69. package/dist/core/types.js +2 -0
  70. package/dist/core/types.js.map +1 -0
  71. package/dist/utils/fs.d.ts +1 -0
  72. package/dist/utils/fs.js +7 -0
  73. package/dist/utils/fs.js.map +1 -0
  74. package/dist/utils/prompt.d.ts +10 -0
  75. package/dist/utils/prompt.js +90 -0
  76. package/dist/utils/prompt.js.map +1 -0
  77. package/openspec/schemas/alloy/instructions/design.md +46 -0
  78. package/openspec/schemas/alloy/instructions/draft.md +39 -0
  79. package/openspec/schemas/alloy/instructions/plans.md +59 -0
  80. package/openspec/schemas/alloy/instructions/proposal.md +34 -0
  81. package/openspec/schemas/alloy/instructions/retrospective.md +157 -0
  82. package/openspec/schemas/alloy/instructions/specs.md +53 -0
  83. package/openspec/schemas/alloy/instructions/tasks.md +40 -0
  84. package/openspec/schemas/alloy/instructions/verify.md +90 -0
  85. package/openspec/schemas/alloy/schema.yaml +100 -0
  86. package/openspec/schemas/alloy/templates/design.md +15 -0
  87. package/openspec/schemas/alloy/templates/draft.md +17 -0
  88. package/openspec/schemas/alloy/templates/plans.md +28 -0
  89. package/openspec/schemas/alloy/templates/proposal.md +22 -0
  90. package/openspec/schemas/alloy/templates/retrospective.md +163 -0
  91. package/openspec/schemas/alloy/templates/specs.md +54 -0
  92. package/openspec/schemas/alloy/templates/tasks.md +8 -0
  93. package/openspec/schemas/alloy/templates/verify.md +55 -0
  94. package/package.json +43 -0
@@ -0,0 +1,76 @@
1
+ export interface AgentInfo {
2
+ id: string;
3
+ label: string;
4
+ supportsColonCommands: boolean;
5
+ commandsDir: string;
6
+ globalOnly?: boolean;
7
+ }
8
+ export interface DeployOptions {
9
+ scope: "global" | "project";
10
+ injectClaudeMd: boolean;
11
+ projectPath: string;
12
+ targetAgents: AgentInfo[];
13
+ }
14
+ export interface EnvInfo {
15
+ nodeVersion: string;
16
+ gitInstalled: boolean;
17
+ claudeCodeInstalled: boolean;
18
+ }
19
+ export interface CompatConfig {
20
+ compatible: {
21
+ node: string;
22
+ openspec: string;
23
+ superpowers: string;
24
+ alloy: string;
25
+ schema: number;
26
+ };
27
+ install: {
28
+ openspec: string;
29
+ superpowers: string;
30
+ };
31
+ }
32
+ /** @deprecated 使用 HealthCheckResult 替代 */
33
+ export interface CompatResult {
34
+ name: string;
35
+ current: string;
36
+ required: string;
37
+ compatible: boolean;
38
+ }
39
+ export interface HealthCheckResult {
40
+ name: string;
41
+ status: "pass" | "warn" | "fail";
42
+ current: string;
43
+ required: string;
44
+ message?: string;
45
+ }
46
+ export interface DepCheckResult {
47
+ installed: boolean;
48
+ version?: string;
49
+ compatible: boolean;
50
+ }
51
+ export interface ArtifactRecord {
52
+ artifact: string;
53
+ hash: string;
54
+ committed_at: string;
55
+ approver: string;
56
+ }
57
+ export interface PhaseTiming {
58
+ started_at: string;
59
+ completed_at: string | null;
60
+ }
61
+ export interface PhaseTimings {
62
+ start?: PhaseTiming;
63
+ plan?: PhaseTiming;
64
+ apply?: PhaseTiming;
65
+ archive?: PhaseTiming;
66
+ finish?: PhaseTiming;
67
+ }
68
+ export interface AlloyState {
69
+ phase: "started" | "planned" | "applied" | "archived" | "finished";
70
+ worktree: string | null;
71
+ schema_version: number;
72
+ created_at: string;
73
+ updated_at: string;
74
+ phase_timings?: PhaseTimings;
75
+ records: ArtifactRecord[];
76
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare function getPackageRoot(): string;
@@ -0,0 +1,7 @@
1
+ import { join, dirname } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ export function getPackageRoot() {
4
+ // 从 dist/utils/ 回到包根目录(2 级: utils → dist → root)
5
+ return join(dirname(fileURLToPath(import.meta.url)), "..", "..");
6
+ }
7
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,cAAc;IAC5B,iDAAiD;IACjD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const supportsInquirer: boolean;
2
+ export interface Choice {
3
+ name: string;
4
+ value: string;
5
+ }
6
+ export declare function promptSelect(message: string, choices: Choice[]): Promise<string>;
7
+ export declare function promptMultiSelect(message: string, choices: Choice[], opts?: {
8
+ validate?: (ids: string[]) => true | string;
9
+ }): Promise<string[]>;
10
+ export declare function promptConfirm(message: string, defaultValue?: boolean): Promise<boolean>;
@@ -0,0 +1,90 @@
1
+ import { createInterface } from "node:readline";
2
+ // 一次判断,启动时确定
3
+ export const supportsInquirer = (() => {
4
+ const [major] = process.versions.node.split(".").map(Number);
5
+ return major >= 20;
6
+ })();
7
+ // —— 底层 stdin helpers ——
8
+ function ask(question) {
9
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
10
+ return new Promise((resolve) => {
11
+ rl.question(question, (answer) => {
12
+ rl.close();
13
+ resolve(answer);
14
+ });
15
+ });
16
+ }
17
+ export async function promptSelect(message, choices) {
18
+ if (supportsInquirer) {
19
+ const { select } = await import("@inquirer/prompts");
20
+ return select({ message, choices });
21
+ }
22
+ // stdin fallback
23
+ console.log(message);
24
+ choices.forEach((c, i) => console.log(` [${i + 1}] ${c.name}`));
25
+ const answer = await ask(`输入数字 (1-${choices.length}): `);
26
+ const idx = parseInt(answer.trim(), 10) - 1;
27
+ if (idx >= 0 && idx < choices.length)
28
+ return choices[idx].value;
29
+ return choices[0].value;
30
+ }
31
+ export async function promptMultiSelect(message, choices, opts) {
32
+ if (supportsInquirer) {
33
+ const { checkbox } = await import("@inquirer/prompts");
34
+ // @inquirer checkbox 的 validate 传入 NormalizedChoice[],适配为 string[]
35
+ const rawValidate = opts?.validate;
36
+ return checkbox({
37
+ message,
38
+ choices: choices.map((c) => ({ name: c.name, value: c.value })),
39
+ validate: rawValidate
40
+ ? (vals) => rawValidate(vals.map((v) => v.value))
41
+ : undefined,
42
+ });
43
+ }
44
+ // stdin fallback: 编号多选
45
+ while (true) {
46
+ console.log(message);
47
+ choices.forEach((c, i) => console.log(` [${i + 1}] ${c.name}`));
48
+ const answer = await ask("输入编号,逗号分隔: ");
49
+ const trimmed = answer.trim();
50
+ if (!trimmed) {
51
+ if (opts?.validate) {
52
+ const err = opts.validate([]);
53
+ if (err !== true) {
54
+ console.log(` ⚠ ${err}`);
55
+ continue;
56
+ }
57
+ }
58
+ return [];
59
+ }
60
+ const ids = [];
61
+ const parts = trimmed.split(/[,,\s]+/);
62
+ for (const p of parts) {
63
+ const idx = parseInt(p, 10) - 1;
64
+ if (idx >= 0 && idx < choices.length) {
65
+ ids.push(choices[idx].value);
66
+ }
67
+ }
68
+ if (opts?.validate) {
69
+ const err = opts.validate(ids);
70
+ if (err !== true) {
71
+ console.log(` ⚠ ${err}`);
72
+ continue;
73
+ }
74
+ }
75
+ return ids;
76
+ }
77
+ }
78
+ export async function promptConfirm(message, defaultValue) {
79
+ if (supportsInquirer) {
80
+ const { confirm } = await import("@inquirer/prompts");
81
+ return confirm({ message, default: defaultValue });
82
+ }
83
+ const suffix = defaultValue === true ? " [Y/n] " : defaultValue === false ? " [y/N] " : " [y/N] ";
84
+ const answer = await ask(message + suffix);
85
+ const trimmed = answer.trim().toLowerCase();
86
+ if (trimmed === "")
87
+ return defaultValue ?? false;
88
+ return trimmed === "y" || trimmed === "yes";
89
+ }
90
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,aAAa;AACb,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE;IACpC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,KAAK,IAAI,EAAE,CAAC;AACrB,CAAC,CAAC,EAAE,CAAC;AAEL,yBAAyB;AAEzB,SAAS,GAAG,CAAC,QAAgB;IAC3B,MAAM,EAAE,GAAG,eAAe,C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C;IAClG,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5C,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,YAAY,IAAI,KAAK,CAAC;IACjD,OAAO,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,KAAK,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,46 @@
1
+ # design 制品指令
2
+
3
+ **定位:** 解释"怎么做"的技术方案。将 draft.md 中的技术决策重组为结构化设计文档。design 是 tasks 的输入——tasks 依赖它来确定实现步骤。
4
+
5
+ 产出: `design.md`
6
+ 依赖: proposal + draft(由 instruction 读取)
7
+
8
+ ## 生成指令
9
+
10
+ 读取 draft.md 作为输入。draft.md 是 brainstorming 的原始捕获(通常是决策日志,含 Q1-Qn 决策、取舍和上下文)。你的工作是**重组(reorganize)**这些内容到以下结构化章节中——不是复制,是转换:
11
+
12
+ **## Context**
13
+ 背景、当前状态、约束条件、利益相关者。给读者理解"为什么需要这个设计"的上下文。
14
+
15
+ **## Goals / Non-Goals**
16
+ - Goals: 本次设计达成的目标
17
+ - Non-Goals: 明确排除的内容——防止范围蔓延
18
+
19
+ **## Decisions**
20
+ 关键技术选择。每个决策包含:
21
+ - 选择什么
22
+ - 为什么选 X 而非 Y(列出考虑过的替代方案及排除理由)
23
+ - 取舍是什么(性能 vs 复杂度、灵活性 vs 简单性)
24
+
25
+ 从 draft.md 中提取:决策(Q1-Qn)→ design.md §Decisions;背景/上下文 → design.md §Context;取舍 → design.md §Risks / Trade-offs。补充 Goals/Non-Goals 和 Migration Plan(可能需要根据 draft.md 内容推断)。
26
+
27
+ **## Risks / Trade-offs**
28
+ 已知限制和可能出错的地方。格式:`[风险] → 缓解措施`
29
+
30
+ **## Migration Plan**
31
+ 部署步骤、回滚策略(如适用)。涉及数据迁移时必须写。
32
+
33
+ **## Open Questions**
34
+ 待解决的决策或未知项。
35
+
36
+ ## IMPORTANT
37
+
38
+ - 这是重组,不是复制。draft.md 中分散的决策要重新组织到对应的结构化章节中
39
+ - 技术方案受 proposal Capabilities 范围约束——不要设计超出范围的东西
40
+ - 好的 design doc 解释"为什么选 X 而非 Y"——列出替代方案及排除理由
41
+ - 聚焦架构和方案,不写逐行实现细节
42
+
43
+ ## 约束
44
+
45
+ - 与 draft.md 中的决策保持一致,不可自行偏离
46
+ - design 读 draft.md,但不在草案之外引入新的需求假设
@@ -0,0 +1,39 @@
1
+ # draft 制品指令
2
+
3
+ **定位:** Pre-OpenSpec 阶段的需求设计草案。draft.md 是 proposal 和 design 的唯一需求输入——先把事情想清楚,再结构化。
4
+
5
+ 产出: `draft.md`(start 阶段生成于项目根目录,确认后移入 `openspec/changes/<name>/`)
6
+ 依赖: 无
7
+
8
+ ## 生成指令
9
+
10
+ PRECHECK — 技能可用性:
11
+ 在调用前确认 `superpowers:brainstorming` 在你的可用技能列表中。若不可用,STOP 并告知用户需要安装 Superpowers(或用户可明确选择用下方模板手动写 draft.md)。不要静默降级。
12
+
13
+ 使用 Skill 工具调用 **superpowers:brainstorming**。
14
+
15
+ IMPORTANT — 输出重定向:
16
+ - 不要写入 `docs/superpowers/specs/`。将 brainstorming 输出直接写入项目根目录 `draft.md`
17
+ - draft.md 是**原始捕获**——不强制模板结构,保留 brainstorming 的自然输出。brainstorming 的典型输出是决策日志(背景 → 决策链 Q1-Qn → 设计取舍),但具体格式因对话而异。保留其自然组织方式
18
+ - 不要在此步骤预先填充 design.md。design.md 是独立制品,在后续阶段重组 draft.md 内容
19
+
20
+ brainstorming 技能将:
21
+ 1. 探查项目上下文
22
+ 2. 逐个询问澄清问题
23
+ 3. 提出 2-3 个方案及取舍
24
+ 4. 按章节展示设计并获取审批
25
+ 5. 输出已验证的设计
26
+
27
+ ## draft.md 内容
28
+
29
+ 自由格式,通常包含:
30
+ - **Why** — 要解决的问题
31
+ - **What** — 方案概述
32
+ - **关键决策链** — Q1 → Qn 技术决策及理由
33
+ - **范围与边界** — 明确不做什么
34
+
35
+ ## 约束
36
+
37
+ - draft.md 初始生成在项目根目录。start 阶段确认后由 `/opsx:new` 创建 change 目录,draft.md 移入 `openspec/changes/<name>/`
38
+ - 不将 brainstorming 输出写入 `docs/superpowers/specs/`——draft.md 是唯一产出
39
+ - 完成后提示用户:可用 grill-me 深入拷问需求,确认后运行 `/alloy:plan`
@@ -0,0 +1,59 @@
1
+ # plans 制品指令
2
+
3
+ **定位:** 将 tasks.md 的粗粒度 checkbox 拆为可执行的 TDD 微步骤。plans.md 是 apply 阶段的直接输入——每个微步骤对应一个 RED-GREEN-REFACTOR 循环。
4
+
5
+ 产出: `plans.md`(TDD 微步骤)
6
+ 依赖: tasks
7
+
8
+ ## 生成指令
9
+
10
+ PRECHECK — 技能可用性:
11
+ 在调用前确认 `superpowers:writing-plans` 在你的可用技能列表中。若不可用,STOP 并告知用户需要安装 Superpowers(或用户可明确选择用下方模板手动写 plans.md)。不要静默降级。
12
+
13
+ 使用 Skill 工具调用 **superpowers:writing-plans**。
14
+
15
+ IMPORTANT — 输出位置:
16
+ - 产出文件直接写入当前 change 目录:`openspec/changes/<name>/plans.md`
17
+ - 将 tasks.md 的内容作为分解输入传给 writing-plans 技能
18
+
19
+ writing-plans 技能将:
20
+ 1. 读取 tasks.md 和 design.md 获取上下文
21
+ 2. 分析任务特征,决定执行策略(SDD 并行 vs 串行),写入 YAML frontmatter
22
+ 3. 将每个 task 拆为 2-5 分钟的 TDD 微步骤
23
+ 4. 每步包含:目标、文件路径、TDD 步骤(RED → GREEN → REFACTOR)、测试命令、预期输出
24
+ 5. 在每个 task 后添加 commit 点
25
+
26
+ ## plans.md 结构
27
+
28
+ ### YAML Frontmatter
29
+
30
+ ```yaml
31
+ ---
32
+ strategy: sdd | serial
33
+ reason: <策略背后的分析理由,apply 阶段展示给用户>
34
+ ---
35
+ ```
36
+
37
+ - `strategy`: `sdd`(任务独立可并行)或 `serial`(任务耦合需串行)
38
+ - `reason`: writing-plans 分析后的一两句话,apply 阶段展示给用户作为推荐依据
39
+
40
+ ### 微步骤格式
41
+
42
+ 每个微步骤应包含:
43
+ - **目标:** 这一步要达成什么
44
+ - **文件路径:** 涉及的文件
45
+ - **TDD 步骤:** RED(写失败测试)→ GREEN(最小实现)→ REFACTOR(重构)
46
+ - **测试命令:** 验证该步骤的具体命令
47
+ - **预期输出:** 测试通过后的预期结果
48
+
49
+ ## IMPORTANT
50
+
51
+ - tasks.md 已经完成了粗粒度拆分——plan 的工作是细化,不是重做
52
+ - plan 的微步骤粒度 = 一个子 agent 可以在 2-5 分钟内完成的单元
53
+ - 每一步都应该是可独立验证的——写完就能跑测试确认
54
+
55
+ ## 约束
56
+
57
+ - 不跳过 TDD 循环——每步必须有 RED → GREEN → REFACTOR
58
+ - 不提供一键生成——始终分步,每步可审查
59
+ - plan 完成后不自动进入 apply——给用户空间审视完整计划
@@ -0,0 +1,34 @@
1
+ # proposal 制品指令
2
+
3
+ **定位:** 基于 draft.md 的需求探索结果,提取并浓缩变更范围。proposal 是规划阶段的第一个正式制品——其 Capabilities 列表创建了 proposal 与 specs 之间的合约:specs 仅读取 Capabilities 列表,不读取 draft.md。
4
+
5
+ 产出: `proposal.md`
6
+ 依赖: draft(由 instruction 读取,不通过 schema requires 声明)
7
+
8
+ ## 生成指令
9
+
10
+ 读取 draft.md 获取已验证的设计。提取:
11
+
12
+ **## Why**
13
+ 变更动机。简述问题或机会,1-2 段即可。聚焦业务价值,不写技术细节。
14
+
15
+ **## What Changes**
16
+ Capabilities 列表——这是最关键的部分。Capabilities 是抽象的行为能力描述:
17
+ - **New Capabilities:** 本次变更引入的新能力。每个使用 kebab-case 命名(如 `user-authentication`、`payment-capture`)。每个将成为 `specs/<capability>/spec.md`
18
+ - **Modified Capabilities:** 现有能力的 REQUIREMENTS 发生变化。检查 `openspec/specs/` 确认已有 spec 名称,不要编造不存在的 Capability 名
19
+ - 每个 Capability 一行简短描述,说明它做什么(而非怎么实现)
20
+
21
+ **## Impact**
22
+ 受影响的范围:代码模块、API、依赖、数据迁移。1-2 段。
23
+
24
+ ## IMPORTANT
25
+
26
+ - draft.md 已经完成了需求探索——proposal 是**提取和浓缩**,不是重新探索
27
+ - **Capabilities 是合约:** proposal 列出的每个 Capability,specs 阶段都必须有对应的 spec 文件。不要列出你不会实现的 Capability
28
+ - **区分新能力 vs 修改能力:** 行为规格变了但概念相同 → Modified;引入了全新概念 → New
29
+ - 保持 1-2 页。聚焦"为什么"和"做什么",不写"怎么做"
30
+
31
+ ## 约束
32
+
33
+ - Capabilities 必须是抽象的行为能力描述,不含技术实现细节(如"用 Redis 缓存" → 应写为"支持会话持久化")
34
+ - 范围不超出 draft.md 中约定的边界
@@ -0,0 +1,157 @@
1
+ # retrospective 制品指令
2
+
3
+ **定位:** apply 阶段 step 5 产出。复盘覆盖 start → plan → apply 全周期,先量化再定性,先证据再判断。
4
+ retrospective 的价值在于捕获"当时知道什么、怎么推理的",不是事后美化。
5
+
6
+ 产出: `retrospective.md`
7
+ 依赖: verify.md 存在且 Overall Decision 不是 FAIL
8
+
9
+ ## PRECHECK(shell 命令,非 LLM 判断)
10
+
11
+ 两条命令都通过后才生成 retrospective:
12
+
13
+ 1. 确认 verify.md 存在:
14
+ ```
15
+ test -f openspec/changes/<change-name>/verify.md
16
+ ```
17
+
18
+ 2. 确认 Overall Decision 不是 FAIL:
19
+ ```
20
+ ! grep -q '^- \[x\] ❌ FAIL' openspec/changes/<change-name>/verify.md
21
+ ```
22
+
23
+ FAIL 时 STOP,告知用户先修复 verify 中的阻塞问题。
24
+
25
+ ## 生成流程
26
+
27
+ ### Step 1: 收集证据(§0)
28
+
29
+ 从三个来源自动收集,不依赖 LLM 判断:
30
+
31
+ **来源一:.alloy.yaml(制品审批链)**
32
+ ```bash
33
+ alloy _state read openspec/changes/<name> records
34
+ alloy _state read openspec/changes/<name> created_at
35
+ alloy _state read openspec/changes/<name> worktree
36
+ ```
37
+
38
+ 提取每个制品的 artifact / hash / approver / committed_at,构建审批链。
39
+
40
+ **来源二:git log(全周期 commit 全景)**
41
+ ```bash
42
+ git log <base>..HEAD --oneline
43
+ git log <base>..HEAD --format="%ai %s"
44
+ git diff --stat <base>..HEAD | tail -1
45
+ ```
46
+
47
+ 按 Conventional Commits type 分组统计(feat / fix / docs / chore / test 等),再按阶段分组(start / plan / apply)。
48
+
49
+ **来源三:文件系统(制品状态)**
50
+ - `tasks.md` checkbox 完成比(`[x]` / 总数)
51
+ - `verify.md` Overall Decision
52
+ - `plans.md` YAML frontmatter(strategy / reason)
53
+
54
+ **§0 输出字段:**
55
+
56
+ | 字段 | 来源 | 说明 |
57
+ |------|------|------|
58
+ | 全周期时间线 | `.alloy.yaml` records | 从 draft 到 retrospective 每个制品的 committed_at |
59
+ | Commit 汇总(按 type) | `git log` | feat / docs / chore 各多少,是否还有 fix/test 等 |
60
+ | Commit 汇总(按阶段) | `git log` + commit message 前缀 | start / plan / apply 各多少 |
61
+ | 制品审批链 | `.alloy.yaml` records | 制品 + 审批人 + Hash + 时间 四列 |
62
+ | 阶段耗时 | `.alloy.yaml` + `git log` | created_at → 最后 commit 时间;各阶段间隔 |
63
+ | 任务完成比 | `tasks.md` | 已勾 / 总数 |
64
+ | 变更规模 | `git diff --stat` | 文件数、行数 |
65
+ | Worktree 状态 | `.alloy.yaml` worktree | 是否使用隔离环境 |
66
+ | 计划策略 vs 实际策略 | `plans.md` + Agent 自报 | plans/strategy vs 实际采用的执行方式 |
67
+ | 验证状态 | `verify.md` | Overall Decision (PASS/FAIL/WARNING) |
68
+ | 测试覆盖信号 | `git diff --stat` 分析 | 测试文件变更 vs 源文件变更的比例 |
69
+ | 完整提交链 | `git log --oneline` | 每条 commit message |
70
+
71
+ ### Step 2: 写入定性分析(§1-§6)
72
+
73
+ 每条结论必须引用 §0 的证据或具体 commit hash/文件路径/测试名称。
74
+
75
+ #### §1 做对了什么
76
+ - 每个 point 格式:`- [evidence: <commit/file/test>] <描述>`
77
+ - 聚焦可复现的成功模式
78
+
79
+ #### §2 做错了什么
80
+ 三级严重度,每条带 evidence:
81
+ - `- 🔴 [blocking | evidence: ...] <描述>` — 阻塞性问题
82
+ - `- 🟡 [painful | evidence: ...] <描述>` — 痛苦但不阻塞
83
+ - `- 📌 [nit | evidence: ...] <描述>` — 小问题
84
+
85
+ #### §3 计划偏离
86
+ 表格:Plan task / What changed / Why
87
+ 哪些 task 的范围在执行中发生了变化,原因是什么。
88
+ 如果 plans.md 的 strategy 和实际执行方式不同,在此记录。
89
+
90
+ #### §4 全周期技能审计
91
+
92
+ Agent 自报全周期技能和命令使用情况(同一 session 亲历):
93
+
94
+ **start 阶段:**
95
+ | 技能/命令 | 使用 |
96
+ |----------|:---:|
97
+ | `opsx:explore` | |
98
+ | `superpowers:brainstorming` | |
99
+
100
+ **plan 阶段:**
101
+ | 技能/命令 | 使用 |
102
+ |----------|:---:|
103
+ | `/opsx:continue` | |
104
+ | `superpowers:writing-plans` | |
105
+
106
+ **apply 阶段:**
107
+ | 技能/命令 | 使用 |
108
+ |----------|:---:|
109
+ | `superpowers:using-git-worktrees` | |
110
+ | `superpowers:subagent-driven-development` | |
111
+ | `superpowers:executing-plans` | |
112
+ | `superpowers:test-driven-development` | |
113
+ | `superpowers:requesting-code-review` | |
114
+ | `superpowers:verification-before-completion` | |
115
+ | `/opsx:verify` | |
116
+
117
+ 默认期望所有行都是 ✓。
118
+
119
+ **Deliberately Skipped Skills:** 对于每个标记 ✗ 的技能,必须回答三个问题:
120
+ 1. **What was skipped** — 具体跳过了哪个技能或子步骤
121
+ 2. **Why this cycle** — 具体触发原因(必须有具体的 commit hash、日志行或观察到的行为)
122
+ 3. **How to prevent recurrence** — 从以下选项中选择:
123
+ - schema graph fix(schema 图修正)
124
+ - skill description tightening(技能描述收紧)
125
+ - CLAUDE.md trigger(CLAUDE.md 触发规则)
126
+ - scope-judgment rule(范围判断规则)
127
+ - one-off(一次性,需说明为什么是边界情况)
128
+
129
+ 如果多个 cycle 因相似原因跳过同一技能,该模式应成为 §6 的 Promote candidate。
130
+
131
+ #### §5 意外发现
132
+ `- <被推翻的假设>` — 哪些假设被证明是错误的
133
+
134
+ #### §6 值得推广
135
+ 使用 `- [ ]` checklist(非表格),未勾选的 = 跨周期 carry-forward:
136
+ - 标题:严重度 emoji + 一句话教训
137
+ - `→ **Promote to** <destination>`(memory / CLAUDE.md / schema / skill / one-off)
138
+ - `> **Why**: <原因>`
139
+ - `> **How to apply**: <触发条件>`
140
+
141
+ 格式对齐 feedback memory schema,使 Why/How to apply 可直接转移到 `~/.claude/memory/`。
142
+
143
+ ### Step 3: 跳过策略
144
+
145
+ | 情况 | 处理 |
146
+ |------|------|
147
+ | 单 commit 小修(linter fix、typo 等) | 可跳过,写一行 "Skipped: single-commit fix, no insights" |
148
+ | 其他一切 | 必须产出 §0 + 全部 6 个分析节。某节确实没有内容时写 "(none observed)" |
149
+
150
+ ### Forward-Pointer 策略
151
+
152
+ 如果后续 cycle 发现 retrospective 中的某个结论、证据或判断是错误/不完整的:
153
+ - **不要重写** retrospective(会丢失审计线索)
154
+ - 追加 forward-pointer:`> **Update YYYY-MM-DD**: section X superseded by <链接到后续 retro / commit / issue>`
155
+ - 后续制品承载修正后的分析
156
+
157
+ 理由:"retrospective 是证据驱动的——它的价值在于捕获特定时间点已知的事实和推理过程。"
@@ -0,0 +1,53 @@
1
+ # specs 制品指令
2
+
3
+ **定位:** 定义系统"应该做什么"的行为规格。specs 是行为契约——描述外部可观察行为,不描述内部实现。每个 Capability 一个 spec 文件。
4
+
5
+ 产出: `specs/**/*.md`(按 Capability 拆分)
6
+ 依赖: proposal
7
+
8
+ ## 生成指令
9
+
10
+ 1. 读取 proposal.md 的 Capabilities 列表
11
+ 2. 为每个 Capability 创建一个 spec 文件:
12
+ - **New Capabilities:** 使用 proposal 中确切的 kebab-case 名称 → `specs/<capability>/spec.md`
13
+ - **Modified Capabilities:** 使用 `openspec/specs/<capability>/` 下的现有目录名
14
+ 3. 使用以下 Delta 操作区段(## 二级标题):
15
+
16
+ **## ADDED Requirements**
17
+ 新增的能力。每个需求:`### Requirement: <名称>`,跟一段描述。
18
+
19
+ **## MODIFIED Requirements**
20
+ 修改的现有行为。**必须包含完整更新后的内容**,不只是 diff。
21
+
22
+ **## REMOVED Requirements**
23
+ 废弃的功能。**必须包含 Reason**(为什么移除)和 **Migration**(迁移方案)。
24
+
25
+ **## RENAMED Requirements**
26
+ 仅名称变更。使用 `FROM: <旧名> TO: <新名>` 格式。
27
+
28
+ ## 格式要求
29
+
30
+ - 需求使用 SHALL/MUST 表达规范性要求(避免 should/may)
31
+ - 每个需求:`### Requirement: <名称>` 后跟描述
32
+ - 每个需求必须至少有一个场景。场景格式:
33
+ ```
34
+ #### Scenario: <场景名>
35
+ - **WHEN** <条件>
36
+ - **THEN** <预期行为>
37
+ ```
38
+ - **CRITICAL:场景必须使用恰好 4 个井号(`####`)。使用 3 个井号或 bullet 会导致静默解析失败。**
39
+ - 每个场景都是潜在的测试用例——规格应该可测试
40
+
41
+ ## CRITICAL 约束
42
+
43
+ - **故意不读 draft.md** —— 只读 proposal 的 Capabilities 列表。这防止行为规格被 draft.md 中的技术实现细节污染。specs 描述"系统应该做什么",不应该知道"打算用 Redis 还是 Postgres"
44
+ - 规格是行为契约,不写类名、库选型、目录结构
45
+ - 仅描述外部可观察行为
46
+
47
+ ## 格式校验
48
+
49
+ 生成完成后,必须运行 `openspec validate --all` 验证 Delta Spec 格式。常见问题:
50
+ - header 格式:`## ADDED` → 应为 `## ADDED Requirements`(OpenSpec 要求完整 section 名)
51
+ - 场景层级:`#### Scenario:` 必须恰好 4 个 `#`,多用或少用会导致静默解析失败
52
+
53
+ 若 validate 失败,根据错误提示修正格式,重新验证直到通过。
@@ -0,0 +1,40 @@
1
+ # tasks 制品指令
2
+
3
+ **定位:** 将"做什么"(specs)和"怎么做"(design)拆分为可追踪的实现清单。tasks.md 是 plan 的输入——plan 将每个 task 进一步拆为 TDD 微步骤。
4
+
5
+ 产出: `tasks.md`(层级编号 checkbox 清单)
6
+ 依赖: specs + design
7
+
8
+ ## 生成指令
9
+
10
+ 1. 读取 specs——确定"做什么"(功能边界、行为需求)
11
+ 2. 读取 design——确定"怎么做"(架构决策、技术方案)
12
+ 3. 将实现工作拆分为层级编号的 checkbox 清单
13
+ 4. **按依赖排序**——必须先完成的放在前面
14
+
15
+ ## 格式要求
16
+
17
+ **IMPORTANT:严格按照以下模板。** apply 阶段通过解析 `- [ ]` checkbox 格式追踪进度。不使用 checkbox 格式的任务不会被追踪。
18
+
19
+ ```
20
+ ## 1. <任务类别>
21
+ - [ ] 1.1 <具体任务描述>
22
+ - [ ] 1.2 <具体任务描述>
23
+
24
+ ## 2. <任务类别>
25
+ - [ ] 2.1 <具体任务描述>
26
+ ```
27
+
28
+ ## 指导原则
29
+
30
+ - 按 ## 编号标题分组相关任务
31
+ - 每个任务必须是 checkbox:`- [ ] X.Y 任务描述`
32
+ - 任务粒度:每个 task 应在一个 session 内可完成
33
+ - 按依赖排序:基础设施 → 核心功能 → 集成 → 测试
34
+ - 每个 task 应能从 specs 中找到对应的需求依据
35
+ - 参考 specs 了解需要构建什么,参考 design 了解如何构建
36
+
37
+ ## 约束
38
+
39
+ - 不涉及 TDD 微步骤(留给 plan 制品处理)
40
+ - 粗粒度即可——每个 checkbox 代表一个有意义的交付单元