atlas-project-harness 0.4.0-beta.3 → 0.4.0-beta.4
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/CHANGELOG.md +22 -0
- package/NOTICE +17 -0
- package/README.md +19 -1
- package/_support/__pycache__/workflow_finish.cpython-312.pyc +0 -0
- package/_support/__pycache__/workflow_plan.cpython-312.pyc +0 -0
- package/_support/workflow_finish.py +150 -4
- package/_support/workflow_plan.py +16 -2
- package/apply/reference.md +20 -0
- package/bin/atlas.js +1 -1
- package/install.py +6 -0
- package/package.json +2 -1
- package/patches/project-wiring/agent-pointer.md +1 -1
- package/scripts/__pycache__/atlas_check.cpython-312.pyc +0 -0
- package/scripts/__pycache__/atlas_review.cpython-312.pyc +0 -0
- package/scripts/__pycache__/atlas_workflow.cpython-312.pyc +0 -0
- package/scripts/__pycache__/pkg_digest.cpython-312.pyc +0 -0
- package/scripts/atlas_check.py +2 -1
- package/scripts/atlas_review.py +180 -67
- package/scripts/atlas_workflow.py +71 -7
- package/scripts/pkg_digest.py +1 -1
- package/shared/closeout.md +13 -2
- package/shared/gates.md +2 -2
- package/shared/independent-review.md +8 -4
- package/shared/stack-profile.md +7 -5
- package/templates/adr/template.md +3 -1
- package/templates/stack-profile.yaml +6 -4
- package/validators/__pycache__/validate_adr.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_task_card.cpython-312.pyc +0 -0
- package/validators/validate_adr.py +10 -6
- package/validators/validate_task_card.py +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [v0.4.0-beta.4] - 2026-11-20
|
|
8
|
+
|
|
9
|
+
### 🧭 偏差处置与 ADR 否决态(`RFC-20261120-01`)
|
|
10
|
+
|
|
11
|
+
* `validate_adr` 新增 `rejected` 合法状态:`accepted` / `rejected` 的 Decision 必须非空(rejected 写「为什么不引入」);ADR 模板同步枚举,并加双源一致性钉;
|
|
12
|
+
* `apply` 契约新增 §5.3「偏差三岔口」:实现期偏差按 `spec_gap` / `spec_amend` / `out_of_scope` 归因,只有 `spec_amend` 回写上游;
|
|
13
|
+
* 收口清单新增步骤 12(偏差三岔口对账)与触发行,编号口径改为 1–5、7–12;`atlas_check` 结构漂移 WARN 追加处置指引。
|
|
14
|
+
|
|
15
|
+
### 🔒 执行层收口(`#68` `#69` `#70`)
|
|
16
|
+
|
|
17
|
+
* `atlas review` 新增 `impl_review.executor: cli|session`:无可用 CLI 时生成 `review-request.md` 派工包并以「待审」(exit 2)退出,会话子代理写 `cli.json` 后复跑完成转换/校验;`finish` 仍只认 `review.json` PASS(`#68`);
|
|
18
|
+
* `finish` 读取任务 AC 关联的 E2E 结论:`red` 阻断收口,索引缺失 / 无 AC 映射 / `skipped` 显式 `SKIP` 并落 `task.json`;验收走查留痕单独记录(`#69`);
|
|
19
|
+
* `finish` 收口后幂等归档到 `.atlas/tasks/archive/`;`load_tasks` 默认只看活跃任务,`status --all` 展示归档;新增 `atlas workflow archive` 供既存 `completed` 单元一次性迁移(`#70`)。
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
7
23
|
## [v0.4.0-beta.3] - 2026-11-20
|
|
8
24
|
|
|
9
25
|
### 🧭 只读上下文预览
|
|
@@ -17,6 +33,12 @@
|
|
|
17
33
|
|
|
18
34
|
* `.gitignore` 接线新增 `.atlas` 白名单块:默认 `.atlas/*` 忽略引擎镜像,`!.atlas/tasks/`、`!.atlas/spec/` 放行项目规范与任务账本;带标记幂等,用户已手写任意 `.atlas` 规则时保留其口径不覆盖。
|
|
19
35
|
|
|
36
|
+
### 📜 许可与署名
|
|
37
|
+
|
|
38
|
+
* 新增根 `NOTICE`(Apache-2.0 §4d),并随 `.atlas/` 装配分发、纳入 MANIFEST 摘要与自检声明;
|
|
39
|
+
* `docs/`、`rings/`、`skills/` 中面向人的说明性文字单独按 CC BY 4.0 授权(`docs/LICENSE`:署名 + 附原文链接 + 标明修改),代码仍为 Apache-2.0;
|
|
40
|
+
* 新增 `CITATION.cff`(GitHub 显示 “Cite this repository”);README 增「出处与署名」段:采用本方法论的衍生项目请注明来源。
|
|
41
|
+
|
|
20
42
|
---
|
|
21
43
|
|
|
22
44
|
## [v0.4.0-beta.2] - 2026-11-20
|
package/NOTICE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Atlas — Project Harness 工作流治理引擎
|
|
2
|
+
Copyright 2026 sunwenzhe-git
|
|
3
|
+
|
|
4
|
+
This product includes software developed as part of the Atlas project
|
|
5
|
+
(https://github.com/sunwenzhe-git/atlas).
|
|
6
|
+
|
|
7
|
+
本产品包含 Atlas 项目原创的工作流治理方法论、契约、校验器、模板与工程线束。
|
|
8
|
+
分发本软件或其衍生作品时,请随附本 NOTICE 与根目录 LICENSE(Apache-2.0),
|
|
9
|
+
并在衍生项目的 README 或关于页面注明来源:
|
|
10
|
+
https://github.com/sunwenzhe-git/atlas
|
|
11
|
+
|
|
12
|
+
文档与规范正文(docs/、rings/、skills/ 中面向人的说明性文字)另按
|
|
13
|
+
Creative Commons Attribution 4.0 International(CC BY 4.0)授权,
|
|
14
|
+
署名与链接要求见 docs/LICENSE。
|
|
15
|
+
|
|
16
|
+
"Atlas" 与 "Project Harness" 为本项目名称;依 Apache License 2.0 第 6 条,
|
|
17
|
+
本许可不授予任何商标使用权。
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Atlas — 践行 Project Harness 的全流程 AI 编程工作流
|
|
2
2
|
|
|
3
3
|
<p align="left">
|
|
4
|
-
<img src="https://img.shields.io/badge/version-0.4.0--beta.
|
|
4
|
+
<img src="https://img.shields.io/badge/version-0.4.0--beta.4-blue.svg" alt="Version" />
|
|
5
5
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="License" />
|
|
6
6
|
<img src="https://img.shields.io/badge/tests-passing-success.svg" alt="Tests" />
|
|
7
7
|
<a href="https://sunwenzhe-git.github.io/atlas/"><img src="https://img.shields.io/badge/docs-VitePress-green.svg" alt="Docs" /></a>
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
- [十、贡献与流水线协同(RFC 机制)](#十贡献与流水线协同rfc-机制)
|
|
43
43
|
- [十一、社区交流(钉钉群)](#十一社区交流钉钉群)
|
|
44
44
|
- [十二、开源协议(License)](#十二开源协议license)
|
|
45
|
+
- [十三、出处与署名(Attribution)](#十三出处与署名attribution)
|
|
45
46
|
|
|
46
47
|
---
|
|
47
48
|
|
|
@@ -489,6 +490,7 @@ Atlas 坚持**变异证明(Mutation Proving / M 系列钉子测试)**原则
|
|
|
489
490
|
* **步骤 3 风险定档**:低/中/高三档 + **Always-Human 路径**(`auth / permission / routing / CI / package deps / shared contracts` 一律禁止 Agent 代勾);
|
|
490
491
|
* **步骤 4 缺陷修复验证 7 检查点**:含「先有一条会失败的测试再修」(Red First)与「关闭的证据在哪」;
|
|
491
492
|
* **步骤 11 事故追问**:每个逃逸缺陷必须回答「哪一层本该接住它」,并落成一条 E2E 回归用例或一条 M 系列变异钉——事故就此变成评测集。
|
|
493
|
+
* **步骤 12 偏差三岔口**:`结构漂移` 点名的新增键、`testid` 多写、AC 对齐偏差,收口时逐条归因为 `spec_gap` / `spec_amend` / `out_of_scope`(`apply/reference.md` §5.3);只有 `spec_amend` 回写上游,其余走执行层任务,防止「实现怎么写、规格就怎么改」。
|
|
492
494
|
|
|
493
495
|
---
|
|
494
496
|
|
|
@@ -572,6 +574,22 @@ Atlas 随包完整分发了一套自洽的高阶开发与评审套件:
|
|
|
572
574
|
|
|
573
575
|
本项目基于 **[Apache License, Version 2.0](LICENSE)** 协议开源。
|
|
574
576
|
|
|
577
|
+
- 代码、脚本、模板、校验器:Apache-2.0。分发时请保留 [LICENSE](LICENSE) 与 [NOTICE](NOTICE),修改过的文件请标注。
|
|
578
|
+
- 文档与规范正文(`docs/`、`rings/`、`skills/` 中面向人的说明性文字):[CC BY 4.0](docs/LICENSE)。复制、改编、商用都需署名并附原文链接。
|
|
579
|
+
- 引用本方法论:见 [CITATION.cff](CITATION.cff)(GitHub 仓库页会出现 “Cite this repository”)。
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
## 十三、出处与署名(Attribution)
|
|
584
|
+
|
|
585
|
+
如果你在项目、文章或产品中采用了 Atlas 的 Project Harness 方法论(契约先行、机器门禁、变异证明、独立审查等),请在 README 或关于页面注明来源:
|
|
586
|
+
|
|
587
|
+
> 本项目的工程治理思路来自 **Atlas — Project Harness 工作流治理引擎**:<https://github.com/sunwenzhe-git/atlas>
|
|
588
|
+
|
|
589
|
+
这是一条署名请求,不是许可条款——方法论本身不受著作权保护,无法强制;但“来源可追溯”是这个项目愿意被复用的前提。
|
|
590
|
+
|
|
591
|
+
`Atlas` 与 `Project Harness` 为项目名称,依 Apache-2.0 第 6 条,本许可不授予商标使用权。
|
|
592
|
+
|
|
575
593
|
---
|
|
576
594
|
|
|
577
595
|
<p align="center">
|
|
Binary file
|
|
Binary file
|
|
@@ -13,11 +13,15 @@ from __future__ import annotations
|
|
|
13
13
|
|
|
14
14
|
import json
|
|
15
15
|
import re
|
|
16
|
+
import shutil
|
|
16
17
|
import subprocess
|
|
18
|
+
from collections import Counter
|
|
19
|
+
from datetime import date
|
|
17
20
|
from pathlib import Path
|
|
18
21
|
|
|
19
22
|
from _support import review_scope_core as scope_core
|
|
20
|
-
from _support.
|
|
23
|
+
from _support.layout import LayoutError, load_layout
|
|
24
|
+
from _support.workflow_plan import ARCHIVE_DIR, load_tasks, atomic_write_json, UNIT_RE
|
|
21
25
|
|
|
22
26
|
|
|
23
27
|
class FinishError(ValueError):
|
|
@@ -25,6 +29,7 @@ class FinishError(ValueError):
|
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
REVIEW_DIR_PREFIX_RE = r"^\d{4}-\d{2}-\d{2}-impl-review-"
|
|
32
|
+
ARCHIVE_MONTH_RE = re.compile(r"^\d{4}-(0[1-9]|1[0-2])$") # `archive/<YYYY-MM>/<ID>/`
|
|
28
33
|
|
|
29
34
|
|
|
30
35
|
def _staged_files(root: Path) -> list[str] | None:
|
|
@@ -99,6 +104,132 @@ def check_task_review_passed(root: Path, unit: str) -> tuple[bool, str]:
|
|
|
99
104
|
return True, str(latest_dir)
|
|
100
105
|
|
|
101
106
|
|
|
107
|
+
def _acceptance_evidence(lay) -> dict:
|
|
108
|
+
"""用户验收走查留痕:`<e2e>/reviews/*-acceptance-*/README.md`(缺 ⇒ SKIP,人工责任)。"""
|
|
109
|
+
reviews = lay.e2e_reviews_dir
|
|
110
|
+
if not reviews.is_dir():
|
|
111
|
+
return {"status": "SKIP", "reason": "无 E2E 验收走查留痕目录(人工责任)"}
|
|
112
|
+
docs = sorted(p for p in reviews.glob("*-acceptance-*")
|
|
113
|
+
if p.is_dir() and (p / "README.md").is_file())
|
|
114
|
+
if not docs:
|
|
115
|
+
return {"status": "SKIP", "reason": "未见 *-acceptance-*/README.md(用户验收走查为人工责任)"}
|
|
116
|
+
latest = docs[-1]
|
|
117
|
+
return {"status": "PASS", "path": str(latest.relative_to(lay.root)),
|
|
118
|
+
"reason": "找到验收走查留痕"}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
E2E_MAIN_COLUMNS = ["用例ID", "页面", "中文标题", "类型", "关联AC", "需求", "状态", "状态原因", "分片"]
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _markdown_tables(text: str) -> list[tuple[list[str], list[list[str]]]]:
|
|
125
|
+
"""轻量读取 Markdown 表(列头 + 行),与 `validators/validate_e2e_index.tables` 同口径。
|
|
126
|
+
|
|
127
|
+
不直接 import 校验器:`_support → validators` 反向依赖有棘轮上限
|
|
128
|
+
(`tests/test_shared_kernel.py`),新增依赖须先拆旧的。
|
|
129
|
+
"""
|
|
130
|
+
out: list[tuple[list[str], list[list[str]]]] = []
|
|
131
|
+
block: list[list[str]] = []
|
|
132
|
+
for line in text.splitlines():
|
|
133
|
+
if line.strip().startswith("|"):
|
|
134
|
+
block.append([c.strip() for c in line.strip().strip("|").split("|")])
|
|
135
|
+
elif block:
|
|
136
|
+
out.append((block[0], [r for r in block[1:]
|
|
137
|
+
if not all(set(c) <= set("-: ") for c in r)]))
|
|
138
|
+
block = []
|
|
139
|
+
if block:
|
|
140
|
+
out.append((block[0], [r for r in block[1:]
|
|
141
|
+
if not all(set(c) <= set("-: ") for c in r)]))
|
|
142
|
+
return out
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def check_e2e_precondition(root: Path, task: dict) -> dict:
|
|
146
|
+
"""收口前把 E2E 结论纳入校验输入(issue #69)。
|
|
147
|
+
|
|
148
|
+
- 与本任务 AC 关联的用例存在 `red` ⇒ `FAIL`(阻断收口);
|
|
149
|
+
- 索引缺失 / 任务卡无 AC / 本任务 AC 未出现在索引 / 含 `skipped` ⇒ `SKIP`(显式记录原因,
|
|
150
|
+
不静默当作通过);
|
|
151
|
+
- 其余(`green` / `blocked` 带原因)⇒ `PASS`。
|
|
152
|
+
验收走查留痕单独记录,不改变 E2E 结论(缺留痕 = `SKIP`,人工责任)。
|
|
153
|
+
"""
|
|
154
|
+
try:
|
|
155
|
+
lay = load_layout(root)
|
|
156
|
+
except LayoutError as exc:
|
|
157
|
+
return {"status": "SKIP", "reason": f"布局不可解析:{exc}"}
|
|
158
|
+
index = lay.e2e_index
|
|
159
|
+
if not index.is_file():
|
|
160
|
+
return {"status": "SKIP", "reason": f"未找到 E2E 索引({index.relative_to(root)}):按人工责任处理"}
|
|
161
|
+
try:
|
|
162
|
+
tabs = _markdown_tables(index.read_text(encoding="utf-8"))
|
|
163
|
+
except OSError as exc:
|
|
164
|
+
return {"status": "SKIP", "reason": f"E2E 索引不可读:{exc}"}
|
|
165
|
+
if not tabs:
|
|
166
|
+
return {"status": "SKIP", "reason": "E2E 索引无可解析表格"}
|
|
167
|
+
matched = next(((h, r) for h, r in tabs if h == E2E_MAIN_COLUMNS), None)
|
|
168
|
+
if matched is None:
|
|
169
|
+
return {"status": "SKIP",
|
|
170
|
+
"reason": f"E2E 主表列头不可识别(期望 {E2E_MAIN_COLUMNS})"}
|
|
171
|
+
header, rows = matched
|
|
172
|
+
grid = [dict(zip(header, r + [""] * (len(header) - len(r)))) for r in rows]
|
|
173
|
+
acs = [str(a) for a in (task.get("acs") or []) if str(a).strip()]
|
|
174
|
+
if not acs:
|
|
175
|
+
return {"status": "SKIP", "reason": "任务卡未声明 AC,无法定位 E2E 适用面", "acs": []}
|
|
176
|
+
scoped = [g for g in grid if any(a in (g.get("关联AC") or "") for a in acs)]
|
|
177
|
+
if not scoped:
|
|
178
|
+
return {"status": "SKIP", "reason": f"本任务 AC 未出现在 E2E 索引:{acs}", "acs": acs}
|
|
179
|
+
counts = dict(Counter((g.get("状态") or "") for g in scoped))
|
|
180
|
+
cases = [g.get("用例ID") or "?" for g in scoped]
|
|
181
|
+
red = [cid for cid, g in zip(cases, scoped) if (g.get("状态") or "") == "red"]
|
|
182
|
+
skipped = [cid for cid, g in zip(cases, scoped) if (g.get("状态") or "") == "skipped"]
|
|
183
|
+
out = {"acs": acs, "cases": cases, "counts": counts,
|
|
184
|
+
"acceptance": _acceptance_evidence(lay)}
|
|
185
|
+
if red:
|
|
186
|
+
out.update(status="FAIL", reason=f"E2E 关联用例存在 red:{red}")
|
|
187
|
+
elif skipped:
|
|
188
|
+
out.update(status="SKIP", reason=f"E2E 关联用例含 skipped(不得当通过):{skipped}")
|
|
189
|
+
else:
|
|
190
|
+
out.update(status="PASS", reason=f"E2E 关联用例无 red({counts})")
|
|
191
|
+
return out
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def archive_month(t_dir: Path, tasks_root: Path) -> str | None:
|
|
195
|
+
"""任务目录若已在 `archive/<YYYY-MM>/<ID>/` 下,返回月份名;否则 None。
|
|
196
|
+
|
|
197
|
+
月份层是判据侧的既有契约:`validators/validate_task_card.py` 按
|
|
198
|
+
`archive/*/*/prd.md` 找卡,封条按 `archive/*/<ID>/<tail>` 定位。写入侧
|
|
199
|
+
只用月度目录,避免归档卡静默掉出判据覆盖(issue #70)。
|
|
200
|
+
"""
|
|
201
|
+
archive_root = (tasks_root / ARCHIVE_DIR).resolve()
|
|
202
|
+
try:
|
|
203
|
+
rel = t_dir.resolve().relative_to(archive_root)
|
|
204
|
+
except ValueError:
|
|
205
|
+
return None
|
|
206
|
+
if len(rel.parts) == 2 and ARCHIVE_MONTH_RE.match(rel.parts[0]):
|
|
207
|
+
return rel.parts[0]
|
|
208
|
+
return None
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def archive_task(root: Path, tasks_root: Path, t_dir: Path, t_id: str) -> dict:
|
|
212
|
+
"""把已收口任务移到 `.atlas/tasks/archive/<YYYY-MM>/<id>/`(幂等;issue #70)。
|
|
213
|
+
|
|
214
|
+
月份取归档当天。历史扁平存档(`archive/<id>/`)或缺/错月份层的目录会在
|
|
215
|
+
下次归档时迁入当月,从而重新进入判据与封条的扫描面。
|
|
216
|
+
"""
|
|
217
|
+
if not UNIT_RE.match(t_id):
|
|
218
|
+
raise FinishError(f"非法任务标识:{t_id!r}")
|
|
219
|
+
root = root.resolve()
|
|
220
|
+
if archive_month(t_dir, tasks_root) is not None:
|
|
221
|
+
return {"status": "already", "path": str(t_dir.resolve().relative_to(root))}
|
|
222
|
+
dest = tasks_root / ARCHIVE_DIR / date.today().strftime("%Y-%m") / t_id
|
|
223
|
+
if dest.exists():
|
|
224
|
+
raise FinishError(f"归档目标已存在:{dest}(源目录仍在 {t_dir};请人工核对后处理)")
|
|
225
|
+
try:
|
|
226
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
227
|
+
shutil.move(str(t_dir), str(dest))
|
|
228
|
+
except OSError as exc:
|
|
229
|
+
raise FinishError(f"归档失败:{t_dir} → {dest}({exc})") from exc
|
|
230
|
+
return {"status": "moved", "path": str(dest.relative_to(root))}
|
|
231
|
+
|
|
232
|
+
|
|
102
233
|
def finish_task(root: Path, task: dict, *, force: bool = False) -> dict:
|
|
103
234
|
"""完成单个任务的收口流转。"""
|
|
104
235
|
root = root.resolve()
|
|
@@ -112,12 +243,21 @@ def finish_task(root: Path, task: dict, *, force: bool = False) -> dict:
|
|
|
112
243
|
|
|
113
244
|
if not t_dir.is_dir():
|
|
114
245
|
raise FinishError(f"任务目录不存在:{t_dir}")
|
|
246
|
+
if archive_month(t_dir, tasks_root) is None:
|
|
247
|
+
archive_dest = tasks_root / ARCHIVE_DIR / date.today().strftime("%Y-%m") / t_id
|
|
248
|
+
if archive_dest.exists():
|
|
249
|
+
raise FinishError(
|
|
250
|
+
f"归档目标已存在:{archive_dest}(源目录仍在 {t_dir};请人工核对后处理)")
|
|
115
251
|
if not force:
|
|
116
252
|
passed, reason = check_task_review_passed(root, t_id)
|
|
117
253
|
if not passed:
|
|
118
254
|
raise FinishError(f"任务 {t_id} 无法收口:{reason}")
|
|
119
255
|
|
|
120
|
-
|
|
256
|
+
e2e = check_e2e_precondition(root, task)
|
|
257
|
+
if e2e["status"] == "FAIL":
|
|
258
|
+
raise FinishError(f"任务 {t_id} 无法收口:{e2e['reason']}")
|
|
259
|
+
|
|
260
|
+
# 更新 task.json 状态为 completed(E2E 前置结论一并落盘,issue #69)
|
|
121
261
|
task_json_file = t_dir / "task.json"
|
|
122
262
|
if task_json_file.is_file():
|
|
123
263
|
try:
|
|
@@ -128,10 +268,14 @@ def finish_task(root: Path, task: dict, *, force: bool = False) -> dict:
|
|
|
128
268
|
meta = task
|
|
129
269
|
|
|
130
270
|
meta["status"] = "completed"
|
|
271
|
+
meta["e2e_precondition"] = e2e
|
|
131
272
|
atomic_write_json(task_json_file, meta)
|
|
132
273
|
|
|
133
|
-
#
|
|
134
|
-
|
|
274
|
+
# 归档(issue #70):completed 任务移出活跃区;幂等,失败显式报错
|
|
275
|
+
archived = archive_task(root, tasks_root, t_dir, t_id)
|
|
276
|
+
|
|
277
|
+
# 检查整体工作流是否全部收工(含归档任务)
|
|
278
|
+
all_tasks = load_tasks(tasks_root, include_archived=True)
|
|
135
279
|
total = len(all_tasks)
|
|
136
280
|
completed_count = sum(1 for t in all_tasks if t.get("status") == "completed")
|
|
137
281
|
|
|
@@ -141,4 +285,6 @@ def finish_task(root: Path, task: dict, *, force: bool = False) -> dict:
|
|
|
141
285
|
"total_tasks": total,
|
|
142
286
|
"completed_tasks": completed_count,
|
|
143
287
|
"all_done": (total > 0 and completed_count == total),
|
|
288
|
+
"e2e_precondition": e2e,
|
|
289
|
+
"archived": archived,
|
|
144
290
|
}
|
|
@@ -19,6 +19,7 @@ from pathlib import Path
|
|
|
19
19
|
|
|
20
20
|
AC_RE = re.compile(r"AC-[A-Z0-9]+(?:-[A-Z0-9]+)*-\d{2,3}")
|
|
21
21
|
UNIT_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$")
|
|
22
|
+
ARCHIVE_DIR = "archive" # `.atlas/tasks/archive/<YYYY-MM>/<ID>/`:已收口任务归档区(issue #70)
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class PlanError(ValueError):
|
|
@@ -178,6 +179,8 @@ def write_task_card(task_dir: Path, task: dict) -> Path:
|
|
|
178
179
|
重跑 plan 不得把已推进的状态打回 `todo`(状态机单调:todo < in_progress < completed);
|
|
179
180
|
已有 task.json 时沿用其 status 与 created_at。
|
|
180
181
|
"""
|
|
182
|
+
if task.get("id") == ARCHIVE_DIR:
|
|
183
|
+
raise PlanError(f"任务标识 {ARCHIVE_DIR!r} 与归档目录保留名冲突")
|
|
181
184
|
task_dir.mkdir(parents=True, exist_ok=True)
|
|
182
185
|
prd_path = task_dir / "prd.md"
|
|
183
186
|
task_json_path = task_dir / "task.json"
|
|
@@ -216,12 +219,21 @@ def write_task_card(task_dir: Path, task: dict) -> Path:
|
|
|
216
219
|
return task_dir
|
|
217
220
|
|
|
218
221
|
|
|
219
|
-
def load_tasks(tasks_root: Path) -> list[dict]:
|
|
220
|
-
"""
|
|
222
|
+
def load_tasks(tasks_root: Path, *, include_archived: bool = False) -> list[dict]:
|
|
223
|
+
"""读取任务元数据并做依赖拓扑排序。
|
|
224
|
+
|
|
225
|
+
`include_archived=False`(缺省)只扫**活跃**任务;归档在
|
|
226
|
+
`<tasks_root>/archive/`(issue #70,由 finish / `atlas workflow archive` 迁入),
|
|
227
|
+
带 `_archived: True` 标记,只能经 `include_archived=True` 或 `status --all` 看到。
|
|
228
|
+
"""
|
|
221
229
|
if not tasks_root.is_dir():
|
|
222
230
|
return []
|
|
223
231
|
tasks: dict[str, dict] = {}
|
|
224
232
|
for p in sorted(tasks_root.rglob("task.json")):
|
|
233
|
+
rel = p.relative_to(tasks_root)
|
|
234
|
+
archived = bool(rel.parts) and rel.parts[0] == ARCHIVE_DIR
|
|
235
|
+
if archived and not include_archived:
|
|
236
|
+
continue
|
|
225
237
|
try:
|
|
226
238
|
data = json.loads(p.read_text(encoding="utf-8"))
|
|
227
239
|
except (OSError, json.JSONDecodeError) as exc:
|
|
@@ -229,6 +241,8 @@ def load_tasks(tasks_root: Path) -> list[dict]:
|
|
|
229
241
|
if not (isinstance(data, dict) and data.get("id")):
|
|
230
242
|
raise PlanError(f"任务卡缺少 id:{p}")
|
|
231
243
|
data["_dir"] = str(p.parent)
|
|
244
|
+
if archived:
|
|
245
|
+
data["_archived"] = True
|
|
232
246
|
tasks[data["id"]] = data
|
|
233
247
|
|
|
234
248
|
# 简单拓扑排序
|
package/apply/reference.md
CHANGED
|
@@ -213,6 +213,8 @@ apply 只对**本次受影响集合**落笔,**不整文件覆盖**任何项目
|
|
|
213
213
|
| 需**裁决**(选项 A/B、要用户拍板) | 登记为设计决策,走用户确认门(`shared/global-rules.md` §7) |
|
|
214
214
|
| **退役 / 迁移**(产物或规则失去宿主) | 生命周期(`shared/global-rules.md` §11) |
|
|
215
215
|
|
|
216
|
+
> 偏差归因见 §5.3:只有 `spec_amend` 进本模式;`spec_gap` / `out_of_scope` 走执行层任务,**不写回上游**。
|
|
217
|
+
|
|
216
218
|
**执行四件**:
|
|
217
219
|
|
|
218
220
|
1. **分组**:按「**上游目标 + 改动类型**」分组;**一次确认门过一组**(不逐条问)。
|
|
@@ -224,6 +226,24 @@ apply 只对**本次受影响集合**落笔,**不整文件覆盖**任何项目
|
|
|
224
226
|
|
|
225
227
|
**与「用例先行」的咬合**:用例先行(`rings/e2e/reference.md` §6.2)会在实现前暴露上游缺口 ⇒ **P0 回填的时限执行器 = 域实现准入前必须裁决并执行**;上游缺口阻塞实现属**预算击穿**(`3509 §94`),登记为流水线缺陷(不与产品缺陷混写)。
|
|
226
228
|
|
|
229
|
+
### 5.3 偏差三岔口(实现期发现的偏差怎么归因;2026-11-20 补,`RFC-20261120-01`)
|
|
230
|
+
|
|
231
|
+
**病根**:实施或验收时发现「代码与上游说法对不上」,现状只有回填一条通道,默认动作是改上游 ⇒ 长期等价于「实现怎么写、规格就怎么改」,Ring 2 的应然性被实现倒灌。
|
|
232
|
+
|
|
233
|
+
**每条偏差先归因,再选通道(三选一,不得跳过)**:
|
|
234
|
+
|
|
235
|
+
| 归因 | 判定 | 动作 | 通道 |
|
|
236
|
+
|---|---|---|---|
|
|
237
|
+
| `spec_gap` | 上游说法是对的,本次实现漏了 | 产实现任务补齐,**不写回上游** | `atlas workflow` |
|
|
238
|
+
| `spec_amend` | 实现多做 / 做偏的部分**有价值**,应转正 | 写回 PRD / E2E,修订行注明 `来源: backfill` | **`apply backfill`(§5.2)** |
|
|
239
|
+
| `out_of_scope` | 实现多做的部分**无价值** | 产移除任务,**不写回上游** | `atlas workflow` |
|
|
240
|
+
|
|
241
|
+
**三条边界**:
|
|
242
|
+
|
|
243
|
+
1. **只有 `spec_amend` 进回填队列**;`spec_gap` / `out_of_scope` 不得丢进 backfill——那会把它们变成「改上游」。
|
|
244
|
+
2. 归因是**语义判断,无机器门**(回填队列当前不是机器可读文件);按 `global-rules.md` §15 先例如实登记,不假装是门。升格条件 = 队列落成机器可读文件后归因成为可校验枚举。
|
|
245
|
+
3. 常见的三处偏差信号在收口清单步骤 12 汇总:`结构漂移` 点名的新增键、`testid` 多写、AC 对齐偏差。
|
|
246
|
+
|
|
227
247
|
---
|
|
228
248
|
|
|
229
249
|
## 6. `all` 模式
|
package/bin/atlas.js
CHANGED
|
@@ -26,7 +26,7 @@ Atlas — 践行 Project Harness 的全流程 AI 编程工作流治理引擎
|
|
|
26
26
|
update 安全刷新当前项目中的 .atlas/ 工程线束与平台 Skills 至最新版本
|
|
27
27
|
upgrade 自动拉取 npm 最新全局包升级全局 Atlas CLI
|
|
28
28
|
check 运行项目级资产与门禁全套检查
|
|
29
|
-
workflow 自建全流程执行层调度(plan / dispatch / context / verify / finish / status / run)
|
|
29
|
+
workflow 自建全流程执行层调度(plan / dispatch / context / verify / finish / status / archive / run)
|
|
30
30
|
solution 多仓方案层:init / adopt / status / check / lock / task(Phase 1 仅 federated)
|
|
31
31
|
review 实例⑤实现代码独立审查一键编排(preview → CLI review → scope → convert → validate → closure)
|
|
32
32
|
eval 消融对照跑分器(run:两 commit 对照出 ledger;gate:回归判定)
|
package/install.py
CHANGED
|
@@ -595,6 +595,11 @@ def main() -> None:
|
|
|
595
595
|
run(f"cp {SCRIPT_DIR}/LICENSE {atlas_dest}/LICENSE",
|
|
596
596
|
action=lambda: cp_f(Path(SCRIPT_DIR, "LICENSE"), Path(atlas_dest, "LICENSE")))
|
|
597
597
|
|
|
598
|
+
# Apache-2.0 §4(d):分发含 NOTICE 的作品时须随附 NOTICE(.atlas/ 是分发给采纳方的副本)。
|
|
599
|
+
if os.path.isfile(os.path.join(SCRIPT_DIR, "NOTICE")):
|
|
600
|
+
run(f"cp {SCRIPT_DIR}/NOTICE {atlas_dest}/NOTICE",
|
|
601
|
+
action=lambda: cp_f(Path(SCRIPT_DIR, "NOTICE"), Path(atlas_dest, "NOTICE")))
|
|
602
|
+
|
|
598
603
|
# RFC-20261111-03 §5.3:`reader_version` 第二级读装配副本的 `.atlas/package.json`
|
|
599
604
|
# (工具自身版本;被检查仓的 `package.json` 不参与分级)。
|
|
600
605
|
pkg_json = os.path.join(SCRIPT_DIR, "package.json")
|
|
@@ -763,6 +768,7 @@ def main() -> None:
|
|
|
763
768
|
check(label, path)
|
|
764
769
|
|
|
765
770
|
c("共享契约", f"{atlas_dest}/shared/global-rules.md")
|
|
771
|
+
c("许可声明", f"{atlas_dest}/NOTICE")
|
|
766
772
|
c("stack-profile 契约", f"{atlas_dest}/shared/stack-profile.md")
|
|
767
773
|
c("单一真相源契约", f"{atlas_dest}/shared/single-source.md")
|
|
768
774
|
c("布局契约", f"{atlas_dest}/shared/layout.md")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atlas-project-harness",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.4",
|
|
4
4
|
"description": "践行 Project Harness 的全流程 AI 编程工作流治理引擎",
|
|
5
5
|
"bin": {
|
|
6
6
|
"atlas": "bin/atlas.js"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"_support",
|
|
27
27
|
"install.py",
|
|
28
28
|
"install.sh",
|
|
29
|
+
"NOTICE",
|
|
29
30
|
"README.md",
|
|
30
31
|
"CHANGELOG.md",
|
|
31
32
|
"DESIGN.md"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
- 开工:`atlas workflow plan --unit <ID> [--paths <glob...>]` → `atlas workflow dispatch [--paths <file...>]`
|
|
16
16
|
- 提交前:`atlas workflow verify --unit <ID>`(未通过不得提交或收口)
|
|
17
|
-
- 收口:`atlas workflow finish --unit <ID
|
|
17
|
+
- 收口:`atlas workflow finish --unit <ID>`(读独立审查 PASS + 本任务 AC 关联的 E2E 结论:`red` 阻断,缺数据显式 `SKIP`;完成后任务移入 `.atlas/tasks/archive/<YYYY-MM>/`)
|
|
18
18
|
- **平台口径(Windows)**:契约里的 `python3` 用 `python` 替代(需 Python 3.10+)。
|
|
19
19
|
|
|
20
20
|
撞到「规则本身不合业务」不许静默绕过:按 `.atlas/shared/global-rules.md` §15 提炼设计问题后 `atlas report` 上报。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/scripts/atlas_check.py
CHANGED
|
@@ -620,7 +620,8 @@ def check_drift(root: Path, rows: Row) -> None:
|
|
|
620
620
|
parts.append(f"{x.get('kind', '?')} +{add} -{rem}")
|
|
621
621
|
more = "" if len(drifts) <= 3 else f"(共 {len(drifts)} 处)"
|
|
622
622
|
rows.add("结构漂移", "WARN",
|
|
623
|
-
f"最近一次事实刷新检测到未登记键级变更(.adapter-out/_drift.json):{';'.join(parts)}{more}"
|
|
623
|
+
f"最近一次事实刷新检测到未登记键级变更(.adapter-out/_drift.json):{';'.join(parts)}{more};"
|
|
624
|
+
"请按偏差三岔口在收口逐条处置(apply/reference.md §5.3)",
|
|
624
625
|
duration_ms=_elapsed_ms(started))
|
|
625
626
|
|
|
626
627
|
|