|
| 1 | +# Process Pull Request Comments |
| 2 | + |
| 3 | +## Purpose |
| 4 | +This workflow processes analyzed pull request comments from `./tmp/PR_CONVERSATIONS.md` and executes actions based on the Decision field for each relevant comment. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | +- Analysis file exists at: `./tmp/PR_CONVERSATIONS.md` |
| 8 | +- Scripts available: `scripts/resolve-pr-conversation.js` |
| 9 | +- GitHub CLI configured for issue creation |
| 10 | + |
| 11 | +## Process Flow |
| 12 | + |
| 13 | +### 1. Read Analysis File |
| 14 | +- Load `./tmp/PR_CONVERSATIONS.md` |
| 15 | +- Parse all comments into structured data |
| 16 | +- Extract fields: Id, Status, Decision, Comment Body, PR Number, etc. |
| 17 | + |
| 18 | +### 2. Process Each Conversation |
| 19 | + |
| 20 | +#### Step 2.1: Check Id Field |
| 21 | +- **If Id = "Local"**: Skip to next conversation (no resolution needed - created by local tool) |
| 22 | +- **Otherwise**: Continue to Step 2.2 |
| 23 | + |
| 24 | +#### Step 2.2: Check Status Field |
| 25 | +- **If Status = "OUTDATED"**: |
| 26 | + - Execute: `node scripts/resolve-pr-conversation.js CONVERSATION_ID "Marked as outdated"` |
| 27 | + - Skip to next conversation |
| 28 | +- **Otherwise**: Continue to Step 2.3 |
| 29 | + |
| 30 | +#### Step 2.3: Process Based on Decision Field |
| 31 | + |
| 32 | +| Decision Value | Action | Resolution Comment | |
| 33 | +|----------------|--------|-------------------| |
| 34 | +| IGNORE or Empty | Skip to next conversation | N/A | |
| 35 | +| RESOLVE | Mark as resolved only | "Acknowledged and resolved" | |
| 36 | +| PROCESS or FIX | 1. Apply fix using common rules<br>2. Mark as resolved | "Fixed: [7-15 word description of what was done]" | |
| 37 | +| Create Issue or Fix later | 1. Create GitHub issue<br>2. Add links (PR ↔ Issue)<br>3. Mark as resolved | "Created issue #[number] for future fix" | |
| 38 | + |
| 39 | +### 3. Resolution Command Format |
| 40 | +```bash |
| 41 | +node scripts/resolve-pr-conversation.js CONVERSATION_ID "Your comment here" |
| 42 | +``` |
| 43 | + |
| 44 | +## Visual Process Diagrams |
| 45 | + |
| 46 | +### Main Process Flow Diagram |
| 47 | +```mermaid |
| 48 | +flowchart TD |
| 49 | + Start([Start: Process PR Comments]) --> ReadFile[Read ./tmp/PR_CONVERSATIONS.md] |
| 50 | + ReadFile --> ParseComments[Parse Comments into Structured Data] |
| 51 | + ParseComments --> StartLoop{For Each Conversation} |
| 52 | + |
| 53 | + StartLoop --> CheckId{Is Id = Local?} |
| 54 | + CheckId -->|Yes| NextConv[Skip to Next Conversation] |
| 55 | + CheckId -->|No| CheckStatus{Is Status = OUTDATED?} |
| 56 | + |
| 57 | + CheckStatus -->|Yes| ResolveOutdated[Execute: resolve-pr-conversation.js<br/>with 'Marked as outdated'] |
| 58 | + ResolveOutdated --> NextConv |
| 59 | + |
| 60 | + CheckStatus -->|No| CheckDecision{Check Decision Field} |
| 61 | + |
| 62 | + CheckDecision -->|IGNORE or Empty| NextConv |
| 63 | + CheckDecision -->|RESOLVE| ResolveOnly[Mark as Resolved<br/>Comment: 'Acknowledged and resolved'] |
| 64 | + CheckDecision -->|PROCESS or FIX| ProcessFix[1. Apply Fix Using Common Rules<br/>2. Mark as Resolved<br/>Comment: 'Fixed: 7-15 word description'] |
| 65 | + CheckDecision -->|Create Issue or<br/>Fix later| CreateIssue[1. Create GitHub Issue<br/>2. Add PR-Issue Links<br/>3. Mark as Resolved<br/>Comment: 'Created issue #number for future fix'] |
| 66 | + |
| 67 | + ResolveOnly --> NextConv |
| 68 | + ProcessFix --> NextConv |
| 69 | + CreateIssue --> NextConv |
| 70 | + |
| 71 | + NextConv --> MoreConv{More Conversations?} |
| 72 | + MoreConv -->|Yes| StartLoop |
| 73 | + MoreConv -->|No| End([End]) |
| 74 | + |
| 75 | + %% Styling |
| 76 | + classDef decision fill:#f9f,stroke:#333,stroke-width:2px |
| 77 | + classDef action fill:#bbf,stroke:#333,stroke-width:2px |
| 78 | + classDef terminal fill:#9f9,stroke:#333,stroke-width:2px |
| 79 | + |
| 80 | + class CheckId,CheckStatus,CheckDecision,StartLoop,MoreConv decision |
| 81 | + class ReadFile,ParseComments,ResolveOutdated,ResolveOnly,ProcessFix,CreateIssue,NextConv action |
| 82 | + class Start,End terminal |
| 83 | +``` |
| 84 | + |
| 85 | +### Common Rules Application Diagram (For PROCESS/FIX Decision) |
| 86 | +```mermaid |
| 87 | +flowchart LR |
| 88 | + subgraph ProcessFix[Process/Fix Workflow] |
| 89 | + direction TB |
| 90 | + Start2([Decision = PROCESS/FIX]) --> ApplyRules[Apply Common Rules] |
| 91 | + |
| 92 | + ApplyRules --> Rule1[no-apologies-rule:<br/>Remove any apologies] |
| 93 | + ApplyRules --> Rule2[no-summaries-rule:<br/>Don't summarize changes] |
| 94 | + ApplyRules --> Rule3[no-unnecessary-confirmations-rule:<br/>Don't ask for confirmation] |
| 95 | + ApplyRules --> Rule4[no-unnecessary-updates-rule:<br/>Only make needed changes] |
| 96 | + ApplyRules --> Rule5[preserve-existing-code-rule:<br/>Keep unrelated code intact] |
| 97 | + |
| 98 | + Rule1 --> ImplementFix[Implement the Fix] |
| 99 | + Rule2 --> ImplementFix |
| 100 | + Rule3 --> ImplementFix |
| 101 | + Rule4 --> ImplementFix |
| 102 | + Rule5 --> ImplementFix |
| 103 | + |
| 104 | + ImplementFix --> CreateComment[Create 7-15 Word Summary<br/>of What Was Fixed] |
| 105 | + CreateComment --> ResolveConv[Execute: resolve-pr-conversation.js<br/>CONVERSATION_ID 'Fixed: summary'] |
| 106 | + end |
| 107 | + |
| 108 | + %% Styling |
| 109 | + classDef rules fill:#ffd,stroke:#333,stroke-width:2px |
| 110 | + classDef process fill:#ddf,stroke:#333,stroke-width:2px |
| 111 | + |
| 112 | + class Rule1,Rule2,Rule3,Rule4,Rule5 rules |
| 113 | + class ApplyRules,ImplementFix,CreateComment,ResolveConv process |
| 114 | +``` |
| 115 | + |
| 116 | +## Comment Guidelines |
| 117 | +- Rephrase comments to fix English grammar |
| 118 | +- Keep original wording/intent |
| 119 | +- For processed/fixed items: Create concise 7-15 word summary of action taken |
| 120 | +- Be specific about what was changed or fixed |
| 121 | + |
| 122 | +## Error Handling |
| 123 | +- If conversation ID not found: Log and continue |
| 124 | +- If GitHub issue creation fails: Log error, mark conversation with error note |
| 125 | +- If resolution script fails: Retry once, then log failure |
| 126 | + |
| 127 | +## Common Rules Reference |
| 128 | +When Decision = PROCESS or FIX, apply these rules: |
| 129 | +- no-apologies-rule |
| 130 | +- no-summaries-rule |
| 131 | +- no-unnecessary-confirmations-rule |
| 132 | +- no-unnecessary-updates-rule |
| 133 | +- preserve-existing-code-rule |
| 134 | + |
| 135 | +## Quick Reference Flowchart |
| 136 | + |
| 137 | +### Main Process Flow |
| 138 | +1. Read `./tmp/PR_CONVERSATIONS.md` |
| 139 | +2. For each conversation: |
| 140 | + - Local? → Skip |
| 141 | + - OUTDATED? → Resolve with "Marked as outdated" |
| 142 | + - Decision: |
| 143 | + - IGNORE/Empty → Skip |
| 144 | + - RESOLVE → Resolve with "Acknowledged and resolved" |
| 145 | + - PROCESS/FIX → Apply fix, resolve with action summary |
| 146 | + - Create Issue/Fix later → Create issue, add links, resolve |
| 147 | + |
| 148 | +### Resolution Command |
| 149 | +```bash |
| 150 | +node scripts/resolve-pr-conversation.js CONVERSATION_ID "Your comment" |
| 151 | +``` |
| 152 | + |
| 153 | +### Decision Matrix |
| 154 | +| Decision | Action Required | Resolution Comment Template | |
| 155 | +|----------|----------------|---------------------------| |
| 156 | +| Local ID | None (Skip) | N/A | |
| 157 | +| OUTDATED | Resolve only | "Marked as outdated" | |
| 158 | +| IGNORE | None (Skip) | N/A | |
| 159 | +| Empty | None (Skip) | N/A | |
| 160 | +| RESOLVE | Resolve only | "Acknowledged and resolved" | |
| 161 | +| PROCESS | Fix + Resolve | "Fixed: [specific action taken]" | |
| 162 | +| FIX | Fix + Resolve | "Fixed: [specific action taken]" | |
| 163 | +| Create Issue | Issue + Resolve | "Created issue #[num] for future fix" | |
| 164 | +| Fix later | Issue + Resolve | "Created issue #[num] for future fix" | |
| 165 | + |
| 166 | + |
0 commit comments