aodw-skill 0.7.28 → 0.9.0
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/.aodw-next/01-core/ai-interaction-rules.md +24 -2
- package/.aodw-next/01-core/ai-knowledge-rules.md +31 -1
- package/.aodw-next/01-core/aodw-constitution.md +84 -15
- package/.aodw-next/01-core/git-discipline.md +160 -31
- package/.aodw-next/01-core/test-discipline.md +124 -0
- package/.aodw-next/02-workflow/autopilot-goal-spec.md +2 -2
- package/.aodw-next/02-workflow/autopilot-protocol.md +1 -1
- package/.aodw-next/02-workflow/rt-manager.md +310 -20
- package/.aodw-next/02-workflow/spec-full-profile.md +4 -3
- package/.aodw-next/02-workflow/spec-lite-profile.md +2 -1
- package/.aodw-next/02-workflow/sub-agent-driven-profile.md +156 -0
- package/.aodw-next/02-workflow/task-pack-projection.md +250 -0
- package/.aodw-next/04-auditors/aodw-development-auditor-rules.md +31 -13
- package/.aodw-next/04-auditors/aodw-full-auditor-rules.md +61 -39
- package/.aodw-next/04-auditors/aodw-plan-auditor-rules.md +109 -0
- package/.aodw-next/04-auditors/aodw-requirement-auditor-rules.md +51 -31
- package/.aodw-next/README.md +63 -1
- package/.aodw-next/SKILL.md +2 -0
- package/.aodw-next/config.yaml +5 -0
- package/.aodw-next/manifest.yaml +42 -2
- package/.aodw-next/manifests/rt-gates.yaml +252 -0
- package/.aodw-next/project.yaml +41 -1
- package/.aodw-next/skills/handover-pack/SKILL.md +219 -0
- package/.aodw-next/skills/handover-pack/references/format-contract.md +124 -0
- package/.aodw-next/skills/handover-pack/scripts/_common.sh +92 -0
- package/.aodw-next/skills/handover-pack/scripts/check-closure.sh +163 -0
- package/.aodw-next/skills/handover-pack/scripts/next-number.sh +111 -0
- package/.aodw-next/skills/handover-pack/scripts/validate.py +260 -0
- package/.aodw-next/skills/handover-pack/templates/handover-template.md +99 -0
- package/.aodw-next/templates/aodw-kernel-loader-template.md +3 -4
- package/.aodw-next/templates/rt-autopilot-preflight.template.md +1 -1
- package/.aodw-next/templates/rt-lite.template.md +1 -1
- package/.aodw-next/templates/rt-meta-template.yaml +30 -1
- package/.aodw-next/tools/fixtures/data/hook-bad-stdin.txt +1 -0
- package/.aodw-next/tools/fixtures/data/hook-pretooluse-benign.json +17 -0
- package/.aodw-next/tools/fixtures/data/hook-pretooluse-commit.json +17 -0
- package/.aodw-next/tools/fixtures/data/hook-stop-active.json +13 -0
- package/.aodw-next/tools/fixtures/data/hook-stop-first.json +13 -0
- package/.aodw-next/tools/fixtures/data/python3-no-yaml.sh +4 -0
- package/.aodw-next/tools/fixtures/root-g101/RT/RT-701/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-g101/RT/RT-702/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-g101/RT/RT-703/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-g101/RT/index.yaml +11 -0
- package/.aodw-next/tools/fixtures/root-g109/RT/RT-622/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-g109/RT/RT-622/rt-lite.md +6 -0
- package/.aodw-next/tools/fixtures/root-g109/RT/index.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-g113/RT/RT-631/handoff/unit-U1-input.md +12 -0
- package/.aodw-next/tools/fixtures/root-g113/RT/RT-631/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-g113/RT/RT-631/rt-lite.md +6 -0
- package/.aodw-next/tools/fixtures/root-g113/RT/index.yaml +3 -0
- package/.aodw-next/tools/fixtures/root-g114-noledger/RT/RT-811/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114-noledger/RT/RT-812/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114-noledger/RT/index.yaml +7 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-801/meta.yaml +10 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-802/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-803/meta.yaml +7 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-804/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-805/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-806/meta.yaml +11 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-807/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-808/meta.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/RT-809/meta.yaml +9 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/_deferred-items.md +53 -0
- package/.aodw-next/tools/fixtures/root-g114g115/RT/index.yaml +21 -0
- package/.aodw-next/tools/fixtures/root-mini/RT/RT-101/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-501/handoff/unit-U1-input.md +19 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-502/handoff/unit-U1-input.md +18 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-503/handoff/unit-U1-input.md +19 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-503/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-503/retrospective.md +5 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-504/handoff/unit-U1-input.md +19 -0
- package/.aodw-next/tools/fixtures/root-u1/RT/RT-504/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-201/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-201/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-202/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-202/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-203/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-203/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-204/meta.yaml +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-204/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-205/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-205/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-206/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-206/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-207/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-207/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-208/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-208/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-209/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-209/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-210/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-210/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-211/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-212/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-212/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-213/meta.yaml +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-213/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-214/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-214/rt-lite.md +4 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-215/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-215/retrospective.md +2 -0
- package/.aodw-next/tools/fixtures/root-u2a/RT/RT-215/rt-lite.md +4 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-301/changelog.md +2 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-301/csf-review.md +2 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-301/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-302/meta.yaml +4 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-302/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-303/meta.yaml +5 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/RT-303/rt-lite.md +2 -0
- package/.aodw-next/tools/fixtures/root-u2a-ok/RT/index.yaml +6 -0
- package/.aodw-next/tools/fixtures/root-u2b/.aodw-next/guide.md +4 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-401/notes.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-401/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-402/notes.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-402/rt-lite.md +13 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-403/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-403/sub/deep-notes.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-404/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-405/rt-lite.md +4 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-406/rt-lite.md +6 -0
- package/.aodw-next/tools/fixtures/root-u2b/RT/RT-407/rt-lite.md +3 -0
- package/.aodw-next/tools/fixtures/root-u2b/docs/a/shared.md +8 -0
- package/.aodw-next/tools/fixtures/root-u2b/docs/b/shared.md +2 -0
- package/.aodw-next/tools/fixtures/run-fixtures.sh +504 -0
- package/.aodw-next/tools/fixtures/run-skill-fixtures.sh +671 -0
- package/.aodw-next/tools/install-skills.sh +228 -0
- package/.aodw-next/tools/rt-guard.sh +1589 -0
- package/bin/aodw.js +11 -0
- package/package.json +4 -2
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""交接包格式校验器。
|
|
3
|
+
|
|
4
|
+
用法:
|
|
5
|
+
validate.py <交接包路径> 校验,全过 exit 0
|
|
6
|
+
validate.py <路径> --quiet 只输出失败项
|
|
7
|
+
|
|
8
|
+
退出码:0 通过 / 1 有必须修的问题 / 2 用法错误。
|
|
9
|
+
|
|
10
|
+
设计原则(来自实测教训):
|
|
11
|
+
- 只判**能机械判定**的事。判不了的(下一步能不能动手、会不会误导)明确交回人工。
|
|
12
|
+
- 判到真问题,不判近似物。例:不只查「有没有 rt 字段」,还查它的值是否合法;
|
|
13
|
+
不只查「有没有引用 commit」,还查那些 commit 是否真的存在。
|
|
14
|
+
- 每条判据都要有判别力——写完用「本该失败的样本」验一遍。
|
|
15
|
+
- 前提不成立时明确 skip,不产生假红(见 check_commits 的说明)。
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import re
|
|
21
|
+
import subprocess
|
|
22
|
+
import sys
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
REQUIRED_FIELDS = [
|
|
26
|
+
"title",
|
|
27
|
+
"status",
|
|
28
|
+
"kind",
|
|
29
|
+
"created",
|
|
30
|
+
"last_verified",
|
|
31
|
+
"owners",
|
|
32
|
+
"rt",
|
|
33
|
+
"related_items",
|
|
34
|
+
"scope",
|
|
35
|
+
"related",
|
|
36
|
+
]
|
|
37
|
+
STATUS_VALUES = {"active", "superseded", "archived"}
|
|
38
|
+
# 交接包分两类,正文章节要求不同(见 check_sections):
|
|
39
|
+
# session 工作过程交接——「我做了什么、下一个人接着做什么」,八节缺一不可
|
|
40
|
+
# operations 运维手册交接——「这个系统怎么运维」,结构由内容决定,不套用八节
|
|
41
|
+
KIND_VALUES = {"session", "operations"}
|
|
42
|
+
RELATION_TYPES = {"发现", "认领", "结清", "受阻于", "同族"}
|
|
43
|
+
DATE_RE = re.compile(r"^\d{4}-\d{2}-\d{2}$")
|
|
44
|
+
RT_RE = re.compile(r"^(RT-\d+|none|\[.*\])$")
|
|
45
|
+
# 正文必需章节:关键词任一命中即算该节存在
|
|
46
|
+
REQUIRED_SECTIONS = [
|
|
47
|
+
("一句话", ["一句话", "TL;DR", "摘要"]),
|
|
48
|
+
("做了什么", ["做了什么", "已完成", "工作内容"]),
|
|
49
|
+
("怎么做的", ["怎么做", "怎么查", "方法"]),
|
|
50
|
+
("要解决什么", ["要解决", "希望解决", "为什么做", "问题背景"]),
|
|
51
|
+
("发现了什么", ["发现了什么", "发现的问题", "实证结论"]),
|
|
52
|
+
("下一步", ["下一步", "后续", "计划做什么"]),
|
|
53
|
+
("现状变化", ["现状变化", "现状核实", "落笔前", "接手时的现状"]),
|
|
54
|
+
("接手清单", ["接手清单", "接手步骤", "照着做"]),
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
problems: list[str] = []
|
|
58
|
+
warnings: list[str] = []
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def fail(msg: str) -> None:
|
|
62
|
+
problems.append(msg)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def warn(msg: str) -> None:
|
|
66
|
+
warnings.append(msg)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def split_frontmatter(text: str) -> tuple[str, str]:
|
|
70
|
+
"""返回 (frontmatter 原文, 正文)。无 frontmatter 时前者为空串。"""
|
|
71
|
+
if not text.startswith("---"):
|
|
72
|
+
return "", text
|
|
73
|
+
end = text.find("\n---", 3)
|
|
74
|
+
if end == -1:
|
|
75
|
+
return "", text
|
|
76
|
+
return text[3:end], text[end + 4 :]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def check_frontmatter(fm: str, path: Path) -> None:
|
|
80
|
+
if not fm.strip():
|
|
81
|
+
fail("缺 frontmatter——必须以 `---` 开头(见 references/format-contract.md §一)")
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
# 用 yaml 解析;不可用时降级为逐行提取,保证校验器本身不因环境挂掉
|
|
85
|
+
data: dict = {}
|
|
86
|
+
try:
|
|
87
|
+
import yaml # type: ignore
|
|
88
|
+
|
|
89
|
+
data = yaml.safe_load(fm) or {}
|
|
90
|
+
if not isinstance(data, dict):
|
|
91
|
+
fail("frontmatter 不是 YAML 映射")
|
|
92
|
+
return
|
|
93
|
+
except ImportError:
|
|
94
|
+
for line in fm.splitlines():
|
|
95
|
+
m = re.match(r"^([a-z_]+):\s*(.*)$", line)
|
|
96
|
+
if m:
|
|
97
|
+
data[m.group(1)] = m.group(2).strip()
|
|
98
|
+
warn("未安装 pyyaml,已降级为逐行提取——列表类字段的校验会放宽")
|
|
99
|
+
|
|
100
|
+
for f in REQUIRED_FIELDS:
|
|
101
|
+
if f not in data or data[f] in (None, "", []):
|
|
102
|
+
if f == "related_items" and f in data:
|
|
103
|
+
continue # 空列表合法,但正文要说明;见下方检查
|
|
104
|
+
fail(f"frontmatter 缺必需字段 `{f}`")
|
|
105
|
+
|
|
106
|
+
if (kd := data.get("kind")) and str(kd) not in KIND_VALUES:
|
|
107
|
+
fail(f"`kind` 取值非法:{kd}(合法:{'/'.join(sorted(KIND_VALUES))})")
|
|
108
|
+
|
|
109
|
+
if (st := data.get("status")) and str(st) not in STATUS_VALUES:
|
|
110
|
+
fail(f"`status` 取值非法:{st}(合法:{'/'.join(sorted(STATUS_VALUES))})")
|
|
111
|
+
|
|
112
|
+
for f in ("created", "last_verified"):
|
|
113
|
+
v = data.get(f)
|
|
114
|
+
if v and not DATE_RE.match(str(v)):
|
|
115
|
+
fail(f"`{f}` 必须是 YYYY-MM-DD 格式,当前:{v}")
|
|
116
|
+
|
|
117
|
+
# rt:字段必须存在,但 none 是完全正当的取值——不挂 RT 的会话是常态,
|
|
118
|
+
# 硬凑一个「看起来相关」的编号比留空更浪费接手人的时间。
|
|
119
|
+
rt = data.get("rt")
|
|
120
|
+
if rt is not None:
|
|
121
|
+
rt_s = str(rt) if not isinstance(rt, list) else "[" + ",".join(str(x) for x in rt) + "]"
|
|
122
|
+
if not RT_RE.match(rt_s.replace(" ", "")):
|
|
123
|
+
fail(f"`rt` 取值非法:{rt}(应为 RT-XXX、列表、或 none)")
|
|
124
|
+
if rt_s == "none":
|
|
125
|
+
scope = str(data.get("scope", ""))
|
|
126
|
+
if len(scope.strip()) < 20:
|
|
127
|
+
fail(
|
|
128
|
+
"`rt: none` 完全正当,但请在 `scope` 里一句话说清这是什么性质的工作(当前 scope 过短)"
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# related_items 的关系类型必须在封闭枚举内
|
|
132
|
+
items = data.get("related_items")
|
|
133
|
+
if isinstance(items, list) and items:
|
|
134
|
+
for it in items:
|
|
135
|
+
if isinstance(it, dict):
|
|
136
|
+
for k, v in it.items():
|
|
137
|
+
if str(v).strip() not in RELATION_TYPES:
|
|
138
|
+
fail(
|
|
139
|
+
f"`related_items` 中 {k} 的关系类型非法:{v}(合法:{'/'.join(sorted(RELATION_TYPES))})"
|
|
140
|
+
)
|
|
141
|
+
elif isinstance(it, str) and ":" in it:
|
|
142
|
+
rel = it.split(":", 1)[1].strip()
|
|
143
|
+
if rel not in RELATION_TYPES:
|
|
144
|
+
fail(f"`related_items` 中的关系类型非法:{rel}")
|
|
145
|
+
elif isinstance(items, list) and not items:
|
|
146
|
+
warn("`related_items` 为空——若本次确实无台账/RT 关联,这是正常的,正文一句话说明即可")
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def check_sections(body: str, kind: str) -> None:
|
|
150
|
+
"""章节要求按 kind 分流。
|
|
151
|
+
|
|
152
|
+
- session(工作过程交接):讲「我做了什么、下一个人接着做什么」,八节缺一不可。
|
|
153
|
+
- operations(操作手册交接):讲「这个系统怎么运维」,结构由内容决定
|
|
154
|
+
(怎么部署 / 怎么健康检查 / 出事怎么办),**不套用八节**——强行套会把
|
|
155
|
+
一份好用的手册改坏。只要求它有「接手清单」性质的可操作内容。
|
|
156
|
+
"""
|
|
157
|
+
heads = "\n".join(re.findall(r"^#{2,3}\s+.*$", body, re.M))
|
|
158
|
+
if kind == "operations":
|
|
159
|
+
if len(heads.strip().splitlines()) < 3:
|
|
160
|
+
fail("operations 类交接包正文至少要有 3 个二级/三级小节,便于按场景查阅")
|
|
161
|
+
return
|
|
162
|
+
for label, keys in REQUIRED_SECTIONS:
|
|
163
|
+
if not any(k in heads for k in keys):
|
|
164
|
+
fail(f"正文缺必需章节:{label}(标题里应含 {' / '.join(keys[:2])} 之一)")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def check_commits(text: str, repo: Path | None) -> None:
|
|
168
|
+
"""引用的 commit hash 必须真实存在——防「引用一个不存在的提交」。
|
|
169
|
+
|
|
170
|
+
⚠️ repo 为 None(文档不在 git 仓库内)时**整体跳过并 WARN**,不逐条报 FAIL。
|
|
171
|
+
自检实测教训:把文档复制到临时目录校验时,原实现把每个 commit 都报成「不存在」
|
|
172
|
+
——一次环境不满足产生十余条假红,掩盖了真正被测的那一条。
|
|
173
|
+
判据在前提不成立时必须明确 skip,不能产生假红。
|
|
174
|
+
"""
|
|
175
|
+
hashes = set(re.findall(r"`([0-9a-f]{7,40})`", text))
|
|
176
|
+
if not hashes:
|
|
177
|
+
warn("正文未引用任何 commit hash——交接包通常应给出可回溯的提交")
|
|
178
|
+
return
|
|
179
|
+
if repo is None:
|
|
180
|
+
warn(f"文档不在 git 仓库内,跳过 {len(hashes)} 个 commit 的存在性校验")
|
|
181
|
+
return
|
|
182
|
+
for h in sorted(hashes):
|
|
183
|
+
r = subprocess.run(
|
|
184
|
+
["git", "-C", str(repo), "cat-file", "-t", h],
|
|
185
|
+
capture_output=True,
|
|
186
|
+
text=True,
|
|
187
|
+
)
|
|
188
|
+
if r.returncode != 0 or r.stdout.strip() != "commit":
|
|
189
|
+
fail(f"引用的 commit `{h}` 在仓库中不存在(或不是 commit)")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def check_links(text: str, doc: Path, repo: Path) -> None:
|
|
193
|
+
"""文档内的相对链接必须指向真实存在的文件。"""
|
|
194
|
+
for label, target in re.findall(r"\[([^\]]+)\]\(([^)]+)\)", text):
|
|
195
|
+
if target.startswith(("http://", "https://", "#", "mailto:")):
|
|
196
|
+
continue
|
|
197
|
+
t = target.split("#", 1)[0]
|
|
198
|
+
if not t:
|
|
199
|
+
continue
|
|
200
|
+
cand = (doc.parent / t), (repo / t)
|
|
201
|
+
if not any(p.exists() for p in cand):
|
|
202
|
+
fail(f"链接指向的文件不存在:[{label}]({target})")
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def main(argv: list[str]) -> int:
|
|
206
|
+
args = [a for a in argv[1:] if not a.startswith("--")]
|
|
207
|
+
quiet = "--quiet" in argv
|
|
208
|
+
if len(args) != 1:
|
|
209
|
+
print(__doc__.strip().splitlines()[2].strip(), file=sys.stderr)
|
|
210
|
+
print("用法:validate.py <交接包路径> [--quiet]", file=sys.stderr)
|
|
211
|
+
return 2
|
|
212
|
+
|
|
213
|
+
doc = Path(args[0]).resolve()
|
|
214
|
+
if not doc.is_file():
|
|
215
|
+
print(f"文件不存在:{doc}", file=sys.stderr)
|
|
216
|
+
return 2
|
|
217
|
+
|
|
218
|
+
r = subprocess.run(
|
|
219
|
+
["git", "-C", str(doc.parent), "rev-parse", "--show-toplevel"],
|
|
220
|
+
capture_output=True,
|
|
221
|
+
text=True,
|
|
222
|
+
)
|
|
223
|
+
# 定位不到仓库根就传 None——让 commit 校验明确跳过,而不是逐条误报
|
|
224
|
+
repo = Path(r.stdout.strip()) if r.returncode == 0 and r.stdout.strip() else None
|
|
225
|
+
|
|
226
|
+
text = doc.read_text(encoding="utf-8")
|
|
227
|
+
fm, body = split_frontmatter(text)
|
|
228
|
+
|
|
229
|
+
kind = "session"
|
|
230
|
+
m = re.search(r"^kind:\s*(\w+)", fm, re.M)
|
|
231
|
+
if m:
|
|
232
|
+
kind = m.group(1)
|
|
233
|
+
|
|
234
|
+
check_frontmatter(fm, doc)
|
|
235
|
+
check_sections(body, kind)
|
|
236
|
+
check_commits(body, repo)
|
|
237
|
+
check_links(body, doc, repo or doc.parent)
|
|
238
|
+
|
|
239
|
+
if not quiet:
|
|
240
|
+
print(f"交接包校验 — {doc.name}\n")
|
|
241
|
+
for w in warnings:
|
|
242
|
+
print(f" \033[33mWARN\033[0m {w}")
|
|
243
|
+
for p in problems:
|
|
244
|
+
print(f" \033[31mFAIL\033[0m {p}")
|
|
245
|
+
|
|
246
|
+
if problems:
|
|
247
|
+
print(f"\n 合计 FAIL={len(problems)} WARN={len(warnings)}")
|
|
248
|
+
print(" ⚠️ 校验不过就不算写完。规则见 references/format-contract.md")
|
|
249
|
+
return 1
|
|
250
|
+
|
|
251
|
+
if not quiet:
|
|
252
|
+
print(f" \033[32mPASS\033[0m 格式校验全过(WARN={len(warnings)})\n")
|
|
253
|
+
print(" ⚠️ 脚本查不了这两件事,请人工过一遍:")
|
|
254
|
+
print(" 1. §下一步 的每一条,接手的人照着能不能直接动手?")
|
|
255
|
+
print(" 2. §现状变化 读完会不会被误导?")
|
|
256
|
+
return 0
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
if __name__ == "__main__":
|
|
260
|
+
sys.exit(main(sys.argv))
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: <一句话说清这是什么工作的交接包>
|
|
3
|
+
status: active
|
|
4
|
+
kind: session # session=工作过程交接(本模板);operations=运维手册型,不套用八节
|
|
5
|
+
created: YYYY-MM-DD
|
|
6
|
+
last_verified: YYYY-MM-DD
|
|
7
|
+
owners: [<项目或团队标识>]
|
|
8
|
+
rt: RT-XXX # 会话在某 RT 里进行就填它;跨多个写 [RT-A, RT-B];
|
|
9
|
+
# 不挂 RT 就写 none——这是常态不是缺陷,别硬凑编号
|
|
10
|
+
related_items: # 与台账/RT 的关联。关系类型限:发现/认领/结清/受阻于/同族
|
|
11
|
+
# 确实没有关联就写 [],正文一句话说明即可
|
|
12
|
+
- DI-0XX: 认领
|
|
13
|
+
- RT-YYY: 同族
|
|
14
|
+
scope: >
|
|
15
|
+
两三句话:这份交接包覆盖哪段工作、写给谁看、读者最该先看哪一节。
|
|
16
|
+
若 rt 为 none,这里一句话说清工作性质(轻量车道 / 台账整理 / 工具改进 / 纯讨论 …)。
|
|
17
|
+
related:
|
|
18
|
+
- 路径/到/关键文件.py # 每条带注释说明为什么相关
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# <标题>
|
|
22
|
+
|
|
23
|
+
> 交接对象:<下一个接手的人 / worker agent>
|
|
24
|
+
> 落笔日期:YYYY-MM-DD | 工作发生于 YYYY-MM-DD ~ YYYY-MM-DD
|
|
25
|
+
> **落笔前已重新核实仓库现状**,差异见 §6——那节最重要,先读它。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 0. 一句话
|
|
30
|
+
|
|
31
|
+
<不看别的、只读这段就知道发生了什么。一到三句。>
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 1. 我们之前做了什么
|
|
36
|
+
|
|
37
|
+
<按时间或主题列。每项带 commit hash。>
|
|
38
|
+
|
|
39
|
+
### 1.1 起点:<为什么开始做这件事>
|
|
40
|
+
|
|
41
|
+
### 1.2 <做的第一件事>(commit `xxxxxxx`)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 2. 我们是怎么做的、怎么查的
|
|
46
|
+
|
|
47
|
+
**这一节是方法论,比结论更值得复用。**
|
|
48
|
+
|
|
49
|
+
<用什么命令查的、怎么验证的、踩过什么坑。写成下一个人能照着做的形式。>
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 可直接复制运行的命令
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 3. 我们希望解决的问题是什么
|
|
58
|
+
|
|
59
|
+
<为什么做这件事。没有这节,接手的人会把手段当目的。>
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 4. 当前我们发现了什么问题
|
|
64
|
+
|
|
65
|
+
<实证结论。每条带证据:file:line(附关键词)/ 命令输出 / commit hash。>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 5. 下一步我们计划做什么
|
|
70
|
+
|
|
71
|
+
**每一条都要能直接动手**:改哪个文件、跑什么命令、预期什么结果。
|
|
72
|
+
|
|
73
|
+
| 建议 | 具体做什么 | 改动量 |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| | | |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 6. 你接手时的现状变化(**最重要,先读这节**)
|
|
80
|
+
|
|
81
|
+
<落笔前重新核实的结果,与工作发生时的差异。**无差异也要显式写「已复核,无变化」**。>
|
|
82
|
+
|
|
83
|
+
<典型要核的:引用的 file:line 是否漂移、commit 是否还在、声称已解决的是否真解决、
|
|
84
|
+
目录结构是否被重构、相关 RT/DI 的状态是否变了。>
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 7. 接手清单(照着做)
|
|
89
|
+
|
|
90
|
+
1. **先确认环境**:<有环境陷阱就写在第一条>
|
|
91
|
+
2. …
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 8. 相关提交索引
|
|
96
|
+
|
|
97
|
+
| commit | 内容 |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `xxxxxxx` | |
|
|
@@ -28,12 +28,11 @@
|
|
|
28
28
|
|---------|---------|------|
|
|
29
29
|
| **创建新 RT** | {{REF_PREFIX}}.aodw-next/02-workflow/rt-manager.md (Sec 1-4, 8-9)<br/>{{REF_PREFIX}}.aodw-next/01-core/ai-knowledge-rules.md (Sec 3.1)<br/>{{REF_PREFIX}}.aodw-next/01-core/ai-interaction-rules.md (Sec 1-4) | 生成 RT-ID,创建目录,Intake 流程 |
|
|
30
30
|
| **选择模式** | {{REF_PREFIX}}.aodw-next/02-workflow/rt-manager.md (Sec 5)<br/>{{REF_PREFIX}}.aodw-next/02-workflow/spec-full-profile.md<br/>{{REF_PREFIX}}.aodw-next/02-workflow/spec-lite-profile.md | 决策 Spec-Full/Spec-Lite,创建分支 |
|
|
31
|
-
| **Spec-Lite Autopilot** | {{REF_PREFIX}}.aodw-next/02-workflow/spec-lite-autopilot-profile.md<br/>{{REF_PREFIX}}.aodw-next/02-workflow/autopilot-protocol.md<br/>{{REF_PREFIX}}.aodw-next/02-workflow/rt-autopilot-readiness.md<br/>{{REF_PREFIX}}.aodw-next/01-core/git-discipline.md | 全自动:机械 Gate + Ralph 循环;强制 7 件套(含 autopilot-preflight.md) |
|
|
32
31
|
| **工具初始化** | {{REF_PREFIX}}.aodw-next/05-tooling/ai-tools-init-rules.md | 初始化开发工具(ESLint、Prettier、Ruff、Black 等) |
|
|
33
32
|
| **项目概览初始化** | {{REF_PREFIX}}.aodw-next/01-core/ai-project-overview-rules.md | 初始化或完善项目概览信息(技术栈、架构、模块等) |
|
|
34
33
|
| **分析阶段** | {{REF_PREFIX}}.aodw-next/03-standards/ai-coding-rules.md (Sec 2-3)<br/>{{REF_PREFIX}}.aodw-next/01-core/ai-knowledge-rules.md (Sec 3.4) | 影响分析、不变量检查,更新 impact.md, invariants.md |
|
|
35
34
|
| **实现阶段** | {{REF_PREFIX}}.aodw-next/03-standards/ai-coding-rules.md (Sec 6)<br/>{{REF_PREFIX}}.aodw-next/01-core/ai-knowledge-rules.md (Sec 3.5)<br/>{{REF_PREFIX}}.aodw-next/01-core/module-doc-rules.md | 代码实现、测试编写、模块文档更新 |
|
|
36
|
-
| **验证阶段** | {{REF_PREFIX}}.aodw-next/01-core/ai-knowledge-rules.md (Sec 5) | 验证文档与代码一致,检查 RT
|
|
35
|
+
| **验证阶段** | {{REF_PREFIX}}.aodw-next/01-core/ai-knowledge-rules.md (Sec 5)<br/>{{REF_PREFIX}}.aodw-next/01-core/test-discipline.md | 验证文档与代码一致,检查 RT 完整性;按判据纪律写验收判据(判据 / AI 评审 / 读产出三格) |
|
|
37
36
|
| **CSF 审查** | {{REF_PREFIX}}.aodw-next/01-core/csf-thinking-framework.md | 执行 CSF 思维框架审查(以终为始、结构化分解、关键要素识别等) |
|
|
38
37
|
| **执行需求审计** | {{REF_PREFIX}}.aodw-next/04-auditors/aodw-requirement-auditor-rules.md | 调用需求阶段审计官,对需求文档进行审计(自动触发或手动触发) |
|
|
39
38
|
| **执行开发审计** | {{REF_PREFIX}}.aodw-next/04-auditors/aodw-development-auditor-rules.md | 调用开发阶段审计官,对代码进行审计(自动触发或手动触发) |
|
|
@@ -58,8 +57,8 @@
|
|
|
58
57
|
- 在修改代码前必须验证当前分支
|
|
59
58
|
|
|
60
59
|
### 4.2 Plan 批准节点(必须)
|
|
61
|
-
- Plan
|
|
62
|
-
- Plan
|
|
60
|
+
- Plan 完成后执行 CSF 审查:Spec-Full 必须执行;Spec-Lite 可选但推荐
|
|
61
|
+
- Plan 批准前通过 CSF 审查:Spec-Full 必须通过;Spec-Lite 可选但推荐
|
|
63
62
|
- 严禁未获批准前开始修改代码
|
|
64
63
|
|
|
65
64
|
### 4.3 提交前确认(必须)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- [ ] `.aodw-next/06-project/modules-index.yaml` 已深度初始化
|
|
10
10
|
- [ ] tests 命令:`________________`(可执行,exit 0/非0 可解释)
|
|
11
11
|
- [ ] lint 命令:`________________`
|
|
12
|
-
- [ ] guard 命令:`
|
|
12
|
+
- [ ] guard 命令:`bash .aodw-next/tools/rt-guard.sh --root .`
|
|
13
13
|
|
|
14
14
|
## 2) RT 准备
|
|
15
15
|
|
|
@@ -19,12 +19,30 @@ profile: Spec-Lite
|
|
|
19
19
|
execution_mode: <user-confirmed: collaborative | autopilot>
|
|
20
20
|
|
|
21
21
|
# 当前状态
|
|
22
|
-
#
|
|
22
|
+
#
|
|
23
|
+
# 进行中:created | intaking | decided | in-progress | reviewing
|
|
24
|
+
# 终态 :done | abandoned | parked-design-only
|
|
25
|
+
# 暂停 :paused(可重启,见 rt-manager.md §3.4 「可复用」一条)
|
|
26
|
+
#
|
|
27
|
+
# parked-design-only 是**终态**,不是暂停:本 RT 是设计记录 / 讨论归档 /
|
|
28
|
+
# 方案储备,从未打算进入实现——典型如 RT-071(GNAP 协议吸收方案)、
|
|
29
|
+
# RT-097(章节依赖快照设计)。用 paused 会让它们在每次「还有什么没做完」
|
|
30
|
+
# 的盘点里反复出现,而答案永远是「本来就不会做」。
|
|
31
|
+
#
|
|
32
|
+
# 2026-08-20 补记:本列表此前只有 6 个值,而实际在用的有
|
|
33
|
+
# abandoned / paused / parked-design-only 三个未登记项。模板落后于实际,
|
|
34
|
+
# 会让新建 RT 的人以为只能在 6 个里选。rt-guard 不校验本枚举
|
|
35
|
+
# (只有 G111 按 status==done 判定复盘 Gate),所以是文档问题不是门禁问题。
|
|
23
36
|
status: created
|
|
24
37
|
|
|
25
38
|
# 涉及的业务/技术模块标识,来自你的模块体系(例如 orders / users / auth 等)
|
|
26
39
|
modules: []
|
|
27
40
|
|
|
41
|
+
# Git 分支与 worktree(Decision 阶段创建后立即回填,见 git-discipline.md §2)
|
|
42
|
+
# status 为 in-progress/reviewing 但这两个字段为空,会导致 §2.1/§2.5 的并行冲突检查和孤儿分支巡检失效
|
|
43
|
+
branch: null # 例如 feature/RT-XXX-short-name
|
|
44
|
+
worktree: null # 例如 .claude/worktrees/RT-XXX-short-name
|
|
45
|
+
|
|
28
46
|
# 当前主要执行工具:cursor / claude / mixed / unknown
|
|
29
47
|
tool: unknown
|
|
30
48
|
|
|
@@ -44,6 +62,17 @@ external_ids:
|
|
|
44
62
|
github: null
|
|
45
63
|
other: null
|
|
46
64
|
|
|
65
|
+
# 遗留事项(DI)台账联动。约定见 rt-manager.md §3.4b-2。
|
|
66
|
+
# **没转出 / 没认领就不要写这两个字段**——字段缺失即判据不适用(G114/G115 返回
|
|
67
|
+
# PASS 并说明「无声明可校验」),未采用台账约定的项目行为完全不变。
|
|
68
|
+
# 转出:本 RT 发现、并已写入 RT/_deferred-items.md 的 DI 编号。
|
|
69
|
+
# G114 校验:编号在台账须有条目,且该条目「发现于」属于本 RT。
|
|
70
|
+
# 认领:本 RT 从台账拿走继续做的 DI 编号。
|
|
71
|
+
# G115 校验:台账该条目的「状态」值单元格须已写明本 RT-ID,且不能仍是「未认领」。
|
|
72
|
+
# 只认这两个结构化字段的列表值;注释里出现的 DI 编号不会被当成声明。
|
|
73
|
+
# deferred_items_raised: []
|
|
74
|
+
# deferred_items_claimed: []
|
|
75
|
+
|
|
47
76
|
# 额外说明(可选,供人和 AI 阅读)
|
|
48
77
|
notes: >
|
|
49
78
|
在这里简要描述本 RT 的背景、限制或特殊说明。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
this is not json at all { broken
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"session_id": "fixture-session-0001",
|
|
3
|
+
"transcript_path": "/tmp/fixture-transcript.jsonl",
|
|
4
|
+
"cwd": "/tmp/fixture-cwd",
|
|
5
|
+
"prompt_id": "fixture-prompt-0001",
|
|
6
|
+
"permission_mode": "auto",
|
|
7
|
+
"agent_id": "fixture-agent-0001",
|
|
8
|
+
"agent_type": "general-purpose",
|
|
9
|
+
"effort": { "level": "xhigh" },
|
|
10
|
+
"hook_event_name": "PreToolUse",
|
|
11
|
+
"tool_name": "Bash",
|
|
12
|
+
"tool_input": {
|
|
13
|
+
"command": "echo \"fixture benign probe\"",
|
|
14
|
+
"description": "fixture: benign command"
|
|
15
|
+
},
|
|
16
|
+
"tool_use_id": "toolu_fixture0002"
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"session_id": "fixture-session-0001",
|
|
3
|
+
"transcript_path": "/tmp/fixture-transcript.jsonl",
|
|
4
|
+
"cwd": "/tmp/fixture-cwd",
|
|
5
|
+
"prompt_id": "fixture-prompt-0001",
|
|
6
|
+
"permission_mode": "auto",
|
|
7
|
+
"agent_id": "fixture-agent-0001",
|
|
8
|
+
"agent_type": "general-purpose",
|
|
9
|
+
"effort": { "level": "xhigh" },
|
|
10
|
+
"hook_event_name": "PreToolUse",
|
|
11
|
+
"tool_name": "Bash",
|
|
12
|
+
"tool_input": {
|
|
13
|
+
"command": "git -C /tmp/some-repo commit --allow-empty -m \"fixture bypass variant\"",
|
|
14
|
+
"description": "fixture: git -C variant commit"
|
|
15
|
+
},
|
|
16
|
+
"tool_use_id": "toolu_fixture0001"
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"session_id": "fixture-session-0001",
|
|
3
|
+
"transcript_path": "/tmp/fixture-transcript.jsonl",
|
|
4
|
+
"cwd": "/tmp/fixture-cwd",
|
|
5
|
+
"prompt_id": "fixture-prompt-0001",
|
|
6
|
+
"permission_mode": "auto",
|
|
7
|
+
"effort": { "level": "xhigh" },
|
|
8
|
+
"hook_event_name": "Stop",
|
|
9
|
+
"stop_hook_active": true,
|
|
10
|
+
"last_assistant_message": "fixture: second stop round",
|
|
11
|
+
"background_tasks": [],
|
|
12
|
+
"session_crons": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"session_id": "fixture-session-0001",
|
|
3
|
+
"transcript_path": "/tmp/fixture-transcript.jsonl",
|
|
4
|
+
"cwd": "/tmp/fixture-cwd",
|
|
5
|
+
"prompt_id": "fixture-prompt-0001",
|
|
6
|
+
"permission_mode": "auto",
|
|
7
|
+
"effort": { "level": "xhigh" },
|
|
8
|
+
"hook_event_name": "Stop",
|
|
9
|
+
"stop_hook_active": false,
|
|
10
|
+
"last_assistant_message": "fixture: first stop round",
|
|
11
|
+
"background_tasks": [],
|
|
12
|
+
"session_crons": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# RT 索引(fixture 最小形态:G101 存量回填豁免的三态锚点)
|
|
2
|
+
# 条目缩进形态对齐真实 index.yaml:`entries:` 之下 `- id:` 顶格。
|
|
3
|
+
schema: rt-index-v1
|
|
4
|
+
entries:
|
|
5
|
+
- id: RT-701
|
|
6
|
+
title: 存量回填条目——带 backfill 键,G101 六值约束豁免
|
|
7
|
+
backfill: rt125-u4
|
|
8
|
+
- id: RT-702
|
|
9
|
+
title: 新 RT 条目——不带 backfill 键,G101 照常硬失败
|
|
10
|
+
- id: RT-999
|
|
11
|
+
title: 无关条目,仅用于确认 awk 块扫描在下一个 `- id:` 处正确收尾
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# fixture 任务包 — G113 合并计数口径锚点(root-g113 / RT-135 U2)
|
|
2
|
+
|
|
3
|
+
## 1. 已定决策
|
|
4
|
+
|
|
5
|
+
合并 b 记净减少条数:n 条并作 1 条记 n−1(裁定 001 措辞 A)。
|
|
6
|
+
|
|
7
|
+
## 3. 出口判据
|
|
8
|
+
|
|
9
|
+
> 溯源:rt-plan.md v1 U9 判据 10 条 → 本包 9 条(新增 0、合并 1、删除 0)
|
|
10
|
+
|
|
11
|
+
声明口径锚点:上游 10 条,其中 2 条并作 1 条(净减少 1),本包 9 条,
|
|
12
|
+
加减账 10 + 0 − 1 − 0 = 9 自洽,应判 PASS。
|