@namewta/speculo 0.7.2 → 0.7.3

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 (53) hide show
  1. package/dist/src/migrations.js +604 -23
  2. package/dist/src/migrations.js.map +1 -1
  3. package/package.json +1 -1
  4. package/template/canonical/canonical-specdev-engineering-cognitive-mentor.md +171 -455
  5. package/template/canonical/canonical-specdev-goal-plan.md +686 -1117
  6. package/template/canonical/canonical-specdev-grill-with-docs.md +172 -456
  7. package/template/canonical/canonical-specdev-spec.md +199 -493
  8. package/template/canonical/canonical-specdev-tickets.md +378 -597
  9. package/template/canonical/canonical-specdev-wayfinder.md +170 -454
  10. package/template/skills/migrate-runtime-state/SKILL.md +6 -6
  11. package/template/skills/migrate-runtime-state/references/migration-contract.md +9 -3
  12. package/template/skills/migrate-runtime-state/scripts/migrate-runtime-state.mjs +322 -33
  13. package/template/workflows/specdev/I-implement/I-implement.md +97 -143
  14. package/template/workflows/specdev/I-implement/evidence-template.md +60 -48
  15. package/template/workflows/specdev/I-implement/execution-preflight.md +29 -21
  16. package/template/workflows/specdev/I-implement/merge-conflict-protocol.md +12 -12
  17. package/template/workflows/specdev/I-init-setup/I-init-setup.md +4 -5
  18. package/template/workflows/specdev/I-init-setup/change-status-template.json +14 -1
  19. package/template/workflows/specdev/I-init-setup/config-template.json +3 -5
  20. package/template/workflows/specdev/I-init-setup/status-template.json +1 -1
  21. package/template/workflows/specdev/INDEX.md +11 -8
  22. package/template/workflows/specdev/P-goal-plan/P-goal-plan.md +76 -102
  23. package/template/workflows/specdev/P-goal-plan/completion-control.md +26 -44
  24. package/template/workflows/specdev/P-goal-plan/goal-plan-template.md +40 -37
  25. package/template/workflows/specdev/P-goal-plan/lead-orchestration.md +34 -0
  26. package/template/workflows/specdev/P-goal-plan/orchestration-protocol.md +31 -46
  27. package/template/workflows/specdev/P-goal-plan/planning-modes.md +42 -76
  28. package/template/workflows/specdev/T-tickets/T-tickets.md +6 -3
  29. package/template/workflows/specdev/T-tickets/ticket-readiness.md +5 -3
  30. package/template/workflows/specdev/T-tickets/ticket-template.md +8 -1
  31. package/template/workflows/specdev/T-tickets/tickets-map-template.md +5 -4
  32. package/template/workflows/specdev/_state/status.json +1 -1
  33. package/template/workflows/specdev/common/README.md +2 -2
  34. package/template/workflows/specdev/common/rules/change-completion.md +17 -20
  35. package/template/workflows/specdev/common/rules/deviation-control.md +1 -1
  36. package/template/workflows/specdev/common/rules/evidence-and-verification.md +27 -37
  37. package/template/workflows/specdev/common/rules/path-ownership.md +21 -23
  38. package/template/workflows/specdev/common/rules/readiness-and-depth.md +1 -1
  39. package/template/workflows/specdev/common/schemas/change-status.schema.json +136 -373
  40. package/template/workflows/specdev/common/schemas/config.schema.json +9 -11
  41. package/template/workflows/specdev/common/schemas/goal-plan.schema.json +24 -16
  42. package/template/workflows/specdev/common/schemas/status.schema.json +7 -63
  43. package/template/workflows/specdev/common/skills/dev-worktree/SKILL.md +42 -21
  44. package/template/workflows/specdev/common/skills/dev-worktree/references/create.md +36 -21
  45. package/template/workflows/specdev/common/skills/dev-worktree/references/finalize.md +46 -18
  46. package/template/workflows/specdev/common/skills/subagent-delivery/SKILL.md +34 -31
  47. package/template/workflows/specdev/common/skills/subagent-delivery/references/external-web-subagent.md +10 -23
  48. package/template/workflows/specdev/common/skills/subagent-delivery/references/native-subagent.md +15 -25
  49. package/template/workflows/specdev/common/tools/validate-specdev.mjs +386 -209
  50. package/template/workflows/specdev/I-implement/delegated-evidence-template.md +0 -12
  51. package/template/workflows/specdev/P-goal-plan/delegated-execution-template.md +0 -35
  52. package/template/workflows/specdev/P-goal-plan/delegated-execution.md +0 -59
  53. package/template/workflows/specdev/P-goal-plan/workspace-execution-template.md +0 -24
