@link-assistant/hive-mind 0.40.1 → 0.41.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,22 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 0.41.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5d193ef: Add `--prompt-general-purpose-sub-agent` flag for Claude tool to enable general-purpose sub-agent usage prompting when processing large tasks with multiple files or folders
8
+
9
+ ## 0.40.3
10
+
11
+ ### Patch Changes
12
+
13
+ - f8ebd99: Make Playwright MCP usage guidelines conditional based on MCP availability
14
+
15
+ - Add `checkPlaywrightMcpAvailability()` function to detect if Playwright MCP is installed
16
+ - Conditionally include Playwright MCP section in Claude system prompt only when MCP is detected
17
+ - Integration in both main execution (solve.mjs) and watch mode (solve.watch.lib.mjs)
18
+ - Resolves merge conflicts from main branch
19
+
3
20
  ## 0.40.1
4
21
 
5
22
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "0.40.1",
3
+ "version": "0.41.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",
@@ -360,6 +360,33 @@ export const handleClaudeRuntimeSwitch = async (argv) => {
360
360
  process.exit(0);
361
361
  }
362
362
  };
363
+ /**
364
+ * Check if Playwright MCP is available and connected to Claude
365
+ * @returns {Promise<boolean>} True if Playwright MCP is available, false otherwise
366
+ */
367
+ export const checkPlaywrightMcpAvailability = async () => {
368
+ try {
369
+ // Try to run a simple claude command that would list MCP servers if available
370
+ // Use a timeout to avoid hanging if Claude is not installed
371
+ const result = await $`timeout 5 claude mcp list 2>&1`.catch(() => null);
372
+
373
+ if (!result || result.code !== 0) {
374
+ return false;
375
+ }
376
+
377
+ const output = result.stdout?.toString() || '';
378
+
379
+ // Check if playwright is in the list of MCP servers
380
+ if (output.toLowerCase().includes('playwright')) {
381
+ return true;
382
+ }
383
+
384
+ return false;
385
+ } catch {
386
+ // If any error occurs, assume Playwright MCP is not available
387
+ return false;
388
+ }
389
+ };
363
390
  /**
364
391
  * Execute Claude with all prompts and settings
365
392
  * This is the main entry point that handles all prompt building and execution
@@ -144,7 +144,7 @@ Initial research.
144
144
  - When you are fixing a bug, please make sure you first find the actual root cause, do as many experiments as needed.
145
145
  - When you are fixing a bug and code does not have enough tracing/logs, add them and make sure they stay in the code, but are switched off by default.
146
146
  - When you need latest comments on pull request (sorted newest first), use appropriate GitHub API commands.
147
- - When you need latest comments on issue (sorted newest first), use appropriate GitHub API commands.
147
+ - When you need latest comments on issue (sorted newest first), use appropriate GitHub API commands.${argv && argv.promptGeneralPurposeSubAgent ? '\n - When the task is big and requires processing of lots of files or folders, you should use the `general-purpose` sub agents to delegate work. Each separate file or folder can be delegated to a sub agent for more efficient processing.' : ''}
148
148
 
149
149
  Solution development and testing.
150
150
  - When issue is solvable, implement code with tests.
@@ -193,7 +193,8 @@ Self review.
193
193
  - When you check your solution draft, run all tests locally.
194
194
  - When you check your solution draft, verify git status shows a clean working tree with no uncommitted changes.
195
195
  - When you compare with repo style, use gh pr diff [number].
196
- - When you finalize, confirm code, tests, and description are consistent.${argv && argv.promptPlanSubAgent ? '\n\nPlan sub-agent usage.\n - When you start working on a task, consider using the Plan sub-agent to research the codebase and create an implementation plan.\n - When using the Plan sub-agent, you can add it as the first item in your todo list.\n - When you delegate planning, use the Task tool with subagent_type="Plan" before starting implementation work.' : ''}`;
196
+ - When you finalize, confirm code, tests, and description are consistent.${argv && argv.promptPlaywrightMcp ? '\n\nPlaywright MCP usage (browser automation via mcp__playwright__* tools).\n - When you develop frontend web applications (HTML, CSS, JavaScript, React, Vue, Angular, etc.), use Playwright MCP tools to test the UI in a real browser.\n - When WebFetch tool fails to retrieve expected content (e.g., returns empty content, JavaScript-rendered pages, or login-protected pages), use Playwright MCP tools (browser_navigate, browser_snapshot) as a fallback for web browsing.\n - When you need to interact with dynamic web pages that require JavaScript execution, use Playwright MCP tools.\n - When you need to visually verify how a web page looks or take screenshots, use browser_take_screenshot from Playwright MCP.\n - When you need to fill forms, click buttons, or perform user interactions on web pages, use Playwright MCP tools (browser_click, browser_type, browser_fill_form).\n - When you need to test responsive design or different viewport sizes, use browser_resize from Playwright MCP.\n - When you finish using the browser, always close it with browser_close to free resources.' : ''}${argv && argv.promptPlanSubAgent ? '\n\nPlan sub-agent usage.\n - When you start working on a task, consider using the Plan sub-agent to research the codebase and create an implementation plan.\n - When using the Plan sub-agent, you can add it as the first item in your todo list.\n - When you delegate planning, use the Task tool with subagent_type="Plan" before starting implementation work.' : ''}`;
197
+
197
198
  };
198
199
 
199
200
  // Export all functions as default object too
@@ -246,6 +246,11 @@ export const createYargsConfig = (yargsInstance) => {
246
246
  description: 'Encourage Claude to use Explore sub-agent for codebase exploration. Only supported for --tool claude.',
247
247
  default: false
248
248
  })
249
+ .option('prompt-general-purpose-sub-agent', {
250
+ type: 'boolean',
251
+ description: 'Prompt AI to use general-purpose sub agents for processing large tasks with multiple files/folders. Only supported for --tool claude.',
252
+ default: false
253
+ })
249
254
  .parserConfiguration({
250
255
  'boolean-negation': true,
251
256
  'strip-dashed': false,
@@ -250,6 +250,11 @@ export const createYargsConfig = (yargsInstance) => {
250
250
  description: 'Encourage Claude to use Explore sub-agent for codebase exploration. Only supported for --tool claude.',
251
251
  default: false
252
252
  })
253
+ .option('prompt-general-purpose-sub-agent', {
254
+ type: 'boolean',
255
+ description: 'Prompt AI to use general-purpose sub agents for processing large tasks with multiple files/folders. Only supported for --tool claude.',
256
+ default: false
257
+ })
253
258
  .parserConfiguration({
254
259
  'boolean-negation': true
255
260
  })
package/src/solve.mjs CHANGED
@@ -815,6 +815,18 @@ try {
815
815
  });
816
816
  } else {
817
817
  // Default to Claude
818
+ // Check for Playwright MCP availability if using Claude tool
819
+ if (argv.tool === 'claude' || !argv.tool) {
820
+ const { checkPlaywrightMcpAvailability } = claudeLib;
821
+ const playwrightMcpAvailable = await checkPlaywrightMcpAvailability();
822
+ if (playwrightMcpAvailable) {
823
+ await log('🎭 Playwright MCP detected - enabling browser automation hints', { verbose: true });
824
+ argv.promptPlaywrightMcp = true;
825
+ } else {
826
+ await log('â„šī¸ Playwright MCP not detected - browser automation hints will be disabled', { verbose: true });
827
+ argv.promptPlaywrightMcp = false;
828
+ }
829
+ }
818
830
  const claudeResult = await executeClaude({
819
831
  issueUrl,
820
832
  issueNumber,
@@ -403,11 +403,23 @@ export const watchForFeedback = async (params) => {
403
403
  } else {
404
404
  // Use Claude (default)
405
405
  const claudeExecLib = await import('./claude.lib.mjs');
406
- const { executeClaude } = claudeExecLib;
406
+ const { executeClaude, checkPlaywrightMcpAvailability } = claudeExecLib;
407
407
 
408
408
  // Get claude path
409
409
  const claudePath = argv.claudePath || 'claude';
410
410
 
411
+ // Check for Playwright MCP availability if using Claude tool
412
+ if (argv.tool === 'claude' || !argv.tool) {
413
+ const playwrightMcpAvailable = await checkPlaywrightMcpAvailability();
414
+ if (playwrightMcpAvailable) {
415
+ await log('🎭 Playwright MCP detected - enabling browser automation hints', { verbose: true });
416
+ argv.promptPlaywrightMcp = true;
417
+ } else {
418
+ await log('â„šī¸ Playwright MCP not detected - browser automation hints will be disabled', { verbose: true });
419
+ argv.promptPlaywrightMcp = false;
420
+ }
421
+ }
422
+
411
423
  toolResult = await executeClaude({
412
424
  issueUrl,
413
425
  issueNumber,