@link-assistant/hive-mind 0.46.1 → 0.47.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +20 -15
  2. package/README.md +42 -8
  3. package/package.json +16 -3
  4. package/src/agent.lib.mjs +49 -70
  5. package/src/agent.prompts.lib.mjs +6 -20
  6. package/src/buildUserMention.lib.mjs +4 -17
  7. package/src/claude-limits.lib.mjs +15 -15
  8. package/src/claude.lib.mjs +617 -626
  9. package/src/claude.prompts.lib.mjs +7 -22
  10. package/src/codex.lib.mjs +39 -71
  11. package/src/codex.prompts.lib.mjs +6 -20
  12. package/src/config.lib.mjs +3 -16
  13. package/src/contributing-guidelines.lib.mjs +5 -18
  14. package/src/exit-handler.lib.mjs +4 -4
  15. package/src/git.lib.mjs +7 -7
  16. package/src/github-issue-creator.lib.mjs +17 -17
  17. package/src/github-linking.lib.mjs +8 -33
  18. package/src/github.batch.lib.mjs +20 -16
  19. package/src/github.graphql.lib.mjs +18 -18
  20. package/src/github.lib.mjs +89 -91
  21. package/src/hive.config.lib.mjs +50 -50
  22. package/src/hive.mjs +1293 -1296
  23. package/src/instrument.mjs +7 -11
  24. package/src/interactive-mode.lib.mjs +112 -138
  25. package/src/lenv-reader.lib.mjs +1 -6
  26. package/src/lib.mjs +36 -45
  27. package/src/lino.lib.mjs +2 -2
  28. package/src/local-ci-checks.lib.mjs +15 -14
  29. package/src/memory-check.mjs +52 -60
  30. package/src/model-mapping.lib.mjs +25 -32
  31. package/src/model-validation.lib.mjs +31 -31
  32. package/src/opencode.lib.mjs +37 -62
  33. package/src/opencode.prompts.lib.mjs +7 -21
  34. package/src/protect-branch.mjs +14 -15
  35. package/src/review.mjs +28 -27
  36. package/src/reviewers-hive.mjs +64 -69
  37. package/src/sentry.lib.mjs +13 -10
  38. package/src/solve.auto-continue.lib.mjs +48 -38
  39. package/src/solve.auto-pr.lib.mjs +111 -69
  40. package/src/solve.branch-errors.lib.mjs +17 -46
  41. package/src/solve.branch.lib.mjs +16 -23
  42. package/src/solve.config.lib.mjs +263 -261
  43. package/src/solve.error-handlers.lib.mjs +21 -79
  44. package/src/solve.execution.lib.mjs +10 -18
  45. package/src/solve.feedback.lib.mjs +25 -46
  46. package/src/solve.mjs +59 -60
  47. package/src/solve.preparation.lib.mjs +10 -36
  48. package/src/solve.repo-setup.lib.mjs +4 -19
  49. package/src/solve.repository.lib.mjs +37 -37
  50. package/src/solve.results.lib.mjs +32 -46
  51. package/src/solve.session.lib.mjs +7 -22
  52. package/src/solve.validation.lib.mjs +19 -17
  53. package/src/solve.watch.lib.mjs +20 -33
  54. package/src/start-screen.mjs +24 -24
  55. package/src/task.mjs +38 -44
  56. package/src/telegram-bot.mjs +125 -121
  57. package/src/telegram-top-command.lib.mjs +32 -48
  58. package/src/usage-limit.lib.mjs +9 -13
  59. package/src/version-info.lib.mjs +1 -1
  60. package/src/version.lib.mjs +1 -1
  61. package/src/youtrack/solve.youtrack.lib.mjs +3 -8
  62. package/src/youtrack/youtrack-sync.mjs +8 -14
  63. package/src/youtrack/youtrack.lib.mjs +26 -28
@@ -16,26 +16,18 @@ const { $ } = await use('command-stream');
16
16
 
17
17
  // Import shared library functions
18
18
  const lib = await import('./lib.mjs');
19
- const {
20
- log,
21
- cleanErrorMessage
22
- } = lib;
19
+ const { log, cleanErrorMessage } = lib;
23
20
 
24
21
  // Import exit handler
25
22
  import { safeExit } from './exit-handler.lib.mjs';
26
23
 
27
24
  // Import branch name validation functions
28
25
  const branchLib = await import('./solve.branch.lib.mjs');
29
- const {
30
- getIssueBranchPrefix,
31
- matchesIssuePattern
32
- } = branchLib;
26
+ const { getIssueBranchPrefix, matchesIssuePattern } = branchLib;
33
27
 
34
28
  // Import GitHub-related functions
35
29
  const githubLib = await import('./github.lib.mjs');
36
- const {
37
- checkFileInBranch
38
- } = githubLib;
30
+ const { checkFileInBranch } = githubLib;
39
31
 
