| 1 | package wire |
| 2 | |
| 3 | import "time" |
| 4 | |
| 5 | // Merge authority (spec docs/superpowers/specs/2026-11-11-equipo-merge- |
| 6 | // authority.md): cards, choices, tools and the API shapes. |
| 7 | |
| 8 | // Cards. A merge receipt says Equipo merged on its own, with Undo when |
| 9 | // the merge SHA is the hub's word; the ships card asks once per project |
| 10 | // whether merging to main ships to users; the policy card confirms a |
| 11 | // change the coordinator proposed that would loosen the policy. |
| 12 | const ( |
| 13 | CardMergeReceipt = "merge_receipt" |
| 14 | CardMergeShips = "merge_ships" |
| 15 | CardMergePolicy = "merge_policy" |
| 16 | // CardUndoneMerge is a receipt's state once Undo opened the revert. |
| 17 | CardUndoneMerge = "undone" |
| 18 | ) |
| 19 | |
| 20 | // Choices. |
| 21 | const ( |
| 22 | ChoiceWaitMac = "wait_mac" |
| 23 | ChoiceShips = "ships" |
| 24 | ChoiceNotShips = "not_ships" |
| 25 | ChoiceSave = "save" |
| 26 | ChoiceCancel = "cancel" |
| 27 | ) |
| 28 | |
| 29 | // Coordinator tools: hold_merge stops Equipo merging a task on its own; |
| 30 | // set_merge_policy proposes a project's policy (tighter applies at once, |
| 31 | // looser needs the person's tap). |
| 32 | const ( |
| 33 | ToolHoldMerge = "hold_merge" |
| 34 | ToolSetMergePolicy = "set_merge_policy" |
| 35 | ) |
| 36 | |
| 37 | // Merge policy bounds on the wire. |
| 38 | const ( |
| 39 | MaxMergeWords = 300 |
| 40 | MaxMergeHold = 200 |
| 41 | ) |
| 42 | |
| 43 | // MergeDecision is the newest decision on a task's merge, as the task |
| 44 | // shows it: the class, Equipo's stance and every criterion. |
| 45 | type MergeDecision struct { |
| 46 | Class string `json:"class"` |
| 47 | Stance string `json:"stance,omitempty"` |
| 48 | DecidedBy string `json:"decided_by,omitempty"` |
| 49 | Reasons []MergeCriterion `json:"reasons"` |
| 50 | At time.Time `json:"at"` |
| 51 | } |
| 52 | |
| 53 | // MergeCriterion is one rule's outcome. |
| 54 | type MergeCriterion struct { |
| 55 | Name string `json:"name"` |
| 56 | OK bool `json:"ok"` |
| 57 | Value string `json:"value,omitempty"` |
| 58 | } |
| 59 | |
| 60 | // MergePolicy is a project's merge policy (GET/PUT |
| 61 | // /api/v1/projects/{id}/merge-policy). |
| 62 | type MergePolicy struct { |
| 63 | ProjectID string `json:"project_id"` |
| 64 | Mode string `json:"mode"` |
| 65 | ModeReason string `json:"mode_reason"` |
| 66 | MaxLines int `json:"max_lines"` |
| 67 | MaxFiles int `json:"max_files"` |
| 68 | MainShips string `json:"main_ships"` |
| 69 | ExtraSensitive []string `json:"extra_sensitive"` |
| 70 | Words string `json:"words"` |
| 71 | Revision int64 `json:"revision"` |
| 72 | Editable bool `json:"editable"` |
| 73 | Decisions []MergeDecision `json:"decisions"` |
| 74 | } |
| 75 | |
| 76 | // SetMergePolicy is PUT /api/v1/projects/{id}/merge-policy: the whole |
| 77 | // policy at Revision. |
| 78 | type SetMergePolicy struct { |
| 79 | Mode string `json:"mode"` |
| 80 | MaxLines int `json:"max_lines"` |
| 81 | MaxFiles int `json:"max_files"` |
| 82 | MainShips string `json:"main_ships"` |
| 83 | ExtraSensitive []string `json:"extra_sensitive"` |
| 84 | Words string `json:"words"` |
| 85 | Revision int64 `json:"revision"` |
| 86 | } |
| 87 | |
| 88 | // UndoMerge is POST /api/v1/tasks/{id}/undo-merge: the receipt's |
| 89 | // revision as the person saw it. |
| 90 | type UndoMerge struct { |
| 91 | Revision int64 `json:"revision"` |
| 92 | } |
| 93 | |