@@ -1530,7 +1530,7 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1530
1530
 
1531
1531
  - 未批准的 ticket、spec、architecture 或 release 偏差不得继续实现。
1532
1532
  - 不得通过扩大 `writable_paths`、删除测试、降低断言或把风险改写成“已知限制”来绕过停止。
1533
- - 偏差影响普通并行执行时,当前集成 owner 必须暂停受影响 Wave,重新计算路径所有权、依赖和 Gate;委派执行由 Lead 承担同一责任。
1533
+ - 偏差影响并行执行、source checkpoint 或 candidate 集成时,Lead 必须暂停受影响 Wave,重新计算路径所有权、依赖、Gate 与父分支顺序;任何 subagent 都不能自行改写上层合同。
1534
1534
 
1535
1535
  </deviation-control>
1536
1536
 
@@ -1593,16 +1593,14 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1593
1593
 
1594
1594
  ```json
1595
1595
  {
1596
- "schema_version": 3,
1596
+ "schema_version": 4,
1597
1597
  "interaction_language": "zh-CN",
1598
1598
  "artifact_language": "zh-CN",
1599
1599
  "git": {
1600
- "auto_commit": false,
1601
- "default_branch": null,
1602
- "worktree_for_parallel": true
1600
+ "default_branch": null
1603
1601
  },
1604
1602
  "execution": {
1605
- "max_parallel": 3,
1603
+ "max_implementation_agents": 3,
1606
1604
  "deep_ticket_human_approval": true,
1607
1605
  "shared_path_owner": "explicit"
1608
1606
  },
@@ -1627,33 +1625,31 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1627
1625
  ```json
1628
1626
  {
1629
1627
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1630
- "$id": "urn:speculo:specdev:config:v3",
1628
+ "$id": "urn:speculo:specdev:config:v4",
1631
1629
  "title": "SpecDev Configuration",
1632
1630
  "type": "object",
1633
1631
  "required": ["schema_version", "interaction_language", "artifact_language", "git", "execution", "verification", "planning"],
1634
1632
  "properties": {
1635
- "schema_version": {"const": 3},
1633
+ "schema_version": {"const": 4},
1636
1634
  "interaction_language": {"type": "string", "minLength": 1},
1637
1635
  "artifact_language": {"type": "string", "minLength": 1},
1638
1636
  "git": {
1639
1637
  "type": "object",
1640
- "required": ["auto_commit", "default_branch", "worktree_for_parallel"],
1638
+ "required": ["default_branch"],
1641
1639
  "properties": {
1642
- "auto_commit": {"type": "boolean"},
1643
- "default_branch": {"type": ["string", "null"]},
1644
- "worktree_for_parallel": {"type": "boolean"}
1640
+ "default_branch": {"type": ["string", "null"]}
1645
1641
  },
1646
- "additionalProperties": true
1642
+ "additionalProperties": false
1647
1643
  },
1648
1644
  "execution": {
1649
1645
  "type": "object",
1650
- "required": ["max_parallel", "deep_ticket_human_approval", "shared_path_owner"],
1646
+ "required": ["max_implementation_agents", "deep_ticket_human_approval", "shared_path_owner"],
1651
1647
  "properties": {
1652
- "max_parallel": {"type": "integer", "minimum": 1},
1648
+ "max_implementation_agents": {"type": "integer", "minimum": 1, "maximum": 3},
1653
1649
  "deep_ticket_human_approval": {"type": "boolean"},
1654
1650
  "shared_path_owner": {"type": "string", "minLength": 1}
1655
1651
  },
1656
- "additionalProperties": true
1652
+ "additionalProperties": false
1657
1653
  },
1658
1654
  "verification": {
1659
1655
  "type": "object",
@@ -1677,7 +1673,7 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1677
1673
  "additionalProperties": true
1678
1674
  }
1679
1675
  },
1680
- "additionalProperties": true
1676
+ "additionalProperties": false
1681
1677
  }
