reasonweave 1.4.4 → 1.4.5

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/INSTALL.md CHANGED
@@ -14,8 +14,8 @@
14
14
  | **spec-guard / drift-gate** | **v2.2.1** | 架构规约与物理接线守卫(ADR-064 机器信任根验签、三维热力表、约定阈值解耦、增量感知门禁、支持 `--version` / `-v` 动态对齐) |
15
15
  | **preflight** | **v1.1.0** | 仓库不变量探针(A1~A5 配置化对账防漂移、工程落地指引) |
16
16
  | **orphan** | **v1.4.2** | 全局死代码与孤儿资产清道夫(ADR-0009 / ADR-0011 / ADR-0013):S1–S3 求解器、L1/L2/L3 正交解耦、新增 `check-deps [--strict]` 孤儿依赖求解器与 `scan-secrets [--strict]` 零调用假凭证探针、支持 `--version` / `-v` 动态对齐 |
17
- | **worktree** | v0.1.0 | 多 Agent 物理工作树隔离调度(动态对齐 `VERSION.md`,支持 `--version`) |
18
- | **review-gate** | **v1.2.2** | SAST + 双盲审计独立重跑器(ADR-0011 / ADR-0012 / ADR-0013):`scan.sh --no-suppress` 穿透扫描、OpenGrep 原生模式对称注入 `engine: "opengrep"` 结构化元数据、Ruff Bandit 诚实降级、macOS bash 3.2 兼容自愈 |
17
+ | **worktree** | v0.1.1 | 多 Agent 物理工作树隔离调度(动态对齐 `VERSION.md`,支持 `--version`) |
18
+ | **review-gate** | **v1.2.3** | SAST + 双盲审计独立重跑器(ADR-0011 / ADR-0012 / ADR-0013):`scan.sh --no-suppress` 穿透扫描、OpenGrep 原生模式对称注入 `engine: "opengrep"` 结构化元数据、Ruff Bandit 诚实降级、macOS bash 3.2 兼容自愈 |
19
19
  | **specs / playbook** | — | Spec Kit 活文档模板全集 (`specs/templates/` 01-research 到 05-evidence) 与 RePPIT 五步工程闭环手册 |
20
20
  | **adr / backlog** | v1.0.1 / v1.2.0 | 架构决策记录 (ADR-0011 ~ ADR-0014 🔒Frozen)、待办捕获跟踪 (Backlog 12 ~ 15) |
21
21
 
@@ -69,10 +69,10 @@ npm link
69
69
 
70
70
  | CLI | 作用 |
71
71
  |---|---|
72
- | `reasonweave`(别名 `lab`, `rw`) | 能力库总管、`lab init` 全套一键初始化、路径动态解析、环境体检 (`lab doctor`)、ZSpec 脚手架、下游一键批量同步分发 (`sync-consumers`)、全量转发核心工具 (v1.4.4,支持 `--version`) |
72
+ | `reasonweave`(别名 `lab`, `rw`) | 能力库总管、`lab init` 全套一键初始化、路径动态解析、环境体检 (`lab doctor`)、ZSpec 脚手架、下游一键批量同步分发 (`sync-consumers`)、全量转发核心工具 (v1.4.5,支持 `--version`) |
73
73
  | `baton`(别名 `agent-baton` / `handoff`) | 跨仓 / 仓内任务交割中枢、统一会话ID、防跨会话硬门禁、会话锁、密码学防伪回执、事件驱动唤醒(v2.41.2) |
74
- | `baton-worktree` | 为工单分配 / 回收独立物理工作树(v0.1.0,支持 `--version`) |
75
- | `baton-audit-runner` | 无上下文独立进程重跑验收测试,真实 Exit 0 方可签发回执(v1.2.2,支持 `--version`) |
74
+ | `baton-worktree` | 为工单分配 / 回收独立物理工作树(v0.1.1,支持 `--version`) |
75
+ | `baton-audit-runner` | 无上下文独立进程重跑验收测试,真实 Exit 0 方可签发回执(v1.2.3,支持 `--version`) |
76
76
  | `lab-orphan` | 死代码与孤儿资产清道夫(v1.4.2,支持 `--version`,也可 `lab orphan <cmd>`) |
77
77
  | `spec-guard`(别名 `drift-gate`) | 架构规约与物理接线守卫、ADR 机器信任根验签、三维热力表(v2.2.1,支持 `--version`) |
78
78
  | `lab-skills`(别名 `skills`) | 微观工程原子技能库与上下文零污染切片引擎(v0.1.0,支持 `--version`,也可 `lab skills <cmd>`) |
package/README.md CHANGED
@@ -160,7 +160,7 @@ adr-init <目标目录> <档位: light|standard|frozen> "<项目名>"
160
160
  | **orphan** | [`units/orphan/`](units/orphan/) | 死代码与孤儿资产清道夫、反假接线三层正交治理(v1.4.2,ADR-0009 / ADR-0011),只读 Git HEAD + S1–S3 求解器 + L1/L2/L3 规范、`check-deps [--strict]` 孤儿依赖分析、`scan-secrets [--strict]` 假凭证探针 |
161
161
  | **backlog** | [`units/backlog/`](units/backlog/) | 待办捕获:越界 / 待拍板 / 未来功能,一任务一文件,不打断当前工作流 |
162
162
  | **preflight** | [`units/preflight/`](units/preflight/) | 仓库不变量探针 + Git 提交门禁(v1.1.0),A1~A5 探针(含配置化单一事实源与派生状态防漂移对账),防止“做完才发现还有一件事” |
163
- | **review-gate** | [`units/review-gate/`](units/review-gate/) | 本地 SAST 扫描 (OpenGrep) + review 门禁 + 双盲审计自动化重跑器 (`baton-audit-runner`),v1.2.2 新增 `--no-suppress` 穿透扫描、Ruff Bandit 诚实降级结构化 JSON 标记与 macOS bash 3.2 兼容自愈、顶层同构 engine 元数据 |
163
+ | **review-gate** | [`units/review-gate/`](units/review-gate/) | 本地 SAST 扫描 (OpenGrep) + review 门禁 + 双盲审计自动化重跑器 (`baton-audit-runner`),v1.2.3 新增 `--no-suppress` 穿透扫描、Ruff Bandit 诚实降级结构化 JSON 标记与 macOS bash 3.2 兼容自愈、顶层同构 engine 元数据 |
164
164
  | **handoffs** | [`units/handoffs/`](units/handoffs/) | 跨仓 / 同仓任务交割中枢(Agent Baton v2.41.2),统一会话ID、防跨会话硬门禁、会话身份锁、跨客户端角色锚定与状态机归属确定性、自主双盲审计分诊协议、避免角色漂移、纯化入站单行裁决提示词、Rule 8 分级 SDD 验收与负向测试先行证明、`--profile readonly` 生产源码写保护物理硬门禁、密码学审计凭据签章、出站防注入提示词、无条件下车、五态状态机与事件唤醒 |
