@namewta/speculo 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/src/migrations.js +755 -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 +200 -448
  5. package/template/canonical/canonical-specdev-goal-plan.md +744 -1108
  6. package/template/canonical/canonical-specdev-grill-with-docs.md +201 -449
  7. package/template/canonical/canonical-specdev-spec.md +232 -486
  8. package/template/canonical/canonical-specdev-tickets.md +411 -590
  9. package/template/canonical/canonical-specdev-wayfinder.md +199 -447
  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 +404 -33
  13. package/template/workflows/specdev/I-implement/I-implement.md +98 -143
  14. package/template/workflows/specdev/I-implement/evidence-template.md +66 -48
  15. package/template/workflows/specdev/I-implement/execution-preflight.md +31 -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 +7 -6
  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 +46 -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 +67 -89
  28. package/template/workflows/specdev/P-prototype/ui-prototype.md +1 -1
  29. package/template/workflows/specdev/T-tickets/T-tickets.md +6 -3
  30. package/template/workflows/specdev/T-tickets/ticket-readiness.md +5 -3
  31. package/template/workflows/specdev/T-tickets/ticket-template.md +8 -1
  32. package/template/workflows/specdev/T-tickets/tickets-map-template.md +5 -4
  33. package/template/workflows/specdev/_state/status.json +1 -1
  34. package/template/workflows/specdev/common/README.md +2 -2
  35. package/template/workflows/specdev/common/rules/change-completion.md +17 -20
  36. package/template/workflows/specdev/common/rules/deviation-control.md +1 -1
  37. package/template/workflows/specdev/common/rules/evidence-and-verification.md +31 -37
  38. package/template/workflows/specdev/common/rules/path-ownership.md +21 -23
  39. package/template/workflows/specdev/common/rules/readiness-and-depth.md +1 -1
  40. package/template/workflows/specdev/common/schemas/change-status.schema.json +153 -363
  41. package/template/workflows/specdev/common/schemas/config.schema.json +17 -13
  42. package/template/workflows/specdev/common/schemas/goal-plan.schema.json +33 -16
  43. package/template/workflows/specdev/common/schemas/status.schema.json +7 -63
  44. package/template/workflows/specdev/common/skills/dev-worktree/SKILL.md +42 -21
  45. package/template/workflows/specdev/common/skills/dev-worktree/references/create.md +36 -21
  46. package/template/workflows/specdev/common/skills/dev-worktree/references/finalize.md +46 -18
  47. package/template/workflows/specdev/common/skills/subagent-delivery/SKILL.md +34 -31
  48. package/template/workflows/specdev/common/skills/subagent-delivery/references/external-web-subagent.md +10 -23
  49. package/template/workflows/specdev/common/skills/subagent-delivery/references/native-subagent.md +15 -25
  50. package/template/workflows/specdev/common/tools/README.md +2 -1
  51. package/template/workflows/specdev/common/tools/validate-specdev.mjs +591 -219
  52. package/template/workflows/specdev/I-implement/delegated-evidence-template.md +0 -12
  53. package/template/workflows/specdev/P-goal-plan/delegated-execution-template.md +0 -35
  54. package/template/workflows/specdev/P-goal-plan/delegated-execution.md +0 -59
  55. 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,15 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1593
1593
 
1594
1594
  ```json
1595
1595
  {
1596
- "schema_version": 3,
1596
+ "schema_version": 5,
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,
1604
+ "max_integration_attempts": 3,
1606
1605
  "deep_ticket_human_approval": true,
1607
1606
  "shared_path_owner": "explicit"
1608
1607
  },
@@ -1615,7 +1614,9 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1615
1614
  "planning": {
1616
1615
  "default_depth": "standard",
1617
1616
  "require_ready_gate": true,
1618
- "require_evidence": true
1617
+ "require_evidence": true,
1618
+ "ui_prototype_default_variants": 3,
1619
+ "ui_prototype_max_variants": 5
1619
1620
  }
1620
1621
  }
1621
1622
  ```
