@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
@@ -513,7 +513,7 @@ Ticket 告诉执行者:做什么、为什么、不能改变什么、按什么
513
513
 
514
514
  ### Deep
515
515
 
516
- 任一条件触发:公共 API、schema、wire format、数据迁移、认证授权、隐私、资金、不可逆操作、expand-contract、共享核心路径、多 Agent 复杂协作、多个实质架构方案或高事故半径。
516
+ 任一条件触发:公共 API、schema、wire format、数据迁移、认证授权、隐私、资金、不可逆操作、expand-contract、共享核心路径、多个 implementation owner 的跨 Ticket 写入协调、多个实质架构方案或高事故半径。
517
517
 
518
518
  额外要求:数据流或状态转换、兼容窗口、迁移顺序、可观测性、回滚、风险缓解、收缩条件和人工批准点。
519
519
 
@@ -593,7 +593,7 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
593
593
 
594
594
  - 未批准的 ticket、spec、architecture 或 release 偏差不得继续实现。
595
595
  - 不得通过扩大 `writable_paths`、删除测试、降低断言或把风险改写成“已知限制”来绕过停止。
596
- - 偏差影响普通并行执行时,当前集成 owner 必须暂停受影响 Wave,重新计算路径所有权、依赖和 Gate;委派执行由 Lead 承担同一责任。
596
+ - 偏差影响并行执行、source checkpoint 或 candidate 集成时,Lead 必须暂停受影响 Wave,重新计算路径所有权、依赖、Gate 与父分支顺序;任何 subagent 都不能自行改写上层合同。
597
597
 
598
598
  </deviation-control>
599
599
 
@@ -656,16 +656,14 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
656
656
 
657
657
  ```json
658
658
  {
659
- "schema_version": 3,
659
+ "schema_version": 4,
660
660
  "interaction_language": "zh-CN",
661
661
  "artifact_language": "zh-CN",
662
662
  "git": {
663
- "auto_commit": false,
664
- "default_branch": null,
665
- "worktree_for_parallel": true
663
+ "default_branch": null
666
664
  },
667
665
  "execution": {
668
- "max_parallel": 3,
666
+ "max_implementation_agents": 3,
669
667
  "deep_ticket_human_approval": true,
670
668
  "shared_path_owner": "explicit"
671
669
  },
@@ -690,33 +688,31 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
690
688
  ```json
691
689
  {
692
690
  "$schema": "https://json-schema.org/draft/2020-12/schema",
693
- "$id": "urn:speculo:specdev:config:v3",
691
+ "$id": "urn:speculo:specdev:config:v4",
694
692
  "title": "SpecDev Configuration",
695
693
  "type": "object",
696
694
  "required": ["schema_version", "interaction_language", "artifact_language", "git", "execution", "verification", "planning"],
697
695
  "properties": {
698
- "schema_version": {"const": 3},
696
+ "schema_version": {"const": 4},
699
697
  "interaction_language": {"type": "string", "minLength": 1},
700
698
  "artifact_language": {"type": "string", "minLength": 1},
701
699
  "git": {
702
700
  "type": "object",
703
- "required": ["auto_commit", "default_branch", "worktree_for_parallel"],
701
+ "required": ["default_branch"],
704
702
  "properties": {
705
- "auto_commit": {"type": "boolean"},
706
- "default_branch": {"type": ["string", "null"]},
707
- "worktree_for_parallel": {"type": "boolean"}
703
+ "default_branch": {"type": ["string", "null"]}
708
704
  },
709
- "additionalProperties": true
705
+ "additionalProperties": false
710
706
  },
711
707
  "execution": {
712
708
  "type": "object",
713
- "required": ["max_parallel", "deep_ticket_human_approval", "shared_path_owner"],
709
+ "required": ["max_implementation_agents", "deep_ticket_human_approval", "shared_path_owner"],
714
710
  "properties": {
715
- "max_parallel": {"type": "integer", "minimum": 1},
711
+ "max_implementation_agents": {"type": "integer", "minimum": 1, "maximum": 3},
716
712
  "deep_ticket_human_approval": {"type": "boolean"},
717
713
  "shared_path_owner": {"type": "string", "minLength": 1}
718
714
  },
719
- "additionalProperties": true
715
+ "additionalProperties": false
720
716
  },
721
717
  "verification": {
722
718
  "type": "object",
@@ -740,7 +736,7 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
740
736
  "additionalProperties": true
741
737
  }
742
738
  },
743
- "additionalProperties": true
739
+ "additionalProperties": false
744
740
  }
