@namewta/speculo 1.0.2 → 1.0.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/README.md +8 -3
- package/package.json +2 -2
- package/template/AGENTS.md +3 -1
- package/template/canonical/canonical-specdev-goal-plan.md +757 -225
- package/template/canonical/canonical-specdev-grill-with-docs.md +221 -133
- package/template/canonical/canonical-specdev-spec.md +73 -3
- package/template/canonical/canonical-specdev-tickets.md +681 -252
- package/template/canonical/canonical-specdev-wayfinder.md +330 -113
- package/template/commands/archive-and-consolidate.md +39 -3
- package/template/commands/git-history-squash.md +76 -0
- package/template/commands/git-repository-audit.md +3 -602
- package/template/commands/references/git-repository-audit-procedure.md +608 -0
- package/template/skills/archive-and-consolidate/SKILL.md +1 -1
- package/template/skills/archive-and-consolidate/references/entry-procedure.md +11 -3
- package/template/skills/git-history-squash/SKILL.md +2 -0
- package/template/skills/git-history-squash/references/entry-procedure.md +1 -1
- package/template/skills/writing-great-skills/SKILL.md +2 -0
- package/template/skills/writing-great-skills/references/document-contract.md +23 -0
- package/template/workflows/learning/common/rules/activation-and-memory.md +7 -3
- package/template/workflows/ops/common/rules/activation-and-memory.md +7 -3
- package/template/workflows/person/common/rules/activation-and-memory.md +7 -3
- package/template/workflows/specdev/G-grill-with-docs/G-grill-with-docs.md +13 -136
- package/template/workflows/specdev/G-grill-with-docs/references/interview-procedure.md +134 -0
- package/template/workflows/specdev/I-implement/I-implement.md +15 -189
- package/template/workflows/specdev/I-implement/evidence-template.md +12 -0
- package/template/workflows/specdev/I-implement/execution-preflight.md +1 -1
- package/template/workflows/specdev/I-implement/references/implementation-procedure.md +192 -0
- package/template/workflows/specdev/P-goal-plan/P-goal-plan.md +28 -143
- package/template/workflows/specdev/P-goal-plan/completion-control.md +1 -1
- package/template/workflows/specdev/P-goal-plan/references/goal-lifecycle.md +35 -0
- package/template/workflows/specdev/P-goal-plan/references/goal-tickets-map-template.md +15 -0
- package/template/workflows/specdev/P-goal-plan/references/map-control.md +28 -0
- package/template/workflows/specdev/{O-orchestrate-implementation/O-orchestrate-implementation.md → P-goal-plan/references/multi-change-plan.md} +21 -33
- package/template/workflows/specdev/P-goal-plan/references/replan-and-recovery.md +21 -0
- package/template/workflows/specdev/P-goal-plan/references/single-change-plan.md +149 -0
- package/template/workflows/specdev/R-review-architecture/R-review-architecture.md +48 -53
- package/template/workflows/specdev/R-review-architecture/architecture-review-template.md +19 -10
- package/template/workflows/specdev/R-review-architecture/proposal-to-ticket.md +3 -1
- package/template/workflows/specdev/R-review-architecture/review-rubric.md +52 -0
- package/template/workflows/specdev/README.md +36 -216
- package/template/workflows/specdev/T-tickets/T-tickets.md +19 -230
- package/template/workflows/specdev/T-tickets/references/planning-procedure.md +233 -0
- package/template/workflows/specdev/T-tickets/ticket-template.md +16 -0
- package/template/workflows/specdev/T-tickets/tickets-map-template.md +14 -0
- package/template/workflows/specdev/T-triage/T-triage.md +3 -1
- package/template/workflows/specdev/W-wayfinder/W-wayfinder.md +24 -118
- package/template/workflows/specdev/W-wayfinder/references/initiative-discovery.md +29 -0
- package/template/workflows/specdev/W-wayfinder/references/initiative-template.json +8 -0
- package/template/workflows/specdev/W-wayfinder/references/map-traversal.md +120 -0
- package/template/workflows/specdev/W-wayfinder/wayfinder-map-template.md +4 -0
- package/template/workflows/specdev/common/README.md +1 -1
- package/template/workflows/specdev/common/rules/activation-and-memory.md +7 -3
- package/template/workflows/specdev/common/rules/artifact-contract.md +10 -2
- package/template/workflows/specdev/common/rules/operating-governance.md +38 -0
- package/template/workflows/specdev/common/rules/parent-implementation-orchestration.md +6 -2
- package/template/workflows/specdev/common/rules/skill-invocation.md +27 -0
- package/template/workflows/specdev/common/rules/workflow-routing.md +24 -0
- package/template/workflows/specdev/common/rules/workflow-state-and-lifecycle.md +93 -0
- package/template/workflows/specdev/common/schemas/goal-tickets-map.schema.json +33 -0
- package/template/workflows/specdev/common/schemas/initiative.schema.json +94 -0
- package/template/workflows/specdev/common/schemas/ticket.schema.json +168 -1
- package/template/workflows/specdev/common/schemas/tickets-map.schema.json +74 -6
- package/template/workflows/specdev/common/skills/code-review/SKILL.md +3 -2
- package/template/workflows/specdev/common/skills/code-review/references/risk-review.md +25 -0
- package/template/workflows/specdev/common/skills/plan-quality-review/SKILL.md +10 -0
- package/template/workflows/specdev/common/skills/plan-quality-review/references/checklist.md +13 -0
- package/template/workflows/specdev/common/skills/subagent-delivery/SKILL.md +5 -83
- package/template/workflows/specdev/common/skills/subagent-delivery/references/dispatch-and-accept.md +87 -0
- package/template/workflows/specdev/common/tools/README.md +14 -2
- package/template/workflows/specdev/common/tools/plan-contract.mjs +256 -0
- package/template/workflows/specdev/common/tools/ticket-control.mjs +251 -0
- package/template/workflows/specdev/common/tools/validate-specdev.mjs +58 -40
- package/template/workflows/specdev/manifest.json +97 -1
- package/template/canonical/canonical-specdev-orchestrate-implementation.md +0 -2839
- package/template/workflows/specdev/O-orchestrate-implementation/implementation-evidence-template.md +0 -39
- package/template/workflows/specdev/O-orchestrate-implementation/implementation-map-template.md +0 -50
- package/template/workflows/specdev/O-orchestrate-implementation/implementation-plan-template.md +0 -61
- package/template/workflows/specdev/R-review-architecture/architecture-report-contract.md +0 -123
- package/template/workflows/specdev/R-review-architecture/architecture-review-report-template.html +0 -106
- /package/template/workflows/specdev/{O-orchestrate-implementation/conflict-and-drift.md → P-goal-plan/references/multi-conflict-and-drift.md} +0 -0
- /package/template/workflows/specdev/{O-orchestrate-implementation/execution-loop.md → P-goal-plan/references/multi-execution-loop.md} +0 -0
- /package/template/workflows/specdev/{O-orchestrate-implementation/input-readiness.md → P-goal-plan/references/multi-input-readiness.md} +0 -0
- /package/template/workflows/specdev/{O-orchestrate-implementation/super-dag.md → P-goal-plan/references/multi-super-dag.md} +0 -0
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
# Git 审计完整采集与报告协议
|
|
2
|
+
|
|
3
|
+
仅在 git-repository-audit 被选择且准备采集/计算/形成报告时完整读取;这不是新的 command。
|
|
4
|
+
|
|
5
|
+
## 输入选择
|
|
6
|
+
|
|
7
|
+
从用户自然语言解析:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
start_time: "YYYY-MM-DD HH:mm:ss"
|
|
11
|
+
end_time: "YYYY-MM-DD HH:mm:ss"
|
|
12
|
+
timezone: "Asia/Shanghai"
|
|
13
|
+
|
|
14
|
+
repositories:
|
|
15
|
+
mode: all # all | selected
|
|
16
|
+
include: [] # project_root 相对路径
|
|
17
|
+
exclude: []
|
|
18
|
+
|
|
19
|
+
branches:
|
|
20
|
+
mode: default # default | selected | all-local | all-refs
|
|
21
|
+
include: []
|
|
22
|
+
primary_branch: ""
|
|
23
|
+
|
|
24
|
+
authors:
|
|
25
|
+
mode: all # all | selected
|
|
26
|
+
include: [] # 作者名字
|
|
27
|
+
exclude: []
|
|
28
|
+
exclude_bots: true
|
|
29
|
+
|
|
30
|
+
paths:
|
|
31
|
+
include: []
|
|
32
|
+
exclude:
|
|
33
|
+
- ".git/**"
|
|
34
|
+
- "<Path>{roots.state}/**</Path>"
|
|
35
|
+
- ".venv/**"
|
|
36
|
+
- "node_modules/**"
|
|
37
|
+
- "vendor/**"
|
|
38
|
+
- "dist/**"
|
|
39
|
+
- "build/**"
|
|
40
|
+
- "coverage/**"
|
|
41
|
+
- "*.min.js"
|
|
42
|
+
- "*.map"
|
|
43
|
+
- "*.lock"
|
|
44
|
+
|
|
45
|
+
options:
|
|
46
|
+
include_merge_commits: true
|
|
47
|
+
include_commit_body: true
|
|
48
|
+
include_raw_commit_appendix: true
|
|
49
|
+
weekly_breakdown: true
|
|
50
|
+
monthly_breakdown: true
|
|
51
|
+
top_n: 20
|
|
52
|
+
topic: git-audit
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
默认与阻塞规则:
|
|
56
|
+
|
|
57
|
+
1. 时区缺失时使用 `Asia/Shanghai`。
|
|
58
|
+
2. 仓库缺失时选择全部发现仓库。
|
|
59
|
+
3. refs 缺失时选择每个仓库主分支的可达历史。
|
|
60
|
+
4. 作者缺失时选择全部作者名字并排除可识别机器人。
|
|
61
|
+
5. 开始或结束时间缺失时:
|
|
62
|
+
- 只完成仓库发现;
|
|
63
|
+
- 展示各仓库最早、最新提交;
|
|
64
|
+
- 一次性询问缺失时间;
|
|
65
|
+
- 时间确认前不采集完整历史、不创建正式报告。
|
|
66
|
+
6. 纯日期的开始边界为 `00:00:00`,结束边界为 `23:59:59`,两端包含。
|
|
67
|
+
7. 指定仓库、ref 或作者名字未命中时停止并列出未命中项,不静默忽略。
|
|
68
|
+
|
|
69
|
+
## 作者身份
|
|
70
|
+
|
|
71
|
+
作者身份只使用 Git Author Name,即 `%an`。
|
|
72
|
+
|
|
73
|
+
身份键为“Unicode NFC 后去除首尾空白的作者名字”。
|
|
74
|
+
|
|
75
|
+
- 不读取、展示或使用邮箱;
|
|
76
|
+
- 不使用 `.mailmap`;
|
|
77
|
+
- 不调用 `git check-mailmap`;
|
|
78
|
+
- 同名合并为同一作者;
|
|
79
|
+
- 不同名字视为不同作者;
|
|
80
|
+
- 保持大小写,不猜测别名。
|
|
81
|
+
|
|
82
|
+
机器人只按名字识别,如 `[bot]`、`dependabot`、`renovate`、`github-actions`、`automation` 或明显的 `bot` 名称。
|
|
83
|
+
|
|
84
|
+
报告必须注明:同名可能误合并,同一人的不同名字可能被拆分。
|
|
85
|
+
|
|
86
|
+
## 执行
|
|
87
|
+
|
|
88
|
+
### 1. 解析 Speculo 工作区
|
|
89
|
+
|
|
90
|
+
1. 从当前目录向上寻找 `<Path>{roots.state}/workspace.json</Path>`。
|
|
91
|
+
2. 第一个命中的目录为 `project_root`;多个候选或用户目录不一致时停止消歧。
|
|
92
|
+
3. 验证 `workspace.json`:
|
|
93
|
+
- 非空且是有效 JSON;
|
|
94
|
+
- `path_base` 为 `project-root`;
|
|
95
|
+
- roots 是 POSIX 项目相对路径。
|
|
96
|
+
4. 读取 `<Path>{roots.config}</Path>`。
|
|
97
|
+
5. 任一初始化文件缺失、为空或不可解析时,停止并提示运行:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
speculo init
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
完成标准:`project_root`、`roots.state` 和最终报告目录只有一个解析结果。
|
|
104
|
+
|
|
105
|
+
### 2. 检查工具
|
|
106
|
+
|
|
107
|
+
执行并记录:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git --version
|
|
111
|
+
uv --version
|
|
112
|
+
uv run --no-project python -V
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
报告声明:
|
|
116
|
+
|
|
117
|
+
- 仅分析本地历史;
|
|
118
|
+
- 未执行 fetch;
|
|
119
|
+
- Git、uv、Python 版本;
|
|
120
|
+
- 生成时间和时区。
|
|
121
|
+
|
|
122
|
+
完成标准:Git 与 uv 可用,Python 由 uv 成功启动。
|
|
123
|
+
|
|
124
|
+
### 3. 发现仓库
|
|
125
|
+
|
|
126
|
+
用标准库脚本扫描 `project_root`,识别:
|
|
127
|
+
|
|
128
|
+
- 根目录仓库;
|
|
129
|
+
- `.git/` 目录;
|
|
130
|
+
- worktree/submodule 的 `.git` 文件;
|
|
131
|
+
- 嵌套仓库。
|
|
132
|
+
|
|
133
|
+
遍历时默认剪枝:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
.git
|
|
137
|
+
<Path>{roots.state}</Path>
|
|
138
|
+
.venv
|
|
139
|
+
node_modules
|
|
140
|
+
vendor
|
|
141
|
+
dist
|
|
142
|
+
build
|
|
143
|
+
coverage
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
对候选执行:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
git -C "<candidate>" rev-parse --is-inside-work-tree
|
|
150
|
+
git -C "<candidate>" rev-parse --show-toplevel
|
|
151
|
+
git -C "<candidate>" rev-parse --is-bare-repository
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
按真实仓库根路径去重。每个仓库记录:
|
|
155
|
+
|
|
156
|
+
- 名称和项目相对路径;
|
|
157
|
+
- bare/worktree/submodule 信号;
|
|
158
|
+
- 当前分支和主分支;
|
|
159
|
+
- 本地分支、远端跟踪分支、标签数量;
|
|
160
|
+
- 最早和最新提交;
|
|
161
|
+
- `git status --short` 摘要;
|
|
162
|
+
- remote 名称与脱敏地址;
|
|
163
|
+
- 分析开始时 HEAD;
|
|
164
|
+
- 选中 refs 的 tip 哈希。
|
|
165
|
+
|
|
166
|
+
主分支按以下顺序识别:
|
|
167
|
+
|
|
168
|
+
1. 用户指定;
|
|
169
|
+
2. `refs/remotes/origin/HEAD`;
|
|
170
|
+
3. `main`;
|
|
171
|
+
4. `master`;
|
|
172
|
+
5. `develop`;
|
|
173
|
+
6. 当前分支;
|
|
174
|
+
7. 最近提交最新的本地分支。
|
|
175
|
+
|
|
176
|
+
无法可靠确定时阻塞该仓库,不猜测。
|
|
177
|
+
|
|
178
|
+
完成标准:仓库列表去重,每个仓库有明确成功/失败状态和项目相对路径。
|
|
179
|
+
|
|
180
|
+
### 4. 确定 revision scope
|
|
181
|
+
|
|
182
|
+
- `default`:主分支可达历史;
|
|
183
|
+
- `selected`:用户指定 refs;
|
|
184
|
+
- `all-local`:全部本地分支;
|
|
185
|
+
- `all-refs`:本地与远端跟踪 refs。
|
|
186
|
+
|
|
187
|
+
多个 refs 含同一 commit 时,按“仓库 + 完整哈希”去重。
|
|
188
|
+
|
|
189
|
+
默认使用 Committer Date 过滤和统计,同时保留 Author Date 用于异常分析。
|
|
190
|
+
|
|
191
|
+
完成标准:每个纳入仓库都有明确 refs、tip 快照、时间范围和时区。
|
|
192
|
+
|
|
193
|
+
### 5. 采集 Git 原始数据
|
|
194
|
+
|
|
195
|
+
Commit 元数据:
|
|
196
|
+
|
|
197
|
+
- 完整/短哈希;
|
|
198
|
+
- 父提交与父数量;
|
|
199
|
+
- Author Name;
|
|
200
|
+
- Author Date;
|
|
201
|
+
- Committer Date;
|
|
202
|
+
- subject、body、refs;
|
|
203
|
+
- merge、revert、机器人标记;
|
|
204
|
+
- 是否位于主分支 first-parent。
|
|
205
|
+
|
|
206
|
+
使用记录分隔符和字段分隔符解析 `git log`,不得解析终端对齐表格。
|
|
207
|
+
|
|
208
|
+
文件变化:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
git -C "<repo>" show --numstat --format= <commit>
|
|
212
|
+
git -C "<repo>" show --name-status --find-renames --format= <commit>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
记录:
|
|
216
|
+
|
|
217
|
+
- changed files;
|
|
218
|
+
- additions、deletions;
|
|
219
|
+
- binary;
|
|
220
|
+
- A/M/D/R/C/T;
|
|
221
|
+
- rename/copy;
|
|
222
|
+
- 一级/二级目录;
|
|
223
|
+
- 扩展名和语言;
|
|
224
|
+
- 业务代码、测试、文档、配置、CI、迁移、依赖、generated/vendor。
|
|
225
|
+
|
|
226
|
+
Merge commit 只统计合并事件;普通 churn 默认只汇总非 merge commit。需要 merge diff 时使用 first-parent 并单独标注。
|
|
227
|
+
|
|
228
|
+
路径排除只影响 LOC、热点和模块统计,不删除 commit。全部文件被排除的 commit 仍保留,`effective_churn` 为 0。
|
|
229
|
+
|
|
230
|
+
完成标准:每个指标可回溯到 commit;binary、rename 和排除路径口径明确。
|
|
231
|
+
|
|
232
|
+
### 6. 分类与主题聚合
|
|
233
|
+
|
|
234
|
+
一级分类:
|
|
235
|
+
|
|
236
|
+
```text
|
|
237
|
+
feature
|
|
238
|
+
bugfix
|
|
239
|
+
refactor
|
|
240
|
+
test
|
|
241
|
+
docs
|
|
242
|
+
build-ci
|
|
243
|
+
performance
|
|
244
|
+
security
|
|
245
|
+
chore
|
|
246
|
+
revert
|
|
247
|
+
merge
|
|
248
|
+
unknown
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
分类依据:
|
|
252
|
+
|
|
253
|
+
1. Conventional Commits;
|
|
254
|
+
2. subject/body;
|
|
255
|
+
3. issue、PR、需求编号;
|
|
256
|
+
4. 文件与模块;
|
|
257
|
+
5. diff 规模和文件类型;
|
|
258
|
+
6. 测试、文档、配置伴随变化。
|
|
259
|
+
|
|
260
|
+
置信度:
|
|
261
|
+
|
|
262
|
+
- `high`:message、路径、变化一致;
|
|
263
|
+
- `medium`:message 明确,文件证据有限;
|
|
264
|
+
- `low`:主要依赖推断;
|
|
265
|
+
- `unknown`:证据不足。
|
|
266
|
+
|
|
267
|
+
按编号、相似 message、模块、时间、依赖、follow-up fix 和 revert 链聚合功能/技术主题。每个主题记录:
|
|
268
|
+
|
|
269
|
+
- 可观察目标;
|
|
270
|
+
- 起止时间;
|
|
271
|
+
- commit 数和关键哈希;
|
|
272
|
+
- 主要作者名字;
|
|
273
|
+
- 仓库/模块;
|
|
274
|
+
- additions、deletions、churn;
|
|
275
|
+
- 测试伴随;
|
|
276
|
+
- 后续 fix/revert;
|
|
277
|
+
- 置信度。
|
|
278
|
+
|
|
279
|
+
证据不足时使用“疑似”或“待人工确认”,不杜撰业务背景。
|
|
280
|
+
|
|
281
|
+
完成标准:分类总数闭合;主要 feature/bugfix 已归入主题或未聚类清单。
|
|
282
|
+
|
|
283
|
+
### 7. 计算分析指标
|
|
284
|
+
|
|
285
|
+
基础指标:
|
|
286
|
+
|
|
287
|
+
```text
|
|
288
|
+
total_commits
|
|
289
|
+
non_merge_commits
|
|
290
|
+
merge_commits
|
|
291
|
+
first_parent_merges
|
|
292
|
+
revert_commits
|
|
293
|
+
feature/bugfix/refactor/test/docs/build_ci/performance/security/chore/unknown
|
|
294
|
+
active_authors
|
|
295
|
+
active_days
|
|
296
|
+
changed_files
|
|
297
|
+
additions
|
|
298
|
+
deletions
|
|
299
|
+
net_change
|
|
300
|
+
churn
|
|
301
|
+
binary_changes
|
|
302
|
+
added/deleted/renamed_files
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
定义:
|
|
306
|
+
|
|
307
|
+
```text
|
|
308
|
+
net_change = additions - deletions
|
|
309
|
+
churn = additions + deletions
|
|
310
|
+
active_day = 至少一个纳入统计的非 merge commit 的自然日
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
提交强度:
|
|
314
|
+
|
|
315
|
+
```text
|
|
316
|
+
commit_density = non_merge_commits / active_days
|
|
317
|
+
weekly_commit_rate = non_merge_commits / period_weeks
|
|
318
|
+
churn_per_active_day = churn / active_days
|
|
319
|
+
files_per_commit = changed_files / non_merge_commits
|
|
320
|
+
churn_per_commit = churn / non_merge_commits
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
按全局、仓库、周、月、作者和模块计算,并分析:
|
|
324
|
+
|
|
325
|
+
- 月/周趋势;
|
|
326
|
+
- 星期和小时分布;
|
|
327
|
+
- 工作日、周末、非标准时段占比;
|
|
328
|
+
- 连续活跃和最长静默;
|
|
329
|
+
- 高峰日/周;
|
|
330
|
+
- 中位数、四分位数、P95;
|
|
331
|
+
- 周期末集中提交;
|
|
332
|
+
- 超大或跨模块 commit;
|
|
333
|
+
- Author/Committer Date 差异。
|
|
334
|
+
|
|
335
|
+
不得把提交时间解释为工时或勤奋度。
|
|
336
|
+
|
|
337
|
+
功能迭代强度优先展示:
|
|
338
|
+
|
|
339
|
+
- 每周 feature commit/churn;
|
|
340
|
+
- feature 活跃天数和模块数;
|
|
341
|
+
- 测试伴随率;
|
|
342
|
+
- 后续 bugfix/revert 比例。
|
|
343
|
+
|
|
344
|
+
有足够比较样本时可附加:
|
|
345
|
+
|
|
346
|
+
```text
|
|
347
|
+
FII =
|
|
348
|
+
30% × normalized(feature_commits_per_active_week)
|
|
349
|
+
+ 25% × normalized(feature_churn_per_active_week)
|
|
350
|
+
+ 20% × normalized(feature_modules_touched)
|
|
351
|
+
+ 15% × normalized(feature_active_day_ratio)
|
|
352
|
+
+ 10% × normalized(feature_test_companion_rate)
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
必须同时显示原始值、标准化范围和权重;样本不足时不计算。
|
|
356
|
+
|
|
357
|
+
质量与风险信号:
|
|
358
|
+
|
|
359
|
+
- bugfix 占比与高频修复模块;
|
|
360
|
+
- feature 后快速 fix、连续 fix、revert 后重做;
|
|
361
|
+
- 测试伴随缺口;
|
|
362
|
+
- generated/vendor/lockfile 噪声;
|
|
363
|
+
- 高频热点和高 churn;
|
|
364
|
+
- Top1/Top2 作者 commit、churn 集中度;
|
|
365
|
+
- message 模糊和 unknown 比例。
|
|
366
|
+
|
|
367
|
+
这些只能作为 Git 证据信号,不得称为真实缺陷密度、实际 bus factor 或绩效事实。
|
|
368
|
+
|
|
369
|
+
完成标准:所有百分比同时给分子/分母,排名注明口径,表格合计一致。
|
|
370
|
+
|
|
371
|
+
### 8. 团队与个人评估
|
|
372
|
+
|
|
373
|
+
团队结论统一使用:
|
|
374
|
+
|
|
375
|
+
```text
|
|
376
|
+
事实 → 解释 → 风险或价值 → 建议
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
每个优点、不足和风险至少引用一个数据、项目相对路径或 commit 短哈希。建议分:
|
|
380
|
+
|
|
381
|
+
```text
|
|
382
|
+
P0:立即复核
|
|
383
|
+
P1:下一迭代改进
|
|
384
|
+
P2:持续优化
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
每位作者按统一结构输出:
|
|
388
|
+
|
|
389
|
+
- commit、merge、活跃天;
|
|
390
|
+
- additions、deletions、churn、changed files;
|
|
391
|
+
- 仓库和模块覆盖;
|
|
392
|
+
- feature/bugfix/refactor/test/docs/build-ci/performance/security;
|
|
393
|
+
- 测试伴随率;
|
|
394
|
+
- 平均、中位、最大 commit;
|
|
395
|
+
- 主要主题、模块和代表性 commit;
|
|
396
|
+
- Git 可见的贡献重心;
|
|
397
|
+
- 优势信号、风险和改进点;
|
|
398
|
+
- 证据与限制。
|
|
399
|
+
|
|
400
|
+
可使用“功能交付型、缺陷治理型、架构重构型、测试保障型、工程效率型、文档规范型、多模块支持型、核心模块深耕型”描述 Git 可见重心。
|
|
401
|
+
|
|
402
|
+
禁止只按 commit/LOC 给出最好或最差排名,禁止推断职位、态度、能力或绩效。
|
|
403
|
+
|
|
404
|
+
完成标准:每位纳入范围的非机器人作者都有多维画像和限制声明。
|
|
405
|
+
|
|
406
|
+
### 9. 交叉校验
|
|
407
|
+
|
|
408
|
+
写报告前验证:
|
|
409
|
+
|
|
410
|
+
- 全局 commit 与仓库去重合计一致;
|
|
411
|
+
- 非 merge 分类之和等于非 merge commit;
|
|
412
|
+
- merge 未重复进入普通 churn;
|
|
413
|
+
- 作者合计闭合;
|
|
414
|
+
- 多 refs 已去重;
|
|
415
|
+
- 时间边界和时区一致;
|
|
416
|
+
- binary 未作为普通 LOC;
|
|
417
|
+
- 排除路径一致应用;
|
|
418
|
+
- 仓库、周、月、作者和分类表合计一致;
|
|
419
|
+
- 关键哈希在对应仓库存在;
|
|
420
|
+
- 最终报告路径未占用。
|
|
421
|
+
|
|
422
|
+
无法修复的差异使报告 `status: partial`,并记录具体差异,禁止伪造平衡数字。
|
|
423
|
+
|
|
424
|
+
完成标准:校验结果进入报告正文和 frontmatter。
|
|
425
|
+
|
|
426
|
+
### 10. 原子持久化
|
|
427
|
+
|
|
428
|
+
1. 在内存生成完整 Markdown。
|
|
429
|
+
2. 在 command 专属目录创建同文件系统临时文件。
|
|
430
|
+
3. 写入并 flush;可用时 fsync。
|
|
431
|
+
4. 原子 rename 到最终未占用路径。
|
|
432
|
+
5. 重新读取验证:
|
|
433
|
+
- frontmatter 完整;
|
|
434
|
+
- command、scope 与文件名一致;
|
|
435
|
+
- 仓库选择和 Git 快照完整;
|
|
436
|
+
- 必需章节存在;
|
|
437
|
+
- 文件非空;
|
|
438
|
+
- 无绝对路径、邮箱或未脱敏凭证。
|
|
439
|
+
6. 清理临时脚本和数据。
|
|
440
|
+
7. 不执行 `git add` 或 commit。
|
|
441
|
+
|
|
442
|
+
完成标准:只有一个正式报告持久化,已有报告未覆盖,临时数据已清理。
|
|
443
|
+
|
|
444
|
+
## 报告 frontmatter
|
|
445
|
+
|
|
446
|
+
```yaml
|
|
447
|
+
---
|
|
448
|
+
command: git-repository-audit
|
|
449
|
+
schema_version: 1
|
|
450
|
+
status: complete
|
|
451
|
+
scope: workspace
|
|
452
|
+
topic: git-audit
|
|
453
|
+
generated_at: "ISO-8601"
|
|
454
|
+
project_root: "."
|
|
455
|
+
timezone: "Asia/Shanghai"
|
|
456
|
+
time_range:
|
|
457
|
+
start: "ISO-8601"
|
|
458
|
+
end: "ISO-8601"
|
|
459
|
+
date_basis: committer-date
|
|
460
|
+
author_identity: author-name-only
|
|
461
|
+
exclude_bots: true
|
|
462
|
+
repository_mode: all
|
|
463
|
+
repositories:
|
|
464
|
+
- path: "."
|
|
465
|
+
primary_branch: main
|
|
466
|
+
refs: [main]
|
|
467
|
+
head_at_start: "<full-sha>"
|
|
468
|
+
path_includes: []
|
|
469
|
+
path_excludes: []
|
|
470
|
+
include_merge_commits: true
|
|
471
|
+
local_history_only: true
|
|
472
|
+
fetch_performed: false
|
|
473
|
+
tool_versions:
|
|
474
|
+
git: ""
|
|
475
|
+
uv: ""
|
|
476
|
+
python: ""
|
|
477
|
+
validation:
|
|
478
|
+
status: passed
|
|
479
|
+
warnings: []
|
|
480
|
+
---
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
- `status` 为 `complete` 或 `partial`。
|
|
484
|
+
- `scope` 必须与文件名一致。
|
|
485
|
+
- `repositories` 保存完整选择、refs 和 HEAD 快照。
|
|
486
|
+
- 部分仓库失败时使用 `partial` 并列明。
|
|
487
|
+
- 不记录邮箱。
|
|
488
|
+
|
|
489
|
+
## 报告结构
|
|
490
|
+
|
|
491
|
+
```markdown
|
|
492
|
+
# Git 仓库代码迭代与团队贡献盘点报告
|
|
493
|
+
|
|
494
|
+
## 0. 执行摘要
|
|
495
|
+
## 1. 分析范围与统计口径
|
|
496
|
+
## 2. 仓库发现与 Git 快照
|
|
497
|
+
## 3. 全局核心指标
|
|
498
|
+
## 4. 仓库间对比
|
|
499
|
+
## 5. 提交时间与提交强度
|
|
500
|
+
## 6. 合并与分支活动
|
|
501
|
+
## 7. 功能迭代主题
|
|
502
|
+
## 8. Bug 修复与质量活动
|
|
503
|
+
## 9. 代码增减与变更结构
|
|
504
|
+
## 10. 热点模块与知识集中
|
|
505
|
+
## 11. 团队优点、不足与风险
|
|
506
|
+
## 12. 个人贡献画像
|
|
507
|
+
## 13. 优先行动项
|
|
508
|
+
## 14. 数据质量、限制与复核
|
|
509
|
+
## 15. 原始数据附录
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
执行摘要在一页内包含范围、仓库数、commit、merge、feature、bugfix、作者数、additions、deletions、churn、3 至 5 条关键发现、3 至 5 条建议和主要限制。
|
|
513
|
+
|
|
514
|
+
核心表格:
|
|
515
|
+
|
|
516
|
+
```markdown
|
|
517
|
+
| 仓库 | 项目相对路径 | 主分支 | refs | 本地分支 | 远端分支 | 标签 | 最早提交 | 最新提交 | 工作区状态 |
|
|
518
|
+
|---|---|---|---|---:|---:|---:|---|---|---|
|
|
519
|
+
|
|
520
|
+
| 主题 | 时间 | commits | 主要作者 | 仓库/模块 | +行 | -行 | 测试伴随 | 后续修复 | 关键哈希 | 置信度 |
|
|
521
|
+
|---|---|---:|---|---|---:|---:|---|---|---|---|
|
|
522
|
+
|
|
523
|
+
| 作者 | commits | 活跃天 | feature | bugfix | test | refactor | 工程类 | churn | 主要模块 | 主要主题 |
|
|
524
|
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---|---|
|
|
525
|
+
|
|
526
|
+
| 优先级 | 发现 | 数据证据 | 影响 | 建议行动 | 建议负责人 |
|
|
527
|
+
|---|---|---|---|---|---|
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
无法从 Git 判断负责人时写“团队共同确认”。
|
|
531
|
+
|
|
532
|
+
## 原始数据附录
|
|
533
|
+
|
|
534
|
+
默认在同一报告中保留全部所选 commit,不静默截断。每条至少包含:
|
|
535
|
+
|
|
536
|
+
```markdown
|
|
537
|
+
| 仓库 | 哈希 | Committer Date | 作者名字 | 类型 | 置信度 | Subject | 文件数 | +行 | -行 | 主要模块 | 主题 |
|
|
538
|
+
|---|---|---|---|---|---|---|---:|---:|---:|---|---|
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
同时包含:
|
|
542
|
+
|
|
543
|
+
- 仓库、周、月和作者原始汇总;
|
|
544
|
+
- merge 事件;
|
|
545
|
+
- 功能主题与 commit 对照;
|
|
546
|
+
- 待人工确认 commit;
|
|
547
|
+
- 排除文件和 binary 影响摘要。
|
|
548
|
+
|
|
549
|
+
commit 很多时按仓库和月份拆表,可用 `<details>` 折叠,但仍保留每个 commit,不生成第二个持久化数据文件。
|
|
550
|
+
|
|
551
|
+
## 数据限制
|
|
552
|
+
|
|
553
|
+
报告必须明确:
|
|
554
|
+
|
|
555
|
+
- 仅本地可见历史,未 fetch;
|
|
556
|
+
- 删除分支名称通常不可恢复;
|
|
557
|
+
- merge commit 数不等于历史分支数;
|
|
558
|
+
- squash/rebase 可能隐藏合并和多人贡献;
|
|
559
|
+
- 作者只按名字归一化;
|
|
560
|
+
- Git 无法完整反映设计、Review、沟通、带教、pair programming 和未提交工作;
|
|
561
|
+
- LOC 会受格式化、生成文件、lockfile 和文件移动影响;
|
|
562
|
+
- 测试文件未变化不等于没有测试;
|
|
563
|
+
- bugfix 占比不等于真实缺陷密度;
|
|
564
|
+
- 报告不能直接替代绩效评估。
|
|
565
|
+
|
|
566
|
+
## 复核命令
|
|
567
|
+
|
|
568
|
+
报告末尾按实际范围填充只读命令:
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
git -C "<repo>" log "<ref>" --since="<start>" --until="<end>" --format="%H" | sort -u | wc -l
|
|
572
|
+
git -C "<repo>" log "<ref>" --merges --first-parent --since="<start>" --until="<end>" --format="%H"
|
|
573
|
+
git -C "<repo>" log "<ref>" --no-merges --since="<start>" --until="<end>" --numstat
|
|
574
|
+
git -C "<repo>" shortlog -sn "<ref>" --since="<start>" --until="<end>"
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
作者复核不使用 `-e`,不输出邮箱。
|
|
578
|
+
|
|
579
|
+
## 返回
|
|
580
|
+
|
|
581
|
+
完成后只返回:
|
|
582
|
+
|
|
583
|
+
1. 报告项目相对路径;
|
|
584
|
+
2. 分析范围摘要;
|
|
585
|
+
3. 3 至 5 条最重要发现;
|
|
586
|
+
4. `complete` 或 `partial`;
|
|
587
|
+
5. 待人工复核事项。
|
|
588
|
+
|
|
589
|
+
完整报告不再次复制到对话;报告文件是唯一事实源。
|
|
590
|
+
|
|
591
|
+
## 完成标准
|
|
592
|
+
|
|
593
|
+
- Speculo 工作区和 state 根唯一解析;
|
|
594
|
+
- Python 仅通过 `uv run --no-project python -` 执行;
|
|
595
|
+
- 范围内仓库发现并去重;
|
|
596
|
+
- 时间、时区、仓库、refs、作者、路径范围明确;
|
|
597
|
+
- 作者只按名字区分,未读取或输出邮箱;
|
|
598
|
+
- commit 按仓库和完整哈希去重;
|
|
599
|
+
- merge 与普通 churn 分开;
|
|
600
|
+
- 功能、bugfix、时间、强度、代码量、热点、团队和个人分析完整;
|
|
601
|
+
- 所有评价有数据、路径或 commit 证据;
|
|
602
|
+
- 报告 frontmatter 保存完整选择和 Git 快照;
|
|
603
|
+
- 报告位于 command 专属规范路径且 scope 可见;
|
|
604
|
+
- 已有报告未覆盖;
|
|
605
|
+
- 未创建 state、sidecar 或第二份正式数据;
|
|
606
|
+
- 临时数据已清理;
|
|
607
|
+
- 未修改 Git 仓库、项目文件或 Python 项目环境;
|
|
608
|
+
- 最终报告已重读并通过结构和敏感信息检查。
|
|
@@ -18,4 +18,4 @@ This file is the routing entry. Read [`references/entry-procedure.md`](reference
|
|
|
18
18
|
|
|
19
19
|
## Stop
|
|
20
20
|
|
|
21
|
-
Stop before side effects when the required input, owner, reference, confirmation, schema, or recovery evidence is missing
|
|
21
|
+
Stop before side effects when the required input, owner, reference, confirmation, schema, or recovery evidence is missing, or when `commands_root` is not `{roots.state}/commands`; report the exact blocker and preserve any dry-run evidence.
|
|
@@ -37,7 +37,14 @@
|
|
|
37
37
|
- 识别操作型路径:`status.json`、`changes/`、`archive/`。
|
|
38
38
|
- 识别知识型 store:`adr/`、`context/` 及任何标注为"永久"的目录(其内容在 change 完成后提升至此)。
|
|
39
39
|
- 每个路径解析为完整的项目相对路径。
|
|
40
|
-
5.
|
|
40
|
+
5. 派生固定路径:
|
|
41
|
+
- `changes_root = state_root/changes`
|
|
42
|
+
- `archive_root = state_root/archive`
|
|
43
|
+
- `commands_root` 必须解析为 `<Path>{roots.state}/commands</Path>`
|
|
44
|
+
- `{roots.commands}` 是命令定义根,记为 `commands_def_root`,不是报告根
|
|
45
|
+
- 「不放进 workflow 私有 state root」只禁止写入 `<Path>{roots.state}/{workflow}/</Path>`(含 `specdev` / `learning` / `ops` / `person`)。它不禁止写入 `{roots.state}` 本身,更不得把报告退回 `{roots.commands}`
|
|
46
|
+
- POSIX 规范化后,若 `commands_root` 等于 `{roots.commands}`,或任何报告路径落在 `{roots.commands}/archive-and-consolidate/` → **blocked,不写文件**
|
|
47
|
+
- 写入 `path_context` 前再次核对 `commands_root` 等于 `<Path>{roots.state}/commands</Path>`
|
|
41
48
|
6. 读取 `<Path>{roots.config}</Path>`(若存在);不存在时静默降级为默认值(`language: "en"`、`confirm_before_external_write: true`)。
|
|
42
49
|
7. 对每个已解析路径执行真实路径包含检查;符号链接逃逸或不存在的静态引用阻塞。
|
|
43
50
|
8. 读取 `status.json`;扫描 changes 时校验 change 名称格式 `^\d{4}-\d{2}-\d{2}-[a-z0-9]+(-[a-z0-9]+)*$`,无日期前缀的历史 change 标注遗留但不阻塞。
|
|
@@ -110,7 +117,7 @@
|
|
|
110
117
|
3. 显式标注所有破坏性动作(移动、删除、改写)。
|
|
111
118
|
4. 报告摘要:待归档 change 数、待合并知识项数、待清理候选数、需确认项数。
|
|
112
119
|
5. 呈现给用户并显式声明:**"未修改任何文件。此为 dry-run 计划,请确认后执行。"**
|
|
113
|
-
6. dry-run 到此完成;调用方负责将报告写入
|
|
120
|
+
6. dry-run 到此完成;调用方负责将报告写入 `<Path>{roots.state}/commands/archive-and-consolidate/{date}-{scope}-{topic}[-NN].md</Path>`(`<scope>` 为目标 workflow 名,`<topic>` 为 change 名或 `batch`)。禁止写入 `{roots.commands}/archive-and-consolidate/`。
|
|
114
121
|
|
|
115
122
|
### Step 7:执行已确认动作
|
|
116
123
|
|
|
@@ -140,7 +147,7 @@
|
|
|
140
147
|
mode: "dry-run" | "executed",
|
|
141
148
|
scope: "archive-single" | "archive-batch",
|
|
142
149
|
knowledge_policy: "generic" | "mechanical-only",
|
|
143
|
-
path_context: { project_root, workflow_root, state_root, changes_root, archive_root, commands_root },
|
|
150
|
+
path_context: { project_root, workflow_root, state_root, changes_root, archive_root, commands_root }, // commands_root === {roots.state}/commands, never {roots.commands}
|
|
144
151
|
knowledge_stores: [{ name, path, exists }],
|
|
145
152
|
archive_plan: [{ source, target, status: "ready" | "blocked" | "moved" | "failed", notes }],
|
|
146
153
|
consolidation_plan: [{ source_change, target_store, action: "create" | "merge" | "append", content_summary, graduation_criterion, status }],
|
|
@@ -157,6 +164,7 @@
|
|
|
157
164
|
- `generic` 的每次合并写入已解决或标记冲突,目标 store 在 state 根内;每个清理动作完成路径包含验证且无跨 workflow 修改。
|
|
158
165
|
- 未确认或 mode=`dry-run` 时无文件系统修改。
|
|
159
166
|
- 执行后重读验证通过或不一致已记录。
|
|
167
|
+
- `path_context.commands_root` 等于 `<Path>{roots.state}/commands</Path>`,不等于 `{roots.commands}`。
|
|
160
168
|
- 本 skill 未自行选择报告路径或自行持久化。
|
|
161
169
|
|
|
162
170
|
## 渐进披露
|
|
@@ -13,6 +13,8 @@ This file is the routing entry. Read [`references/entry-procedure.md`](reference
|
|
|
13
13
|
## Scope
|
|
14
14
|
|
|
15
15
|
- Trigger: Plan and execute a confirmed first-parent Git history squash with recoverable refs and exact remote leases; never auto-trigger.
|
|
16
|
+
- Owning command: `<Path>{roots.commands}/git-history-squash.md</Path>` owns confirmation and the command audit report.
|
|
17
|
+
- This skill owns `<Path>{roots.state}/skills/git-history-squash/</Path>` transactional state.
|
|
16
18
|
- Output and write owner remain those declared by the entry procedure and the owning command/workflow.
|
|
17
19
|
- Do not infer missing scope, credentials, target, or authorization.
|
|
18
20
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
1. 从当前目录向上寻找并读取 `<Path>{roots.state}/workspace.json</Path>`,验证 `path_base: project-root` 和全部 roots,再读取 `<Path>{roots.config}</Path>`;无法唯一确定项目根时停止。
|
|
10
10
|
2. 读取项目 `AGENTS.md` 及目标仓库作用域内规则。
|
|
11
|
-
3. 将本 Skill 的持久化根解析为 `<Path>{roots.state}/skills/git-history-squash/</Path>`。根 `state.json` 只保存当前可恢复运行的 locator;每次运行使用 `<Path>{roots.state}/skills/git-history-squash/{date}-{topic}[-NN]/</Path
|
|
11
|
+
3. 将本 Skill 的持久化根解析为 `<Path>{roots.state}/skills/git-history-squash/</Path>`。根 `state.json` 只保存当前可恢复运行的 locator;每次运行使用 `<Path>{roots.state}/skills/git-history-squash/{date}-{topic}[-NN]/</Path>`,已有目录永不覆盖。由 `<Path>{roots.commands}/git-history-squash.md</Path>` 调用时,command 负责确认门和 `<Path>{roots.state}/commands/git-history-squash/</Path>` 审计报告;本 Skill 仍只写上述 skill namespace。
|
|
12
12
|
4. 从 [request template](../assets/request-template.json) 生成临时 request JSON。用户必须逐仓库明确 repository、完整 local branch ref、start、end、`inclusive | exclusive`、commit message、签名选择和远端发布选择;不得猜测缺失值。
|
|
13
13
|
5. 读取 [Rewrite contract](rewrite-contract.md),用它验证区间语义、预检项、确认门和 Git 写入边界。涉及父仓库与 submodule 时同时读取 [Submodule contract](submodule-contract.md)。
|
|
14
14
|
|
|
@@ -16,6 +16,8 @@ This file is the routing entry. Read [`references/entry-procedure.md`](reference
|
|
|
16
16
|
- Output and write owner remain those declared by the entry procedure and the owning command/workflow.
|
|
17
17
|
- Do not infer missing scope, credentials, target, or authorization.
|
|
18
18
|
|
|
19
|
+
For an authorized review or rewrite of a skill/document, read [`references/document-contract.md`](references/document-contract.md) before editing. Its fidelity checks apply to any document; this does not change this skill’s explicit-only activation policy.
|
|
20
|
+
|
|
19
21
|
## Stop
|
|
20
22
|
|
|
21
23
|
Stop before side effects when the required input, owner, reference, confirmation, schema, or recovery evidence is missing; report the exact blocker and preserve any dry-run evidence.
|