create-byan-agent 2.11.3 → 2.12.1

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.
@@ -1489,10 +1489,100 @@ async function install() {
1489
1489
  soulSpinner.warn(`Soul setup had issues: ${soulError.message}`);
1490
1490
  console.log(chalk.yellow(' Soul files can be added manually later'));
1491
1491
  }
1492
-
1492
+
1493
1493
  console.log('');
1494
1494
  }
1495
-
1495
+
1496
+ // Step 8.7: BYAN API Backend (optional)
1497
+ console.log('');
1498
+ console.log(chalk.blue('--- BYAN API Backend (optional) ---'));
1499
+ console.log(chalk.gray('Connect this BYAN install to a running byan-api server'));
1500
+ console.log(chalk.gray('(centralized agent state, FD history, ELO, kanban, workflow-scripts).'));
1501
+ console.log('');
1502
+
1503
+ const { apiUrl } = await inquirer.prompt([{
1504
+ type: 'input',
1505
+ name: 'apiUrl',
1506
+ message: 'BYAN API URL (leave empty to skip):',
1507
+ default: process.env.BYAN_API_URL || ''
1508
+ }]);
1509
+
1510
+ let apiToken = '';
1511
+ if (apiUrl.trim()) {
1512
+ const tokenAns = await inquirer.prompt([{
1513
+ type: 'password',
1514
+ name: 'apiToken',
1515
+ message: 'BYAN API token (leave empty for public endpoints only):',
1516
+ mask: '*',
1517
+ default: process.env.BYAN_API_TOKEN || ''
1518
+ }]);
1519
+ apiToken = (tokenAns.apiToken || '').trim();
1520
+ }
1521
+
1522
+ const apiConfigured = Boolean(apiUrl.trim());
1523
+ const apiUrlFinal = apiUrl.trim();
1524
+
1525
+ if (apiConfigured) {
1526
+ const apiSpinner = ora('Configuring BYAN API integration...').start();
1527
+ try {
1528
+ // Copy embedded MCP server from the create-byan-agent package to the project
1529
+ const mcpSrcDir = path.join(__dirname, '..', '..', '_byan', 'mcp', 'byan-mcp-server');
1530
+ const mcpDstDir = path.join(projectRoot, '_byan', 'mcp', 'byan-mcp-server');
1531
+
1532
+ if (await fs.pathExists(mcpSrcDir)) {
1533
+ await fs.ensureDir(path.dirname(mcpDstDir));
1534
+ await fs.copy(mcpSrcDir, mcpDstDir, {
1535
+ filter: (src) => !src.includes('node_modules') && !src.endsWith('package-lock.json') && !src.includes('/test/'),
1536
+ overwrite: true
1537
+ });
1538
+ }
1539
+
1540
+ // Install MCP server dependencies (so `node server.js` runs)
1541
+ const mcpServerJs = path.join(mcpDstDir, 'server.js');
1542
+ if (await fs.pathExists(mcpServerJs)) {
1543
+ const { execSync } = require('child_process');
1544
+ try {
1545
+ execSync('npm install --silent --omit=dev --no-audit --no-fund', {
1546
+ cwd: mcpDstDir,
1547
+ stdio: 'pipe'
1548
+ });
1549
+ } catch (npmErr) {
1550
+ apiSpinner.warn(`MCP npm install failed: ${npmErr.message.split('\n')[0]}`);
1551
+ }
1552
+ }
1553
+
1554
+ // Write / merge .mcp.json
1555
+ const mcpConfigPath = path.join(projectRoot, '.mcp.json');
1556
+ let mcpConfig = { mcpServers: {} };
1557
+ if (await fs.pathExists(mcpConfigPath)) {
1558
+ try { mcpConfig = await fs.readJson(mcpConfigPath); } catch { /* overwrite invalid */ }
1559
+ if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
1560
+ }
1561
+
1562
+ mcpConfig.mcpServers.byan = {
1563
+ command: 'node',
1564
+ args: [mcpServerJs],
1565
+ env: {
1566
+ BYAN_API_URL: apiUrlFinal,
1567
+ ...(apiToken ? { BYAN_API_TOKEN: apiToken } : {})
1568
+ }
1569
+ };
1570
+
1571
+ await fs.writeJson(mcpConfigPath, mcpConfig, { spaces: 2 });
1572
+ apiSpinner.succeed(`BYAN API configured → .mcp.json (${apiUrlFinal})`);
1573
+ console.log(chalk.gray(` MCP server installed at ${path.relative(projectRoot, mcpServerJs)}`));
1574
+ if (!apiToken) {
1575
+ console.log(chalk.yellow(' Note: no token set — authenticated tools (list_projects, kanban, FD, etc.) will fail.'));
1576
+ }
1577
+ } catch (apiError) {
1578
+ apiSpinner.warn(`API config failed: ${apiError.message}`);
1579
+ console.log(chalk.yellow(' You can configure it manually later by editing .mcp.json'));
1580
+ }
1581
+ } else {
1582
+ console.log(chalk.gray(' Skipped. Configure later by editing .mcp.json.'));
1583
+ }
1584
+ console.log('');
1585
+
1496
1586
  // Step 9: Create package.json script
