@link-assistant/hive-mind 0.47.1 → 0.48.0

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,20 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 0.48.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 93ea94b: Add solution drafts listing feature to hive command. When processing completes, hive now displays all completed issues with their linked pull requests before showing the "✅ All issues processed!" message.
8
+
9
+ ### Patch Changes
10
+
11
+ - a44ab88: Add system prompt guidance to prefer using existing code as examples
12
+ - Added guideline to encourage searching for similar existing implementations before implementing from scratch
13
+ - Applied consistently across all three prompt modules (claude, codex, opencode)
14
+ - Helps maintain consistency with existing patterns and reduces redundant work
15
+
16
+ - 1bdc96d: Fix --base-branch option to properly create branches from the specified base branch instead of from current HEAD
17
+
3
18
  ## 0.47.1
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "0.47.1",
3
+ "version": "0.48.0",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -135,6 +135,7 @@ Initial research.
135
135
 
136
136
  Solution development and testing.
137
137
  - When issue is solvable, implement code with tests.
138
+ - When implementing features, search for similar existing implementations in the codebase and use them as examples instead of implementing everything from scratch.
138
139
  - When coding, each atomic step that can be useful by itself should be commited to the pull request's branch, meaning if work will be interrupted by any reason parts of solution will still be kept intact and safe in pull request.
139
140
  - When you test:
140
141
  start from testing of small functions using separate scripts;
@@ -127,6 +127,7 @@ Initial research.
127
127
 
128
128
  Solution development and testing.
129
129
  - When issue is solvable, implement code with tests.
130
+ - When implementing features, search for similar existing implementations in the codebase and use them as examples instead of implementing everything from scratch.
130
131
  - When coding, each atomic step that can be useful by itself should be commited to the pull request's branch, meaning if work will be interrupted by any reason parts of solution will still be kept intact and safe in pull request.
131
132
  - When you test:
132
133
  start from testing of small functions using separate scripts;
package/src/hive.mjs CHANGED
@@ -108,6 +108,8 @@ if (isDirectExecution) {
108
108
  const { initializeSentry, withSentry, addBreadcrumb, reportError } = sentryLib;
109
109
  const graphqlLib = await import('./github.graphql.lib.mjs');
110
110
  const { tryFetchIssuesWithGraphQL } = graphqlLib;
111
+ const solutionDraftsLib = await import('./list-solution-drafts.lib.mjs');
112
+ const { listSolutionDrafts } = solutionDraftsLib;
111
113
  const commandName = process.argv[1] ? process.argv[1].split('/').pop() : '';
112
114
  const isLocalScript = commandName.endsWith('.mjs');
113
115
  const solveCommand = isLocalScript ? './solve.mjs' : 'solve';
@@ -196,9 +198,7 @@ if (isDirectExecution) {
196
198
  }
197
199
  // Add delay between repository requests
198
200
  await new Promise(resolve => setTimeout(resolve, 1000));
199
-
200
201
  const repoIssues = await fetchAllIssuesWithPagination(issueCmd);
201
-
202
202
  // Add repository information to each issue
203
203
  const issuesWithRepo = repoIssues.map(issue => ({
204
204
  ...issue,
@@ -207,10 +207,8 @@ if (isDirectExecution) {
207
207
  owner: { login: ownerName },
208
208
  },
209
209
  }));
210
-
211
210
  collectedIssues.push(...issuesWithRepo);
212
211
  processedRepos++;
213
-
214
212
  if (issuesWithRepo.length > 0) {
215
213
  await log(` ✅ Found ${issuesWithRepo.length} issues in ${ownerName}/${repoName}`, { verbose: true });
216
214
  }
@@ -1348,7 +1346,10 @@ if (isDirectExecution) {
1348
1346
  }
1349
1347
  Object.assign(stats, currentStats);
1350
1348
  }
