@namewta/speculo 0.1.21 → 0.2.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/README.md +68 -78
- package/dist/src/cli.js +57 -34
- package/dist/src/cli.js.map +1 -1
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.js +128 -168
- package/dist/src/index.js.map +1 -1
- package/dist/src/migrate.d.ts +38 -0
- package/dist/src/migrate.js +646 -0
- package/dist/src/migrate.js.map +1 -0
- package/dist/src/workflows.d.ts +7 -37
- package/dist/src/workflows.js +49 -123
- package/dist/src/workflows.js.map +1 -1
- package/package.json +6 -4
- package/template/.speculo/README.md +20 -0
- package/template/.speculo/workspace.json +12 -0
- package/template/commands/docs-sync.md +28 -0
- package/template/commands/finalize.md +37 -0
- package/template/commands/knowledge-prune.md +20 -0
- package/template/commands/retro.md +15 -8
- package/template/commands/status.md +8 -51
- package/template/skills/agents-md-builder/SKILL.md +14 -101
- package/template/skills/change-lifecycle/SKILL.md +25 -0
- package/template/{workflows/dev/_templates → skills/change-lifecycle/assets}/completion-summary-template.md +2 -2
- package/template/{workflows/dev/_templates → skills/change-lifecycle/assets}/completion-verification-template.md +1 -1
- package/template/skills/change-lifecycle/references/completion-gate.md +19 -0
- package/template/skills/change-lifecycle/references/finalize-archive.md +32 -0
- package/template/skills/docs-sync/SKILL.md +22 -0
- package/template/skills/docs-sync/assets/report-template.md +45 -0
- package/template/skills/docs-sync/assets/state-template.json +20 -0
- package/template/skills/docs-sync/assets/workflow-scope-template.json +9 -0
- package/template/skills/docs-sync/references/agents-contract.md +43 -0
- package/template/skills/docs-sync/references/changelog-contract.md +39 -0
- package/template/skills/docs-sync/references/document-lifecycle-contract.md +38 -0
- package/template/skills/docs-sync/references/git-state-contract.md +67 -0
- package/template/skills/docs-sync/references/readme-contract.md +44 -0
- package/template/skills/docs-sync/references/workflow-scope-contract.md +50 -0
- package/template/skills/github-npm-ops/SKILL.md +14 -39
- package/template/skills/github-npm-ops/references/failure-recovery.md +1 -1
- package/template/skills/github-npm-ops/references/preflight-checklist.md +1 -1
- package/template/skills/github-npm-ops/references/release-notes-injection.md +1 -1
- package/template/skills/github-npm-ops/references/release-pipeline.md +13 -13
- package/template/skills/github-npm-ops/references/version-bump-flow.md +3 -3
- package/template/skills/knowledge-prune/SKILL.md +29 -0
- package/template/skills/knowledge-prune/references/audit-rules.md +24 -0
- package/template/skills/runtime-context/SKILL.md +43 -0
- package/template/skills/runtime-context/references/path-resolution.md +32 -0
- package/template/skills/speculo-retro/SKILL.md +13 -37
- package/template/skills/speculo-retro/references/friction-taxonomy.md +3 -3
- package/template/skills/speculo-retro/references/issue-drafting-sop.md +3 -3
- package/template/skills/worktree-isolation/SKILL.md +10 -46
- package/template/skills/worktree-isolation/references/audit-branch-tree.md +2 -2
- package/template/skills/worktree-isolation/references/create-worktree.md +6 -6
- package/template/skills/worktree-isolation/references/merge-and-cleanup.md +5 -5
- package/template/vendor/README.md +11 -10
- package/template/vendor/matt-pocock/README.md +41 -0
- package/template/vendor/matt-pocock/engineering/README.md +28 -0
- package/template/vendor/matt-pocock/engineering/ask-matt/SKILL.md +76 -0
- package/template/vendor/matt-pocock/engineering/code-review/SKILL.md +89 -0
- package/template/vendor/matt-pocock/engineering/codebase-design/DEEPENING.md +37 -0
- package/template/vendor/matt-pocock/engineering/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/template/vendor/matt-pocock/engineering/codebase-design/SKILL.md +114 -0
- package/template/vendor/matt-pocock/engineering/diagnosing-bugs/SKILL.md +134 -0
- package/template/vendor/matt-pocock/engineering/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/template/vendor/matt-pocock/engineering/domain-modeling/ADR-FORMAT.md +47 -0
- package/template/vendor/matt-pocock/engineering/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/template/vendor/matt-pocock/engineering/domain-modeling/SKILL.md +74 -0
- package/template/vendor/matt-pocock/engineering/grill-with-docs/SKILL.md +7 -0
- package/template/vendor/matt-pocock/engineering/implement/SKILL.md +15 -0
- package/template/vendor/matt-pocock/engineering/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/template/vendor/matt-pocock/engineering/improve-codebase-architecture/SKILL.md +66 -0
- package/template/vendor/matt-pocock/engineering/prototype/LOGIC.md +79 -0
- package/template/vendor/matt-pocock/engineering/prototype/SKILL.md +30 -0
- package/template/vendor/matt-pocock/engineering/prototype/UI.md +112 -0
- package/template/vendor/matt-pocock/engineering/research/SKILL.md +12 -0
- package/template/vendor/matt-pocock/engineering/resolving-merge-conflicts/SKILL.md +14 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/SKILL.md +127 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/domain.md +51 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/issue-tracker-github.md +45 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
- package/template/vendor/matt-pocock/engineering/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/template/vendor/matt-pocock/engineering/tdd/SKILL.md +36 -0
- package/template/vendor/matt-pocock/engineering/tdd/mocking.md +59 -0
- package/template/vendor/matt-pocock/engineering/tdd/tests.md +77 -0
- package/template/vendor/matt-pocock/engineering/to-spec/SKILL.md +75 -0
- package/template/vendor/matt-pocock/engineering/to-tickets/SKILL.md +113 -0
- package/template/vendor/matt-pocock/engineering/triage/AGENT-BRIEF.md +204 -0
- package/template/vendor/matt-pocock/engineering/triage/OUT-OF-SCOPE.md +104 -0
- package/template/vendor/matt-pocock/engineering/triage/SKILL.md +112 -0
- package/template/vendor/matt-pocock/engineering/wayfinder/SKILL.md +127 -0
- package/template/vendor/matt-pocock/in-progress/README.md +10 -0
- package/template/vendor/matt-pocock/in-progress/claude-handoff/SKILL.md +18 -0
- package/template/vendor/matt-pocock/in-progress/loop-me/SKILL.md +32 -0
- package/template/vendor/matt-pocock/in-progress/wizard/SKILL.md +45 -0
- package/template/vendor/matt-pocock/in-progress/wizard/template.sh +211 -0
- package/template/vendor/matt-pocock/in-progress/writing-beats/SKILL.md +67 -0
- package/template/vendor/matt-pocock/in-progress/writing-fragments/SKILL.md +78 -0
- package/template/vendor/matt-pocock/in-progress/writing-shape/SKILL.md +79 -0
- package/template/vendor/matt-pocock/productivity/README.md +18 -0
- package/template/vendor/matt-pocock/productivity/grill-me/SKILL.md +7 -0
- package/template/vendor/matt-pocock/productivity/grilling/SKILL.md +12 -0
- package/template/vendor/matt-pocock/productivity/handoff/SKILL.md +16 -0
- package/template/vendor/matt-pocock/productivity/teach/GLOSSARY-FORMAT.md +35 -0
- package/template/vendor/matt-pocock/productivity/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/template/vendor/matt-pocock/productivity/teach/MISSION-FORMAT.md +31 -0
- package/template/vendor/matt-pocock/productivity/teach/RESOURCES-FORMAT.md +32 -0
- package/template/vendor/matt-pocock/productivity/teach/SKILL.md +140 -0
- package/template/vendor/matt-pocock/productivity/writing-great-skills/GLOSSARY.md +201 -0
- package/template/vendor/matt-pocock/productivity/writing-great-skills/SKILL.md +83 -0
- package/template/workflows/matt-pocock/WORKFLOW.md +145 -0
- package/template/workflows/matt-pocock/_state/status.json +5 -0
- package/template/workflows/matt-pocock/routes/architecture.md +24 -0
- package/template/workflows/matt-pocock/routes/diagnose.md +22 -0
- package/template/workflows/matt-pocock/routes/experimental.md +18 -0
- package/template/workflows/matt-pocock/routes/idea-to-delivery.md +63 -0
- package/template/workflows/matt-pocock/routes/merge-conflicts.md +19 -0
- package/template/workflows/matt-pocock/routes/productivity.md +25 -0
- package/template/workflows/matt-pocock/routes/research-prototype.md +20 -0
- package/template/workflows/matt-pocock/routes/review.md +19 -0
- package/template/workflows/matt-pocock/routes/setup.md +42 -0
- package/template/workflows/matt-pocock/routes/triage.md +25 -0
- package/template/workflows/matt-pocock/routes/wayfinder.md +27 -0
- package/template/workflows/person/M-mao-zedong-cognitive-os/M-mao-zedong-cognitive-os.md +74 -59
- package/template/workflows/person/M-mao-zedong-cognitive-os/activate.md +2 -2
- package/template/workflows/person/M-mao-zedong-cognitive-os/deliver.md +5 -5
- package/template/workflows/person/M-mao-zedong-cognitive-os/diagnose.md +2 -2
- package/template/workflows/person/M-mao-zedong-cognitive-os/mobilize.md +4 -4
- package/template/workflows/person/M-mao-zedong-cognitive-os/strategize.md +3 -3
- package/template/workflows/person/WORKFLOW.md +68 -0
- package/template/workflows/person/_state/.config/LESSONS.md +3 -0
- package/template/workflows/person/_state/.config/RULES.md +3 -0
- package/template/workflows/person/_state/changes/.gitkeep +1 -0
- package/template/workflows/person/_state/status.json +5 -0
- package/template/.speculo/.config/LESSONS.md +0 -9
- package/template/.speculo/.config/RULES.md +0 -11
- package/template/.speculo/AGENTS.md +0 -30
- package/template/.speculo/archive/AGENTS.md +0 -28
- package/template/.speculo/archive/dev/.gitkeep +0 -0
- package/template/.speculo/archive/person/.gitkeep +0 -0
- package/template/.speculo/dev/.gitkeep +0 -0
- package/template/.speculo/dev/docs-sync-state.json +0 -14
- package/template/.speculo/dev-status.json +0 -3
- package/template/.speculo/doc-status.json +0 -3
- package/template/.speculo/person/.gitkeep +0 -0
- package/template/.speculo/person-status.json +0 -1
- package/template/commands/archive.md +0 -68
- package/template/commands/caveman.md +0 -50
- package/template/commands/config-prune.md +0 -59
- package/template/commands/grill-me.md +0 -48
- package/template/commands/handoff.md +0 -59
- package/template/commands/scaffold-exercises.md +0 -56
- package/template/commands/write-a-skill.md +0 -52
- package/template/skills/caveman/SKILL.md +0 -38
- package/template/skills/caveman/references/compression-rules.md +0 -102
- package/template/skills/config-prune/SKILL.md +0 -44
- package/template/skills/config-prune/references/audit-rules.md +0 -38
- package/template/skills/grill-me/SKILL.md +0 -40
- package/template/skills/handoff/SKILL.md +0 -73
- package/template/skills/scaffold-exercises/SKILL.md +0 -41
- package/template/skills/scaffold-exercises/references/exercise-structure.md +0 -85
- package/template/skills/scaffold-exercises/references/lint-and-git.md +0 -54
- package/template/skills/speculo-write/SKILL.md +0 -56
- package/template/skills/speculo-write/references/asset-selection-sop.md +0 -67
- package/template/skills/speculo-write/references/authoring-quality-levers.md +0 -61
- package/template/skills/speculo-write/references/command-authoring-sop.md +0 -98
- package/template/skills/speculo-write/references/migration-sop.md +0 -101
- package/template/skills/speculo-write/references/persistence-contract-sop.md +0 -271
- package/template/skills/speculo-write/references/skill-authoring-sop.md +0 -212
- package/template/skills/speculo-write/references/validation-checklist.md +0 -85
- package/template/skills/speculo-write/references/workflow-authoring-sop.md +0 -165
- package/template/vendor/codebase-design/DEEPENING.md +0 -37
- package/template/vendor/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/template/vendor/codebase-design/SKILL.md +0 -114
- package/template/vendor/officecli/SKILL.md +0 -415
- package/template/vendor/resolving-merge-conflicts/SKILL.md +0 -14
- package/template/workflows/dev/01-grill-with-docs/01-grill-with-docs.md +0 -107
- package/template/workflows/dev/01-grill-with-docs/grill-context-scan.md +0 -30
- package/template/workflows/dev/01-grill-with-docs/grill-decision.md +0 -38
- package/template/workflows/dev/02-prd/02-prd.md +0 -70
- package/template/workflows/dev/02-prd/prd-synthesis.md +0 -30
- package/template/workflows/dev/02-prd/prd-zoom-out.md +0 -29
- package/template/workflows/dev/03-tdd/03-tdd.md +0 -55
- package/template/workflows/dev/03-tdd/agents/tdd-finish-agent.md +0 -34
- package/template/workflows/dev/03-tdd/agents/tdd-implement-agent.md +0 -34
- package/template/workflows/dev/03-tdd/agents/tdd-plan-agent.md +0 -34
- package/template/workflows/dev/03-tdd/mocking.md +0 -43
- package/template/workflows/dev/03-tdd/refactoring.md +0 -10
- package/template/workflows/dev/03-tdd/tdd-finish.md +0 -34
- package/template/workflows/dev/03-tdd/tdd-loop.md +0 -36
- package/template/workflows/dev/03-tdd/tdd-plan.md +0 -37
- package/template/workflows/dev/03-tdd/tests.md +0 -61
- package/template/workflows/dev/04-finalize/04-finalize.md +0 -57
- package/template/workflows/dev/04-finalize/agents/completion-gate-agent.md +0 -35
- package/template/workflows/dev/04-finalize/completion-gate.md +0 -41
- package/template/workflows/dev/04-finalize/finalize-archive.md +0 -55
- package/template/workflows/dev/A-improve-architecture/A-improve-architecture.md +0 -60
- package/template/workflows/dev/A-improve-architecture/HTML-REPORT.md +0 -123
- package/template/workflows/dev/A-improve-architecture/architecture-grill.md +0 -30
- package/template/workflows/dev/A-improve-architecture/architecture-review.md +0 -29
- package/template/workflows/dev/A-improve-architecture/architecture-scan.md +0 -37
- package/template/workflows/dev/AGENTS.md +0 -95
- package/template/workflows/dev/D-docs-sync/D-docs-sync.md +0 -140
- package/template/workflows/dev/D-docs-sync/agents/docs-diff-agent.md +0 -34
- package/template/workflows/dev/D-docs-sync/agents/docs-update-agent.md +0 -34
- package/template/workflows/dev/D-docs-sync/agents-contract.md +0 -95
- package/template/workflows/dev/D-docs-sync/changelog-contract.md +0 -155
- package/template/workflows/dev/D-docs-sync/config-contract.md +0 -75
- package/template/workflows/dev/D-docs-sync/docs-sync-diff.md +0 -86
- package/template/workflows/dev/D-docs-sync/docs-sync-finish.md +0 -37
- package/template/workflows/dev/D-docs-sync/docs-sync-state.md +0 -47
- package/template/workflows/dev/D-docs-sync/docs-sync-update.md +0 -44
- package/template/workflows/dev/D-docs-sync/knowledge-extract.md +0 -66
- package/template/workflows/dev/D-docs-sync/readme-contract.md +0 -124
- package/template/workflows/dev/D-docs-sync/state-json-schema.md +0 -172
- package/template/workflows/dev/H-diagnose/H-diagnose.md +0 -108
- package/template/workflows/dev/H-diagnose/agents/diagnose-agent.md +0 -33
- package/template/workflows/dev/H-diagnose/agents/fix-agent.md +0 -34
- package/template/workflows/dev/H-diagnose/diagnose-fix.md +0 -34
- package/template/workflows/dev/H-diagnose/diagnose-guide.md +0 -144
- package/template/workflows/dev/H-diagnose/diagnose-loop.md +0 -41
- package/template/workflows/dev/H-diagnose/scripts/hitl-loop.template.sh +0 -41
- package/template/workflows/dev/I-to-issues/I-to-issues.md +0 -79
- package/template/workflows/dev/I-to-issues/issues-slices.md +0 -211
- package/template/workflows/dev/M-domain-modeling/ADR-FORMAT.md +0 -74
- package/template/workflows/dev/M-domain-modeling/CONTEXT-FORMAT.md +0 -67
- package/template/workflows/dev/M-domain-modeling/M-domain-modeling.md +0 -102
- package/template/workflows/dev/R-review/R-review.md +0 -75
- package/template/workflows/dev/R-review/agents/engineering-review-agent.md +0 -33
- package/template/workflows/dev/R-review/agents/spec-review-agent.md +0 -34
- package/template/workflows/dev/R-review/agents/standards-review-agent.md +0 -34
- package/template/workflows/dev/R-review/code-quality-checklist.md +0 -118
- package/template/workflows/dev/R-review/removal-checklist.md +0 -53
- package/template/workflows/dev/R-review/review-axes.md +0 -61
- package/template/workflows/dev/R-review/review-setup.md +0 -111
- package/template/workflows/dev/R-review/review-verdict.md +0 -43
- package/template/workflows/dev/R-review/security-checklist.md +0 -126
- package/template/workflows/dev/R-review/solid-checklist.md +0 -73
- package/template/workflows/dev/_templates/diagnosis-template.md +0 -20
- package/template/workflows/dev/_templates/docs-sync-report-template.md +0 -45
- package/template/workflows/dev/_templates/docs-sync-state-template.json +0 -14
- package/template/workflows/dev/_templates/domain-model-log-template.md +0 -20
- package/template/workflows/dev/_templates/grill-context-map-template.md +0 -20
- package/template/workflows/dev/_templates/grill-decision-log-template.md +0 -20
- package/template/workflows/dev/_templates/issues-slices-template.md +0 -106
- package/template/workflows/dev/_templates/overview-template.md +0 -19
- package/template/workflows/dev/_templates/prd-template.md +0 -26
- package/template/workflows/dev/_templates/regression-template.md +0 -20
- package/template/workflows/dev/_templates/review-report-template.md +0 -30
- package/template/workflows/dev/_templates/review-sources-template.md +0 -33
- package/template/workflows/dev/_templates/review-verdict-template.md +0 -33
- package/template/workflows/dev/_templates/tdd-log-template.md +0 -23
- package/template/workflows/dev/_templates/tdd-plan-template.md +0 -35
- package/template/workflows/dev/_templates/tdd-verification-template.md +0 -26
- package/template/workflows/doc/AGENTS.md +0 -80
- package/template/workflows/doc/B-writing-beats/B-writing-beats.md +0 -79
- package/template/workflows/doc/B-writing-beats/writing-beats-append.md +0 -31
- package/template/workflows/doc/B-writing-beats/writing-beats-options.md +0 -29
- package/template/workflows/doc/E-edit-article/E-edit-article.md +0 -79
- package/template/workflows/doc/E-edit-article/edit-article-plan.md +0 -30
- package/template/workflows/doc/E-edit-article/edit-article-rewrite.md +0 -31
- package/template/workflows/doc/F-writing-fragments/F-writing-fragments.md +0 -80
- package/template/workflows/doc/F-writing-fragments/writing-fragments-interview.md +0 -32
- package/template/workflows/doc/F-writing-fragments/writing-fragments-log.md +0 -29
- package/template/workflows/doc/S-writing-shape/S-writing-shape.md +0 -81
- package/template/workflows/doc/S-writing-shape/writing-shape-block.md +0 -32
- package/template/workflows/doc/S-writing-shape/writing-shape-opening.md +0 -27
- package/template/workflows/doc/T-teach/T-teach.md +0 -64
- package/template/workflows/doc/T-teach/teach-lesson-wrap.md +0 -63
- package/template/workflows/doc/T-teach/teach-lesson.md +0 -53
- package/template/workflows/doc/T-teach/teach-mission.md +0 -33
- package/template/workflows/doc/T-teach/teach-resources.md +0 -36
- package/template/workflows/doc/_templates/edit-article-plan-template.md +0 -25
- package/template/workflows/doc/_templates/edit-article-template.md +0 -7
- package/template/workflows/doc/_templates/teach-glossary-template.md +0 -26
- package/template/workflows/doc/_templates/teach-learning-record-template.md +0 -38
- package/template/workflows/doc/_templates/teach-lesson-html-template.md +0 -24
- package/template/workflows/doc/_templates/teach-mission-template.md +0 -19
- package/template/workflows/doc/_templates/teach-resources-template.md +0 -18
- package/template/workflows/doc/_templates/writing-article-template.md +0 -7
- package/template/workflows/doc/_templates/writing-beat-options-template.md +0 -21
- package/template/workflows/doc/_templates/writing-fragments-template.md +0 -7
- package/template/workflows/doc/_templates/writing-interview-log-template.md +0 -21
- package/template/workflows/doc/_templates/writing-shape-log-template.md +0 -25
- package/template/workflows/person/AGENTS.md +0 -72
- /package/template/{.speculo/.config/adr → workflows/matt-pocock/_state/archive}/.gitkeep +0 -0
- /package/template/{.speculo/.config/context → workflows/matt-pocock/_state/changes}/.gitkeep +0 -0
- /package/template/{.speculo/archive/doc → workflows/person/_state/.config/context}/.gitkeep +0 -0
- /package/template/{.speculo/doc → workflows/person/_state/archive}/.gitkeep +0 -0
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Workflow Authoring SOP
|
|
2
|
-
|
|
3
|
-
phase 的切分、完成准则与措辞遵循 `authoring-quality-levers.md` 的质量杠杆(**按序列拆分**隐藏后续步骤防过早完成、**完成标准**可检验且穷尽、**主导词**锚定调用与执行);本文只补 workflow 特有的结构与路径约束。
|
|
4
|
-
|
|
5
|
-
## 入口结构
|
|
6
|
-
|
|
7
|
-
workflow 放在 `template/workflows/<cat>/`,`<cat>` 只能是 `dev`、`doc`、`person`。`ops` 是预留分类,只有 `.speculo` 骨架和 workflow 分类同时落地后才能启用。
|
|
8
|
-
|
|
9
|
-
目录和入口文件必须同名:
|
|
10
|
-
|
|
11
|
-
```text
|
|
12
|
-
template/workflows/<cat>/<entry>/<entry>.md
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
主线 workflow 使用数字前缀,如 `01-grill-with-docs`。横向 workflow 使用字母前缀,如 `H-diagnose`、`R-review`、`D-docs-sync`。
|
|
16
|
-
|
|
17
|
-
## Frontmatter
|
|
18
|
-
|
|
19
|
-
入口 frontmatter 只承载发现元数据:
|
|
20
|
-
|
|
21
|
-
```yaml
|
|
22
|
-
---
|
|
23
|
-
id: <cat>/<name>
|
|
24
|
-
category: <cat>
|
|
25
|
-
name: <人类可读名>
|
|
26
|
-
description: <一句话用途>
|
|
27
|
-
keywords: [<关键词>]
|
|
28
|
-
---
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
禁止把 phases、模板、依赖、状态字段写进 frontmatter。
|
|
32
|
-
|
|
33
|
-
## 正文必备章节
|
|
34
|
-
|
|
35
|
-
入口正文必须包含:
|
|
36
|
-
|
|
37
|
-
- `## 阶段`
|
|
38
|
-
- `## 依赖`
|
|
39
|
-
- `## 状态扩展字段`
|
|
40
|
-
- `## 完成与状态更新`
|
|
41
|
-
|
|
42
|
-
阶段条目必须写清:
|
|
43
|
-
|
|
44
|
-
- 稳定 phase id(kebab-case,用于 `current_phase`)
|
|
45
|
-
- 规范 phase 文件
|
|
46
|
-
- 模板路径
|
|
47
|
-
- 产物文件名
|
|
48
|
-
- 完成准则
|
|
49
|
-
- 可选 agent 文件(若该 phase 支持隔离执行)
|
|
50
|
-
|
|
51
|
-
## Phase 文件
|
|
52
|
-
|
|
53
|
-
phase 文件不需要 frontmatter。每个 phase 文件写清:
|
|
54
|
-
|
|
55
|
-
- 输入
|
|
56
|
-
- 产物
|
|
57
|
-
- 填写引导
|
|
58
|
-
- 边界
|
|
59
|
-
- 完成准则
|
|
60
|
-
|
|
61
|
-
phase 文件只放该阶段执行所需内容,不重复入口文件的全局说明。
|
|
62
|
-
|
|
63
|
-
## Workflow Agents
|
|
64
|
-
|
|
65
|
-
适合隔离执行、并行审查或反自证验证的 phase 可以创建:
|
|
66
|
-
|
|
67
|
-
```text
|
|
68
|
-
template/workflows/<cat>/<entry>/agents/<name>-agent.md
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Agent 文件需要 frontmatter:
|
|
72
|
-
|
|
73
|
-
```yaml
|
|
74
|
-
---
|
|
75
|
-
id: <cat>/<entry>/<agent-name>
|
|
76
|
-
type: agent
|
|
77
|
-
name: <人类可读名>
|
|
78
|
-
description: <一句话说明该 agent 何时用于隔离执行>
|
|
79
|
-
---
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
正文必须包含:
|
|
83
|
-
|
|
84
|
-
- `## 使命`
|
|
85
|
-
- `## 输入契约`
|
|
86
|
-
- `## 执行规范`
|
|
87
|
-
- `## 产物与状态`
|
|
88
|
-
- `## 边界`
|
|
89
|
-
|
|
90
|
-
Agent 引用同目录 phase 文件、模板和 skill,不复制大段规范正文。Agent 只可写它声明的 phase 产物和 `.status.json` 扩展字段,不写 `change_status`。入口 `## 阶段` 必须列出对应 agent 相对路径。
|
|
91
|
-
|
|
92
|
-
## 模板
|
|
93
|
-
|
|
94
|
-
模板放在:
|
|
95
|
-
|
|
96
|
-
```text
|
|
97
|
-
template/workflows/<cat>/_templates/
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
命名:
|
|
101
|
-
|
|
102
|
-
```text
|
|
103
|
-
<name>-<artifact>-template.md
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
模板不写 frontmatter,顶部用归属说明:
|
|
107
|
-
|
|
108
|
-
```markdown
|
|
109
|
-
> **服务工作流:** `../<entry>/<entry>.md`
|
|
110
|
-
> **产物文件名:** `<artifact>.md`
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
模板占位符必须使用 `[TODO: ...]`。
|
|
114
|
-
|
|
115
|
-
## 持久化路径
|
|
116
|
-
|
|
117
|
-
workflow 产物写入:
|
|
118
|
-
|
|
119
|
-
```text
|
|
120
|
-
speculo/.speculo/<cat>/<change>/
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
当前 change 的状态写入:
|
|
124
|
-
|
|
125
|
-
```text
|
|
126
|
-
speculo/.speculo/<cat>/<change>/.status.json
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
顶层 active 索引写入:
|
|
130
|
-
|
|
131
|
-
```text
|
|
132
|
-
speculo/.speculo/<cat>-status.json
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
项目级规则、经验、上下文和 ADR 使用:
|
|
136
|
-
|
|
137
|
-
```text
|
|
138
|
-
speculo/.speculo/.config/RULES.md
|
|
139
|
-
speculo/.speculo/.config/LESSONS.md
|
|
140
|
-
speculo/.speculo/.config/context/
|
|
141
|
-
speculo/.speculo/.config/adr/
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
不要把新状态放到项目根目录。`.status.json` 元字段、顶层索引 schema 和写入责任表见 `persistence-contract-sop.md`。
|
|
145
|
-
|
|
146
|
-
`current_phase` 使用入口 `## 阶段` 声明的稳定 phase id;首个 workflow 进入 change 时写入 `execution_mode`。只有收尾 workflow 或 `archive` 命令可写 `change_status: completed | archived`,普通 workflow 只写自治状态字段。
|
|
147
|
-
|
|
148
|
-
## 索引与文档同步
|
|
149
|
-
|
|
150
|
-
新增 workflow 后检查:
|
|
151
|
-
|
|
152
|
-
- 对应分类的 `AGENTS.md` 是否需要新增别名
|
|
153
|
-
- `speculo/.speculo/<cat>-status.json` 和 `speculo/.speculo/<cat>/.gitkeep` 是否存在
|
|
154
|
-
- `speculo/.speculo/archive/<cat>/.gitkeep` 是否存在
|
|
155
|
-
- 项目若有 `docs/quick-reference.md` 等入口索引,是否需要新增条目
|
|
156
|
-
- CLI tests 是否需要断言复制新入口
|
|
157
|
-
|
|
158
|
-
## 完成线
|
|
159
|
-
|
|
160
|
-
- 入口 frontmatter 合规
|
|
161
|
-
- 正文必备章节齐全
|
|
162
|
-
- 所有跨文件引用使用相对路径
|
|
163
|
-
- 非模板文件不残留无说明 TODO
|
|
164
|
-
- 模板只保留 `[TODO: ...]` 占位符
|
|
165
|
-
- `pnpm test` 通过或记录无法运行原因
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# 深化(Deepening)
|
|
2
|
-
|
|
3
|
-
如何在给定依赖关系的情况下,安全地深化一组浅模块。假定使用 [SKILL.md](SKILL.md) 中的术语——**module(模块)**、**interface(接口)**、**seam(接缝)**、**adapter(适配器)**。
|
|
4
|
-
|
|
5
|
-
## 依赖分类
|
|
6
|
-
|
|
7
|
-
在评估深化候选时,对其依赖进行分类。分类决定了深化后的模块如何跨接缝进行测试。
|
|
8
|
-
|
|
9
|
-
### 1. 进程内(In-process)
|
|
10
|
-
|
|
11
|
-
纯计算、内存状态、无 I/O。始终可深化——合并模块,直接通过新接口进行测试。不需要适配器。
|
|
12
|
-
|
|
13
|
-
### 2. 本地可替换(Local-substitutable)
|
|
14
|
-
|
|
15
|
-
具有本地测试替代方案的依赖(Postgres 用 PGLite、内存文件系统)。如果存在替代方案则可深化。深化后的模块在测试套件中运行替代方案进行测试。接缝是内部的;模块外部接口处没有端口。
|
|
16
|
-
|
|
17
|
-
### 3. 远程但自有(Remote but owned)(端口与适配器)
|
|
18
|
-
|
|
19
|
-
跨网络边界的自有服务(微服务、内部 API)。在接缝处定义一个**端口(port)**(接口)。深度模块拥有逻辑;传输层作为**适配器(adapter)**注入。测试使用内存适配器。生产环境使用 HTTP/gRPC/队列适配器。
|
|
20
|
-
|
|
21
|
-
推荐形式:*"在接缝处定义一个端口,为生产环境实现 HTTP 适配器,为测试实现内存适配器,这样即使逻辑部署跨网络,仍位于一个深度模块中。"*
|
|
22
|
-
|
|
23
|
-
### 4. 真正外部(True external)(Mock)
|
|
24
|
-
|
|
25
|
-
你无法控制的第三方服务(Stripe、Twilio 等)。深化后的模块将外部依赖作为注入端口接收;测试提供 mock 适配器。
|
|
26
|
-
|
|
27
|
-
## 接缝纪律
|
|
28
|
-
|
|
29
|
-
- **一个适配器意味着假设的接缝。两个适配器才意味着真正的接缝。** 除非至少有两个适配器是合理的(通常是生产 + 测试),否则不要引入端口。单适配器接缝只是间接层。
|
|
30
|
-
- **内部接缝 vs 外部接缝。** 深度模块可以有内部接缝(对其实现私有,由其自身测试使用)以及其接口处的外部接缝。不要因为测试使用了内部接缝就通过接口暴露它们。
|
|
31
|
-
|
|
32
|
-
## 测试策略:替换,而非叠加
|
|
33
|
-
|
|
34
|
-
- 一旦深化模块接口层面的测试存在,浅模块的旧单元测试就成为废料——删除它们。
|
|
35
|
-
- 在深化模块的接口层面编写新测试。**接口就是测试面**。
|
|
36
|
-
- 测试通过接口断言可观察的结果,而非内部状态。
|
|
37
|
-
- 测试应能经受内部重构——它们描述的是行为,而非实现。如果一个测试在实现变更时必须随之改变,那它就是在测试接口背后的内容。
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# 设计两次(Design It Twice)
|
|
2
|
-
|
|
3
|
-
当用户想要为选定的深化候选探索替代接口时,使用此并行子代理模式。基于"设计两次"(Ousterhout)——你的第一个想法不太可能是最好的。
|
|
4
|
-
|
|
5
|
-
使用 [SKILL.md](SKILL.md) 中的术语——**module(模块)**、**interface(接口)**、**seam(接缝)**、**adapter(适配器)**、**leverage(杠杆)**。
|
|
6
|
-
|
|
7
|
-
## 流程
|
|
8
|
-
|
|
9
|
-
### 1. 界定问题空间
|
|
10
|
-
|
|
11
|
-
在生成子代理之前,为选定候选编写面向用户的问题空间说明:
|
|
12
|
-
|
|
13
|
-
- 任何新接口需要满足的约束
|
|
14
|
-
- 它将依赖的依赖项,以及它们属于哪个类别(参见 [DEEPENING.md](DEEPENING.md))
|
|
15
|
-
- 一个粗略的说明性代码草图,用于将约束具体化——不是提案,只是将约束变得具体的方式
|
|
16
|
-
|
|
17
|
-
将此展示给用户,然后立即进入第 2 步。用户在子代理并行工作时阅读和思考。
|
|
18
|
-
|
|
19
|
-
### 2. 生成子代理
|
|
20
|
-
|
|
21
|
-
使用 Agent 工具并行生成 3 个以上的子代理。每个子代理必须为深化后的模块生成一个**截然不同**的接口。
|
|
22
|
-
|
|
23
|
-
为每个子代理提供一个单独的技术概要(文件路径、耦合细节、来自 [DEEPENING.md](DEEPENING.md) 的依赖类别、接缝背后的内容)。该概要独立于第 1 步中面向用户的问题空间说明。给每个代理不同的设计约束:
|
|
24
|
-
|
|
25
|
-
- 代理 1:"最小化接口——目标是最多 1–3 个入口点。最大化每个入口点的杠杆效应。"
|
|
26
|
-
- 代理 2:"最大化灵活性——支持多种用例和扩展。"
|
|
27
|
-
- 代理 3:"针对最常见调用方优化——让默认情况变得简单。"
|
|
28
|
-
- 代理 4(如适用):"围绕端口与适配器设计跨接缝依赖。"
|
|
29
|
-
|
|
30
|
-
在概要中同时包含 [SKILL.md](SKILL.md) 词汇和 CONTEXT.md 词汇,以便每个子代理在命名时与架构语言和项目的领域语言保持一致。
|
|
31
|
-
|
|
32
|
-
每个子代理输出:
|
|
33
|
-
|
|
34
|
-
1. 接口(类型、方法、参数——加上不变量、排序、错误模式)
|
|
35
|
-
2. 使用示例,展示调用方如何使用
|
|
36
|
-
3. 实现隐藏在接缝背后的内容
|
|
37
|
-
4. 依赖策略和适配器(参见 [DEEPENING.md](DEEPENING.md))
|
|
38
|
-
5. 权衡——杠杆效应高的地方,薄弱的地方
|
|
39
|
-
|
|
40
|
-
### 3. 展示与比较
|
|
41
|
-
|
|
42
|
-
依次展示设计,以便用户逐一消化,然后用文字进行比较。通过**深度**(接口层面的杠杆效应)、**局部性**(变更集中的位置)和**接缝位置**进行对比。
|
|
43
|
-
|
|
44
|
-
比较后,给出你自己的推荐:你认为哪个设计最强以及为什么。如果来自不同设计的元素可以很好地组合,提出一个混合方案。要有明确的观点——用户想要的是一个强有力的解读,而不是一份菜单。
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: codebase-design
|
|
3
|
-
description: 设计深层模块的共享词汇。适用于用户想要设计或改进模块接口、寻找深化机会、决定接缝位置、使代码更可测试或对 AI 更可导航,或其他技能需要深层模块词汇的场景。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 代码库设计
|
|
7
|
-
|
|
8
|
-
设计**深层模块**:大量行为隐藏在小型接口之后,放置在清晰的接缝处,通过该接口可测试。在任何设计或重构代码的地方使用这套语言和原则。目标是为调用者提供杠杆,为维护者提供局部性,为所有人提供可测试性。
|
|
9
|
-
|
|
10
|
-
## 词汇表
|
|
11
|
-
|
|
12
|
-
严格使用这些术语——不要替换为"组件"、"服务"、"API"或"边界"。一致的语言是全部要点。
|
|
13
|
-
|
|
14
|
-
**模块**——任何有接口和实现的东西。刻意与规模无关:一个函数、类、包或跨层切片。*避免*:单元、组件、服务。
|
|
15
|
-
|
|
16
|
-
**接口**——调用者正确使用模块必须知道的一切:类型签名,还有不变量、排序约束、错误模式、所需配置和性能特征。*避免*:API、签名(太窄——它们仅指向类型层面的表面)。
|
|
17
|
-
|
|
18
|
-
**实现**——模块内部的内容,其代码体。区别于**适配器**:一个东西可以是一个小适配器带大实现(一个 Postgres 仓库)或一个大适配器带小实现(一个内存假对象)。当接缝是主题时用"适配器";否则用"实现"。
|
|
19
|
-
|
|
20
|
-
**深度**——接口处的杠杆:调用者(或测试)每学习单位接口能运用的行为量。一个模块是**深的**,当大量行为隐藏在小型接口之后;是**浅的**,当接口几乎和实现一样复杂。
|
|
21
|
-
|
|
22
|
-
**接缝** *(Michael Feathers)*——一个可以在不编辑该处的情况下改变行为的地方;模块接口所在的*位置*。接缝放在哪里是其自身的设计决策,区别于接缝后面是什么。*避免*:边界(被 DDD 的有界上下文过载)。
|
|
23
|
-
|
|
24
|
-
**适配器**——在接缝处满足接口的具体事物。描述*角色*(它填补哪个槽位),而非实质(里面是什么)。
|
|
25
|
-
|
|
26
|
-
**杠杆**——调用者从深度中获得的东西:每学习单位接口获得更多能力。一个实现付出,在 N 个调用点和 M 个测试中获得回报。
|
|
27
|
-
|
|
28
|
-
**局部性**——维护者从深度中获得的东西:变更、bug、知识和验证集中在一处,而不是分散在调用者中。一处修复,处处修复。
|
|
29
|
-
|
|
30
|
-
## 深 vs 浅
|
|
31
|
-
|
|
32
|
-
**深层模块** = 小接口 + 大量实现:
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
┌─────────────────────┐
|
|
36
|
-
│ 小型接口 │ ← 少数方法,简单参数
|
|
37
|
-
├─────────────────────┤
|
|
38
|
-
│ │
|
|
39
|
-
│ 深层实现 │ ← 复杂逻辑隐藏
|
|
40
|
-
│ │
|
|
41
|
-
└─────────────────────┘
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**浅层模块** = 大接口 + 少量实现(应避免):
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
┌─────────────────────────────────┐
|
|
48
|
-
│ 大型接口 │ ← 许多方法,复杂参数
|
|
49
|
-
├─────────────────────────────────┤
|
|
50
|
-
│ 薄实现 │ ← 只是传递
|
|
51
|
-
└─────────────────────────────────┘
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
设计接口时,问:
|
|
55
|
-
|
|
56
|
-
- 我能减少方法数量吗?
|
|
57
|
-
- 我能简化参数吗?
|
|
58
|
-
- 我能隐藏更多复杂性在内部吗?
|
|
59
|
-
|
|
60
|
-
## 原则
|
|
61
|
-
|
|
62
|
-
- **深度是接口的属性,而非实现的属性。** 一个深层模块可以在内部由小型、可 mock、可替换的部件组成——它们只是不是接口的一部分。一个模块可以有**内部接缝**(对其实现私有,由其自己的测试使用)以及其接口处的**外部接缝**。
|
|
63
|
-
- **删除测试。** 想象删除该模块。如果复杂性消失,它就是个传递。如果复杂性在 N 个调用者中重新出现,它就在赚取它的价值。
|
|
64
|
-
- **接口就是测试表面。** 调用者和测试跨越同一接缝。如果你想测试到接口*之外*,模块的形状可能不对。
|
|
65
|
-
- **一个适配器意味着假设的接缝。两个适配器意味着真实的接缝。** 除非某物确实在接缝处变化,否则不要引入接缝。
|
|
66
|
-
|
|
67
|
-
## 为可测试性设计
|
|
68
|
-
|
|
69
|
-
好的接口使测试变得自然:
|
|
70
|
-
|
|
71
|
-
1. **接受依赖,而非创建依赖。**
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
// 可测试
|
|
75
|
-
function processOrder(order, paymentGateway) {}
|
|
76
|
-
|
|
77
|
-
// 难以测试
|
|
78
|
-
function processOrder(order) {
|
|
79
|
-
const gateway = new StripeGateway();
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
2. **返回结果,而非产生副作用。**
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
// 可测试
|
|
87
|
-
function calculateDiscount(cart): Discount {}
|
|
88
|
-
|
|
89
|
-
// 难以测试
|
|
90
|
-
function applyDiscount(cart): void {
|
|
91
|
-
cart.total -= discount;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
3. **小表面积。** 更少的方法 = 需要更少的测试。更少的参数 = 更简单的测试设置。
|
|
96
|
-
|
|
97
|
-
## 关系
|
|
98
|
-
|
|
99
|
-
- 一个**模块**有且仅有一个**接口**(它呈现给调用者和测试的表面)。
|
|
100
|
-
- **深度**是**模块**的属性,对照其**接口**来衡量。
|
|
101
|
-
- **接缝**是模块**接口**所在之处。
|
|
102
|
-
- **适配器**位于**接缝**处并满足**接口**。
|
|
103
|
-
- **深度**为调用者产生**杠杆**,为维护者产生**局部性**。
|
|
104
|
-
|
|
105
|
-
## 拒绝的框架
|
|
106
|
-
|
|
107
|
-
- **深度为实现行数与接口行数之比**(Ousterhout):奖励填充实现。我们改用深度作为杠杆。
|
|
108
|
-
- **"接口"作为 TypeScript `interface` 关键字或类的公共方法**:太窄——这里的接口包括调用者必须知道的每个事实。
|
|
109
|
-
- **"边界"**:被 DDD 的有界上下文过载。说**接缝**或**接口**。
|
|
110
|
-
|
|
111
|
-
## 深入探索
|
|
112
|
-
|
|
113
|
-
- **给定依赖深化一个集群**——参见 [DEEPENING.md](DEEPENING.md):依赖类别、接缝规范和替换而非分层的测试。
|
|
114
|
-
- **探索替代接口**——参见 [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md):启动并行子代理以几种截然不同的方式设计接口,然后比较深度、局部性和接缝位置。
|