@link-assistant/hive-mind 1.34.6 → 1.34.8

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,21 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.34.8
4
+
5
+ ### Patch Changes
6
+
7
+ - c95a472: Add test timeout guidelines to system prompt and case study documentation
8
+ - Added guidelines for setting reasonable test timeouts in CI/CD pipelines
9
+ - Created comprehensive case study in docs/case-studies/issue-1197/
10
+ - Recommendations include: 5-30s for unit tests, 30-60s for E2E tests
11
+ - Guidelines for job-level workflow timeouts and fail-fast patterns
12
+
13
+ ## 1.34.7
14
+
15
+ ### Patch Changes
16
+
17
+ - bb83be9: fix: fail with helpful error when --fork used on own repository (issue #1206)
18
+
3
19
  ## 1.34.6
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -509,6 +509,21 @@ Shows:
509
509
  - Commands run as the system user running the bot
510
510
  - Ensure proper authentication (`gh auth login`, `claude-profiles`)
511
511
 
512
+ ## 🏆 Best Practices
513
+
514
+ Hive Mind works even better when repositories have strong CI/CD pipelines and clear issue requirements. See:
515
+
516
+ - [BEST-PRACTICES.md](./docs/BEST-PRACTICES.md) — Universal prompts, issue writing guidelines, architecture improvement, and subagent patterns
517
+ - [CI-CD-BEST-PRACTICES.md](./docs/CI-CD-BEST-PRACTICES.md) — CI/CD pipeline setup, recommended templates, and enforcement strategies
518
+
519
+ Key benefits of proper CI/CD:
520
+
521
+ - AI solvers iterate until all checks pass
522
+ - Consistent quality regardless of human/AI team composition
523
+ - File size limits ensure code is readable by both AI and humans
524
+
525
+ Ready-to-use templates are available for JavaScript, Rust, Python, Go, C#, and Java.
526
+
512
527
  ## 🏗️ Architecture
513
528
 
514
529
  The Hive Mind operates on three layers:
@@ -850,21 +865,6 @@ That can be done, but not recommended as reboot have better effect.
850
865
 
851
866
  Unlicense License - see [LICENSE](./LICENSE)
852
867
 
853
- ## 🏆 Best Practices
854
-
855
- Hive Mind works even better when repositories have strong CI/CD pipelines and clear issue requirements. See:
856
-
857
- - [BEST-PRACTICES.md](./docs/BEST-PRACTICES.md) — Universal prompts, issue writing guidelines, architecture improvement, and subagent patterns
858
- - [CI-CD-BEST-PRACTICES.md](./docs/CI-CD-BEST-PRACTICES.md) — CI/CD pipeline setup, recommended templates, and enforcement strategies
859
-
860
- Key benefits of proper CI/CD:
861
-
862
- - AI solvers iterate until all checks pass
863
- - Consistent quality regardless of human/AI team composition
864
- - File size limits ensure code is readable by both AI and humans
865
-
866
- Ready-to-use templates are available for JavaScript, Rust, Python, Go, C#, and Java.
867
-
868
868
  ## 🤖 Contributing
869
869
 
870
870
  This project uses AI-driven development. See [CONTRIBUTING.md](./docs/CONTRIBUTING.md) for human-AI collaboration guidelines.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.34.6",
3
+ "version": "1.34.8",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -172,6 +172,8 @@ Solution development and testing.
172
172
  write unit tests with mocks for easy and quick start.
173
173
  - When you test integrations, use existing framework.
174
174
  - When you test solution draft, include automated checks in pr.
175
+ - When you write or modify tests, consider setting reasonable timeouts at test, suite, and CI job levels so failures surface quickly instead of hanging.
176
+ - When you see repeated test timeout patterns in CI, investigate the root cause rather than increasing timeouts.
175
177
  - When issue is unclear, write comment on issue asking questions.
176
178
  - When you encounter any problems that you unable to solve yourself, write a comment to the pull request asking for help.
177
179
  - When you need human help, use gh pr comment ${prNumber} --body "your message" to comment on existing PR.
@@ -215,6 +215,8 @@ Solution development and testing.
215
215
  write unit tests with mocks for easy and quick start.
216
216
  - When you test integrations, use existing framework.
217
217
  - When you test solution draft, include automated checks in pr.
218
+ - When you write or modify tests, consider setting reasonable timeouts at test, suite, and CI job levels so failures surface quickly instead of hanging.
219
+ - When you see repeated test timeout patterns in CI, investigate the root cause rather than increasing timeouts.
218
220
  - When issue is unclear, write comment on issue asking questions.
219
221
  - When you encounter any problems that you unable to solve yourself (any human feedback or help), write a comment to the pull request asking for help.
220
222
  - When you need human help, use gh pr comment ${prNumber} --body "your message" to comment on existing PR.
@@ -181,6 +181,8 @@ Solution development and testing.
181
181
  write unit tests with mocks for easy and quick start.
182
182
  - When you test integrations, use existing framework.
183
183
  - When you test solution draft, include automated checks in pr.
184
+ - When you write or modify tests, consider setting reasonable timeouts at test, suite, and CI job levels so failures surface quickly instead of hanging.
185
+ - When you see repeated test timeout patterns in CI, investigate the root cause rather than increasing timeouts.
184
186
  - When issue is unclear, write comment on issue asking questions.
185
187
  - When you encounter any problems that you unable to solve yourself (any human feedback or help), write a comment to the pull request asking for help.
186
188
  - When you need human help, use gh pr comment ${prNumber} --body "your message" to comment on existing PR.
@@ -175,6 +175,8 @@ Solution development and testing.
175
175
  write unit tests with mocks for easy and quick start.
176
176
  - When you test integrations, use existing framework.
177
177
  - When you test solution draft, include automated checks in pr.
178
+ - When you write or modify tests, consider setting reasonable timeouts at test, suite, and CI job levels so failures surface quickly instead of hanging.
179
+ - When you see repeated test timeout patterns in CI, investigate the root cause rather than increasing timeouts.
178
180
  - When issue is unclear, write comment on issue asking questions.
179
181
  - When you encounter any problems that you unable to solve yourself, write a comment to the pull request asking for help.
180
182
  - When you need human help, use gh pr comment ${prNumber} --body "your message" to comment on existing PR.
@@ -33,38 +33,16 @@ import { safeExit } from './exit-handler.lib.mjs';
33
33
  const githubLib = await import('./github.lib.mjs');
34
34
  const { checkRepositoryWritePermission } = githubLib;
35
35
 
36
- // Get the root repository of any repository
37
- // Returns the source (root) repository if the repo is a fork, otherwise returns the repo itself
38
- // Returns null if repository is not accessible (404 or other errors)
36
+ // Get root repository (fork source or self), or null if inaccessible
39
37
  export const getRootRepository = async (owner, repo) => {
40
38
  try {
41
39
  const result = await $`gh api repos/${owner}/${repo} --jq '{fork: .fork, source: .source.full_name}' 2>&1`;
42
-
43
- if (result.code !== 0) {
44
- // Check if it's a 404 error - repository doesn't exist or no permissions
45
- const errorOutput = (result.stderr || result.stdout || '').toString();
46
- if (errorOutput.includes('HTTP 404') || errorOutput.includes('Not Found')) {
47
- // Repository not accessible - this will be handled by fork creation logic
48
- // Return null to indicate we couldn't determine root repo
49
- return null;
50
- }
51
- return null;
52
- }
40
+ if (result.code !== 0) return null;
53
41
 
54
42
  const repoInfo = JSON.parse(result.stdout.toString().trim());
55
-
56
- if (repoInfo.fork && repoInfo.source) {
57
- return repoInfo.source;
58
- } else {
59
- return `${owner}/${repo}`;
60
- }
43
+ return repoInfo.fork && repoInfo.source ? repoInfo.source : `${owner}/${repo}`;
61
44
  } catch (error) {
62
- reportError(error, {
63
- context: 'get_root_repository',
64
- owner,
65
- repo,
66
- operation: 'determine_fork_root',
67
- });
45
+ reportError(error, { context: 'get_root_repository', owner, repo, operation: 'determine_fork_root' });
68
46
  return null;
69
47
  }
70
48
  };
@@ -73,34 +51,20 @@ export const getRootRepository = async (owner, repo) => {
73
51
  export const checkExistingForkOfRoot = async rootRepo => {
74
52
  try {
75
53
  const userResult = await $`gh api user --jq .login`;
76
- if (userResult.code !== 0) {
77
- return null;
78
- }
54
+ if (userResult.code !== 0) return null;
79
55
  const currentUser = userResult.stdout.toString().trim();
80
56
 
81
57
  const forksResult = await $`gh api repos/${rootRepo}/forks --paginate --jq '.[] | select(.owner.login == "${currentUser}") | .full_name'`;
82
-
83
- if (forksResult.code !== 0) {
84
- return null;
85
- }
58
+ if (forksResult.code !== 0) return null;
86
59
 
87
60
  const forks = forksResult.stdout
88
61
  .toString()
89
62
  .trim()
90
63
  .split('\n')
91
64
  .filter(f => f);
92
-
93
- if (forks.length > 0) {
94
- return forks[0];
95
- } else {
96
- return null;
97
- }
65
+ return forks.length > 0 ? forks[0] : null;
98
66
  } catch (error) {
99
- reportError(error, {
100
- context: 'check_existing_fork_of_root',
101
- rootRepo,
102
- operation: 'search_user_forks',
103
- });
67
+ reportError(error, { context: 'check_existing_fork_of_root', rootRepo, operation: 'search_user_forks' });
104
68
  return null;
105
69
  }
106
70
  };
@@ -407,6 +371,30 @@ export const setupRepository = async (argv, owner, repo, forkOwner = null, issue
407
371
  }
408
372
  const currentUser = userResult.stdout.toString().trim();
409
373
 
374
+ // Check if user owns the repository (Issue #1206)
375
+ // GitHub doesn't allow forking your own repositories and returns HTTP 403
376
+ // When --fork is explicitly used, fail with a clear error and suggest --auto-fork
377
+ if (currentUser === owner) {
378
+ await log('');
379
+ await log(`${formatAligned('❌', 'CANNOT FORK OWN REPOSITORY', '')}`, { level: 'error' });
380
+ await log('');
381
+ await log(' 🔍 What happened:');
382
+ await log(` You are the owner of ${owner}/${repo}`);
383
+ await log(' GitHub does not allow forking your own repositories (returns HTTP 403)');
384
+ await log('');
385
+ await log(' 💡 Solutions:');
386
+ await log('');
387
+ await log(' Option 1: Use --auto-fork instead of --fork');
388
+ await log(' --auto-fork automatically detects ownership and works directly');
389
+ await log(' on the repository when you have write access, without forking.');
390
+ await log(` Example: solve "${issueUrl || `https://github.com/${owner}/${repo}/issues/<number>`}" --auto-fork`);
391
+ await log('');
392
+ await log(' Option 2: Work directly on the repository without forking');
393
+ await log(` Example: solve "${issueUrl || `https://github.com/${owner}/${repo}/issues/<number>`}"`);
394
+ await log('');
395
+ await safeExit(1, 'Cannot fork own repository - use --auto-fork or remove --fork flag');
396
+ }
397
+
410
398
  // Check for fork conflicts (Issue #344)
411
399
  // Detect if we're trying to fork a repository that shares the same root
412
400
  // as an existing fork we already have