@link-assistant/hive-mind 1.16.0 → 1.17.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 +19 -0
- package/package.json +1 -1
- package/src/hive.config.lib.mjs +90 -203
- package/src/hive.mjs +33 -28
- package/src/option-suggestions.lib.mjs +12 -0
- package/src/solve.branch.lib.mjs +2 -1
- package/src/solve.config.lib.mjs +389 -372
- package/src/solve.repository.lib.mjs +77 -8
package/src/solve.config.lib.mjs
CHANGED
|
@@ -22,381 +22,398 @@ export const initializeConfig = async use => {
|
|
|
22
22
|
return { yargs, hideBin };
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
// Solve option definitions as a plain data structure.
|
|
26
|
+
// This is the single source of truth for all solve command options.
|
|
27
|
+
// Exported so hive.config.lib.mjs can automatically register solve options
|
|
28
|
+
// without manual duplication (see issue #1209).
|
|
29
|
+
// NOTE: Options with function defaults (like 'model') are defined inline in createYargsConfig
|
|
30
|
+
// and excluded from this map since functions cannot be cleanly shared as data.
|
|
31
|
+
export const SOLVE_OPTION_DEFINITIONS = {
|
|
32
|
+
resume: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Resume from a previous session ID (when limit was reached)',
|
|
35
|
+
alias: 'r',
|
|
36
|
+
},
|
|
37
|
+
'working-directory': {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'Use specified working directory instead of creating a new temp directory. If directory does not exist, it will be created and the repository will be cloned. Essential for --resume to work correctly with Claude Code sessions.',
|
|
40
|
+
alias: 'd',
|
|
41
|
+
},
|
|
42
|
+
'only-prepare-command': {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
description: 'Only prepare and print the claude command without executing it',
|
|
45
|
+
},
|
|
46
|
+
'dry-run': {
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
description: 'Prepare everything but do not execute Claude (alias for --only-prepare-command)',
|
|
49
|
+
alias: 'n',
|
|
50
|
+
},
|
|
51
|
+
'skip-tool-connection-check': {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
description: 'Skip tool connection check (useful in CI environments). Does NOT skip model validation.',
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
'skip-tool-check': {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
description: 'Alias for --skip-tool-connection-check (deprecated, use --skip-tool-connection-check instead)',
|
|
59
|
+
default: false,
|
|
60
|
+
hidden: true,
|
|
61
|
+
},
|
|
62
|
+
'skip-claude-check': {
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
description: 'Alias for --skip-tool-connection-check (deprecated)',
|
|
65
|
+
default: false,
|
|
66
|
+
hidden: true,
|
|
67
|
+
},
|
|
68
|
+
'tool-connection-check': {
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
description: 'Perform tool connection check (enabled by default, use --no-tool-connection-check to skip). Does NOT affect model validation.',
|
|
71
|
+
default: true,
|
|
72
|
+
hidden: true,
|
|
73
|
+
},
|
|
74
|
+
'tool-check': {
|
|
75
|
+
type: 'boolean',
|
|
76
|
+
description: 'Alias for --tool-connection-check (deprecated)',
|
|
77
|
+
default: true,
|
|
78
|
+
hidden: true,
|
|
79
|
+
},
|
|
80
|
+
'auto-pull-request-creation': {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
description: 'Automatically create a draft pull request before running Claude',
|
|
83
|
+
default: true,
|
|
84
|
+
},
|
|
85
|
+
verbose: {
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
description: 'Enable verbose logging for debugging',
|
|
88
|
+
alias: 'v',
|
|
89
|
+
default: false,
|
|
90
|
+
},
|
|
91
|
+
fork: {
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
description: "Fork the repository if you don't have write access",
|
|
94
|
+
alias: 'f',
|
|
95
|
+
default: false,
|
|
96
|
+
},
|
|
97
|
+
'auto-fork': {
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
description: 'Automatically fork public repositories without write access (fails for private repos)',
|
|
100
|
+
default: true,
|
|
101
|
+
},
|
|
102
|
+
'claude-file': {
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
description: 'Create CLAUDE.md file for task details (default for --tool claude, mutually exclusive with --gitkeep-file)',
|
|
105
|
+
default: true,
|
|
106
|
+
},
|
|
107
|
+
'gitkeep-file': {
|
|
108
|
+
type: 'boolean',
|
|
109
|
+
description: 'Create .gitkeep file instead of CLAUDE.md (default for --tool agent/opencode/codex, mutually exclusive with --claude-file)',
|
|
110
|
+
default: false,
|
|
111
|
+
},
|
|
112
|
+
'auto-gitkeep-file': {
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
description: 'Automatically use .gitkeep if CLAUDE.md is in .gitignore (pre-checks before creating file)',
|
|
115
|
+
default: true,
|
|
116
|
+
},
|
|
117
|
+
'attach-logs': {
|
|
118
|
+
type: 'boolean',
|
|
119
|
+
description: 'Upload the solution draft log file to the Pull Request on completion (⚠️ WARNING: May expose sensitive data)',
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
'auto-close-pull-request-on-fail': {
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
description: 'Automatically close the pull request if execution fails',
|
|
125
|
+
default: false,
|
|
126
|
+
},
|
|
127
|
+
'auto-continue': {
|
|
128
|
+
type: 'boolean',
|
|
129
|
+
description: 'Continue with existing PR when issue URL is provided (instead of creating new PR)',
|
|
130
|
+
default: true,
|
|
131
|
+
},
|
|
132
|
+
'auto-resume-on-limit-reset': {
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
description: 'Automatically resume when AI tool limit resets (maintains session context with --resume flag)',
|
|
135
|
+
default: false,
|
|
136
|
+
},
|
|
137
|
+
'auto-restart-on-limit-reset': {
|
|
138
|
+
type: 'boolean',
|
|
139
|
+
description: 'Automatically restart when AI tool limit resets (fresh start without --resume flag)',
|
|
140
|
+
default: false,
|
|
141
|
+
},
|
|
142
|
+
'session-type': {
|
|
143
|
+
type: 'string',
|
|
144
|
+
description: 'Internal: Session type for comment differentiation (new, resume, auto-resume, auto-restart)',
|
|
145
|
+
choices: ['new', 'resume', 'auto-resume', 'auto-restart'],
|
|
146
|
+
default: 'new',
|
|
147
|
+
hidden: true,
|
|
148
|
+
},
|
|
149
|
+
'auto-resume-on-errors': {
|
|
150
|
+
type: 'boolean',
|
|
151
|
+
description: 'Automatically resume on network errors (503, etc.) with exponential backoff',
|
|
152
|
+
default: false,
|
|
153
|
+
},
|
|
154
|
+
'auto-continue-only-on-new-comments': {
|
|
155
|
+
type: 'boolean',
|
|
156
|
+
description: 'Explicitly fail on absence of new comments in auto-continue or continue mode',
|
|
157
|
+
default: false,
|
|
158
|
+
},
|
|
159
|
+
'auto-commit-uncommitted-changes': {
|
|
160
|
+
type: 'boolean',
|
|
161
|
+
description: 'Automatically commit and push uncommitted changes made by Claude (disabled by default)',
|
|
162
|
+
default: false,
|
|
163
|
+
},
|
|
164
|
+
'auto-restart-on-uncommitted-changes': {
|
|
165
|
+
type: 'boolean',
|
|
166
|
+
description: 'Automatically restart when uncommitted changes are detected to allow the tool to handle them (default: true, use --no-auto-restart-on-uncommitted-changes to disable)',
|
|
167
|
+
default: true,
|
|
168
|
+
},
|
|
169
|
+
'auto-restart-max-iterations': {
|
|
170
|
+
type: 'number',
|
|
171
|
+
description: 'Maximum number of auto-restart iterations when uncommitted changes are detected (default: 3)',
|
|
172
|
+
default: 3,
|
|
173
|
+
},
|
|
174
|
+
'auto-merge': {
|
|
175
|
+
type: 'boolean',
|
|
176
|
+
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.',
|
|
177
|
+
default: false,
|
|
178
|
+
},
|
|
179
|
+
'auto-restart-until-mergable': {
|
|
180
|
+
type: 'boolean',
|
|
181
|
+
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.',
|
|
182
|
+
default: false,
|
|
183
|
+
},
|
|
184
|
+
'auto-restart-on-non-updated-pull-request-description': {
|
|
185
|
+
type: 'boolean',
|
|
186
|
+
description: 'Automatically restart if PR title or description still contains auto-generated placeholder text after agent execution. Restarts with a hint about what was not updated.',
|
|
187
|
+
default: false,
|
|
188
|
+
},
|
|
189
|
+
'continue-only-on-feedback': {
|
|
190
|
+
type: 'boolean',
|
|
191
|
+
description: 'Only continue if feedback is detected (works only with pull request link or issue link with --auto-continue)',
|
|
192
|
+
default: false,
|
|
193
|
+
},
|
|
194
|
+
watch: {
|
|
195
|
+
type: 'boolean',
|
|
196
|
+
description: 'Monitor continuously for feedback and auto-restart when detected (stops when PR is merged)',
|
|
197
|
+
alias: 'w',
|
|
198
|
+
default: false,
|
|
199
|
+
},
|
|
200
|
+
'watch-interval': {
|
|
201
|
+
type: 'number',
|
|
202
|
+
description: 'Interval in seconds for checking feedback in watch mode (default: 60)',
|
|
203
|
+
default: 60,
|
|
204
|
+
},
|
|
205
|
+
'min-disk-space': {
|
|
206
|
+
type: 'number',
|
|
207
|
+
description: 'Minimum required disk space in MB (default: 2048)',
|
|
208
|
+
default: 2048,
|
|
209
|
+
},
|
|
210
|
+
'log-dir': {
|
|
211
|
+
type: 'string',
|
|
212
|
+
description: 'Directory to save log files (defaults to current working directory)',
|
|
213
|
+
alias: 'l',
|
|
214
|
+
},
|
|
215
|
+
think: {
|
|
216
|
+
type: 'string',
|
|
217
|
+
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.',
|
|
218
|
+
choices: ['off', 'low', 'medium', 'high', 'max'],
|
|
219
|
+
default: undefined,
|
|
220
|
+
},
|
|
221
|
+
'thinking-budget': {
|
|
222
|
+
type: 'number',
|
|
223
|
+
description: 'Thinking token budget for Claude Code (0-63999). Controls MAX_THINKING_TOKENS. Default: 31999 (Claude default). Set to 0 to disable thinking. For older Claude Code versions, translated back to --think level.',
|
|
224
|
+
default: undefined,
|
|
225
|
+
},
|
|
226
|
+
'thinking-budget-claude-minimum-version': {
|
|
227
|
+
type: 'string',
|
|
228
|
+
description: 'Minimum Claude Code version that supports --thinking-budget (MAX_THINKING_TOKENS env var). Versions below this use thinking keywords instead.',
|
|
229
|
+
default: '2.1.12',
|
|
230
|
+
},
|
|
231
|
+
'max-thinking-budget': {
|
|
232
|
+
type: 'number',
|
|
233
|
+
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.',
|
|
234
|
+
default: 31999,
|
|
235
|
+
},
|
|
236
|
+
'prompt-plan-sub-agent': {
|
|
237
|
+
type: 'boolean',
|
|
238
|
+
description: 'Encourage AI to use Plan sub-agent for initial planning (only works with --tool claude)',
|
|
239
|
+
default: false,
|
|
240
|
+
},
|
|
241
|
+
'base-branch': {
|
|
242
|
+
type: 'string',
|
|
243
|
+
description: 'Target branch for the pull request (defaults to repository default branch)',
|
|
244
|
+
alias: 'b',
|
|
245
|
+
},
|
|
246
|
+
sentry: {
|
|
247
|
+
type: 'boolean',
|
|
248
|
+
description: 'Enable Sentry error tracking and monitoring (use --no-sentry to disable)',
|
|
249
|
+
default: true,
|
|
250
|
+
},
|
|
251
|
+
'auto-cleanup': {
|
|
252
|
+
type: 'boolean',
|
|
253
|
+
description: 'Automatically delete temporary working directory on completion (error, success, or CTRL+C). Default: true for private repos, false for public repos. Use explicit flag to override.',
|
|
254
|
+
default: undefined,
|
|
255
|
+
},
|
|
256
|
+
'auto-merge-default-branch-to-pull-request-branch': {
|
|
257
|
+
type: 'boolean',
|
|
258
|
+
description: 'Automatically merge the default branch to the pull request branch when continuing work (only in continue mode)',
|
|
259
|
+
default: false,
|
|
260
|
+
},
|
|
261
|
+
'allow-fork-divergence-resolution-using-force-push-with-lease': {
|
|
262
|
+
type: 'boolean',
|
|
263
|
+
description: 'Allow automatic force-push (--force-with-lease) when fork diverges from upstream (DANGEROUS: can overwrite fork history)',
|
|
264
|
+
default: false,
|
|
265
|
+
},
|
|
266
|
+
'allow-to-push-to-contributors-pull-requests-as-maintainer': {
|
|
267
|
+
type: 'boolean',
|
|
268
|
+
description: 'When continuing a fork PR as a maintainer, attempt to push directly to the contributor\'s fork if "Allow edits by maintainers" is enabled. Requires --auto-fork to be enabled.',
|
|
269
|
+
default: false,
|
|
270
|
+
},
|
|
271
|
+
'prefix-fork-name-with-owner-name': {
|
|
272
|
+
type: 'boolean',
|
|
273
|
+
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.',
|
|
274
|
+
default: true,
|
|
275
|
+
},
|
|
276
|
+
tool: {
|
|
277
|
+
type: 'string',
|
|
278
|
+
description: 'AI tool to use for solving issues',
|
|
279
|
+
choices: ['claude', 'opencode', 'codex', 'agent'],
|
|
280
|
+
default: 'claude',
|
|
281
|
+
},
|
|
282
|
+
'execute-tool-with-bun': {
|
|
283
|
+
type: 'boolean',
|
|
284
|
+
description: 'Execute the AI tool using bunx (experimental, may improve speed and memory usage)',
|
|
285
|
+
default: false,
|
|
286
|
+
},
|
|
287
|
+
'enable-workspaces': {
|
|
288
|
+
type: 'boolean',
|
|
289
|
+
description: 'Use separate workspace directory structure with repository/ and tmp/ folders. Works with all tools (claude, opencode, codex, agent). Experimental feature.',
|
|
290
|
+
default: false,
|
|
291
|
+
},
|
|
292
|
+
'interactive-mode': {
|
|
293
|
+
type: 'boolean',
|
|
294
|
+
description: '[EXPERIMENTAL] Post Claude output as PR comments in real-time. Only supported for --tool claude.',
|
|
295
|
+
default: false,
|
|
296
|
+
},
|
|
297
|
+
'prompt-explore-sub-agent': {
|
|
298
|
+
type: 'boolean',
|
|
299
|
+
description: 'Encourage Claude to use Explore sub-agent for codebase exploration. Only supported for --tool claude.',
|
|
300
|
+
default: false,
|
|
301
|
+
},
|
|
302
|
+
'prompt-general-purpose-sub-agent': {
|
|
303
|
+
type: 'boolean',
|
|
304
|
+
description: 'Prompt AI to use general-purpose sub agents for processing large tasks with multiple files/folders. Only supported for --tool claude.',
|
|
305
|
+
default: false,
|
|
306
|
+
},
|
|
307
|
+
'tokens-budget-stats': {
|
|
308
|
+
type: 'boolean',
|
|
309
|
+
description: '[EXPERIMENTAL] Show detailed token budget statistics including context window usage and ratios. Only supported for --tool claude.',
|
|
310
|
+
default: false,
|
|
311
|
+
},
|
|
312
|
+
'prompt-issue-reporting': {
|
|
313
|
+
type: 'boolean',
|
|
314
|
+
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.',
|
|
315
|
+
default: false,
|
|
316
|
+
},
|
|
317
|
+
'prompt-architecture-care': {
|
|
318
|
+
type: 'boolean',
|
|
319
|
+
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.',
|
|
320
|
+
default: false,
|
|
321
|
+
},
|
|
322
|
+
'prompt-case-studies': {
|
|
323
|
+
type: 'boolean',
|
|
324
|
+
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.',
|
|
325
|
+
default: false,
|
|
326
|
+
},
|
|
327
|
+
'prompt-playwright-mcp': {
|
|
328
|
+
type: 'boolean',
|
|
329
|
+
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.',
|
|
330
|
+
default: true,
|
|
331
|
+
},
|
|
332
|
+
'prompt-check-sibling-pull-requests': {
|
|
333
|
+
type: 'boolean',
|
|
334
|
+
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.',
|
|
335
|
+
default: true,
|
|
336
|
+
},
|
|
337
|
+
'prompt-experiments-folder': {
|
|
338
|
+
type: 'string',
|
|
339
|
+
description: 'Path to experiments folder used in system prompt. Set to empty string to disable experiments folder prompt. Default: ./experiments',
|
|
340
|
+
default: './experiments',
|
|
341
|
+
},
|
|
342
|
+
'prompt-examples-folder': {
|
|
343
|
+
type: 'string',
|
|
344
|
+
description: 'Path to examples folder used in system prompt. Set to empty string to disable examples folder prompt. Default: ./examples',
|
|
345
|
+
default: './examples',
|
|
346
|
+
},
|
|
347
|
+
'playwright-mcp-auto-cleanup': {
|
|
348
|
+
type: 'boolean',
|
|
349
|
+
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.',
|
|
350
|
+
default: true,
|
|
351
|
+
},
|
|
352
|
+
'auto-gh-configuration-repair': {
|
|
353
|
+
type: 'boolean',
|
|
354
|
+
description: 'Automatically repair git configuration using gh-setup-git-identity --repair when git identity is not configured. Requires gh-setup-git-identity to be installed.',
|
|
355
|
+
default: false,
|
|
356
|
+
},
|
|
357
|
+
'prompt-subagents-via-agent-commander': {
|
|
358
|
+
type: 'boolean',
|
|
359
|
+
description: 'Guide Claude to use agent-commander CLI (start-agent) instead of native Task tool for subagent delegation. Allows using any supported agent type (claude, opencode, codex, agent) with unified API. Only works with --tool claude and requires agent-commander to be installed.',
|
|
360
|
+
default: false,
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
|
|
25
364
|
// Function to create yargs configuration - avoids duplication
|
|
26
365
|
export const createYargsConfig = yargsInstance => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.
|
|
31
|
-
yargs.positional('issue-url', {
|
|
32
|
-
type: 'string',
|
|
33
|
-
description: 'The GitHub issue URL to solve',
|
|
34
|
-
});
|
|
35
|
-
})
|
|
36
|
-
.fail((msg, err) => {
|
|
37
|
-
// Custom fail handler to suppress yargs error output
|
|
38
|
-
// Errors will be handled in the parseArguments catch block
|
|
39
|
-
if (err) throw err; // Rethrow actual errors
|
|
40
|
-
// For validation errors, throw a clean error object with the message
|
|
41
|
-
const error = new Error(msg);
|
|
42
|
-
error.name = 'YargsValidationError';
|
|
43
|
-
throw error;
|
|
44
|
-
})
|
|
45
|
-
.option('resume', {
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Resume from a previous session ID (when limit was reached)',
|
|
48
|
-
alias: 'r',
|
|
49
|
-
})
|
|
50
|
-
.option('working-directory', {
|
|
51
|
-
type: 'string',
|
|
52
|
-
description: 'Use specified working directory instead of creating a new temp directory. If directory does not exist, it will be created and the repository will be cloned. Essential for --resume to work correctly with Claude Code sessions.',
|
|
53
|
-
alias: 'd',
|
|
54
|
-
})
|
|
55
|
-
.option('only-prepare-command', {
|
|
56
|
-
type: 'boolean',
|
|
57
|
-
description: 'Only prepare and print the claude command without executing it',
|
|
58
|
-
})
|
|
59
|
-
.option('dry-run', {
|
|
60
|
-
type: 'boolean',
|
|
61
|
-
description: 'Prepare everything but do not execute Claude (alias for --only-prepare-command)',
|
|
62
|
-
alias: 'n',
|
|
63
|
-
})
|
|
64
|
-
.option('skip-tool-connection-check', {
|
|
65
|
-
type: 'boolean',
|
|
66
|
-
description: 'Skip tool connection check (useful in CI environments). Does NOT skip model validation.',
|
|
67
|
-
default: false,
|
|
68
|
-
})
|
|
69
|
-
.option('skip-tool-check', {
|
|
70
|
-
type: 'boolean',
|
|
71
|
-
description: 'Alias for --skip-tool-connection-check (deprecated, use --skip-tool-connection-check instead)',
|
|
72
|
-
default: false,
|
|
73
|
-
hidden: true,
|
|
74
|
-
})
|
|
75
|
-
.option('skip-claude-check', {
|
|
76
|
-
type: 'boolean',
|
|
77
|
-
description: 'Alias for --skip-tool-connection-check (deprecated)',
|
|
78
|
-
default: false,
|
|
79
|
-
hidden: true,
|
|
80
|
-
})
|
|
81
|
-
.option('tool-connection-check', {
|
|
82
|
-
type: 'boolean',
|
|
83
|
-
description: 'Perform tool connection check (enabled by default, use --no-tool-connection-check to skip). Does NOT affect model validation.',
|
|
84
|
-
default: true,
|
|
85
|
-
hidden: true,
|
|
86
|
-
})
|
|
87
|
-
.option('tool-check', {
|
|
88
|
-
type: 'boolean',
|
|
89
|
-
description: 'Alias for --tool-connection-check (deprecated)',
|
|
90
|
-
default: true,
|
|
91
|
-
hidden: true,
|
|
92
|
-
})
|
|
93
|
-
.option('model', {
|
|
94
|
-
type: 'string',
|
|
95
|
-
description: 'Model to use (for claude: opus, sonnet, haiku, haiku-3-5, haiku-3; for opencode: grok, gpt4o; for codex: gpt5, gpt5-codex, o3; for agent: grok, grok-code, big-pickle)',
|
|
96
|
-
alias: 'm',
|
|
97
|
-
default: currentParsedArgs => {
|
|
98
|
-
// Dynamic default based on tool selection
|
|
99
|
-
if (currentParsedArgs?.tool === 'opencode') {
|
|
100
|
-
return 'grok-code-fast-1';
|
|
101
|
-
} else if (currentParsedArgs?.tool === 'codex') {
|
|
102
|
-
return 'gpt-5';
|
|
103
|
-
} else if (currentParsedArgs?.tool === 'agent') {
|
|
104
|
-
return 'grok-code';
|
|
105
|
-
}
|
|
106
|
-
return 'sonnet';
|
|
107
|
-
},
|
|
108
|
-
})
|
|
109
|
-
.option('auto-pull-request-creation', {
|
|
110
|
-
type: 'boolean',
|
|
111
|
-
description: 'Automatically create a draft pull request before running Claude',
|
|
112
|
-
default: true,
|
|
113
|
-
})
|
|
114
|
-
.option('verbose', {
|
|
115
|
-
type: 'boolean',
|
|
116
|
-
description: 'Enable verbose logging for debugging',
|
|
117
|
-
alias: 'v',
|
|
118
|
-
default: false,
|
|
119
|
-
})
|
|
120
|
-
.option('fork', {
|
|
121
|
-
type: 'boolean',
|
|
122
|
-
description: "Fork the repository if you don't have write access",
|
|
123
|
-
alias: 'f',
|
|
124
|
-
default: false,
|
|
125
|
-
})
|
|
126
|
-
.option('auto-fork', {
|
|
127
|
-
type: 'boolean',
|
|
128
|
-
description: 'Automatically fork public repositories without write access (fails for private repos)',
|
|
129
|
-
default: true,
|
|
130
|
-
})
|
|
131
|
-
.option('claude-file', {
|
|
132
|
-
type: 'boolean',
|
|
133
|
-
description: 'Create CLAUDE.md file for task details (default for --tool claude, mutually exclusive with --gitkeep-file)',
|
|
134
|
-
default: true,
|
|
135
|
-
})
|
|
136
|
-
.option('gitkeep-file', {
|
|
137
|
-
type: 'boolean',
|
|
138
|
-
description: 'Create .gitkeep file instead of CLAUDE.md (default for --tool agent/opencode/codex, mutually exclusive with --claude-file)',
|
|
139
|
-
default: false,
|
|
140
|
-
})
|
|
141
|
-
.option('auto-gitkeep-file', {
|
|
142
|
-
type: 'boolean',
|
|
143
|
-
description: 'Automatically use .gitkeep if CLAUDE.md is in .gitignore (pre-checks before creating file)',
|
|
144
|
-
default: true,
|
|
145
|
-
})
|
|
146
|
-
.option('attach-logs', {
|
|
147
|
-
type: 'boolean',
|
|
148
|
-
description: 'Upload the solution draft log file to the Pull Request on completion (⚠️ WARNING: May expose sensitive data)',
|
|
149
|
-
default: false,
|
|
150
|
-
})
|
|
151
|
-
.option('auto-close-pull-request-on-fail', {
|
|
152
|
-
type: 'boolean',
|
|
153
|
-
description: 'Automatically close the pull request if execution fails',
|
|
154
|
-
default: false,
|
|
155
|
-
})
|
|
156
|
-
.option('auto-continue', {
|
|
157
|
-
type: 'boolean',
|
|
158
|
-
description: 'Continue with existing PR when issue URL is provided (instead of creating new PR)',
|
|
159
|
-
default: true,
|
|
160
|
-
})
|
|
161
|
-
.option('auto-resume-on-limit-reset', {
|
|
162
|
-
type: 'boolean',
|
|
163
|
-
description: 'Automatically resume when AI tool limit resets (maintains session context with --resume flag)',
|
|
164
|
-
default: false,
|
|
165
|
-
})
|
|
166
|
-
.option('auto-restart-on-limit-reset', {
|
|
167
|
-
type: 'boolean',
|
|
168
|
-
description: 'Automatically restart when AI tool limit resets (fresh start without --resume flag)',
|
|
169
|
-
default: false,
|
|
170
|
-
})
|
|
171
|
-
.option('session-type', {
|
|
172
|
-
type: 'string',
|
|
173
|
-
description: 'Internal: Session type for comment differentiation (new, resume, auto-resume, auto-restart)',
|
|
174
|
-
choices: ['new', 'resume', 'auto-resume', 'auto-restart'],
|
|
175
|
-
default: 'new',
|
|
176
|
-
hidden: true,
|
|
177
|
-
})
|
|
178
|
-
.option('auto-resume-on-errors', {
|
|
179
|
-
type: 'boolean',
|
|
180
|
-
description: 'Automatically resume on network errors (503, etc.) with exponential backoff',
|
|
181
|
-
default: false,
|
|
182
|
-
})
|
|
183
|
-
.option('auto-continue-only-on-new-comments', {
|
|
184
|
-
type: 'boolean',
|
|
185
|
-
description: 'Explicitly fail on absence of new comments in auto-continue or continue mode',
|
|
186
|
-
default: false,
|
|
187
|
-
})
|
|
188
|
-
.option('auto-commit-uncommitted-changes', {
|
|
189
|
-
type: 'boolean',
|
|
190
|
-
description: 'Automatically commit and push uncommitted changes made by Claude (disabled by default)',
|
|
191
|
-
default: false,
|
|
192
|
-
})
|
|
193
|
-
.option('auto-restart-on-uncommitted-changes', {
|
|
194
|
-
type: 'boolean',
|
|
195
|
-
description: 'Automatically restart when uncommitted changes are detected to allow the tool to handle them (default: true, use --no-auto-restart-on-uncommitted-changes to disable)',
|
|
196
|
-
default: true,
|
|
197
|
-
})
|
|
198
|
-
.option('auto-restart-max-iterations', {
|
|
199
|
-
type: 'number',
|
|
200
|
-
description: 'Maximum number of auto-restart iterations when uncommitted changes are detected (default: 3)',
|
|
201
|
-
default: 3,
|
|
202
|
-
})
|
|
203
|
-
.option('auto-merge', {
|
|
204
|
-
type: 'boolean',
|
|
205
|
-
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.',
|
|
206
|
-
default: false,
|
|
207
|
-
})
|
|
208
|
-
.option('auto-restart-until-mergable', {
|
|
209
|
-
type: 'boolean',
|
|
210
|
-
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.',
|
|
211
|
-
default: false,
|
|
212
|
-
})
|
|
213
|
-
.option('auto-restart-on-non-updated-pull-request-description', {
|
|
214
|
-
type: 'boolean',
|
|
215
|
-
description: 'Automatically restart if PR title or description still contains auto-generated placeholder text after agent execution. Restarts with a hint about what was not updated.',
|
|
216
|
-
default: false,
|
|
217
|
-
})
|
|
218
|
-
.option('continue-only-on-feedback', {
|
|
219
|
-
type: 'boolean',
|
|
220
|
-
description: 'Only continue if feedback is detected (works only with pull request link or issue link with --auto-continue)',
|
|
221
|
-
default: false,
|
|
222
|
-
})
|
|
223
|
-
.option('watch', {
|
|
224
|
-
type: 'boolean',
|
|
225
|
-
description: 'Monitor continuously for feedback and auto-restart when detected (stops when PR is merged)',
|
|
226
|
-
alias: 'w',
|
|
227
|
-
default: false,
|
|
228
|
-
})
|
|
229
|
-
.option('watch-interval', {
|
|
230
|
-
type: 'number',
|
|
231
|
-
description: 'Interval in seconds for checking feedback in watch mode (default: 60)',
|
|
232
|
-
default: 60,
|
|
233
|
-
})
|
|
234
|
-
.option('min-disk-space', {
|
|
235
|
-
type: 'number',
|
|
236
|
-
description: 'Minimum required disk space in MB (default: 2048)',
|
|
237
|
-
default: 2048,
|
|
238
|
-
})
|
|
239
|
-
.option('log-dir', {
|
|
240
|
-
type: 'string',
|
|
241
|
-
description: 'Directory to save log files (defaults to current working directory)',
|
|
242
|
-
alias: 'l',
|
|
243
|
-
})
|
|
244
|
-
.option('think', {
|
|
245
|
-
type: 'string',
|
|
246
|
-
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.',
|
|
247
|
-
choices: ['off', 'low', 'medium', 'high', 'max'],
|
|
248
|
-
default: undefined,
|
|
249
|
-
})
|
|
250
|
-
.option('thinking-budget', {
|
|
251
|
-
type: 'number',
|
|
252
|
-
description: 'Thinking token budget for Claude Code (0-63999). Controls MAX_THINKING_TOKENS. Default: 31999 (Claude default). Set to 0 to disable thinking. For older Claude Code versions, translated back to --think level.',
|
|
253
|
-
default: undefined,
|
|
254
|
-
})
|
|
255
|
-
.option('thinking-budget-claude-minimum-version', {
|
|
366
|
+
let config = yargsInstance
|
|
367
|
+
.usage('Usage: solve.mjs <issue-url> [options]')
|
|
368
|
+
.command('$0 <issue-url>', 'Solve a GitHub issue or pull request', yargs => {
|
|
369
|
+
yargs.positional('issue-url', {
|
|
256
370
|
type: 'string',
|
|
257
|
-
description: '
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
default: true,
|
|
304
|
-
})
|
|
305
|
-
.option('tool', {
|
|
306
|
-
type: 'string',
|
|
307
|
-
description: 'AI tool to use for solving issues',
|
|
308
|
-
choices: ['claude', 'opencode', 'codex', 'agent'],
|
|
309
|
-
default: 'claude',
|
|
310
|
-
})
|
|
311
|
-
.option('execute-tool-with-bun', {
|
|
312
|
-
type: 'boolean',
|
|
313
|
-
description: 'Execute the AI tool using bunx (experimental, may improve speed and memory usage)',
|
|
314
|
-
default: false,
|
|
315
|
-
})
|
|
316
|
-
.option('enable-workspaces', {
|
|
317
|
-
type: 'boolean',
|
|
318
|
-
description: 'Use separate workspace directory structure with repository/ and tmp/ folders. Works with all tools (claude, opencode, codex, agent). Experimental feature.',
|
|
319
|
-
default: false,
|
|
320
|
-
})
|
|
321
|
-
.option('interactive-mode', {
|
|
322
|
-
type: 'boolean',
|
|
323
|
-
description: '[EXPERIMENTAL] Post Claude output as PR comments in real-time. Only supported for --tool claude.',
|
|
324
|
-
default: false,
|
|
325
|
-
})
|
|
326
|
-
.option('prompt-explore-sub-agent', {
|
|
327
|
-
type: 'boolean',
|
|
328
|
-
description: 'Encourage Claude to use Explore sub-agent for codebase exploration. Only supported for --tool claude.',
|
|
329
|
-
default: false,
|
|
330
|
-
})
|
|
331
|
-
.option('prompt-general-purpose-sub-agent', {
|
|
332
|
-
type: 'boolean',
|
|
333
|
-
description: 'Prompt AI to use general-purpose sub agents for processing large tasks with multiple files/folders. Only supported for --tool claude.',
|
|
334
|
-
default: false,
|
|
335
|
-
})
|
|
336
|
-
.option('tokens-budget-stats', {
|
|
337
|
-
type: 'boolean',
|
|
338
|
-
description: '[EXPERIMENTAL] Show detailed token budget statistics including context window usage and ratios. Only supported for --tool claude.',
|
|
339
|
-
default: false,
|
|
340
|
-
})
|
|
341
|
-
.option('prompt-issue-reporting', {
|
|
342
|
-
type: 'boolean',
|
|
343
|
-
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.',
|
|
344
|
-
default: false,
|
|
345
|
-
})
|
|
346
|
-
.option('prompt-architecture-care', {
|
|
347
|
-
type: 'boolean',
|
|
348
|
-
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.',
|
|
349
|
-
default: false,
|
|
350
|
-
})
|
|
351
|
-
.option('prompt-case-studies', {
|
|
352
|
-
type: 'boolean',
|
|
353
|
-
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.',
|
|
354
|
-
default: false,
|
|
355
|
-
})
|
|
356
|
-
.option('prompt-playwright-mcp', {
|
|
357
|
-
type: 'boolean',
|
|
358
|
-
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.',
|
|
359
|
-
default: true,
|
|
360
|
-
})
|
|
361
|
-
.option('prompt-check-sibling-pull-requests', {
|
|
362
|
-
type: 'boolean',
|
|
363
|
-
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.',
|
|
364
|
-
default: true,
|
|
365
|
-
})
|
|
366
|
-
.option('prompt-experiments-folder', {
|
|
367
|
-
type: 'string',
|
|
368
|
-
description: 'Path to experiments folder used in system prompt. Set to empty string to disable experiments folder prompt. Default: ./experiments',
|
|
369
|
-
default: './experiments',
|
|
370
|
-
})
|
|
371
|
-
.option('prompt-examples-folder', {
|
|
372
|
-
type: 'string',
|
|
373
|
-
description: 'Path to examples folder used in system prompt. Set to empty string to disable examples folder prompt. Default: ./examples',
|
|
374
|
-
default: './examples',
|
|
375
|
-
})
|
|
376
|
-
.option('playwright-mcp-auto-cleanup', {
|
|
377
|
-
type: 'boolean',
|
|
378
|
-
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.',
|
|
379
|
-
default: true,
|
|
380
|
-
})
|
|
381
|
-
.option('auto-gh-configuration-repair', {
|
|
382
|
-
type: 'boolean',
|
|
383
|
-
description: 'Automatically repair git configuration using gh-setup-git-identity --repair when git identity is not configured. Requires gh-setup-git-identity to be installed.',
|
|
384
|
-
default: false,
|
|
385
|
-
})
|
|
386
|
-
.option('prompt-subagents-via-agent-commander', {
|
|
387
|
-
type: 'boolean',
|
|
388
|
-
description: 'Guide Claude to use agent-commander CLI (start-agent) instead of native Task tool for subagent delegation. Allows using any supported agent type (claude, opencode, codex, agent) with unified API. Only works with --tool claude and requires agent-commander to be installed.',
|
|
389
|
-
default: false,
|
|
390
|
-
})
|
|
391
|
-
.parserConfiguration({
|
|
392
|
-
'boolean-negation': true,
|
|
393
|
-
})
|
|
394
|
-
// Use yargs built-in strict mode to reject unrecognized options
|
|
395
|
-
// This prevents issues like #453 and #482 where unknown options are silently ignored
|
|
396
|
-
.strict()
|
|
397
|
-
.help('h')
|
|
398
|
-
.alias('h', 'help')
|
|
399
|
-
);
|
|
371
|
+
description: 'The GitHub issue URL to solve',
|
|
372
|
+
});
|
|
373
|
+
})
|
|
374
|
+
.fail((msg, err) => {
|
|
375
|
+
// Custom fail handler to suppress yargs error output
|
|
376
|
+
// Errors will be handled in the parseArguments catch block
|
|
377
|
+
if (err) throw err; // Rethrow actual errors
|
|
378
|
+
// For validation errors, throw a clean error object with the message
|
|
379
|
+
const error = new Error(msg);
|
|
380
|
+
error.name = 'YargsValidationError';
|
|
381
|
+
throw error;
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// Register all options from the definitions map
|
|
385
|
+
for (const [name, def] of Object.entries(SOLVE_OPTION_DEFINITIONS)) {
|
|
386
|
+
config = config.option(name, def);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// 'model' has a dynamic default function, so it's defined inline (not in SOLVE_OPTION_DEFINITIONS)
|
|
390
|
+
config = config
|
|
391
|
+
.option('model', {
|
|
392
|
+
type: 'string',
|
|
393
|
+
description: 'Model to use (for claude: opus, sonnet, haiku, haiku-3-5, haiku-3; for opencode: grok, gpt4o; for codex: gpt5, gpt5-codex, o3; for agent: grok, grok-code, big-pickle)',
|
|
394
|
+
alias: 'm',
|
|
395
|
+
default: currentParsedArgs => {
|
|
396
|
+
// Dynamic default based on tool selection
|
|
397
|
+
if (currentParsedArgs?.tool === 'opencode') {
|
|
398
|
+
return 'grok-code-fast-1';
|
|
399
|
+
} else if (currentParsedArgs?.tool === 'codex') {
|
|
400
|
+
return 'gpt-5';
|
|
401
|
+
} else if (currentParsedArgs?.tool === 'agent') {
|
|
402
|
+
return 'grok-code';
|
|
403
|
+
}
|
|
404
|
+
return 'sonnet';
|
|
405
|
+
},
|
|
406
|
+
})
|
|
407
|
+
.parserConfiguration({
|
|
408
|
+
'boolean-negation': true,
|
|
409
|
+
})
|
|
410
|
+
// Use yargs built-in strict mode to reject unrecognized options
|
|
411
|
+
// This prevents issues like #453 and #482 where unknown options are silently ignored
|
|
412
|
+
.strict()
|
|
413
|
+
.help('h')
|
|
414
|
+
.alias('h', 'help');
|
|
415
|
+
|
|
416
|
+
return config;
|
|
400
417
|
};
|
|
401
418
|
|
|
402
419
|
// Parse command line arguments - now needs yargs and hideBin passed in
|