@link-assistant/hive-mind 1.2.9 → 1.2.10

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,15 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 7ba1476: Auto-cleanup .playwright-mcp/ folder to prevent false auto-restart triggers
8
+ - Add auto-cleanup of .playwright-mcp/ folder before checking uncommitted changes
9
+ - Add --playwright-mcp-auto-cleanup option (enabled by default)
10
+ - Use --no-playwright-mcp-auto-cleanup to disable cleanup for debugging
11
+ - Add comprehensive case study documentation for issue #1124
12
+
3
13
  ## 1.2.9
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -311,6 +311,11 @@ export const createYargsConfig = yargsInstance => {
311
311
  description: 'Include prompt to check related/sibling pull requests when studying related work. Enabled by default, use --no-prompt-check-sibling-pull-requests to disable.',
312
312
  default: true,
313
313
  })
314
+ .option('playwright-mcp-auto-cleanup', {
315
+ type: 'boolean',
316
+ description: 'Automatically remove .playwright-mcp/ folder before checking for uncommitted changes. This prevents browser automation artifacts from triggering auto-restart. Use --no-playwright-mcp-auto-cleanup to keep the folder for debugging.',
317
+ default: true,
318
+ })
314
319
  .parserConfiguration({
315
320
  'boolean-negation': true,
316
321
  })
package/src/solve.mjs CHANGED
@@ -1116,6 +1116,27 @@ try {
1116
1116
  await safeExit(1, `${argv.tool.toUpperCase()} execution failed`);
1117
1117
  }
1118
1118
 
1119
+ // Clean up .playwright-mcp/ folder before checking for uncommitted changes
1120
+ // This prevents browser automation artifacts from triggering auto-restart (Issue #1124)
1121
+ if (argv.playwrightMcpAutoCleanup !== false) {
1122
+ const playwrightMcpDir = path.join(tempDir, '.playwright-mcp');
1123
+ try {
1124
+ const playwrightMcpExists = await fs
1125
+ .stat(playwrightMcpDir)
1126
+ .then(() => true)
1127
+ .catch(() => false);
1128
+ if (playwrightMcpExists) {
1129
+ await fs.rm(playwrightMcpDir, { recursive: true, force: true });
1130
+ await log('🧹 Cleaned up .playwright-mcp/ folder (browser automation artifacts)', { verbose: true });
1131
+ }
1132
+ } catch (cleanupError) {
1133
+ // Non-critical error, just log and continue
1134
+ await log(`⚠️ Could not clean up .playwright-mcp/ folder: ${cleanupError.message}`, { verbose: true });
1135
+ }
1136
+ } else {
1137
+ await log('ℹ️ Playwright MCP auto-cleanup disabled via --no-playwright-mcp-auto-cleanup', { verbose: true });
1138
+ }
1139
+
1119
1140
  // Check for uncommitted changes
1120
1141
  // When limit is reached, force auto-commit of any uncommitted changes to preserve work
1121
1142
  const shouldAutoCommit = argv['auto-commit-uncommitted-changes'] || limitReached;
@@ -15,6 +15,10 @@ const use = globalThis.use;
15
15
  // Use command-stream for consistent $ behavior across runtimes
16
16
  const { $ } = await use('command-stream');
17
17
 
18
+ // Import path and fs for cleanup operations
19
+ const path = (await use('path')).default;
20
+ const fs = (await use('fs')).promises;
21
+
18
22
  // Import shared library functions
19
23
  const lib = await import('./lib.mjs');
20
24
  const { log, cleanErrorMessage, formatAligned } = lib;
@@ -50,10 +54,36 @@ const checkPRMerged = async (owner, repo, prNumber) => {
50
54
  return false;
51
55
  };
52
56
 
57
+ /**
58
+ * Clean up .playwright-mcp/ folder to prevent browser automation artifacts
59
+ * from triggering auto-restart (Issue #1124)
60
+ */
61
+ const cleanupPlaywrightMcpFolder = async (tempDir, argv) => {
62
+ if (argv.playwrightMcpAutoCleanup !== false) {
63
+ const playwrightMcpDir = path.join(tempDir, '.playwright-mcp');
64
+ try {
65
+ const playwrightMcpExists = await fs
66
+ .stat(playwrightMcpDir)
67
+ .then(() => true)
68
+ .catch(() => false);
69
+ if (playwrightMcpExists) {
70
+ await fs.rm(playwrightMcpDir, { recursive: true, force: true });
71
+ await log('🧹 Cleaned up .playwright-mcp/ folder (browser automation artifacts)', { verbose: true });
72
+ }
73
+ } catch (cleanupError) {
74
+ // Non-critical error, just log and continue
75
+ await log(`⚠️ Could not clean up .playwright-mcp/ folder: ${cleanupError.message}`, { verbose: true });
76
+ }
77
+ }
78
+ };
79
+
53
80
  /**
54
81
  * Check if there are uncommitted changes in the repository
55
82
  */
56
- const checkForUncommittedChanges = async (tempDir, $) => {
83
+ const checkForUncommittedChanges = async (tempDir, $, argv = {}) => {
84
+ // First, clean up .playwright-mcp/ folder to prevent false positives (Issue #1124)
85
+ await cleanupPlaywrightMcpFolder(tempDir, argv);
86
+
57
87
  try {
58
88
  const gitStatusResult = await $({ cwd: tempDir })`git status --porcelain 2>&1`;
59
89
  if (gitStatusResult.code === 0) {
@@ -130,7 +160,7 @@ export const watchForFeedback = async params => {
130
160
 
131
161
  // In temporary watch mode, check if all changes have been committed
132
162
  if (isTemporaryWatch && !firstIterationInTemporaryMode) {
133
- const hasUncommitted = await checkForUncommittedChanges(tempDir, $);
163
+ const hasUncommitted = await checkForUncommittedChanges(tempDir, $, argv);
134
164
  if (!hasUncommitted) {
135
165
  await log('');
136
166
  await log(formatAligned('✅', 'CHANGES COMMITTED!', 'Exiting auto-restart mode'));
@@ -185,7 +215,7 @@ export const watchForFeedback = async params => {
185
215
  // In temporary watch mode, also check for uncommitted changes as a restart trigger
186
216
  let hasUncommittedInTempMode = false;
187
217
  if (isTemporaryWatch && !firstIterationInTemporaryMode) {
188
- hasUncommittedInTempMode = await checkForUncommittedChanges(tempDir, $);
218
+ hasUncommittedInTempMode = await checkForUncommittedChanges(tempDir, $, argv);
189
219
  }
190
220
 
191
221
  const shouldRestart = hasFeedback || firstIterationInTemporaryMode || hasUncommittedInTempMode;