@seanmars/tospec 0.10.0 → 0.11.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.
Files changed (69) hide show
  1. package/dist/commands/config.d.ts.map +1 -1
  2. package/dist/commands/config.js +18 -8
  3. package/dist/commands/config.js.map +1 -1
  4. package/dist/commands/decision.js +4 -4
  5. package/dist/commands/decision.js.map +1 -1
  6. package/dist/core/archive.d.ts +3 -3
  7. package/dist/core/archive.js +8 -8
  8. package/dist/core/archive.js.map +1 -1
  9. package/dist/core/artifact-graph/resolver.d.ts +10 -0
  10. package/dist/core/artifact-graph/resolver.d.ts.map +1 -1
  11. package/dist/core/artifact-graph/resolver.js +28 -6
  12. package/dist/core/artifact-graph/resolver.js.map +1 -1
  13. package/dist/core/config-schema.d.ts +6 -0
  14. package/dist/core/config-schema.d.ts.map +1 -1
  15. package/dist/core/config-schema.js +36 -0
  16. package/dist/core/config-schema.js.map +1 -1
  17. package/dist/core/dashboard-data.d.ts +1 -1
  18. package/dist/core/dashboard-data.js +1 -1
  19. package/dist/core/migrate.d.ts.map +1 -1
  20. package/dist/core/migrate.js +2 -1
  21. package/dist/core/migrate.js.map +1 -1
  22. package/dist/core/parsers/change-parser.d.ts +11 -2
  23. package/dist/core/parsers/change-parser.d.ts.map +1 -1
  24. package/dist/core/parsers/change-parser.js +14 -0
  25. package/dist/core/parsers/change-parser.js.map +1 -1
  26. package/dist/core/parsers/requirement-blocks.d.ts +8 -0
  27. package/dist/core/parsers/requirement-blocks.d.ts.map +1 -1
  28. package/dist/core/parsers/requirement-blocks.js +10 -0
  29. package/dist/core/parsers/requirement-blocks.js.map +1 -1
  30. package/dist/core/shared/rules-generation.js +2 -2
  31. package/dist/core/shared/rules-generation.js.map +1 -1
  32. package/dist/core/specs-apply.d.ts +3 -2
  33. package/dist/core/specs-apply.d.ts.map +1 -1
  34. package/dist/core/specs-apply.js +127 -15
  35. package/dist/core/specs-apply.js.map +1 -1
  36. package/dist/core/templates/workflows/archive.js +3 -3
  37. package/dist/core/templates/workflows/decision.js +14 -14
  38. package/dist/core/templates/workflows/decision.js.map +1 -1
  39. package/dist/core/templates/workflows/explore.js +4 -4
  40. package/dist/core/templates/workflows/grill.js +4 -4
  41. package/dist/core/templates/workflows/propose.js +1 -1
  42. package/dist/core/templates/workflows/sync.js +10 -10
  43. package/dist/core/templates/workflows/update.d.ts.map +1 -1
  44. package/dist/core/templates/workflows/update.js +4 -3
  45. package/dist/core/templates/workflows/update.js.map +1 -1
  46. package/dist/core/validation/validator.d.ts.map +1 -1
  47. package/dist/core/validation/validator.js +23 -2
  48. package/dist/core/validation/validator.js.map +1 -1
  49. package/dist/utils/change-utils.d.ts +9 -4
  50. package/dist/utils/change-utils.d.ts.map +1 -1
  51. package/dist/utils/change-utils.js +13 -13
  52. package/dist/utils/change-utils.js.map +1 -1
  53. package/dist/utils/timestamp.d.ts +6 -0
  54. package/dist/utils/timestamp.d.ts.map +1 -1
  55. package/dist/utils/timestamp.js +9 -0
  56. package/dist/utils/timestamp.js.map +1 -1
  57. package/package.json +2 -1
  58. package/schemas/decision/schema.yaml +10 -7
  59. package/schemas/decision/templates/decision.md +22 -22
  60. package/schemas/issue/schema.yaml +15 -11
  61. package/schemas/issue/templates/spec.md +9 -9
  62. package/schemas/issue/templates/task.md +11 -11
  63. package/schemas/issue/templates/ticket.md +1 -1
  64. package/schemas/sdd/schema.yaml +36 -17
  65. package/schemas/sdd/templates/design.md +23 -3
  66. package/schemas/sdd/templates/proposal.md +5 -5
  67. package/schemas/sdd/templates/spec.md +9 -9
  68. package/schemas/sdd/templates/tasks.md +9 -9
  69. package/schemas/sdd/templates/ticket.md +1 -1