@@ -1627,33 +1628,32 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1627
1628
  ```json
1628
1629
  {
1629
1630
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1630
- "$id": "urn:speculo:specdev:config:v3",
1631
+ "$id": "urn:speculo:specdev:config:v5",
1631
1632
  "title": "SpecDev Configuration",
1632
1633
  "type": "object",
1633
1634
  "required": ["schema_version", "interaction_language", "artifact_language", "git", "execution", "verification", "planning"],
1634
1635
  "properties": {
1635
- "schema_version": {"const": 3},
1636
+ "schema_version": {"const": 5},
1636
1637
  "interaction_language": {"type": "string", "minLength": 1},
1637
1638
  "artifact_language": {"type": "string", "minLength": 1},
1638
1639
  "git": {
1639
1640
  "type": "object",
1640
- "required": ["auto_commit", "default_branch", "worktree_for_parallel"],
1641
+ "required": ["default_branch"],
1641
1642
  "properties": {
1642
- "auto_commit": {"type": "boolean"},
1643
- "default_branch": {"type": ["string", "null"]},
1644
- "worktree_for_parallel": {"type": "boolean"}
1643
+ "default_branch": {"type": ["string", "null"]}
1645
1644
  },
1646
- "additionalProperties": true
1645
+ "additionalProperties": false
1647
1646
  },
1648
1647
  "execution": {
1649
1648
  "type": "object",
1650
- "required": ["max_parallel", "deep_ticket_human_approval", "shared_path_owner"],
1649
+ "required": ["max_implementation_agents", "max_integration_attempts", "deep_ticket_human_approval", "shared_path_owner"],
1651
1650
  "properties": {
1652
- "max_parallel": {"type": "integer", "minimum": 1},
1651
+ "max_implementation_agents": {"type": "integer", "minimum": 1},
1652
+ "max_integration_attempts": {"type": "integer", "minimum": 1},
1653
1653
  "deep_ticket_human_approval": {"type": "boolean"},
1654
1654
  "shared_path_owner": {"type": "string", "minLength": 1}
1655
1655
  },
1656
- "additionalProperties": true
1656
+ "additionalProperties": false
1657
1657
  },
1658
1658
  "verification": {
1659
1659
  "type": "object",
@@ -1668,16 +1668,21 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1668
1668
  },
1669
1669
  "planning": {
1670
1670
  "type": "object",
1671
- "required": ["default_depth", "require_ready_gate", "require_evidence"],
1671
+ "required": ["default_depth", "require_ready_gate", "require_evidence", "ui_prototype_default_variants", "ui_prototype_max_variants"],
1672
1672
  "properties": {
1673
1673
  "default_depth": {"enum": ["lite", "standard", "deep"]},
1674
1674
  "require_ready_gate": {"type": "boolean"},
1675
- "require_evidence": {"type": "boolean"}
1675
+ "require_evidence": {"type": "boolean"},
1676
+ "ui_prototype_default_variants": {"type": "integer", "minimum": 1},
1677
+ "ui_prototype_max_variants": {"type": "integer", "minimum": 1}
1676
1678
  },
1677
1679
  "additionalProperties": true
1678
1680
  }
1679
1681
  },
1680
- "additionalProperties": true
1682
+ "allOf": [{
1683
+ "$comment": "ui_prototype_default_variants <= ui_prototype_max_variants is enforced by validate-specdev.mjs because JSON Schema cannot compare sibling numeric values."
1684
+ }],
1685
+ "additionalProperties": false
1681
1686
  }
1682
1687
  ```
1683
1688
 
@@ -1687,7 +1692,7 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1687
1692
 
1688
1693
  ```json
1689
1694
  {
1690
- "schema_version": 4,
1695
+ "schema_version": 5,
1691
1696
  "workflow": "specdev",
1692
1697
  "active": [],
1693
1698
  "archived": []
@@ -1701,83 +1706,27 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1701
1706
  ```json
