@hung319/opencode-hive 1.6.4 → 1.6.5

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 (3) hide show
  1. package/README.md +23 -7
  2. package/bin/doctor.ts +51 -18
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -567,7 +567,7 @@ bunx @hung319/opencode-hive doctor --fix # Auto-fix issues
567
567
 
568
568
  ```
569
569
  ╔═══════════════════════════════════════════════════════════╗
570
- ║ 🐝 Hive Doctor v1.6.4 - System Check ║
570
+ ║ 🐝 Hive Doctor v1.6.5 - System Check ║
571
571
  ╚═══════════════════════════════════════════════════════════╝
572
572
 
573
573
  Status: ⚠️ NEEDS SETUP
@@ -578,18 +578,17 @@ bunx @hung319/opencode-hive doctor --fix # Auto-fix issues
578
578
 
579
579
  🔧 CLI Tools (4/5)
580
580
  ✅ dora (via npx)
581
- auto-cr not available
581
+ auto-cr (check) installed
582
582
  ...
583
583
 
584
584
  📦 MCPs: Auto-installed with plugin
585
585
 
586
586
  ⚡ C++20 for native modules:
587
- Not set (needed for @ast-grep/napi)
588
- Run with --fix to auto-configure
587
+ Already configured
589
588
 
590
589
  🚀 Quick Install
591
590
 
592
- npx -y auto-cr-cmd && npm install @sparkleideas/agent-booster
591
+ npm install @sparkleideas/agent-booster
593
592
  ```
594
593
 
595
594
  ### Auto-fix Mode
