85 lines
2.9 KiB
YAML
85 lines
2.9 KiB
YAML
# discussion-status-promoter - Determine if discussion status should be promoted based on voting
|
|
# Usage: cat discussion.md | discussion-parser | discussion-vote-counter | discussion-status-promoter
|
|
|
|
name: discussion-status-promoter
|
|
description: Determine if discussion status should be promoted based on voting
|
|
category: Discussion
|
|
|
|
arguments:
|
|
- flag: --current-status
|
|
variable: current_status
|
|
default: "OPEN"
|
|
description: Current discussion status
|
|
- flag: --current-phase
|
|
variable: current_phase
|
|
default: "initial_feedback"
|
|
description: Current discussion phase
|
|
|
|
steps:
|
|
- type: code
|
|
code: |
|
|
import json
|
|
|
|
data = json.loads(input)
|
|
consensus = data.get("consensus", {})
|
|
consensus_reached = consensus.get("reached", False)
|
|
blocked_by = consensus.get("blocked_by", [])
|
|
|
|
# Status transition rules based on phase + consensus
|
|
# Format: (current_status, current_phase, consensus_reached) -> new_status
|
|
transitions = {
|
|
# Feature workflow
|
|
("OPEN", "consensus_vote", True): "READY_FOR_DESIGN",
|
|
("OPEN", "final_vote", True): "READY_FOR_DESIGN",
|
|
("READY_FOR_DESIGN", "design_review", True): "READY_FOR_IMPLEMENTATION",
|
|
("READY_FOR_IMPLEMENTATION", "implementation_review", True): "READY_FOR_TESTING",
|
|
("READY_FOR_TESTING", "signoff", True): "CLOSED",
|
|
|
|
# ADR workflow
|
|
("PROPOSED", "consensus_vote", True): "ACCEPTED",
|
|
|
|
# Code review workflow
|
|
("OPEN", "review", True): "APPROVED",
|
|
}
|
|
|
|
new_status = current_status
|
|
transition_reason = None
|
|
should_promote = False
|
|
|
|
key = (current_status.upper(), current_phase.lower(), consensus_reached)
|
|
if key in transitions:
|
|
new_status = transitions[key]
|
|
should_promote = True
|
|
transition_reason = f"Consensus reached in {current_phase} phase"
|
|
|
|
# Check for rejection (don't auto-reject, but note it)
|
|
rejection_warning = None
|
|
if blocked_by:
|
|
rejection_warning = f"Discussion blocked by: {', '.join(blocked_by)}"
|
|
|
|
# Phase advancement suggestions
|
|
next_phase_suggestion = None
|
|
phase_flow = {
|
|
"initial_feedback": "detailed_review",
|
|
"detailed_review": "consensus_vote",
|
|
"consensus_vote": None, # Terminal or status change
|
|
"proposal": "consensus_vote",
|
|
"review": None,
|
|
}
|
|
if current_phase.lower() in phase_flow:
|
|
next_phase_suggestion = phase_flow[current_phase.lower()]
|
|
|
|
result = json.dumps({
|
|
"current_status": current_status,
|
|
"current_phase": current_phase,
|
|
"new_status": new_status,
|
|
"should_promote": should_promote,
|
|
"transition_reason": transition_reason,
|
|
"next_phase_suggestion": next_phase_suggestion,
|
|
"rejection_warning": rejection_warning,
|
|
"consensus": consensus
|
|
}, indent=2)
|
|
output_var: result
|
|
|
|
output: "{result}"
|