165
165
  | **worktree** | [`units/worktree/`](units/worktree/) | 基于 Git Worktree 的物理目录隔离调度引擎,为多 Agent 并发分配独立沙盒并智能共享依赖缓存 |
166
166
  | **skills** | [`units/skills/`](units/skills/) | 微观工程原子技能库与分发引擎(v0.1.0,ADR-0015),官方沉淀 TDD、系统化调试、先验后报、需求澄清 4 大原子技能,带 Iron Law 与借口阻断表,提供 `task-brief` 与 `review-package` 零污染切片流水线 |
@@ -16,6 +16,7 @@
16
16
  8. [场景七:消费方接入或升级 orphan v1.4.2 反假接线三层治理与 AGENTS/GEMINI 极简路由](#场景七消费方接入或升级-orphan-v142-反假接线三层治理与-agentsgemini-极简路由)
17
17
  9. [场景八:消费方基于 ReasonWeave v1.3.2 新架构全面排查、整改与优化(Vibe Security 穿透防线 + 依赖瘦身 + SDD/RePPIT 落地)](#场景八消费方基于-reasonweave-v132-新架构全面排查整改与优化vibe-security-穿透防线--依赖瘦身--sddreppit-落地)
18
18
  10. [场景九:极简触发自主多维双盲审计(Zero-Cognitive Double-Blind Audit · v2.40.0)](#场景九极简触发自主多维双盲审计zero-cognitive-double-blind-audit--v2400)
19
+ 11. [场景十:消费方接入 AEF 2.0 研发纪律、三态裁决与标准作业程序 (SOP)](#场景十消费方接入-aef-20-研发纪律三态裁决与标准作业程序-sop)
19
20
 
20
21
  ---
21
22
 
@@ -498,4 +499,50 @@ baton install && baton link --check && lab doctor && baton check
498
499
  - 默认(95% 场景):开立 **1 份「自适应多维矩阵工单」**,作为后台任务运行 `baton forward <id> --blind --wait`(自动脱敏思考与自辩,挂起秒级监听);
499
500
  - 回复末尾**仅输出唯一一张独立的标准交接提示词卡片**,严禁将多份工单或多个卡片堆叠在同一个代码块内!
500
501
 
502
+ ---
503
+
504
+ ### 场景十:消费方接入 AEF 2.0 研发纪律、三态裁决与标准作业程序 (SOP)
505
+
506
+ > 📋 **适用场景**:消费方项目升级至 ReasonWeave v1.4.4 / AEF 2.0,接入三态裁决体系 (GO / NO-GO / BLOCKED)、免责受阻挂起呈报与工业级 SOP 执行流。彻底终结环境限制(如 socketpair E_ACCESSDENIED)下的越界 reject 拦截与认知死锁。
507
+ > 📋 **使用方式**:复制以下内容发送给消费方项目的 AI Agent 会话:
508
+
509
+ ```markdown
510
+ 请按 ReasonWeave AEF 2.0 工业级标准为本项目对齐研发纪律与标准作业程序 (SOP)。
511
+
512
+ ### 核心升级背景与纪律要点(不可违背):
513
+ 1. **三态裁决体系 (GO / NO-GO / BLOCKED · ADR-0017 / 宪法 T8)**:
514
+ - 严禁二元思维:当遭遇宿主容器沙箱权限硬拦截(如 `socketpair E_ACCESSDENIED`)、外部依赖缺失或基础设施不可用等不可抗力(`E_ENV`)时:
515
+ - **普通实现方(`impl`/`worker`)专享交付权,严禁越界调用 `baton reject`**(会被 CLI 越界拦截);
516
+ - **严禁伪造 PASS 交付,亦严禁静默挂起或失踪**;
517
+ - 必须在 15 分钟内提交客观受阻回执:`baton receipt <ID> -n "## 状态 / 结论\n- **结论**:BLOCKED\n- **阻断类型**:E_ENV\n- **根因分析**:..." --evidence-note "环境阻断日志"`,解除死锁并移交发起方协调。
518
+ 2. **标准作业程序流水线 (docs/sop/)**:
519
+ - 日常作业优先查阅并执行 SOP,严禁凭主观臆想操作:
520
+ - 全仓与业务仓接入:参考 `$(lab path playbook)/docs/sop/01-installation-and-onboarding-sop.md`
521
+ - 日常工程协同与三态流转:参考 `$(lab path playbook)/docs/sop/02-day-to-day-engineering-sop.md`
522
+ - 跨端流转与双盲审计:参考 `$(lab path playbook)/docs/sop/03-handoffs-and-audit-sop.md`
523
+ - 提交前反未接线与孤儿治理:参考 `$(lab path playbook)/docs/sop/04-anti-orphan-governance-sop.md`
524
+ 3. **单行裁决收尾铁律 (宪法 T4 / ADR-0016)**:
525
+ - 接收方/审计方在回复人类时,末尾仅输出单行纯文本(无需标题,无需代码块,严禁反向输出出站交接卡片):
526
+ - 交付通过:`交付完成,回执已就绪`(或 `审计完成,裁决 GO`)
527
+ - 驳回退回:`审计完成,裁决 NO-GO(工单已退回<发起方角色>进入 Round <N>)`
528
+
529
+ ### 本次排查与就绪执行动作:
530
+ 1. **核验接入桩版本**:
531
+ ```bash
532
+ baton doctor
533
+ ```
534
+ 确保输出 `桩版本 == 引擎版本`。
535
+ 2. **合规体检与历史漂移自愈**:
536
+ ```bash
537
+ baton check --fix
538
+ ```
539
+ 对历史工单的 needs_change 漂移与状态流水进行原子对齐。
540
+ 3. **验证提交前增量接线门禁**:
541
+ ```bash
542
+ lab-orphan check-diff --staged
543
+ ```
544
+ 4. **输出确认报告**:汇报接入桩版本、体检自愈结果以及已遵照 AEF 2.0 三态裁决(GO/NO-GO/BLOCKED)就绪。
545
+ ```
546
+
547
+
501
548
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reasonweave",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Agent Engineering Framework (AEF) & Disciplines Toolkit for multi-agent software engineering",
5
5
  "type": "module",
6
6
  "main": "bin/lab.mjs",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "scripts": {
34
34
  "sync:consumers": "node scripts/sync-all-consumers.mjs",
35
- "test": "node bin/lab.mjs doctor && node units/handoffs/handoff.mjs status && node units/worktree/worktree.mjs --help && node units/review-gate/clean-runner.mjs --help && node units/orphan/bin/lab-orphan.mjs test-solver && node --test units/orphan/tests/*.test.mjs && node --test units/spec-guard/tests/*.test.mjs && node --test units/handoffs/tests/*.test.mjs && node --test units/review-gate/tests/*.test.mjs && node --test units/skills/tests/*.test.mjs && node --test tests/*.test.mjs",
35
+ "test": "node bin/lab.mjs doctor && node units/handoffs/handoff.mjs status && node units/worktree/worktree.mjs --help && node units/review-gate/clean-runner.mjs --help && node units/orphan/bin/lab-orphan.mjs test-solver && node --test units/orphan/tests/*.test.mjs && node --test units/spec-guard/tests/*.test.mjs && node --test units/handoffs/tests/*.test.mjs && node --test units/review-gate/tests/*.test.mjs && node --test units/worktree/tests/*.test.mjs && node --test units/skills/tests/*.test.mjs && node --test tests/*.test.mjs",
36
36
  "postinstall": "chmod +x bin/lab.mjs units/handoffs/handoff.mjs units/worktree/worktree.mjs units/review-gate/clean-runner.mjs units/orphan/bin/lab-orphan.mjs units/spec-guard/bin/spec-guard.mjs units/skills/skills.mjs units/skills/bin/*.mjs units/adr/scripts/adr-init.sh units/preflight/templates/preflight.sh units/preflight/templates/check.sh units/review-gate/templates/scan.sh scripts/sync-all-consumers.mjs 2>/dev/null || true"
37
37
  },
38
38
  "files": [
@@ -157,6 +157,7 @@ function getSessionId() {
157
157
  process.env.CURSOR_CONVERSATION_ID ||
158
158
  process.env.CLAUDE_CONVERSATION_ID ||
159
159
  process.env.CLAUDE_SESSION_ID ||
160
+ process.env.CODEX_SESSION_ID ||
160
161
  process.env.WORKBUDDY_CONVERSATION_ID ||
161
162
  process.env.WORKBUDDY_SESSION_ID ||
162
163
  process.env.CODEBUDDY_CONVERSATION_ID ||
@@ -301,6 +301,7 @@ function isAgentEnvironment() {
301
301
  process.env.BATON_AGENT_HOST ||
302
302
  process.env.CLAUDE_CODE ||
303
303
  process.env.CLAUDE_SESSION_ID ||
304
+ process.env.CODEX_SESSION_ID ||
304
305
  process.env.CURSOR_AGENT ||
305
306
  process.env.WORKBUDDY_AGENT ||
306
307
  process.env.WORKBUDDY_SESSION_ID ||
@@ -974,6 +975,7 @@ const KNOWN_SESSION_ENV_KEYS = [
974
975
  'CURSOR_CONVERSATION_ID',
975
976
  'CLAUDE_CONVERSATION_ID',
976
977
  'CLAUDE_SESSION_ID',
978
+ 'CODEX_SESSION_ID',
977
979
  'WORKBUDDY_CONVERSATION_ID',
978
980
  'WORKBUDDY_SESSION_ID',
979
981
  'CODEBUDDY_CONVERSATION_ID',
@@ -5607,7 +5609,7 @@ async function cmdWait(args) {
5607
5609
 
5608
5610
  // 平息完成后:对自愈候选工单安全落盘推进为 delivered
5609
5611
  promoteAutoDeliverCandidates();
5610
- console.log(`🎉 [会话已平息] 执行方会话已彻底结束,正式唤醒发起方!`);
5612
+ console.log(`🎉 [会话已平息] 执行方会话已平息,监听进程结束并以 Exit 0 唤醒宿主发起方!`);
5611
5613
  }
5612
5614
 
5613
5615
  cleanupAll();
@@ -1,5 +1,10 @@
1
1
  # Changelog — review-gate
2
2
 
3
+ ## v1.2.3 (2026-11-27)
4
+ - **Ruff 降级结果解析与门禁拦截漏洞彻底根治**:重构 `pre-commit` 门禁与 `scan.sh`,支持准确解析 Ruff 输出的 JSON 数组结构并归一化转换为基线比对模型,杜绝因 `dict.get` 在列表上抛错被捕获而静默放行 Python 安全漏洞的问题。
5
+ - **真实暂存区(Git Index Blob)快照扫描**:门禁扫描不再直接读取可能已被修改的工作区物理文件,改为通过 `git show :<staged_path>` 将待提交快照还原至独立沙箱目录进行扫描,彻底解决部分暂存误报或工作区未重新暂存导致的漏洞漏检。
6
+ - **双盲审计运行器(Clean Runner)多行判据块保持**:修复验收判据代码块按换行逐行切割导致 `cd` 上下文丢失、多行语句断裂的问题,完整保持脚本块原子执行。
7
+
3
8
  ## v1.2.2 (2026-11-22)
4
9
  - **文档与审查防线增强(Layer-2 code-review-graph 集成指引)**:在 `README.md` §6 Layer-2 本地审查中明确补充与 `code-review-graph` 的协同工作模式,推荐在 Review 前运行 `code-review-graph impact` 提取爆炸半径精准切片。
5
10
  - **OpenGrep 原生扫描产物补齐结构化引擎元数据**:修复 `scan.sh` 在 OpenGrep 原生扫描路径下输出 JSON 缺少顶层 `engine: "opengrep"` 与 `fallback: false` 字段的问题,实现与降级扫描模式对齐的对称契约。
@@ -1,3 +1,3 @@
1
1
  # review-gate 版本
2
2
 
3
- v1.2.2 — 2026-11-22
3
+ v1.2.3 — 2026-11-27
@@ -16,12 +16,12 @@ const REVIEW_GATE_VERSION = (() => {
16
16
  try {
17
17
  const vPath = path.join(SCRIPT_ROOT, 'VERSION.md');
18
18
  if (fs.existsSync(vPath)) {
19
- const line = fs.readFileSync(vPath, 'utf8').trim().split('\n')[0];
20
- const m = line.match(/v?(\d+\.\d+\.\d+)/);
19
+ const content = fs.readFileSync(vPath, 'utf8');
20
+ const m = content.match(/v?(\d+\.\d+\.\d+)/);
21
21
  if (m) return m[1];
22
22
  }
23
23
  } catch {}
24
- return '1.2.2';
24
+ return '1.2.3';
25
25
  })();
26
26
 
27
27
  const args = process.argv.slice(2);
@@ -91,11 +91,11 @@ function extractCommandsFromTicket(content) {
91
91
  const codeBlockRegex = /```(?:bash|sh|zsh)?\n([\s\S]*?)```/g;
92
92
  let match;
93
93
  while ((match = codeBlockRegex.exec(sectionBody)) !== null) {
94
- const lines = match[1]
95
- .split('\n')
96
- .map((l) => l.trim())
97
- .filter((l) => l && !l.startsWith('#'));
98
- commands.push(...lines);
94
+ const block = match[1].trim();
95
+ if (block) {
96
+ // 保持代码块作为一个完整的 Shell 脚本块执行,避免逐行拆分导致 cd、变量与上下文断裂
97
+ commands.push(block);
98
+ }
99
99
  }
100
100
  }
101
101
  return commands;
@@ -199,29 +199,33 @@ function runAudit(ticketId, options = {}) {
199
199
  process.exit(1);
200
200
  }
201
201
 
202
- console.log(`\n🛡️ [Clean Audit Runner] 启动无上下文双盲审计执行:`);
203
- console.log(` • 工单 ID: \x1b[36m${cleanId}\x1b[0m`);
204
- console.log(` • 执行物理目录: \x1b[32m${targetDir}\x1b[0m ${isWorktree ? '(隔离工作树)' : '(主代码库)'}`);
205
- console.log(` • 待执行校验项 (${commands.length} 项):`);
206
- commands.forEach((c, idx) => console.log(` ${idx + 1}. \x1b[33m${c}\x1b[0m`));
207
- console.log('─'.repeat(70));
202
+ if (!options.json) {
203
+ console.log(`\n🛡️ [Clean Audit Runner] 启动无上下文双盲审计执行:`);
204
+ console.log(` • 工单 ID: \x1b[36m${cleanId}\x1b[0m`);
205
+ console.log(` • 执行物理目录: \x1b[32m${targetDir}\x1b[0m ${isWorktree ? '(隔离工作树)' : '(主代码库)'}`);
206
+ console.log(` • 待执行校验项 (${commands.length} 项):`);
207
+ commands.forEach((c, idx) => console.log(` ${idx + 1}. \x1b[33m${c}\x1b[0m`));
208
+ console.log('─'.repeat(70));
209
+ }
208
210
 
209
211
  const results = [];
210
212
  let allPassed = true;
211
213
 
212
214
  for (const cmd of commands) {
213
- process.stdout.write(`⏳ 正在执行: ${cmd} ... `);
215
+ if (!options.json) process.stdout.write(`⏳ 正在执行: ${cmd} ... `);
214
216
  const execRes = executeClean(cmd, targetDir);
215
217
  results.push(execRes);
216
218
 
217
219
  if (execRes.exitCode === 0) {
218
- console.log(`\x1b[32mPASS\x1b[0m (${(execRes.durationMs / 1000).toFixed(2)}s)`);
220
+ if (!options.json) console.log(`\x1b[32mPASS\x1b[0m (${(execRes.durationMs / 1000).toFixed(2)}s)`);
219
221
  } else {
220
- console.log(`\x1b[31mFAIL (Exit ${execRes.exitCode})\x1b[0m (${(execRes.durationMs / 1000).toFixed(2)}s)`);
222
+ if (!options.json) {
223
+ console.log(`\x1b[31mFAIL (Exit ${execRes.exitCode})\x1b[0m (${(execRes.durationMs / 1000).toFixed(2)}s)`);
224
+ console.error('\n' + '─'.repeat(40) + ' [错误输出摘要] ' + '─'.repeat(40));
225
+ console.error(execRes.stderr.trim() || execRes.stdout.trim() || '(无标准输出)');
226
+ console.error('─'.repeat(96) + '\n');
227
+ }
221
228
  allPassed = false;
222
- console.error('\n' + '─'.repeat(40) + ' [错误输出摘要] ' + '─'.repeat(40));
223
- console.error(execRes.stderr.trim() || execRes.stdout.trim() || '(无标准输出)');
224
- console.error('─'.repeat(96) + '\n');
225
229
  break;
226
230
  }
227
231
  }
@@ -17,9 +17,15 @@ set -uo pipefail
17
17
 
18
18
  # 非交互 hook 可能没把 ~/.local/bin 放进 PATH
19
19
  export PATH="$HOME/.local/bin:$PATH"
20
- OG="${OPENGREP_BIN:-$HOME/.local/bin/opengrep}"
21
- if ! [ -x "$OG" ] && ! command -v "$OG" >/dev/null 2>&1; then
22
- OG=$(command -v opengrep || true)
20
+ OG="${OPENGREP_BIN:-__AUTO__}"
21
+ if [ "$OG" = "__AUTO__" ]; then
22
+ if [ -x "$HOME/.local/bin/opengrep" ]; then
23
+ OG="$HOME/.local/bin/opengrep"
24
+ else
25
+ OG=$(command -v opengrep || true)
26
+ fi
27
+ elif [ -n "$OG" ] && { [ ! -x "$OG" ] && ! command -v "$OG" >/dev/null 2>&1; }; then
28
+ OG=""
23
29
  fi
24
30
 
25
31
  USE_RUFF_FALLBACK=0
@@ -48,22 +54,33 @@ SCAN_EXTS="${SCAN_EXTS:-py kt kts java rs ts tsx go xml gradle toml}"
48
54
  EXT_RE="\.(${SCAN_EXTS// /|})$"
49
55
 
50
56
  # 只扫本次提交真正要落库的暂存代码文件
51
- FILES=()
57
+ STAGED_FILES=()
52
58
  while IFS= read -r f; do
53
- [ -n "$f" ] && FILES+=("$f")
59
+ [ -n "$f" ] && STAGED_FILES+=("$f")
54
60
  done < <(git -C "$REPO_ROOT" diff --cached --name-only --diff-filter=ACM | grep -E "$EXT_RE" || true)
55
61
 
62
+ if [ ${#STAGED_FILES[@]} -eq 0 ]; then
63
+ exit 0
64
+ fi
65
+
66
+ # 从 Git Index 中将暂存内容安全还原至独立临时目录进行扫描,确保真实扫描暂存快照
67
+ STAGED_DIR=$(mktemp -d /tmp/og-staged-XXXXXX)
68
+ TMP=$(mktemp /tmp/og-precommit-XXXXXX.json)
69
+ trap 'rm -rf "$STAGED_DIR" "$TMP"' EXIT
70
+
56
71
  EXISTING=()
57
- for f in "${FILES[@]:-}"; do
58
- [ -f "$REPO_ROOT/$f" ] && EXISTING+=("$REPO_ROOT/$f")
72
+ for f in "${STAGED_FILES[@]}"; do
73
+ dest="$STAGED_DIR/$f"
74
+ mkdir -p "$(dirname "$dest")"
75
+ if git -C "$REPO_ROOT" show ":$f" > "$dest" 2>/dev/null; then
76
+ EXISTING+=("$dest")
77
+ fi
59
78
  done
79
+
60
80
  if [ ${#EXISTING[@]} -eq 0 ]; then
61
81
  exit 0
62
82
  fi
63
83
 
64
- TMP=$(mktemp /tmp/og-precommit-XXXXXX.json)
65
- trap 'rm -f "$TMP"' EXIT
66
-
67
84
  cd "$REPO_ROOT"
68
85
 
69
86
  # 规则集 / 排除项与 scan.sh 同语义(按需用环境变量覆盖)
@@ -79,13 +96,14 @@ EXCLUDE_RULES=(
79
96
  )
80
97
  EXCLUDES=$(printf -- '--exclude-rule %s ' ${EXCLUDE_RULES[@]+"${EXCLUDE_RULES[@]}"})
81
98
 
99
+ SCAN_EXIT=0
82
100
  if [ "$USE_RUFF_FALLBACK" = "1" ]; then
83
101
  echo "🔍 Ruff Bandit fallback gate: scanning ${#EXISTING[@]} staged file(s)..."
84
- "$RUFF" check --select S --output-format json "${EXISTING[@]}" > "$TMP" 2>/dev/null || true
102
+ "$RUFF" check --select S --output-format json "${EXISTING[@]}" > "$TMP" 2>/dev/null || SCAN_EXIT=$?
85
103
  else
86
104
  echo "🔍 OpenGrep gate: scanning ${#EXISTING[@]} staged file(s)..."
87
105
  "$OG" scan ${CONFIG_ARGS[@]+"${CONFIG_ARGS[@]}"} --disable-version-check --timeout 60 ${EXCLUDES} \
88
- --json --output "$TMP" "${EXISTING[@]}" >/dev/null 2>&1 || true
106
+ --json --output "$TMP" "${EXISTING[@]}" >/dev/null 2>&1 || SCAN_EXIT=$?
89
107
  fi
90
108
 
91
109
  PY=$(command -v python3 || command -v python || true)
@@ -94,37 +112,69 @@ if [ -z "$PY" ]; then
94
112
  exit 0
95
113
  fi
96
114
 
97
- "$PY" - "$TMP" "$BASELINE" "$REPO_ROOT" <<'PYEOF'
98
- import json, sys
115
+ "$PY" - "$TMP" "$BASELINE" "$STAGED_DIR" "$USE_RUFF_FALLBACK" "$SCAN_EXIT" <<'PYEOF'
116
+ import json, sys, os
117
+
118
+ tmp_path = sys.argv[1]
119
+ base_path = sys.argv[2]
120
+ staged_dir = os.path.realpath(sys.argv[3]).rstrip("/") + "/"
121
+ is_ruff = sys.argv[4] == "1"
122
+ scan_exit = int(sys.argv[5])
99
123
 
100
- def load(p):
124
+ def load(p, is_ruff_output=False):
101
125
  try:
102
- return json.load(open(p)).get("results", [])
103
- except Exception:
104
- return []
126
+ with open(p, "r", encoding="utf-8") as f:
127
+ data = json.load(f)
128
+ except Exception as e:
129
+ print(f"❌ 门禁评估失败: 无法解析扫描报告 {p}: {e}", file=sys.stderr)
130
+ sys.exit(2)
131
+
132
+ if isinstance(data, list):
133
+ if is_ruff_output:
134
+ return [
135
+ {
136
+ "check_id": item.get("code") or item.get("check_id"),
137
+ "path": item.get("filename") or item.get("path"),
138
+ "start": {"line": (item.get("location") or {}).get("row")},
139
+ "extra": {"severity": "WARNING", "message": item.get("message", "")}
140
+ }
141
+ for item in data
142
+ if isinstance(item, dict)
143
+ ]
144
+ return data
145
+ elif isinstance(data, dict):
146
+ return data.get("results", [])
147
+ return []
148
+
149
+ cur = load(tmp_path, is_ruff_output=is_ruff)
150
+ base = load(base_path, is_ruff_output=False)
105
151
 
106
- # opengrep 对绝对路径入参会回写绝对 path,而基线多为相对根路径 → 归一化为相对仓库根再比对
107
- REPO = sys.argv[3].rstrip("/") + "/"
108
152
  def norm(p):
109
- p = str(p)
110
- if p.startswith(REPO):
111
- p = p[len(REPO):]
112
- return p
113
-
114
- cur = load(sys.argv[1])
115
- base = load(sys.argv[2])
116
- base_keys = {(r["check_id"], norm(r["path"])) for r in base if "check_id" in r and "path" in r}
117
- new = [r for r in cur if ("check_id" in r and "path" in r)
118
- and (r["check_id"], norm(r["path"])) not in base_keys]
153
+ if not p:
154
+ return ""
155
+ p_real = os.path.realpath(str(p))
156
+ if p_real.startswith(staged_dir):
157
+ return p_real[len(staged_dir):]
158
+ p_str = str(p)
159
+ if p_str.startswith(sys.argv[3].rstrip("/") + "/"):
160
+ return p_str[len(sys.argv[3].rstrip("/") + "/"):]
161
+ return p_str
162
+
163
+ base_keys = {(r.get("check_id"), norm(r.get("path"))) for r in base if "check_id" in r and "path" in r}
164
+ new = [
165
+ r for r in cur
166
+ if ("check_id" in r and "path" in r) and (r.get("check_id"), norm(r.get("path"))) not in base_keys
167
+ ]
119
168
 
120
169
  if new:
121
- print("❌ OpenGrep gate: %d new finding(s) beyond accepted baseline:" % len(new))
170
+ gate_name = "Ruff Bandit" if is_ruff else "OpenGrep"
171
+ print(f"❌ {gate_name} gate: {len(new)} new finding(s) beyond accepted baseline:")
122
172
  for r in new:
123
173
  e = r.get("extra", {})
124
174
  line = r.get("start", {}).get("line", "?")
125
- print(" - [%s] %s:%s (%s)" % (r["check_id"], norm(r["path"]), line, e.get("severity", "?")))
126
- print("\n Fix the issue, or re-baseline: RULESETS=... bash scan.sh %s" % sys.argv[2])
175
+ print(f" - [{r.get('check_id')}] {norm(r.get('path'))}:{line} ({e.get('severity', '?')})")
176
+ print(f"\n Fix the issue, or re-baseline: RULESETS=... bash scan.sh {sys.argv[2]}")
127
177
  sys.exit(1)
128
178
 
129
- print("✅ OpenGrep gate passed (no new findings vs %d accepted baseline)." % len(base))
179
+ print(f"✅ Static-analysis gate passed (no new findings vs {len(base)} accepted baseline).")
130
180
  PYEOF
@@ -136,8 +136,22 @@ else
136
136
  python3 -c '
137
137
  import sys, json
138
138
  findings = []
139
- try: findings = json.loads(sys.argv[1]) if sys.argv[1] else []
140
- except: pass
139
+ try:
140
+ raw = json.loads(sys.argv[1]) if sys.argv[1] else []
141
+ if isinstance(raw, list):
142
+ for f in raw:
143
+ if isinstance(f, dict):
144
+ loc = f.get("location") or {}
145
+ end_loc = f.get("end_location") or {}
146
+ findings.append({
147
+ "check_id": f.get("code"),
148
+ "path": f.get("filename"),
149
+ "start": { "line": loc.get("row"), "col": loc.get("column") },
150
+ "end": { "line": end_loc.get("row"), "col": end_loc.get("column") },
151
+ "extra": { "message": f.get("message", ""), "severity": "WARNING" }
152
+ })
153
+ except Exception as e:
154
+ sys.stderr.write(f"Ruff JSON parse warning: {e}\n")
141
155
  payload = {
142
156
  "engine": "fallback-ruff-bandit",
143
157
  "fallback": True,
@@ -176,6 +176,14 @@ export function runMutationTest(options = {}) {
176
176
  throw new Error(`Mutation runner target file not found: ${targetFile}`);
177
177
  }
178
178
 
179
+ // 严格安全边界检查:确保 targetFile 位于 repoRoot 内部
180
+ const realRepoRoot = fs.existsSync(repoRoot) ? fs.realpathSync(repoRoot) : path.resolve(repoRoot);
181
+ const realTargetFile = fs.existsSync(targetFile) ? fs.realpathSync(targetFile) : path.resolve(targetFile);
182
+ const relativeTarget = path.relative(realRepoRoot, realTargetFile);
183
+ if (relativeTarget.startsWith('..') || path.isAbsolute(relativeTarget)) {
184
+ throw new Error(`Mutation runner target file must be located inside repoRoot: ${targetFile}`);
185
+ }
186
+
179
187
  const cleanEnv = { ...process.env };
180
188
  delete cleanEnv.NODE_TEST_CONTEXT;
181
189
 
@@ -207,42 +215,62 @@ export function runMutationTest(options = {}) {
207
215
  }
208
216
 
209
217
  // 3. 逐个注入变异并验证测试套件敏感度
218
+ // 安全防护:在进程退出或意外中断时注册保护兜底
210
219
  let killedCount = 0;
211
220
  const survivedMutants = [];
212
221
 
213
- for (const mutant of mutants) {
214
- const mutatedContent =
215
- originalContent.slice(0, mutant.index) +
216
- mutant.replacement +
217
- originalContent.slice(mutant.index + mutant.original.length);
218
-
222
+ const cleanupHandler = () => {
219
223
  try {
220
- fs.writeFileSync(targetFile, mutatedContent, 'utf8');
224
+ if (fs.existsSync(targetFile)) {
225
+ fs.writeFileSync(targetFile, originalContent, 'utf8');
226
+ }
227
+ } catch {}
228
+ };
229
+
230
+ process.once('SIGINT', cleanupHandler);
231
+ process.once('SIGTERM', cleanupHandler);
232
+ process.once('exit', cleanupHandler);
233
+
234
+ try {
235
+ for (const mutant of mutants) {
236
+ const mutatedContent =
237
+ originalContent.slice(0, mutant.index) +
238
+ mutant.replacement +
239
+ originalContent.slice(mutant.index + mutant.original.length);
221
240
 
222
- let testPassedWithMutant = false;
223
241
  try {
224
- execSync(testCmd, { cwd: repoRoot, stdio: 'pipe', encoding: 'utf8', env: cleanEnv });
225
- testPassedWithMutant = true;
226
- } catch {
227
- // 测试报错 = 变异被消灭 (Killed)
228
- testPassedWithMutant = false;
229
- }
242
+ fs.writeFileSync(targetFile, mutatedContent, 'utf8');
230
243
 
231
- if (testPassedWithMutant) {
232
- // 变异体存活 = 假测试!
233
- survivedMutants.push(mutant);
234
- } else {
235
- killedCount++;
244
+ let testPassedWithMutant = false;
245
+ try {
246
+ execSync(testCmd, { cwd: repoRoot, stdio: 'pipe', encoding: 'utf8', env: cleanEnv });
247
+ testPassedWithMutant = true;
248
+ } catch {
249
+ // 测试报错 = 变异被消灭 (Killed)
250
+ testPassedWithMutant = false;
251
+ }
252
+
253
+ if (testPassedWithMutant) {
254
+ // 变异体存活 = 假测试!
255
+ survivedMutants.push(mutant);
256
+ } else {
257
+ killedCount++;
258
+ }
259
+ } finally {
260
+ // 必须立刻恢复原文件,保证工作区绝对干净零污染!
261
+ fs.writeFileSync(targetFile, originalContent, 'utf8');
236
262
  }
237
- } finally {
238
- // 必须立刻恢复原文件,保证工作区绝对干净零污染!
239
- fs.writeFileSync(targetFile, originalContent, 'utf8');
240
- }
241
263
 
242
- // 发现任何一个存活变异体,立即熔断报告
243
- if (survivedMutants.length > 0) {
244
- break;
264
+ // 发现任何一个存活变异体,立即熔断报告
265
+ if (survivedMutants.length > 0) {
266
+ break;
267
+ }
245
268
  }
269
+ } finally {
270
+ process.removeListener('SIGINT', cleanupHandler);
271
+ process.removeListener('SIGTERM', cleanupHandler);
272
+ process.removeListener('exit', cleanupHandler);
273
+ cleanupHandler();
246
274
  }
247
275
 
248
276
  if (survivedMutants.length > 0) {
@@ -478,6 +478,25 @@ assert.equal(ep, "/api/v1/device/interlock");
478
478
  }
479
479
  });
480
480
 
481
+ it('runMutationTest 边界防御:严禁变异 repoRoot 外部的文件', () => {
482
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'spec-guard-sec-'));
483
+ const outsideDir = fs.mkdtempSync(path.join(os.tmpdir(), 'spec-guard-out-'));
484
+ try {
485
+ const outsideFile = path.join(outsideDir, 'outside.mjs');
486
+ fs.writeFileSync(outsideFile, 'export const x = 1;');
487
+ assert.throws(() => {
488
+ runMutationTest({
489
+ repoRoot: tmpDir,
490
+ targetFile: outsideFile,
491
+ testCmd: 'node -e "process.exit(0)"',
492
+ });
493
+ }, /must be located inside repoRoot/);
494
+ } finally {
495
+ fs.rmSync(tmpDir, { recursive: true, force: true });
496
+ fs.rmSync(outsideDir, { recursive: true, force: true });
497
+ }
498
+ });
499
+
481
500
  it('orphan 单元联动测试:符号引用分类与倒排生产调用者检索', () => {
482
501
  assert.equal(Classifier.isTestPath('src/test/java/Test.kt'), true);
483
502
  assert.equal(Classifier.isTestPath('src/main/java/Main.kt'), false);
@@ -1,5 +1,11 @@
1
1
  # Changelog — units/worktree
2
2
 
3
+ ## [v0.1.1] - 2026-11-27
4
+
5
+ ### Fixed
6
+ - **诚实分支回收状态报告**:修复 `prune` 子命令在临时分支包含未合并修改且未加 `--force` 时静默吞掉 `git branch -d` 报错并虚报成功的问题;现在明确输出警告并返回 `worktree_removed_branch_retained` 状态与详细错误。
7
+ - **单元测试补齐**:新增 `units/worktree/tests/worktree.test.mjs`,常驻校验回收状态诚实性。
8
+
3
9
  ## [v0.1.0] - 2026-11-09
4
10
 
5
11
  ### Added
@@ -1 +1 @@
1
- v0.1.0 — 2026-11-09
1
+ v0.1.1 — 2026-11-27
@@ -0,0 +1,57 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import os from 'node:os';
6
+ import { execSync } from 'node:child_process';
7
+
8
+ describe('units/worktree: 隔离与回收诚实状态测试', () => {
9
+ const worktreeBin = path.resolve('units/worktree/worktree.mjs');
10
+
11
+ it('prune 在分支无法安全删除时真实反映状态,不瞒报成功', () => {
12
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'wt-test-'));
13
+ try {
14
+ execSync('git init', { cwd: tmpDir, stdio: 'pipe' });
15
+ execSync('git config user.name "Test"', { cwd: tmpDir, stdio: 'pipe' });
16
+ execSync('git config user.email "test@example.com"', { cwd: tmpDir, stdio: 'pipe' });
17
+
18
+ // 创建初始提交
19
+ fs.writeFileSync(path.join(tmpDir, 'init.txt'), 'base');
20
+ execSync('git add init.txt && git commit -m "init"', { cwd: tmpDir, stdio: 'pipe' });
21
+
22
+ const ticketId = 'TASK-001';
23
+ // 1. 分配 worktree
24
+ execSync(`node "${worktreeBin}" allocate ${ticketId}`, { cwd: tmpDir, stdio: 'pipe' });
25
+
26
+ const wtPath = path.join(tmpDir, '.worktrees', ticketId);
27
+ assert.ok(fs.existsSync(wtPath), 'Worktree directory should be created');
28
+
29
+ // 2. 在 worktree 中产生未合并提交
30
+ fs.writeFileSync(path.join(wtPath, 'feature.txt'), 'feature branch commit');
31
+ execSync('git add feature.txt && git commit -m "work in progress"', { cwd: wtPath, stdio: 'pipe' });
32
+
33
+ // 3. 执行 prune (不带 --force)
34
+ const pruneOut = execSync(`node "${worktreeBin}" prune ${ticketId} --json`, {
35
+ cwd: tmpDir,
36
+ encoding: 'utf8',
37
+ stdio: 'pipe',
38
+ });
39
+ const parsed = JSON.parse(pruneOut);
40
+ assert.equal(parsed.status, 'worktree_removed_branch_retained');
41
+ assert.equal(parsed.branchPruned, false);
42
+ assert.ok(parsed.branchPruneError, 'Should report branch prune error');
43
+
44
+ // 4. 带 --force 执行 prune
45
+ const forceOut = execSync(`node "${worktreeBin}" prune ${ticketId} --force --json`, {
46
+ cwd: tmpDir,
47
+ encoding: 'utf8',
48
+ stdio: 'pipe',
49
+ });
50
+ const forceParsed = JSON.parse(forceOut);
51
+ assert.equal(forceParsed.status, 'pruned');
52
+ assert.equal(forceParsed.branchPruned, true);
53
+ } finally {
54
+ fs.rmSync(tmpDir, { recursive: true, force: true });
55
+ }
56
+ });
57
+ });
@@ -187,22 +187,38 @@ function prune(ticketId, options = {}) {
187
187
  }
188
188
 
189
189
  // 2. 清理分支
190
+ let branchPruned = true;
191
+ let branchPruneError = null;
190
192
  const branchExists = runCmd(`git rev-parse --verify refs/heads/${branchName}`, { ignoreError: true });
191
193
  if (branchExists) {
192
194
  const delFlag = options.force ? '-D' : '-d';
193
195
  try {
194
196
  runCmd(`git branch ${delFlag} "${branchName}"`);
195
- } catch {
196
- // 若无法安全删除分支且未加 force,提示用户
197
+ } catch (err) {
198
+ branchPruned = false;
199
+ branchPruneError = err.message;
200
+ if (!options.json) {
201
+ console.warn(`⚠️ 临时分支 [${branchName}] 未能自动删除(可能包含未合并改动): ${err.message}`);
202
+ console.warn(` 若确认丢弃该分支,可运行: git branch -D "${branchName}"`);
203
+ }
197
204
  }
198
205
  }
199
206
 
200
207
  runCmd('git worktree prune', { ignoreError: true });
201
208
 
202
209
  if (options.json) {
203
- console.log(JSON.stringify({ status: 'pruned', ticketId: cleanId }));
210
+ console.log(JSON.stringify({
211
+ status: branchPruned ? 'pruned' : 'worktree_removed_branch_retained',
212
+ ticketId: cleanId,
213
+ branchPruned,
214
+ branchPruneError
215
+ }));
204
216
  } else {
205
- console.log(`\n🧹 已成功回收工单 [${cleanId}] 的隔离工作区与临时分支。`);
217
+ if (branchPruned) {
218
+ console.log(`\n🧹 已成功回收工单 [${cleanId}] 的隔离工作区与临时分支。`);
219
+ } else {
220
+ console.log(`\n🧹 已成功回收工单 [${cleanId}] 的隔离工作区,但临时分支保留。`);
221
+ }
206
222
  }
207
223
  }
208
224
 
@@ -55,14 +55,14 @@
55
55
  | **codegraph** | `docs/codegraph-readiness-check.md` | 代码语义索引就绪检查(索引工具本身需独立安装,本库只含就绪检查文档) |
56
56
  | **code-review-graph** | `docs/code-review-graph-guide.md` | 代码审查与变动爆炸半径(Blast Radius)分析引擎就绪与使用指引 |
57
57
  | **handoffs** | `handoffs/` | 跨仓 / 仓内交接枢纽(`handoff.mjs` 引擎 + 中央契约 **v2.41.2**),统一工单与会话ID、防跨会话硬门禁、跨客户端角色锚定与状态机归属确定性 (ADR-0016)、根治建单 from_lane 为空与上游角色倒错、出站提示词双向锚定、自主双盲审计分诊协议、避免角色漂移、纯化入站单行裁决提示词、Rule 8 分级 SDD 验收与负向测试先行证明、`--profile readonly` 生产源码写保护物理硬门禁、HMAC-SHA256 密码学审计凭据 (`audit.token`)、出站提示词防注入三段式、五态状态机、显式身份 `--as`、无条件下车与事件唤醒 |
58
- | **worktree** | `worktree/` | 基于 Git Worktree 的物理目录隔离调度引擎,为多 Agent 并发分配独立沙盒,智能共享依赖缓存(v0.1.0,支持 `--version` 与契约门禁) |
58
+ | **worktree** | `worktree/` | 基于 Git Worktree 的物理目录隔离调度引擎,为多 Agent 并发分配独立沙盒,智能共享依赖缓存(v0.1.1,支持 `--version` 与契约门禁) |
59
59
  | **orphan** | `orphan/` | 全局死代码与孤儿资产清道夫与反假接线三层正交治理(**v1.4.2**,ADR-0009 / ADR-0011 / ADR-0013):只读 Git HEAD、S1–S3 求解器、L1/L2/L3 规范、Tier 1/2 自查、`check-deps [--strict]` 孤儿依赖求解器、`scan-secrets [--strict]` 零调用高熵假凭证探针、动态 SSOT 与 `--version` 支持 |
60
60
  | **spec-guard** | `spec-guard/` | 架构规约与物理接线守卫(**v2.2.1**):P3' 三元对账、三维热力表、ADR 机器信任根验签、物理接线探针、约定阈值解耦、零覆盖假绿防卫、暂存区增量快速放行、动态 SSOT 与 `--version` 支持 |
61
61
  | **skills** | `skills/` | 微观工程原子技能库与分发引擎(**v0.1.0**,ADR-0015):官方沉淀 TDD 红绿循环、系统化排错四步法、先验后报、需求澄清 4 大原子技能,带 Iron Law 与借口阻断表,提供 `task-brief` 与 `review-package` 零污染切片流水线 |
62
62
  | **specs** | `specs/` | Spec Kit 活文档模板全集(`specs/templates/` 01-research 到 05-evidence),赋能 RePPIT 5 步规约驱动开发闭环 |
63
63
  | **playbook** | `playbook/` | AEF 全套执行手册(constitution + group + specs + 生命周期门禁 + 第 20/21 章战法手册) |
64
64
  | **preflight** | `preflight/` | 仓库不变量探针 + 提交门禁 + 收尾回报三节形状(**v1.1.0**,A1~A5 探针含配置化单一事实源对账防漂移) |
65
- | **review-gate** | `review-gate/` | SAST (OpenGrep) + 本地 review + 双盲审计自动化运行器 (`baton-audit-runner`),**v1.2.2** 新增 `--no-suppress` 穿透扫描、OpenGrep 原生模式顶层对称注入 `engine: "opengrep"` 结构化元数据、Ruff Bandit 诚实降级与 macOS bash 3.2 兼容自愈 |
65
+ | **review-gate** | `review-gate/` | SAST (OpenGrep) + 本地 review + 双盲审计自动化运行器 (`baton-audit-runner`),**v1.2.3** 新增 `--no-suppress` 穿透扫描、OpenGrep 原生模式顶层对称注入 `engine: "opengrep"` 结构化元数据、Ruff Bandit 诚实降级与 macOS bash 3.2 兼容自愈 |
66
66
 
67
67
  每个模块目录里都有 `README.md`(规范的**唯一事实源**);`adr` / `backlog` / `preflight` / `review-gate` 另提供 `docs/new-project-prompt.md`(可直接复制给 AI Agent 会话),其余模块按 README 与 `$(lab path <unit>)` 动态指针接入。全部 10 个单元可用 `lab list` 列出。
68
68
 
@@ -143,7 +143,7 @@ baton check # 交接 / 回执合规自检
143
143
  - 出站转递:单工单 `baton forward <ID> --wait`(挂起监听),多工单并发解耦 `baton forward <ID> --async`,或批量派发与聚合等待 `baton forward <id1> <id2> ... --wait`。
144
144
  - 详见 `units/handoffs/AGENT-GUIDE.md` + `units/handoffs/COMMANDS.md`。
145
145
 
146
- 6. **worktree(多 Agent 物理并发隔离引擎 · v0.1.0)**
146
+ 6. **worktree(多 Agent 物理并发隔离引擎 · v0.1.1)**
147
147
  解决多 Agent 并发开发时互相踩踏主目录暂存区的顽疾:
148
148
  ```bash
149
149
  baton-worktree allocate <ticket-id> # 为工单创建专属物理目录 (.worktrees/<id>) 并软链共享依赖缓存