1497
1587
  const shortcutSpinner = ora('Creating shortcuts...').start();
1498
1588
 
@@ -1527,6 +1617,11 @@ async function install() {
1527
1617
  checks.push({ name: 'Soul file', path: path.join(byanDir, 'soul.md') });
1528
1618
  checks.push({ name: 'Soul memory', path: path.join(byanDir, 'soul-memory.md') });
1529
1619
  }
1620
+
1621
+ // BYAN API backend check
1622
+ if (apiConfigured) {
1623
+ checks.push({ name: 'BYAN API config (.mcp.json)', path: path.join(projectRoot, '.mcp.json') });
1624
+ }
1530
1625
 
1531
1626
  // Platform-specific checks based on installation mode
1532
1627
  if (isManual) {
@@ -1607,6 +1702,7 @@ async function install() {
1607
1702
  console.log(` • Language: ${chalk.cyan(config.language)}`);
1608
1703
  console.log(` • Turbo Whisper: ${chalk.cyan(turboWhisperInstalled ? `Installed (${turboWhisperMode} mode)` : 'Not installed')}`);
1609
1704
  console.log(` • Soul System: ${chalk.cyan(soulMode === 'skip' ? 'Not installed' : `${soulMode} mode`)}`);
1705
+ console.log(` • BYAN API: ${chalk.cyan(apiConfigured ? `${apiUrlFinal}${apiToken ? ' (with token)' : ' (no token)'}` : 'Not configured')}`);
1610
1706
  console.log(` • Model Selector: ${chalk.cyan('Integrated (Auto cost optimization)')}`);
1611
1707
 
1612
1708
  if (isManual && manualSelection) {
@@ -1682,6 +1778,16 @@ async function install() {
1682
1778
  console.log(chalk.gray(' Documentation: TURBO-WHISPER-SETUP.md'));
1683
1779
  }
1684
1780
 
1781
+ // BYAN MCP instructions (if API configured)
1782
+ if (apiConfigured) {
1783
+ console.log('');
1784
+ console.log(chalk.yellow('🔌 BYAN MCP tools (available in Claude Code):'));
1785
+ console.log(chalk.gray(' list_projects, FD lifecycle, kanban, ELO, fact-check,'));
1786
+ console.log(chalk.gray(' peer-review, standup, workflow-node-scripts (9 tools).'));
1787
+ console.log(chalk.gray(' → Restart Claude Code to load the MCP server.'));
1788
+ console.log(chalk.gray(` → First call will npx-install byan-mcp-server automatically.`));
1789
+ }
1790
+
1685
1791
  console.log('');
1686
1792
  console.log(chalk.gray('Need help? Type \'/bmad-help\' when BYAN is active'));
1687
1793
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "2.11.3",
3
+ "version": "2.12.1",
4
4
  "description": "BYAN v2.6.1 - Intelligent AI agent creator with ELO trust system + scientific fact-check + Hermes universal dispatcher. Multi-platform (Copilot CLI, Claude Code, Codex). Merise Agile + TDD + 64 Mantras. ~54% LLM cost savings.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -45,6 +45,11 @@
45
45
  "files": [
46
46
  "src/",
47
47
  "install/",
48
+ "_byan/mcp/byan-mcp-server/server.js",
49
+ "_byan/mcp/byan-mcp-server/lib/",
50
+ "_byan/mcp/byan-mcp-server/package.json",
51
+ "_byan/mcp/byan-mcp-server/README.md",
52
+ "_byan/mcp/byan-mcp-server/LICENSE",
48
53
  "README.md",
49
54
  "CHANGELOG.md",
50
55
  "CHANGELOG-v2.1.0.md",
@@ -56,6 +61,7 @@
56
61
  "LICENSE"
57
62
  ],
58
63
  "dependencies": {
64
+ "@modelcontextprotocol/sdk": "^1.29.0",
59
65
  "chalk": "^4.1.2",
60
66
  "commander": "^11.1.0",
61
67
  "fs-extra": "^11.2.0",