@link-assistant/hive-mind 0.51.12 → 0.51.13

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,11 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 0.51.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 20d6f3a: Fix URL hash fragment parsing - URLs with hash fragments like #issuecomment-123 are now correctly parsed. Previously, solving a PR with a comment URL like /pull/9#issuecomment-123 would fail because the PR number was extracted as "9#issuecomment-123" instead of "9".
8
+
3
9
  ## 0.51.12
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "0.51.12",
3
+ "version": "0.51.13",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
package/src/solve.mjs CHANGED
@@ -52,7 +52,7 @@ const { log, setLogFile, getLogFile, getAbsoluteLogPath, cleanErrorMessage, form
52
52
  const githubLib = await import('./github.lib.mjs');
53
53
  const { sanitizeLogContent, attachLogToGitHub } = githubLib;
54
54
  const validation = await import('./solve.validation.lib.mjs');
55
- const { validateGitHubUrl, showAttachLogsWarning, initializeLogFile, validateUrlRequirement, validateContinueOnlyOnFeedback, performSystemChecks, parseUrlComponents } = validation;
55
+ const { validateGitHubUrl, showAttachLogsWarning, initializeLogFile, validateUrlRequirement, validateContinueOnlyOnFeedback, performSystemChecks } = validation;
56
56
  const autoContinue = await import('./solve.auto-continue.lib.mjs');
57
57
  const { processAutoContinueForIssue } = autoContinue;
58
58
  const repository = await import('./solve.repository.lib.mjs');
@@ -175,8 +175,11 @@ const urlValidation = validateGitHubUrl(issueUrl);
175
175
  if (!urlValidation.isValid) {
176
176
  await safeExit(1, 'Invalid GitHub URL');
177
177
  }
178
- const { isIssueUrl, isPrUrl, normalizedUrl } = urlValidation;
178
+ const { isIssueUrl, isPrUrl, normalizedUrl, owner, repo, number: urlNumber } = urlValidation;
179
179
  issueUrl = normalizedUrl || issueUrl;
180
+ // Store owner and repo globally for error handlers early
181
+ global.owner = owner;
182
+ global.repo = repo;
180
183
  // Setup unhandled error handlers to ensure log path is always shown
181
184
  const errorHandlerOptions = {
182
185
  log,
@@ -222,11 +225,9 @@ if (argv.verbose) {
222
225
  await log(` Is PR URL: ${!!isPrUrl}`, { verbose: true });
223
226
  }
224
227
  const claudePath = process.env.CLAUDE_PATH || 'claude';
225
- // Parse URL components using validation module
226
- const { owner, repo, urlNumber } = parseUrlComponents(issueUrl);
227
- // Store owner and repo globally for error handlers
228
- global.owner = owner;
229
- global.repo = repo;
228
+ // Note: owner, repo, and urlNumber are already extracted from validateGitHubUrl() above
229
+ // The parseUrlComponents() call was removed as it had a bug with hash fragments (#issuecomment-xyz)
230
+ // and the validation result already provides these values correctly parsed
230
231
 
231
232
  // Handle --auto-fork option: automatically fork public repositories without write access
232
233
  if (argv.autoFork && !argv.fork) {
@@ -272,13 +272,23 @@ export const performSystemChecks = async (minDiskSpace = 2048, skipToolConnectio
272
272
  return true;
273
273
  };
274
274
 
275
- // Parse URL components
275
+ // Parse URL components using Node.js URL API
276
+ // Note: This function is a simpler alternative to parseGitHubUrl for cases where
277
+ // you only need owner, repo, and urlNumber without full validation.
278
+ // For full validation, use validateGitHubUrl() which internally uses parseGitHubUrl().
279
+ // Uses Node.js URL API (https://nodejs.org/api/url.html) for stable parsing.
276
280
  export const parseUrlComponents = issueUrl => {
277
- const urlParts = issueUrl.split('/');
281
+ // Use Node.js URL API for reliable parsing
282
+ // This automatically handles hash fragments, query params, and edge cases
283
+ const urlObj = new globalThis.URL(issueUrl);
284
+
285
+ // Extract path segments, filtering out empty strings from leading/trailing slashes
286
+ const pathParts = urlObj.pathname.split('/').filter(p => p);
287
+
278
288
  return {
279
- owner: urlParts[3],
280
- repo: urlParts[4],
281
- urlNumber: urlParts[6], // Could be issue or PR number
289
+ owner: pathParts[0],
290
+ repo: pathParts[1],
291
+ urlNumber: pathParts[3], // Could be issue or PR number (pathParts[2] is 'issues' or 'pull')
282
292
  };
283
293
  };
284
294