1702
1707
  {
1703
1708
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1704
- "$id": "urn:speculo:specdev:status:v4",
1709
+ "$id": "urn:speculo:specdev:status:v5",
1705
1710
  "title": "SpecDev Global Status",
1706
1711
  "type": "object",
1707
- "required": [
1708
- "schema_version",
1709
- "workflow",
1710
- "active",
1711
- "archived"
1712
- ],
1712
+ "required": ["schema_version", "workflow", "active", "archived"],
1713
1713
  "properties": {
1714
- "schema_version": {
1715
- "const": 4
1716
- },
1717
- "workflow": {
1718
- "const": "specdev"
1719
- },
1714
+ "schema_version": {"const": 5},
1715
+ "workflow": {"const": "specdev"},
1720
1716
  "active": {
1721
1717
  "type": "array",
1722
1718
  "items": {
1723
1719
  "type": "object",
1724
- "required": [
1725
- "change",
1726
- "current_work",
1727
- "works_run"
1728
- ],
1720
+ "required": ["change"],
1729
1721
  "properties": {
1730
1722
  "change": {
1731
1723
  "type": "string",
1732
1724
  "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
1725
  }
1778
1726
  },
1779
1727
  "additionalProperties": false
1780
- }
1728
+ },
1729
+ "uniqueItems": true
1781
1730
  },
1782
1731
  "archived": {
1783
1732
  "type": "array",
@@ -1798,11 +1747,24 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1798
1747
 
1799
1748
  ```json
1800
1749
  {
1801
- "schema_version": 3,
1750
+ "schema_version": 6,
1802
1751
  "artifact": "change-status",
1803
1752
  "change": "<YYYY-MM-DD-topic>",
1804
1753
  "change_status": "active",
1805
1754
  "current_work": null,
1755
+ "works_run": [],
1756
+ "claimed_investigations": [],
1757
+ "execution_authorization": {
1758
+ "implementation_commit": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Ticket implementation commits"},
1759
+ "local_candidate_integration": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Lead-owned local direct-parent or candidate integration and parent update"},
1760
+ "source_cleanup": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Source worktree and branch cleanup"}
1761
+ },
1762
+ "leadership": {
1763
+ "current": "<owner-or-session-locator>",
1764
+ "epoch": 1,
1765
+ "assigned_at": "<ISO-8601>",
1766
+ "history": []
1767
+ },
1806
1768
  "created_at": "<ISO-8601>",
1807
1769
  "updated_at": "<ISO-8601>",
1808
1770
  "completed_at": null,
@@ -1821,394 +1783,184 @@ Change CONTEXT/ADR 是 active change 内的执行权威,不是 workflow 级永
1821
1783
  ```json
1822
1784
  {
1823
1785
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1824
- "$id": "urn:speculo:specdev:change-status:v3",
1786
+ "$id": "urn:speculo:specdev:change-status:v6",
1825
1787
  "title": "SpecDev Change Status",
1826
1788
  "type": "object",
1827
1789
  "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"
1790
+ "schema_version", "artifact", "change", "change_status", "current_work", "works_run",
1791
+ "claimed_investigations", "execution_authorization", "leadership", "created_at", "updated_at",
1792
+ "completed_at", "archived", "archive_path", "blockers", "deviations", "worktrees"
1840
1793
  ],
1841
1794
  "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
- ]
1795
+ "schema_version": {"const": 6},
1796
+ "artifact": {"const": "change-status"},
1797
+ "change": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"},
1798
+ "change_status": {"enum": ["active", "blocked", "completed", "archived"]},
1799
+ "current_work": {"type": ["string", "null"], "pattern": "^specdev/"},
1800
+ "works_run": {"type": "array", "items": {"type": "string", "pattern": "^specdev/"}, "uniqueItems": true},
1801
+ "claimed_investigations": {"type": "array", "items": {"$ref": "#/$defs/claim"}},
1802
+ "execution_authorization": {"$ref": "#/$defs/authorization"},
1803
+ "leadership": {"$ref": "#/$defs/leadership"},
1804
+ "created_at": {"type": "string", "minLength": 1},
1805
+ "updated_at": {"type": "string", "minLength": 1},
1806
+ "completed_at": {"type": ["string", "null"]},
1807
+ "archived": {"type": "boolean"},
1808
+ "archive_path": {"anyOf": [{"type": "null"}, {"type": "string", "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"}]},
1809
+ "blockers": {"type": "array", "items": {"type": "string"}},
1810
+ "deviations": {"type": "array", "items": {"type": "string"}},
1811
+ "worktrees": {"type": "array", "items": {"$ref": "#/$defs/worktree"}}
1812
+ },
1813
+ "$defs": {
1814
+ "claim": {
1815
+ "type": "object",
1816
+ "required": ["id", "owner", "session", "claimed_at"],
1817
+ "properties": {
1818
+ "id": {"type": "string", "minLength": 1},
1819
+ "owner": {"type": "string", "minLength": 1},
1820
+ "session": {"type": ["string", "null"]},
1821
+ "claimed_at": {"type": "string", "minLength": 1}
1822
+ },
1823
+ "additionalProperties": false
1859
1824
  },
1860
- "current_work": {
1861
- "type": [
1862
- "string",
1863
- "null"
1864
- ]
1825
+ "authorization-entry": {
1826
+ "type": "object",
1827
+ "required": ["status", "source", "granted_at", "scope"],
1828
+ "properties": {
1829
+ "status": {"enum": ["authorized", "not-authorized", "revoked"]},
1830
+ "source": {"type": ["string", "null"]},
1831
+ "granted_at": {"type": ["string", "null"]},
1832
+ "scope": {"type": "string", "minLength": 1}
1833
+ },
1834
+ "allOf": [{
1835
+ "if": {"properties": {"status": {"const": "authorized"}}, "required": ["status"]},
1836
+ "then": {"properties": {"source": {"type": "string", "minLength": 1}, "granted_at": {"type": "string", "minLength": 1}}}
1837
+ }],
1838
+ "additionalProperties": false
1865
1839
  },
1866
- "created_at": {
1867
- "type": "string",
1868
- "minLength": 1
1840
+ "authorization": {
1841
+ "type": "object",
1842
+ "required": ["implementation_commit", "local_candidate_integration", "source_cleanup"],
1843
+ "properties": {
1844
+ "implementation_commit": {"$ref": "#/$defs/authorization-entry"},
1845
+ "local_candidate_integration": {"$ref": "#/$defs/authorization-entry"},
1846
+ "source_cleanup": {"$ref": "#/$defs/authorization-entry"}
1847
+ },
1848
+ "additionalProperties": false
1869
1849
  },
1870
- "updated_at": {
1871
- "type": "string",
1872
- "minLength": 1
1850
+ "leadership-history": {
1851
+ "type": "object",
1852
+ "required": ["owner", "epoch", "assigned_at", "ended_at"],
1853
+ "properties": {
1854
+ "owner": {"type": "string", "minLength": 1},
1855
+ "epoch": {"type": "integer", "minimum": 1},
1856
+ "assigned_at": {"type": "string", "minLength": 1},
1857
+ "ended_at": {"type": "string", "minLength": 1}
1858
+ },
1859
+ "additionalProperties": false
1873
1860
  },
1874
- "completed_at": {
1875
- "type": [
1876
- "string",
1877
- "null"
1878
- ]
1861
+ "leadership": {
1862
+ "type": "object",
1863
+ "required": ["current", "epoch", "assigned_at", "history"],
1864
+ "properties": {
1865
+ "current": {"type": "string", "minLength": 1},
1866
+ "epoch": {"type": "integer", "minimum": 1},
1867
+ "assigned_at": {"type": "string", "minLength": 1},
1868
+ "history": {"type": "array", "items": {"$ref": "#/$defs/leadership-history"}}
1869
+ },
1870
+ "additionalProperties": false
1879
1871
  },
1880
- "archived": {
1881
- "type": "boolean"
1872
+ "full-suite": {
1873
+ "type": "object",
1874
+ "required": ["required", "status", "reason", "evidence"],
1875
+ "properties": {
1876
+ "required": {"type": "boolean"},
1877
+ "status": {"enum": ["not-required", "pending", "passed", "failed"]},
1878
+ "reason": {"type": ["string", "null"]},
1879
+ "evidence": {"type": ["string", "null"]}
1880
+ },
1881
+ "allOf": [{
1882
+ "if": {"properties": {"required": {"const": false}}, "required": ["required"]},
1883
+ "then": {"properties": {"status": {"const": "not-required"}, "reason": {"type": "string", "minLength": 1}}}
1884
+ }],
1885
+ "additionalProperties": false
1882
1886
  },
1883
- "archive_path": {
1884
- "anyOf": [
1885
- {
1886
- "type": "null"
1887
- },
1887
+ "worktree": {
1888
+ "type": "object",
1889
+ "required": ["ticket_id", "owner", "implementation_owner", "integration_owner", "provider", "base_sha", "parent_branch", "branch", "workspace_ref", "source_checkpoint", "integration", "status", "updated_at"],
1890
+ "properties": {
1891
+ "ticket_id": {"type": "string", "pattern": "^T-[0-9]{2,}$"},
1892
+ "owner": {"type": "string", "minLength": 1},
1893
+ "implementation_owner": {"type": "string", "minLength": 1},
1894
+ "integration_owner": {"type": "string", "minLength": 1},
1895
+ "provider": {"const": "git"},
1896
+ "base_sha": {"type": "string", "minLength": 1},
1897
+ "parent_branch": {"type": "string", "minLength": 1},
1898
+ "branch": {"type": "string", "minLength": 1},
1899
+ "workspace_ref": {"type": "string", "pattern": "^(?:current|specdev-worktree/[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*/T-[0-9]{2,})$"},
1900
+ "source_checkpoint": {"type": ["string", "null"]},
1901
+ "integration": {"$ref": "#/$defs/integration"},
1902
+ "status": {"enum": ["planned", "active", "review", "integrating", "integrated", "removed", "blocked"]},
1903
+ "updated_at": {"type": "string", "minLength": 1}
1904
+ },
1905
+ "allOf": [
1888
1906
  {
1889
- "type": "string",
1890
- "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"
1891
- }
1892
- ]
1893
- },
1894
- "blockers": {
1895
- "type": "array",
1896
- "items": {
1897
- "type": "string"
1898
- }
1899
- },
1900
- "deviations": {
1901
- "type": "array",
1902
- "items": {
1903
- "type": "string"
1904
- }
1905
- },
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
- ],
1907
+ "if": {"properties": {"workspace_ref": {"const": "current"}}, "required": ["workspace_ref"]},
1908
+ "then": {
1982
1909
  "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": {
1910
+ "integration": {
1911
+ "allOf": [{
2078
1912
  "properties": {
2079
- "parent_before_sha": {"type": "string", "minLength": 1},
2080
- "source_sha": {"type": "string", "minLength": 1},
2081
- "attempts": {"type": "integer", "minimum": 1}
1913
+ "candidate_sha": {"const": null},
1914
+ "candidate_tree_sha": {"const": null},
1915
+ "candidate_branch": {"const": null},
1916
+ "candidate_workspace_ref": {"const": null},
1917
+ "method": {"enum": [null, "direct-parent"]}
2082
1918
  }
2083
- }
1919
+ }]
2084
1920
  }
2085
1921
  }
2086
1922
  },
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
- }
2163
- },
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
- }
1923
+ "else": {
1924
+ "properties": {
1925
+ "integration": {
1926
+ "allOf": [{"properties": {"method": {"enum": [null, "fast-forward", "merge-commit"]}}}]
2184
1927
  }
2185
1928
  }
2186
1929
  }
2187
1930
  }
2188
- }
1931
+ ],
1932
+ "additionalProperties": false
2189
1933
  },