1351
-
1349
+ // List completed issues with their solution draft PRs
1350
+ if (stats.completed > 0) {
1351
+ await listSolutionDrafts(issueQueue, log, batchCheckPullRequestsForIssues);
1352
+ }
1352
1353
  await log('\n✅ All issues processed!');
1353
1354
  await log(` Completed: ${stats.completed}`);
1354
1355
  await log(` Failed: ${stats.failed}`);
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Solution Drafts Listing Module
3
+ * Displays completed issues with their linked pull requests
4
+ */
5
+
6
+ /**
7
+ * Lists all completed issues with their solution drafts (PRs)
8
+ * @param {Object} issueQueue - The issue queue containing completed issues
9
+ * @param {Function} log - Logging function
10
+ * @param {Function} batchCheckPullRequestsForIssues - Function to batch check PRs for issues
11
+ */
12
+ export async function listSolutionDrafts(issueQueue, log, batchCheckPullRequestsForIssues) {
13
+ if (!issueQueue.completed || issueQueue.completed.length === 0) return;
14
+ await log('\n📋 Issues with solution drafts:');
15
+ const byRepo = {};
16
+ for (const url of issueQueue.completed) {
17
+ const m = url.match(/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/);
18
+ if (m) (byRepo[`${m[1]}/${m[2]}`] ||= { owner: m[1], repo: m[2], iss: [] }).iss.push({ n: +m[3], url });
19
+ }
20
+ for (const r of Object.values(byRepo)) {
21
+ const prs = await batchCheckPullRequestsForIssues(
22
+ r.owner,
23
+ r.repo,
24
+ r.iss.map(i => i.n)
25
+ );
26
+ for (const i of r.iss)
27
+ if (prs[i.n]?.linkedPRs?.length) {
28
+ await log(` - ${i.url}`);
29
+ for (const p of prs[i.n].linkedPRs) await log(` → PR #${p.number}: ${p.url}`);
30
+ } else await log(` - ${i.url} (no PR found)`);
31
+ }
32
+ }
@@ -119,6 +119,7 @@ Initial research.
119
119
 
120
120
  Solution development and testing.
121
121
  - When issue is solvable, implement code with tests.
122
+ - When implementing features, search for similar existing implementations in the codebase and use them as examples instead of implementing everything from scratch.
122
123
  - When coding, each atomic step that can be useful by itself should be commited to the pull request's branch, meaning if work will be interrupted by any reason parts of solution will still be kept intact and safe in pull request.
123
124
  - When you test:
124
125
  start from testing of small functions using separate scripts;
@@ -115,11 +115,16 @@ export async function createOrCheckoutBranch({ isContinueMode, prBranch, issueNu
115
115
  // Traditional mode: create new branch for issue
116
116
  const randomHex = crypto.randomBytes(6).toString('hex');
117
117
  branchName = `issue-${issueNumber}-${randomHex}`;
118
- await log(`\n${formatAligned('🌿', 'Creating branch:', `${branchName} from ${defaultBranch}`)}`);
118
+
119
+ // Use user-specified base branch if provided, otherwise use repository default
120
+ const baseBranch = argv.baseBranch || defaultBranch;
121
+ const branchSource = argv.baseBranch ? 'custom' : 'default';
122
+ await log(`\n${formatAligned('🌿', 'Creating branch:', `${branchName} from ${baseBranch} (${branchSource})`)}`);
119
123
 
120
124
  // IMPORTANT: Don't use 2>&1 here as it can interfere with exit codes
121
125
  // Git checkout -b outputs to stderr but that's normal
122
- checkoutResult = await $({ cwd: tempDir })`git checkout -b ${branchName}`;
126
+ // Create branch from the specified base branch (origin/baseBranch)
127
+ checkoutResult = await $({ cwd: tempDir })`git checkout -b ${branchName} origin/${baseBranch}`;
123
128
  }
124
129
 
125
130
  if (checkoutResult.code !== 0) {