@namewta/speculo 0.2.16 → 0.3.1
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 +1 -2
- package/package.json +3 -2
- package/template/canonical/README.md +8 -1
- package/template/canonical/canonical-specdev-engineering-cognitive-mentor.md +2040 -0
- package/template/canonical/canonical-specdev-goal-plan.md +1379 -0
- package/template/canonical/canonical-specdev-grill-with-docs.md +848 -294
- package/template/canonical/canonical-specdev-spec.md +1062 -45
- package/template/canonical/canonical-specdev-tickets.md +1542 -142
- package/template/canonical/canonical-specdev-wayfinder.md +676 -108
- package/template/commands/archive-and-consolidate.md +3 -3
- package/template/commands/docs-sync.md +3 -5
- package/template/commands/git-repository-audit.md +682 -0
- package/template/commands/handoff.md +8 -6
- package/template/commands/retro.md +6 -9
- package/template/commands/status.md +1 -1
- package/template/skills/agents-md-builder/references/claude-redirect.md +10 -14
- package/template/skills/agents-md-builder/references/manifest-discovery.md +1 -6
- package/template/skills/agents-md-builder/references/role-classification.md +0 -12
- package/template/skills/archive-and-consolidate/SKILL.md +1 -1
- package/template/skills/docs-sync/references/agents-contract.md +4 -4
- package/template/skills/github-npm-ops/references/failure-recovery.md +4 -16
- package/template/skills/github-npm-ops/references/preflight-checklist.md +7 -7
- package/template/skills/github-npm-ops/references/release-notes-injection.md +8 -8
- package/template/skills/github-npm-ops/references/troubleshooting-playbook.md +5 -19
- package/template/skills/github-npm-ops/references/version-bump-flow.md +8 -28
- package/template/skills/github-npm-ops/references/workflow-yaml-reference.md +8 -8
- package/template/skills/writing-great-skills/SKILL.md +2 -0
- package/template/workflows/person/M-mao-zedong-cognitive-os/_templates/mao-consultation-output-template.md +32 -0
- package/template/workflows/specdev/A-archive-and-consolidate/A-archive-and-consolidate.md +69 -36
- package/template/workflows/specdev/A-archive-and-consolidate/archive-checklist.md +15 -0
- package/template/workflows/specdev/A-archive-and-consolidate/knowledge-promotion-rules.md +32 -0
- package/template/workflows/specdev/D-diagnose-bugs/D-diagnose-bugs.md +51 -51
- package/template/workflows/specdev/D-diagnose-bugs/diagnosis-template.md +64 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/E-engineering-cognitive-mentor.md +252 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/architecture-guidance.md +90 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/bug-guidance.md +80 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/codebase-guidance.md +107 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/comprehension-and-closure.md +95 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/domain-learning-guidance.md +62 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/evidence-and-options.md +132 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/interaction-protocol.md +116 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/mentor-report-template.md +135 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/mode-routing.md +47 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/persistence-and-resume.md +147 -0
- package/template/workflows/specdev/E-engineering-cognitive-mentor/requirements-guidance.md +92 -0
- package/template/workflows/specdev/G-grill-with-docs/G-grill-with-docs.md +99 -33
- package/template/workflows/specdev/G-grill-with-docs/adr-format.md +22 -75
- package/template/workflows/specdev/G-grill-with-docs/context-format.md +27 -53
- package/template/workflows/specdev/G-grill-with-docs/domain-modeling-rules.md +6 -92
- package/template/workflows/specdev/G-grill-with-docs/grilling-protocol.md +32 -49
- package/template/workflows/specdev/G-grill-with-docs/log-format.md +16 -98
- package/template/workflows/specdev/I-implement/I-implement.md +168 -52
- package/template/workflows/specdev/I-implement/code-review-process.md +10 -76
- package/template/workflows/specdev/I-implement/codebase-design-glossary.md +12 -109
- package/template/workflows/specdev/I-implement/deepening.md +12 -32
- package/template/workflows/specdev/I-implement/design-it-twice.md +6 -41
- package/template/workflows/specdev/I-implement/evidence-template.md +69 -0
- package/template/workflows/specdev/I-implement/execution-preflight.md +20 -0
- package/template/workflows/specdev/I-implement/tdd-examples.md +10 -135
- package/template/workflows/specdev/I-implement/tdd-rules.md +12 -28
- package/template/workflows/specdev/I-init-setup/I-init-setup.md +81 -86
- package/template/workflows/specdev/I-init-setup/change-status-template.json +15 -0
- package/template/workflows/specdev/I-init-setup/config-template.json +26 -0
- package/template/workflows/specdev/I-init-setup/domain-layout-template.md +23 -0
- package/template/workflows/specdev/I-init-setup/status-labels-template.md +55 -0
- package/template/workflows/specdev/I-init-setup/status-template.json +7 -0
- package/template/workflows/specdev/I-init-setup/tracking-template.md +10 -0
- package/template/workflows/specdev/INDEX.md +165 -76
- package/template/workflows/specdev/P-goal-plan/P-goal-plan.md +108 -44
- package/template/workflows/specdev/P-goal-plan/completion-control.md +79 -0
- package/template/workflows/specdev/P-goal-plan/goal-plan-template.md +105 -0
- package/template/workflows/specdev/P-goal-plan/orchestration-protocol.md +115 -0
- package/template/workflows/specdev/P-goal-plan/planning-modes.md +70 -0
- package/template/workflows/specdev/R-review-architecture/R-review-architecture.md +140 -0
- package/template/workflows/specdev/R-review-architecture/architecture-review-report-template.html +58 -0
- package/template/workflows/specdev/R-review-architecture/architecture-review-template.md +68 -0
- package/template/workflows/specdev/R-review-architecture/proposal-to-ticket.md +11 -0
- package/template/workflows/specdev/S-spec/S-spec.md +103 -49
- package/template/workflows/specdev/S-spec/spec-readiness.md +16 -0
- package/template/workflows/specdev/S-spec/spec-template.md +95 -0
- package/template/workflows/specdev/T-tickets/T-tickets.md +146 -133
- package/template/workflows/specdev/T-tickets/decomposition-rules.md +56 -0
- package/template/workflows/specdev/T-tickets/ticket-readiness.md +45 -0
- package/template/workflows/specdev/T-tickets/ticket-template.md +124 -0
- package/template/workflows/specdev/T-tickets/tickets-map-template.md +52 -50
- package/template/workflows/specdev/T-triage/T-triage.md +32 -63
- package/template/workflows/specdev/T-triage/triage-template.md +29 -0
- package/template/workflows/specdev/W-wayfinder/W-wayfinder.md +88 -159
- package/template/workflows/specdev/W-wayfinder/investigation-ticket-template.md +50 -0
- package/template/workflows/specdev/W-wayfinder/wayfinder-map-template.md +46 -0
- package/template/workflows/specdev/_state/status.json +1 -1
- package/template/workflows/specdev/common/README.md +47 -0
- package/template/workflows/specdev/common/rules/artifact-contract.md +57 -0
- package/template/workflows/specdev/common/rules/code-commenting-rule.md +39 -0
- package/template/workflows/specdev/common/rules/deviation-control.md +43 -0
- package/template/workflows/specdev/common/rules/evidence-and-verification.md +57 -0
- package/template/workflows/specdev/common/rules/path-ownership.md +35 -0
- package/template/workflows/specdev/common/rules/path-reference-contract.md +116 -0
- package/template/workflows/specdev/common/rules/planning-principles.md +57 -0
- package/template/workflows/specdev/common/rules/readiness-and-depth.md +51 -0
- package/template/workflows/specdev/common/schemas/change-status.schema.json +170 -0
- package/template/workflows/specdev/common/schemas/config.schema.json +54 -0
- package/template/workflows/specdev/common/schemas/goal-plan.schema.json +21 -0
- package/template/workflows/specdev/common/schemas/spec.schema.json +16 -0
- package/template/workflows/specdev/common/schemas/status.schema.json +149 -0
- package/template/workflows/specdev/common/schemas/ticket.schema.json +130 -0
- package/template/workflows/specdev/common/schemas/tickets-map.schema.json +14 -0
- package/template/workflows/specdev/common/skills/dev-worktree/SKILL.md +28 -0
- package/template/workflows/specdev/common/skills/dev-worktree/references/create.md +30 -0
- package/template/workflows/specdev/common/skills/dev-worktree/references/finalize.md +16 -0
- package/template/workflows/specdev/common/skills/research/SKILL.md +43 -0
- package/template/workflows/specdev/common/tools/README.md +16 -0
- package/template/workflows/specdev/common/tools/validate-specdev.mjs +1155 -0
- package/template/canonical/canonical-teach.md +0 -301
- package/template/workflows/specdev/A-archive-and-consolidate/archive-rules.md +0 -49
- package/template/workflows/specdev/A-archive-and-consolidate/cleanup-rules.md +0 -80
- package/template/workflows/specdev/A-archive-and-consolidate/consolidation-rules.md +0 -120
- package/template/workflows/specdev/A-archive-and-consolidate/discrimination-guide.md +0 -96
- package/template/workflows/specdev/A-archive-and-consolidate/knowledge-graduation.md +0 -51
- package/template/workflows/specdev/D-diagnose-bugs/cleanup-postmortem.md +0 -37
- package/template/workflows/specdev/D-diagnose-bugs/feedback-loop-techniques.md +0 -84
- package/template/workflows/specdev/D-diagnose-bugs/hypothesis-format.md +0 -46
- package/template/workflows/specdev/D-diagnose-bugs/instrumentation-rules.md +0 -51
- package/template/workflows/specdev/I-init-setup/domain-layout.md +0 -90
- package/template/workflows/specdev/I-init-setup/status-labels.md +0 -54
- package/template/workflows/specdev/I-init-setup/tracking-convention.md +0 -65
- package/template/workflows/specdev/P-goal-plan/execution-sections.md +0 -126
- package/template/workflows/specdev/P-goal-plan/governance-sections.md +0 -103
- package/template/workflows/specdev/P-goal-plan/input-validation.md +0 -94
- package/template/workflows/specdev/P-goal-plan/lead-orchestration-protocol.md +0 -161
- package/template/workflows/specdev/P-goal-plan/quick-reference-table.md +0 -60
- package/template/workflows/specdev/P-goal-plan/vision-sections.md +0 -80
- package/template/workflows/specdev/T-triage/artifact-templates.md +0 -122
- package/template/workflows/specdev/T-triage/intake-rules.md +0 -71
- package/template/workflows/specdev/T-triage/routing-rules.md +0 -70
- package/template/workflows/specdev/T-triage/understanding-rules.md +0 -102
- package/template/workflows/specdev/_state/adr/.gitkeep +0 -0
- package/template/workflows/specdev/_state/context/.gitkeep +0 -0
- package/template/workflows/specdev/_state/research/.gitkeep +0 -0
- package/template/workflows/specdev/common/dev-worktree/SKILL.md +0 -138
- package/template/workflows/specdev/common/dev-worktree/references/create.md +0 -63
- package/template/workflows/specdev/common/dev-worktree/references/finalize.md +0 -102
- package/template/workflows/specdev/common/improve-codebase-architecture/HTML-REPORT.md +0 -125
- package/template/workflows/specdev/common/improve-codebase-architecture/SKILL.md +0 -66
- package/template/workflows/specdev/common/neat-freak/SKILL.md +0 -210
- package/template/workflows/specdev/common/neat-freak/references/agent-paths.md +0 -72
- package/template/workflows/specdev/common/neat-freak/references/governance.md +0 -88
- package/template/workflows/specdev/common/neat-freak/references/sync-matrix.md +0 -77
- package/template/workflows/specdev/common/neat-freak/references/verification.md +0 -92
- package/template/workflows/specdev/common/neat-freak/scripts/audit-inventory.sh +0 -106
- package/template/workflows/specdev/common/prototype/LOGIC.md +0 -89
- package/template/workflows/specdev/common/prototype/SKILL.md +0 -78
- package/template/workflows/specdev/common/prototype/UI.md +0 -120
- package/template/workflows/specdev/common/research/SKILL.md +0 -54
- package/template/workflows/specdev/common/resolving-merge-conflicts/SKILL.md +0 -14
- package/template/workflows/specdev/common/scripts/hitl-loop.template.sh +0 -41
- package/template/workflows/specdev/common/triage/AGENT-BRIEF.md +0 -204
- package/template/workflows/specdev/common/triage/OUT-OF-SCOPE.md +0 -104
- package/template/workflows/specdev/common/triage/SKILL.md +0 -112
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# 摄入规则
|
|
2
|
-
|
|
3
|
-
将外部 issue 或 PR 规范化为会话内统一结构,供后续理解与落盘使用。本步骤只读取远端或用户输入,不写回 tracker。
|
|
4
|
-
|
|
5
|
-
## 远程可用性
|
|
6
|
-
|
|
7
|
-
按顺序探测:
|
|
8
|
-
|
|
9
|
-
1. 当前目录处于 git 仓库内
|
|
10
|
-
2. `gh` 可执行
|
|
11
|
-
3. `gh auth status` 成功
|
|
12
|
-
|
|
13
|
-
三者皆满足 → **远程可用**。任一项失败 → 按粘贴 / 口头路径处理,向用户说明原因。
|
|
14
|
-
|
|
15
|
-
## 远程拉取
|
|
16
|
-
|
|
17
|
-
用户给出 `#N`、纯数字编号、issue URL 或 PR URL 时:
|
|
18
|
-
|
|
19
|
-
**Issue(优先)**
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
gh issue view <n> --json number,title,body,author,labels,url,createdAt,state,comments
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
人类可读备选:`gh issue view <n> --comments`。
|
|
26
|
-
|
|
27
|
-
**PR(用户明确给了 PR,或 issue view 失败且 `gh pr view <n>` 成功)**
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
gh pr view <n> --json number,title,body,author,labels,url,createdAt,state,comments,files
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
PR 按「附带代码的 issue」处理:正文 + 评论 + 变更文件列表进入内部结构;diff 摘要可记入 `body` 附录或 comments 旁注。仍只写本地产物。
|
|
34
|
-
|
|
35
|
-
**解析 `#N`**:先尝试 `gh pr view N`,再 `gh issue view N`(或按用户声明的类型二选一)。
|
|
36
|
-
|
|
37
|
-
**失败回退**:网络错误、无权限、编号不存在 → 向用户说明,并请粘贴标题 + 正文 + 关键评论。不中止分诊。
|
|
38
|
-
|
|
39
|
-
## 粘贴与口头
|
|
40
|
-
|
|
41
|
-
| 来源 | 条件 | 处理 |
|
|
42
|
-
|------|------|------|
|
|
43
|
-
| `paste` | 用户粘贴全文(可含评论) | 拆出标题、正文、评论块;缺评论则 `comments: []` |
|
|
44
|
-
| `manual` | 仅口头 / 碎片描述 | 索取最小字段:标题、问题描述、期望行为;可选复现步骤 |
|
|
45
|
-
|
|
46
|
-
## 规范化内部结构
|
|
47
|
-
|
|
48
|
-
无论来源,统一为:
|
|
49
|
-
|
|
50
|
-
| 字段 | 说明 |
|
|
51
|
-
|------|------|
|
|
52
|
-
| `source` | `gh` \| `paste` \| `manual` |
|
|
53
|
-
| `kind` | `issue` \| `pr` \| `manual` |
|
|
54
|
-
| `number` | 编号,无则 `n/a` |
|
|
55
|
-
| `title` | 标题 |
|
|
56
|
-
| `body` | 正文(markdown 原文) |
|
|
57
|
-
| `url` | 远端 URL,无则空 |
|
|
58
|
-
| `author` | 作者登录名或「用户」 |
|
|
59
|
-
| `labels` | 标签字符串数组 |
|
|
60
|
-
| `state` | open/closed 等,未知则空 |
|
|
61
|
-
| `comments` | `{ author, created_at, body }[]` |
|
|
62
|
-
| `fetched_at` | ISO-8601 摄入时间 |
|
|
63
|
-
|
|
64
|
-
后续步骤只消费此结构;写入 `source-issue.md` 时按 `<Path>{roots.workflows}/specdev/T-triage/artifact-templates.md</Path>` 展开。
|
|
65
|
-
|
|
66
|
-
## 完成检查
|
|
67
|
-
|
|
68
|
-
- 标题非空
|
|
69
|
-
- 正文非空(`manual` 时问题描述 + 期望行为可拼成 body)
|
|
70
|
-
- `source` 与 `fetched_at` 已设
|
|
71
|
-
- 远程路径下 `number` 与 `url` 尽量齐全;失败回退已标注
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# 路由规则
|
|
2
|
-
|
|
3
|
-
在 `triage.md` 已具备类别、验证结果、信息缺口与行为契约草案后,按**首匹配**(从上到下)选定恰好一条主推荐。可附一条备选。推荐后**停止**,等用户确认再加载对应 work 入口。
|
|
4
|
-
|
|
5
|
-
## 首匹配表
|
|
6
|
-
|
|
7
|
-
| # | 条件 | Recommended status | 主推荐 |
|
|
8
|
-
|---|------|--------------------|--------|
|
|
9
|
-
| 1 | 已实现,或用户确认拒绝 / wontfix | `wontfix` | `none` |
|
|
10
|
-
| 2 | 关键信息不足(无法写出可测 AC 或无法判断类别/复现) | `needs-info` | `none` |
|
|
11
|
-
| 3 | `bug`,可复现(confirmed),根因未知 | `ready-for-agent` 或 `needs-triage` | **诊断** |
|
|
12
|
-
| 4 | `bug`,AC 清晰,范围小,修复点/模块清楚 | `ready-for-agent` | **实现** |
|
|
13
|
-
| 5 | `enhancement`,设计未定或接口仍开放 | `needs-triage` 或 `ready-for-human` | **设计访谈** |
|
|
14
|
-
| 6 | `enhancement`,设计已定,足以写 PRD | `ready-for-agent` | **编写 Spec** |
|
|
15
|
-
| 7 | 工作超单会话、通往目标的路径仍在迷雾中 | `needs-triage` | **寻路** |
|
|
16
|
-
| 8 | 以上皆非(默认) | `needs-triage` | **设计访谈** |
|
|
17
|
-
|
|
18
|
-
规则 1 的补充:用户确认拒绝 enhancement 时,可**提示**写入项目根 `.out-of-scope/<concept>.md`(格式见 `<Path>{roots.workflows}/specdev/common/triage/OUT-OF-SCOPE.md</Path>`);默认不自动写。已实现关闭不写 `.out-of-scope/`。
|
|
19
|
-
|
|
20
|
-
规则 3 vs 4:「根因未知」= 知道坏在哪一类症状,但不知哪个模块/不变量失败;「修复点清楚」= 已能指出接口或模块级落点。
|
|
21
|
-
|
|
22
|
-
规则 7 可选:仅当用户或理解结论明确「多会话 / 战争迷雾」时命中;否则落入默认规则 8。
|
|
23
|
-
|
|
24
|
-
## 入口 Path
|
|
25
|
-
|
|
26
|
-
| 显示名 | Path |
|
|
27
|
-
|--------|------|
|
|
28
|
-
| 设计访谈 | `<Path>{roots.workflows}/specdev/G-grill-with-docs/G-grill-with-docs.md</Path>` |
|
|
29
|
-
| 编写 Spec | `<Path>{roots.workflows}/specdev/S-spec/S-spec.md</Path>` |
|
|
30
|
-
| 实现 | `<Path>{roots.workflows}/specdev/I-implement/I-implement.md</Path>` |
|
|
31
|
-
| 诊断 | `<Path>{roots.workflows}/specdev/D-diagnose-bugs/D-diagnose-bugs.md</Path>` |
|
|
32
|
-
| 寻路 | `<Path>{roots.workflows}/specdev/W-wayfinder/W-wayfinder.md</Path>` |
|
|
33
|
-
| none | 字面 `none`(向用户提问或结束分诊) |
|
|
34
|
-
|
|
35
|
-
## 推荐话术
|
|
36
|
-
|
|
37
|
-
向用户展示时使用固定骨架:
|
|
38
|
-
|
|
39
|
-
```markdown
|
|
40
|
-
## 分诊结论
|
|
41
|
-
|
|
42
|
-
- **Change:** `{change}`
|
|
43
|
-
- **类别:** bug | enhancement
|
|
44
|
-
- **推荐 status:** …
|
|
45
|
-
- **主推荐:** <显示名> → <Path>…
|
|
46
|
-
- **理由:** <对应上表条件的一句话>
|
|
47
|
-
- **备选:** <可选>
|
|
48
|
-
|
|
49
|
-
产物:
|
|
50
|
-
- `<Path>{roots.state}/specdev/changes/{change}/source-issue.md</Path>`
|
|
51
|
-
- `<Path>{roots.state}/specdev/changes/{change}/triage.md</Path>`
|
|
52
|
-
|
|
53
|
-
是否进入主推荐 work?确认前我不会启动下游或修改项目代码。
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
`needs-info` 时:话术改为列出「信息缺口」中的具体问题,主推荐写 `none`,并说明补齐后可再次运行本 work 或直接指定下游。
|
|
57
|
-
|
|
58
|
-
`none` + `wontfix` 时:说明已实现位置或拒绝理由;询问是否需要记录到 `.out-of-scope/`(仅 enhancement 拒绝)。
|
|
59
|
-
|
|
60
|
-
## 停止规则
|
|
61
|
-
|
|
62
|
-
- 本步只推荐与展示;用户确认「进入 X」后再加载对应 Path,并移交 change 名、`triage.md` 路径与行为契约要点
|
|
63
|
-
- 用户选择备选或否决时,先更新 `triage.md` 推荐字段,再结束或按新选择移交
|
|
64
|
-
|
|
65
|
-
## 完成检查
|
|
66
|
-
|
|
67
|
-
- 从上到下只命中一条主推荐
|
|
68
|
-
- Path 使用上表别名格式(或 `none`)
|
|
69
|
-
- 用户已看到理由与确认问题
|
|
70
|
-
- 下游仍处于未启动状态
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# 深度理解规则
|
|
2
|
-
|
|
3
|
-
在写入分诊产物之前,对摄入的 issue 完成可检查的理解。行为契约对齐 `<Path>{roots.workflows}/specdev/common/triage/AGENT-BRIEF.md</Path>`:
|
|
4
|
-
|
|
5
|
-
- **持久优于精确**——描述接口、类型与行为契约;少绑易变文件路径与行号
|
|
6
|
-
- **行为而非过程**——写系统应做什么,不写如何实现
|
|
7
|
-
- **完整验收标准**——每条可独立验证
|
|
8
|
-
- **明确范围外**——写清本 change 不做什么
|
|
9
|
-
|
|
10
|
-
范围外只读去重遵循 `<Path>{roots.workflows}/specdev/common/triage/OUT-OF-SCOPE.md</Path>`。
|
|
11
|
-
|
|
12
|
-
## 检查清单(逐项完成)
|
|
13
|
-
|
|
14
|
-
### 1. 问题一句话
|
|
15
|
-
|
|
16
|
-
用一句用户可理解的话概括「出了什么问题 / 要什么能力」。
|
|
17
|
-
|
|
18
|
-
### 2. 类别
|
|
19
|
-
|
|
20
|
-
判定恰好一个:
|
|
21
|
-
|
|
22
|
-
- `bug`——现有行为不符合预期
|
|
23
|
-
- `enhancement`——新功能或对现有能力的改进
|
|
24
|
-
|
|
25
|
-
依据不足时倾向 `enhancement` 并在信息缺口中写清「请确认是回归还是新需求」。
|
|
26
|
-
|
|
27
|
-
### 3. 当前行为 vs 期望行为
|
|
28
|
-
|
|
29
|
-
- **当前**:代码库与 issue 共同描述的现状(bug 为故障表现;enhancement 为建立其上的基线)
|
|
30
|
-
- **期望**:完成后应发生什么;含已知边界与错误条件
|
|
31
|
-
|
|
32
|
-
未知部分列入信息缺口,不编造。
|
|
33
|
-
|
|
34
|
-
### 4. 代码库探查
|
|
35
|
-
|
|
36
|
-
- 先读 `<Path>{roots.state}/specdev/adr/</Path>` 与 `<Path>{roots.state}/specdev/context/</Path>`(若存在),使用既有术语与决策
|
|
37
|
-
- 按**领域概念**搜索(不仅是 issue 措辞)
|
|
38
|
-
- 记录相关模块、类型、函数签名或配置形态——行为级命名优先
|
|
39
|
-
- 报告查找范围,便于用户质疑遗漏
|
|
40
|
-
|
|
41
|
-
### 5. 冗余(已实现)
|
|
42
|
-
|
|
43
|
-
若请求行为已在代码库中存在:
|
|
44
|
-
|
|
45
|
-
- 指向存在位置(模块/接口名 + 简要证据)
|
|
46
|
-
- 倾向推荐 status `wontfix`、next work `none`
|
|
47
|
-
- 已实现路径只指向代码位置;`.out-of-scope/` 仅用于被拒绝的 enhancement
|
|
48
|
-
|
|
49
|
-
### 6. 范围外匹配(只读)
|
|
50
|
-
|
|
51
|
-
读取项目根 `.out-of-scope/*.md`(目录不存在则跳过):
|
|
52
|
-
|
|
53
|
-
- 按**概念相似**匹配(如「night theme」≈ `dark-mode`)
|
|
54
|
-
- 有匹配则呈现文件路径与拒绝理由,请用户选择:
|
|
55
|
-
- **确认**——仍拒绝 → next `none`;可提示用户自行追加 prior request(本 work **默认不自动写** `.out-of-scope/`)
|
|
56
|
-
- **重新考虑**——进入正常分诊
|
|
57
|
-
- **不相关**——继续正常分诊
|
|
58
|
-
|
|
59
|
-
### 7. 信息缺口
|
|
60
|
-
|
|
61
|
-
列出具体、可回答的问题。每条应能独立关闭一个决策或验证点。
|
|
62
|
-
|
|
63
|
-
- 好:「在 Node 20 + macOS 上执行 `speculo init` 后的完整终端输出是什么?」
|
|
64
|
-
- 坏:「请提供更多信息。」
|
|
65
|
-
|
|
66
|
-
无缺口则写「无」。
|
|
67
|
-
|
|
68
|
-
### 8. Bug 验证(轻量)
|
|
69
|
-
|
|
70
|
-
仅 `bug` 类别:
|
|
71
|
-
|
|
72
|
-
| 结果 | 含义 |
|
|
73
|
-
|------|------|
|
|
74
|
-
| `confirmed` | 按报告步骤复现成功,或代码路径明确支撑该故障 |
|
|
75
|
-
| `not-reproduced` | 按步骤未能复现;记录尝试环境与命令 |
|
|
76
|
-
| `needs-info` | 步骤不足,无法尝试复现 |
|
|
77
|
-
| `n/a` | 非 bug |
|
|
78
|
-
|
|
79
|
-
完整反馈回路、插桩与假设排名由 `<Path>{roots.workflows}/specdev/D-diagnose-bugs/D-diagnose-bugs.md</Path>` 负责。本步只需确认「是否像真 bug」及可复现性档位。
|
|
80
|
-
|
|
81
|
-
## 输出给后续步骤的结论包
|
|
82
|
-
|
|
83
|
-
步骤 4 写入 `triage.md` 前,会话中应具备:
|
|
84
|
-
|
|
85
|
-
| 字段 | 来源 |
|
|
86
|
-
|------|------|
|
|
87
|
-
| 类别 | 清单 §2 |
|
|
88
|
-
| 问题摘要 | 清单 §1 |
|
|
89
|
-
| 当前 / 期望行为 | 清单 §3 |
|
|
90
|
-
| 关键接口(草案) | 清单 §4 |
|
|
91
|
-
| 验收标准(草案) | 自期望行为拆出;不足则进缺口 |
|
|
92
|
-
| 范围外 | 清单 §6 + 显式不做项 |
|
|
93
|
-
| 验证结果 | 清单 §8 |
|
|
94
|
-
| 冗余 / 范围外结论 | 清单 §5–6 |
|
|
95
|
-
| 信息缺口 | 清单 §7 |
|
|
96
|
-
| 完备性 | 足以写契约 → 可路由下游;否则 `needs-info` |
|
|
97
|
-
|
|
98
|
-
## 完成检查
|
|
99
|
-
|
|
100
|
-
- 八项均有结论或明确「不适用」
|
|
101
|
-
- 用户已看到已实现 / 范围外匹配(若有)并给出方向(或已 AFK 默认继续)
|
|
102
|
-
- 信息缺口每条可操作
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dev-worktree
|
|
3
|
-
description: 在 Speculo workflow change 内创建隔离 git worktree 进行开发,完成后验证测试并合回基础分支。当用户要求隔离开发、开始实现、或实现完成后需要合并/清理时使用。与 specdev workflow 深度集成,worktree 持久化在 change 目录下的 .worktree/ 中。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Dev Worktree
|
|
7
|
-
|
|
8
|
-
为当前 workflow change 创建独立 worktree,实现「隔离开发 → 验证 → 合并 → 清理」闭环。
|
|
9
|
-
|
|
10
|
-
**启动时宣布:** 「正在使用 dev-worktree 技能。」
|
|
11
|
-
|
|
12
|
-
## 决策树
|
|
13
|
-
|
|
14
|
-
| 场景 | 入口 |
|
|
15
|
-
|------|------|
|
|
16
|
-
| 要开始实现 / 用户要求隔离 | **阶段 A:创建 worktree** |
|
|
17
|
-
| 已在 worktree 中,开发完成 | **阶段 B:收尾合并** |
|
|
18
|
-
| 已在 worktree 中,未完成 | 继续开发,不重复创建 |
|
|
19
|
-
| 用户要求 PR / 暂存 / 丢弃 | 阶段 B 按对应选项执行 |
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## 阶段 A:创建 Worktree
|
|
24
|
-
|
|
25
|
-
详细步骤见 [references/create.md](references/create.md)。核心流程:
|
|
26
|
-
|
|
27
|
-
### A0. 检测现有隔离
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
31
|
-
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
32
|
-
SUPER=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
- `SUPER` 有值 → submodule 内,按普通仓库处理,不误判
|
|
36
|
-
- `GIT_DIR != GIT_COMMON` 且非 submodule → 已在 worktree,跳到 A3 设置
|
|
37
|
-
- `GIT_DIR == GIT_COMMON` → 主工作区,继续
|
|
38
|
-
|
|
39
|
-
### A1. 命名与路径
|
|
40
|
-
|
|
41
|
-
| 要素 | 值 |
|
|
42
|
-
|------|-----|
|
|
43
|
-
| 基础分支 | 当前分支(`git rev-parse --abbrev-ref HEAD`) |
|
|
44
|
-
| change 分支 | `speculo/<workflow>/<change>` |
|
|
45
|
-
| worktree 路径 | `{state-root}/<workflow>/changes/<change>/.worktree/` |
|
|
46
|
-
|
|
47
|
-
分支或路径已存在 → 停止,不覆盖不复用。
|
|
48
|
-
|
|
49
|
-
**前置检查:** `speculo/.speculo/` 必须被 git 跟踪——产物需随分支合并。若被忽略则降级为非 worktree 模式。
|
|
50
|
-
|
|
51
|
-
### A2. 创建
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
git worktree add -b speculo/<workflow>/<change> {state-root}/<workflow>/changes/<change>/.worktree
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
确保 `.gitignore` 含 `.worktree/`;缺失则追加并提交。
|
|
58
|
-
|
|
59
|
-
### A3. 项目设置与基线
|
|
60
|
-
|
|
61
|
-
自动检测并安装依赖、运行基线测试:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
[ -f package.json ] && (npm install 2>/dev/null || true)
|
|
65
|
-
[ -f Cargo.toml ] && cargo build
|
|
66
|
-
[ -f requirements.txt ] && pip install -r requirements.txt
|
|
67
|
-
[ -f go.mod ] && go mod download
|
|
68
|
-
# 跑基线测试
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
基线测试失败 → 报告并询问,未获许可不开始实现。
|
|
72
|
-
|
|
73
|
-
### A4. 写回状态
|
|
74
|
-
|
|
75
|
-
将 `base_branch`、`change_branch`、`worktree_path`、`worktree_status: active` 写入 change 的 `.status.json`。
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## 阶段 B:收尾合并
|
|
80
|
-
|
|
81
|
-
详细步骤见 [references/finalize.md](references/finalize.md)。
|
|
82
|
-
|
|
83
|
-
### B1. 验证测试
|
|
84
|
-
|
|
85
|
-
跑项目测试套件。失败 → 停止,禁止合并/PR。
|
|
86
|
-
|
|
87
|
-
### B2. 展示选项
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
实现已完成。你想怎么做?
|
|
91
|
-
|
|
92
|
-
1. 本地合并回 <base-branch>(推荐,默认)
|
|
93
|
-
2. 推送并创建 Pull Request
|
|
94
|
-
3. 保持现状(稍后处理)
|
|
95
|
-
4. 丢弃
|
|
96
|
-
|
|
97
|
-
选哪个?
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
分离 HEAD 时移除选项 1。用户未指定时默认选项 1。
|
|
101
|
-
|
|
102
|
-
### B3. 执行 —— 顺序不可变
|
|
103
|
-
|
|
104
|
-
**选项 1(本地合并):**
|
|
105
|
-
1. 合并到 base:`git checkout <base> && git pull && git merge --no-ff <change_branch>`
|
|
106
|
-
2. 在合并结果上再跑测试
|
|
107
|
-
3. 测试通过 → 从主仓库根删除 worktree:`git worktree remove <path>`
|
|
108
|
-
4. 删除分支:`git branch -d <change_branch>`
|
|
109
|
-
5. `git worktree prune`
|
|
110
|
-
6. 更新 `.status.json`:`worktree_status: removed`
|
|
111
|
-
|
|
112
|
-
**选项 2(PR):** 推送分支、创建 PR,保留 worktree。
|
|
113
|
-
**选项 3(保持):** 不动,报告状态。
|
|
114
|
-
**选项 4(丢弃):** 确认后删除 worktree 和分支。
|
|
115
|
-
|
|
116
|
-
合并冲突或测试失败 → 停止,保留现场,报告原因,不强推。
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## 红线
|
|
121
|
-
|
|
122
|
-
**绝不:**
|
|
123
|
-
- 已在 worktree 时嵌套创建
|
|
124
|
-
- 覆盖已有分支或路径
|
|
125
|
-
- 测试失败时继续合并/PR
|
|
126
|
-
- 合并结果未验证就删 worktree
|
|
127
|
-
- 先删分支再 worktree remove(顺序:merge → remove worktree → delete branch)
|
|
128
|
-
- 在 worktree 内部执行 `git worktree remove`
|
|
129
|
-
- 未经确认执行破坏性操作
|
|
130
|
-
- 强制推送
|
|
131
|
-
|
|
132
|
-
**始终:**
|
|
133
|
-
- 分支名:`speculo/<workflow>/<change>`
|
|
134
|
-
- worktree 路径:change 目录下的 `.worktree/`
|
|
135
|
-
- 创建后装依赖 + 基线测试
|
|
136
|
-
- 收尾前验证测试
|
|
137
|
-
- 合并成功后再清理
|
|
138
|
-
- 清理后 `git worktree prune`
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# 创建 Worktree
|
|
2
|
-
|
|
3
|
-
为当前 workflow change 建立独立 worktree。由 SKILL.md 阶段 A 调用。
|
|
4
|
-
|
|
5
|
-
## 前置
|
|
6
|
-
|
|
7
|
-
1. git 仓库内,工作区干净或可接受
|
|
8
|
-
2. `speculo/.speculo/` 被 git 跟踪(change 产物随分支合并回 base);若被忽略则降级非 worktree 模式
|
|
9
|
-
3. `.gitignore` 含 `.worktree/`;缺失则追加并提交
|
|
10
|
-
|
|
11
|
-
## 检测已有隔离
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
15
|
-
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
16
|
-
SUPER=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
| 条件 | 判断 |
|
|
20
|
-
|------|------|
|
|
21
|
-
| `SUPER` 有值 | submodule,按普通仓库 |
|
|
22
|
-
| `GIT_DIR != GIT_COMMON` 且非 submodule | 已在 worktree |
|
|
23
|
-
| `GIT_DIR == GIT_COMMON` | 主工作区,继续创建 |
|
|
24
|
-
|
|
25
|
-
已在 worktree → 报告路径与分支,跳到设置步骤,不重复创建。
|
|
26
|
-
|
|
27
|
-
## 命名
|
|
28
|
-
|
|
29
|
-
| 要素 | 值 |
|
|
30
|
-
|------|-----|
|
|
31
|
-
| base 分支 | `git rev-parse --abbrev-ref HEAD` |
|
|
32
|
-
| change 分支 | `speculo/<workflow>/<change>` |
|
|
33
|
-
| worktree 路径 | `{state-root}/<workflow>/changes/<change>/.worktree/` |
|
|
34
|
-
|
|
35
|
-
分支或路径已存在 → 停止报告,不覆盖、不复用。
|
|
36
|
-
|
|
37
|
-
## 创建
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
mkdir -p {state-root}/<workflow>/changes/<change>
|
|
41
|
-
git worktree add -b speculo/<workflow>/<change> {state-root}/<workflow>/changes/<change>/.worktree
|
|
42
|
-
cd {state-root}/<workflow>/changes/<change>/.worktree
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
> 若平台有原生 worktree 工具(如 `EnterWorktree`)且用户要求使用:用原生工具,但目标路径对齐 change 目录下 `.worktree/` 约定。无法指定路径时注明实际路径,收尾时按真实路径清理。
|
|
46
|
-
|
|
47
|
-
## 项目设置与基线
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
[ -f package.json ] && (npm install 2>/dev/null || true)
|
|
51
|
-
[ -f Cargo.toml ] && cargo build
|
|
52
|
-
[ -f requirements.txt ] && pip install -r requirements.txt
|
|
53
|
-
[ -f go.mod ] && go mod download
|
|
54
|
-
# 跑项目基线测试
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
基线失败 → 报告询问,未获许可不开始实现。
|
|
58
|
-
|
|
59
|
-
## 返回
|
|
60
|
-
|
|
61
|
-
- `base_branch`、`change_branch`、`worktree_path`(绝对路径)
|
|
62
|
-
- `worktree_status: active`
|
|
63
|
-
- 由调用方写入 change `.status.json`
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# 收尾合并与清理
|
|
2
|
-
|
|
3
|
-
实现完成后合并回 base、清理 worktree 与分支。由 SKILL.md 阶段 B 调用。**破坏性操作须先确认。**
|
|
4
|
-
|
|
5
|
-
## 前置
|
|
6
|
-
|
|
7
|
-
- 测试通过(未通过不得合并)
|
|
8
|
-
- 产物已在 `change_branch` 上提交
|
|
9
|
-
- 已有 `base_branch`、`change_branch`、`worktree_path`
|
|
10
|
-
|
|
11
|
-
## 检测环境
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
15
|
-
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
16
|
-
WORKTREE_PATH=$(git rev-parse --show-toplevel)
|
|
17
|
-
FEATURE_BRANCH=$(git branch --show-current)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
确定 base 分支:
|
|
21
|
-
```bash
|
|
22
|
-
BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null || echo "")
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 展示选项
|
|
26
|
-
|
|
27
|
-
展示前先验测试。**命名分支:**
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
实现已完成。你想怎么做?
|
|
31
|
-
|
|
32
|
-
1. 本地合并回 <base-branch>(推荐,默认)
|
|
33
|
-
2. 推送并创建 Pull Request
|
|
34
|
-
3. 保持现状(稍后处理)
|
|
35
|
-
4. 丢弃
|
|
36
|
-
|
|
37
|
-
选哪个?
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**分离 HEAD:** 移除选项 1,仅提供 2/3/4。用户未指定时默认推荐选项 1。
|
|
41
|
-
|
|
42
|
-
## 选项 1:本地合并
|
|
43
|
-
|
|
44
|
-
顺序固定——**先合并验证 → 再删 worktree → 最后删分支**:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
MAIN_ROOT=$(git rev-parse --show-toplevel)
|
|
48
|
-
cd "$MAIN_ROOT"
|
|
49
|
-
|
|
50
|
-
git checkout <base-branch>
|
|
51
|
-
git pull # 仅远程存在且用户未禁止时
|
|
52
|
-
git merge --no-ff <change_branch>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
合并后跑测试。**失败 → 停止,保留现场,报告原因。**
|
|
56
|
-
|
|
57
|
-
测试通过后:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# 必须在主仓库根执行,不能在 worktree 内部
|
|
61
|
-
git worktree remove {worktree_path}
|
|
62
|
-
git worktree prune
|
|
63
|
-
git branch -d <change_branch>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
更新 `.status.json`:`worktree_status: removed`。
|
|
67
|
-
|
|
68
|
-
报告:已合并到 `<base-branch>`,worktree 与分支已清理。
|
|
69
|
-
|
|
70
|
-
## 选项 2:PR
|
|
71
|
-
|
|
72
|
-
推送分支,创建 PR,保留 worktree。若需指定远程或目标分支,先确认。
|
|
73
|
-
|
|
74
|
-
## 选项 3:保持
|
|
75
|
-
|
|
76
|
-
不动 worktree 和分支。报告当前状态,以便后续继续。
|
|
77
|
-
|
|
78
|
-
## 选项 4:丢弃
|
|
79
|
-
|
|
80
|
-
确认后删除 worktree 和分支(不合并):
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
cd "$MAIN_ROOT"
|
|
84
|
-
git worktree remove {worktree_path}
|
|
85
|
-
git worktree prune
|
|
86
|
-
git branch -D <change_branch>
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## 失败处理
|
|
90
|
-
|
|
91
|
-
| 情况 | 处理 |
|
|
92
|
-
|------|------|
|
|
93
|
-
| 合并冲突 | 停止,报告冲突文件,保留 worktree/分支,不强推 |
|
|
94
|
-
| worktree remove 失败 | 停止报告,不 `--force`(用户明确要求除外) |
|
|
95
|
-
| 已合并不回滚 | 除非用户明确要求 |
|
|
96
|
-
|
|
97
|
-
## 清理规则
|
|
98
|
-
|
|
99
|
-
- **只清理约定路径下的 worktree**(change 目录下 `.worktree/`)
|
|
100
|
-
- 路径不匹配 → 不删(可能由 harness 管理)
|
|
101
|
-
- 永远在主仓库根执行 `git worktree remove`
|
|
102
|
-
- 顺序不可颠倒:merge → remove worktree → delete branch
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# HTML 报告格式
|
|
2
|
-
|
|
3
|
-
架构审查渲染为一个独立的 HTML 文件,存放在操作系统临时目录中。Tailwind 和 Mermaid 均来自 CDN。Mermaid 处理图形状的图表;手工构建的 div 和内联 SVG 处理更具编辑性的可视化(质量图、横截面图)。混合使用两者 — 不要所有事情都依赖 Mermaid,否则会变得千篇一律。
|
|
4
|
-
|
|
5
|
-
`{{config.defaults.report_language}}` 占位符由 runtime-context 输出的 `config` 对象填充,值来自 `speculo/config.json` 的 `defaults.report_language` 字段;若 config 文件不存在,默认值为 `"en"`。Tailwind 和 Mermaid 均来自 CDN。Mermaid 处理图形状的图表;手工构建的 div 和内联 SVG 处理更具编辑性的可视化(质量图、横截面图)。混合使用两者 — 不要所有事情都依赖 Mermaid,否则会变得千篇一律。
|
|
6
|
-
|
|
7
|
-
## 脚手架
|
|
8
|
-
|
|
9
|
-
```html
|
|
10
|
-
<!doctype html>
|
|
11
|
-
<html lang="{{config.defaults.report_language}}">
|
|
12
|
-
<head>
|
|
13
|
-
<meta charset="utf-8" />
|
|
14
|
-
<title>Architecture review — {{repo name}}</title>
|
|
15
|
-
<script src="https://cdn.tailwindcss.com"></script>
|
|
16
|
-
<script type="module">
|
|
17
|
-
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
|
18
|
-
mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
|
|
19
|
-
</script>
|
|
20
|
-
<style>
|
|
21
|
-
/* Tailwind 无法很好覆盖的小型自定义层:
|
|
22
|
-
虚线接缝线、手绘感箭头等。 */
|
|
23
|
-
.seam { stroke-dasharray: 4 4; }
|
|
24
|
-
.leak { stroke: #dc2626; }
|
|
25
|
-
.deep { background: linear-gradient(135deg, #0f172a, #1e293b); }
|
|
26
|
-
</style>
|
|
27
|
-
</head>
|
|
28
|
-
<body class="bg-stone-50 text-slate-900 font-sans">
|
|
29
|
-
<main class="max-w-5xl mx-auto px-6 py-12 space-y-12">
|
|
30
|
-
<header>...</header>
|
|
31
|
-
<section id="candidates" class="space-y-10">...</section>
|
|
32
|
-
<section id="top-recommendation">...</section>
|
|
33
|
-
</main>
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## 页头
|
|
39
|
-
|
|
40
|
-
仓库名称、日期和一个紧凑的图例:实线框 = 模块,虚线 = 接缝,红色箭头 = 泄漏,粗黑框 = 深模块。无介绍段落 — 直接进入候选。
|
|
41
|
-
|
|
42
|
-
## 候选卡片
|
|
43
|
-
|
|
44
|
-
图表承担主要分量。文字稀疏、平实,并使用来自 `/codebase-design` skill 的术语,不刻意修饰。
|
|
45
|
-
|
|
46
|
-
每个候选是一个 `<article>`:
|
|
47
|
-
|
|
48
|
-
- **标题** — 简短,命名深化方案(例如"Collapse the Order intake pipeline")。
|
|
49
|
-
- **徽章行** — 推荐强度(`Strong` = 翡翠绿,`Worth exploring` = 琥珀色,`Speculative` = 石板灰),外加一个依赖类别标签(`in-process`、`local-substitutable`、`ports & adapters`、`mock`)。
|
|
50
|
-
- **文件** — 等宽字体列表,`font-mono text-sm`。
|
|
51
|
-
- **Before / After 图表** — 核心。两列,并排。参见下方模式。
|
|
52
|
-
- **Problem** — 一句话。痛点是什么。
|
|
53
|
-
- **Solution** — 一句话。改变了什么。
|
|
54
|
-
- **Wins** — 要点,每个不超过 6 个词。例如 "Tests hit one interface"、"Pricing logic stops leaking"、"Delete 4 shallow wrappers"。
|
|
55
|
-
- **ADR 标注**(如适用)— 一行,放在琥珀色调的框中。
|
|
56
|
-
|
|
57
|
-
无需解释段落。如果图表需要一段文字才能理解,重新画图。
|
|
58
|
-
|
|
59
|
-
## 图表模式
|
|
60
|
-
|
|
61
|
-
选择适合候选的模式。混合使用它们。不要让每个图表看起来都一样 — 多样性本身就是目的的一部分。
|
|
62
|
-
|
|
63
|
-
### Mermaid 图表(依赖/调用流的常用工具)
|
|
64
|
-
|
|
65
|
-
当重点是"X 调用 Y 调用 Z,看看这有多混乱"时,使用 Mermaid `flowchart` 或 `graph`。用 Tailwind 风格卡片包裹它,这样不会显得突兀。使用 classDef 将泄漏边缘着红色,深模块着深色。序列图适合展示"before:6 个往返;after:1 个"。
|
|
66
|
-
|
|
67
|
-
```html
|
|
68
|
-
<div class="rounded-lg border border-slate-200 bg-white p-4">
|
|
69
|
-
<pre class="mermaid">
|
|
70
|
-
flowchart LR
|
|
71
|
-
A[OrderHandler] --> B[OrderValidator]
|
|
72
|
-
B --> C[OrderRepo]
|
|
73
|
-
C -.leak.-> D[PricingClient]
|
|
74
|
-
classDef leak stroke:#dc2626,stroke-width:2px;
|
|
75
|
-
class C,D leak
|
|
76
|
-
</pre>
|
|
77
|
-
</div>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 手工绘制的框线图(当 Mermaid 的布局难以驾驭时)
|
|
81
|
-
|
|
82
|
-
模块用带边框和标签的 `<div>` 表示。箭头用绝对定位在相对容器上的内联 SVG `<line>` 或 `<path>` 元素表示。当你希望"after"图表看起来像一个粗边的深模块,内部元素灰显时使用 — Mermaid 不会以合适的权重渲染这种效果。
|
|
83
|
-
|
|
84
|
-
### 横截面图(适合分层浅度)
|
|
85
|
-
|
|
86
|
-
堆叠水平条(`h-12 border-l-4`)来展示调用经过的各层。Before:6 个薄层,每个都不做什么。After:一个厚条,标注合并后的职责。
|
|
87
|
-
|
|
88
|
-
### 质量图(适合"接口与实现一样宽"的场景)
|
|
89
|
-
|
|
90
|
-
每个模块两个矩形 — 一个表示接口表面积,一个表示实现。Before:接口矩形几乎和实现矩形一样高(浅)。After:接口矩形短,实现矩形高(深)。
|
|
91
|
-
|
|
92
|
-
### 调用图坍缩
|
|
93
|
-
|
|
94
|
-
Before:嵌套框呈现的函数调用树。After:同一棵树坍缩成一个框,内部调用在其内部以淡化形式显示。
|
|
95
|
-
|
|
96
|
-
## 样式指导
|
|
97
|
-
|
|
98
|
-
- 偏向编辑风格,而非企业仪表盘风格。宽松的留白。标题可选择衬线字体(`font-serif` 与 stone/slate 搭配效果很好)。
|
|
99
|
-
- 色彩使用克制:一种强调色(翠绿或靛蓝),加上红色用于泄漏,琥珀色用于警告。
|
|
100
|
-
- 保持图表约 320px 高,使 before/after 能够舒适地并排放置而无需滚动。
|
|
101
|
-
- 使用 `text-xs uppercase tracking-wider` 用于图表内的模块标签 — 它们应读起来像示意图,而非 UI。
|
|
102
|
-
- 唯一的脚本是 Tailwind CDN 和 Mermaid ESM 导入。除此之外报告是静态的 — 没有应用代码,除了 Mermaid 自身的渲染之外没有交互。
|
|
103
|
-
|
|
104
|
-
## 顶部推荐部分
|
|
105
|
-
|
|
106
|
-
一张更大的卡片。候选名称,一句话说明为什么,指向其卡片的锚链接。这就够了。
|
|
107
|
-
|
|
108
|
-
## 语气
|
|
109
|
-
|
|
110
|
-
平实的英语,简洁 — 但架构名词和动词直接来自 `/codebase-design` skill。简洁不是偏离的借口。
|
|
111
|
-
|
|
112
|
-
**完全使用:** module、interface、implementation、depth、deep、shallow、seam、adapter、leverage、locality。
|
|
113
|
-
|
|
114
|
-
**绝不替代:** component、service、unit(代替 module)· API、signature(代替 interface)· boundary(代替 seam)· layer、wrapper(代替 module,当你的意思是 module 时)。
|
|
115
|
-
|
|
116
|
-
**符合风格的表达方式:**
|
|
117
|
-
|
|
118
|
-
- "Order intake module is shallow — interface nearly matches the implementation."
|
|
119
|
-
- "Pricing leaks across the seam."
|
|
120
|
-
- "Deepen: one interface, one place to test."
|
|
121
|
-
- "Two adapters justify the seam: HTTP in prod, in-memory in tests."
|
|
122
|
-
|
|
123
|
-
**Wins 要点**用术语表命名收益:*"locality: bugs concentrate in one module"*、*"leverage: one interface, N call sites"*、*"interface shrinks; implementation absorbs the wrappers"*。不要写 *"easier to maintain"* 或 *"cleaner code"* — 这些术语不在术语表中,不值得留下。
|
|
124
|
-
|
|
125
|
-
不模糊其词,不清喉咙,不说"值得注意的是……"。如果一句话可以变成一个要点,就变成要点。如果一个要点可以删除,就删除它。如果一个术语不在 `/codebase-design` 术语表中,在发明新术语之前先用术语表中已有的。
|