40
32
  // Import validation functions for time parsing
41
33
  const validation = await import('./solve.validation.lib.mjs');
@@ -51,16 +43,14 @@ const { extractLinkedIssueNumber } = githubLinking;
51
43
  // Import configuration
52
44
  import { autoContinue } from './config.lib.mjs';
53
45
 
54
- const {
55
- calculateWaitTime
56
- } = validation;
46
+ const { calculateWaitTime } = validation;
57
47
 
58
48
  /**
59
49
  * Format time duration in days:hours:minutes:seconds
60
50
  * @param {number} ms - Milliseconds
61
51
  * @returns {string} - Formatted time string (e.g., "0:02:15:30")
62
52
  */
63
- const formatWaitTime = (ms) => {
53
+ const formatWaitTime = ms => {
64
54
  const seconds = Math.floor(ms / 1000);
65
55
  const minutes = Math.floor(seconds / 60);
66
56
  const hours = Math.floor(minutes / 60);
@@ -109,7 +99,8 @@ export const autoContinueWhenLimitResets = async (issueUrl, sessionId, argv, sho
109
99
  const resumeArgs = [
110
100
  process.argv[1], // solve.mjs path
111
101
  issueUrl,
112
- '--resume', sessionId
102
+ '--resume',
103
+ sessionId,
113
104
  ];
114
105
 
115
106
  // Preserve auto-continue flag
@@ -129,19 +120,18 @@ export const autoContinueWhenLimitResets = async (issueUrl, sessionId, argv, sho
129
120
  const child = childProcess.spawn('node', resumeArgs, {
130
121
  stdio: 'inherit',
131
122
  cwd: process.cwd(),
132
- env: process.env
123
+ env: process.env,
133
124
  });
134
125
 
135
- child.on('close', (code) => {
126
+ child.on('close', code => {
136
127
  process.exit(code);
137
128
  });
138
-
139
129
  } catch (error) {
140
130
  reportError(error, {
141
131
  context: 'auto_continue_with_command',
142
132
  issueUrl,
143
133
  sessionId,
144
- operation: 'auto_continue_execution'
134
+ operation: 'auto_continue_execution',
145
135
  });
146
136
  await log(`\n❌ Auto-continue failed: ${cleanErrorMessage(error)}`, { level: 'error' });
147
137
  await log('\n🔄 Manual resume command:');
@@ -240,7 +230,7 @@ export const checkExistingPRsForAutoContinue = async (argv, isIssueUrl, owner, r
240
230
  owner,
241
231
  repo,
242
232
  issueNumber,
243
- operation: 'search_issue_prs'
233
+ operation: 'search_issue_prs',
244
234
  });
245
235
  await log(`⚠️ Warning: Could not search for existing PRs: ${prSearchError.message}`, { level: 'warning' });
246
236
  await log(' Continuing with normal flow...');
@@ -276,14 +266,20 @@ export const processPRMode = async (isPrUrl, urlNumber, owner, repo, argv) => {
276
266
  prNumber,
277
267
  owner,
278
268
  repo,
279
- jsonFields: 'headRefName,body,number,mergeStateStatus,headRepositoryOwner'
269
+ jsonFields: 'headRefName,body,number,mergeStateStatus,headRepositoryOwner',
280
270
  });
281
271
 
282
272
  if (prResult.code !== 0 || !prResult.data) {
283
273
  await log('Error: Failed to get PR details', { level: 'error' });
284
274
 
285
275
  if (prResult.output.includes('Could not resolve to a PullRequest')) {
286
- await githubLib.handlePRNotFoundError({ prNumber, owner, repo, argv, shouldAttachLogs: argv.attachLogs || argv['attach-logs'] });
276
+ await githubLib.handlePRNotFoundError({
277
+ prNumber,
278
+ owner,
279
+ repo,
280
+ argv,
281
+ shouldAttachLogs: argv.attachLogs || argv['attach-logs'],
282
+ });
287
283
  } else {
288
284
  await log(`Error: ${prResult.stderr || 'Unknown error'}`, { level: 'error' });
289
285
  }
@@ -319,7 +315,7 @@ export const processPRMode = async (isPrUrl, urlNumber, owner, repo, argv) => {
319
315
  reportError(error, {
320
316
  context: 'process_pr_in_auto_continue',
321
317
  prNumber,
322
- operation: 'process_pr_for_continuation'
318
+ operation: 'process_pr_for_continuation',
323
319
  });
324
320
  await log(`Error: Failed to process PR: ${cleanErrorMessage(error)}`, { level: 'error' });
325
321
  await safeExit(1, 'Auto-continue failed');
@@ -362,7 +358,11 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
362
358
  const branchListResult = await $`gh api --paginate repos/${forkRepo}/branches --jq '.[].name'`;
363
359
 
364
360
  if (branchListResult.code === 0) {
365
- const allBranches = branchListResult.stdout.toString().trim().split('\n').filter(b => b);
361
+ const allBranches = branchListResult.stdout
362
+ .toString()
363
+ .trim()
364
+ .split('\n')
365
+ .filter(b => b);
366
366
  existingBranches = allBranches.filter(branch => matchesIssuePattern(branch, issueNumber));
367
367
 
368
368
  if (existingBranches.length > 0) {
@@ -380,9 +380,11 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
380
380
  owner,
381
381
  repo,
382
382
  issueNumber,
383
- operation: 'search_fork_branches'
383
+ operation: 'search_fork_branches',
384
+ });
385
+ await log(`⚠️ Warning: Could not check for existing branches in fork: ${forkBranchError.message}`, {
386
+ level: 'warning',
384
387
  });
385
- await log(`⚠️ Warning: Could not check for existing branches in fork: ${forkBranchError.message}`, { level: 'warning' });
386
388
  }
387
389
  } else {
388
390
  // NOT in fork mode - check for existing branches in the main repository
@@ -394,7 +396,11 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
394
396
  const branchListResult = await $`gh api --paginate repos/${owner}/${repo}/branches --jq '.[].name'`;
395
397
 
396
398
  if (branchListResult.code === 0) {
397
- const allBranches = branchListResult.stdout.toString().trim().split('\n').filter(b => b);
399
+ const allBranches = branchListResult.stdout
400
+ .toString()
401
+ .trim()
402
+ .split('\n')
403
+ .filter(b => b);
398
404
  existingBranches = allBranches.filter(branch => matchesIssuePattern(branch, issueNumber));
399
405
 
400
406
  if (existingBranches.length > 0) {
@@ -410,9 +416,11 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
410
416
  owner,
411
417
  repo,
412
418
  issueNumber,
413
- operation: 'search_main_repo_branches'
419
+ operation: 'search_main_repo_branches',
420
+ });
421
+ await log(`⚠️ Warning: Could not check for existing branches in main repo: ${mainBranchError.message}`, {
422
+ level: 'warning',
414
423
  });
415
- await log(`⚠️ Warning: Could not check for existing branches in main repo: ${mainBranchError.message}`, { level: 'warning' });
416
424
  }
417
425
  }
418
426
 
@@ -463,7 +471,7 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
463
471
  isContinueMode: true,
464
472
  prNumber: pr.number,
465
473
  prBranch: pr.headRefName,
466
- issueNumber
474
+ issueNumber,
467
475
  };
468
476
  } else if (createdAt < twentyFourHoursAgo) {
469
477
  await log(`✅ Auto-continue: Using PR #${pr.number} (created ${ageHours}h ago, branch: ${pr.headRefName})`);
@@ -479,7 +487,7 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
479
487
  isContinueMode: true,
480
488
  prNumber: pr.number,
481
489
  prBranch: pr.headRefName,
482
- issueNumber
490
+ issueNumber,
483
491
  };
484
492
  } else {
485
493
  await log(` PR #${pr.number}: CLAUDE.md exists, age ${ageHours}h < 24h - skipping`);
@@ -498,7 +506,7 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
498
506
  owner,
499
507
  repo,
500
508
  issueNumber,
501
- operation: 'search_pr_with_claude_md'
509
+ operation: 'search_pr_with_claude_md',
502
510
  });
