@hung319/opencode-hive 1.6.4 → 1.6.6

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/README.md CHANGED
@@ -567,29 +567,21 @@ 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.6 - System Check ║
571
571
  ╚═══════════════════════════════════════════════════════════╝
572
572
 
573
- Status: ⚠️ NEEDS SETUP
574
-
575
- 🚀 Agent Tools (0/2)
576
- ○ @sparkleideas/agent-booster not installed
577
- ○ @sparkleideas/memory not installed
573
+ Status: READY
578
574
 
579
- 🔧 CLI Tools (4/5)
580
- dora (via npx)
581
- ○ auto-cr not available
582
- ...
575
+ 🚀 Agent Tools (2/2)
576
+ 🔧 CLI Tools (5/5)
583
577
 
584
578
  📦 MCPs: Auto-installed with plugin
585
579
 
586
580
  ⚡ C++20 for native modules:
587
- Not set (needed for @ast-grep/napi)
588
- Run with --fix to auto-configure
581
+ Active in session
589
582
 
590
583
  🚀 Quick Install
591
-
592
- npx -y auto-cr-cmd && npm install @sparkleideas/agent-booster
584
+ All tools ready!
593
585
  ```
594
586
 
595
587
  ### Auto-fix Mode
@@ -599,8 +591,25 @@ bunx @hung319/opencode-hive doctor --fix
599
591
  ```
600
592
 
601
593
  This will:
602
- 1. Auto-add CXXFLAGS="-std=c++20" to ~/.bashrc
603
- 2. Install available CLI tools via npx
594
+ 1. Set CXXFLAGS for current session
595
+ 2. Add to ~/.bashrc for future sessions
596
+ 3. Install available CLI tools via npx
597
+
598
+ ### C++20 for Native Modules
599
+
600
+ Node.js v24+ requires C++20 for native modules like `@ast-grep/napi`.
601
+
602
+ **Auto-fix:**
603
+ ```bash
604
+ bunx @hung319/opencode-hive doctor --fix
605
+ ```
606
+
607
+ **Manual:**
608
+ ```bash
609
+ echo 'export CXXFLAGS="-std=c++20"' >> ~/.bashrc
610
+ source ~/.bashrc
611
+ CXXFLAGS="-std=c++20" npm install @ast-grep/napi
612
+ ```
604
613
  ╔═══════════════════════════════════════════════════════════╗
605
614
  ║ 🐝 Hive Doctor v1.6.3 - System Check ║
606
615
  ╚═══════════════════════════════════════════════════════════╝
package/bin/doctor.ts CHANGED
@@ -61,7 +61,7 @@ interface DoctorOutput {
61
61
  reason: string;
62
62
  }[];
63
63
  quickInstall: string;
64
- cxxflagsStatus: 'set' | 'not-set' | 'auto-fixed';
64
+ cxxflagsStatus: 'ready' | 'in-config' | 'not-set' | 'auto-fixed';
65
65
  }
66
66
 
67
67
  // ============================================================================
@@ -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
 
@@ -158,7 +168,7 @@ function checkCliTool(name: string, command: string, description: string): CliCh
158
168
  // CXXFLAGS: Check and Auto-fix
159
169
  // ============================================================================
160
170
 
