@buildr-ai/buildr 0.1.0-rc.1

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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/docs/cli-architecture.md +62 -0
  4. package/docs/cli-reference.md +67 -0
  5. package/docs/known-limitations.md +13 -0
  6. package/examples/minimal-workspace/README.md +24 -0
  7. package/package/README.md +28 -0
  8. package/package/bootstrap/contract.yml +122 -0
  9. package/package/bootstrap/guide.md +79 -0
  10. package/package/manifest.yml +144 -0
  11. package/package/targets/runtime/skills/buildr/SKILL.md +151 -0
  12. package/package/targets/workspace/.buildr/workspace.yml +5 -0
  13. package/package/targets/workspace/AGENTS.md +5 -0
  14. package/package/targets/workspace/commands/buildr/openspec/manifest.yml +15 -0
  15. package/package/targets/workspace/commands/manifest.yml +2 -0
  16. package/package/targets/workspace/components/buildr/openspec/component.yml +16 -0
  17. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-apply-sidebar.md +3 -0
  18. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-archive-sidebar.md +3 -0
  19. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-explore-sidebar.md +3 -0
  20. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-propose-sidebar.md +3 -0
  21. package/package/targets/workspace/components/buildr/openspec/contributions/openspec-sync-sidebar.md +3 -0
  22. package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-post-sync.md +1 -0
  23. package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-pre-sync.md +1 -0
  24. package/package/targets/workspace/components/buildr/openspec/contributions/task-triage-change-ready.md +10 -0
  25. package/package/targets/workspace/components/manifest.yml +2 -0
  26. package/package/targets/workspace/gitignore +13 -0
  27. package/package/targets/workspace/projects/AGENTS.project.md +25 -0
  28. package/package/targets/workspace/projects/manifest.yml +2 -0
  29. package/package/targets/workspace/projects/services/manifest.yml +3 -0
  30. package/package/targets/workspace/projects/skills/manifest.yml +2 -0
  31. package/package/targets/workspace/rules/buildr/core.md +63 -0
  32. package/package/targets/workspace/rules/manifest.yml +9 -0
  33. package/package/targets/workspace/skills/buildr/git-ops/SKILL.md +73 -0
  34. package/package/targets/workspace/skills/buildr/openspec-contract-guard/SKILL.md +67 -0
  35. package/package/targets/workspace/skills/buildr/task-finish/SKILL.md +104 -0
  36. package/package/targets/workspace/skills/buildr/task-triage/SKILL.md +103 -0
  37. package/package/targets/workspace/skills/buildr/task-worktree/SKILL.md +104 -0
  38. package/package/targets/workspace/skills/manifest.yml +38 -0
  39. package/package/targets/workspace/skills/openspec/openspec-apply-change/SKILL.md +159 -0
  40. package/package/targets/workspace/skills/openspec/openspec-archive-change/SKILL.md +117 -0
  41. package/package/targets/workspace/skills/openspec/openspec-explore/SKILL.md +287 -0
  42. package/package/targets/workspace/skills/openspec/openspec-propose/SKILL.md +111 -0
  43. package/package/targets/workspace/skills/openspec/openspec-sync-specs/SKILL.md +147 -0
  44. package/package.json +67 -0
  45. package/tools/buildr +11 -0
  46. package/tools/cli/application/cli-update.mjs +219 -0
  47. package/tools/cli/application/compose-runtime.mjs +38 -0
  48. package/tools/cli/application/doctor/runtime-diagnostics.mjs +226 -0
  49. package/tools/cli/application/doctor/scope-diagnostics.mjs +440 -0
  50. package/tools/cli/application/doctor/service-diagnostics.mjs +184 -0
  51. package/tools/cli/application/doctor.mjs +201 -0
  52. package/tools/cli/application/package-maintenance/builtin-receipts.mjs +73 -0
  53. package/tools/cli/application/package-maintenance/output.mjs +148 -0
  54. package/tools/cli/application/package-maintenance/smoke-checks.mjs +469 -0
  55. package/tools/cli/application/package-maintenance/static-validation.mjs +678 -0
  56. package/tools/cli/application/package-maintenance.mjs +538 -0
  57. package/tools/cli/application/runtime.mjs +118 -0
  58. package/tools/cli/application/workspace-operations.mjs +310 -0
  59. package/tools/cli/bootstrap.mjs +6 -0
  60. package/tools/cli/command/help.mjs +292 -0
  61. package/tools/cli/command/registry.mjs +97 -0
  62. package/tools/cli/domains/commands.mjs +661 -0
  63. package/tools/cli/domains/components.mjs +922 -0
  64. package/tools/cli/domains/openspec.mjs +603 -0
  65. package/tools/cli/domains/package-assets.mjs +652 -0
  66. package/tools/cli/domains/rules.mjs +380 -0
  67. package/tools/cli/domains/runtime.mjs +94 -0
  68. package/tools/cli/domains/skills.mjs +647 -0
  69. package/tools/cli/domains/workspace.mjs +571 -0
  70. package/tools/cli/shared/infrastructure.mjs +411 -0
  71. package/tools/cli/shared/json-contracts.mjs +22 -0
  72. package/tools/cli/shared/platform.mjs +52 -0
  73. package/tools/runtime/adapter-contract.mjs +330 -0
  74. package/tools/runtime/check-claude-code.mjs +26 -0
  75. package/tools/runtime/check-codex.mjs +26 -0
  76. package/tools/runtime/projection.mjs +163 -0
  77. package/tools/runtime/render-claude-code-rules.mjs +459 -0
  78. package/tools/runtime/render-claude-code.mjs +59 -0
  79. package/tools/runtime/skills/arguments.mjs +51 -0
  80. package/tools/runtime/skills/contributions.mjs +171 -0
  81. package/tools/runtime/skills/manifests.mjs +167 -0
  82. package/tools/runtime/skills/primitives.mjs +86 -0
  83. package/tools/runtime/skills/render-plan.mjs +244 -0
  84. package/tools/runtime/skills/sources.mjs +276 -0
  85. package/tools/shared/fetch-remote-text.mjs +78 -0
  86. package/tools/verification/integrity/managed-data-integrity.mjs +107 -0
  87. package/tools/verification/integrity/managed-mutations.mjs +72 -0
  88. package/tools/verification/openspec/contract.mjs +212 -0
  89. package/tools/verification/runtime/adapter-contract.mjs +102 -0
  90. package/tools/verification/runtime/adapter-parity.mjs +99 -0
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: task-finish
3
+ description: 用户在 task worktree 中要求“收尾”、完成任务、自动收尾,或要求自动完成已验证 change 的归档、提交、集成、推送和本地清理时使用。
4
+ ---
5
+
6
+ # Task Finish Skill
7
+
8
+ 本 Skill 是 Buildr 自有的任务收尾编排层。它在不修改外部 OpenSpec Skills 的前提下,组合项目验证、OpenSpec、Git Ops 和 Task Worktree 契约,把已完成任务安全推进到目标分支已推送、本地 task worktree 已清理的状态。
9
+
10
+ ## “收尾”的授权
11
+
12
+ 用户在当前轮次明确说“收尾”、完成任务或自动收尾,表示一次性授权以下常规动作:
13
+
14
+ - 对已完成的 OpenSpec change 默认同步 delta specs 并归档。
15
+ - 修复可证明由 OpenSpec archive/specs sync 产生的 Markdown 文件末尾多余空行。
16
+ - 提交当前任务直接相关改动。
17
+ - fetch 已确认远端;对本地未推送任务分支执行无语义冲突的必要 rebase。
18
+ - fast-forward-only 集成到已确认目标分支并普通 push 该目标分支。
19
+ - 迁移仍指向待删 worktree 的本机入口,删除本地 task worktree 和本地任务分支。
20
+
21
+ 该授权只在当前轮次有效。执行 Git 写操作前,必须向用户一次性说明任务/change、提交范围、commit message、目标分支、远端、集成方式和本地清理范围;上下文清楚时不再逐项等待确认。
22
+
23
+ “收尾”不授权 force push、merge commit、删除远端任务分支、丢弃改动、改写已推送或共享分支历史,也不授权替用户解决需要业务或语义判断的冲突。出现这些情况时停止并请求对具体动作的明确授权或决策。
24
+
25
+ ## 1. 收尾前置检查
26
+
27
+ 在任何归档、提交、merge、push 或 cleanup 前确认:
28
+
29
+ - 使用 `git rev-parse --show-toplevel`、`git worktree list --porcelain` 和当前分支解析真实仓库、Buildr workspace root、canonical task worktree 与本地任务分支。
30
+ - 当前任务/change、目标分支和远端均唯一可确认;不得根据目录名猜测仓库边界或目标分支。
31
+ - task worktree 中的改动都属于当前任务;存在无关 dirty changes 时不 stage、不丢弃,并在破坏性动作前停止。
32
+ - 主 workspace 可用于集成且没有未处理改动。
33
+ - 如果存在 active OpenSpec change,使用 `openspec status --change <id> --json` 和 apply instructions 确认 artifacts、tasks 与 action context;未完成、blocked 或 workspace planning context 不得自动归档。
34
+ - 当前候选内容具备可信的项目验证结果。当前会话没有对应成功结果,或验证后内容已改变时,先运行项目要求的验证。
35
+
36
+ 如果此前完整验证失败,收尾前必须确认修复期间已经优先重跑失败项和受影响专项检查,并在候选重新稳定后完成一次新的最终完整验证。不得把仍在修复循环中的专项检查结果当作最终候选验证证据。
37
+
38
+ 多个 change、多个 worktree、多个远端或目标分支无法消歧时停止,不替用户选择。
39
+
40
+ ## 2. OpenSpec 归档与格式收敛
41
+
42
+ 当前任务包含已完成的 active OpenSpec change 时:
43
+
44
+ <!-- buildr:skill-contributions pre-spec-sync -->
45
+
46
+ 1. 使用外部可用的 OpenSpec CLI/Skills 评估 delta specs,并采用默认推荐路径同步 canonical specs。不得直接修改 Buildr 随附的 `openspec-*` Skill 源来加入收尾逻辑。
47
+
48
+ <!-- buildr:skill-contributions post-spec-sync -->
49
+
50
+ 2. 归档后立即运行 `git diff --check`。
51
+ 3. 只有全部诊断都是本次 archive/specs sync 修改的 OpenSpec Markdown 文件中的 `new blank line at EOF` 时,才自动删除多余结尾空白行,使每个文件恰好以一个换行结束。
52
+ 4. 自动规范后重新运行 `git diff --check` 和当前 planning root 的 OpenSpec strict validation。
53
+ 5. 任何其他 whitespace error、非 OpenSpec 文件或无法确认来源的问题都停止自动修复并报告。
54
+
55
+ 归档改变 specs/tree,但不等于产品实现需要重复完整 E2E。只运行归档直接影响的格式、OpenSpec 或项目专项检查。
56
+
57
+ ## 3. 提交与验证 tree
58
+
59
+ - 按 Git Ops 提交范围检查,只 stage 当前任务文件;提交前展示变更摘要和 commit message。
60
+ - 提交只记录已检查内容;commit hook 或提交后状态若表明内容改变,重新判断验证。
61
+ - 提交后记录最终候选 Git tree identity,例如 `git rev-parse HEAD^{tree}`。
62
+ - fetch 最新目标分支。仅当本地未推送任务分支发生分叉时执行必要 rebase;已推送或共享分支不自动改写。
63
+ - rebase 后再次读取 `HEAD^{tree}` 并与已验证 tree 比较:
64
+ - tree 相同:复用已有验证结果,不因 commit hash、parent、checkout 或分支名称变化重复 E2E。
65
+ - tree 不同:在集成前重新运行受影响的验证;验证失败时停止 merge、push 和 cleanup。
66
+ - rebase 冲突只有在能机械保持双方既有语义时才可继续;需要业务选择时停止。
67
+ - 验证命令仍返回 session、cell、process id 或运行中状态时,继续 wait、poll 或 resume 同一进程;暂时无输出不得启动第二个相同验证。
68
+
69
+ ## 4. 集成与推送
70
+
71
+ 在验证证据仍有效且目标 workspace 干净时:
72
+
73
+ 1. 从目标分支所在的保留 workspace 执行 fast-forward-only 集成;不创建 merge commit。
74
+ 2. 确认集成后的 tree 与任务分支一致。
75
+ 3. 普通 push 已确认的目标分支,并确认远端目标 ref 指向预期提交。
76
+ 4. fast-forward、普通 push 和 checkout 切换不改变 tree,不在主开发分支重复相同产品 E2E。
77
+
78
+ push 被拒绝或远端状态变化时停止;不得改用 force push。
79
+
80
+ ## 5. 本地清理
81
+
82
+ 只有全部条件成立才清理:
83
+
84
+ - OpenSpec change 已归档或任务不需要 OpenSpec。
85
+ - 目标分支包含任务提交且远端目标分支已推送。
86
+ - task worktree 干净,没有未提交或未处理内容。
87
+ - 本地任务分支不再承载未集成提交。
88
+
89
+ 清理步骤:
90
+
91
+ 1. 检查本机命令、symlink 或开发入口是否指向待删 worktree;如有,先按项目规则迁移到仍保留的 checkout,并完成该入口要求的最小验证。
92
+ 2. 将后续命令的工作目录切换到主 workspace 或其他保留目录,不在即将删除的目录中执行清理。
93
+ 3. 删除本地 task worktree,再删除已经合入的本地任务分支。
94
+ 4. 不删除远端任务分支,除非用户另行明确授权。
95
+ 5. 检查 worktree 列表、分支包含关系、目标分支远端状态和主 workspace status。
96
+
97
+ ## 失败处理
98
+
99
+ 任一步骤失败时:
100
+
101
+ - 停止尚未执行的 archive、commit、rebase、merge、push 或 cleanup。
102
+ - 不回滚已经成功的远端操作,不隐藏部分完成状态。
103
+ - 报告失败阶段、已完成动作、当前 Git/OpenSpec 状态和下一步。
104
+ - 保留仍可能用于修复的 task worktree 和本地任务分支。
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: task-triage
3
+ description: 用户要求修 bug、实现或调整功能、改需求、重构、优化、补文档、补测试、调整 API/契约/权限/状态流/数据语义,或询问某项改动是否需要更新 spec、创建 change、只改代码时使用。用于先理解用户任务意图和影响范围,再决定后续处理方式。
4
+ ---
5
+
6
+ # Task Triage Skill
7
+
8
+ 本 Skill 用于在用户提出修改、修复、实现、补充或整理类任务时,先判断任务意图、影响范围和业务语义变化,再选择后续处理方式。
9
+
10
+ ## 判断目标
11
+
12
+ - 用户真正想改变什么。
13
+ - 影响的是产品/业务语义、已有事实文档,还是实现细节。
14
+ - 是否需要业务确认。
15
+ - 后续处理方式是 `code-only`、`spec-maintenance`、`change-flow`,还是暂停确认。
16
+
17
+ ## 判断步骤
18
+
19
+ 1. 识别用户任务意图:
20
+ - 动作:修复、实现、调整、重构、优化、补文档、补测试、整理、删除。
21
+ - 对象:产品能力、模块、接口、规则、文档、数据、状态流或权限。
22
+ - 期望结果:用户希望外部可观察行为或长期事实如何变化。
23
+ 2. 检查任务相关事实,只读任务相关范围,不做全量审计:
24
+ - 相关 specs、knowledge、active changes。
25
+ - 相关代码、测试、文档和现有行为。
26
+ 3. 判断语义影响:
27
+ - 是否改变 SHALL/MUST。
28
+ - 是否改变状态流、API、数据契约、权限或业务规则。
29
+ - 是否只是让代码符合已有 spec。
30
+ - 是否只是把已接受的现有事实补写到文档。
31
+ 4. 输出后续处理方式。
32
+
33
+ ## 输出格式
34
+
35
+ ```text
36
+ 路径判定:
37
+ - 选择:code-only / spec-maintenance / change-flow / 暂停确认
38
+ - 用户任务意图:
39
+ - 是否改变业务语义:
40
+ - 是否需要业务确认:
41
+ ```
42
+
43
+ 如果选择或继续使用 OpenSpec,在同一回复中追加:
44
+
45
+ ```text
46
+ OpenSpec change 状态:
47
+ - Change:<change id>
48
+ - 路径:<resolved change path;尚未解析时明确说明>
49
+ - 当前动作:<explore / propose / apply / sync / archive>
50
+ - 当前状态:<planned / active / blocked / apply-ready / complete / archived>
51
+ - 进度:<artifact 或 task 进度;可用时填写>
52
+ - 下一步或阻塞原因:<next executable action 或 blocking reason>
53
+ ```
54
+
55
+ 状态必须来自当前可确认的 OpenSpec 事实。优先读取 `openspec status --change <id> --json`;实现阶段需要 task 进度时,同时读取 `openspec instructions apply --change <id> --json`。change 尚未创建时写明 `planned`,不得伪造 resolved path 或进度。
56
+
57
+ 首次采用 OpenSpec、状态发生实质变化、工作暂停或完成,以及用户询问进度时,必须刷新并报告当前 change 状态;没有状态变化的中间消息不必机械重复完整摘要。
58
+
59
+ 使用 OpenSpec 时,Buildr 自有的 proposal、design、specs、tasks 和面向用户的说明,其文档正文使用中文。命令、路径、代码标识符、协议字段、YAML/frontmatter 以及 `Requirement`、`Scenario`、`MUST`、`WHEN`、`THEN` 等 OpenSpec 格式关键字可以保留英文。外部加载或由 OpenSpec 生成的 `openspec-*` Skills 不属于本约束的翻译范围。
60
+
61
+ ## 后续处理方式
62
+
63
+ ### code-only
64
+
65
+ - 适用于 spec 已覆盖、代码不符合的缺陷修复。
66
+ - 适用于 spec 已覆盖且代码符合的普通实现、重构、测试补充、日志、格式或性能优化。
67
+ - 不创建 OpenSpec change,不修改 specs,除非任务本身要求补文档且确认为已有事实。
68
+
69
+ ### spec-maintenance
70
+
71
+ - 适用于 spec 缺失或含糊,但代码或已接受行为已经代表当前事实。
72
+ - 直接维护 specs 或 knowledge,不为已经发生的历史事实补造 change。
73
+ - 如果无法判断代码和文档谁代表正确事实,暂停并向用户确认。
74
+
75
+ ### change-flow
76
+
77
+ - 适用于本次任务会改变 SHALL/MUST、状态流、契约、权限、业务规则或数据语义。
78
+ - 提案通过前不进入正式实现,除非用户明确要求探索性原型。
79
+ - 一个独立业务目标使用一个 change;多个独立业务目标分别维护。
80
+ - 选择或继续 OpenSpec change-flow 时,在用户可见回复中说明当前 change 状态、进度以及下一步或阻塞原因。
81
+
82
+ ## 实现型任务的验证编排
83
+
84
+ 为实现型 change 编写或调整 tasks 时,按共享实现区域、验证入口或失败影响面组织有语义的任务组,不按固定任务数量机械分组:
85
+
86
+ - 每个实现任务只安排语法、类型或直接相关测试等最小反馈检查。
87
+ - 每个任务组完成后安排一次受影响范围验证,不为组内每项任务重复同一专项检查。
88
+ - 将完整候选验证放在全部实现、自然语言资产、生成资产同步和 review 修订之后。
89
+ - 具体专项检查和完整验证命令由当前 workspace 或 Project 的规则、OpenSpec 或开发文档定义;不得把 Buildr 产品仓的 package check、临时 workspace E2E 或产品总验证规定为所有项目的固定入口。
90
+ - 安全边界、不可逆迁移或用户明确要求的即时检查不因批量编排而省略。
91
+
92
+ <!-- buildr:skill-contributions change-ready -->
93
+
94
+ ## Guardrails
95
+
96
+ - Bug 修复目标若已被现有 spec 覆盖,走 `code-only`。
97
+ - 小改动只要改变业务语义,就走 `change-flow`。
98
+ - 不能用 `spec-maintenance` 绕过新需求评审。
99
+ - 不能用 `code-only` 掩盖 spec 缺失或业务事实不明。
100
+ - 不能为过去未记录的事实补造虚假 change 历史。
101
+ - OpenSpec 只记录业务语义,不记录代码风格、工具类、SQL 默认值等工程约定。
102
+ - 不使用未经 OpenSpec CLI 确认的路径、进度或完成状态填充 change 状态摘要。
103
+ - 不把“按任务组集中验证”解释为跳过最终候选完整验证。
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: task-worktree
3
+ description: 用户要求代码开发、修 bug、实现功能、运行构建或测试、多仓协作、隔离任务分支,或清理已上线、已归档、已收尾任务的 worktree/change-id/任务分支时使用。用于管理任务 worktree 的创建、使用、保留和清理边界。
4
+ ---
5
+
6
+ # Task Worktree Skill
7
+
8
+ 本 Skill 管理任务 worktree 生命周期:是否创建、如何隔离开发、何时保留,以及何时进入清理检查。它不判断业务语义是否需要 OpenSpec change,也不提供 Git 命令教程。
9
+
10
+ 用户要求完整“收尾”或自动完成归档、集成、推送和清理时,由 `task-finish` Skill 编排;本 Skill 只提供 worktree placement、retention 和 cleanup 条件。
11
+
12
+ ## 创建或复用 worktree
13
+
14
+ 代码开发、修 bug、实现功能、运行构建测试、多仓协作、需要隔离任务分支或长期任务上下文时,优先使用任务 worktree。task triage 选择 OpenSpec change-flow 且预计进入这些动作时,必须在 propose 和创建 change artifacts 前先完成 worktree 决策。
15
+
16
+ 创建或复用前先确认:
17
+
18
+ - 当前 Buildr workspace 根;task worktree 统一放在 `<workspace-root>/.worktrees/<task-id>`,不按当前 Git 主 worktree 或系统临时目录推导位置。
19
+ - 实际 Git 仓库边界,以 `git rev-parse --show-toplevel` 为准。
20
+ - 当前任务标识,可来自 change id、用户指定任务名,或当前工作单元。
21
+ - 每个独立 Git 仓库最多一个任务 worktree。
22
+ - 同一任务优先复用已有 task worktree,不重复创建。
23
+ - 多仓任务为每个独立仓库使用带 repo 标识的 task id,避免 `.worktrees/` 下路径碰撞。
24
+
25
+ 执行创建或复用前,必须先明确告诉用户:
26
+
27
+ - 当前采用 task worktree,以及是创建还是复用。
28
+ - workspace 根、task id、canonical worktree 路径和任务分支。
29
+ - 如同时使用 OpenSpec,change id、change 路径和当前 OpenSpec 动作。
30
+
31
+ canonical 位置不可用、已被其他任务占用或无法确认 workspace 根时,停止并说明问题;不得静默回退到 `/tmp` 或其他任意目录。
32
+
33
+ 一旦采用 task worktree,artifacts、实现和合并前候选验证都只能写入该 worktree;artifacts 包括 proposal、design、specs 和 tasks。不得在原始主工作区保留同一 change 的第二份 artifacts,也不得从未合并 task checkout 向主自举 workspace 执行 sync。
34
+
35
+ ## 不创建 worktree 的场景
36
+
37
+ 明确只维护 Buildr 源资产、OpenSpec artifacts、规则、Skills、文档、模板、README、AGENTS 等元内容,且不会进入代码实现、构建或测试时,默认在当前 workspace 直接修改,不创建 task worktree。
38
+
39
+ 如果纯元内容任务后来升级为实现任务,必须先创建或复用 canonical task worktree,把已有 artifacts 收敛到该唯一位置并清除原工作区重复副本;确认主工作区没有该任务的开发改动后才能继续。
40
+
41
+ ## 使用边界
42
+
43
+ - 任务代码改动只在对应 task worktree 中进行。
44
+ - 合并前,原始主工作区只用于只读检查、worktree 管理、任务集成或排查;不承载任务 artifacts、代码开发或未合并候选产品的自举安装结果。
45
+ - 一个 worktree 同一时间只由一个 Agent 写入。
46
+ - workspace 根 `/.worktrees/` 必须由 `.gitignore` 忽略;不把其中内容提交到仓库,也不把任务副本当作 Rules 扫描源。
47
+ - 构建、编译和测试命令以当前项目或服务规则为准。
48
+
49
+ ## 保留策略
50
+
51
+ - 任务未上线、未归档或未明确收尾前,默认保留 task worktree 和任务分支。
52
+ - 同一任务的缺陷、联调问题和需求调整优先继续在原 task worktree 中处理。
53
+ - 代码合并、推送、联调、测试通过或验收通过本身不等于可以清理 worktree。
54
+
55
+ ## 验证证据边界
56
+
57
+ 项目要求的完整验证应在所有 rebase、冲突解决和内容修改结束后,对准备集成的最终候选 Git tree 执行。
58
+
59
+ 实现期间采用三级验证门禁:
60
+
61
+ 1. 单任务最小反馈:完成任务组内的普通任务后,只运行语法、类型或与该任务直接相关的小范围检查,不默认运行当前 workspace 或 Project 定义的完整验证入口。
62
+ 2. 任务组受影响范围验证:共享实现区域、验证入口或失败影响面的任务全部完成后,集中运行一次专项检查,不为组内每个任务机械重复同一检查。
63
+ 3. 最终候选完整验证:全部实现、自然语言资产、生成资产同步和 review 修订完成后冻结候选,再运行一次项目要求的完整验证。
64
+
65
+ - 具体检查命令由当前 workspace 或 Project 定义;Buildr 产品仓的 package check、临时 workspace E2E 和产品总验证不是所有用户项目的固定入口。
66
+ - 能证明上层验证入口覆盖某项底层检查时,同一候选状态不机械重复该底层检查;无法证明覆盖关系时保留必要检查。
67
+ - 高风险安全边界、不可逆迁移或用户明确要求的即时检查不受默认批量节奏限制。
68
+ - 完整验证失败后退出候选冻结状态;修复期间优先重跑失败项和受影响专项检查,候选重新稳定后再执行一次最终完整验证。
69
+ - 验证命令返回 session、cell、process id 或仍在运行状态时,使用 wait、poll 或 resume 继续同一进程;暂时无输出不得触发相同命令重复启动。
70
+
71
+ - commit 只记录相同内容、集成后的 tree 与已验证 tree 相同、push 只传输已有提交或 worktree 清理不改变产品内容时,复用已有验证结果;不在主开发分支重复运行相同 E2E。
72
+ - rebase、冲突解决、后续编辑或其他操作改变候选 tree 时,原验证结果失效,必须在集成前对新 tree 重新运行受影响的验证。
73
+ - 实际自举 workspace 的 sync 是独立的状态变更,不是第二轮产品 E2E;如果执行,按 Buildr Core 运行当前 Agent doctor。CLI update 只更新 Product checkout 或 registry package,不读取 workspace。
74
+ - 本机 `buildr` 若指向即将删除的 task worktree,清理前必须切换到仍保留的 checkout,避免留下悬空入口。
75
+
76
+ ## 清理触发
77
+
78
+ 以下表达进入 worktree 清理检查:
79
+
80
+ - 用户说明任务已上线。
81
+ - 用户说明 change 已归档。
82
+ - 用户说明任务已收尾或可以清理。
83
+ - 用户要求清理指定 worktree、change-id 或任务分支。
84
+
85
+ ## 清理前检查
86
+
87
+ 删除 worktree 或任务分支前,先确认:
88
+
89
+ - worktree 没有未提交或未处理改动,或用户明确放弃这些改动。
90
+ - 任务分支内容已经合入目标分支,或用户明确放弃该分支内容。
91
+ - 远端任务分支删除属于远端状态修改,需要用户当前轮次明确授权。
92
+ - 清理后检查 worktree 列表和仓库状态。
93
+
94
+ ## Guardrails
95
+
96
+ - 不在未确认仓库边界时假设目录是否为独立仓库。
97
+ - 不在未向用户说明 canonical 路径和分支时创建或切换 task worktree。
98
+ - 不在原始主工作区直接承载任务代码开发,除非用户明确要求。
99
+ - 不在实现型 OpenSpec change 创建 artifacts 后才延迟决定 worktree,也不保留同一 change 的双份副本。
100
+ - 不从未合并 task checkout 更新主自举 workspace。
101
+ - 不因 checkout 或 commit hash 改变而机械重复验证,也不在候选 tree 已改变时沿用旧验证结果。
102
+ - 不在每个普通实现任务后机械运行完整验证,也不因运行中进程暂时无输出而重复启动验证。
103
+ - 不自动删除仍可能承载后续修复或未合入内容的 worktree。
104
+ - 不把 commit、push、merge、rebase、远端分支删除的授权和协作策略写成 worktree 流程。
@@ -0,0 +1,38 @@
1
+ schemaVersion: buildr.skills/v1
2
+ skills:
3
+ - id: task-triage
4
+ source: buildr
5
+ path: buildr/task-triage
6
+ description: 用户要求修 bug、实现或调整功能、改需求、重构、优化、补文档、补测试、调整 API/契约/权限/状态流/数据语义,或询问某项改动是否需要更新 spec、创建 change、只改代码时使用。
7
+ enabled: true
8
+ required: false
9
+ state: installed
10
+ runtimes: ["claude-code","codex"]
11
+ runtimePath: task-triage
12
+ - id: task-worktree
13
+ source: buildr
14
+ path: buildr/task-worktree
15
+ description: 用户要求代码开发、修 bug、实现功能、运行构建或测试、多仓协作、隔离任务分支,或清理已上线、已归档、已收尾任务的 worktree/change-id/任务分支时使用。
16
+ enabled: true
17
+ required: false
18
+ state: installed
19
+ runtimes: ["claude-code","codex"]
20
+ runtimePath: task-worktree
21
+ - id: task-finish
22
+ source: buildr
23
+ path: buildr/task-finish
24
+ description: 用户在 task worktree 中要求“收尾”、完成任务、自动收尾,或要求自动完成已验证 change 的归档、提交、集成、推送和本地清理时使用。
25
+ enabled: true
26
+ required: false
27
+ state: installed
28
+ runtimes: ["claude-code","codex"]
29
+ runtimePath: task-finish
30
+ - id: git-ops
31
+ source: buildr
32
+ path: buildr/git-ops
33
+ description: 用户表达提交、commit、推送、push、提交并推送、合并、merge、rebase、发布、release、删除分支、清理远端分支等单项 Git 意图,或 Git 操作存在授权、范围、amend、远端改写、分支删除等歧义时使用。
34
+ enabled: true
35
+ required: false
36
+ state: installed
37
+ runtimes: ["claude-code","codex"]
38
+ runtimePath: git-ops
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.4.1"
10
+ ---
11
+
12
+ Implement tasks from an OpenSpec change.
13
+
14
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
15
+
16
+ **Steps**
17
+
18
+ 1. **Select the change**
19
+
20
+ If a name is provided, use it. Otherwise:
21
+ - Infer from conversation context if the user mentioned a change
22
+ - Auto-select if only one active change exists
23
+ - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
24
+
25
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
26
+
27
+ 2. **Check status to understand the schema**
28
+ ```bash
29
+ openspec status --change "<name>" --json
30
+ ```
31
+ Parse the JSON to understand:
32
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
33
+ - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
34
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
35
+
36
+ 3. **Get apply instructions**
37
+
38
+ ```bash
39
+ openspec instructions apply --change "<name>" --json
40
+ ```
41
+
42
+ This returns:
43
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
44
+ - Progress (total, complete, remaining)
45
+ - Task list with status
46
+ - Dynamic instruction based on current state
47
+
48
+ **Handle states:**
49
+ - If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
50
+ - If `state: "all_done"`: congratulate, suggest archive
51
+ - Otherwise: proceed to implementation
52
+
53
+ **Workspace guard:** If status JSON reports `actionContext.mode: "workspace-planning"` and `allowedEditRoots` is empty, explain that full workspace apply is not supported in this slice. Treat linked repos and folders as read-only context, ask the user to select an affected area through an explicit implementation workflow, and STOP before editing files.
54
+
55
+ 4. **Read context files**
56
+
57
+ Read every file path listed under `contextFiles` from the apply instructions output.
58
+ The files depend on the schema being used:
59
+ - **spec-driven**: proposal, specs, design, tasks
60
+ - Other schemas: follow the contextFiles from CLI output
61
+
62
+ 5. **Show current progress**
63
+
64
+ Display:
65
+ - Schema being used
66
+ - Progress: "N/M tasks complete"
67
+ - Remaining tasks overview
68
+ - Dynamic instruction from CLI
69
+
70
+ 6. **Implement tasks (loop until done or blocked)**
71
+
72
+ For each pending task:
73
+ - Show which task is being worked on
74
+ - Make the code changes required
75
+ - Keep changes minimal and focused
76
+ - Mark task complete in the tasks file: `- [ ]` → `- [x]`
77
+ - Continue to next task
78
+
79
+ **Pause if:**
80
+ - Task is unclear → ask for clarification
81
+ - Implementation reveals a design issue → suggest updating artifacts
82
+ - Error or blocker encountered → report and wait for guidance
83
+ - User interrupts
84
+
85
+ 7. **On completion or pause, show status**
86
+
87
+ Display:
88
+ - Tasks completed this session
89
+ - Overall progress: "N/M tasks complete"
90
+ - If all done: suggest archive
91
+ - If paused: explain why and wait for guidance
92
+
93
+ **Output During Implementation**
94
+
95
+ ```
96
+ ## Implementing: <change-name> (schema: <schema-name>)
97
+
98
+ Working on task 3/7: <task description>
99
+ [...implementation happening...]
100
+ ✓ Task complete
101
+
102
+ Working on task 4/7: <task description>
103
+ [...implementation happening...]
104
+ ✓ Task complete
105
+ ```
106
+
107
+ **Output On Completion**
108
+
109
+ ```
110
+ ## Implementation Complete
111
+
112
+ **Change:** <change-name>
113
+ **Schema:** <schema-name>
114
+ **Progress:** 7/7 tasks complete ✓
115
+
116
+ ### Completed This Session
117
+ - [x] Task 1
118
+ - [x] Task 2
119
+ ...
120
+
121
+ All tasks complete! Ready to archive this change.
122
+ ```
123
+
124
+ **Output On Pause (Issue Encountered)**
125
+
126
+ ```
127
+ ## Implementation Paused
128
+
129
+ **Change:** <change-name>
130
+ **Schema:** <schema-name>
131
+ **Progress:** 4/7 tasks complete
132
+
133
+ ### Issue Encountered
134
+ <description of the issue>
135
+
136
+ **Options:**
137
+ 1. <option 1>
138
+ 2. <option 2>
139
+ 3. Other approach
140
+
141
+ What would you like to do?
142
+ ```
143
+
144
+ **Guardrails**
145
+ - Keep going through tasks until done or blocked
146
+ - Always read context files before starting (from the apply instructions output)
147
+ - If task is ambiguous, pause and ask before implementing
148
+ - If implementation reveals issues, pause and suggest artifact updates
149
+ - Keep code changes minimal and scoped to each task
150
+ - Update task checkbox immediately after completing each task
151
+ - Pause on errors, blockers, or unclear requirements - don't guess
152
+ - Use contextFiles from CLI output, don't assume specific file names
153
+
154
+ **Fluid Workflow Integration**
155
+
156
+ This skill supports the "actions on a change" model:
157
+
158
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
159
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: openspec-archive-change
3
+ description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.4.1"
10
+ ---
11
+
12
+ Archive a completed change in the experimental workflow.
13
+
14
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
15
+
16
+ **Steps**
17
+
18
+ 1. **If no change name provided, prompt for selection**
19
+
20
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
21
+
22
+ Show only active changes (not already archived).
23
+ Include the schema used for each change if available.
24
+
25
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
26
+
27
+ 2. **Check artifact completion status**
28
+
29
+ Run `openspec status --change "<name>" --json` to check artifact completion.
30
+
31
+ Parse the JSON to understand:
32
+ - `schemaName`: The workflow being used
33
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
34
+ - `artifacts`: List of artifacts with their status (`done` or other)
35
+
36
+ If status reports `actionContext.mode: "workspace-planning"`, explain that workspace archive is not supported in this slice and STOP. Do not move workspace changes into repo-local archives or edit linked repos.
37
+
38
+ **If any artifacts are not `done`:**
39
+ - Display warning listing incomplete artifacts
40
+ - Use **AskUserQuestion tool** to confirm user wants to proceed
41
+ - Proceed if user confirms
42
+
43
+ 3. **Check task completion status**
44
+
45
+ Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
46
+
47
+ Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
48
+
49
+ **If incomplete tasks found:**
50
+ - Display warning showing count of incomplete tasks
51
+ - Use **AskUserQuestion tool** to confirm user wants to proceed
52
+ - Proceed if user confirms
53
+
54
+ **If no tasks file exists:** Proceed without task-related warning.
55
+
56
+ 4. **Assess delta spec sync state**
57
+
58
+ Use `artifactPaths.specs.existingOutputPaths` from status JSON to check for delta specs. If none exist, proceed without sync prompt.
59
+
60
+ **If delta specs exist:**
61
+ - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
62
+ - Determine what changes would be applied (adds, modifications, removals, renames)
63
+ - Show a combined summary before prompting
64
+
65
+ **Prompt options:**
66
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
67
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
68
+
69
+ If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
70
+
71
+ 5. **Perform the archive**
72
+
73
+ Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
74
+ ```bash
75
+ mkdir -p "<planningHome.changesDir>/archive"
76
+ ```
77
+
78
+ Generate target name using current date: `YYYY-MM-DD-<change-name>`
79
+
80
+ **Check if target already exists:**
81
+ - If yes: Fail with error, suggest renaming existing archive or using different date
82
+ - If no: Move `changeRoot` to the archive directory
83
+
84
+ ```bash
85
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
86
+ ```
87
+
88
+ 6. **Display summary**
89
+
90
+ Show archive completion summary including:
91
+ - Change name
92
+ - Schema that was used
93
+ - Archive location
94
+ - Whether specs were synced (if applicable)
95
+ - Note about any warnings (incomplete artifacts/tasks)
96
+
97
+ **Output On Success**
98
+
99
+ ```
100
+ ## Archive Complete
101
+
102
+ **Change:** <change-name>
103
+ **Schema:** <schema-name>
104
+ **Archived to:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
105
+ **Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
106
+
107
+ All artifacts complete. All tasks complete.
108
+ ```
109
+
110
+ **Guardrails**
111
+ - Always prompt for change selection if not provided
112
+ - Use artifact graph (openspec status --json) for completion checking
113
+ - Don't block archive on warnings - just inform and confirm
114
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
115
+ - Show clear summary of what happened
116
+ - If sync is requested, use openspec-sync-specs approach (agent-driven)
117
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting