@buildr-ai/buildr 0.1.0-rc.2 → 0.1.0-rc.21
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/README.md +47 -5
- package/application-payload.json +595 -0
- package/bin/buildr.mjs +14 -0
- package/installation-origin.json +13 -0
- package/package.json +16 -45
- package/payload/licenses/dependencies/yaml-LICENSE +13 -0
- package/payload/product/LICENSE +21 -0
- package/payload/product/README.md +59 -0
- package/payload/product/package/README.md +42 -0
- package/{package → payload/product/package}/bootstrap/contract.yml +26 -11
- package/{package → payload/product/package}/bootstrap/guide.md +11 -11
- package/payload/product/package/launchers/assets/Buildr.icns +0 -0
- package/payload/product/package/launchers/assets/Buildr.ico +0 -0
- package/payload/product/package/manifest.yml +547 -0
- package/payload/product/package/targets/runtime/skills/buildr/SKILL.md +174 -0
- package/{package → payload/product/package}/targets/workspace/commands/buildr/openspec/manifest.yml +2 -2
- package/payload/product/package/targets/workspace/components/buildr/openspec/component.yml +79 -0
- package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-apply-sidebar.md +21 -0
- package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-archive-converge.md +5 -0
- package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-explore-terminology.md +5 -0
- package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-propose-sidebar.md +21 -0
- package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-sync-converge.md +5 -0
- package/payload/product/package/targets/workspace/components/buildr/openspec/contributions/openspec-update-sidebar.md +13 -0
- package/payload/product/package/targets/workspace/gitattributes +1 -0
- package/payload/product/package/targets/workspace/gitignore +31 -0
- package/{package → payload/product/package}/targets/workspace/projects/AGENTS.project.md +1 -1
- package/payload/product/package/targets/workspace/rules/buildr/core.md +62 -0
- package/payload/product/package/targets/workspace/skills/buildr/capability-adaptation/SKILL.md +56 -0
- package/payload/product/package/targets/workspace/skills/buildr/capability-adaptation/agents/openai.yaml +4 -0
- package/payload/product/package/targets/workspace/skills/buildr/current-knowledge-maintenance/SKILL.md +103 -0
- package/payload/product/package/targets/workspace/skills/buildr/declaration-intake/SKILL.md +65 -0
- package/payload/product/package/targets/workspace/skills/buildr/git-operations/SKILL.md +100 -0
- package/payload/product/package/targets/workspace/skills/buildr/openspec-contract-guard/SKILL.md +65 -0
- package/payload/product/package/targets/workspace/skills/buildr/project-daily-progress/SKILL.md +52 -0
- package/payload/product/package/targets/workspace/skills/buildr/project-testing/SKILL.md +84 -0
- package/payload/product/package/targets/workspace/skills/buildr/project-testing/references/testing-model-v1.md +116 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-development/SKILL.md +108 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-environment/SKILL.md +42 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-environment/agents/openai.yaml +4 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-environment/references/project-environment-preparation-v1.md +14 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-environment/templates/project-preparation.yml +20 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-environment/templates/task-environment-plan-request.json +17 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-finish/SKILL.md +80 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-manager/SKILL.md +47 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-manager/agents/openai.yaml +4 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-retrospective/SKILL.md +101 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-retrospective/agents/openai.yaml +4 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-review/SKILL.md +60 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-review/agents/openai.yaml +4 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-triage/SKILL.md +119 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-verification/SKILL.md +142 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-verification/references/project-verification-v2.md +51 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-verification/templates/project-verification.yml +16 -0
- package/payload/product/package/targets/workspace/skills/buildr/task-worktree/SKILL.md +28 -0
- package/payload/product/package/targets/workspace/skills/buildr/terminology-governance/SKILL.md +60 -0
- package/payload/product/package/targets/workspace/skills/buildr/ui-preview/SKILL.md +74 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/current-knowledge-maintenance/v1.md +36 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/current-knowledge-maintenance/v2.md +45 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/git-operations/v1.md +39 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/git-worktree-provider/v1.md +35 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-development/v2.md +61 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-environment/v1.md +37 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-finish/v1.md +59 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-record/v2.md +35 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-retrospective/v2.md +41 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-review/v1.md +39 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/task-verification/v3.md +63 -0
- package/payload/product/package/targets/workspace/skills/contracts/buildr/terminology-governance/v1.md +36 -0
- package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-apply-change/SKILL.md +4 -3
- package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-archive-change/SKILL.md +4 -3
- package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-explore/SKILL.md +4 -1
- package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-propose/SKILL.md +4 -1
- package/{package → payload/product/package}/targets/workspace/skills/openspec/openspec-sync-specs/SKILL.md +4 -3
- package/payload/product/package/targets/workspace/skills/openspec/openspec-update-change/SKILL.md +86 -0
- package/payload/product/package.json +33 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0000_create_migration_ledger.sql +16 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0001_create_task_store.sql +47 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0002_create_parent_task_relations.sql +7 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0003_inline_parent_task_column.sql +19 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0004_create_task_current_records.sql +16 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0005_create_task_retrospective_current.sql +4 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0006_create_task_lifecycle_current.sql +4 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0007_create_task_finish_current.sql +46 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0008_create_task_environment_current.sql +8 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0009_retire_task_lifecycle_current.sql +107 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0010_add_task_retrospective_disposition.sql +19 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0011_create_task_execution_records.sql +115 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0012_compact_task_finish_current.sql +261 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0013_add_todo_task_retrospective_sources.sql +56 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0014_add_task_execution_invocation_identity.sql +14 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0015_add_task_execution_unknown_outcome.sql +143 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0016_allow_terminal_task_finish_target_lease.sql +83 -0
- package/payload/product/src/infrastructure/sqlite/migrations/0017_expand_task_finish_repository_set.sql +111 -0
- package/payload/product/src/interfaces/local-app/web-dist/assets/antd-NAtxFWmu.js +394 -0
- package/payload/product/src/interfaces/local-app/web-dist/assets/index-BqoyfMSY.css +1 -0
- package/payload/product/src/interfaces/local-app/web-dist/assets/index-DTqvE0TF.js +39 -0
- package/payload/product/src/interfaces/local-app/web-dist/assets/react-9kRp7SbA.js +28 -0
- package/payload/product/src/interfaces/local-app/web-dist/index.html +19 -0
- package/payload/runtime/read-worker.cjs +45071 -0
- package/runtime/buildr.cjs +51533 -0
- package/scripts/postinstall.mjs +15 -0
- package/docs/agent-runtime-adapters.md +0 -94
- package/docs/cli-architecture.md +0 -65
- package/docs/cli-reference.md +0 -67
- package/docs/known-limitations.md +0 -15
- package/examples/minimal-workspace/README.md +0 -24
- package/package/README.md +0 -28
- package/package/manifest.yml +0 -150
- package/package/targets/runtime/skills/buildr/SKILL.md +0 -154
- package/package/targets/workspace/.buildr/workspace.yml +0 -5
- package/package/targets/workspace/commands/manifest.yml +0 -2
- package/package/targets/workspace/components/buildr/openspec/component.yml +0 -16
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-apply-sidebar.md +0 -3
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-archive-sidebar.md +0 -3
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-explore-sidebar.md +0 -3
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-propose-sidebar.md +0 -3
- package/package/targets/workspace/components/buildr/openspec/contributions/openspec-sync-sidebar.md +0 -3
- package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-post-sync.md +0 -1
- package/package/targets/workspace/components/buildr/openspec/contributions/task-finish-pre-sync.md +0 -1
- package/package/targets/workspace/components/buildr/openspec/contributions/task-triage-change-ready.md +0 -10
- package/package/targets/workspace/components/manifest.yml +0 -2
- package/package/targets/workspace/gitignore +0 -16
- package/package/targets/workspace/projects/manifest.yml +0 -2
- package/package/targets/workspace/projects/services/manifest.yml +0 -3
- package/package/targets/workspace/projects/skills/manifest.yml +0 -2
- package/package/targets/workspace/rules/buildr/core.md +0 -65
- package/package/targets/workspace/rules/manifest.yml +0 -9
- package/package/targets/workspace/skills/buildr/git-ops/SKILL.md +0 -73
- package/package/targets/workspace/skills/buildr/openspec-contract-guard/SKILL.md +0 -67
- package/package/targets/workspace/skills/buildr/task-finish/SKILL.md +0 -104
- package/package/targets/workspace/skills/buildr/task-triage/SKILL.md +0 -103
- package/package/targets/workspace/skills/buildr/task-worktree/SKILL.md +0 -104
- package/package/targets/workspace/skills/manifest.yml +0 -38
- package/tools/buildr +0 -11
- package/tools/cli/application/cli-update.mjs +0 -219
- package/tools/cli/application/compose-runtime.mjs +0 -38
- package/tools/cli/application/doctor/runtime-diagnostics.mjs +0 -227
- package/tools/cli/application/doctor/scope-diagnostics.mjs +0 -440
- package/tools/cli/application/doctor/service-diagnostics.mjs +0 -184
- package/tools/cli/application/doctor.mjs +0 -201
- package/tools/cli/application/package-maintenance/builtin-receipts.mjs +0 -73
- package/tools/cli/application/package-maintenance/output.mjs +0 -148
- package/tools/cli/application/package-maintenance/smoke-checks.mjs +0 -463
- package/tools/cli/application/package-maintenance/static-validation.mjs +0 -680
- package/tools/cli/application/package-maintenance.mjs +0 -540
- package/tools/cli/application/runtime.mjs +0 -118
- package/tools/cli/application/workspace-operations.mjs +0 -311
- package/tools/cli/bootstrap.mjs +0 -6
- package/tools/cli/command/help.mjs +0 -296
- package/tools/cli/command/registry.mjs +0 -97
- package/tools/cli/domains/commands.mjs +0 -661
- package/tools/cli/domains/components.mjs +0 -922
- package/tools/cli/domains/openspec.mjs +0 -603
- package/tools/cli/domains/package-assets.mjs +0 -652
- package/tools/cli/domains/rules.mjs +0 -380
- package/tools/cli/domains/runtime.mjs +0 -87
- package/tools/cli/domains/skills.mjs +0 -647
- package/tools/cli/domains/workspace.mjs +0 -571
- package/tools/cli/shared/infrastructure.mjs +0 -411
- package/tools/cli/shared/json-contracts.mjs +0 -22
- package/tools/cli/shared/platform.mjs +0 -52
- package/tools/runtime/adapter-contract.mjs +0 -655
- package/tools/runtime/check-claude-code.mjs +0 -23
- package/tools/runtime/check-codex.mjs +0 -23
- package/tools/runtime/check-runtime.mjs +0 -98
- package/tools/runtime/projection.mjs +0 -375
- package/tools/runtime/render-claude-code-rules.mjs +0 -459
- package/tools/runtime/render-claude-code.mjs +0 -59
- package/tools/runtime/skills/arguments.mjs +0 -51
- package/tools/runtime/skills/contributions.mjs +0 -171
- package/tools/runtime/skills/manifests.mjs +0 -167
- package/tools/runtime/skills/primitives.mjs +0 -86
- package/tools/runtime/skills/render-plan.mjs +0 -243
- package/tools/runtime/skills/sources.mjs +0 -276
- package/tools/shared/fetch-remote-text.mjs +0 -78
- package/tools/verification/integrity/managed-data-integrity.mjs +0 -107
- package/tools/verification/integrity/managed-mutations.mjs +0 -72
- package/tools/verification/openspec/contract.mjs +0 -212
- package/tools/verification/runtime/adapter-contract.mjs +0 -218
- package/tools/verification/runtime/adapter-parity.mjs +0 -173
- /package/{package → payload/product/package}/targets/workspace/AGENTS.md +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
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
|
-
- 不把“按任务组集中验证”解释为跳过最终候选完整验证。
|
|
@@ -1,104 +0,0 @@
|
|
|
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 流程。
|
|
@@ -1,38 +0,0 @@
|
|
|
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","cursor","qoder","trae","trae-work","workbuddy"]
|
|
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","cursor","qoder","trae","trae-work","workbuddy"]
|
|
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","cursor","qoder","trae","trae-work","workbuddy"]
|
|
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","cursor","qoder","trae","trae-work","workbuddy"]
|
|
38
|
-
runtimePath: git-ops
|
package/tools/buildr
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import process from 'node:process';
|
|
4
|
-
import { runCli } from './cli/bootstrap.mjs';
|
|
5
|
-
|
|
6
|
-
try {
|
|
7
|
-
runCli(process.argv);
|
|
8
|
-
} catch (error) {
|
|
9
|
-
console.error(process.env.BUILDR_DEBUG_STACK === '1' && error.stack ? error.stack : error.message);
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { fs, path, process, spawnSync } from '../shared/platform.mjs';
|
|
2
|
-
import { PUBLIC_JSON_SCHEMAS, withJsonSchema } from '../shared/json-contracts.mjs';
|
|
3
|
-
|
|
4
|
-
function run(command, args, options = {}) {
|
|
5
|
-
const result = spawnSync(command, args, { encoding: 'utf8', ...options });
|
|
6
|
-
return {
|
|
7
|
-
ok: result.status === 0,
|
|
8
|
-
status: result.status,
|
|
9
|
-
stdout: (result.stdout || '').trim(),
|
|
10
|
-
stderr: (result.stderr || '').trim(),
|
|
11
|
-
error: result.error?.message || null,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function readPackage(file) {
|
|
16
|
-
try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return null; }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function registryPrefixForProductRoot(root) {
|
|
20
|
-
const normalized = path.resolve(root);
|
|
21
|
-
const marker = process.platform === 'win32'
|
|
22
|
-
? `${path.sep}node_modules${path.sep}`
|
|
23
|
-
: `${path.sep}lib${path.sep}node_modules${path.sep}`;
|
|
24
|
-
const index = normalized.lastIndexOf(marker);
|
|
25
|
-
return index > 0 ? normalized.slice(0, index) : null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function compareVersions(left, right) {
|
|
29
|
-
const parse = (value) => String(value || '').replace(/^v/, '').split('-', 1)[0].split('.').map((part) => Number(part));
|
|
30
|
-
const a = parse(left);
|
|
31
|
-
const b = parse(right);
|
|
32
|
-
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
33
|
-
const delta = (a[index] || 0) - (b[index] || 0);
|
|
34
|
-
if (delta !== 0) return delta;
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function identifyCliSource(productRoot) {
|
|
40
|
-
const root = path.resolve(productRoot);
|
|
41
|
-
const packageFile = path.join(root, 'package.json');
|
|
42
|
-
const manifest = readPackage(packageFile);
|
|
43
|
-
const base = {
|
|
44
|
-
productRoot: root,
|
|
45
|
-
package: manifest?.name || null,
|
|
46
|
-
version: manifest?.version || null,
|
|
47
|
-
};
|
|
48
|
-
if (manifest?.name !== '@buildr-ai/buildr') {
|
|
49
|
-
return { ...base, mode: 'unknown', installPrefix: null, blockingReasons: ['当前 executable 的产品根没有声明 @buildr-ai/buildr package identity。'] };
|
|
50
|
-
}
|
|
51
|
-
const gitRoot = run('git', ['-C', root, 'rev-parse', '--show-toplevel']);
|
|
52
|
-
if (gitRoot.ok) {
|
|
53
|
-
const resolvedGitRoot = fs.realpathSync(path.resolve(gitRoot.stdout));
|
|
54
|
-
return { ...base, mode: 'development-checkout', gitRoot: resolvedGitRoot, installPrefix: null, blockingReasons: [] };
|
|
55
|
-
}
|
|
56
|
-
const installPrefix = registryPrefixForProductRoot(root);
|
|
57
|
-
if (installPrefix) {
|
|
58
|
-
return { ...base, mode: 'registry-package', installPrefix, blockingReasons: [] };
|
|
59
|
-
}
|
|
60
|
-
return { ...base, mode: 'unknown', installPrefix: null, blockingReasons: ['无法证明当前 executable 来自 Buildr Git checkout 或支持的 npm global prefix。'] };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function gitValue(root, args) {
|
|
64
|
-
const result = run('git', ['-C', root, ...args]);
|
|
65
|
-
return result.ok ? result.stdout : null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function gitUpdatePlan(source, { fetch = true } = {}) {
|
|
69
|
-
const root = source.gitRoot;
|
|
70
|
-
const blockingReasons = [];
|
|
71
|
-
const branch = gitValue(root, ['symbolic-ref', '--quiet', '--short', 'HEAD']);
|
|
72
|
-
const head = gitValue(root, ['rev-parse', 'HEAD']);
|
|
73
|
-
const upstream = gitValue(root, ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}']);
|
|
74
|
-
const dirty = Boolean(gitValue(root, ['status', '--porcelain=v1', '--untracked-files=normal']));
|
|
75
|
-
if (!branch) blockingReasons.push('当前 checkout 处于 detached HEAD。');
|
|
76
|
-
if (!upstream) blockingReasons.push('当前 branch 没有 upstream。');
|
|
77
|
-
if (dirty) blockingReasons.push('当前 checkout 存在未提交改动。');
|
|
78
|
-
let fetchResult = null;
|
|
79
|
-
if (fetch && upstream && !dirty) {
|
|
80
|
-
fetchResult = run('git', ['-C', root, 'fetch', '--quiet']);
|
|
81
|
-
if (!fetchResult.ok) blockingReasons.push(`无法 fetch 远端:${fetchResult.stderr || fetchResult.error || 'unknown error'}`);
|
|
82
|
-
}
|
|
83
|
-
let ahead = null;
|
|
84
|
-
let behind = null;
|
|
85
|
-
if (upstream && (!fetchResult || fetchResult.ok)) {
|
|
86
|
-
const counts = gitValue(root, ['rev-list', '--left-right', '--count', `HEAD...${upstream}`]);
|
|
87
|
-
if (counts) [ahead, behind] = counts.split(/\s+/).map(Number);
|
|
88
|
-
}
|
|
89
|
-
let strategy = 'none';
|
|
90
|
-
if (blockingReasons.length === 0 && ahead === 0 && behind > 0) strategy = 'fast-forward';
|
|
91
|
-
else if (blockingReasons.length === 0 && ahead > 0 && behind > 0) {
|
|
92
|
-
const remoteContainsHead = run('git', ['-C', root, 'branch', '-r', '--contains', 'HEAD']);
|
|
93
|
-
if (remoteContainsHead.ok && remoteContainsHead.stdout) blockingReasons.push('当前 HEAD 已存在于远端分支,无法证明这些提交未共享。');
|
|
94
|
-
else strategy = 'rebase';
|
|
95
|
-
}
|
|
96
|
-
const status = blockingReasons.length ? 'blocked' : strategy === 'none' ? 'up-to-date' : 'update-available';
|
|
97
|
-
return {
|
|
98
|
-
mode: source.mode,
|
|
99
|
-
current: { version: source.version, productRoot: source.productRoot, gitRoot: root, branch, head, upstream, ahead, behind, dirty },
|
|
100
|
-
available: { upstream, commitsBehind: behind },
|
|
101
|
-
status,
|
|
102
|
-
strategy,
|
|
103
|
-
blockingReasons,
|
|
104
|
-
nextActions: blockingReasons.length
|
|
105
|
-
? ['处理上述 Git 状态后重新运行 buildr update check --json。']
|
|
106
|
-
: strategy === 'none'
|
|
107
|
-
? []
|
|
108
|
-
: ['运行 buildr update 更新 Buildr CLI;成功后由 Agent 按用户意图决定是否执行 buildr sync <agent>。'],
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function registryUpdatePlan(source) {
|
|
113
|
-
const blockingReasons = [];
|
|
114
|
-
const result = run('npm', ['view', source.package, 'version', '--json']);
|
|
115
|
-
let availableVersion = null;
|
|
116
|
-
if (!result.ok) blockingReasons.push(`无法查询 npm registry:${result.stderr || result.error || 'unknown error'}`);
|
|
117
|
-
else {
|
|
118
|
-
try { availableVersion = JSON.parse(result.stdout); } catch { blockingReasons.push('npm registry 返回了无法解析的版本。'); }
|
|
119
|
-
}
|
|
120
|
-
const updateAvailable = availableVersion && compareVersions(availableVersion, source.version) > 0;
|
|
121
|
-
return {
|
|
122
|
-
mode: source.mode,
|
|
123
|
-
current: { package: source.package, version: source.version, productRoot: source.productRoot, installPrefix: source.installPrefix },
|
|
124
|
-
available: { version: availableVersion },
|
|
125
|
-
status: blockingReasons.length ? 'blocked' : updateAvailable ? 'update-available' : 'up-to-date',
|
|
126
|
-
strategy: updateAvailable ? 'npm-install' : 'none',
|
|
127
|
-
blockingReasons,
|
|
128
|
-
nextActions: blockingReasons.length
|
|
129
|
-
? ['检查当前 npm registry、网络和安装 prefix 后重试。']
|
|
130
|
-
: updateAvailable
|
|
131
|
-
? ['运行 buildr update 更新 Buildr CLI;成功后由 Agent 按用户意图决定是否执行 buildr sync <agent>。']
|
|
132
|
-
: [],
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function buildCliUpdatePlan(productRoot, options = {}) {
|
|
137
|
-
const source = identifyCliSource(productRoot);
|
|
138
|
-
if (source.mode === 'development-checkout') return gitUpdatePlan(source, options);
|
|
139
|
-
if (source.mode === 'registry-package') return registryUpdatePlan(source);
|
|
140
|
-
return {
|
|
141
|
-
mode: 'unknown',
|
|
142
|
-
current: { package: source.package, version: source.version, productRoot: source.productRoot },
|
|
143
|
-
available: null,
|
|
144
|
-
status: 'blocked',
|
|
145
|
-
strategy: 'none',
|
|
146
|
-
blockingReasons: source.blockingReasons,
|
|
147
|
-
nextActions: ['使用 Buildr 开发 checkout 安装脚本或受支持的 npm registry package 重新安装 CLI。'],
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function executeCliUpdatePlan(plan, options = {}) {
|
|
152
|
-
if (plan.status !== 'update-available') return { ok: plan.status === 'up-to-date', status: plan.status === 'up-to-date' ? 0 : 1, stdout: '', stderr: '', error: null };
|
|
153
|
-
return plan.mode === 'development-checkout'
|
|
154
|
-
? run('git', ['-C', plan.current.gitRoot, plan.strategy === 'fast-forward' ? 'merge' : 'rebase', ...(plan.strategy === 'fast-forward' ? ['--ff-only'] : []), plan.current.upstream], options)
|
|
155
|
-
: run(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['install', '--global', '--prefix', plan.current.installPrefix, `${plan.current.package}@${plan.available.version}`], {
|
|
156
|
-
...options,
|
|
157
|
-
shell: process.platform === 'win32',
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function printPlan(plan, label) {
|
|
162
|
-
console.log(`${label}: ${plan.status}`);
|
|
163
|
-
console.log(`mode: ${plan.mode}`);
|
|
164
|
-
if (plan.current?.version) console.log(`current: ${plan.current.version}`);
|
|
165
|
-
if (plan.available?.version) console.log(`available: ${plan.available.version}`);
|
|
166
|
-
if (plan.current?.branch) console.log(`branch: ${plan.current.branch}`);
|
|
167
|
-
if (plan.current?.upstream) console.log(`upstream: ${plan.current.upstream}`);
|
|
168
|
-
for (const reason of plan.blockingReasons) console.log(`blocked: ${reason}`);
|
|
169
|
-
for (const action of plan.nextActions) console.log(`next: ${action}`);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function registerApplicationCliUpdate(runtime) {
|
|
173
|
-
const productRoot = (...args) => runtime.productRoot(...args);
|
|
174
|
-
const assertNoUnknownOptions = (...args) => runtime.assertNoUnknownOptions(...args);
|
|
175
|
-
const hasFlag = (...args) => runtime.hasFlag(...args);
|
|
176
|
-
|
|
177
|
-
function updateCheck(args) {
|
|
178
|
-
if (args.includes('--target')) throw new Error('buildr update 不接收 workspace --target;请使用 buildr sync <agent> --target <dir> 同步 workspace。');
|
|
179
|
-
assertNoUnknownOptions(args, new Set(['--json']));
|
|
180
|
-
const plan = buildCliUpdatePlan(productRoot());
|
|
181
|
-
if (hasFlag(args, '--json')) process.stdout.write(`${JSON.stringify(withJsonSchema(PUBLIC_JSON_SCHEMAS.updateCheck, plan), null, 2)}\n`);
|
|
182
|
-
else printPlan(plan, 'Buildr CLI update check');
|
|
183
|
-
if (plan.status === 'blocked') process.exitCode = 1;
|
|
184
|
-
return plan;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function updateBuildr(args) {
|
|
188
|
-
if (args.includes('--target')) throw new Error('buildr update 不接收 workspace --target;请使用 buildr sync <agent> --target <dir> 同步 workspace。');
|
|
189
|
-
assertNoUnknownOptions(args, new Set(['--json']));
|
|
190
|
-
const json = hasFlag(args, '--json');
|
|
191
|
-
const plan = buildCliUpdatePlan(productRoot());
|
|
192
|
-
if (plan.status === 'blocked') {
|
|
193
|
-
if (json) process.stdout.write(`${JSON.stringify(withJsonSchema(PUBLIC_JSON_SCHEMAS.update, plan), null, 2)}\n`);
|
|
194
|
-
else printPlan(plan, 'Buildr CLI update');
|
|
195
|
-
process.exitCode = 1;
|
|
196
|
-
return plan;
|
|
197
|
-
}
|
|
198
|
-
if (plan.status === 'up-to-date') {
|
|
199
|
-
if (json) process.stdout.write(`${JSON.stringify(withJsonSchema(PUBLIC_JSON_SCHEMAS.update, plan), null, 2)}\n`);
|
|
200
|
-
else printPlan(plan, 'Buildr CLI update');
|
|
201
|
-
return plan;
|
|
202
|
-
}
|
|
203
|
-
const result = executeCliUpdatePlan(plan);
|
|
204
|
-
if (!result.ok) {
|
|
205
|
-
const failed = { ...plan, status: 'blocked', blockingReasons: [`CLI 更新失败:${result.stderr || result.error || 'unknown error'}`], nextActions: plan.mode === 'development-checkout' && plan.strategy === 'rebase' ? ['检查 Git rebase 状态并决定继续或中止;Buildr 不会自动解决冲突。'] : ['处理安装错误后重新运行 buildr update。'] };
|
|
206
|
-
if (json) process.stdout.write(`${JSON.stringify(withJsonSchema(PUBLIC_JSON_SCHEMAS.update, failed), null, 2)}\n`);
|
|
207
|
-
else printPlan(failed, 'Buildr CLI update');
|
|
208
|
-
process.exitCode = 1;
|
|
209
|
-
return failed;
|
|
210
|
-
}
|
|
211
|
-
const completed = { ...plan, status: 'updated', blockingReasons: [], nextActions: ['CLI 已更新。若用户要求完整更新 Buildr,重新解析 buildr 入口并运行 buildr sync <agent> --target <workspace>。'] };
|
|
212
|
-
if (json) process.stdout.write(`${JSON.stringify(withJsonSchema(PUBLIC_JSON_SCHEMAS.update, completed), null, 2)}\n`);
|
|
213
|
-
else printPlan(completed, 'Buildr CLI update');
|
|
214
|
-
return completed;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
Object.assign(runtime, { updateCheck, updateBuildr });
|
|
218
|
-
return runtime;
|
|
219
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { registerSharedInfrastructure } from '../shared/infrastructure.mjs';
|
|
2
|
-
import { registerDomainsRuntime } from '../domains/runtime.mjs';
|
|
3
|
-
import { registerDomainsWorkspace } from '../domains/workspace.mjs';
|
|
4
|
-
import { registerDomainsComponents } from '../domains/components.mjs';
|
|
5
|
-
import { registerDomainsCommands } from '../domains/commands.mjs';
|
|
6
|
-
import { registerDomainsRules } from '../domains/rules.mjs';
|
|
7
|
-
import { registerDomainsOpenspec } from '../domains/openspec.mjs';
|
|
8
|
-
import { registerApplicationDoctor } from '../application/doctor.mjs';
|
|
9
|
-
import { registerDomainsPackageAssets } from '../domains/package-assets.mjs';
|
|
10
|
-
import { registerDomainsSkills } from '../domains/skills.mjs';
|
|
11
|
-
import { registerApplicationPackageMaintenance } from '../application/package-maintenance.mjs';
|
|
12
|
-
import { registerApplicationWorkspaceOperations } from '../application/workspace-operations.mjs';
|
|
13
|
-
import { registerApplicationRuntime } from '../application/runtime.mjs';
|
|
14
|
-
import { registerApplicationCliUpdate } from '../application/cli-update.mjs';
|
|
15
|
-
import * as platform from '../shared/platform.mjs';
|
|
16
|
-
|
|
17
|
-
const REGISTRATIONS = [
|
|
18
|
-
registerSharedInfrastructure,
|
|
19
|
-
registerDomainsRuntime,
|
|
20
|
-
registerDomainsWorkspace,
|
|
21
|
-
registerDomainsComponents,
|
|
22
|
-
registerDomainsCommands,
|
|
23
|
-
registerDomainsRules,
|
|
24
|
-
registerDomainsOpenspec,
|
|
25
|
-
registerApplicationDoctor,
|
|
26
|
-
registerDomainsPackageAssets,
|
|
27
|
-
registerDomainsSkills,
|
|
28
|
-
registerApplicationPackageMaintenance,
|
|
29
|
-
registerApplicationWorkspaceOperations,
|
|
30
|
-
registerApplicationCliUpdate,
|
|
31
|
-
registerApplicationRuntime,
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
export function createRuntime() {
|
|
35
|
-
const runtime = { ...platform };
|
|
36
|
-
for (const register of REGISTRATIONS) register(runtime);
|
|
37
|
-
return runtime;
|
|
38
|
-
}
|