@@ -6,4 +6,10 @@
6
6
  * timestamp themselves, so the format lives in exactly one place.
7
7
  */
8
8
  export declare function formatTimestamp(date: Date): string;
9
+ /**
10
+ * Formats a Date as `yyyy-MM-dd` in local time. Use this for date-only metadata
11
+ * instead of `toISOString().split('T')[0]`, which truncates in UTC and records
12
+ * the wrong calendar day near local midnight.
13
+ */
14
+ export declare function formatLocalDate(date?: Date): string;
9
15
  //# sourceMappingURL=timestamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../src/utils/timestamp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CASlD"}
1
+ {"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../src/utils/timestamp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CASlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAG/D"}
@@ -15,4 +15,13 @@ export function formatTimestamp(date) {
15
15
  const seconds = pad(date.getSeconds());
16
16
  return `${year}${month}${day}_${hours}${minutes}${seconds}`;
17
17
  }
18
+ /**
19
+ * Formats a Date as `yyyy-MM-dd` in local time. Use this for date-only metadata
20
+ * instead of `toISOString().split('T')[0]`, which truncates in UTC and records
21
+ * the wrong calendar day near local midnight.
22
+ */
23
+ export function formatLocalDate(date = new Date()) {
24
+ const pad = (n) => String(n).padStart(2, '0');
25
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
26
+ }
18
27
  //# sourceMappingURL=timestamp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../src/utils/timestamp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvC,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC;AAC9D,CAAC"}
