@link-assistant/hive-mind 1.11.1 → 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 CHANGED
@@ -1,5 +1,25 @@
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
+
15
+ ## 1.11.2
16
+
17
+ ### Patch Changes
18
+
19
+ - 8ee116a: fix: detect "command not found" errors to prevent false success
20
+
21
+ When the `claude` CLI command is not found (not installed or not in PATH), the tool was incorrectly reporting "Claude command completed" instead of detecting the failure. This fix adds "not found" to the stderr error detection pattern to properly detect when commands fail to start.
22
+
3
23
  ## 1.11.1
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -1095,7 +1095,9 @@ export const executeClaudeCommand = async params => {
1095
1095
  // Example: "⚠️ [BashTool] Pre-flight check is taking longer than expected. Run with ANTHROPIC_LOG=debug to check for failed or slow API requests."
1096
1096
  // Even though this contains the word "failed", it's a warning, not an error
1097
1097
  const isWarning = trimmed.startsWith('⚠️') || trimmed.startsWith('⚠');
1098
- if (trimmed && !isWarning && (trimmed.includes('Error:') || trimmed.includes('error') || trimmed.includes('failed'))) {
1098
+ // Issue #1165: Also detect "command not found" errors (e.g., "/bin/sh: 1: claude: not found")
1099
+ // These indicate the Claude CLI is not installed or not in PATH
1100
+ if (trimmed && !isWarning && (trimmed.includes('Error:') || trimmed.includes('error') || trimmed.includes('failed') || trimmed.includes('not found'))) {
1099
1101
  stderrErrors.push(trimmed);
1100
1102
  }
1101
1103
  }
@@ -1108,6 +1110,23 @@ export const executeClaudeCommand = async params => {
1108
1110
  }
1109
1111
  }
1110
1112
 
1113
+ // Issue #1165: Check actual exit code from command result for more reliable detection
1114
+ // The .stream() method may not emit 'exit' chunks, but the command object still tracks the exit code
1115
+ // Exit code 127 is the standard Unix convention for "command not found"
1116
+ if (execCommand.result && typeof execCommand.result.code === 'number') {
1117
+ const resultExitCode = execCommand.result.code;
1118
+ if (exitCode === 0 && resultExitCode !== 0) {
1119
+ exitCode = resultExitCode;
1120
+ await log(`⚠️ Updated exit code from command result: ${resultExitCode}`, { verbose: true });
1121
+ }
1122
+ // Specifically detect "command not found" via exit code 127
1123
+ if (resultExitCode === 127 && !commandFailed) {
1124
+ commandFailed = true;
1125
+ await log(`\n❌ Command not found (exit code 127) - "${claudePath}" is not installed or not in PATH`, { level: 'error' });
1126
+ await log(' Please ensure Claude CLI is installed: npm install -g @anthropic-ai/claude-code', { level: 'error' });
1127
+ }
1128
+ }
1129
+
1111
1130
  // Flush any remaining queued comments from interactive mode
1112
1131
  if (interactiveHandler) {
1113
1132
  try {
@@ -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: 'ready' label exists in ${owner}/${repo}`);
57
+ console.log(`[VERBOSE] /merge: Unexpected response format when checking label in ${owner}/${repo}`);
43
58
  }
44
- return { exists: true, label };
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
- const labelData = JSON.stringify({
68
- name: READY_LABEL.name,
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) {