2190
- {
2191
- "if": {
2192
- "properties": {
2193
- "change_status": {
2194
- "const": "archived"
2195
- }
2196
- }
1934
+ "integration": {
1935
+ "type": "object",
1936
+ "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"],
1937
+ "properties": {
1938
+ "status": {"enum": ["pending", "candidate", "passed", "failed", "stale"]},
1939
+ "parent_ref": {"type": ["string", "null"]},
1940
+ "parent_before_sha": {"type": ["string", "null"]},
1941
+ "source_sha": {"type": ["string", "null"]},
1942
+ "candidate_sha": {"type": ["string", "null"]},
1943
+ "candidate_tree_sha": {"type": ["string", "null"]},
1944
+ "candidate_branch": {"type": ["string", "null"]},
1945
+ "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,}$"}]},
1946
+ "result_sha": {"type": ["string", "null"]},
1947
+ "method": {"enum": [null, "direct-parent", "fast-forward", "merge-commit"]},
1948
+ "conflict_paths": {"type": "array", "items": {"type": "string"}},
1949
+ "verification": {"enum": ["pending", "passed", "failed"]},
1950
+ "full_suite": {"$ref": "#/$defs/full-suite"},
1951
+ "e2e": {"$ref": "#/$defs/full-suite"},
1952
+ "evidence": {"type": "string", "pattern": "^\\{roots\\.state\\}/specdev/changes/[^<]+/evidence/T-[0-9]{2,}\\.md$"},
1953
+ "attempts": {"type": "integer", "minimum": 0},
1954
+ "promotion_status": {"enum": ["pending", "applying", "applied", "failed", "stale"]}
2197
1955
  },
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
- }
1956
+ "additionalProperties": false
2209
1957
  }
2210
- ],
2211
- "additionalProperties": true
1958
+ },
1959
+ "allOf": [{
1960
+ "if": {"properties": {"change_status": {"const": "archived"}}, "required": ["change_status"]},
1961
+ "then": {"properties": {"archived": {"const": true}, "archive_path": {"type": "string", "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"}}}
1962
+ }],
1963
+ "additionalProperties": false
2212
1964
  }
2213
1965
  ```
2214
1966