1
+ {"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../src/utils/timestamp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvC,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAa,IAAI,IAAI,EAAE;IACrD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9D,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AACpF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanmars/tospec",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Spec-driven development CLI for structured requirements and issue workflows",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -48,6 +48,7 @@
48
48
  "scripts": {
49
49
  "build": "node build.js",
50
50
  "skills": "node build.js && node scripts/gen-skills.mjs",
51
+ "templates": "node scripts/gen-templates.mjs",
51
52
  "dev": "tsc --watch",
52
53
  "test": "vitest run",
53
54
  "prepublish": "node build.js"
@@ -2,16 +2,19 @@ name: decision
2
2
  version: 1
3
3
  description: Architecture Decision Record (ADR) workflow
4
4
  artifacts:
5
- # decision 由專屬 `tospec decision` 指令建立於 tospec/decisions/<yyyy-MM-dd>-<topic>.md,
6
- # 不走 change 目錄; artifact 只作為 template 與段落驗證的資料契約。
5
+ # decision is created by the dedicated `tospec decision` command at
6
+ # tospec/decisions/<yyyy-MM-dd>-<topic>.md; it does not go through the change
7
+ # directory. This artifact only serves as the template and section-validation
8
+ # data contract.
7
9
  - id: decision
8
10
  generates: decision.md
9
- description: 單一 ADR 文件 狀態 / 背景 / 決策 / 影響 / 替代方案 / 後續工作
11
+ description: A single ADR — Status / Context / Decision / Impact / Alternatives / Follow-up
10
12
  template: decision.md
11
13
  requires: []
12
14
  instruction: |
13
- ADR 規範撰寫一份決策文件。狀態使用 proposed / accepted / superseded;
14
- superseded 需註明取代者。決策段要寫清楚選了什麼與為什麼, 替代方案列出評估過的
15
- 選項與各自優缺點, 影響段列出受影響的模組 / API / 文件 / 測試。
15
+ Write one decision record per ADR conventions. Status is proposed / accepted /
16
+ superseded; superseded must name its successor. The Decision section states
17
+ clearly what was chosen and why; Alternatives lists the options evaluated with
18
+ their trade-offs; Impact lists the affected modules / APIs / docs / tests.
16
19
  validation:
17
- requiredSections: [狀態, 背景, 決策, 影響, 替代方案, 後續工作]
20
+ requiredSections: [Status, Context, Decision, Impact, Alternatives, Follow-up]
@@ -1,37 +1,37 @@
1
- # [決策主題]
1
+ # [decision topic]
2
2
 
3
- ## 狀態
3
+ ## Status
4
4
 
5
5
  - proposed
6
- - 日期:[yyyyMMdd_HHmmss]
6
+ - Date: [yyyyMMdd_HHmmss]
7
7
 
8
- <!-- 狀態: proposed(已提出) / accepted(已採用) / superseded(已被取代, 需註明取代者) -->
8
+ <!-- Status: proposed / accepted / superseded (name the successor when superseded) -->
9
9
 
10
- ## 背景
11
- <!-- 為什麼要做這個決策: 現況、限制與需求目標 -->
10
+ ## Context
11
+ <!-- Why this decision is needed: current state, constraints, and requirement goals -->
12
12
 
13
- ## 決策
14
- <!-- 選了什麼方案; canonical 術語; 為什麼這樣選而非其他方案 -->
13
+ ## Decision
14
+ <!-- What was chosen; the canonical terms; why this over the other options -->
15
15
 
16
- ## 影響
17
- <!-- 受影響的模組 / API / 文件 / 測試 -->
16
+ ## Impact
17
+ <!-- Affected modules / APIs / docs / tests -->
18
18
 
19
- ## 替代方案
20
- <!-- 評估過哪些方案, 各自優缺點與結論 -->
19
+ ## Alternatives
20
+ <!-- Options evaluated, their trade-offs, and the conclusion -->
21
21
 
22
- ## 後續工作
23
- <!-- 分階段的後續實作項目 -->
22
+ ## Follow-up
23
+ <!-- Follow-up implementation items, phased if useful -->
24
24
 
25
- ## 關聯變更
26
- <!-- 選配: 實作此決策的 change ( tospec new change --decisions 反向連結); 列出 change 名稱, 歸檔後可補歸檔路徑; 尚無實作可省略 -->
25
+ ## Related Changes
26
+ <!-- Optional: changes that implement this decision (back-linked by tospec new change --decisions); list change names, add archive paths once archived; omit if none yet -->
27
27
 
28
- ## 決策過程
29
- <!-- 選配: 關鍵問答紀錄; 每組以 **Q:** 開頭, 下一段為回答; 摘要即可, 不貼逐字稿; 無互動討論可省略 -->
28
+ ## Decision Process
29
+ <!-- Optional: the key Q&A that shaped this decision; each pair starts with **Q:**, answer in the next paragraph; summarize, don't paste a transcript; omit if there was no interactive discussion -->
30
30
 
31
- **Q:** [問題]
31
+ **Q:** [question]
32
32
 
33
- [回答]
33
+ [answer]
34
34
 
35
- **Q:** [問題]
35
+ **Q:** [question]
36
36
 
37
- [回答]
37
+ [answer]
@@ -2,18 +2,20 @@ name: issue
2
2
  version: 1
3
3
  description: Diagnosis and repair workflow for issues
4
4
  artifacts:
5
- # ticket CLI 管理的全域索引 (tospec/tickets/<yyyyMMdd_HHmmss>-<name>.md),
6
- # 不是 graph artifact: `tospec new change` 自動產生於 change 目錄之外, 故不列於此。
5
+ # ticket is a CLI-managed global index (tospec/tickets/<yyyyMMdd_HHmmss>-<name>.md),
6
+ # not a graph artifact: `tospec new change` auto-generates it outside the change
7
+ # directory, so it is not listed here.
7
8
  - id: task
8
9
  generates: task.md
9
10
  description: Root-cause diagnosis and repair plan
10
11
  template: task.md
11
12
  requires: []
12
13
  instruction: |
13
- 診斷並撰寫 issue task: 先建立 tight feedback loop (一個指令能讓
14
- 這個 bug red), 3-5 個可否證的假設並排序, 逐一驗證後寫下根因。
15
- 內容: 根因分析、修正方案、測試計畫 (既有測試為何沒抓到 / 缺哪些
16
- edge case)、任務 checkbox 清單。
14
+ Diagnose and write the issue task: first build a tight feedback loop (one
15
+ command that turns this bug red), list 3-5 falsifiable hypotheses and rank
16
+ them, verify each, then write down the root cause. Contents: root-cause
17
+ analysis, fix plan, test plan (why existing tests missed it / which edge
18
+ cases are missing), and a task checkbox list.
17
19
  validation:
18
20
  requiredSections: [Feedback Loop, Root Cause, Fix Plan, Test Plan, Tasks]
19
21
  - id: specs
@@ -23,12 +25,14 @@ artifacts:
23
25
  requires: []
24
26
  optional: true
25
27
  instruction: |
26
- 僅當修正會改變對外行為時撰寫 delta specs (文法同 sdd)。
27
- bug 源於 spec 本身錯誤, MODIFIED 修正該 Requirement。
28
+ Write delta specs only when the fix changes externally observable behavior
29
+ (same grammar as sdd). If the bug stems from a wrong spec, fix that
30
+ Requirement with MODIFIED.
28
31
  apply:
29
32
  requires: [task]
30
33
  tracks: task.md
31
34
  instruction: |
32
- task.md 修正: 先確認是否已有相關測試
33
- 有且失敗找出為何失敗; 有且通過 檢查 edge case 缺漏, 補測試;
34
- 沒有先寫會 red 的回歸測試。修到全綠, 並驗證符合 task.md 規範。
35
+ Fix per task.md: first check whether a related test exists
36
+ exists and fails find out why it fails; exists and passes → check for missing
37
+ edge cases and add tests; none write a regression test that goes red first.
38
+ Fix until everything is green, and verify it matches task.md.
@@ -1,13 +1,13 @@
1
1
  ## ADDED Requirements
2
2
 
3
- ### Requirement: [名稱]
4
- [系統 SHALL/MUST ... 的行為描述 關鍵字必須在內文, 不能只在標題]
3
+ ### Requirement: [name]
4
+ [Behavior the system SHALL/MUST ... — the keyword must appear in the body, not only in the heading]
5
5
 
6
- #### Scenario: [情境名稱]
7
- - **WHEN** [條件]
8
- - **THEN** [結果]
9
- - **AND** [附加結果]
6
+ #### Scenario: [scenario name]
7
+ - **WHEN** [condition]
8
+ - **THEN** [outcome]
9
+ - **AND** [additional outcome]
10
10
 
11
- <!-- 亦可使用 MODIFIED、REMOVEDRENAMED Requirements
12
- MODIFIED 必須包含完整更新後的 requirement 區塊。
13
- REMOVED 必須包含 Reason MigrationRENAMED 使用 FROM/TO 配對。 -->
11
+ <!-- MODIFIED, REMOVED, and RENAMED Requirements may also be used.
12
+ MODIFIED must contain the full updated requirement block.
13
+ REMOVED must include Reason and Migration; RENAMED uses a FROM/TO pair. -->
@@ -1,21 +1,21 @@
1
- # Task: [issue 名稱]
1
+ # Task: [issue name]
2
2
 
3
3
  ## Feedback Loop
4
- [能讓這個 bug red 的單一指令]
4
+ [The single command that turns this bug red]
5
5
 
6
6
  ## Root Cause
7
- [驗證過的根因不是猜測; 附驗證方式]
7
+ [The verified root cause not a guess; include how it was verified]
8
8
 
9
9
  ## Fix Plan
10
- [修正方案與理由; 為什麼修這裡是根因修法而非症狀修法]
10
+ [The fix and its rationale; why fixing here is a root-cause fix rather than a symptom fix]
11
11
 
12
12
  ## Test Plan
13
- - 既有測試為何沒抓到: [分析]
14
- - 需補的測試 / edge cases: [清單]
13
+ - Why existing tests didn't catch it: [analysis]
14
+ - Tests / edge cases to add: [list]
15
15
 
16
16
  ## Tasks
17
- ### 1. 修正
18
- - [ ] 1.1 撰寫回歸測試 (red)
19
- - [ ] 1.2 實作修正至測試通過 (green)
20
- - [ ] 1.3 edge case 測試: [...]
21
- - [ ] 1.4 跑完整測試套件確認無回歸
17
+ ### 1. Fix
18
+ - [ ] 1.1 Write a regression test (red)
19
+ - [ ] 1.2 Implement the fix until the test passes (green)
20
+ - [ ] 1.3 Add edge-case tests: [...]
21
+ - [ ] 1.4 Run the full test suite to confirm no regressions
@@ -1,2 +1,2 @@
1
1
  ## Summary
2
- [一句話描述這個 issue 的現象 詳細根因/重現/修法見 task.md]
2
+ [One sentence describing the symptom of this issue — detailed root cause / repro / fix live in task.md]
@@ -2,17 +2,19 @@ name: sdd
2
2
  version: 1
3
3
  description: Spec-driven development workflow for new requirements
4
4
  artifacts:
5
- # ticket CLI 管理的全域索引 (tospec/tickets/<yyyyMMdd_HHmmss>-<name>.md),
6
- # 不是 graph artifact: `tospec new change` 自動產生於 change 目錄之外, 故不列於此。
5
+ # ticket is a CLI-managed global index (tospec/tickets/<yyyyMMdd_HHmmss>-<name>.md),
6
+ # not a graph artifact: `tospec new change` auto-generates it outside the change
7
+ # directory, so it is not listed here.
7
8
  - id: proposal
8
9
  generates: proposal.md
9
10
  description: Main proposal — why, what changes, capabilities, impact
10
11
  template: proposal.md
11
12
  requires: []
12
13
  instruction: |
13
- 承載主要細節: Why (動機, 為什麼現在做)What Changes (具體新增/修改/移除)、
14
- Capabilities (New/Modified capability 與對應 specs)、Impact (受影響的程式/API/相依/系統)。
15
- 這是 specs design 展開的依據; 禁止寫入檔案路徑與程式碼片段 (會過時)。
14
+ Carry the main detail: Why (motivation, why now), What Changes (concrete
15
+ add/modify/remove), Capabilities (New/Modified capabilities and their specs),
16
+ Impact (affected code/APIs/dependencies/systems). This is what specs and
17
+ design expand from; never write file paths or code snippets (they go stale).
16
18
  validation:
17
19
  requiredSections: [Why, What Changes, Impact]
18
20
  minSectionLength:
@@ -23,19 +25,34 @@ artifacts:
23
25
  template: spec.md
24
26
  requires: [proposal]
25
27
  instruction: |
26
- proposal 撰寫 delta specs。每個 capability 一個檔案。
27
- 文法: ## ADDED|MODIFIED|REMOVED|RENAMED Requirements /
28
- ### Requirement: <名稱> (內文必須含 SHALL MUST) /
29
- #### Scenario: <名稱> (四個 #, WHEN/THEN/AND bullet)
30
- MODIFIED 必須貼上完整更新後的 requirement 區塊。
28
+ Write delta specs from the proposal. One file per capability.
29
+ Grammar: ## ADDED|MODIFIED|REMOVED|RENAMED Requirements /
30
+ ### Requirement: <name> (the body must contain SHALL or MUST) /
31
+ #### Scenario: <name> (four #, WHEN/THEN/AND bullets).
32
+ MODIFIED must paste the full updated requirement block.
33
+ A new capability's delta must open with ## Purpose (one sentence on why this
34
+ capability exists); archive carries it into the newly created main spec. Do
35
+ not add Purpose to an existing capability's delta (edit the main spec's
36
+ Purpose directly instead).
31
37
  - id: design