745
741
  ```
746
742
 
@@ -750,7 +746,7 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
750
746
 
751
747
  ```json
752
748
  {
753
- "schema_version": 4,
749
+ "schema_version": 5,
754
750
  "workflow": "specdev",
755
751
  "active": [],
756
752
  "archived": []
@@ -764,83 +760,27 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
764
760
  ```json
765
761
  {
766
762
  "$schema": "https://json-schema.org/draft/2020-12/schema",
767
- "$id": "urn:speculo:specdev:status:v4",
763
+ "$id": "urn:speculo:specdev:status:v5",
768
764
  "title": "SpecDev Global Status",
769
765
  "type": "object",
770
- "required": [
771
- "schema_version",
772
- "workflow",
773
- "active",
774
- "archived"
775
- ],
766
+ "required": ["schema_version", "workflow", "active", "archived"],
776
767
  "properties": {
777
- "schema_version": {
778
- "const": 4
779
- },
780
- "workflow": {
781
- "const": "specdev"
782
- },
768
+ "schema_version": {"const": 5},
769
+ "workflow": {"const": "specdev"},
783
770
  "active": {
784
771
  "type": "array",
785
772
  "items": {
786
773
  "type": "object",
787
- "required": [
788
- "change",
789
- "current_work",
790
- "works_run"
791
- ],
774
+ "required": ["change"],
792
775
  "properties": {
793
776
  "change": {
794
777
  "type": "string",
795
778
  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"
796
- },
797
- "current_work": {
798
- "type": [
799
- "string",
800
- "null"
801
- ],
802
- "pattern": "^specdev/"
803
- },
804
- "works_run": {
805
- "type": "array",
806
- "items": {
807
- "type": "string",
808
- "pattern": "^specdev/"
809
- },
810
- "uniqueItems": true
811
- },
812
- "claimed_investigations": {
813
- "type": "array",
814
- "items": {
815
- "type": "object",
816
- "required": [
817
- "id",
818
- "owner",
819
- "claimed_at"
820
- ],
821
- "properties": {
822
- "id": {
823
- "type": "string"
824
- },
825
- "owner": {
826
- "type": "string"
827
- },
828
- "session": {
829
- "type": [
830
- "string",
831
- "null"
832
- ]
833
- },
834
- "claimed_at": {
835
- "type": "string"
836
- }
837
- },
838
- "additionalProperties": false
839
- }
840
779
  }
841
780
  },
842
781
  "additionalProperties": false
843
- }
782
+ },
783
+ "uniqueItems": true
844
784
  },
845
785
  "archived": {
846
786
  "type": "array",
@@ -861,11 +801,24 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
861
801
 
862
802
  ```json
863
803
  {
864
- "schema_version": 3,
804
+ "schema_version": 5,
865
805
  "artifact": "change-status",
866
806
  "change": "<YYYY-MM-DD-topic>",
867
807
  "change_status": "active",
868
808
  "current_work": null,
809
+ "works_run": [],
810
+ "claimed_investigations": [],
811
+ "execution_authorization": {
812
+ "implementation_commit": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Ticket source commits"},
813
+ "local_candidate_integration": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Lead-owned local parent candidate integration and parent update"},
814
+ "source_cleanup": {"status": "not-authorized", "source": null, "granted_at": null, "scope": "Source worktree and branch cleanup"}
815
+ },
816
+ "leadership": {
817
+ "current": "<owner-or-session-locator>",
818
+ "epoch": 1,
819
+ "assigned_at": "<ISO-8601>",
820
+ "history": []
821
+ },
869
822
  "created_at": "<ISO-8601>",
870
823
  "updated_at": "<ISO-8601>",
871
824
  "completed_at": null,
@@ -884,394 +837,157 @@ Ticket 只有同时满足以下适用条件才可设置 `ready: true`:
884
837
  ```json
885
838
  {
886
839
  "$schema": "https://json-schema.org/draft/2020-12/schema",
887
- "$id": "urn:speculo:specdev:change-status:v3",
840
+ "$id": "urn:speculo:specdev:change-status:v5",
888
841
  "title": "SpecDev Change Status",
889
842
  "type": "object",
890
843
  "required": [
891
- "schema_version",
892
- "artifact",
893
- "change",
894
- "change_status",
895
- "current_work",
896
- "created_at",
897
- "updated_at",
898
- "completed_at",
899
- "archived",
900
- "archive_path",
901
- "blockers",
902
- "deviations"
844
+ "schema_version", "artifact", "change", "change_status", "current_work", "works_run",
845
+ "claimed_investigations", "execution_authorization", "leadership", "created_at", "updated_at",
846
+ "completed_at", "archived", "archive_path", "blockers", "deviations", "worktrees"
903
847
  ],
904
848
  "properties": {
905
- "schema_version": {
906
- "const": 3
907
- },
908
- "artifact": {
909
- "const": "change-status"
910
- },
911
- "change": {
912
- "type": "string",
913
- "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"
914
- },
915
- "change_status": {
916
- "enum": [
917
- "active",
918
- "blocked",
919
- "completed",
920
- "archived"
921
- ]
922
- },
923
- "current_work": {
924
- "type": [
925
- "string",
926
- "null"
927
- ]
928
- },
929
- "created_at": {
930
- "type": "string",
931
- "minLength": 1
932
- },
933
- "updated_at": {
934
- "type": "string",
935
- "minLength": 1
849
+ "schema_version": {"const": 5},
850
+ "artifact": {"const": "change-status"},
851
+ "change": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9]+(?:-[a-z0-9]+)*$"},
852
+ "change_status": {"enum": ["active", "blocked", "completed", "archived"]},
853
+ "current_work": {"type": ["string", "null"], "pattern": "^specdev/"},
854
+ "works_run": {"type": "array", "items": {"type": "string", "pattern": "^specdev/"}, "uniqueItems": true},
855
+ "claimed_investigations": {"type": "array", "items": {"$ref": "#/$defs/claim"}},
856
+ "execution_authorization": {"$ref": "#/$defs/authorization"},
857
+ "leadership": {"$ref": "#/$defs/leadership"},
858
+ "created_at": {"type": "string", "minLength": 1},
859
+ "updated_at": {"type": "string", "minLength": 1},
860
+ "completed_at": {"type": ["string", "null"]},
861
+ "archived": {"type": "boolean"},
862
+ "archive_path": {"anyOf": [{"type": "null"}, {"type": "string", "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"}]},
863
+ "blockers": {"type": "array", "items": {"type": "string"}},
864
+ "deviations": {"type": "array", "items": {"type": "string"}},
865
+ "worktrees": {"type": "array", "items": {"$ref": "#/$defs/worktree"}}
866
+ },
867
+ "$defs": {
868
+ "claim": {
869
+ "type": "object",
870
+ "required": ["id", "owner", "session", "claimed_at"],
871
+ "properties": {
872
+ "id": {"type": "string", "minLength": 1},
873
+ "owner": {"type": "string", "minLength": 1},
874
+ "session": {"type": ["string", "null"]},
875
+ "claimed_at": {"type": "string", "minLength": 1}
876
+ },
877
+ "additionalProperties": false
936
878
  },
937
- "completed_at": {
938
- "type": [
939
- "string",
940
- "null"
941
- ]
879
+ "authorization-entry": {
880
+ "type": "object",
881
+ "required": ["status", "source", "granted_at", "scope"],
882
+ "properties": {
883
+ "status": {"enum": ["authorized", "not-authorized", "revoked"]},
884
+ "source": {"type": ["string", "null"]},
885
+ "granted_at": {"type": ["string", "null"]},
886
+ "scope": {"type": "string", "minLength": 1}
887
+ },
888
+ "allOf": [{
889
+ "if": {"properties": {"status": {"const": "authorized"}}, "required": ["status"]},
890
+ "then": {"properties": {"source": {"type": "string", "minLength": 1}, "granted_at": {"type": "string", "minLength": 1}}}
891
+ }],
892
+ "additionalProperties": false
942
893
  },
943
- "archived": {
944
- "type": "boolean"
894
+ "authorization": {
895
+ "type": "object",
896
+ "required": ["implementation_commit", "local_candidate_integration", "source_cleanup"],
897
+ "properties": {
898
+ "implementation_commit": {"$ref": "#/$defs/authorization-entry"},
899
+ "local_candidate_integration": {"$ref": "#/$defs/authorization-entry"},
900
+ "source_cleanup": {"$ref": "#/$defs/authorization-entry"}
901
+ },
902
+ "additionalProperties": false
945
903
  },
946
- "archive_path": {
947
- "anyOf": [
948
- {
949
- "type": "null"
950
- },
951
- {
952
- "type": "string",
953
- "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"
954
- }
955
- ]
904
+ "leadership-history": {
905
+ "type": "object",
906
+ "required": ["owner", "epoch", "assigned_at", "ended_at"],
907
+ "properties": {
908
+ "owner": {"type": "string", "minLength": 1},
909
+ "epoch": {"type": "integer", "minimum": 1},
910
+ "assigned_at": {"type": "string", "minLength": 1},
911
+ "ended_at": {"type": "string", "minLength": 1}
912
+ },
913
+ "additionalProperties": false
956
914
  },
957
- "blockers": {
958
- "type": "array",
959
- "items": {
960
- "type": "string"
961
- }
915
+ "leadership": {
916
+ "type": "object",
917
+ "required": ["current", "epoch", "assigned_at", "history"],
918
+ "properties": {
919
+ "current": {"type": "string", "minLength": 1},
920
+ "epoch": {"type": "integer", "minimum": 1},
921
+ "assigned_at": {"type": "string", "minLength": 1},
922
+ "history": {"type": "array", "items": {"$ref": "#/$defs/leadership-history"}}
923
+ },
924
+ "additionalProperties": false
962
925
  },
963
- "deviations": {
964
- "type": "array",
965
- "items": {
966
- "type": "string"
967
- }
926
+ "full-suite": {
927
+ "type": "object",
928
+ "required": ["required", "status", "reason", "evidence"],
929
+ "properties": {
930
+ "required": {"type": "boolean"},
931
+ "status": {"enum": ["not-required", "pending", "passed", "failed"]},
932
+ "reason": {"type": ["string", "null"]},
933
+ "evidence": {"type": ["string", "null"]}
934
+ },
935
+ "allOf": [{
936
+ "if": {"properties": {"required": {"const": false}}, "required": ["required"]},
937
+ "then": {"properties": {"status": {"const": "not-required"}, "reason": {"type": "string", "minLength": 1}}}
938
+ }],
939
+ "additionalProperties": false
968
940
  },
969
- "worktrees": {
970
- "type": "array",
971
- "items": {
972
- "type": "object",
973
- "required": [
974
- "ticket_id",
975
- "owner",
976
- "provider",
977
- "base_sha",
978
- "branch",
979
- "workspace_ref",
980
- "status",
981
- "updated_at"
982
- ],
983
- "properties": {
984
- "ticket_id": {
985
- "type": "string",
986
- "pattern": "^T-[0-9]{2,}$"
987
- },
988
- "owner": {
989
- "type": "string",
990
- "minLength": 1
991
- },
992
- "integration_owner": {
993
- "type": "string",
994
- "minLength": 1
995
- },
996
- "provider": {
997
- "enum": [
998
- "native",
999
- "git",
1000
- "external"
1001
- ]
1002
- },
1003
- "base_sha": {
1004
- "type": "string",
1005
- "minLength": 1
1006
- },
1007
- "parent_branch": {
1008
- "type": "string",
1009
- "minLength": 1
1010
- },
1011
- "branch": {
1012
- "type": "string",
1013
- "minLength": 1
1014
- },
1015
- "workspace_ref": {
1016
- "type": "string",
1017
- "minLength": 1,
1018
- "pattern": "^(?!/)(?![A-Za-z]:[\\\\/]).+"
1019
- },
1020
- "terminal_action": {
1021
- "enum": [
1022
- "integrate",
1023
- "retain"
1024
- ]
1025
- },
1026
- "source_checkpoint": {
1027
- "type": [
1028
- "string",
1029
- "null"
1030
- ]
1031
- },
1032
- "integration": {
1033
- "type": "object",
1034
- "required": [
1035
- "status",
1036
- "parent_before_sha",
1037
- "source_sha",
1038
- "result_sha",
1039
- "method",
1040
- "conflict_paths",
1041
- "verification",
1042
- "evidence",
1043
- "attempts"
1044
- ],
1045
- "properties": {
1046
- "status": {
1047
- "enum": [
1048
- "pending",
1049
- "running",
1050
- "passed",
1051
- "blocked"
1052
- ]
1053
- },
1054
- "parent_before_sha": {
1055
- "type": ["string", "null"]
1056
- },
1057
- "source_sha": {
1058
- "type": ["string", "null"]
1059
- },
1060
- "result_sha": {
1061
- "type": ["string", "null"]
1062
- },
1063
- "method": {
1064
- "enum": [null, "fast-forward", "merge-commit"]
1065
- },
1066
- "conflict_paths": {
1067
- "type": "array",
1068
- "items": {"type": "string"}
1069
- },
1070
- "verification": {
1071
- "enum": ["pending", "passed", "failed"]
1072
- },
1073
- "evidence": {
1074
- "type": "string",
1075
- "pattern": "^\\{roots\\.state\\}/specdev/changes/[^<]+/evidence/T-[0-9]{2,}\\.md$"
1076
- },
1077
- "attempts": {
1078
- "type": "integer",
1079
- "minimum": 0
1080
- }
1081
- },
1082
- "additionalProperties": true
1083
- },
1084
- "status": {
1085
- "enum": [
1086
- "planned",
1087
- "active",
1088
- "review",
1089
- "integrating",
1090
- "integrated",
1091
- "removed",
1092
- "blocked"
1093
- ]
1094
- },
1095
- "updated_at": {
1096
- "type": "string",
1097
- "minLength": 1
1098
- }
1099
- },
1100
- "dependentRequired": {
1101
- "terminal_action": [
1102
- "integration_owner",
1103
- "parent_branch",
1104
- "source_checkpoint",
1105
- "integration"
1106
- ]
1107
- },
1108
- "allOf": [
1109
- {
1110
- "if": {
1111
- "properties": {
1112
- "status": {"const": "integrating"}
1113
- },
1114
- "required": ["status"]
1115
- },
1116
- "then": {
1117
- "required": [
1118
- "terminal_action",
1119
- "integration_owner",
1120
- "parent_branch",
1121
- "source_checkpoint",
1122
- "integration"
1123
- ],
1124
- "properties": {
1125
- "terminal_action": {"const": "integrate"}
1126
- }
1127
- }
1128
- },
1129
- {
1130
- "if": {
1131
- "properties": {
1132
- "status": {"enum": ["integrating", "integrated"]},
1133
- "terminal_action": {"const": "integrate"}
1134
- },
1135
- "required": ["status", "terminal_action"]
1136
- },
1137
- "then": {
1138
- "properties": {
1139
- "source_checkpoint": {"type": "string", "minLength": 1},
1140
- "integration": {
1141
- "properties": {
1142
- "parent_before_sha": {"type": "string", "minLength": 1},
1143
- "source_sha": {"type": "string", "minLength": 1},
1144
- "attempts": {"type": "integer", "minimum": 1}
1145
- }
1146
- }
1147
- }
1148
- }
1149
- },
1150
- {
1151
- "if": {
1152
- "properties": {
1153
- "status": {"const": "integrating"},
1154
- "terminal_action": {"const": "integrate"}
1155
- },
1156
- "required": ["status", "terminal_action"]
1157
- },
1158
- "then": {
1159
- "properties": {
1160
- "integration": {
1161
- "properties": {
1162
- "status": {"const": "running"}
1163
- }
1164
- }
1165
- }
1166
- }
1167
- },
1168
- {
1169
- "if": {
1170
- "properties": {
1171
- "status": {"const": "integrated"},
1172
- "terminal_action": {"const": "integrate"}
1173
- },
1174
- "required": ["status", "terminal_action"]
1175
- },
1176
- "then": {
1177
- "properties": {
1178
- "integration": {
1179
- "properties": {
1180
- "status": {"const": "passed"},
1181
- "result_sha": {"type": "string", "minLength": 1},
1182
- "method": {"enum": ["fast-forward", "merge-commit"]},
1183
- "verification": {"const": "passed"}
1184
- }
1185
- }
1186
- }
1187
- }
1188
- },
1189
- {
1190
- "if": {
1191
- "properties": {
1192
- "terminal_action": {"const": "retain"}
1193
- },
1194
- "required": ["terminal_action"]
1195
- },
1196
- "then": {
1197
- "properties": {
1198
- "status": {
1199
- "not": {"enum": ["integrating", "integrated"]}
1200
- }
1201
- }
1202
- }
1203
- }
1204
- ],
1205
- "additionalProperties": true
1206
- }
1207
- }
1208
- },
1209
- "allOf": [
1210
- {
1211
- "if": {
1212
- "properties": {
1213
- "worktrees": {
1214
- "contains": {
1215
- "properties": {
1216
- "provider": {
1217
- "const": "git"
1218
- }
1219
- },
1220
- "required": [
1221
- "provider"
1222
- ]
1223
- }
1224
- }
1225
- }
941
+ "worktree": {
942
+ "type": "object",
943
+ "required": ["ticket_id", "owner", "implementation_owner", "integration_owner", "provider", "base_sha", "parent_branch", "branch", "workspace_ref", "source_checkpoint", "integration", "status", "updated_at"],
944
+ "properties": {
945
+ "ticket_id": {"type": "string", "pattern": "^T-[0-9]{2,}$"},
946
+ "owner": {"type": "string", "minLength": 1},
947
+ "implementation_owner": {"type": "string", "minLength": 1},
948
+ "integration_owner": {"type": "string", "minLength": 1},
949
+ "provider": {"const": "git"},
950
+ "base_sha": {"type": "string", "minLength": 1},
951
+ "parent_branch": {"type": "string", "minLength": 1},
952
+ "branch": {"type": "string", "minLength": 1},
953
+ "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,}$"},
954
+ "source_checkpoint": {"type": ["string", "null"]},
955
+ "integration": {"$ref": "#/$defs/integration"},
956
+ "status": {"enum": ["planned", "active", "review", "integrating", "integrated", "removed", "blocked"]},
957
+ "updated_at": {"type": "string", "minLength": 1}
1226
958
  },
1227
- "then": {
1228
- "properties": {
1229
- "worktrees": {
1230
- "items": {
1231
- "if": {
1232
- "properties": {
1233
- "provider": {
1234
- "const": "git"
1235
- }
1236
- },
1237
- "required": [
1238
- "provider"
1239
- ]
1240
- },
1241
- "then": {
1242
- "properties": {
1243
- "workspace_ref": {
1244
- "pattern": "^specdev-worktree/T-[0-9]{2,}$"
1245
- }
1246
- }
1247
- }
1248
- }
1249
- }
1250
- }
1251
- }
959
+ "additionalProperties": false
1252
960
  },
1253
- {
1254
- "if": {
1255
- "properties": {
1256
- "change_status": {
1257
- "const": "archived"
1258
- }
1259
- }
961
+ "integration": {
962
+ "type": "object",
963
+ "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"],
964
+ "properties": {
965
+ "status": {"enum": ["pending", "candidate", "passed", "failed", "stale"]},
966
+ "parent_ref": {"type": ["string", "null"]},
967
+ "parent_before_sha": {"type": ["string", "null"]},
968
+ "source_sha": {"type": ["string", "null"]},
969
+ "candidate_sha": {"type": ["string", "null"]},
970
+ "candidate_tree_sha": {"type": ["string", "null"]},
971
+ "candidate_branch": {"type": ["string", "null"]},
972
+ "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,}$"}]},
973
+ "result_sha": {"type": ["string", "null"]},
974
+ "method": {"enum": [null, "fast-forward", "merge-commit"]},
975
+ "conflict_paths": {"type": "array", "items": {"type": "string"}},
976
+ "verification": {"enum": ["pending", "passed", "failed"]},
977
+ "full_suite": {"$ref": "#/$defs/full-suite"},
978
+ "e2e": {"$ref": "#/$defs/full-suite"},
979
+ "evidence": {"type": "string", "pattern": "^\\{roots\\.state\\}/specdev/changes/[^<]+/evidence/T-[0-9]{2,}\\.md$"},
980
+ "attempts": {"type": "integer", "minimum": 0},
981
+ "promotion_status": {"enum": ["pending", "applying", "applied", "failed", "stale"]}
1260
982
  },
1261
- "then": {
1262
- "properties": {
1263
- "archived": {
1264
- "const": true
1265
- },
1266
- "archive_path": {
1267
- "type": "string",
1268
- "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"
1269
- }
1270
- }
1271
- }
983
+ "additionalProperties": false
1272
984
  }
1273
- ],
1274
- "additionalProperties": true
985
+ },
986
+ "allOf": [{
987
+ "if": {"properties": {"change_status": {"const": "archived"}}, "required": ["change_status"]},
988
+ "then": {"properties": {"archived": {"const": true}, "archive_path": {"type": "string", "pattern": "^specdev/archive/[0-9]{4}-[0-9]{2}/.+/$"}}}
989
+ }],
990
+ "additionalProperties": false
1275
991
  }
1276
992
  ```
1277
993