503
511
  await log(`⚠️ Warning: Could not search for existing PRs: ${prSearchError.message}`, { level: 'warning' });
504
512
  await log(' Continuing with normal flow...');
@@ -536,7 +544,7 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
536
544
  isContinueMode: true,
537
545
  prNumber: openPr.number,
538
546
  prBranch: selectedBranch,
539
- issueNumber
547
+ issueNumber,
540
548
  };
541
549
  }
542
550
  }
@@ -547,10 +555,12 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
547
555
  owner,
548
556
  repo,
549
557
  selectedBranch,
550
- operation: 'search_pr_for_branch'
558
+ operation: 'search_pr_for_branch',
551
559
  });
552
560
  // If we can't check for PR, still continue with the branch
553
- await log(`⚠️ Warning: Could not check for existing PR for branch: ${prCheckError.message}`, { level: 'warning' });
561
+ await log(`⚠️ Warning: Could not check for existing PR for branch: ${prCheckError.message}`, {
562
+ level: 'warning',
563
+ });
554
564
  }
555
565
 
556
566
  // No PR exists yet for this branch, but we can still use the branch
@@ -560,9 +570,9 @@ export const processAutoContinueForIssue = async (argv, isIssueUrl, urlNumber, o
560
570
  isContinueMode: true,
561
571
  prNumber: null, // No PR yet
562
572
  prBranch: selectedBranch,
563
- issueNumber
573
+ issueNumber,
564
574
  };
565
575
  }
566
576
 
567
577
  return { isContinueMode: false, issueNumber };
568
- };
578
+ };