@link-assistant/hive-mind 1.16.1 → 1.17.1

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,24 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0e59647: Fix /solve-queue command: register /solve_queue handler, fix hint text to use underscore instead of hyphen (Telegram Bot API only supports underscores in command names)
8
+
9
+ ## 1.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 52cef77: feat: automatic solve option forwarding from hive config (issue #1209)
14
+
15
+ Refactored hive-to-solve option forwarding to be fully automatic. New solve options are now
16
+ automatically available in hive and TELEGRAM_HIVE_OVERRIDES without manual code changes.
17
+ - Extracted `SOLVE_OPTION_DEFINITIONS` from solve.config.lib.mjs as a shared data structure
18
+ - hive.config.lib.mjs auto-registers all solve options (minus hive-only and solve-only exclusions)
19
+ - hive.mjs uses a generic forwarding loop instead of per-option if statements
20
+ - Added `getSolvePassthroughOptionNames()` export for programmatic access to passthrough list
21
+
3
22
  ## 1.16.1
4
23
 
5
24
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.16.1",
3
+ "version": "1.17.1",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "hive-telegram-bot": "./src/telegram-bot.mjs"
14
14
  },
15
15
  "scripts": {
16
- "test": "node tests/solve-queue.test.mjs && node tests/limits-display.test.mjs && node tests/test-usage-limit.mjs && node tests/test-telegram-message-filters.mjs",
16
+ "test": "node tests/solve-queue.test.mjs && node tests/limits-display.test.mjs && node tests/test-usage-limit.mjs && node tests/test-telegram-message-filters.mjs && node tests/test-solve-queue-command.mjs",
17
17
  "test:queue": "node tests/solve-queue.test.mjs",
18
18
  "test:limits-display": "node tests/limits-display.test.mjs",
19
19
  "test:usage-limit": "node tests/test-usage-limit.mjs",
@@ -3,8 +3,71 @@
3
3
  // when only the yargs configuration is needed (e.g., in telegram-bot.mjs)
4
4
  // This module has no heavy dependencies to allow fast loading for --help
5
5
 
6
+ import { SOLVE_OPTION_DEFINITIONS } from './solve.config.lib.mjs';
7
+
8
+ // Hive-only options that are NOT solve options (hive-specific functionality).
9
+ // These are excluded when auto-registering solve-passthrough options.
10
+ const HIVE_ONLY_OPTION_NAMES = new Set(['monitor-tag', 'all-issues', 'skip-issues-with-prs', 'concurrency', 'pull-requests-per-issue', 'interval', 'max-issues', 'once', 'project-number', 'project-owner', 'project-status', 'project-mode', 'youtrack-mode', 'youtrack-stage', 'youtrack-project', 'target-branch', 'issue-order']);
11
+
12
+ // Solve-only options that should NOT be registered in hive
13
+ // (they are internal to solve and not meaningful when passed from hive)
14
+ const SOLVE_ONLY_OPTION_NAMES = new Set(['resume', 'working-directory', 'only-prepare-command', 'session-type']);
15
+
16
+ // Options that hive defines with different defaults/descriptions than solve.
17
+ // These are registered manually in hive config to preserve hive-specific behavior.
18
+ // All other solve options are auto-registered from SOLVE_OPTION_DEFINITIONS.
19
+ const HIVE_CUSTOM_SOLVE_OPTIONS = {
20
+ model: {
21
+ type: 'string',
22
+ description: 'Model to use for solve (opus, sonnet, haiku, haiku-3-5, haiku-3, or any model ID supported by the tool)',
23
+ alias: 'm',
24
+ default: 'sonnet',
25
+ },
26
+ 'dry-run': {
27
+ type: 'boolean',
28
+ description: 'List issues that would be processed without actually processing them',
29
+ default: false,
30
+ },
31
+ 'auto-continue': {
32
+ type: 'boolean',
33
+ description: 'Pass --auto-continue to solve for each issue (continues with existing PRs instead of creating new ones)',
34
+ default: true,
35
+ },
36
+ 'auto-resume-on-limit-reset': {
37
+ type: 'boolean',
38
+ description: 'Automatically resume when AI tool limit resets (calculates reset time and waits). Passed to solve command.',
39
+ default: false,
40
+ },
41
+ 'auto-cleanup': {
42
+ type: 'boolean',
43
+ description: 'Automatically clean temporary directories (/tmp/* /var/tmp/*) when finished successfully',
44
+ default: false,
45
+ },
46
+ tool: {
47
+ type: 'string',
48
+ description: 'AI tool to use for solving issues',
49
+ choices: ['claude', 'opencode', 'agent'],
50
+ default: 'claude',
51
+ },
52
+ };
53
+
54
+ // Compute the set of solve options that hive auto-registers from SOLVE_OPTION_DEFINITIONS.
55
+ // This is exported so hive.mjs can use it for automatic argument forwarding.
56
+ // An option is auto-registered if it: (1) exists in solve, (2) is not hive-only,
57
+ // (3) is not solve-only, and (4) is not customized in hive.
58
+ export const getSolvePassthroughOptionNames = () => {
59
+ const names = [];
60
+ for (const name of Object.keys(SOLVE_OPTION_DEFINITIONS)) {
61
+ if (HIVE_ONLY_OPTION_NAMES.has(name)) continue;
62
+ if (SOLVE_ONLY_OPTION_NAMES.has(name)) continue;
63
+ // Include both custom and auto-registered options as passthrough
64
+ names.push(name);
65
+ }
66
+ return names;
67
+ };
68
+
6
69
  export const createYargsConfig = yargsInstance => {
7
- return yargsInstance
70
+ let config = yargsInstance
8
71
  .command('$0 [github-url]', 'Monitor GitHub issues and create PRs', yargs => {
9
72
  yargs.positional('github-url', {
10
73
  type: 'string',
@@ -27,7 +90,10 @@ export const createYargsConfig = yargsInstance => {
27
90
  error.cause = err;
28
91
  }
29
92
  throw error;
30
- })
93
+ });
94
+
95
+ // Register hive-only options
96
+ config = config
31
97
  .option('monitor-tag', {
32
98
  type: 'string',
33
99
  description: 'GitHub label to monitor for issues',
@@ -58,12 +124,6 @@ export const createYargsConfig = yargsInstance => {
58
124
  default: 1,
59
125
  alias: 'p',
60
126
  })
61
- .option('model', {
62
- type: 'string',
63
- description: 'Model to use for solve (opus, sonnet, haiku, haiku-3-5, haiku-3, or any model ID supported by the tool)',
64
- alias: 'm',
65
- default: 'sonnet',
66
- })
67
127
  .option('interval', {
68
128
  type: 'number',
69
129
  description: 'Polling interval in seconds',
@@ -75,83 +135,11 @@ export const createYargsConfig = yargsInstance => {
75
135
  description: 'Maximum number of issues to process (0 = unlimited)',
76
136
  default: 0,
77
137
  })
78
- .option('dry-run', {
79
- type: 'boolean',
80
- description: 'List issues that would be processed without actually processing them',
81
- default: false,
82
- })
83
- .option('skip-tool-connection-check', {
84
- type: 'boolean',
85
- description: 'Skip tool connection check (useful in CI environments). Does NOT skip model validation.',
86
- default: false,
87
- })
88
- .option('skip-tool-check', {
89
- type: 'boolean',
90
- description: 'Alias for --skip-tool-connection-check (deprecated, use --skip-tool-connection-check instead)',
91
- default: false,
92
- hidden: true,
93
- })
94
- .option('skip-claude-check', {
95
- type: 'boolean',
96
- description: 'Alias for --skip-tool-connection-check (deprecated)',
97
- default: false,
98
- hidden: true,
99
- })
100
- .option('tool-connection-check', {
101
- type: 'boolean',
102
- description: 'Perform tool connection check (enabled by default, use --no-tool-connection-check to skip). Does NOT affect model validation.',
103
- default: true,
104
- hidden: true,
105
- })
106
- .option('tool-check', {
107
- type: 'boolean',
108
- description: 'Alias for --tool-connection-check (deprecated)',
109
- default: true,
110
- hidden: true,
111
- })
112
- .option('tool', {
113
- type: 'string',
114
- description: 'AI tool to use for solving issues',
115
- choices: ['claude', 'opencode', 'agent'],
116
- default: 'claude',
117
- })
118
- .option('verbose', {
119
- type: 'boolean',
120
- description: 'Enable verbose logging',
121
- alias: 'v',
122
- default: false,
123
- })
124
138
  .option('once', {
125
139
  type: 'boolean',
126
140
  description: 'Run once and exit instead of continuous monitoring',
127
141
  default: false,
128
142
  })
129
- .option('min-disk-space', {
130
- type: 'number',
131
- description: 'Minimum required disk space in MB (default: 2048)',
132
- default: 2048,
133
- })
134
- .option('auto-cleanup', {
135
- type: 'boolean',
136
- description: 'Automatically clean temporary directories (/tmp/* /var/tmp/*) when finished successfully',
137
- default: false,
138
- })
139
- .option('fork', {
140
- type: 'boolean',
141
- description: "Fork the repository if you don't have write access",
142
- alias: 'f',
143
- default: false,
144
- })
145
- .option('auto-fork', {
146
- type: 'boolean',
147
- description: 'Automatically fork public repos without write access (passed to solve command)',
148
- default: true,
149
- })
150
- .option('attach-logs', {
151
- type: 'boolean',
152
- description: 'Upload the solution draft log file to the Pull Request on completion (⚠️ WARNING: May expose sensitive data)',
153
- default: false,
154
- })
155
143
  .option('project-number', {
156
144
  type: 'number',
157
145
  description: 'GitHub Project number to monitor',
@@ -192,135 +180,32 @@ export const createYargsConfig = yargsInstance => {
192
180
  description: 'Target branch for pull requests (defaults to repository default branch)',
193
181
  alias: 'tb',
194
182
  })
195
- .option('log-dir', {
196
- type: 'string',
197
- description: 'Directory to save log files (defaults to current working directory)',
198
- alias: 'l',
199
- })
200
- .option('auto-continue', {
201
- type: 'boolean',
202
- description: 'Pass --auto-continue to solve for each issue (continues with existing PRs instead of creating new ones)',
203
- default: true,
204
- })
205
- .option('auto-resume-on-limit-reset', {
206
- type: 'boolean',
207
- description: 'Automatically resume when AI tool limit resets (calculates reset time and waits). Passed to solve command.',
208
- default: false,
209
- })
210
- .option('think', {
211
- type: 'string',
212
- description: 'Thinking level for Claude. Translated to --thinking-budget for Claude Code >= 2.1.12 (off=0, low=~8000, medium=~16000, high=~24000, max=31999). For older versions, uses thinking keywords.',
213
- choices: ['off', 'low', 'medium', 'high', 'max'],
214
- default: undefined,
215
- })
216
- .option('thinking-budget', {
217
- type: 'number',
218
- description: 'Thinking token budget for Claude Code (0-63999). Controls MAX_THINKING_TOKENS. Default: 31999 (Claude default). Set to 0 to disable thinking.',
219
- default: undefined,
220
- })
221
- .option('max-thinking-budget', {
222
- type: 'number',
223
- description: 'Maximum thinking budget for calculating --think level mappings (default: 31999 for Claude Code). Values: off=0, low=max/4, medium=max/2, high=max*3/4, max=max.',
224
- default: 31999,
225
- })
226
- .option('prompt-plan-sub-agent', {
227
- type: 'boolean',
228
- description: 'Encourage AI to use Plan sub-agent for initial planning (only works with --tool claude)',
229
- default: false,
230
- })
231
- .option('sentry', {
232
- type: 'boolean',
233
- description: 'Enable Sentry error tracking and monitoring (use --no-sentry to disable)',
234
- default: true,
235
- })
236
- .option('watch', {
237
- type: 'boolean',
238
- description: 'Monitor continuously for feedback and auto-restart when detected (stops when PR is merged)',
239
- alias: 'w',
240
- default: false,
241
- })
242
- .option('auto-merge', {
243
- type: 'boolean',
244
- description: 'Automatically merge the pull request when the working session is finished and all CI/CD statuses pass and PR is mergeable. Implies --auto-restart-until-mergable.',
245
- default: false,
246
- })
247
- .option('auto-restart-until-mergable', {
248
- type: 'boolean',
249
- description: 'Auto-restart until PR becomes mergeable (no iteration limit). Restarts on new comments from non-bot users, CI failures, merge conflicts, or other issues. Does NOT auto-merge.',
250
- default: false,
251
- })
252
183
  .option('issue-order', {
253
184
  type: 'string',
254
185
  description: 'Order issues by publication date: "asc" (oldest first) or "desc" (newest first)',
255
186
  alias: 'o',
256
187
  default: 'asc',
257
188
  choices: ['asc', 'desc'],
258
- })
259
- .option('prefix-fork-name-with-owner-name', {
260
- type: 'boolean',
261
- description: 'Prefix fork name with original owner name (e.g., "owner-repo" instead of "repo"). Useful when forking repositories with same name from different owners.',
262
- default: true,
263
- })
264
- .option('interactive-mode', {
265
- type: 'boolean',
266
- description: '[EXPERIMENTAL] Post Claude output as PR comments in real-time. Only supported for --tool claude.',
267
- default: false,
268
- })
269
- .option('prompt-explore-sub-agent', {
270
- type: 'boolean',
271
- description: 'Encourage Claude to use Explore sub-agent for codebase exploration. Only supported for --tool claude.',
272
- default: false,
273
- })
274
- .option('prompt-general-purpose-sub-agent', {
275
- type: 'boolean',
276
- description: 'Prompt AI to use general-purpose sub agents for processing large tasks with multiple files/folders. Only supported for --tool claude.',
277
- default: false,
278
- })
279
- .option('tokens-budget-stats', {
280
- type: 'boolean',
281
- description: '[EXPERIMENTAL] Show detailed token budget statistics including context window usage and ratios. Only supported for --tool claude.',
282
- default: false,
283
- })
284
- .option('prompt-issue-reporting', {
285
- type: 'boolean',
286
- description: 'Enable automatic issue creation for spotted bugs/errors not related to main task. Issues will include reproducible examples, workarounds, and fix suggestions. Works for both current and third-party repositories. Only supported for --tool claude.',
287
- default: false,
288
- })
289
- .option('prompt-case-studies', {
290
- type: 'boolean',
291
- description: 'Create comprehensive case study documentation for the issue including logs, analysis, timeline, root cause investigation, and proposed solutions. Organizes findings into ./docs/case-studies/issue-{id}/ directory. Only supported for --tool claude.',
292
- default: false,
293
- })
294
- .option('prompt-playwright-mcp', {
295
- type: 'boolean',
296
- description: 'Enable Playwright MCP browser automation hints in system prompt (enabled by default, only takes effect if Playwright MCP is installed). Use --no-prompt-playwright-mcp to disable. Only supported for --tool claude.',
297
- default: true,
298
- })
299
- .option('prompt-check-sibling-pull-requests', {
300
- type: 'boolean',
301
- 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.',
302
- default: true,
303
- })
304
- .option('prompt-experiments-folder', {
305
- type: 'string',
306
- description: 'Path to experiments folder used in system prompt. Set to empty string to disable experiments folder prompt. Default: ./experiments',
307
- default: './experiments',
308
- })
309
- .option('prompt-examples-folder', {
310
- type: 'string',
311
- description: 'Path to examples folder used in system prompt. Set to empty string to disable examples folder prompt. Default: ./examples',
312
- default: './examples',
313
- })
314
- .option('prompt-architecture-care', {
315
- type: 'boolean',
316
- description: '[EXPERIMENTAL] Include guidance for managing REQUIREMENTS.md and ARCHITECTURE.md files. When enabled, agents will update these documentation files when changes affect requirements or architecture.',
317
- default: false,
318
- })
319
- .option('execute-tool-with-bun', {
320
- type: 'boolean',
321
- description: 'Execute the AI tool using bunx (experimental, may improve speed and memory usage) - passed to solve command',
322
- default: false,
323
- })
189
+ });
190
+
191
+ // Register options with hive-specific customizations (different defaults/descriptions than solve)
192
+ for (const [name, def] of Object.entries(HIVE_CUSTOM_SOLVE_OPTIONS)) {
193
+ config = config.option(name, def);
194
+ }
195
+
196
+ // Auto-register all remaining solve options as passthrough options.
197
+ // This ensures any new option added to solve.config.lib.mjs is automatically
198
+ // available in hive (and TELEGRAM_HIVE_OVERRIDES) without manual code changes.
199
+ // See: https://github.com/link-assistant/hive-mind/issues/1209
200
+ for (const [name, def] of Object.entries(SOLVE_OPTION_DEFINITIONS)) {
201
+ // Skip options that are hive-only, solve-only, or already registered with custom hive config
202
+ if (HIVE_ONLY_OPTION_NAMES.has(name)) continue;
203
+ if (SOLVE_ONLY_OPTION_NAMES.has(name)) continue;
204
+ if (name in HIVE_CUSTOM_SOLVE_OPTIONS) continue;
205
+ config = config.option(name, def);
206
+ }
207
+
208
+ config = config
324
209
  .parserConfiguration({
325
210
  'boolean-negation': true,
326
211
  'strip-dashed': false,
@@ -331,4 +216,6 @@ export const createYargsConfig = yargsInstance => {
331
216
  .strict()
332
217
  .help('h')
333
218
  .alias('h', 'help');
219
+
220
+ return config;
334
221
  };
package/src/hive.mjs CHANGED
@@ -745,36 +745,41 @@ if (isDirectExecution) {
745
745
  const startTime = Date.now();
746
746
  // Use spawn to get real-time streaming output while avoiding command-stream's automatic quote addition
747
747
  const { spawn } = await import('child_process');
748
- // Build arguments array to avoid shell parsing issues
748
+ // Auto-forward all solve-passthrough options from hive argv to solve.
749
+ // New options added to SOLVE_OPTION_DEFINITIONS are automatically forwarded.
750
+ // See: https://github.com/link-assistant/hive-mind/issues/1209
751
+ const { getSolvePassthroughOptionNames } = await import('./hive.config.lib.mjs');
752
+ const { SOLVE_OPTION_DEFINITIONS } = await import('./solve.config.lib.mjs');
753
+ const kebabToCamel = str => str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
749
754
  const args = [issueUrl, '--model', argv.model];
750
- if (argv.tool) args.push('--tool', argv.tool);
751
- if (argv.fork) args.push('--fork');
752
- if (argv.autoFork) args.push('--auto-fork');
753
- if (argv.verbose) args.push('--verbose');
754
- if (argv.attachLogs) args.push('--attach-logs');
755
- if (argv.targetBranch) args.push('--target-branch', argv.targetBranch);
756
- if (argv.logDir) args.push('--log-dir', argv.logDir);
757
- if (argv.dryRun) args.push('--dry-run');
755
+ // Special handling for options with different semantics in hive vs solve
756
+ if (argv.baseBranch) args.push('--base-branch', argv.baseBranch);
757
+ else if (argv.targetBranch) args.push('--base-branch', argv.targetBranch);
758
758
  if (argv.skipToolConnectionCheck || argv.toolConnectionCheck === false) args.push('--skip-tool-connection-check');
759
- args.push(argv.autoContinue ? '--auto-continue' : '--no-auto-continue');
760
- if (argv.autoResumeOnLimitReset) args.push('--auto-resume-on-limit-reset');
761
- if (argv.think) args.push('--think', argv.think);
762
- if (argv.thinkingBudget !== undefined) args.push('--thinking-budget', argv.thinkingBudget);
763
- if (argv.maxThinkingBudget !== undefined && argv.maxThinkingBudget !== 31999) args.push('--max-thinking-budget', argv.maxThinkingBudget);
764
- if (argv.promptPlanSubAgent) args.push('--prompt-plan-sub-agent');
765
- if (!argv.sentry) args.push('--no-sentry');
766
- if (argv.watch) args.push('--watch');
767
- if (argv.prefixForkNameWithOwnerName) args.push('--prefix-fork-name-with-owner-name');
768
- if (argv.interactiveMode) args.push('--interactive-mode');
769
- if (argv.promptExploreSubAgent) args.push('--prompt-explore-sub-agent');
770
- if (argv.promptIssueReporting) args.push('--prompt-issue-reporting');
771
- if (argv.promptCaseStudies) args.push('--prompt-case-studies');
772
- if (argv.promptPlaywrightMcp !== undefined) args.push(argv.promptPlaywrightMcp ? '--prompt-playwright-mcp' : '--no-prompt-playwright-mcp');
773
- if (argv.promptExperimentsFolder !== undefined) args.push('--prompt-experiments-folder', argv.promptExperimentsFolder);
774
- if (argv.promptExamplesFolder !== undefined) args.push('--prompt-examples-folder', argv.promptExamplesFolder);
775
- if (argv.executeToolWithBun) args.push('--execute-tool-with-bun');
776
- if (argv.autoMerge) args.push('--auto-merge');
777
- if (argv.autoRestartUntilMergable) args.push('--auto-restart-until-mergable');
759
+ if (argv.dryRun) args.push('--dry-run');
760
+ if (argv.autoCleanup) args.push('--auto-cleanup'); // hive default differs from solve's auto-detect default
761
+
762
+ // Options already handled above or deprecated aliases (skip in generic loop)
763
+ const SKIP_AUTO_FORWARD = new Set(['model', 'base-branch', 'skip-tool-connection-check', 'tool-connection-check', 'skip-tool-check', 'skip-claude-check', 'tool-check', 'dry-run', 'auto-cleanup']);
764
+
765
+ for (const optionName of getSolvePassthroughOptionNames()) {
766
+ if (SKIP_AUTO_FORWARD.has(optionName)) continue;
767
+ const camelName = kebabToCamel(optionName);
768
+ const value = argv[camelName];
769
+ const def = SOLVE_OPTION_DEFINITIONS[optionName];
770
+ if (!def) continue;
771
+ if (def.type === 'boolean') {
772
+ if (value === undefined) continue;
773
+ // For booleans with default true or undefined, forward both --flag and --no-flag
774
+ if (def.default === true || def.default === undefined) {
775
+ args.push(value ? `--${optionName}` : `--no-${optionName}`);
776
+ } else if (value) {
777
+ args.push(`--${optionName}`); // Default false: only forward when truthy
778
+ }
779
+ } else if ((def.type === 'string' || def.type === 'number') && value !== undefined) {
780
+ args.push(`--${optionName}`, String(value));
781
+ }
782
+ }
778
783
  // Log the actual command being executed so users can investigate/reproduce
779
784
  await log(` 📋 Command: ${solveCommand} ${args.join(' ')}`);
780
785
 
@@ -203,6 +203,18 @@ const KNOWN_OPTION_NAMES = [
203
203
  'prefix-fork-name-with-owner-name',
204
204
  'auto-restart-max-iterations',
205
205
  'auto-continue-only-on-new-comments',
206
+ 'auto-restart-on-limit-reset',
207
+ 'auto-restart-on-non-updated-pull-request-description',
208
+ 'auto-restart-until-mergable',
209
+ 'auto-merge',
210
+ 'auto-gitkeep-file',
211
+ 'playwright-mcp-auto-cleanup',
212
+ 'auto-gh-configuration-repair',
213
+ 'prompt-subagents-via-agent-commander',
214
+ 'prompt-experiments-folder',
215
+ 'prompt-examples-folder',
216
+ 'session-type',
217
+ 'working-directory',
206
218
  ];
207
219
 
208
220
  /**