32
38
  generates: design.md
33
39
  description: Technical design and testing seams
34
40
  template: design.md
35
41
  requires: [proposal]
36
42
  instruction: |
37
- 技術設計: ContextGoals/Non-GoalsDecisions、測試 seam 的選定
38
- (優先沿用既有 seam, 越高層越好, 數量越少越好)、Risks、Open Questions。
43
+ Technical design: Context, Goals/Non-Goals, Decisions, the chosen testing
44
+ seam (reuse an existing seam, the highest layer possible, as few as possible),
45
+ Migration Plan, Risks, Open Questions.
46
+ Decisions: one sub-block per decision, numbered `### D{index}: <title>`
47
+ (D1, D2, ...). Each opens with a short summary of what was decided, then adds
48
+ **Why** / **Trade-off** / **Alternative (rejected)** bullets as the decision
49
+ warrants — not every decision needs all three.
50
+ Migration Plan: only when the change alters existing data, config, or behavior;
51
+ otherwise write "No migration needed."
52
+ proposal covers why and what, design covers how: reference proposal.md, don't
53
+ restate it. Context holds only the current state and constraints the approach
54
+ needs (motivation lives in proposal.md - Why); Goals/Non-Goals add design-level
55
+ boundaries only, not a restatement of the proposal's scope.
39
56
  validation:
