@link-assistant/hive-mind 0.39.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +24 -0
  3. package/README.md +769 -0
  4. package/package.json +58 -0
  5. package/src/agent.lib.mjs +705 -0
  6. package/src/agent.prompts.lib.mjs +196 -0
  7. package/src/buildUserMention.lib.mjs +71 -0
  8. package/src/claude-limits.lib.mjs +389 -0
  9. package/src/claude.lib.mjs +1445 -0
  10. package/src/claude.prompts.lib.mjs +203 -0
  11. package/src/codex.lib.mjs +552 -0
  12. package/src/codex.prompts.lib.mjs +194 -0
  13. package/src/config.lib.mjs +207 -0
  14. package/src/contributing-guidelines.lib.mjs +268 -0
  15. package/src/exit-handler.lib.mjs +205 -0
  16. package/src/git.lib.mjs +145 -0
  17. package/src/github-issue-creator.lib.mjs +246 -0
  18. package/src/github-linking.lib.mjs +152 -0
  19. package/src/github.batch.lib.mjs +272 -0
  20. package/src/github.graphql.lib.mjs +258 -0
  21. package/src/github.lib.mjs +1479 -0
  22. package/src/hive.config.lib.mjs +254 -0
  23. package/src/hive.mjs +1500 -0
  24. package/src/instrument.mjs +191 -0
  25. package/src/interactive-mode.lib.mjs +1000 -0
  26. package/src/lenv-reader.lib.mjs +206 -0
  27. package/src/lib.mjs +490 -0
  28. package/src/lino.lib.mjs +176 -0
  29. package/src/local-ci-checks.lib.mjs +324 -0
  30. package/src/memory-check.mjs +419 -0
  31. package/src/model-mapping.lib.mjs +145 -0
  32. package/src/model-validation.lib.mjs +278 -0
  33. package/src/opencode.lib.mjs +479 -0
  34. package/src/opencode.prompts.lib.mjs +194 -0
  35. package/src/protect-branch.mjs +159 -0
  36. package/src/review.mjs +433 -0
  37. package/src/reviewers-hive.mjs +643 -0
  38. package/src/sentry.lib.mjs +284 -0
  39. package/src/solve.auto-continue.lib.mjs +568 -0
  40. package/src/solve.auto-pr.lib.mjs +1374 -0
  41. package/src/solve.branch-errors.lib.mjs +341 -0
  42. package/src/solve.branch.lib.mjs +230 -0
  43. package/src/solve.config.lib.mjs +342 -0
  44. package/src/solve.error-handlers.lib.mjs +256 -0
  45. package/src/solve.execution.lib.mjs +291 -0
  46. package/src/solve.feedback.lib.mjs +436 -0
  47. package/src/solve.mjs +1128 -0
  48. package/src/solve.preparation.lib.mjs +210 -0
  49. package/src/solve.repo-setup.lib.mjs +114 -0
  50. package/src/solve.repository.lib.mjs +961 -0
  51. package/src/solve.results.lib.mjs +558 -0
  52. package/src/solve.session.lib.mjs +135 -0
  53. package/src/solve.validation.lib.mjs +325 -0
  54. package/src/solve.watch.lib.mjs +572 -0
  55. package/src/start-screen.mjs +324 -0
  56. package/src/task.mjs +308 -0
  57. package/src/telegram-bot.mjs +1481 -0
  58. package/src/telegram-markdown.lib.mjs +64 -0
  59. package/src/usage-limit.lib.mjs +218 -0
  60. package/src/version.lib.mjs +41 -0
  61. package/src/youtrack/solve.youtrack.lib.mjs +116 -0
  62. package/src/youtrack/youtrack-sync.mjs +219 -0
  63. package/src/youtrack/youtrack.lib.mjs +425 -0
