@link-assistant/hive-mind 1.11.2 → 1.11.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.
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/github-merge.lib.mjs +19 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 1.11.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9f24356: Fix 'ready' label not being created by /merge command
|
|
8
|
+
|
|
9
|
+
Two bugs prevented the /merge command from creating the 'ready' label:
|
|
10
|
+
1. `checkReadyLabelExists()` incorrectly treated GitHub API's 404 JSON error response as the label existing. The function now properly checks for "Not Found" message in the response.
|
|
11
|
+
2. `createReadyLabel()` used bash-specific heredoc syntax (`<<<`) which fails in `/bin/sh`. Now uses `gh api -f` flags for shell compatibility.
|
|
12
|
+
|
|
13
|
+
Fixes #1177
|
|
14
|
+
|
|
3
15
|
## 1.11.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
package/src/github-merge.lib.mjs
CHANGED
|
@@ -38,10 +38,25 @@ export async function checkReadyLabelExists(owner, repo, verbose = false) {
|
|
|
38
38
|
const { stdout } = await exec(`gh api repos/${owner}/${repo}/labels/${READY_LABEL.name} 2>/dev/null || echo ""`);
|
|
39
39
|
if (stdout.trim()) {
|
|
40
40
|
const label = JSON.parse(stdout.trim());
|
|
41
|
+
// Check if the response is an error (404 Not Found returns JSON with "message" field)
|
|
42
|
+
if (label.message === 'Not Found' || label.status === '404') {
|
|
43
|
+
if (verbose) {
|
|
44
|
+
console.log(`[VERBOSE] /merge: 'ready' label does not exist in ${owner}/${repo}`);
|
|
45
|
+
}
|
|
46
|
+
return { exists: false, label: null };
|
|
47
|
+
}
|
|
48
|
+
// Valid label has a 'name' field
|
|
49
|
+
if (label.name) {
|
|
50
|
+
if (verbose) {
|
|
51
|
+
console.log(`[VERBOSE] /merge: 'ready' label exists in ${owner}/${repo}`);
|
|
52
|
+
}
|
|
53
|
+
return { exists: true, label };
|
|
54
|
+
}
|
|
55
|
+
// Unknown response format, treat as not found
|
|
41
56
|
if (verbose) {
|
|
42
|
-
console.log(`[VERBOSE] /merge:
|
|
57
|
+
console.log(`[VERBOSE] /merge: Unexpected response format when checking label in ${owner}/${repo}`);
|
|
43
58
|
}
|
|
44
|
-
return { exists:
|
|
59
|
+
return { exists: false, label: null };
|
|
45
60
|
}
|
|
46
61
|
if (verbose) {
|
|
47
62
|
console.log(`[VERBOSE] /merge: 'ready' label does not exist in ${owner}/${repo}`);
|
|
@@ -64,13 +79,8 @@ export async function checkReadyLabelExists(owner, repo, verbose = false) {
|
|
|
64
79
|
*/
|
|
65
80
|
export async function createReadyLabel(owner, repo, verbose = false) {
|
|
66
81
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
description: READY_LABEL.description,
|
|
70
|
-
color: READY_LABEL.color,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const { stdout } = await exec(`gh api repos/${owner}/${repo}/labels -X POST -H "Accept: application/vnd.github+json" --input - <<< '${labelData}'`);
|
|
82
|
+
// Use gh api with -f flags to pass fields directly (avoids shell heredoc compatibility issues)
|
|
83
|
+
const { stdout } = await exec(`gh api repos/${owner}/${repo}/labels -X POST -H "Accept: application/vnd.github+json" -f name="${READY_LABEL.name}" -f description="${READY_LABEL.description}" -f color="${READY_LABEL.color}"`);
|
|
74
84
|
const label = JSON.parse(stdout.trim());
|
|
75
85
|
|
|
76
86
|
if (verbose) {
|