40
57
  requiredSections: [Context, Decisions, Testing Seams]
41
58
  - id: tasks
@@ -44,12 +61,14 @@ artifacts:
44
61
  template: tasks.md
45
62
  requires: [specs, design]
46
63
  instruction: |
47
- specs + design 切成 tracer-bullet 垂直切片任務。
48
- 每個任務群組 = 一條窄而完整的路徑 (可獨立驗證)
49
- 每個實作任務前面都要有對應的「先寫測試」任務 (TDD red 先行)。
64
+ Cut specs + design into tracer-bullet vertical slices.
65
+ Each task group = one narrow, complete path (independently verifiable).
66
+ Every implementation task is preceded by its own "write the test first" task
67
+ (TDD red before green).
50
68
  apply:
51
69
  requires: [tasks]
52
70
  tracks: tasks.md
53
71
  instruction: |
54
- tasks.md TDD 執行: 每個切片先寫失敗測試 (red), 再實作到通過 (green),
55
- 只測 design.md 選定的 seam。完成後對照 specs 驗證行為一致。
72
+ Execute tasks.md with TDD: each slice writes a failing test first (red), then
73
+ implements until it passes (green), testing only the seam design.md chose.
74
+ When done, verify behavior against the specs.
@@ -1,14 +1,34 @@
1
- # Design: [change 名稱]
1
+ # Design: [change name]
2
2
 
