@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 陈俊
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # Buildr
2
+
3
+ 中文 | [English](https://github.com/elevenching/Buildr/blob/main/README.en.md)
4
+
5
+ Buildr 是面向人、Agent 和组织的工作资产治理系统。官方源码位于 [elevenching/Buildr](https://github.com/elevenching/Buildr),公开 npm package 为 `@buildr-ai/buildr`,安装后使用 `buildr` 命令。
6
+
7
+ ```bash
8
+ npm install --global @buildr-ai/buildr
9
+ buildr runtime list --json
10
+ buildr init --agent <agent> --target . --name <name> --profile <personal|team|company>
11
+ ```
12
+
13
+ 完整产品定位、核心模型、快速开始、当前能力和文档导航见仓库根目录的[中文 README](https://github.com/elevenching/Buildr#readme) 或 [English README](https://github.com/elevenching/Buildr/blob/main/README.en.md)。
14
+
15
+ 本目录维护 Buildr 产品源;开发约定见 [AGENTS.md](AGENTS.md),详细产品事实见 [Buildr 产品说明](docs/buildr-product.md),当前实现事实见 [Buildr current state](openspec/knowledge/buildr-current-state.md),规范性契约见 [OpenSpec specs](openspec/specs/)。
@@ -0,0 +1,62 @@
1
+ # Buildr CLI 内部架构
2
+
3
+ 本文面向 Buildr 维护者,说明 npm `buildr` bin 的内部模块边界。`tools/cli/` 是 package 内部实现,不是面向使用者的稳定 JavaScript API;公开兼容承诺仍以命令、参数、help 和 OpenSpec specs 为准。
4
+
5
+ ## 分层
6
+
7
+ ```text
8
+ tools/buildr
9
+ -> tools/cli/bootstrap.mjs
10
+ -> tools/cli/command/
11
+ -> tools/cli/application/
12
+ -> tools/cli/domains/
13
+ -> tools/cli/shared/
14
+
15
+ tools/runtime/ # runtime adapter 与 renderer
16
+ tools/shared/ # CLI 外复用的基础 helper
17
+ tools/verification/ # 按 cli/runtime/release 等领域分组的 verifier
18
+ ```
19
+
20
+ - `tools/buildr`:稳定 shebang/bin,只负责启动和顶层错误处理。
21
+ - `command/`:根/主题 help、唯一 command registry 和参数 dispatch。
22
+ - `application/`:组合 doctor、sync/update、package maintenance 等跨领域流程。
23
+ - `domains/`:Workspace/Project/Service、Rules、Skills、Commands、Components、OpenSpec contract 和 runtime 等领域实现。
24
+ - `shared/`:无领域语义的参数、路径、YAML、Git、filesystem、atomic write 和 workspace transaction 基础设施。
25
+
26
+ 依赖只允许沿上述方向向下。领域模块不直接互相 import;跨领域调用由 `application/compose-runtime.mjs` 显式装配,以避免循环依赖和隐式全局共享。composition root 可以聚合完整 platform,其余 CLI 模块必须从 `shared/platform.mjs` 使用实际需要的 named imports,并通过窄 runtime port 调用跨领域能力。
27
+
28
+ 三个稳定 facade 保留现有调用表面,但不承载长流程:
29
+
30
+ ```text
31
+ application/doctor.mjs
32
+ -> application/doctor/{scope,service,runtime}-diagnostics.mjs
33
+ application/package-maintenance.mjs
34
+ -> application/package-maintenance/{static-validation,smoke-checks}.mjs
35
+ tools/runtime/render-claude-code.mjs
36
+ -> tools/runtime/skills/{arguments,manifests,contributions,sources,render-plan}.mjs
37
+ ```
38
+
39
+ `tools/verify-buildr-product-mvp` 同样只调度 `tools/verify/mvp/*.sh` 场景;共享同一临时 workspace 的 E2E 仍在同一 shell 进程执行,但不再把所有场景实现堆在聚合入口。
40
+
41
+ `tools/` 顶层只保留 `buildr`、安装/卸载脚本和产品验证聚合入口等稳定可执行表面。内部 runtime、共享 helper 与专项 verifier 必须进入职责子目录;这些内部文件路径不属于公开兼容契约。
42
+
43
+ ## 兼容和发布边界
44
+
45
+ - `tools/buildr` 与 npm 安装后的 `buildr` 使用同一个内部 runtime 和 command registry。
46
+ - `package.json#files` 递归发布 `tools/cli/`,但不声明 package `exports`。
47
+ - 重构内部模块不得改变命令路径、参数、stdout/stderr、退出码、JSON schema、文件结果或 transaction/fail-closed 行为;行为变化必须使用独立 OpenSpec change。
48
+ - `packageCheck` 是 composition handler:静态发布校验和临时 workspace smoke runner 分开维护,统一聚合问题与退出状态。
49
+
50
+ ## 维护验证
51
+
52
+ ```bash
53
+ node tools/verification/cli/architecture.mjs
54
+ npm run test:unit
55
+ node tools/verification/cli/compatibility.mjs
56
+ node tools/verification/cli/package-parity.mjs
57
+ node tools/verification/integrity/managed-mutations.mjs
58
+ ```
59
+
60
+ architecture verifier 检查薄入口、稳定 facade、显式 platform 依赖、完整 runtime inventory、单向 import、command 唯一登记、MVP 场景组合和 npm 边界;`node:test` 覆盖参数/manifest/path/render plan 等纯逻辑;compatibility verifier 检查 help、失败路径、JSON discovery 和 source mutation;package parity verifier 从 tarball 安装,在干净目录比较 checkout/npm 行为;mutation verifier 递归扫描全部发布 runtime modules 的直接写入白名单。
61
+
62
+ 新增命令时应先在 `command/registry.mjs` 登记唯一 key,把领域逻辑放入对应 domain,并仅在确需跨领域组合时新增 application service。不要把领域 helper 放入 `shared/`,也不要通过 Component 或动态加载扩展 command registry。
@@ -0,0 +1,67 @@
1
+ # Buildr CLI Reference
2
+
3
+ 本文列出 Buildr 0.1.x 的公开命令和稳定用途。以 `buildr <topic> --help`、`buildr runtime list --json` 和 `buildr doctor --agent <agent> --json` 的当前输出为最终参数事实。
4
+
5
+ 支持 `--json` 的命令在顶层输出 `schemaVersion`。该字段及兼容规则见 [公开 JSON 契约](json-contracts.md);消费者应按 schema identity 判断格式,而不是依赖未声明的内部实现。
6
+
7
+ ## 首次使用
8
+
9
+ ```bash
10
+ buildr runtime list --json
11
+ buildr init --agent <claude-code|codex> --target <workspace> --name <name> --profile <personal|team|company>
12
+ ```
13
+
14
+ `init --agent` 是默认首次 onboarding 入口:它先初始化源资产,再复用完整 `sync` 执行 source update、产品 Buildr Skill 安装、workspace/project Skills 投射和最终 doctor。已有 workspace 的产品能力与 runtime 更新继续使用 `sync`。
15
+
16
+ `buildr update` 只更新 CLI 自身:开发 checkout 使用 Git 安全更新,registry package 使用 npm 更新。它不接收 `--target`,也不读取 workspace。用户要求完整“更新 Buildr”时,Agent 在 update 成功后重新解析入口,再执行 `buildr sync <agent> --target <workspace>`。
17
+
18
+ ## Workspace 与资产
19
+
20
+ | 命令 | 用途 |
21
+ |---|---|
22
+ | `buildr init [--agent <agent>]` | 初始化 Organization/Root;传入 `--agent` 时一次完成 runtime 与最终 doctor,不传时只写源资产。 |
23
+ | `buildr project create <project>` | 创建或登记 Project;`--repo` 接入 Project 资产 Git repo。 |
24
+ | `buildr service create <project>/<service> <repo-ref>` | 接入本地目录或 Git Service;Git 来源可用 `--branch <branch>` 指定 checkout intent。 |
25
+ | `buildr rules add/remove` | 维护 root Rules manifest 和文件生命周期。 |
26
+ | `buildr skills add/remove/render` | 维护本地或远端 Skills 源资产并投射 runtime。 |
27
+ | `buildr commands add/remove/check` | 声明并诊断外部 CLI;Buildr 不代替用户安装。 |
28
+ | `buildr component list/check/install/uninstall` | 管理 workspace 级 Rules、Skills、Command collections 与声明式 Skill Contribution。 |
29
+ | `buildr builtin list/uninstall/restore` | 查看或维护 Buildr 内置能力;required 能力不能卸载。 |
30
+ | `buildr update [check]` | 检查或更新 Buildr CLI 自身;不维护 workspace。 |
31
+
32
+ `service create --branch` 只适用于 Git 来源。Manifest 使用 `repo.branch` 保存显式 checkout intent,`repo.defaultBranch` 保存远端 HEAD 事实。
33
+
34
+ ## Runtime 与诊断
35
+
36
+ | 命令 | 用途 |
37
+ |---|---|
38
+ | `buildr runtime list` | 查看 supported adapters、capabilities 和推荐命令。 |
39
+ | `buildr doctor` | 聚合 workspace、registries、Components、Commands 和 runtime 状态。Agent 默认传 `--agent` 与 `--json`。 |
40
+ | `buildr render <agent>` | 组合投射 Rules entry 与 workspace/project Skills,不安装产品入口 Skill。 |
41
+ | `buildr sync <agent>` | 同步 workspace 产品源能力并准备完整当前 Agent runtime;不更新 CLI。 |
42
+ | `buildr runtime check <agent>` | 专项比较某个 scope 的 runtime 期望状态。 |
43
+ | `buildr skill install <agent>` | 只安装产品入口 Buildr Skill。 |
44
+ | `buildr mutation recover <id>` | 从完整 transaction journal/backup 恢复未完成 source mutation。 |
45
+
46
+ 当前支持 `claude-code` 和 `codex`。其他 runtime 不使用 fallback adapter。
47
+
48
+ ## Product maintenance / workflow internal
49
+
50
+ - `buildr package check/build`:产品 package 维护和构建,不是普通 workspace 日常命令。
51
+ - `buildr openspec baseline create/check`:Buildr OpenSpec workflow 契约门禁,由相关 Skills 编排。
52
+ - `buildr bootstrap guide`:产品 Skill 不可用时的纯文本兜底说明。
53
+
54
+ 这些命令可执行,但不构成普通用户需要记忆的 public asset API。
55
+
56
+ ## 内部实现边界
57
+
58
+ `tools/buildr` 是稳定 npm bin 路径,实际命令通过内部 `tools/cli/` runtime 和唯一 command registry 执行。该模块树随 tarball 发布以保证命令可运行,但不是公开 JavaScript API,不承诺文件级 import 兼容;维护约定见 [CLI 内部架构](cli-architecture.md)。
59
+
60
+ ## 远端 Skill 请求
61
+
62
+ resolved `skill-url` 默认具有有限请求时间。维护者可设置:
63
+
64
+ - `BUILDR_REMOTE_SKILL_INACTIVITY_TIMEOUT_MS`
65
+ - `BUILDR_REMOTE_SKILL_TOTAL_TIMEOUT_MS`
66
+
67
+ 值必须是 `1..120000` 的整数毫秒。生产环境建议为 resolved source 提供 `sha256-<hex>` integrity。
@@ -0,0 +1,13 @@
1
+ # Buildr 0.1 已知限制
2
+
3
+ - 当前只支持 `claude-code` 和 `codex` runtime adapter。
4
+ - CLI 支持 Node.js 20 及以上版本。CI 在 Linux 上对 Node 20/22 执行完整验证,并在 Linux、macOS、Windows 的 Node 22 上验证打包安装生命周期;其他 Node/操作系统组合不属于 0.1 的持续验证范围。
5
+ - Component 只支持 workspace scope;没有 Project/Service Component、远程 registry、依赖求解或可执行 Hook。
6
+ - Buildr 使用本地文件系统和 Git 保存资产,没有云端权限系统、Web UI 或跨机器自动恢复服务。
7
+ - Commands 只声明和诊断外部 CLI,不执行本机安装、升级或登录。
8
+ - 远端 Skill 当前只支持 raw `SKILL.md` 的 `resolved.kind: skill-url`;未声明 integrity 时允许 render,但 doctor 会警告。
9
+ - Service branch intent 不负责 pull、merge、rebase 或长期分支同步;它只控制首次 clone、metadata 和 drift 诊断。
10
+ - 官方 npm package identity 已确定为 `@buildr-ai/buildr`;在 `0.1.0-rc.1` 实际发布和 GitHub trusted publisher 配置完成前,registry 安装命令仍属于发布准备表面,开发 checkout 和本地 tarball 路径继续作为当前可验证入口。
11
+ - `package check/build` 与 `openspec baseline/check` 是维护/workflow 表面,不建议普通 workspace 直接依赖。
12
+
13
+ 遇到 unsupported runtime 或不能确定的资产边界时,Agent 应停止自动变更、保留源资产,并报告可执行下一步。
@@ -0,0 +1,24 @@
1
+ # Minimal Buildr Workspace
2
+
3
+ 这个示例展示从 CLI 可用到 Agent runtime 可用的最小路径,不保存生成后的 runtime 文件。
4
+
5
+ 把 `<agent>` 替换为 `codex` 或 `claude-code`:
6
+
7
+ ```bash
8
+ mkdir buildr-demo
9
+ cd buildr-demo
10
+ buildr runtime list --json
11
+ buildr init --agent <agent> --target . --name buildr-demo --profile personal
12
+ ```
13
+
14
+ 该命令已包含完整 sync 和最终 doctor;已有 workspace 后续更新时再使用 `buildr sync <agent> --target .`。
15
+
16
+ 随后可以创建 Project 并接入 Service:
17
+
18
+ ```bash
19
+ buildr project create shop --target . --title "Shop" --description "示例业务项目"
20
+ buildr service create shop/api <git-url> --branch main --target . --type backend
21
+ buildr doctor --agent <agent> --target . --json
22
+ ```
23
+
24
+ 长期事实写入 `AGENTS.md`、`rules/`、`skills/`、`commands/`、`components/` 和 `projects/`;`.agents/`、`.claude/` 与 `CLAUDE.md` 是可重建 runtime。
@@ -0,0 +1,28 @@
1
+ # Buildr Package
2
+
3
+ 本目录保存 Buildr 随包源资产。这里的 README 只面向维护者说明目录职责,不作为发布、映射或运行契约。
4
+
5
+ `package check` 和 `package build` 属于 Buildr 产品维护、验证和发布表面,不是普通 workspace onboarding 的必需步骤。`package:<source-id>` 仅是 package manifest `skillSources` 与随包 resolver 的内部 source identity;维护材料可以准确描述它,public Skill authoring 指引不得把它当作用户 asset id 或公开 source scheme。
6
+
7
+ ## 事实来源
8
+
9
+ - `manifest.yml` 是发布边界、source-to-target 映射、模板变量和禁止内容的机器契约。
10
+ - 产品仓中的 `openspec/specs/buildr-package-assets/spec.md` 是随包资产和 package check 的规范性契约。
11
+ - 产品仓中的 `docs/release-checklist.md` 是发布和验证入口。
12
+ - `targets/workspace/` 保存由 init/sync 物化到用户 workspace 或 Project 的交付源。
13
+ - `targets/runtime/` 保存直接安装到 Agent runtime 的交付源;产品入口 Buildr Skill 位于 `targets/runtime/skills/buildr/SKILL.md`。
14
+ - `bootstrap/guide.md` 是 Buildr Skill 不可用时由 CLI 输出的 fallback runbook,`bootstrap/contract.yml` 是对应机器校验契约;bootstrap 不属于 workspace/runtime target。
15
+
16
+ ## 验证
17
+
18
+ 从 workspace root 运行:
19
+
20
+ ```bash
21
+ projects/product/buildr package check
22
+ projects/product/tools/verification/onboarding/init.mjs
23
+ projects/product/tools/verification/onboarding/repository.mjs
24
+ projects/product/tools/verify-buildr-product-mvp
25
+ (cd projects/product && openspec validate --all --strict)
26
+ ```
27
+
28
+ `verify-repository-onboarding.mjs` 会复制一个不含 `node_modules` 与 Agent runtime 的临时候选树,从开发 checkout installer 开始验证 `runtime list -> init --agent codex`,并独立读取 doctor JSON 证明最终状态。
@@ -0,0 +1,122 @@
1
+ bootstrapGuidePath: package/bootstrap/guide.md
2
+ bootstrapGuideMaxLines: 80
3
+ bootstrapGuideRequiredText:
4
+ - Buildr Skill
5
+ - 兜底入口
6
+ - buildr bootstrap guide
7
+ - buildr runtime list --json
8
+ - 识别当前 Agent
9
+ - 支持列表中对应的参数
10
+ - buildr init --agent <agent>
11
+ - buildr skill install <agent>
12
+ - claude-code
13
+ - codex
14
+ - buildr sync <agent>
15
+ - 产品能力同步
16
+ - 当前 Agent runtime render
17
+ - buildr doctor --agent <agent>
18
+ - 不要省略 `--agent`
19
+ - buildr init
20
+ - buildr project create
21
+ - --repo
22
+ - buildr service create
23
+ - buildr rules add
24
+ - buildr rules remove
25
+ - 优先使用 Buildr CLI
26
+ - 根据用户目标和 doctor 结果
27
+ - workspace 必须完成
28
+ - Agent runtime 是面向当前 Agent 的可重建入口
29
+ - 组织资产先改变源资产
30
+ - enabled、required 且 installed
31
+ - disabled 或 uninstalled Rule
32
+ - 请联系 Buildr 作者反馈该 Agent
33
+ - buildr component list/check
34
+ - CLI 不根据对象名称猜测 Component 边界
35
+ bootstrapGuideForbiddenText:
36
+ - onboarding.contract.yml
37
+ - bootstrap.contract.yml
38
+ - buildr skills add
39
+ - buildr runtime check claude-code
40
+
41
+ buildrSkillPath: package/targets/runtime/skills/buildr/SKILL.md
42
+ buildrSkillMaxLines: 160
43
+ buildrSkillRequiredSections:
44
+ - Buildr 是什么
45
+ - 执行循环
46
+ - 任务路由
47
+ - 资产维护
48
+ - Workspace
49
+ - Project
50
+ - Service
51
+ - Rules
52
+ - Commands
53
+ - Skills
54
+ - Agent 运行时渲染
55
+ - 完成标准
56
+ buildrSkillRequiredText:
57
+ - 优先使用 Buildr CLI
58
+ - 状态变更后确认最新 doctor 结果
59
+ - 根据用户目标和 doctor 结果
60
+ - 建立事实基线
61
+ - 创建或修复 Project/Service 必须来自用户意图
62
+ - AGENTS.md
63
+ - projects/manifest.yml
64
+ - commands/manifest.yml
65
+ - skills/manifest.yml
66
+ - buildr commands add
67
+ - buildr commands remove
68
+ - buildr commands check
69
+ - buildr rules add
70
+ - buildr rules remove
71
+ - "enabled: true"
72
+ - "state: installed"
73
+ - 不替 Agent 判断 optional Rule
74
+ - buildr runtime list --json
75
+ - 识别当前 Agent
76
+ - 支持列表中对应的参数
77
+ - buildr doctor --agent <agent>
78
+ - 不要省略 `--agent`
79
+ - buildr skills add
80
+ - --remote-source
81
+ - --resolved-source
82
+ - buildr skills remove
83
+ - runtime check
84
+ - 专项 runtime 细查
85
+ - rules render
86
+ - skills render
87
+ - buildr sync
88
+ - buildr update
89
+ - buildr builtin list
90
+ - 请联系 Buildr 作者反馈该 Agent
91
+ - task-worktree
92
+ - task-finish
93
+ - git-ops
94
+ - components/manifest.yml
95
+ - buildr component install
96
+ - buildr component uninstall
97
+ - 二次确认
98
+ buildrSkillForbiddenText:
99
+ - onboarding.contract.yml
100
+ - bootstrap.contract.yml
101
+ - openspec-contract-guard
102
+ - buildr openspec
103
+ - --reference
104
+ - "## 轻约束"
105
+ - "## 命令地图"
106
+ - "| 目的 |"
107
+ - "manifest 示例"
108
+
109
+ globalForbiddenText:
110
+ - buildr bootstrap install-skill
111
+ - buildr onboard
112
+ - buildr use
113
+
114
+ generatedSkillRequiredText:
115
+ - 当前 Agent Adapter
116
+ - buildr runtime list --json
117
+ - buildr skill install claude-code
118
+ - buildr sync claude-code
119
+ - buildr doctor --agent claude-code --target <dir> --json
120
+ - buildr runtime check claude-code
121
+ - buildr rules render claude-code
122
+ - buildr skills render claude-code
@@ -0,0 +1,79 @@
1
+ # Buildr Bootstrap Guide
2
+
3
+ 本指南面向 Agent,是 Buildr Skill 不可用、未安装、损坏或需要维护 Buildr 时的兜底入口,可通过 `buildr bootstrap guide` 读取。它负责区分 CLI 自更新与 workspace 同步、恢复 Buildr Skill,或在安装失败时给出最小 CLI 兜底流程。
4
+ ## 首次初始化或恢复 Skill
5
+
6
+ 先发现 Buildr 支持的 Agent runtime:
7
+
8
+ ```bash
9
+ buildr runtime list --json
10
+ ```
11
+
12
+ 识别当前 Agent,并将 `<agent>` 固定为支持列表中对应的参数;当前支持 `claude-code` 和 `codex`。如果无法和支持列表对齐,停止 Buildr 操作,并请联系 Buildr 作者反馈该 Agent。
13
+
14
+ workspace 尚未初始化时,用一个高层命令完成源资产、Buildr Skill、当前 Agent runtime render 和最终 doctor:
15
+
16
+ ```bash
17
+ buildr init --agent <agent> --target <dir> --name <name> --profile <personal|team|company>
18
+ ```
19
+ 已有 workspace 中,用户要求“更新 Buildr”时先更新 CLI,再用新入口同步 workspace:
20
+
21
+ ```bash
22
+ buildr update
23
+ command -v buildr
24
+ buildr sync <agent> --target <workspace-root>
25
+ ```
26
+
27
+ 用户明确只同步 workspace 时直接使用 sync:
28
+
29
+ ```bash
30
+ buildr sync <agent> --target <dir>
31
+ ```
32
+
33
+ `sync` 包含产品能力同步、产品入口 Buildr Skill 安装、从 `.` 递归投射各层 `AGENTS.md` 的当前 Agent runtime render 和 doctor 复查。
34
+ 只需要在未初始化目录单独恢复产品入口 Skill 时使用专项入口:
35
+
36
+ ```bash
37
+ buildr skill install <agent> --target <dir>
38
+ ```
39
+
40
+ 如果安装后 Buildr Skill 可用,后续按 Buildr Skill 工作。本指南只保留 Skill 不可用时的最小兜底流程。
41
+
42
+ ## 最小兜底
43
+
44
+ 优先使用 Buildr CLI 完成用户指令。workspace 必须完成初始化;未初始化时使用上面的 `buildr init --agent <agent>`,其成功输出已包含最终 doctor,不再重复执行。已有 workspace 中,`buildr doctor --agent <agent> --json` 是最小兜底流程的默认事实入口。不要省略 `--agent`;未指定 Agent 时 doctor 会检查所有支持的 runtime。
45
+
46
+ ```bash
47
+ buildr doctor --agent <agent> --target <dir> --json
48
+ ```
49
+
50
+ 根据用户目标和 doctor 结果继续。创建或修复 Project/Service 必须来自用户意图、已有源资产、明确 repo/ref,或 doctor 指出的可修复 drift。Component 当前只支持 workspace:先用 `buildr component list/check --target <dir> --json` 核对定义和成员,再用带 `--agent <agent>` 的 install/uninstall 完成 runtime 与 doctor 闭环;CLI 不根据对象名称猜测 Component 边界。
51
+
52
+ ```bash
53
+ buildr project create <project> --target <dir> [--repo <git-url>] [--title <text>] [--description <text>]
54
+ buildr service create <project>/<service> <repo-ref> --target <dir> [--type <type>] [--branch <branch>]
55
+ ```
56
+
57
+ 用户要管理业务、产品线、系统或长期工作单元时才创建 Project;Project 资产 repo 用 `project create --repo` clone 到 `projects/<project>/`,不登记外部本地链接。用户提供 service repo 路径、Git URL 或明确要接入服务资产时才创建 Service;Git 来源可用 `--branch` 保存显式 checkout intent。Service 规则入口是 Service 目录中的 `AGENTS.md`,不通过 registry 参数指定规则路径。
58
+
59
+ ## 边界
60
+
61
+ Buildr workspace 是组织(Organization/Root)资产根;Agent runtime 是面向当前 Agent 的可重建入口。组织资产先改变源资产(使用 Buildr CLI),再同步 Agent runtime(使用 render/sync)。
62
+
63
+ Rules 控制 Agent 的价值观、边界和约束;Skills 封装可复用的专业动作和操作流程。Rule 和 Skill 不以“是否必须加载”作为本质区分;任务触发型流程应沉淀为 Skills,并通过当前 Agent runtime 渲染后使用。
64
+
65
+ Agent runtime adapter 按“scope 祖先链 + scope 子树”发现和投射 `AGENTS.md`,不替 Agent 做语义决策。Agent 必须读取 enabled、required 且 installed 的 Rule;对 enabled、optional 且 installed 的 Rule,先检查 description,并在当前任务语义相关时于行动前读取正文。disabled 或 uninstalled Rule 不参与任务。
66
+
67
+ root/Organization 规则维护使用 `rules/manifest.yml` 和 `rules/`。新增规则时,先创建并编辑 `rules/<rule-id>.md`,再运行:
68
+
69
+ ```bash
70
+ buildr rules add <rule-id> --target <dir> --description <text>
71
+ ```
72
+
73
+ 删除 root 规则时运行:
74
+
75
+ ```bash
76
+ buildr rules remove <rule-id> --target <dir>
77
+ ```
78
+
79
+ 如只取消注册并保留规则文件,使用 `--keep-file`;Project 规则当前通过 `projects/<project>/AGENTS.md` 维护。对象级卸载若命中 Component,必须先展示完整成员、runtime 影响以及不会删除的外部 CLI 和 Project 内容,取得二次确认后才执行。
@@ -0,0 +1,144 @@
1
+ include:
2
+ - LICENSE
3
+ - README.md
4
+ - docs/cli-reference.md
5
+ - docs/cli-architecture.md
6
+ - docs/known-limitations.md
7
+ - examples/minimal-workspace/README.md
8
+ - package/
9
+
10
+ agentSkills:
11
+ - id: buildr
12
+ path: package/targets/runtime/skills/buildr
13
+ runtimes:
14
+ - claude-code
15
+ - codex
16
+
17
+ builtins:
18
+ rules:
19
+ - id: buildr-core
20
+ path: package/targets/workspace/rules/buildr/core.md
21
+ target: rules/buildr/core.md
22
+ description: Buildr workspace 基础契约;每次进入 workspace 都必须读取。
23
+ required: true
24
+ skills:
25
+ - id: task-triage
26
+ path: package/targets/workspace/skills/buildr/task-triage
27
+ target: skills/buildr/task-triage
28
+ description: 用户要求修 bug、实现或调整功能、改需求、重构、优化、补文档、补测试、调整 API/契约/权限/状态流/数据语义,或询问某项改动是否需要更新 spec、创建 change、只改代码时使用。
29
+ required: false
30
+ runtimes: ["claude-code","codex"]
31
+ - id: task-worktree
32
+ path: package/targets/workspace/skills/buildr/task-worktree
33
+ target: skills/buildr/task-worktree
34
+ description: 用户要求代码开发、修 bug、实现功能、运行构建或测试、多仓协作、隔离任务分支,或清理已上线、已归档、已收尾任务的 worktree/change-id/任务分支时使用。
35
+ required: false
36
+ legacyIntegrities:
37
+ - sha256-23e68c3174887ebbf6990526f93e7f1c047199e1bef1f2e8e293b0cba2a3cfad
38
+ runtimes: ["claude-code","codex"]
39
+ - id: task-finish
40
+ path: package/targets/workspace/skills/buildr/task-finish
41
+ target: skills/buildr/task-finish
42
+ description: 用户在 task worktree 中要求“收尾”、完成任务、自动收尾,或要求自动完成已验证 change 的归档、提交、集成、推送和本地清理时使用。
43
+ required: false
44
+ runtimes: ["claude-code","codex"]
45
+ - id: git-ops
46
+ path: package/targets/workspace/skills/buildr/git-ops
47
+ target: skills/buildr/git-ops
48
+ description: 用户表达提交、commit、推送、push、提交并推送、合并、merge、rebase、发布、release、删除分支、清理远端分支等单项 Git 意图,或 Git 操作存在授权、范围、amend、远端改写、分支删除等歧义时使用。
49
+ required: false
50
+ runtimes: ["claude-code","codex"]
51
+ - id: openspec-explore
52
+ path: package/targets/workspace/skills/openspec/openspec-explore
53
+ target: skills/openspec/openspec-explore
54
+ description: 探索想法、调查问题或澄清需求时使用;只思考和梳理,不实现代码。
55
+ required: false
56
+ component: openspec
57
+ runtimes: ["claude-code","codex"]
58
+ - id: openspec-propose
59
+ path: package/targets/workspace/skills/openspec/openspec-propose
60
+ target: skills/openspec/openspec-propose
61
+ description: 用户要快速创建完整 OpenSpec change 提案、设计、规格和任务时使用。
62
+ required: false
63
+ component: openspec
64
+ runtimes: ["claude-code","codex"]
65
+ - id: openspec-apply-change
66
+ path: package/targets/workspace/skills/openspec/openspec-apply-change
67
+ target: skills/openspec/openspec-apply-change
68
+ description: 用户要开始或继续实现某个 OpenSpec change 的任务时使用。
69
+ required: false
70
+ component: openspec
71
+ runtimes: ["claude-code","codex"]
72
+ - id: openspec-sync-specs
73
+ path: package/targets/workspace/skills/openspec/openspec-sync-specs
74
+ target: skills/openspec/openspec-sync-specs
75
+ description: 用户要把 change 中的 delta specs 同步到主 specs,但不归档 change 时使用。
76
+ required: false
77
+ component: openspec
78
+ runtimes: ["claude-code","codex"]
79
+ - id: openspec-archive-change
80
+ path: package/targets/workspace/skills/openspec/openspec-archive-change
81
+ target: skills/openspec/openspec-archive-change
82
+ description: 用户明确要归档已完成 OpenSpec change 时使用。
83
+ required: false
84
+ component: openspec
85
+ runtimes: ["claude-code","codex"]
86
+ - id: openspec-contract-guard
87
+ path: package/targets/workspace/skills/buildr/openspec-contract-guard
88
+ target: skills/buildr/openspec-contract-guard
89
+ description: 创建、同步或归档 OpenSpec change 时建立契约基线,并检测并行冲突、陈旧 delta 和同步结果漂移。
90
+ required: false
91
+ component: openspec
92
+ runtimes: ["claude-code","codex"]
93
+ commands: []
94
+
95
+ components:
96
+ - id: openspec
97
+ path: package/targets/workspace/components/buildr/openspec/component.yml
98
+ defaultEnabled: true
99
+ required: false
100
+
101
+ workspaceDirectories:
102
+ - commands
103
+ - components
104
+ - projects
105
+ - rules
106
+ - skills
107
+
108
+ workspaceFiles:
109
+ - package/targets/workspace/AGENTS.md => AGENTS.md render
110
+ - package/targets/workspace/.buildr/workspace.yml => .buildr/workspace.yml render
111
+ - package/targets/workspace/projects/manifest.yml => projects/manifest.yml copy
112
+ - package/targets/workspace/gitignore => .gitignore copy
113
+ - package/targets/workspace/rules/manifest.yml => rules/manifest.yml copy
114
+ - package/targets/workspace/rules/buildr/core.md => rules/buildr/core.md copy
115
+ - package/targets/workspace/commands/manifest.yml => commands/manifest.yml copy
116
+ - package/targets/workspace/components/manifest.yml => components/manifest.yml copy
117
+ - package/targets/workspace/skills/manifest.yml => skills/manifest.yml copy
118
+ - package/targets/workspace/skills/buildr/task-triage/SKILL.md => skills/buildr/task-triage/SKILL.md copy
119
+ - package/targets/workspace/skills/buildr/task-worktree/SKILL.md => skills/buildr/task-worktree/SKILL.md copy
120
+ - package/targets/workspace/skills/buildr/task-finish/SKILL.md => skills/buildr/task-finish/SKILL.md copy
121
+ - package/targets/workspace/skills/buildr/git-ops/SKILL.md => skills/buildr/git-ops/SKILL.md copy
122
+
123
+ projectDirectories:
124
+ - openspec/specs
125
+ - openspec/knowledge
126
+ - openspec/changes
127
+ - skills
128
+ - services
129
+
130
+ projectFiles:
131
+ - package/targets/workspace/projects/AGENTS.project.md => AGENTS.md render
132
+ - package/targets/workspace/projects/services/manifest.yml => services/manifest.yml render
133
+ - package/targets/workspace/projects/skills/manifest.yml => skills/manifest.yml copy
134
+
135
+ templateVariables:
136
+ - name
137
+ - profile
138
+ - project
139
+
140
+ forbiddenPatterns:
141
+ - /Users/
142
+ - organizations/
143
+ - rules/AGENTS.private.md
144
+ - integrations/openspec.md