eacn3 0.5.0 → 0.6.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/scripts/cli.cjs CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  /**
3
3
  * cli.js — `eacn3` CLI entry point
4
4
  * Usage:
@@ -13,6 +13,8 @@ const os = require('os');
13
13
 
14
14
  const PKG_ROOT = path.resolve(__dirname, '..');
15
15
  const PLUGIN_ID = 'eacn3';
16
+ const IS_WIN = process.platform === 'win32';
17
+ const NPX_CMD = IS_WIN ? 'npx.cmd' : 'npx';
16
18
  const EXT_DIR = path.join(os.homedir(), '.openclaw', 'extensions', PLUGIN_ID);
17
19
  const CONFIG_PATH = path.join(os.homedir(), '.openclaw', 'openclaw.json');
18
20
 
@@ -314,7 +316,7 @@ function setupOpenclaw() {
314
316
  source: 'path',
315
317
  sourcePath: PKG_ROOT,
316
318
  installPath: EXT_DIR,
317
- version: pkg.version || '0.5.0',
319
+ version: pkg.version || '0.5.1',
318
320
  installedAt: new Date().toISOString()
319
321
  };
320
322
  ok('plugins.installs: metadata recorded');
@@ -345,7 +347,7 @@ function setupOpenclaw() {
345
347
 
346
348
  function setupClaudeCode(scope) {
347
349
  console.log('\neacn3 setup — Claude Code\n');
348
- const serverJs = ensureBuild();
350
+ ensureBuild();
349
351
 
350
352
  let configPath;
351
353
  if (scope === 'global') {
@@ -358,8 +360,8 @@ function setupClaudeCode(scope) {
358
360
  if (!config.mcpServers) config.mcpServers = {};
359
361
  config.mcpServers.eacn3 = {
360
362
  type: 'stdio',
361
- command: 'node',
362
- args: [serverJs],
363
+ command: NPX_CMD,
364
+ args: ['eacn3', 'serve'],
363
365
  };
364
366
 
365
367
  writeJSON(configPath, config);
@@ -381,7 +383,7 @@ function setupClaudeCode(scope) {
381
383
 
382
384
  function setupCursor(scope) {
383
385
  console.log('\neacn3 setup — Cursor\n');
384
- const serverJs = ensureBuild();
386
+ ensureBuild();
385
387
 
386
388
  let configPath;
387
389
  if (scope === 'global') {
@@ -393,8 +395,8 @@ function setupCursor(scope) {
393
395
  const config = readJSON(configPath);
394
396
  if (!config.mcpServers) config.mcpServers = {};
395
397
  config.mcpServers.eacn3 = {
396
- command: 'node',
397
- args: [serverJs],
398
+ command: NPX_CMD,
399
+ args: ['eacn3', 'serve'],
398
400
  };
399
401
 
400
402
  writeJSON(configPath, config);
@@ -415,7 +417,7 @@ function setupCursor(scope) {
415
417
 
416
418
  function setupCodex(scope) {
417
419
  console.log('\neacn3 setup — Codex\n');
418
- const serverJs = ensureBuild();
420
+ ensureBuild();
419
421
 
420
422
  let configPath;
421
423
  if (scope === 'global') {
@@ -437,8 +439,8 @@ function setupCodex(scope) {
437
439
  const block = [
438
440
  '',
439
441
  '[mcp_servers.eacn3]',
440
- `command = "node"`,
441
- `args = [${JSON.stringify(serverJs)}]`,
442
+ `command = "${NPX_CMD}"`,
443
+ `args = ["eacn3", "serve"]`,
442
444
  'enabled = true',
443
445
  '',
444
446
  ].join('\n');
@@ -547,12 +549,13 @@ async function clusterStatus(endpoint) {
547
549
 
548
550
  function showHelp() {
549
551
  console.log(`
550
- eacn3 — EACN3 network plugin CLI (v${readJSON(path.join(PKG_ROOT, 'package.json')).version || '0.5.0'})
552
+ eacn3 — EACN3 network plugin CLI (v${readJSON(path.join(PKG_ROOT, 'package.json')).version || '0.5.1'})
551
553
 
552
554
  Usage:
553
555
  eacn3 <command> [target] [options]
554
556
 
555
557
  Commands:
558
+ serve Start the MCP stdio server (used by client configs)
556
559
  setup [target] Install plugin for a specific client
557
560
  diagnose | doctor Run full diagnostics on plugin installation
558
561
  health [endpoint] Probe a network node's /health endpoint
@@ -584,6 +587,20 @@ const DEFAULT_ENDPOINT = process.env.EACN3_NETWORK_URL || 'https://network.eacn3
584
587
  const cmd = process.argv[2];
585
588
 
586
589
  switch (cmd) {
590
+ case 'serve':
591
+ case 'server':
592
+ case 'start': {
593
+ // Launch the MCP stdio server — used by MCP client configs
594
+ const serverJs = path.join(PKG_ROOT, 'dist', 'server.js');
595
+ if (!fs.existsSync(serverJs)) {
596
+ console.error('dist/server.js not found — run "npm run build" first');
597
+ process.exit(1);
598
+ }
599
+ const { execFileSync: run } = require('child_process');
600
+ try { run(process.execPath, [serverJs], { stdio: 'inherit' }); }
601
+ catch (e) { process.exit(e.status || 1); }
602
+ break;
603
+ }
587
604
  case 'setup':
588
605
  setupRouter();
589
606
  break;