@link-assistant/hive-mind 1.2.11 → 1.3.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,13 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a403c0e: Add --auto-gitkeep-file option to automatically fallback to .gitkeep when CLAUDE.md is in .gitignore
8
+
9
+ This feature pre-checks if CLAUDE.md would be ignored by .gitignore BEFORE creating the file, preventing the "paths are ignored by one of your .gitignore files" error. When detected, automatically switches to .gitkeep mode. Enabled by default (--auto-gitkeep-file=true).
10
+
3
11
  ## 1.2.11
4
12
 
5
13
  ### Patch Changes
@@ -952,7 +960,7 @@
952
960
 
953
961
  This feature allows users to choose which file type to use for PR creation:
954
962
  - `--claude-file` (default: true): Use CLAUDE.md file for task details
955
- - `--gitkeep-file` (default: false, experimental): Use .gitkeep file instead
963
+ - `--gitkeep-file` (default: false): Use .gitkeep file instead
956
964
 
957
965
  The flags are mutually exclusive:
958
966
  - Using `--gitkeep-file` automatically disables `--claude-file`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.2.11",
3
+ "version": "1.3.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",
@@ -31,12 +31,20 @@ export async function handleAutoPrCreation({ argv, tempDir, branchName, issueNum
31
31
 
32
32
  try {
33
33
  // Determine which file to create based on CLI flags
34
- const useClaudeFile = argv.claudeFile !== false; // Default to true
35
- const useGitkeepFile = argv.gitkeepFile === true; // Default to false
34
+ let useClaudeFile = argv.claudeFile !== false;
35
+ const useAutoGitkeepFile = argv.autoGitkeepFile !== false;
36
+
37
+ // Pre-check: If CLAUDE.md would be ignored by .gitignore, automatically switch to .gitkeep mode
38
+ if (useClaudeFile && useAutoGitkeepFile) {
39
+ const checkResult = await $({ cwd: tempDir, silent: true })`git check-ignore CLAUDE.md 2>/dev/null`;
40
+ if (checkResult.code === 0) {
41
+ await log(formatAligned('ℹ️', 'Pre-check:', 'CLAUDE.md is in .gitignore, switching to .gitkeep mode\n'));
42
+ useClaudeFile = false;
43
+ }
44
+ }
36
45
 
37
- // Log which mode we're using
38
46
  if (argv.verbose) {
39
- await log(` Using ${useClaudeFile ? 'CLAUDE.md' : '.gitkeep'} mode (--claude-file=${useClaudeFile}, --gitkeep-file=${useGitkeepFile})`, { verbose: true });
47
+ await log(` Using ${useClaudeFile ? 'CLAUDE.md' : '.gitkeep'} mode (--claude-file=${argv.claudeFile !== false}, --gitkeep-file=${argv.gitkeepFile === true}, --auto-gitkeep-file=${useAutoGitkeepFile})`, { verbose: true });
40
48
  }
41
49
 
42
50
  let filePath;
@@ -62,14 +70,13 @@ export async function handleAutoPrCreation({ argv, tempDir, branchName, issueNum
62
70
  }
63
71
  }
64
72
  } else {
65
- // Create .gitkeep file directly (experimental mode)
66
- await log(formatAligned('📝', 'Creating:', '.gitkeep (experimental mode)'));
73
+ // .gitkeep mode (via explicit --gitkeep-file or auto-gitkeep-file fallback)
74
+ const modeDesc = argv.gitkeepFile === true ? '.gitkeep (explicit --gitkeep-file)' : '.gitkeep (CLAUDE.md is ignored)';
75
+ await log(formatAligned('📝', 'Creating:', modeDesc));
67
76
 
68
77
  filePath = path.join(tempDir, '.gitkeep');
69
78
  fileName = '.gitkeep';
70
-
71
- // .gitkeep files are typically small, no need to check for existing content
72
- // But we'll check if it exists for proper handling
79
+ // Check if .gitkeep already exists for proper handling
73
80
  try {
74
81
  existingContent = await fs.readFile(filePath, 'utf8');
75
82
  fileExisted = true;
@@ -125,12 +132,13 @@ Proceed.
125
132
  finalContent = taskInfo;
126
133
  }
127
134
  } else {
128
- // .gitkeep: Use minimal metadata format
135
+ // .gitkeep: Use minimal metadata format (explicit --gitkeep-file or auto-gitkeep-file fallback)
136
+ const creationReason = argv.gitkeepFile === true ? '# This file was created with --gitkeep-file flag' : '# This file was created because CLAUDE.md is in .gitignore (--auto-gitkeep-file=true)';
129
137
  const gitkeepContent = `# Auto-generated file for PR creation
130
138
  # Issue: ${issueUrl}
131
139
  # Branch: ${branchName}
132
140
  # Timestamp: ${timestamp}
133
- # This file was created with --gitkeep-file flag (experimental)
141
+ ${creationReason}
134
142
  # It will be removed when the task is complete`;
135
143
 
136
144
  if (fileExisted && existingContent) {
@@ -289,9 +297,8 @@ Proceed.
289
297
  }
290
298
 
291
299
  await log(formatAligned('📝', 'Creating commit:', `With ${commitFileName} file`));
292
-
293
- // Determine commit message based on which file is being committed
294
- const fileDesc = commitFileName === 'CLAUDE.md' ? 'CLAUDE.md with task information for AI processing' : `.gitkeep for PR creation (${useGitkeepFile ? 'created with --gitkeep-file flag (experimental)' : 'CLAUDE.md is in .gitignore'})`;
300
+ // Commit message distinguishes between explicit --gitkeep-file and auto-gitkeep-file fallback
301
+ const fileDesc = commitFileName === 'CLAUDE.md' ? 'CLAUDE.md with task information for AI processing' : `.gitkeep for PR creation (${argv.gitkeepFile === true ? 'created with --gitkeep-file flag' : 'CLAUDE.md is in .gitignore'})`;
295
302
  const commitMessage = `Initial commit with task details\n\nAdding ${fileDesc}.\nThis file will be removed when the task is complete.\n\nIssue: ${issueUrl}`;
296
303
 
297
304
  // Use explicit cwd option for better reliability
@@ -130,9 +130,14 @@ export const createYargsConfig = yargsInstance => {
130
130
  })
131
131
  .option('gitkeep-file', {
132
132
  type: 'boolean',
133
- description: 'Create .gitkeep file instead of CLAUDE.md (experimental, mutually exclusive with --claude-file)',
133
+ description: 'Create .gitkeep file instead of CLAUDE.md (mutually exclusive with --claude-file)',
134
134
  default: false,
135
135
  })
136
+ .option('auto-gitkeep-file', {
137
+ type: 'boolean',
138
+ description: 'Automatically use .gitkeep if CLAUDE.md is in .gitignore (pre-checks before creating file)',
139
+ default: true,
140
+ })
136
141
  .option('attach-logs', {
137
142
  type: 'boolean',
138
143
  description: 'Upload the solution draft log file to the Pull Request on completion (⚠️ WARNING: May expose sensitive data)',