@orderful/droid 0.42.1 → 0.44.0

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.
@@ -0,0 +1,104 @@
1
+ # Release Templates
2
+
3
+ Slack mrkdwn and PR body templates for release notifications.
4
+
5
+ ## Slack Messages
6
+
7
+ All Slack messages are posted via `droid integrations slack post`. Format as Slack mrkdwn (not GitHub markdown).
8
+
9
+ ### Release Started
10
+
11
+ ```
12
+ :rocket: *Release started — {repo_name}*
13
+
14
+ *Risk:* {risk_emoji} {risk_level}
15
+ *PR:* <{pr_url}|#{pr_number}>
16
+ *Branch:* `{release_branch}` → `{production_branch}`
17
+
18
+ {pr_summary}
19
+
20
+ Posted with :droid:
21
+ ```
22
+
23
+ Risk emojis:
24
+ - Low Risk: `:large_green_circle:`
25
+ - High Risk: `:warning:`
26
+
27
+ ### Release Merged
28
+
29
+ ```
30
+ :merged-pr: *Release merged — {repo_name}*
31
+
32
+ *PR:* <{pr_url}|#{pr_number}>
33
+ *Branch:* `{release_branch}` → `{production_branch}`
34
+
35
+ Monitoring deployment :eyes:
36
+
37
+ Posted with :droid:
38
+ ```
39
+
40
+ ### Release Complete
41
+
42
+ ```
43
+ :white_check_mark: *Release complete — {repo_name}*
44
+
45
+ *PR:* <{pr_url}|#{pr_number}>
46
+ *Branch:* `{release_branch}` → `{production_branch}`
47
+
48
+ Posted with :droid:
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Release PR Body
54
+
55
+ Used when creating the release PR via `gh pr create --body`.
56
+
57
+ ```markdown
58
+ ### {repo_name} Release
59
+
60
+ **Risk:** [{risk_level}]
61
+
62
+ **When:** Imminent
63
+
64
+ **PRs included:**
65
+ {pr_list}
66
+
67
+ ---
68
+
69
+ Created with :robot: [droid](https://github.com/Orderful/droid)
70
+ ```
71
+
72
+ Where `{pr_list}` is a bulleted list of merged PRs:
73
+ ```markdown
74
+ - #{number} {title} (@{author})
75
+ - #{number} {title} (@{author})
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Terminal Fallback
81
+
82
+ When Slack is not configured, print a plain-text version to terminal:
83
+
84
+ ### Release Started (terminal)
85
+ ```
86
+ Release started — {repo_name}
87
+ Risk: {risk_level}
88
+ PR: {pr_url}
89
+ Branch: {release_branch} -> {production_branch}
90
+ ```
91
+
92
+ ### Release Merged (terminal)
93
+ ```
94
+ Release merged — {repo_name}
95
+ PR: {pr_url}
96
+ Branch: {release_branch} -> {production_branch}
97
+ Monitoring deployment...
98
+ ```
99
+
100
+ ### Release Complete (terminal)
101
+ ```
102
+ Release complete — {repo_name}
103
+ PR: {pr_url}
104
+ ```
@@ -0,0 +1,166 @@
1
+ # Release Workflows
2
+
3
+ Detailed step-by-step procedures for each `/release` subcommand. All commands use `gh` CLI directly.
4
+
5
+ ## Common Setup (every command)
6
+
7
+ ```bash
8
+ # 1. Read config
9
+ SLACK_CHANNEL=$(droid config --get tools.release.slack_channel)
10
+ # Default to #release-management if not set
11
+ SLACK_CHANNEL="${SLACK_CHANNEL:-#release-management}"
12
+
13
+ # 2. Get repos and filter for release repos (those with release_branch set)
14
+ droid config --get repos
15
+ # Parse JSON output — release repos have release_branch defined
16
+ ```
17
+
18
+ Detect repo from cwd or ask user. Extract `release_branch`, `production_branch` (default: `master`), and the GitHub `owner/repo` slug from the repo's remote.
19
+
20
+ ```bash
21
+ # Get owner/repo from git remote
22
+ git -C {repo_path} remote get-url origin
23
+ # Parse to extract owner/repo (e.g., "Orderful/orderful-workspace")
24
+ ```
25
+
26
+ ---
27
+
28
+ ## `/release start [repo]`
29
+
30
+ Create a release PR and notify Slack.
31
+
32
+ ### Steps
33
+
34
+ 1. **Detect repo** — match cwd or ask user to pick from release repos
35
+
36
+ 2. **Check for existing release PR:**
37
+ ```bash
38
+ gh pr list --search "[RELEASE]" --state open --base {production_branch} --head {release_branch} --json number,title,url --repo {owner}/{repo}
39
+ ```
40
+ If one exists, show it and ask: "A release PR already exists. Open it instead?"
41
+
42
+ 3. **Generate release notes** — compare branches to find PRs included in this release:
43
+ ```bash
44
+ # Get commits in release_branch that aren't in production_branch
45
+ gh api repos/{owner}/{repo}/compare/{production_branch}...{release_branch} --jq '.commits[].commit.message'
46
+ ```
47
+ Extract PR numbers from commit messages (e.g. `(#1234)`) and format as a bulleted list for the PR body.
48
+
49
+ **Do NOT use** `gh pr list --base {release_branch} --state merged` — that returns ALL historically merged PRs, not just the ones since the last release.
50
+
51
+ 4. **Ask risk level** — use AskUserQuestion:
52
+ - Low Risk (routine release, no breaking changes)
53
+ - High Risk (breaking changes, data migrations, or high-traffic feature)
54
+
55
+ 5. **Create the release PR:**
56
+ ```bash
57
+ gh pr create \
58
+ --base {production_branch} \
59
+ --head {release_branch} \
60
+ --title "[RELEASE] {repo_name}" \
61
+ --label "READY" \
62
+ --body "{release_pr_body}" \
63
+ --repo {owner}/{repo}
64
+ ```
65
+ See `templates.md` for the PR body template.
66
+
67
+ 6. **Post to Slack:**
68
+ ```bash
69
+ node -e 'process.stdout.write(JSON.stringify({
70
+ channel: "{slack_channel}",
71
+ text: "{slack_message}",
72
+ unfurl_links: false
73
+ }))' | droid integrations slack post
74
+ ```
75
+ See `templates.md` for the Slack message template (release started).
76
+
77
+ 7. **Confirm to user** — show PR URL and Slack post confirmation.
78
+
79
+ ---
80
+
81
+ ## `/release merge [repo]`
82
+
83
+ Merge the release PR if all checks are green, then notify Slack.
84
+
85
+ ### Steps
86
+
87
+ 1. **Detect repo** — match cwd or ask user
88
+
89
+ 2. **Find the open release PR:**
90
+ ```bash
91
+ gh pr list --search "[RELEASE]" --state open --base {production_branch} --head {release_branch} --json number,title,url,statusCheckRollup --repo {owner}/{repo}
92
+ ```
93
+ If no open release PR found, error: "No open release PR found. Run `/release start` first."
94
+
95
+ 3. **Check all status checks:**
96
+ Parse `statusCheckRollup` from the PR data. Every check must have `conclusion: "SUCCESS"` or `state: "SUCCESS"`.
97
+
98
+ If any checks are pending: "CI checks are still running on PR #{number}. Wait for them to finish."
99
+ If any checks are failing: "CI checks are failing on PR #{number}. Fix them before merging." Show the failing checks.
100
+
101
+ 4. **Confirm with user** — use AskUserQuestion:
102
+ "All checks are green on PR #{number}. Merge `{release_branch}` → `{production_branch}`?"
103
+
104
+ 5. **Merge the PR:**
105
+ ```bash
106
+ gh pr merge {pr_number} --merge --repo {owner}/{repo}
107
+ ```
108
+
109
+ 6. **Post to Slack** — release merged notification (see `templates.md`).
110
+
111
+ 7. **Confirm to user** — show merge confirmation and Slack post confirmation.
112
+
113
+ ---
114
+
115
+ ## `/release status`
116
+
117
+ Check release status across all configured release repos.
118
+
119
+ ### Steps
120
+
121
+ 1. **Get all release repos** from config
122
+
123
+ 2. **For each release repo**, gather:
124
+
125
+ **Open release PRs:**
126
+ ```bash
127
+ gh pr list --search "[RELEASE]" --state open --json number,title,url,statusCheckRollup --repo {owner}/{repo}
128
+ ```
129
+
130
+ 3. **Format and display** as a summary:
131
+
132
+ ```
133
+ {repo_name}
134
+ Release PR: #{number} — {CI status} (green/pending/failing)
135
+ ```
136
+
137
+ If no open release PR: "No active release"
138
+ If no release repos configured: "No release repos configured"
139
+
140
+ ---
141
+
142
+ ## `/release complete [repo]`
143
+
144
+ Close out a release — notify Slack.
145
+
146
+ ### Steps
147
+
148
+ 1. **Detect repo** — match cwd or ask user
149
+
150
+ 2. **Find the release PR:**
151
+ ```bash
152
+ # Check merged first
153
+ gh pr list --search "[RELEASE]" --state merged --base {production_branch} --head {release_branch} --json number,title,url,mergedAt --limit 1 --repo {owner}/{repo}
154
+ ```
155
+ If no merged PR found, check open:
156
+ ```bash
157
+ gh pr list --search "[RELEASE]" --state open --base {production_branch} --head {release_branch} --json number,title,url --repo {owner}/{repo}
158
+ ```
159
+ - If PR is still open (not merged): warn "Release PR #{number} is still open. Merge it first, or complete anyway?"
160
+ - If no PR found at all: warn "No release PR found. Post completion anyway?"
161
+
162
+ 3. **Post to Slack** — release complete notification (see `templates.md`).
163
+
164
+ 4. **Confirm to user:**
165
+ - "Release complete for `{repo_name}`"
166
+ - Show Slack message confirmation