1682
1678
  ```
1683
1679
 
@@ -1687,7 +1683,7 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1687
1683
 
1688
1684
  ```json
1689
1685
  {
1690
- "schema_version": 4,
1686
+ "schema_version": 5,
1691
1687
  "workflow": "specdev",
1692
1688
  "active": [],
1693
1689
  "archived": []
@@ -1701,83 +1697,27 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1701
1697
  ```json
1702
1698
  {
1703
1699
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1704
- "$id": "urn:speculo:specdev:status:v4",
1700
+ "$id": "urn:speculo:specdev:status:v5",
1705
1701
  "title": "SpecDev Global Status",
1706
1702
  "type": "object",
1707
- "required": [
1708
- "schema_version",
1709
- "workflow",
1710
- "active",
1711
- "archived"
1712
- ],
1703
+ "required": ["schema_version", "workflow", "active", "archived"],
1713
1704
  "properties": {
1714
- "schema_version": {
1715
- "const": 4
1716
- },
1717
- "workflow": {
1718
- "const": "specdev"
1719
- },
1705
+ "schema_version": {"const": 5},
1706
+ "workflow": {"const": "specdev"},
1720
1707
  "active": {
1721
1708
  "type": "array",
1722
1709
  "items": {
1723
1710
  "type": "object",
1724
- "required": [
1725
- "change",
1726
- "current_work",
1727
- "works_run"
1728
- ],
1711
+ "required": ["change"],
1729
1712
  "properties": {
1730
1713
  "change": {
1731
1714
  "type": "string",
1732
1715
  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"
1733
- },
1734
- "current_work": {
1735
- "type": [
1736
- "string",
1737
- "null"
1738
- ],
1739
- "pattern": "^specdev/"
1740
- },
1741
- "works_run": {
1742
- "type": "array",
1743
- "items": {
1744
- "type": "string",
1745
- "pattern": "^specdev/"
1746
- },
1747
- "uniqueItems": true
1748
- },
1749
- "claimed_investigations": {
1750
- "type": "array",
1751
- "items": {
1752
- "type": "object",
1753
- "required": [
1754
- "id",
1755
- "owner",
1756
- "claimed_at"
1757
- ],
1758
- "properties": {
1759
- "id": {
1760
- "type": "string"
1761
- },
1762
- "owner": {
1763
- "type": "string"
1764
- },
1765
- "session": {
1766
- "type": [
1767
- "string",
1768
- "null"
1769
- ]
1770
- },
1771
- "claimed_at": {
1772
- "type": "string"
1773
- }
1774
- },
1775
- "additionalProperties": false
1776
- }
1777
1716
  }
1778
1717
  },
1779
1718
  "additionalProperties": false
1780
- }
1719
+ },
1720
+ "uniqueItems": true
1781
1721
  },
1782
1722
  "archived": {
1783
1723
  "type": "array",
@@ -1798,11 +1738,24 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1798
1738
 
1799
1739
  ```json
1800
1740
  {
1801
- "schema_version": 3,
1741
+ "schema_version": 5,
1802
1742
  "artifact": "change-status",
1803
1743
  "change": "<YYYY-MM-DD-topic>",
1804
1744
  "change_status": "active",
1805
1745
  "current_work": null,
1746
+ "works_run": [],
1747
+ "claimed_investigations": [],
1748
+ "execution_authorization": {
1749
+ "implementation_commit": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Ticket source commits"},
1750
+ "local_candidate_integration": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Lead-owned local parent candidate integration and parent update"},
1751
+ "source_cleanup": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Source worktree and branch cleanup"}
1752
+ },
1753
+ "leadership": {
1754
+ "current": "<owner-or-session-locator>",
1755
+ "epoch": 1,
1756
+ "assigned_at": "<ISO-8601>",
1757
+ "history": []
1758
+ },
1806
1759
  "created_at": "<ISO-8601>",
1807
1760
  "updated_at": "<ISO-8601>",
1808
1761
  "completed_at": null,
@@ -1821,394 +1774,157 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1821
1774
  ```json
1822
1775
  {
1823
1776
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1824
- "$id": "urn:speculo:specdev:change-status:v3",
1777
+ "$id": "urn:speculo:specdev:change-status:v5",
1825
1778
  "title": "SpecDev Change Status",
1826
1779
  "type": "object",
1827
1780
  "required": [
1828
- "schema_version",
1829
- "artifact",
1830
- "change",
1831
- "change_status",
1832
- "current_work",
1833
- "created_at",
1834
- "updated_at",
1835
- "completed_at",
1836
- "archived",
1837
- "archive_path",
1838
- "blockers",
1839
- "deviations"
1781
+ "schema_version", "artifact", "change", "change_status", "current_work", "works_run",
1782
+ "claimed_investigations", "execution_authorization", "leadership", "created_at", "updated_at",
1783
+ "completed_at", "archived", "archive_path", "blockers", "deviations", "worktrees"
1840
1784
  ],
1841
1785
  "properties": {
1842
- "schema_version": {
1843
- "const": 3
1844
- },
1845
- "artifact": {
1846
- "const": "change-status"
1847
- },
1848
- "change": {
1849
- "type": "string",
1850
- "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"
1851
- },
1852
- "change_status": {
1853
- "enum": [
1854
- "active",
1855
- "blocked",
1856
- "completed",
1857
- "archived"
1858
- ]
1859
- },
1860
- "current_work": {
1861
- "type": [
1862
- "string",
1863
- "null"
1864
- ]
1865
- },
1866
- "created_at": {
1867
- "type": "string",
1868
- "minLength": 1
1869
- },
1870
- "updated_at": {
1871
- "type": "string",
1872
- "minLength": 1
1786
+ "schema_version": {"const": 5},
1787
+ "artifact": {"const": "change-status"},
1788
+ "change": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"},
1789
+ "change_status": {"enum": ["active", "blocked", "completed", "archived"]},
1790
+ "current_work": {"type": ["string", "null"], "pattern": "^specdev/"},
1791
+ "works_run": {"type": "array", "items": {"type": "string", "pattern": "^specdev/"}, "uniqueItems": true},
1792
+ "claimed_investigations": {"type": "array", "items": {"$ref": "#/$defs/claim"}},
1793
+ "execution_authorization": {"$ref": "#/$defs/authorization"},
1794
+ "leadership": {"$ref": "#/$defs/leadership"},
1795
+ "created_at": {"type": "string", "minLength": 1},
1796
+ "updated_at": {"type": "string", "minLength": 1},
1797
+ "completed_at": {"type": ["string", "null"]},
1798
+ "archived": {"type": "boolean"},
1799
+ "archive_path": {"anyOf": [{"type": "null"}, {"type": "string", "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"}]},
1800
+ "blockers": {"type": "array", "items": {"type": "string"}},
1801
+ "deviations": {"type": "array", "items": {"type": "string"}},
1802
+ "worktrees": {"type": "array", "items": {"$ref": "#/$defs/worktree"}}
1803
+ },
1804
+ "$defs": {
1805
+ "claim": {
1806
+ "type": "object",
1807
+ "required": ["id", "owner", "session", "claimed_at"],
1808
+ "properties": {
1809
+ "id": {"type": "string", "minLength": 1},
1810
+ "owner": {"type": "string", "minLength": 1},
1811
+ "session": {"type": ["string", "null"]},
1812
+ "claimed_at": {"type": "string", "minLength": 1}
1813
+ },
1814
+ "additionalProperties": false
1873
1815
  },
1874
- "completed_at": {
1875
- "type": [
1876
- "string",
1877
- "null"
1878
- ]
1816
+ "authorization-entry": {
1817
+ "type": "object",
1818
+ "required": ["status", "source", "granted_at", "scope"],
1819
+ "properties": {
1820
+ "status": {"enum": ["authorized", "not-authorized", "revoked"]},
1821
+ "source": {"type": ["string", "null"]},
1822
+ "granted_at": {"type": ["string", "null"]},
1823
+ "scope": {"type": "string", "minLength": 1}
1824
+ },
1825
+ "allOf": [{
1826
+ "if": {"properties": {"status": {"const": "authorized"}}, "required": ["status"]},
1827
+ "then": {"properties": {"source": {"type": "string", "minLength": 1}, "granted_at": {"type": "string", "minLength": 1}}}
1828
+ }],
1829
+ "additionalProperties": false
1879
1830
  },
1880
- "archived": {
1881
- "type": "boolean"
1831
+ "authorization": {
1832
+ "type": "object",
1833
+ "required": ["implementation_commit", "local_candidate_integration", "source_cleanup"],
1834
+ "properties": {
1835
+ "implementation_commit": {"$ref": "#/$defs/authorization-entry"},
1836
+ "local_candidate_integration": {"$ref": "#/$defs/authorization-entry"},
1837
+ "source_cleanup": {"$ref": "#/$defs/authorization-entry"}
1838
+ },
1839
+ "additionalProperties": false
1882
1840
  },
1883
- "archive_path": {
1884
- "anyOf": [
1885
- {
1886
- "type": "null"
1887
- },
1888
- {
1889
- "type": "string",
1890
- "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"
1891
- }
1892
- ]
1841
+ "leadership-history": {
1842
+ "type": "object",
1843
+ "required": ["owner", "epoch", "assigned_at", "ended_at"],
1844
+ "properties": {
1845
+ "owner": {"type": "string", "minLength": 1},
1846
+ "epoch": {"type": "integer", "minimum": 1},
1847
+ "assigned_at": {"type": "string", "minLength": 1},
1848
+ "ended_at": {"type": "string", "minLength": 1}
1849
+ },
1850
+ "additionalProperties": false
1893
1851
  },
1894
- "blockers": {
1895
- "type": "array",
1896
- "items": {
1897
- "type": "string"
1898
- }
1852
+ "leadership": {
1853
+ "type": "object",
1854
+ "required": ["current", "epoch", "assigned_at", "history"],
1855
+ "properties": {
1856
+ "current": {"type": "string", "minLength": 1},
1857
+ "epoch": {"type": "integer", "minimum": 1},
1858
+ "assigned_at": {"type": "string", "minLength": 1},
1859
+ "history": {"type": "array", "items": {"$ref": "#/$defs/leadership-history"}}
1860
+ },
1861
+ "additionalProperties": false
1899
1862
  },
1900
- "deviations": {
1901
- "type": "array",
1902
- "items": {
1903
- "type": "string"
1904
- }
1863
+ "full-suite": {
1864
+ "type": "object",
1865
+ "required": ["required", "status", "reason", "evidence"],
1866
+ "properties": {
1867
+ "required": {"type": "boolean"},
1868
+ "status": {"enum": ["not-required", "pending", "passed", "failed"]},
1869
+ "reason": {"type": ["string", "null"]},
1870
+ "evidence": {"type": ["string", "null"]}
1871
+ },
1872
+ "allOf": [{
1873
+ "if": {"properties": {"required": {"const": false}}, "required": ["required"]},
1874
+ "then": {"properties": {"status": {"const": "not-required"}, "reason": {"type": "string", "minLength": 1}}}
1875
+ }],
1876
+ "additionalProperties": false
1905
1877
  },
1906
- "worktrees": {
1907
- "type": "array",
1908
- "items": {
1909
- "type": "object",
1910
- "required": [
1911
- "ticket_id",
1912
- "owner",
1913
- "provider",
1914
- "base_sha",
1915
- "branch",
1916
- "workspace_ref",
1917
- "status",
1918
- "updated_at"
1919
- ],
1920
- "properties": {
1921
- "ticket_id": {
1922
- "type": "string",
1923
- "pattern": "^T-[0-9]{2,}$"
1924
- },
1925
- "owner": {
1926
- "type": "string",
1927
- "minLength": 1
1928
- },
1929
- "integration_owner": {
1930
- "type": "string",
1931
- "minLength": 1
1932
- },
1933
- "provider": {
1934
- "enum": [
1935
- "native",
1936
- "git",
1937
- "external"
1938
- ]
1939
- },
1940
- "base_sha": {
1941
- "type": "string",
1942
- "minLength": 1
1943
- },
1944
- "parent_branch": {
1945
- "type": "string",
1946
- "minLength": 1
1947
- },
1948
- "branch": {
1949
- "type": "string",
1950
- "minLength": 1
1951
- },
1952
- "workspace_ref": {
1953
- "type": "string",
1954
- "minLength": 1,
1955
- "pattern": "^(?!/)(?![A-Za-z]:[\\\\/]).+"
1956
- },
1957
- "terminal_action": {
1958
- "enum": [
1959
- "integrate",
1960
- "retain"
1961
- ]
1962
- },
1963
- "source_checkpoint": {
1964
- "type": [
1965
- "string",
1966
- "null"
1967
- ]
1968
- },
1969
- "integration": {
1970
- "type": "object",
1971
- "required": [
1972
- "status",
1973
- "parent_before_sha",
1974
- "source_sha",
1975
- "result_sha",
1976
- "method",
1977
- "conflict_paths",
1978
- "verification",
1979
- "evidence",
1980
- "attempts"
1981
- ],
1982
- "properties": {
1983
- "status": {
1984
- "enum": [
1985
- "pending",
1986
- "running",
1987
- "passed",
1988
- "blocked"
1989
- ]
1990
- },
1991
- "parent_before_sha": {
1992
- "type": ["string", "null"]
1993
- },
1994
- "source_sha": {
1995
- "type": ["string", "null"]
1996
- },
1997
- "result_sha": {
1998
- "type": ["string", "null"]
1999
- },
2000
- "method": {
2001
- "enum": [null, "fast-forward", "merge-commit"]
2002
- },
2003
- "conflict_paths": {
2004
- "type": "array",
2005
- "items": {"type": "string"}
2006
- },
2007
- "verification": {
2008
- "enum": ["pending", "passed", "failed"]
2009
- },
2010
- "evidence": {
2011
- "type": "string",
2012
- "pattern": "^\\{roots\\.state\\}/specdev/changes/[^<]+/evidence/T-[0-9]{2,}\\.md$"
2013
- },
2014
- "attempts": {
2015
- "type": "integer",
2016
- "minimum": 0
2017
- }
2018
- },
2019
- "additionalProperties": true
2020
- },
2021
- "status": {
2022
- "enum": [
2023
- "planned",
2024
- "active",
2025
- "review",
2026
- "integrating",
2027
- "integrated",
2028
- "removed",
2029
- "blocked"
2030
- ]
2031
- },
2032
- "updated_at": {
2033
- "type": "string",
2034
- "minLength": 1
2035
- }
2036
- },
2037
- "dependentRequired": {
2038
- "terminal_action": [
2039
- "integration_owner",
2040
- "parent_branch",
2041
- "source_checkpoint",
2042
- "integration"
2043
- ]
2044
- },
2045
- "allOf": [
2046
- {
2047
- "if": {
2048
- "properties": {
2049
- "status": {"const": "integrating"}
2050
- },
2051
- "required": ["status"]
2052
- },
2053
- "then": {
2054
- "required": [
2055
- "terminal_action",
2056
- "integration_owner",
2057
- "parent_branch",
2058
- "source_checkpoint",
2059
- "integration"
2060
- ],
2061
- "properties": {
2062
- "terminal_action": {"const": "integrate"}
2063
- }
2064
- }
2065
- },
2066
- {
2067
- "if": {
2068
- "properties": {
2069
- "status": {"enum": ["integrating", "integrated"]},
2070
- "terminal_action": {"const": "integrate"}
2071
- },
2072
- "required": ["status", "terminal_action"]
2073
- },
2074
- "then": {
2075
- "properties": {
2076
- "source_checkpoint": {"type": "string", "minLength": 1},
2077
- "integration": {
2078
- "properties": {
2079
- "parent_before_sha": {"type": "string", "minLength": 1},
2080
- "source_sha": {"type": "string", "minLength": 1},
2081
- "attempts": {"type": "integer", "minimum": 1}
2082
- }
2083
- }
2084
- }
2085
- }
2086
- },
2087
- {
2088
- "if": {
2089
- "properties": {
2090
- "status": {"const": "integrating"},
2091
- "terminal_action": {"const": "integrate"}
2092
- },
2093
- "required": ["status", "terminal_action"]
2094
- },
2095
- "then": {
2096
- "properties": {
2097
- "integration": {
2098
- "properties": {
2099
- "status": {"const": "running"}
2100
- }
2101
- }
2102
- }
2103
- }
2104
- },
2105
- {
2106
- "if": {
2107
- "properties": {
2108
- "status": {"const": "integrated"},
2109
- "terminal_action": {"const": "integrate"}
2110
- },
2111
- "required": ["status", "terminal_action"]
2112
- },
2113
- "then": {
2114
- "properties": {
2115
- "integration": {
2116
- "properties": {
2117
- "status": {"const": "passed"},
2118
- "result_sha": {"type": "string", "minLength": 1},
2119
- "method": {"enum": ["fast-forward", "merge-commit"]},
2120
- "verification": {"const": "passed"}
2121
- }
2122
- }
2123
- }
2124
- }
2125
- },
2126
- {
2127
- "if": {
2128
- "properties": {
2129
- "terminal_action": {"const": "retain"}
2130
- },
2131
- "required": ["terminal_action"]
2132
- },
2133
- "then": {
2134
- "properties": {
2135
- "status": {
2136
- "not": {"enum": ["integrating", "integrated"]}
2137
- }
2138
- }
2139
- }
2140
- }
2141
- ],
2142
- "additionalProperties": true
2143
- }
2144
- }
2145
- },
2146
- "allOf": [
2147
- {
2148
- "if": {
2149
- "properties": {
2150
- "worktrees": {
2151
- "contains": {
2152
- "properties": {
2153
- "provider": {
2154
- "const": "git"
2155
- }
2156
- },
2157
- "required": [
2158
- "provider"
2159
- ]
2160
- }
2161
- }
2162
- }
1878
+ "worktree": {
1879
+ "type": "object",
1880
+ "required": ["ticket_id", "owner", "implementation_owner", "integration_owner", "provider", "base_sha", "parent_branch", "branch", "workspace_ref", "source_checkpoint", "integration", "status", "updated_at"],
1881
+ "properties": {
1882
+ "ticket_id": {"type": "string", "pattern": "^T-[0-9]{2,}$"},
1883
+ "owner": {"type": "string", "minLength": 1},
1884
+ "implementation_owner": {"type": "string", "minLength": 1},
1885
+ "integration_owner": {"type": "string", "minLength": 1},
1886
+ "provider": {"const": "git"},
1887
+ "base_sha": {"type": "string", "minLength": 1},
1888
+ "parent_branch": {"type": "string", "minLength": 1},
1889
+ "branch": {"type": "string", "minLength": 1},
1890
+ "workspace_ref": {"type": "string", "pattern": "^specdev-worktree/[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*/T-[0-9]{2,}$"},
1891
+ "source_checkpoint": {"type": ["string", "null"]},
1892
+ "integration": {"$ref": "#/$defs/integration"},
1893
+ "status": {"enum": ["planned", "active", "review", "integrating", "integrated", "removed", "blocked"]},
1894
+ "updated_at": {"type": "string", "minLength": 1}
2163
1895
  },
2164
- "then": {
2165
- "properties": {
2166
- "worktrees": {
2167
- "items": {
2168
- "if": {
2169
- "properties": {
2170
- "provider": {
2171
- "const": "git"
2172
- }
2173
- },
2174
- "required": [
2175
- "provider"
2176
- ]
2177
- },
2178
- "then": {
2179
- "properties": {
2180
- "workspace_ref": {
2181
- "pattern": "^specdev-worktree/T-[0-9]{2,}$"
2182
- }
2183
- }
2184
- }
2185
- }
2186
- }
2187
- }
2188
- }
1896
+ "additionalProperties": false
2189
1897
  },
2190
- {
2191
- "if": {
2192
- "properties": {
2193
- "change_status": {
2194
- "const": "archived"
2195
- }
2196
- }
1898
+ "integration": {
1899
+ "type": "object",
1900
+ "required": ["status", "parent_ref", "parent_before_sha", "source_sha", "candidate_sha", "candidate_tree_sha", "candidate_branch", "candidate_workspace_ref", "result_sha", "method", "conflict_paths", "verification", "full_suite", "e2e", "evidence", "attempts", "promotion_status"],
1901
+ "properties": {
1902
+ "status": {"enum": ["pending", "candidate", "passed", "failed", "stale"]},
1903
+ "parent_ref": {"type": ["string", "null"]},
1904
+ "parent_before_sha": {"type": ["string", "null"]},
1905
+ "source_sha": {"type": ["string", "null"]},
1906
+ "candidate_sha": {"type": ["string", "null"]},
1907
+ "candidate_tree_sha": {"type": ["string", "null"]},
1908
+ "candidate_branch": {"type": ["string", "null"]},
1909
+ "candidate_workspace_ref": {"anyOf": [{"type": "null"}, {"type": "string", "pattern": "^specdev-worktree/\\.integration/[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*/T-[0-9]{2,}$"}]},
1910
+ "result_sha": {"type": ["string", "null"]},
1911
+ "method": {"enum": [null, "fast-forward", "merge-commit"]},
1912
+ "conflict_paths": {"type": "array", "items": {"type": "string"}},
1913
+ "verification": {"enum": ["pending", "passed", "failed"]},
1914
+ "full_suite": {"$ref": "#/$defs/full-suite"},
1915
+ "e2e": {"$ref": "#/$defs/full-suite"},
1916
+ "evidence": {"type": "string", "pattern": "^\\{roots\\.state\\}/specdev/changes/[^<]+/evidence/T-[0-9]{2,}\\.md$"},
1917
+ "attempts": {"type": "integer", "minimum": 0},
1918
+ "promotion_status": {"enum": ["pending", "applying", "applied", "failed", "stale"]}
2197
1919
  },
2198
- "then": {
2199
- "properties": {
2200
- "archived": {
2201
- "const": true
2202
- },
2203
- "archive_path": {
2204
- "type": "string",
2205
- "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"
2206
- }
2207
- }
2208
- }
1920
+ "additionalProperties": false
2209
1921
  }
2210
- ],
2211
- "additionalProperties": true
1922
+ },
1923
+ "allOf": [{
1924
+ "if": {"properties": {"change_status": {"const": "archived"}}, "required": ["change_status"]},
1925
+ "then": {"properties": {"archived": {"const": true}, "archive_path": {"type": "string", "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"}}}
1926
+ }],
1927
+ "additionalProperties": false
2212
1928
  }
2213
1929
  ```
2214
1930