create-byan-agent 2.9.2 → 2.9.3

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.
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Build Copilot CLI agent stubs from BYAN source files.
5
+ *
6
+ * Copilot CLI treats .github/agents/*.md as system instructions.
7
+ * It does NOT dynamically load files referenced in the content.
8
+ * This script inlines the full agent + soul + tao content into
9
+ * each stub so Copilot CLI has everything it needs.
10
+ *
11
+ * Usage: node build-copilot-stubs.js [--agent byan] [--all]
12
+ */
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+
17
+ const ROOT = path.resolve(__dirname, '..', '..');
18
+ const AGENTS_DIR = path.join(ROOT, '.github', 'agents');
19
+ const BYAN_DIR = path.join(ROOT, '_byan');
20
+
21
+ function readFile(filePath) {
22
+ try {
23
+ return fs.readFileSync(filePath, 'utf-8');
24
+ } catch {
25
+ return null;
26
+ }
27
+ }
28
+
29
+ function stripFrontmatter(content) {
30
+ return content.replace(/^---\s*\n[\s\S]*?\n---\s*\n?/, '');
31
+ }
32
+
33
+ function buildByanStub() {
34
+ const agentContent = readFile(path.join(BYAN_DIR, 'agents', 'byan.md'));
35
+ if (!agentContent) {
36
+ console.error('Cannot read _byan/agents/byan.md');
37
+ process.exit(1);
38
+ }
39
+
40
+ const soulContent = readFile(path.join(BYAN_DIR, 'soul.md'));
41
+ const taoContent = readFile(path.join(BYAN_DIR, 'tao.md'));
42
+ const soulActivation = readFile(path.join(BYAN_DIR, 'core', 'activation', 'soul-activation.md'));
43
+
44
+ const agentBody = stripFrontmatter(agentContent);
45
+ const soulBody = soulContent ? stripFrontmatter(soulContent) : '';
46
+ const taoBody = taoContent ? stripFrontmatter(taoContent) : '';
47
+ const activationBody = soulActivation ? stripFrontmatter(soulActivation) : '';
48
+
49
+ const stub = `---
50
+ name: 'byan'
51
+ description: 'BYAN - Builder of YAN - Agent Creator Specialist'
52
+ ---
53
+
54
+ ${agentBody}
55
+
56
+ <!-- ============================================================ -->
57
+ <!-- INLINED: Soul System (soul.md + tao.md + soul-activation.md) -->
58
+ <!-- ============================================================ -->
59
+
60
+ <soul-system>
61
+
62
+ <!-- soul.md -->
63
+ ${soulBody}
64
+
65
+ <!-- tao.md -->
66
+ ${taoBody}
67
+
68
+ <!-- soul-activation.md -->
69
+ ${activationBody}
70
+
71
+ </soul-system>
72
+ `;
73
+
74
+ const outPath = path.join(AGENTS_DIR, 'bmad-agent-byan.md');
75
+ fs.writeFileSync(outPath, stub, 'utf-8');
76
+
77
+ const size = Buffer.byteLength(stub, 'utf-8');
78
+ console.log(`Built: ${outPath} (${(size / 1024).toFixed(1)} KB)`);
79
+ return outPath;
80
+ }
81
+
82
+ function buildModuleAgentStub(agentName, moduleName) {
83
+ const agentPath = path.join(BYAN_DIR, moduleName, 'agents', `${agentName}.md`);
84
+ const agentContent = readFile(agentPath);
85
+ if (!agentContent) {
86
+ console.error(`Cannot read ${agentPath}`);
87
+ return null;
88
+ }
89
+
90
+ const agentBody = stripFrontmatter(agentContent);
91
+
92
+ const soulPath = path.join(BYAN_DIR, moduleName, 'agents', `${agentName}-soul.md`);
93
+ const soulContent = readFile(soulPath);
94
+ const soulSection = soulContent ? `\n<!-- soul: ${agentName}-soul.md -->\n${stripFrontmatter(soulContent)}\n` : '';
95
+
96
+ const stub = `---
97
+ name: '${agentName}'
98
+ description: '${agentName} agent'
99
+ ---
100
+
101
+ ${agentBody}
102
+ ${soulSection}
103
+ `;
104
+
105
+ const outPath = path.join(AGENTS_DIR, `bmad-agent-${agentName}.md`);
106
+ fs.writeFileSync(outPath, stub, 'utf-8');
107
+
108
+ const size = Buffer.byteLength(stub, 'utf-8');
109
+ console.log(`Built: ${outPath} (${(size / 1024).toFixed(1)} KB)`);
110
+ return outPath;
111
+ }
112
+
113
+ // --- CLI ---
114
+ const args = process.argv.slice(2);
115
+ const agentArg = args.indexOf('--agent') >= 0 ? args[args.indexOf('--agent') + 1] : null;
116
+ const buildAll = args.includes('--all');
117
+
118
+ if (agentArg === 'byan' || buildAll || args.length === 0) {
119
+ buildByanStub();
120
+ }
121
+
122
+ if (agentArg && agentArg !== 'byan') {
123
+ const mod = args.indexOf('--module') >= 0 ? args[args.indexOf('--module') + 1] : 'bmm';
124
+ buildModuleAgentStub(agentArg, mod);
125
+ }
126
+
127
+ if (buildAll || args.length === 0) {
128
+ console.log('\nDone. Run this after editing _byan/agents/byan.md, soul.md, or tao.md.');
129
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "2.9.2",
3
+ "version": "2.9.3",
4
4
  "description": "BYAN v2.2.2 - Intelligent AI agent installer with multi-platform native support (GitHub Copilot CLI, Claude Code, Codex/OpenCode)",
5
5
  "bin": {
6
6
  "create-byan-agent": "bin/create-byan-agent-v2.js"
@@ -22,10 +22,8 @@ class ClaudeAdapter extends Bridge {
22
22
  ];
23
23
 
24
24
  if (this.agent) {
25
- const agentPath = this.resolveAgent(this.agent);
26
- if (agentPath) {
27
- args.push('--agent', agentPath);
28
- }
25
+ // Claude Code expects agent name, not file path
26
+ args.push('--agent', this.agent);
29
27
  }
30
28
 
31
29
  if (this.model) {
@@ -18,10 +18,8 @@ class CopilotAdapter extends Bridge {
18
18
  const args = [];
19
19
 
20
20
  if (this.agent) {
21
- const agentPath = this.resolveAgent(this.agent);
22
- if (agentPath) {
23
- args.push(`--agent=${agentPath}`);
24
- }
21
+ // Copilot CLI expects agent name, not file path
22
+ args.push(`--agent=${this.agent}`);
25
23
  }
26
24
 
27
25
  args.push('--prompt', message);