@@ -599,8 +598,25 @@ bunx @hung319/opencode-hive doctor --fix
599
598
  ```
600
599
 
601
600
  This will:
602
- 1. Auto-add CXXFLAGS="-std=c++20" to ~/.bashrc
603
- 2. Install available CLI tools via npx
601
+ 1. Set CXXFLAGS for current session
602
+ 2. Add to ~/.bashrc for future sessions
603
+ 3. Install available CLI tools via npx
604
+
605
+ ### C++20 for Native Modules
606
+
607
+ Node.js v24+ requires C++20 for native modules like `@ast-grep/napi`.
608
+
609
+ **Auto-fix:**
610
+ ```bash
611
+ bunx @hung319/opencode-hive doctor --fix
612
+ ```
613
+
614
+ **Manual:**
615
+ ```bash
616
+ echo 'export CXXFLAGS="-std=c++20"' >> ~/.bashrc
617
+ source ~/.bashrc
618
+ CXXFLAGS="-std=c++20" npm install @ast-grep/napi
619
+ ```
604
620
  ╔═══════════════════════════════════════════════════════════╗
605
621
  ║ 🐝 Hive Doctor v1.6.3 - System Check ║
606
622
  ╚═══════════════════════════════════════════════════════════╝
package/bin/doctor.ts CHANGED
@@ -130,19 +130,19 @@ function checkNpmPackage(name: string): CheckResult {
130
130
 
131
131
  function checkCliTool(name: string, command: string, description: string): CliCheck {
132
132
  const result: CliCheck = { name, command, installed: false, description };
133
+ const cmdName = command.split(' ')[0];
133
134
 
134
- // Try direct command
135
+ // Try direct command with --help (some binaries don't have --version)
135
136
  try {
136
- const cmd = command.split(' ')[0];
137
- execSync(cmd, { stdio: 'ignore', timeout: 3000 });
137
+ execSync(cmdName, { stdio: 'ignore', timeout: 3000 });
138
138
  result.installed = true;
139
139
  result.version = 'installed';
140
140
  return result;
141
141
  } catch {}
142
142
 
143
- // Try npx
143
+ // Try npx with --help
144
144
  try {
145
- execSync(`npx -y ${command.split(' ')[0]} --version`, {
145
+ execSync(`npx -y ${cmdName} --help`, {
146
146
  stdio: 'ignore',
147
147
  timeout: 10000
148
148
  });
@@ -151,6 +151,16 @@ function checkCliTool(name: string, command: string, description: string): CliCh
151
151
  return result;
152
152
  } catch {}
153
153
 
154
+ // Special case for auto-cr: binary is "check", not "auto-cr"
155
+ if (name === 'auto-cr') {
156
+ try {
157
+ execSync('check --help', { stdio: 'ignore', timeout: 3000 });
158
+ result.installed = true;
159
+ result.version = 'installed (check)';
160
+ return result;
161
+ } catch {}
162
+ }
163
+
154
164
  return result;
155
165
  }
156
166
 
@@ -185,10 +195,9 @@ function autoFixCxxFlags(): boolean {
185
195
  return true;
186
196
  }
187
197
 
188
- const exportLine = '\nexport CXXFLAGS="-std=c++20"\n';
189
- const comment = '# For tree-sitter native modules (e.g., @ast-grep/napi)\n';
190
-
191
198
  const bashrc = path.join(process.env.HOME || '', '.bashrc');
199
+ const exportLine = '\nexport CXXFLAGS="-std=c++20"\nexport CXXFLAGS="std=c++20"\n';
200
+ const comment = '\n# For tree-sitter native modules (e.g., @ast-grep/napi)\n';
192
201
 
193
202
  try {
194
203
  // Check if bashrc exists
@@ -199,12 +208,28 @@ function autoFixCxxFlags(): boolean {
199
208
  const content = fs.readFileSync(bashrc, 'utf-8');
200
209
 
201
210
  // Check if already set
202
- if (content.includes('CXXFLAGS="-std=c++20"')) {
211
+ if (content.includes('CXXFLAGS')) {
203
212
  return true;
204
213
  }
205
214
 
206
215
  // Add to bashrc
207
- fs.appendFileSync(bashrc, `\n${comment}${exportLine}`);
216
+ fs.appendFileSync(bashrc, `${comment}${exportLine}`);
217
+ console.log(c.green(`✓ Added CXXFLAGS to ${bashrc}`));
218
+ return true;
219
+ } catch {
220
+ return false;
221
+ }
222
+ }
223
+
224
+ // ============================================================================
225
+ // Auto-set CXXFLAGS for current session
226
+ // ============================================================================
227
+
228
+ function setCxxFlagsForCurrentSession(): boolean {
229
+ try {
230
+ process.env.CXXFLAGS = '"-std=c++20"';
231
+ process.env.npm_config_cxxflags = '"-std=c++20"';
232
+ console.log(c.green('✓ CXXFLAGS set for current session'));
208
233
  return true;
209
234
  } catch {
210
235
  return false;
@@ -245,7 +270,7 @@ function autoInstallCliTools(tools: CliCheck[]): { success: string[]; failed: st
245
270
  function runDoctor(autoFix = false): DoctorOutput {
246
271
  const output: DoctorOutput = {
247
272
  status: 'ready',
248
- version: '1.6.4',
273
+ version: '1.6.5',
249
274
  summary: getSystemInfo(),
250
275
  checks: {
251
276
  agentTools: { total: 0, installed: 0, items: [] },
@@ -257,9 +282,15 @@ function runDoctor(autoFix = false): DoctorOutput {
257
282
  };
258
283
 
259
284
  // Auto-fix CXXFLAGS if requested
260
- if (autoFix && output.cxxflagsStatus === 'not-set') {
261
- console.log(c.cyan('\n🔧 Auto-fixing C++20 configuration...\n'));
262
- if (autoFixCxxFlags()) {
285
+ if (autoFix) {
286
+ console.log(c.cyan('\n🔧 Auto-fixing...\n'));
287
+
288
+ // Set for current session
289
+ setCxxFlagsForCurrentSession();
290
+
291
+ // Add to shell config
292
+ if (output.cxxflagsStatus === 'not-set') {
293
+ autoFixCxxFlags();
263
294
  output.cxxflagsStatus = 'auto-fixed';
264
295
  }
265
296
  }
@@ -326,19 +357,21 @@ function runDoctor(autoFix = false): DoctorOutput {
326
357
  output.status = 'needs-setup';
327
358
  }
328
359
 
329
- // Auto-install if requested
360
+ // Auto-install CLI tools if requested
330
361
  if (autoFix && missingTools.length > 0) {
331
- console.log(c.cyan('\n🔧 Auto-installing CLI tools...\n'));
362
+ console.log(c.cyan('\n🔧 Installing CLI tools...\n'));
332
363
  const installResult = autoInstallCliTools(missingTools);
333
364
 
334
365
  // Re-check after installation
335
366
  if (installResult.success.length > 0) {
336
367
  for (const name of installResult.success) {
337
368
  const tool = output.checks.cliTools.items.find(t => t.name === name);
338
- if (tool) tool.installed = true;
369
+ if (tool) {
370
+ tool.installed = true;
371
+ tool.version = 'installed';
372
+ }
339
373
  }
340
374
  output.checks.cliTools.available = output.checks.cliTools.items.filter(t => t.installed).length;
341
- missingTools.length; // Refresh
342
375
  }
343
376
  }
344
377
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hung319/opencode-hive",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Agent Hive - from vibe coding to hive coding",
6
6
  "license": "MIT WITH Commons-Clause",