@@ -0,0 +1,254 @@
1
+ // CLI configuration module for hive command
2
+ // Extracted from hive.mjs to avoid loading heavy dependencies (instrument.mjs, etc.)
3
+ // when only the yargs configuration is needed (e.g., in telegram-bot.mjs)
4
+ // This module has no heavy dependencies to allow fast loading for --help
5
+
6
+ export const createYargsConfig = (yargsInstance) => {
7
+ return yargsInstance
8
+ .command('$0 [github-url]', 'Monitor GitHub issues and create PRs', (yargs) => {
9
+ yargs.positional('github-url', {
10
+ type: 'string',
11
+ description: 'GitHub organization, repository, or user URL to monitor (or GitHub repo URL when using --youtrack-mode)'
12
+ });
13
+ })
14
+ .usage('Usage: $0 <github-url> [options]')
15
+ .fail((msg, err) => {
16
+ // Custom fail handler to suppress yargs' automatic error output to stderr
17
+ // We handle errors in the calling code's try-catch block
18
+ // If there's an existing error object, throw it as-is to preserve the full trace
19
+ if (err) {
20
+ throw err;
21
+ }
22
+ // For validation messages, throw them as-is without wrapping
23
+ // This preserves the original error and its stack trace
24
+ const error = new Error(msg);
25
+ // Preserve the original error as the cause if yargs provided one
26
+ if (err) {
27
+ error.cause = err;
28
+ }
29
+ throw error;
30
+ })
31
+ .option('monitor-tag', {
32
+ type: 'string',
33
+ description: 'GitHub label to monitor for issues',
34
+ default: 'help wanted',
35
+ alias: 't'
36
+ })
37
+ .option('all-issues', {
38
+ type: 'boolean',
39
+ description: 'Process all open issues regardless of labels',
40
+ default: false,
41
+ alias: 'a'
42
+ })
43
+ .option('skip-issues-with-prs', {
44
+ type: 'boolean',
45
+ description: 'Skip issues that already have open pull requests',
46
+ default: false,
47
+ alias: 's'
48
+ })
49
+ .option('concurrency', {
50
+ type: 'number',
51
+ description: 'Number of concurrent solve instances',
52
+ default: 2,
53
+ alias: 'c'
54
+ })
55
+ .option('pull-requests-per-issue', {
56
+ type: 'number',
57
+ description: 'Number of pull requests to generate per issue',
58
+ default: 1,
59
+ alias: 'p'
60
+ })
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
+ .option('interval', {
68
+ type: 'number',
69
+ description: 'Polling interval in seconds',
70
+ default: 300, // 5 minutes
71
+ alias: 'i'
72
+ })
73
+ .option('max-issues', {
74
+ type: 'number',
75
+ description: 'Maximum number of issues to process (0 = unlimited)',
76
+ default: 0
77
+ })
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
+ .option('once', {
125
+ type: 'boolean',
126
+ description: 'Run once and exit instead of continuous monitoring',
127
+ default: false
128
+ })
129
+ .option('min-disk-space', {
130
+ type: 'number',
131
+ description: 'Minimum required disk space in MB (default: 500)',
132
+ default: 500
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
+ .option('project-number', {
156
+ type: 'number',
157
+ description: 'GitHub Project number to monitor',
158
+ alias: 'pn'
159
+ })
160
+ .option('project-owner', {
161
+ type: 'string',
162
+ description: 'GitHub Project owner (organization or user)',
163
+ alias: 'po'
164
+ })
165
+ .option('project-status', {
166
+ type: 'string',
167
+ description: 'Project status column to monitor (e.g., "Ready", "To Do")',
168
+ alias: 'ps',
169
+ default: 'Ready'
170
+ })
171
+ .option('project-mode', {
172
+ type: 'boolean',
173
+ description: 'Enable project-based monitoring instead of label-based',
174
+ alias: 'pm',
175
+ default: false
176
+ })
177
+ .option('youtrack-mode', {
178
+ type: 'boolean',
179
+ description: 'Enable YouTrack mode instead of GitHub issues',
180
+ default: false
181
+ })
182
+ .option('youtrack-stage', {
183
+ type: 'string',
184
+ description: 'Override YouTrack stage to monitor (overrides YOUTRACK_STAGE env var)'
185
+ })
186
+ .option('youtrack-project', {
187
+ type: 'string',
188
+ description: 'Override YouTrack project code (overrides YOUTRACK_PROJECT_CODE env var)'
189
+ })
190
+ .option('target-branch', {
191
+ type: 'string',
192
+ description: 'Target branch for pull requests (defaults to repository default branch)',
193
+ alias: 'tb'
194
+ })
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('think', {
206
+ type: 'string',
207
+ description: 'Thinking level: low (Think.), medium (Think hard.), high (Think harder.), max (Ultrathink.)',
208
+ choices: ['low', 'medium', 'high', 'max'],
209
+ default: undefined
210
+ })
211
+ .option('sentry', {
212
+ type: 'boolean',
213
+ description: 'Enable Sentry error tracking and monitoring (use --no-sentry to disable)',
214
+ default: true
215
+ })
216
+ .option('watch', {
217
+ type: 'boolean',
218
+ description: 'Monitor continuously for feedback and auto-restart when detected (stops when PR is merged)',
219
+ alias: 'w',
220
+ default: false
221
+ })
222
+ .option('issue-order', {
223
+ type: 'string',
224
+ description: 'Order issues by publication date: "asc" (oldest first) or "desc" (newest first)',
225
+ alias: 'o',
226
+ default: 'asc',
227
+ choices: ['asc', 'desc']
228
+ })
229
+ .option('prefix-fork-name-with-owner-name', {
230
+ type: 'boolean',
231
+ 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.',
232
+ default: true
233
+ })
234
+ .option('interactive-mode', {
235
+ type: 'boolean',
236
+ description: '[EXPERIMENTAL] Post Claude output as PR comments in real-time. Only supported for --tool claude.',
237
+ default: false
238
+ })
239
+ .option('prompt-explore-sub-agent', {
240
+ type: 'boolean',
241
+ description: 'Encourage Claude to use Explore sub-agent for codebase exploration. Only supported for --tool claude.',
242
+ default: false
243
+ })
244
+ .parserConfiguration({
245
+ 'boolean-negation': true,
246
+ 'strip-dashed': false,
247
+ 'strip-aliased': false,
248
+ 'populate--': false
249
+ })
250
+ .showHelpOnFail(false) // Don't show help on validation failures
251
+ .strict()
252
+ .help('h')
253
+ .alias('h', 'help');
254
+ };