@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.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/docs/cli-architecture.md +62 -0
- package/docs/cli-reference.md +67 -0
- package/docs/known-limitations.md +13 -0
- package/examples/minimal-workspace/README.md +24 -0
- package/package/README.md +28 -0
- package/package/bootstrap/contract.yml +122 -0
- package/package/bootstrap/guide.md +79 -0
- package/package/manifest.yml +144 -0
- package/package/targets/runtime/skills/buildr/SKILL.md +151 -0
- package/package/targets/workspace/.buildr/workspace.yml +5 -0
- package/package/targets/workspace/AGENTS.md +5 -0
- package/package/targets/workspace/commands/buildr/openspec/manifest.yml +15 -0
- package/package/targets/workspace/commands/manifest.yml +2 -0
- package/package/targets/workspace/components/buildr/openspec/component.yml +16 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-apply-sidebar.md +3 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-archive-sidebar.md +3 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-explore-sidebar.md +3 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-propose-sidebar.md +3 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-sync-sidebar.md +3 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-post-sync.md +1 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-pre-sync.md +1 -0
- package/package/targets/workspace/components/buildr/openspec/contributions/task-triage-change-ready.md +10 -0
- package/package/targets/workspace/components/manifest.yml +2 -0
- package/package/targets/workspace/gitignore +13 -0
- package/package/targets/workspace/projects/AGENTS.project.md +25 -0
- package/package/targets/workspace/projects/manifest.yml +2 -0
- package/package/targets/workspace/projects/services/manifest.yml +3 -0
- package/package/targets/workspace/projects/skills/manifest.yml +2 -0
- package/package/targets/workspace/rules/buildr/core.md +63 -0
- package/package/targets/workspace/rules/manifest.yml +9 -0
- package/package/targets/workspace/skills/buildr/git-ops/SKILL.md +73 -0
- package/package/targets/workspace/skills/buildr/openspec-contract-guard/SKILL.md +67 -0
- package/package/targets/workspace/skills/buildr/task-finish/SKILL.md +104 -0
- package/package/targets/workspace/skills/buildr/task-triage/SKILL.md +103 -0
- package/package/targets/workspace/skills/buildr/task-worktree/SKILL.md +104 -0
- package/package/targets/workspace/skills/manifest.yml +38 -0
- package/package/targets/workspace/skills/openspec/openspec-apply-change/SKILL.md +159 -0
- package/package/targets/workspace/skills/openspec/openspec-archive-change/SKILL.md +117 -0
- package/package/targets/workspace/skills/openspec/openspec-explore/SKILL.md +287 -0
- package/package/targets/workspace/skills/openspec/openspec-propose/SKILL.md +111 -0
- package/package/targets/workspace/skills/openspec/openspec-sync-specs/SKILL.md +147 -0
- package/package.json +67 -0
- package/tools/buildr +11 -0
- package/tools/cli/application/cli-update.mjs +219 -0
- package/tools/cli/application/compose-runtime.mjs +38 -0
- package/tools/cli/application/doctor/runtime-diagnostics.mjs +226 -0
- package/tools/cli/application/doctor/scope-diagnostics.mjs +440 -0
- package/tools/cli/application/doctor/service-diagnostics.mjs +184 -0
- package/tools/cli/application/doctor.mjs +201 -0
- package/tools/cli/application/package-maintenance/builtin-receipts.mjs +73 -0
- package/tools/cli/application/package-maintenance/output.mjs +148 -0
- package/tools/cli/application/package-maintenance/smoke-checks.mjs +469 -0
- package/tools/cli/application/package-maintenance/static-validation.mjs +678 -0
- package/tools/cli/application/package-maintenance.mjs +538 -0
- package/tools/cli/application/runtime.mjs +118 -0
- package/tools/cli/application/workspace-operations.mjs +310 -0
- package/tools/cli/bootstrap.mjs +6 -0
- package/tools/cli/command/help.mjs +292 -0
- package/tools/cli/command/registry.mjs +97 -0
- package/tools/cli/domains/commands.mjs +661 -0
- package/tools/cli/domains/components.mjs +922 -0
- package/tools/cli/domains/openspec.mjs +603 -0
- package/tools/cli/domains/package-assets.mjs +652 -0
- package/tools/cli/domains/rules.mjs +380 -0
- package/tools/cli/domains/runtime.mjs +94 -0
- package/tools/cli/domains/skills.mjs +647 -0
- package/tools/cli/domains/workspace.mjs +571 -0
- package/tools/cli/shared/infrastructure.mjs +411 -0
- package/tools/cli/shared/json-contracts.mjs +22 -0
- package/tools/cli/shared/platform.mjs +52 -0
- package/tools/runtime/adapter-contract.mjs +330 -0
- package/tools/runtime/check-claude-code.mjs +26 -0
- package/tools/runtime/check-codex.mjs +26 -0
- package/tools/runtime/projection.mjs +163 -0
- package/tools/runtime/render-claude-code-rules.mjs +459 -0
- package/tools/runtime/render-claude-code.mjs +59 -0
- package/tools/runtime/skills/arguments.mjs +51 -0
- package/tools/runtime/skills/contributions.mjs +171 -0
- package/tools/runtime/skills/manifests.mjs +167 -0
- package/tools/runtime/skills/primitives.mjs +86 -0
- package/tools/runtime/skills/render-plan.mjs +244 -0
- package/tools/runtime/skills/sources.mjs +276 -0
- package/tools/shared/fetch-remote-text.mjs +78 -0
- package/tools/verification/integrity/managed-data-integrity.mjs +107 -0
- package/tools/verification/integrity/managed-mutations.mjs +72 -0
- package/tools/verification/openspec/contract.mjs +212 -0
- package/tools/verification/runtime/adapter-contract.mjs +102 -0
- package/tools/verification/runtime/adapter-parity.mjs +99 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: buildr
|
|
3
|
+
description: 在 Buildr workspace 中安装、更新、同步、诊断和维护组织工作资产时使用,覆盖组织(Organization/Root)、项目(Project)、服务(Service)、组件(Components)、规则(Rules)、技能(Skills)、命令(Commands)、内置能力(Builtins)和 Agent runtime 渲染。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Buildr Skill
|
|
7
|
+
|
|
8
|
+
## Buildr 是什么
|
|
9
|
+
|
|
10
|
+
Buildr 是面向人、Agent 和组织的工作资产治理系统。
|
|
11
|
+
|
|
12
|
+
它把组织长期复用的规则、技能、命令、规范、产品事实和协作流程沉淀为可共享、可审计、可适配不同 Agent 的工作区(workspace)源资产,支撑多人、多职责、多项目、多服务的稳定协作。
|
|
13
|
+
|
|
14
|
+
Buildr workspace 是组织(Organization/Root)资产根;Agent runtime 是面向当前 Agent 的可重建入口;本机状态和临时提示不由 Buildr 维护。
|
|
15
|
+
|
|
16
|
+
Agent 使用本 Skill 判断用户意图属于哪类 Buildr 资产,并通过 Buildr CLI 完成维护、诊断和按需渲染。事实状态以 `buildr runtime list --json`、`buildr doctor --agent <agent> --target <dir> --json`、manifest、CLI 帮助和 CLI 错误输出为准。
|
|
17
|
+
|
|
18
|
+
组织资产先改变源资产(使用 Buildr CLI),再同步 Agent runtime(使用 render/sync)。
|
|
19
|
+
|
|
20
|
+
## 执行循环
|
|
21
|
+
|
|
22
|
+
1. 确认 `target`。未指定时默认当前目录;如果当前目录在服务(Service)代码仓内,先定位 Buildr 组织(Organization/Root)。
|
|
23
|
+
2. 运行或参考 `buildr runtime list --json` 获取受支持的 Agent runtime;识别当前 Agent,并将后续 `<agent>` 固定为支持列表中对应的参数。
|
|
24
|
+
3. 如果当前 Agent 无法和支持列表对齐,停止 Buildr 操作,并请联系 Buildr 作者反馈该 Agent。
|
|
25
|
+
4. 判断 workspace 是否已初始化。未初始化时运行 `buildr init --agent <agent> --target <dir> --name <name> --profile <personal|team|company>`,并使用命令内置的最终 doctor 结果;已有 workspace 运行 `buildr doctor --agent <agent> --target <dir> --json` 建立事实基线。不要省略 `--agent`。
|
|
26
|
+
5. 根据用户目标和 doctor 结果选择资产类型:组织(Organization/Root)、项目(Project)、服务(Service)、组件(Components)、规则(Rules)、命令(Commands)、技能(Skills)、内置能力(Builtins)或 Agent runtime 渲染。
|
|
27
|
+
6. 执行对应维护动作。用户要求“更新 Buildr”时,先运行 `buildr update`;成功后重新解析当前 `buildr` 入口,再运行 `buildr sync <agent> --target <dir>`。用户明确要求“只更新 Buildr”时只运行 `update`;要求“同步 workspace”时只运行 `sync`。update 受阻时不得继续用旧 CLI sync。
|
|
28
|
+
7. 状态变更后确认最新 doctor 结果;`init --agent`、`sync` 和 Component install/uninstall 已包含最终 doctor,其他变更再运行 `buildr doctor --agent <agent> --target <dir> --json`。只有 doctor 指向专项问题,或用户明确要求细查时,才运行 `commands check` 或 `runtime check`。
|
|
29
|
+
8. 优先使用 Buildr CLI;复杂参数以当前 manifest、CLI 帮助和 CLI 错误输出为准。
|
|
30
|
+
|
|
31
|
+
## 任务路由
|
|
32
|
+
|
|
33
|
+
| 用户意图 | 资产类型 |
|
|
34
|
+
|---|---|
|
|
35
|
+
| 初始化、修复或诊断 Buildr workspace | 组织(Organization/Root) |
|
|
36
|
+
| 更新 Buildr CLI 自身 | Buildr CLI update |
|
|
37
|
+
| 同步 workspace 或恢复内置能力 | 内置能力(Builtins)/ Agent runtime 渲染 |
|
|
38
|
+
| 接入业务、产品线、系统或长期工作单元 | 项目(Project) |
|
|
39
|
+
| 接入代码仓、服务仓或可执行资产 | 服务(Service) |
|
|
40
|
+
| 代码开发、实现、构建、测试或任务 worktree 生命周期 | `task-worktree` Skill |
|
|
41
|
+
| 完成已验证任务、自动归档集成并清理 task worktree | `task-finish` Skill |
|
|
42
|
+
| 提交、合并、rebase、推送、发布或其他单项 Git 操作 | `git-ops` Skill |
|
|
43
|
+
| 统一安装、更新和卸载一组 workspace Rules、Skills、Command collections | 组件(Components) |
|
|
44
|
+
| 沉淀每次会话必须遵守的约束 | 规则(Rules) |
|
|
45
|
+
| 沉淀可复用任务流程或操作能力 | 技能(Skills) |
|
|
46
|
+
| 声明组织复用的外部命令行工具 | 命令(Commands) |
|
|
47
|
+
| 当前 Agent 找不到已声明规则或技能 | Agent runtime 渲染 |
|
|
48
|
+
|
|
49
|
+
## 资产维护
|
|
50
|
+
|
|
51
|
+
### Workspace / Organization Root
|
|
52
|
+
|
|
53
|
+
- Workspace 是 Buildr 组织(Organization/Root)源资产根;`--target` 始终指向 Buildr workspace root,不指向 Service 代码仓。
|
|
54
|
+
- workspace 必须完成 `buildr init`;首次使用且当前 Agent 已确认时,运行 `buildr init --agent <agent> --target <dir> --name <name> --profile <personal|team|company>` 一次完成源资产、runtime 和最终 doctor。不带 `--agent` 的 init 只初始化源资产。
|
|
55
|
+
- root `AGENTS.md` 是规则入口,必须包含 Buildr required block 并引用 `rules/buildr/core.md`;`projects/manifest.yml` 是 Project registry。
|
|
56
|
+
|
|
57
|
+
### Project
|
|
58
|
+
|
|
59
|
+
- 创建或修复 Project/Service 必须来自用户意图、已有源资产、明确 repo/ref,或 doctor 指出的可修复 drift。
|
|
60
|
+
- Project 表示业务、产品线、系统或长期工作单元。
|
|
61
|
+
- 创建 Project:`buildr project create <project> --target <dir>`。
|
|
62
|
+
- Project 资产 Git repo 用 `project create --repo`;Project registry 写入 `projects/manifest.yml`。
|
|
63
|
+
|
|
64
|
+
### 遗留 Practices
|
|
65
|
+
|
|
66
|
+
- Practices 不再是独立 Buildr 资产类型;已有 workspace 或 Project `practices/` 是用户保留数据,不得自动读取、迁移、覆盖或删除,也不得因其存在阻塞正常命令。
|
|
67
|
+
- 用户决定整理时,先人工审阅内容语义:约束和值守边界迁移为 Rule,可复用专业动作和操作流程迁移为 Skill,产品事实、需求和变更迁移为 OpenSpec,其他说明保留为普通 docs。
|
|
68
|
+
- 不根据文件名或正文猜测迁移类别;用户确认内容已经妥善归类且目录为空后,才由用户自行决定是否删除遗留目录。
|
|
69
|
+
|
|
70
|
+
### Service
|
|
71
|
+
|
|
72
|
+
- Service 表示代码 repo 或可执行资产;用户提供 service repo 路径、Git URL 或明确要接入服务资产时才创建。
|
|
73
|
+
- 接入 Service:`buildr service create <project>/<service> <repo-ref> --target <dir> [--branch <branch>]`;`--branch` 只用于 Git 来源并保存显式 checkout intent。
|
|
74
|
+
- Service registry 写入所属 Project 的 `services/manifest.yml`;Service 规则入口是 Service 目录中的 `AGENTS.md`,不写入 `rules.source`。
|
|
75
|
+
- Rules scope 使用真实 workspace 相对路径:`.`、`projects/<project>`、`projects/<project>/services/<service>` 或其任意深层目录。
|
|
76
|
+
|
|
77
|
+
### Builtins
|
|
78
|
+
|
|
79
|
+
- Buildr 内置能力包括 required core Rule、optional Skills 和内置 Command 声明。
|
|
80
|
+
- 只更新 Buildr CLI 自身:`buildr update`;查看 CLI 更新状态:`buildr update check --json`。命令自动识别开发 checkout 或 registry package,不读取 workspace。
|
|
81
|
+
- 同步 workspace 产品源能力并准备当前 Agent runtime:`buildr sync <agent> --target <dir>`。
|
|
82
|
+
- 查看 workspace 内置能力状态:`buildr builtin list --target <dir> --json` 或最终 doctor。
|
|
83
|
+
- 卸载 optional 内置能力:`buildr builtin uninstall <id> --target <dir>`;required 能力不能卸载。
|
|
84
|
+
- 恢复 optional 内置能力:`buildr builtin restore <id> --target <dir>`。
|
|
85
|
+
|
|
86
|
+
### Components
|
|
87
|
+
- Component 是 workspace 级统一生命周期单元;当前不支持 Project/Service Component。registry 为 `components/manifest.yml`,成员由 installed `component.yml` 唯一声明。
|
|
88
|
+
- Component 必须自证 definition、全部成员 integrity、唯一 ownership 和 Skill Contribution 完整性;不能注册或注入 runtime adapter、runtime hook、可执行 member 或 registry patch。验证通过的 Contribution 只作为通用 runtime source input。
|
|
89
|
+
- Sidebar 是对外部能力的独立、可卸载增强;Skill Contribution 是其 runtime 组合机制。外部 Skill 源必须保持上游正文,Buildr 增强只进入 Agent runtime 派生版本,不在 `skills/buildr/` 维护外部 fork。
|
|
90
|
+
- 用户明确说“作为 Component”时,即使只有一个成员也走 Component;用户明确要单项 Rule、Skill 或 Command 时走单项入口。
|
|
91
|
+
- 用户只说“安装 X”时,先读取权威来源并识别会安装的资源;跨资产类型或需要统一版本、更新、卸载时创建或选择 Component,组成不明时继续调查,不让 CLI 猜测。
|
|
92
|
+
- 安装前用 `buildr component list/check --target <dir> --json` 核对来源、版本、成员和 integrity;执行 `buildr component install <id> --agent <agent> --target <dir>`。
|
|
93
|
+
- 用户只说“卸载 X”时,先查询 registry、ownership 和 `component check`。若 X 是 Component 或其成员,不得调用单项删除命令。
|
|
94
|
+
- 卸载前展示 Component id、source、version、workspace scope、将删除的 Rules、Skills、Command collections 和当前 Agent runtime 投射,并说明不会删除本机外部 CLI 或任何 Project 内容;然后请求用户针对完整范围二次确认。
|
|
95
|
+
- 只有用户明确确认后才运行 `buildr component uninstall <id> --agent <agent> --target <dir> [--reason <text>]`;拒绝、未确认或范围变化时不得写入。
|
|
96
|
+
- install/uninstall 必须完成指定 Agent runtime reconcile 和最终 doctor;仍有 error 时不得报告完成。
|
|
97
|
+
- sync 完成后,应提醒用户 optional Rules、Skills、Components 和 Command declarations 可以按需卸载;用户不希望使用某项能力时,由 Agent 先检查完整影响范围再使用对应生命周期入口。
|
|
98
|
+
|
|
99
|
+
### Rules
|
|
100
|
+
|
|
101
|
+
- Rules 源资产是当前 scope 的 `AGENTS.md`、`rules/manifest.yml` 和 `rules/`。
|
|
102
|
+
- Rules 控制 Agent 的价值观、边界和约束;Skills 封装可复用的专业动作和操作流程。
|
|
103
|
+
- Rule 和 Skill 不以“是否必须加载”作为本质区分;Rule description 是 Agent 判断规则语义相关性的索引,不是路径或角色路由表。
|
|
104
|
+
- Agent runtime adapter 按“scope 祖先链 + scope 子树”发现和投射 `AGENTS.md`,不替 Agent 判断 optional Rule 与任务的语义相关性,也不使用预设 role/path 路由。
|
|
105
|
+
- `enabled: true`、`required: true` 且 `state: installed` 的 Rule 必须读取;`enabled: true`、`required: false` 且 installed 的 Rule 先检查 description,语义相关时在行动前读取正文。
|
|
106
|
+
- `enabled: false` 或 `state: uninstalled` 的 Rule 不参与当前任务。
|
|
107
|
+
- root/Organization 规则新增:先创建并编辑 `rules/<rule-id>.md`,再运行 `buildr rules add <rule-id> --target <dir> --description <text>`;未传 `--path` 时默认注册 `rules/<rule-id>.md`。
|
|
108
|
+
- root/Organization 规则删除:运行 `buildr rules remove <rule-id> --target <dir>`,同时删除 manifest entry 和规则文件;如只取消注册并保留文件,使用 `--keep-file`。
|
|
109
|
+
- Project/Service 规则分别通过对应目录的 `AGENTS.md` 维护,不使用 Project 或 Service 级 `rules/manifest.yml`。
|
|
110
|
+
- 需要渲染到 Agent runtime 时,运行 `buildr rules render <agent> --scope <workspace-relative-path> --target <dir>`;Claude Code 在每个 source 同目录维护 `CLAUDE.md` bridge,Codex 原生读取且不写 Rules bridge。
|
|
111
|
+
|
|
112
|
+
### Commands
|
|
113
|
+
|
|
114
|
+
- Commands 源资产是 root `commands/manifest.yml` 和安全递归发现的 `commands/**/manifest.yml` collections,用于声明组织需要复用的外部命令行工具。
|
|
115
|
+
- 新增或替换用 `buildr commands add`,删除用 `buildr commands remove`;`--collection <path>` 选择嵌套 collection,未传时操作根 collection。Component-owned collection 只能通过 Component 生命周期维护。
|
|
116
|
+
- doctor 已聚合 Commands 基础检查;需要命令清单细节时再运行 `buildr commands check --target <dir> --json`。
|
|
117
|
+
- Commands 只声明和检查,不渲染到 Agent runtime,不安装到本机。
|
|
118
|
+
- 已声明但本机缺少时,按 `installHint` 或官方链接说明差异;安装、升级、登录配置必须取得用户授权。
|
|
119
|
+
|
|
120
|
+
### Skills
|
|
121
|
+
|
|
122
|
+
- Skills 源资产至少包含当前 scope 的 `skills/manifest.yml`;本地作者型 Skill 还包含 `skills/<skill-id>/`。
|
|
123
|
+
- 本地作者型 Skill 适合项目专用流程、私有沉淀和未发布 Skill;远端发布型 Skill 适合已发布或外部维护的 Skill。
|
|
124
|
+
- Buildr 随包场景化流程通过 workspace Skills 承载;Rule 保留 Agent 价值观、边界和约束。
|
|
125
|
+
- 本地作者型:`buildr skills add [<id>] --source <skill-dir> --scope <scope> --target <dir>`;删除用 `buildr skills remove <id> --scope <scope> --target <dir>`。
|
|
126
|
+
- 远端发布型:先用 `buildr skills add <id> --remote-source <url> --scope <scope> --target <dir>` 登记;解析出确定安装源后用 `--resolved-source <url> --replace` 更新。
|
|
127
|
+
- `--resolved-kind` 默认 `skill-url`,表示 URL 内容是 raw `SKILL.md`;`--version`、`--integrity` 和 `--ignore-unsupported` 等细节按 CLI 帮助和 manifest 补齐。
|
|
128
|
+
- 渲染 workspace/Project 技能用 `buildr skills render <agent> --scope <scope> --target <dir>`;`buildr skill install <agent>` 只安装或修复 Buildr 产品内置 Skill。
|
|
129
|
+
- render 结果分三类:本地源由 Buildr 安装,已解析远端源由 Buildr 安装,未解析远端信息源由 Buildr 生成 Agent 可读安装说明并要求 Agent 处理。
|
|
130
|
+
|
|
131
|
+
### Agent 运行时渲染
|
|
132
|
+
|
|
133
|
+
- 只在当前 Agent 已确认受支持时处理 Agent runtime。
|
|
134
|
+
- `buildr runtime list --json` 的静态 registry 是 supported adapter 的事实源;每个 supported adapter 必须完整覆盖 Rules entry、产品 Buildr Skill、workspace/Project Skills、Skill install plans 和 runtime check,不为 unsupported runtime 使用 alias 或 fallback。
|
|
135
|
+
- Adapter 只生成 runtime-specific 声明式计划;Buildr 通用 core 统一负责 Component 完整性后的 source assembly、计划验证、冲突预检、写入、清理和诊断。
|
|
136
|
+
- 用户说“更新 Buildr”时,依次运行 `buildr update` 与新的 `buildr sync <agent> --target <dir>`;用户说“只更新 Buildr”时不追加 sync;用户说“同步 workspace”时不先更新 CLI。sync 默认从 `.` 递归 reconcile workspace Rules,并同步 Root/Project Skills。
|
|
137
|
+
- doctor 指出特定 scope runtime 问题时,按 canonical workspace 相对 scope 运行 `render`、`rules render` 或 `runtime check`;组合 `render` 会把 Skills scope 折叠到所属 Root/Project。
|
|
138
|
+
- `runtime check` 是专项 runtime 细查入口;只有 doctor 指向具体 runtime 问题,或用户明确要求细查时运行。
|
|
139
|
+
|
|
140
|
+
## 完成标准
|
|
141
|
+
|
|
142
|
+
- 用户目标已映射到对应 Buildr 资产类型。
|
|
143
|
+
- 状态变更后已运行 `buildr doctor --agent <agent> --target <dir> --json`,且没有需要用户立即处理的 error。
|
|
144
|
+
- 有复用价值的信息已按语义写回 Buildr 源资产:Rule、OpenSpec、Skill、Component、Command、Project/Service registry 或普通 docs。
|
|
145
|
+
- Agent runtime 已按需 sync 或 render。
|
|
146
|
+
|
|
147
|
+
如果本 Skill 不可用或 runtime 损坏,运行:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
buildr bootstrap guide
|
|
151
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
schemaVersion: buildr.commands/v1
|
|
2
|
+
commands:
|
|
3
|
+
- id: openspec
|
|
4
|
+
name: OpenSpec
|
|
5
|
+
source: buildr
|
|
6
|
+
enabled: true
|
|
7
|
+
required: false
|
|
8
|
+
state: installed
|
|
9
|
+
executable: openspec
|
|
10
|
+
purpose: 管理 OpenSpec spec-driven development workflow。
|
|
11
|
+
description: OpenSpec Component 使用的外部 SDD CLI;Buildr 只诊断,不安装或卸载本机 CLI。
|
|
12
|
+
version:
|
|
13
|
+
constraint: "=1.4.1"
|
|
14
|
+
args: ["--version"]
|
|
15
|
+
installHint: 按 OpenSpec 官方说明安装 @fission-ai/openspec@1.4.1;Buildr 不代为安装。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
schemaVersion: buildr.component/v1
|
|
2
|
+
id: openspec
|
|
3
|
+
kind: integration
|
|
4
|
+
version: "1.4.1+buildr.3"
|
|
5
|
+
source: buildr
|
|
6
|
+
upstream:
|
|
7
|
+
name: "@fission-ai/openspec"
|
|
8
|
+
version: "1.4.1"
|
|
9
|
+
members:
|
|
10
|
+
rules: []
|
|
11
|
+
skills: ["skills/openspec/openspec-explore","skills/openspec/openspec-propose","skills/openspec/openspec-apply-change","skills/openspec/openspec-sync-specs","skills/openspec/openspec-archive-change","skills/buildr/openspec-contract-guard"]
|
|
12
|
+
commandCollections: ["commands/buildr/openspec/manifest.yml"]
|
|
13
|
+
skillContributions: ["components/buildr/openspec/contributions/task-triage-change-ready.md","components/buildr/openspec/contributions/task-finish-pre-sync.md","components/buildr/openspec/contributions/task-finish-post-sync.md","components/buildr/openspec/contributions/openspec-explore-sidebar.md","components/buildr/openspec/contributions/openspec-propose-sidebar.md","components/buildr/openspec/contributions/openspec-apply-sidebar.md","components/buildr/openspec/contributions/openspec-sync-sidebar.md","components/buildr/openspec/contributions/openspec-archive-sidebar.md"]
|
|
14
|
+
contributions:
|
|
15
|
+
skillFragments: ["task-triage#change-ready=components/buildr/openspec/contributions/task-triage-change-ready.md","task-finish#pre-spec-sync=components/buildr/openspec/contributions/task-finish-pre-sync.md","task-finish#post-spec-sync=components/buildr/openspec/contributions/task-finish-post-sync.md","openspec-explore@prepend=components/buildr/openspec/contributions/openspec-explore-sidebar.md","openspec-propose@prepend=components/buildr/openspec/contributions/openspec-propose-sidebar.md","openspec-apply-change@prepend=components/buildr/openspec/contributions/openspec-apply-sidebar.md","openspec-sync-specs@prepend=components/buildr/openspec/contributions/openspec-sync-sidebar.md","openspec-archive-change@prepend=components/buildr/openspec/contributions/openspec-archive-sidebar.md"]
|
|
16
|
+
integrity: ["skills/openspec/openspec-explore=sha256-d7b8734a4700a0d61e0caef0361b8586dbfa02c4af72b267831d80b129d5f3c5","skills/openspec/openspec-propose=sha256-15b8b2873ffb9fed7b92b770801e5e98adf55cfb95e5b6bbae827c37d029abc8","skills/openspec/openspec-apply-change=sha256-3f301b91da398fc7e4df38fb5364e5b12379a85fffa06f7bfdf1cb8fe7188b69","skills/openspec/openspec-sync-specs=sha256-671b9d9c5d9f6bdbf483bf8200416f5f402f42b7a7e158e68598fa079ce1b32d","skills/openspec/openspec-archive-change=sha256-675b0ea6e8fef175d1ca0cacb173479de8f741672cbc122df370b9fb5b5383a5","skills/buildr/openspec-contract-guard=sha256-565babe5c73df1352d57ba7cc8dfbb754ad10ea2edd592a2697a4b021284b17c","commands/buildr/openspec/manifest.yml=sha256-d6a6d37fffd129bbe9a6d0a4baa2ff5d1ef79e315b82d716f18541fefb14651a","components/buildr/openspec/contributions/task-triage-change-ready.md=sha256-7d886ead6253bb4a957a626b03ca6fbdacdc091e65efa2550434f57525b09fd6","components/buildr/openspec/contributions/task-finish-pre-sync.md=sha256-77de2c0d4bdec69becfdb428df9749d39b0bf2bf7347c604365339ea3927389e","components/buildr/openspec/contributions/task-finish-post-sync.md=sha256-20e165f501132ca635e30074288231ef6ee85d1db1f94d4466376bb6ed6f79bc","components/buildr/openspec/contributions/openspec-explore-sidebar.md=sha256-62fda69e4b749e997c8a44ef76ef6fba32ff38d3996ee1bdb62cbd94382f422b","components/buildr/openspec/contributions/openspec-propose-sidebar.md=sha256-26f92129a2baf7b1b7a5e0200ec67158cefcca19c0a87f8ffc863c69d541b46c","components/buildr/openspec/contributions/openspec-apply-sidebar.md=sha256-476e17e12f3d419d4d0516d55eabec009ed164187d37807e2909fab78104cf51","components/buildr/openspec/contributions/openspec-sync-sidebar.md=sha256-fabb6ea6af9194cd8572d94ae7fa8c3152d34d6a63dcddf68527829552578e4e","components/buildr/openspec/contributions/openspec-archive-sidebar.md=sha256-5b6a3212c72ffbeb0a2f19d1a3e8b36b20189cc646d45a6114758233d3038d13"]
|
package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-post-sync.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
在 canonical spec sync 后、archive 前运行 `buildr openspec check <change> --stage post-sync --project <project> --target <workspace> --json`。失败时保留 worktree 和 change,停止尚未执行的 archive、commit、rebase、merge、push 或 cleanup,不得通过重跑 pre-sync 掩盖结果。
|
package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-pre-sync.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
在任何 canonical spec sync 前,从 Buildr workspace root 和 Project registry 解析 `<workspace>`、`<project>` 与 `<change>`,并运行 `buildr openspec check <change> --stage pre-sync --project <project> --target <workspace> --json`。结果不是 `ok: true` 时,停止尚未执行的 archive、commit、rebase、merge、push 或 cleanup。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
### OpenSpec 契约门禁
|
|
2
|
+
|
|
3
|
+
当 OpenSpec change 的 proposal、design、specs 和 tasks 都已完成、准备进入 apply 时:
|
|
4
|
+
|
|
5
|
+
1. 从 Buildr workspace root 和 Project registry 解析 `<workspace>` 与 `<project>`,不得根据当前目录猜测。
|
|
6
|
+
2. 运行 `buildr openspec baseline create <change> --project <project> --target <workspace> --json`,再运行 `buildr openspec check <change> --stage proposal --project <project> --target <workspace> --json`。
|
|
7
|
+
3. 只有 check 返回 `ok: true` 才报告 change 可进入 apply;缺少、陈旧或不完整 baseline,或 proposal/delta 不一致时,将 change 标记为 `blocked` 并报告 `nextActions`。
|
|
8
|
+
4. delta 后续新增或改变 touched Requirement identity 时,必须再次运行 proposal check,并在审阅后显式使用 baseline `--update`;普通 check 不得自动采用当前 canonical facts。
|
|
9
|
+
|
|
10
|
+
历史 active change 缺少 baseline 时,先向用户说明无法证明原始事实。只有用户明确确认以当前 canonical specs 作为采用基线,才能使用 `--adopt-current`。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Agent 在 `{{project}}` Project 中的最小运行规则。
|
|
4
|
+
|
|
5
|
+
## 项目定位
|
|
6
|
+
|
|
7
|
+
本文件是 Project scope 规则。开始项目任务时,先遵循 Buildr root `AGENTS.md` 和 Buildr Core,再读取本文件;进入具体 Service repo 后继续读取该服务仓 `AGENTS.md`。
|
|
8
|
+
|
|
9
|
+
禁止把其他 Project 的规范直接视为本 Project 事实;可以参考其目录组织和写法,但业务事实必须在本 Project `openspec/` 中独立沉淀。
|
|
10
|
+
|
|
11
|
+
## 资产边界
|
|
12
|
+
|
|
13
|
+
| 对象 | 位置 | 说明 |
|
|
14
|
+
|------|------|------|
|
|
15
|
+
| Project rules | `AGENTS.md` | 当前 Project 的 Agent 工作规则 |
|
|
16
|
+
| OpenSpec | `openspec/` | Project 事实、能力规范、变更和归档 |
|
|
17
|
+
| Skills | `skills/`、`skills/manifest.yml` | Project 级 Skills 源 |
|
|
18
|
+
| Service registry | `services/manifest.yml` | 当前项目 service repo registry |
|
|
19
|
+
| Service repos | `services/<service>/` | 独立 Git repo,业务代码由自身 Git 管理 |
|
|
20
|
+
|
|
21
|
+
Project 经验不使用独立 Practices 资产类型:约束和值守边界写入 Rule,可复用专业动作和操作流程写入 Skill,产品事实、需求和变更写入 OpenSpec,其他说明保留为普通 docs。
|
|
22
|
+
|
|
23
|
+
## 服务入口
|
|
24
|
+
|
|
25
|
+
Project 服务通过 `services/manifest.yml` 维护 Service registry,默认 repo 目录为 `services/<service>/`。进入具体 Service repo 后,继续读取该服务仓 `AGENTS.md`。
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Buildr Core
|
|
2
|
+
|
|
3
|
+
Buildr workspace 的基础模型、术语和硬边界。每次进入 workspace 都必须先读取当前 scope 的 `AGENTS.md`,再读取本文件。
|
|
4
|
+
|
|
5
|
+
## 基本原则
|
|
6
|
+
|
|
7
|
+
- Rule 控制 Agent 的价值观、边界和约束;Skill 封装可复用的专业动作和操作流程。
|
|
8
|
+
- Rule 和 Skill 不以“是否必须加载”作为本质区分;Rule description 是 Agent 判断规则语义相关性的索引,不是路径、角色或服务路由表。
|
|
9
|
+
- Rule 不承担场景化操作流程;任务触发型流程应优先沉淀为 Skill。
|
|
10
|
+
- Agent runtime adapter 只负责按目录层级发现和投射 Rule 源,不使用预设 role/path 替 Agent 判断规则与当前任务的语义相关性。
|
|
11
|
+
- 当前目录适用的 `AGENTS.md` 按 workspace root 到当前 scope 由宽到窄生效;scope 子树中的 `AGENTS.md` 在 Agent 进入或修改对应目录时生效。
|
|
12
|
+
- Organization/root 的模块化 Rule 由 `rules/manifest.yml` 管理:`enabled: true`、`required: true` 且 `state: installed` 的 Rule 必须读取正文。
|
|
13
|
+
- 对 `enabled: true`、`required: false` 且 `state: installed` 的 Rule,Agent 必须先检查 description,并在用户目标、修改范围、代码语义或 workspace context 表明相关时,于行动前读取正文。
|
|
14
|
+
- `enabled: false` 或 `state: uninstalled` 的 Rule 不参与当前任务;description 只表达语义边界和用途,不承载规则正文。
|
|
15
|
+
- 长期事实写入 Buildr 源资产;Agent runtime 是可重建渲染结果,不作为源资产维护。
|
|
16
|
+
- 在已初始化 workspace 中,Buildr 安装、源资产或 Agent runtime 状态变更后,必须运行当前 Agent 的 doctor;仍有需要立即处理的 error 时不得视为完成。
|
|
17
|
+
- 术语使用必须一致:同一个描述块内,要么统一使用中文术语,要么统一使用英文术语,要么在首次出现时统一使用“中文(English Term)”。
|
|
18
|
+
- 没有更具体的 Project、Service 或仓库约定时,Git 提交信息的主题和正文默认使用中文;代码标识、路径、scope 和专有名词可保留原文。
|
|
19
|
+
- 新建或重写文本文件时,文件末尾必须恰好保留一个换行符;不得在 EOF 前生成额外空白行。内容内部为表达段落所需的空行不受此约束。
|
|
20
|
+
- 面向用户说明问题、方案、进度或结果时,优先使用常用、直接和简练的语言;只在准确表达所必需时使用专业术语,并在需要时解释。
|
|
21
|
+
- 完成当前工作、到达阶段节点或遇到阻塞时,应结合当前状态以及适用的 Rule、Skill 和项目约定,向用户说明明确、可执行的下一步;任务已经完整结束时,应明确说明任务已完成,不机械追加无关建议。
|
|
22
|
+
- `rules/manifest.yml` 是 root/Organization Rule 登记和启停用事实清单;新增 root Rule 先编辑 `rules/<rule-id>.md`,再用 `buildr rules add` 注册;删除 root Rule 用 `buildr rules remove`。
|
|
23
|
+
|
|
24
|
+
## 基本模型
|
|
25
|
+
|
|
26
|
+
Buildr 是面向人、Agent 和组织的工作资产治理系统。
|
|
27
|
+
|
|
28
|
+
它把组织长期复用的规则、技能、命令、规范、产品事实和协作流程沉淀为可共享、可审计、可适配不同 Agent 的工作区(workspace)源资产,支撑多人、多职责、多项目、多服务的稳定协作。
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
Organization/Root -> Project -> Service
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| 术语 | 含义 |
|
|
35
|
+
|------|------|
|
|
36
|
+
| 组织(Organization/Root) | Buildr workspace 根;保存组织级规则(Rules)、项目登记(Project registry)、组件(Components)、技能(Skills)、命令(Commands)和 Agent runtime 渲染关系。 |
|
|
37
|
+
| 项目(Project) | 业务、产品线、系统或长期工作单元;保存项目级规则(Rules)、OpenSpec、技能(Skills)和服务登记(Service registry)。 |
|
|
38
|
+
| 服务(Service) | Project 管理的代码仓、应用、模块或可执行资产。 |
|
|
39
|
+
| Agent runtime | 当前 Agent 实际运行的资产,是从 Buildr 源资产生成的可重建结果。 |
|
|
40
|
+
|
|
41
|
+
## 资产边界
|
|
42
|
+
|
|
43
|
+
| 资产类型 | 默认位置 |
|
|
44
|
+
|----------|----------|
|
|
45
|
+
| 规则(Rules) | `AGENTS.md`、`rules/manifest.yml`、`rules/` |
|
|
46
|
+
| Project registry | `projects/manifest.yml` |
|
|
47
|
+
| 项目资产(Project assets) | `projects/<project>/` |
|
|
48
|
+
| Service registry | `projects/<project>/services/manifest.yml` |
|
|
49
|
+
| 服务资产(Service assets) | `projects/<project>/services/<service>/` |
|
|
50
|
+
| 技能(Skills) | `skills/manifest.yml`、`skills/` |
|
|
51
|
+
| 组件(Components) | `components/manifest.yml`、`components/<source>/<id>/component.yml` |
|
|
52
|
+
| 命令清单(Commands) | `commands/manifest.yml`、`commands/**/manifest.yml` |
|
|
53
|
+
| Agent runtime | `.agents/`、`.claude/`、`CLAUDE.md` 等渲染结果 |
|
|
54
|
+
|
|
55
|
+
## 硬边界
|
|
56
|
+
|
|
57
|
+
- Buildr 源资产是组织工作资产的长期事实来源;Agent runtime、本机状态、登录态、token、cookie、临时 prompt 和一次性聊天内容不是组织源资产。
|
|
58
|
+
- Practices 不是独立受管资产;已有 `practices/` 是用户保留数据,Buildr 不自动读取、迁移、覆盖或删除,也不因其存在阻塞正常命令。
|
|
59
|
+
- Component 当前只支持 workspace scope;成员由 definition 唯一声明,只能通过 Component 生命周期统一维护。本机外部 CLI 和 Project 内容不属于 workspace Component。
|
|
60
|
+
- 对象级卸载命中 Component 时,Agent 必须展示完整范围和保留项并取得二次确认,CLI 不负责猜测对象边界。
|
|
61
|
+
- 组织资产、项目资产和服务代码仓的 Git 边界必须按实际仓库判断,不得凭目录名假设。
|
|
62
|
+
- Buildr required block 只负责把 Agent 引导到 Buildr Core;具体任务流程由对应 Skill、项目规则或服务规则承载。
|
|
63
|
+
- Buildr required Rule 不建议手工改写;如被破坏,由 Buildr 产品能力恢复。
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-ops
|
|
3
|
+
description: 用户表达提交、commit、推送、push、提交并推送、合并、merge、rebase、发布、release、删除分支、清理远端分支等单项 Git 意图,或 Git 操作存在授权、提交范围、amend、远端改写、分支删除等歧义时使用。用于统一 Git 协作约定和安全默认行为,而不是完整任务结束编排。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Ops Skill
|
|
7
|
+
|
|
8
|
+
本 Skill 处理 Git 协作约定、意图消歧和安全默认行为。它不讲解 Git 命令用法,也不替代项目或服务规则中的构建、测试、发布要求。
|
|
9
|
+
|
|
10
|
+
## 意图消歧
|
|
11
|
+
|
|
12
|
+
- “提交”或 `commit` 只表示创建 commit,不表示 push。
|
|
13
|
+
- “推送”或 `push` 只表示推送已有提交;如果没有可推送提交,先说明状态,不自动创建 commit。
|
|
14
|
+
- “提交并推送”表示 commit + push。
|
|
15
|
+
- 完整“收尾”、完成任务或自动完成归档集成的意图由 `task-finish` Skill 编排;本 Skill 只处理单项 Git 意图和其安全策略。
|
|
16
|
+
- “发布”不自动等于 push;需要结合项目发布规则和用户明确动作。
|
|
17
|
+
|
|
18
|
+
## 授权边界
|
|
19
|
+
|
|
20
|
+
- 不依据历史对话里的提交、推送或清理授权自动执行新一轮 Git 操作,除非用户明确声明后续自动提交推送。
|
|
21
|
+
- 没有用户当前轮次明确授权,不执行 commit、push、merge、删除分支、删除远端分支、force push 或其他会改变远端状态的操作。
|
|
22
|
+
- 会改写提交历史的 amend、rebase、reset 或 force-with-lease,必须确认提交未推送,或取得用户明确授权。
|
|
23
|
+
- 远端 push 被拒绝时停止说明原因,不自动改用 force push。
|
|
24
|
+
- 新建开发任务本地分支时,除非用户指定,否则使用 `tasks/<task-id>`。
|
|
25
|
+
|
|
26
|
+
## Commit 范围
|
|
27
|
+
|
|
28
|
+
- commit 只包含当前任务直接相关变更。
|
|
29
|
+
- 工作区存在无关改动时,不 stage,不回滚,只说明已忽略。
|
|
30
|
+
- 执行 commit 前给出变更摘要:涉及文件、变更性质、排除的无关改动、commit message。
|
|
31
|
+
- 如果用户当前轮次已明确要求提交,且变更范围在上下文中清楚匹配当前任务,可以直接提交,不重复打断。
|
|
32
|
+
|
|
33
|
+
## Commit 信息
|
|
34
|
+
|
|
35
|
+
默认格式:`<type>(<scope>): <subject>`,其中 scope 可选。
|
|
36
|
+
|
|
37
|
+
- type 根据实际变更选择:`feat` 新功能,`fix` 修复,`docs` 文档,`style` 格式,`refactor` 重构,`perf` 性能,`test` 测试,`build` 构建或依赖,`ci` CI,`chore` 其他维护,`revert` 撤销。
|
|
38
|
+
- scope 仅在范围明确时使用,不猜测。
|
|
39
|
+
- subject 简洁描述实际变更;无需补充信息时只写一行。
|
|
40
|
+
- 正文可选,仅说明变更动机和行为差异;破坏性变更使用 `BREAKING CHANGE:`。
|
|
41
|
+
- 提交信息语言遵循 Buildr Core 和当前 scope 更具体的 Project、Service 或仓库约定。
|
|
42
|
+
|
|
43
|
+
## Amend 策略
|
|
44
|
+
|
|
45
|
+
- 同一任务的多次直接相关修正默认合并为一次提交。
|
|
46
|
+
- 同一任务已有本地未推送提交时,后续直接相关修正默认使用 amend。
|
|
47
|
+
- 已推送提交不自动 amend;需要用户明确选择新提交、revert,或允许安全的历史改写方式。
|
|
48
|
+
|
|
49
|
+
## 分支集成策略
|
|
50
|
+
|
|
51
|
+
- 集成前先 fetch 最新目标分支;本地未推送任务分支发生分叉时,默认 rebase 到最新目标分支。
|
|
52
|
+
- 项目要求的完整验证应绑定所有 rebase、冲突解决和内容修改结束后的最终候选 Git tree。
|
|
53
|
+
- rebase 前后必须比较最终候选 Git tree;rebase、冲突解决、amend 中的内容调整或其他操作改变已验证 tree 时,原验证结果失效,集成前重新运行受影响的验证。
|
|
54
|
+
- commit 只记录相同内容、目标分支集成后保持相同 tree 或 push 只传输已有提交时,复用已有验证结果,不因 checkout、commit hash 或分支名称改变而重复运行相同验证。
|
|
55
|
+
- 目标分支默认只通过 fast-forward 集成任务分支;除非用户当前轮次或项目规则明确要求,不创建 merge commit。
|
|
56
|
+
- 已推送或多人共享的任务分支不自动 rebase 或 force push。
|
|
57
|
+
- rebase 冲突需要业务或语义选择时,停止并报告冲突,等待用户确认。
|
|
58
|
+
|
|
59
|
+
## 远端默认行为
|
|
60
|
+
|
|
61
|
+
- push 前确认目标分支和待推送提交。
|
|
62
|
+
- 不对受保护分支 force push。
|
|
63
|
+
- 不自动创建或删除远端分支,除非用户意图明确。
|
|
64
|
+
- 涉及 API、SDK 或公共契约模块时,未完成项目或服务要求的发布/验证前不 push。
|
|
65
|
+
|
|
66
|
+
## 失败处理
|
|
67
|
+
|
|
68
|
+
检查、测试、OpenSpec 校验、发布、rebase、merge、push 或分支删除失败时:
|
|
69
|
+
|
|
70
|
+
- 停止当前 Git 操作。
|
|
71
|
+
- 说明失败阶段、失败命令和阻塞原因。
|
|
72
|
+
- 给出可选处理路径。
|
|
73
|
+
- 等用户确认后再继续。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openspec-contract-guard
|
|
3
|
+
description: 创建、修改、同步或归档 OpenSpec change,且需要建立契约基线、检查 active change 冲突、陈旧 delta 或同步结果时使用。此 Skill 是 Buildr 的 OpenSpec sidebar,不修改外部 openspec-* Skills。
|
|
4
|
+
metadata:
|
|
5
|
+
author: buildr
|
|
6
|
+
version: "1.0"
|
|
7
|
+
supportedOpenSpec: "1.4.1"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# OpenSpec Contract Guard
|
|
11
|
+
|
|
12
|
+
本 Skill 是 Buildr 自有的 OpenSpec 契约门禁。它通过 `buildr openspec` 检查 change 与 canonical specs 的关系,不修改外部 `openspec-*` Skills,也不修改或替换外部 OpenSpec CLI,更不安装外部 CLI。
|
|
13
|
+
|
|
14
|
+
## 适用边界
|
|
15
|
+
|
|
16
|
+
- Change 的 proposal、design、specs、tasks 已经 complete,准备进入 apply 时,建立或更新 baseline。
|
|
17
|
+
- 即将同步 delta specs、归档 change 或执行 `task-finish` 时,执行 pre-sync 和 post-sync 门禁。
|
|
18
|
+
- 用户要求排查并行 change、陈旧 delta、spec 回退或同步后契约丢失时,读取 JSON diagnostics 并报告可执行下一步。
|
|
19
|
+
|
|
20
|
+
先从 workspace root、Project registry 和 OpenSpec status 确认 `<workspace>`、`<project>` 与 `<change>`;不得根据当前目录猜测 Project。
|
|
21
|
+
|
|
22
|
+
## 1. 建立基线
|
|
23
|
+
|
|
24
|
+
在 change artifacts 达到 apply-ready、且 delta specs 已完成后运行:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
buildr openspec baseline create <change> --project <project> --target <workspace> --json
|
|
28
|
+
buildr openspec check <change> --stage proposal --project <project> --target <workspace> --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
基线位于 change 的 `.buildr/contract-baseline.json`,记录 touched Requirement 的 canonical facts。普通 check 不会自动创建或刷新基线。
|
|
32
|
+
|
|
33
|
+
历史 active change 缺少基线时,先向用户报告无法证明原始事实;只有用户确认“以当前 canonical specs 作为采用基线”后,才能运行:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
buildr openspec baseline create <change> --project <project> --target <workspace> --adopt-current --json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
delta 在基线后新增或改变 touched Requirement 时,先审阅新范围,再显式运行 `--update`。不得把 stale、incomplete 或 adopted warning 描述为已通过门禁。
|
|
40
|
+
|
|
41
|
+
## 2. 同步前后门禁
|
|
42
|
+
|
|
43
|
+
在任何 canonical spec sync 前:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
buildr openspec check <change> --stage pre-sync --project <project> --target <workspace> --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
只有 `ok: true` 才能调用外部 OpenSpec sync。pre-sync 会检查 proposal/delta 对齐、baseline 完整性、active change 同 Requirement 冲突、当前 canonical Requirement 是否仍匹配基线,并写入本次同步 receipt。
|
|
50
|
+
|
|
51
|
+
完成外部 sync 后、archive 前:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
buildr openspec check <change> --stage post-sync --project <project> --target <workspace> --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
post-sync 会验证 ADDED、MODIFIED、REMOVED、RENAMED 的结果,并确认 receipt 中未触达的 Requirement 没有被删改。失败时停止 archive、commit、push 和 cleanup;不要手工删除 sidecar 或重新运行 pre-sync 来掩盖已经发生的同步结果。
|
|
58
|
+
|
|
59
|
+
## 3. 失败处理
|
|
60
|
+
|
|
61
|
+
- `active_conflict`:列出冲突 change 和 Requirement;合并语义、先完成其中一个 change,或重新建立后续 change 基线。
|
|
62
|
+
- `baseline_stale`:当前 canonical facts 已变化;不要继续 sync,先审阅前序 change 并更新/重建当前 change。
|
|
63
|
+
- `baseline_missing` 或 `baseline_incomplete`:补齐显式基线;历史 change 必须得到采用确认。
|
|
64
|
+
- `post_sync_*`:停止归档与 Git 动作,保留 worktree,报告实际/预期摘要;需要语义选择时请用户决定。
|
|
65
|
+
- upstream 或 CLI version 不一致:按 Component 的 Command declaration 升级或恢复用户本机 OpenSpec CLI;Buildr 不代为安装。
|
|
66
|
+
|
|
67
|
+
用户可见状态必须包含 change、stage、baselineState、conflicts/findings 和 `nextActions`。外部 `openspec-*` Skills 继续承担 explore、propose、apply、sync 与 archive 的原有职责。
|