3
3
  ## Context
4
+ [Current state and constraints that shape the approach; see proposal.md - Why for motivation, don't restate it]
4
5
 
5
6
  ## Goals / Non-Goals
6
7
 
8
+ **Goals:**
9
+ [What this design aims to achieve]
10
+
11
+ **Non-Goals:**
12
+ [What is explicitly out of scope — design-level boundaries only, don't restate the proposal's scope]
13
+
7
14
  ## Decisions
8
- [每個決策: 選了什麼 / 考慮過什麼 / 為什麼]
15
+ <!-- One sub-block per decision, numbered D1, D2, ... Each opens with a short summary of what was
16
+ decided, then adds **Why** / **Trade-off** / **Alternative (rejected)** bullets as the
17
+ decision warrants (not every decision needs all three). Inline a trimmed code/type/schema
18
+ snippet only when it pins the decision more precisely than prose. -->
19
+
20
+ ### D1: [short title stating the decision]
21
+ [Summary: what was chosen and what it does.]
22
+
23
+ - **Why**: [rationale]
24
+ - **Trade-off**: [cost accepted — only if there is one]
25
+ - **Alternative (rejected)**: [option considered and why it lost — when a real one existed]
9
26
 
10
27
  ## Testing Seams
11
- [測試切入點: 沿用哪個既有 seam, 或新增哪個; 為什麼是這一層]
28
+ [The seam(s) tospec-apply will test at: reuse an existing seam over a new one, the highest layer that still catches the behavior, as few as possible (ideally one); say why this layer]
29
+
30
+ ## Migration Plan
31
+ [Only when the change alters existing data, config, or behavior: migration steps, backward-compat handling, rollout order. Otherwise: "No migration needed."]
12
32
 
13
33
  ## Risks / Trade-offs
14
34
 
@@ -1,15 +1,15 @@
1
1
  ## Why
2
- <!-- 動機: 解決什麼問題, 為什麼現在做 (>= 50 ) -->
2
+ <!-- Motivation: what problem does this solve, why now (>= 50 chars) -->
3
3
 
4
4
  ## What Changes
5
- <!-- 具體變更: 新增 / 修改 / 移除 了什麼 -->
5
+ <!-- Concrete changes: what is added / modified / removed -->
6
6
 
7
7
  ## Capabilities
8
8
  ### New Capabilities
9
- - `<name>`: <描述> (對應 specs/<name>/spec.md)
9
+ - `<name>`: <description> (maps to specs/<name>/spec.md)
10
10
 
11
11
  ### Modified Capabilities
12
- - `<existing-name>`: <改變的 requirement>
12
+ - `<existing-name>`: <the requirement that changes>
13
13
 
14
14
  ## Impact
15
- <!-- 受影響的程式 / API / 相依 / 系統 -->
15
+ <!-- Affected code / APIs / dependencies / systems -->
@@ -1,13 +1,13 @@
1
1
  ## ADDED Requirements
2
2
 
3
- ### Requirement: [名稱]
4
- [系統 SHALL/MUST ... 的行為描述 關鍵字必須在內文, 不能只在標題]
3
+ ### Requirement: [name]
4
+ [Behavior the system SHALL/MUST ... — the keyword must appear in the body, not only in the heading]
5
5
 
6
- #### Scenario: [情境名稱]
7
- - **WHEN** [條件]
8
- - **THEN** [結果]
9
- - **AND** [附加結果]
6
+ #### Scenario: [scenario name]
7
+ - **WHEN** [condition]
8
+ - **THEN** [outcome]
9
+ - **AND** [additional outcome]
10
10
 
11
- <!-- 亦可使用 MODIFIED、REMOVEDRENAMED Requirements
12
- MODIFIED 必須包含完整更新後的 requirement 區塊。
13
- REMOVED 必須包含 Reason MigrationRENAMED 使用 FROM/TO 配對。 -->
11
+ <!-- MODIFIED, REMOVED, and RENAMED Requirements may also be used.
12
+ MODIFIED must contain the full updated requirement block.
13
+ REMOVED must include Reason and Migration; RENAMED uses a FROM/TO pair. -->
@@ -1,11 +1,11 @@
1
- # Tasks: [change 名稱]
1
+ # Tasks: [change name]
2
2
 
3
- ## 1. [切片名稱一條垂直路徑]
4
- - [ ] 1.1 撰寫失敗測試: [對應的 Scenario 名稱]
5
- - [ ] 1.2 實作至測試通過
6
- - [ ] 1.3 對照 spec 驗證行為
3
+ ## 1. [slice name one vertical path]
4
+ - [ ] 1.1 Write a failing test: [corresponding Scenario name]
5
+ - [ ] 1.2 Implement until the test passes
6
+ - [ ] 1.3 Verify behavior against the spec
7
7
 
8
- ## 2. [下一個切片]
9
- - [ ] 2.1 撰寫失敗測試
10
- - [ ] 2.2 實作至測試通過
11
- - [ ] 2.3 對照 spec 驗證行為
8
+ ## 2. [next slice]
9
+ - [ ] 2.1 Write a failing test
10
+ - [ ] 2.2 Implement until the test passes
11
+ - [ ] 2.3 Verify behavior against the spec
@@ -1,2 +1,2 @@
1
1
  ## Summary
2
- [一句話描述這個 change 要做什麼詳細 why/what/capabilities/impact proposal.md]
2
+ [One sentence describing what this change doesdetailed why/what/capabilities/impact live in proposal.md]