161
- function checkCxxFlags(): 'set' | 'not-set' {
171
+ function checkCxxFlags(): { inConfig: 'set' | 'not-set'; inSession: boolean } {
162
172
  const shellConfigs = [
163
173
  path.join(process.env.HOME || '', '.bashrc'),
164
174
  path.join(process.env.HOME || '', '.bash_profile'),
@@ -166,29 +176,39 @@ function checkCxxFlags(): 'set' | 'not-set' {
166
176
  path.join(process.env.HOME || '', '.profile'),
167
177
  ];
168
178
 
169
- const pattern = 'CXXFLAGS="-std=c++20"';
179
+ const patterns = ['CXXFLAGS="-std=c++20"', "CXXFLAGS='-std=c++20'"];
170
180
 
181
+ // Check if set in shell config files
182
+ let inConfig: 'set' | 'not-set' = 'not-set';
171
183
  for (const config of shellConfigs) {
172
184
  if (fs.existsSync(config)) {
173
185
  const content = fs.readFileSync(config, 'utf-8');
174
- if (content.includes(pattern)) {
175
- return 'set';
186
+ for (const pattern of patterns) {
187
+ if (content.includes(pattern)) {
188
+ inConfig = 'set';
189
+ break;
190
+ }
176
191
  }
177
192
  }
193
+ if (inConfig === 'set') break;
178
194
  }
179
195
 
180
- return 'not-set';
196
+ // Check if CXXFLAGS is active in current session
197
+ const inSession = !!process.env.CXXFLAGS;
198
+
199
+ return { inConfig, inSession };
181
200
  }
182
201
 
183
202
  function autoFixCxxFlags(): boolean {
184
- if (checkCxxFlags() === 'set') {
203
+ const cxxflags = checkCxxFlags();
204
+
205
+ if (cxxflags.inConfig === 'set') {
185
206
  return true;
186
207
  }
187
208
 
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
209
  const bashrc = path.join(process.env.HOME || '', '.bashrc');
210
+ const exportLine = 'export CXXFLAGS="-std=c++20"\n';
211
+ const comment = '# For tree-sitter native modules (e.g., @ast-grep/napi)\n';
192
212
 
193
213
  try {
194
214
  // Check if bashrc exists
@@ -205,6 +225,22 @@ function autoFixCxxFlags(): boolean {
205
225
 
206
226
  // Add to bashrc
207
227
  fs.appendFileSync(bashrc, `\n${comment}${exportLine}`);
228
+ console.log(c.green(`✓ Added CXXFLAGS to ${bashrc}`));
229
+ return true;
230
+ } catch {
231
+ return false;
232
+ }
233
+ }
234
+
235
+ // ============================================================================
236
+ // Auto-set CXXFLAGS for current session
237
+ // ============================================================================
238
+
239
+ function setCxxFlagsForCurrentSession(): boolean {
240
+ try {
241
+ process.env.CXXFLAGS = '"-std=c++20"';
242
+ process.env.npm_config_cxxflags = '"-std=c++20"';
243
+ console.log(c.green('✓ CXXFLAGS set for current session'));
208
244
  return true;
209
245
  } catch {
210
246
  return false;
@@ -243,9 +279,11 @@ function autoInstallCliTools(tools: CliCheck[]): { success: string[]; failed: st
243
279
  // ============================================================================
244
280
 
245
281
  function runDoctor(autoFix = false): DoctorOutput {
282
+ const cxxflags = checkCxxFlags();
283
+
246
284
  const output: DoctorOutput = {
247
285
  status: 'ready',
248
- version: '1.6.4',
286
+ version: '1.6.6',
249
287
  summary: getSystemInfo(),
250
288
  checks: {
251
289
  agentTools: { total: 0, installed: 0, items: [] },
@@ -253,13 +291,19 @@ function runDoctor(autoFix = false): DoctorOutput {
253
291
  },
254
292
  actionItems: [],
255
293
  quickInstall: '',
256
- cxxflagsStatus: checkCxxFlags(),
294
+ cxxflagsStatus: cxxflags.inSession ? 'ready' : cxxflags.inConfig === 'set' ? 'in-config' : 'not-set',
257
295
  };
258
296
 
259
297
  // 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()) {
298
+ if (autoFix) {
299
+ console.log(c.cyan('\n🔧 Auto-fixing...\n'));
300
+
301
+ // Set for current session
302
+ setCxxFlagsForCurrentSession();
303
+
304
+ // Add to shell config
305
+ if (cxxflags.inConfig !== 'set') {
306
+ autoFixCxxFlags();
263
307
  output.cxxflagsStatus = 'auto-fixed';
264
308
  }
265
309
  }
@@ -326,19 +370,21 @@ function runDoctor(autoFix = false): DoctorOutput {
326
370
  output.status = 'needs-setup';
327
371
  }
328
372
 
329
- // Auto-install if requested
373
+ // Auto-install CLI tools if requested
330
374
  if (autoFix && missingTools.length > 0) {
331
- console.log(c.cyan('\n🔧 Auto-installing CLI tools...\n'));
375
+ console.log(c.cyan('\n🔧 Installing CLI tools...\n'));
332
376
  const installResult = autoInstallCliTools(missingTools);
333
377
 
334
378
  // Re-check after installation
335
379
  if (installResult.success.length > 0) {
336
380
  for (const name of installResult.success) {
337
381
  const tool = output.checks.cliTools.items.find(t => t.name === name);
338
- if (tool) tool.installed = true;
382
+ if (tool) {
383
+ tool.installed = true;
384
+ tool.version = 'installed';
385
+ }
339
386
  }
340
387
  output.checks.cliTools.available = output.checks.cliTools.items.filter(t => t.installed).length;
341
- missingTools.length; // Refresh
342
388
  }
343
389
  }
344
390
 
@@ -389,12 +435,16 @@ function printDoctor(output: DoctorOutput) {
389
435
 
390
436
  // C++20 status
391
437
  console.log('\n⚡ C++20 for native modules:');
392
- if (output.cxxflagsStatus === 'set') {
393
- console.log(' ' + c.green('✓ Already configured in shell'));
438
+ if (output.cxxflagsStatus === 'ready') {
439
+ console.log(' ' + c.green('✓ Active in session'));
440
+ } else if (output.cxxflagsStatus === 'in-config') {
441
+ console.log(' ' + c.yellow('⚠ Configured but not active in current session'));
442
+ console.log(' ' + c.gray(' Run: source ~/.bashrc'));
394
443
  } else if (output.cxxflagsStatus === 'auto-fixed') {
395
- console.log(' ' + c.green('✓ Auto-configured! (run "source ~/.bashrc" or restart terminal)'));
444
+ console.log(' ' + c.green('✓ Configured!'));
445
+ console.log(' ' + c.gray(' Run: source ~/.bashrc to activate'));
396
446
  } else {
397
- console.log(' ' + c.yellow('○ Not set (needed for @ast-grep/napi)'));
447
+ console.log(' ' + c.red('○ Not set (needed for @ast-grep/napi)'));
398
448
  console.log(' ' + c.gray(' Run with --fix to auto-configure'));
399
449
  }
400
450
 
package/dist/index.js CHANGED
@@ -17850,15 +17850,18 @@ function checkCxxFlags() {
17850
17850
  path6.join(process.env.HOME || "", ".bashrc"),
17851
17851
  path6.join(process.env.HOME || "", ".zshrc")
17852
17852
  ];
17853
+ let inConfig = false;
17853
17854
  for (const config2 of configs) {
17854
17855
  if (fs5.existsSync(config2)) {
17855
17856
  const content = fs5.readFileSync(config2, "utf-8");
17856
- if (content.includes('CXXFLAGS="-std=c++20"')) {
17857
- return "set";
17857
+ if (content.includes("CXXFLAGS")) {
17858
+ inConfig = true;
17859
+ break;
17858
17860
  }
17859
17861
  }
17860
17862
  }
17861
- return "not-set";
17863
+ const inSession = !!process.env.CXXFLAGS;
17864
+ return { inConfig, inSession };
17862
17865
  }
17863
17866
  var hiveDoctorTool = tool({
17864
17867
  description: `Hive Doctor - System health check for Hive plugin.
@@ -17876,14 +17879,16 @@ var hiveDoctorTool = tool({
17876
17879
  **Tip:** Run standalone for auto-fix: \`bunx @hung319/opencode-hive doctor --fix\``,
17877
17880
  args: {},
17878
17881
  async execute() {
17882
+ const cxxflags = checkCxxFlags();
17879
17883
  const result = {
17880
17884
  status: "ready",
17881
- version: "1.6.4",
17885
+ version: "1.6.6",
17882
17886
  checks: {
17883
17887
  agentTools: { total: 0, installed: 0, items: [] },
17884
17888
  cliTools: { total: 0, available: 0, items: [] }
17885
17889
  },
17886
- cxxflagsStatus: checkCxxFlags(),
17890
+ cxxflagsStatus: cxxflags.inSession ? "ready" : cxxflags.inConfig ? "in-config" : "not-set",
17891
+ cxxflagsHint: cxxflags.inSession ? "Active in session" : cxxflags.inConfig ? "Run: source ~/.bashrc" : "Run: bunx @hung319/opencode-hive doctor --fix",
17887
17892
  actionItems: [],
17888
17893
  quickInstall: ""
17889
17894
  };
@@ -17922,11 +17927,11 @@ var hiveDoctorTool = tool({
17922
17927
  reason: "Agent tools provide faster editing and memory"
17923
17928
  });
17924
17929
  }
17925
- if (result.cxxflagsStatus === "not-set") {
17930
+ if (result.cxxflagsStatus !== "ready") {
17926
17931
  result.actionItems.push({
17927
17932
  priority: "low",
17928
17933
  action: "Enable C++20 for native modules",
17929
- command: `echo 'export CXXFLAGS="-std=c++20"' >> ~/.bashrc`,
17934
+ command: `bunx @hung319/opencode-hive doctor --fix`,
17930
17935
  reason: "Required for @ast-grep/napi tree-sitter build"
17931
17936
  });
17932
17937
  }
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.6",
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",