create-byan-agent 2.0.1 → 2.1.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.
- package/API-BYAN-V2.md +741 -0
- package/BMAD-QUICK-REFERENCE.md +370 -0
- package/CHANGELOG-v2.1.0.md +371 -0
- package/LICENSE +1 -1
- package/MIGRATION-v2.0-to-v2.1.md +430 -0
- package/README-BYAN-V2.md +446 -0
- package/README.md +264 -201
- package/install/.eslintrc.js +20 -0
- package/install/.prettierrc +7 -0
- package/install/BUGFIX-CHALK.md +173 -0
- package/install/BUGFIX-DOCUMENTATION-INDEX.md +299 -0
- package/install/BUGFIX-PATH-RESOLUTION.md +293 -0
- package/install/BUGFIX-QUICKSTART.md +184 -0
- package/install/BUGFIX-SUMMARY.txt +91 -0
- package/install/BUGFIX-VISUAL-SUMMARY.md +253 -0
- package/install/DEPLOYMENT-GUIDE-V2.md +431 -0
- package/install/DOCS-INDEX.md +261 -0
- package/install/GUIDE-INSTALLATION-BYAN-SIMPLE.md +1083 -0
- package/install/INSTALLER-V2-CHANGES.md +472 -0
- package/install/LICENSE +21 -0
- package/install/PUBLICATION-CHECKLIST.md +265 -0
- package/install/PUBLISH-GUIDE.md +190 -0
- package/install/QUICKSTART.md +311 -0
- package/install/README-NPM-PUBLISH.md +298 -0
- package/install/README-NPM-SHORT.md +298 -0
- package/install/README-NPM.md +433 -0
- package/install/README-RACHID.md +302 -0
- package/install/README-V2-INDEX.md +306 -0
- package/install/README.md +298 -0
- package/install/RESUME-EXECUTIF-YAN.md +408 -0
- package/install/UPDATE-SUMMARY.md +205 -0
- package/install/__tests__/integration/detection-flow.test.js +154 -0
- package/install/__tests__/platforms/claude-code.test.js +175 -0
- package/install/__tests__/platforms/codex.test.js +80 -0
- package/install/__tests__/platforms/copilot-cli.test.js +118 -0
- package/install/__tests__/platforms/vscode.test.js +67 -0
- package/install/__tests__/utils/file-utils.test.js +87 -0
- package/install/__tests__/utils/git-detector.test.js +80 -0
- package/install/__tests__/utils/logger.test.js +83 -0
- package/install/__tests__/utils/node-detector.test.js +71 -0
- package/install/__tests__/utils/os-detector.test.js +63 -0
- package/install/__tests__/utils/yaml-utils.test.js +85 -0
- package/install/__tests__/yanstaller/detector.test.js +210 -0
- package/install/coverage/clover.xml +219 -0
- package/install/coverage/coverage-final.json +13 -0
- package/install/coverage/lcov-report/base.css +224 -0
- package/install/coverage/lcov-report/block-navigation.js +87 -0
- package/install/coverage/lcov-report/favicon.png +0 -0
- package/install/coverage/lcov-report/index.html +146 -0
- package/install/coverage/lcov-report/lib/errors.js.html +268 -0
- package/install/coverage/lcov-report/lib/exit-codes.js.html +247 -0
- package/install/coverage/lcov-report/lib/index.html +131 -0
- package/install/coverage/lcov-report/lib/platforms/claude-code.js.html +343 -0
- package/install/coverage/lcov-report/lib/platforms/codex.js.html +361 -0
- package/install/coverage/lcov-report/lib/platforms/copilot-cli.js.html +454 -0
- package/install/coverage/lcov-report/lib/platforms/index.html +176 -0
- package/install/coverage/lcov-report/lib/platforms/index.js.html +127 -0
- package/install/coverage/lcov-report/lib/platforms/vscode.js.html +238 -0
- package/install/coverage/lcov-report/lib/utils/config-loader.js.html +322 -0
- package/install/coverage/lcov-report/lib/utils/file-utils.js.html +397 -0
- package/install/coverage/lcov-report/lib/utils/git-detector.js.html +190 -0
- package/install/coverage/lcov-report/lib/utils/index.html +206 -0
- package/install/coverage/lcov-report/lib/utils/logger.js.html +277 -0
- package/install/coverage/lcov-report/lib/utils/node-detector.js.html +259 -0
- package/install/coverage/lcov-report/lib/utils/os-detector.js.html +307 -0
- package/install/coverage/lcov-report/lib/utils/yaml-utils.js.html +346 -0
- package/install/coverage/lcov-report/lib/yanstaller/backuper.js.html +409 -0
- package/install/coverage/lcov-report/lib/yanstaller/detector.js.html +508 -0
- package/install/coverage/lcov-report/lib/yanstaller/index.html +236 -0
- package/install/coverage/lcov-report/lib/yanstaller/index.js.html +364 -0
- package/install/coverage/lcov-report/lib/yanstaller/installer.js.html +505 -0
- package/install/coverage/lcov-report/lib/yanstaller/interviewer.js.html +349 -0
- package/install/coverage/lcov-report/lib/yanstaller/recommender.js.html +379 -0
- package/install/coverage/lcov-report/lib/yanstaller/troubleshooter.js.html +352 -0
- package/install/coverage/lcov-report/lib/yanstaller/validator.js.html +679 -0
- package/install/coverage/lcov-report/lib/yanstaller/wizard.js.html +412 -0
- package/install/coverage/lcov-report/platforms/claude-code.js.html +343 -0
- package/install/coverage/lcov-report/platforms/codex.js.html +361 -0
- package/install/coverage/lcov-report/platforms/copilot-cli.js.html +454 -0
- package/install/coverage/lcov-report/platforms/index.html +176 -0
- package/install/coverage/lcov-report/platforms/index.js.html +127 -0
- package/install/coverage/lcov-report/platforms/vscode.js.html +238 -0
- package/install/coverage/lcov-report/prettify.css +1 -0
- package/install/coverage/lcov-report/prettify.js +2 -0
- package/install/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/install/coverage/lcov-report/sorter.js +210 -0
- package/install/coverage/lcov-report/utils/file-utils.js.html +397 -0
- package/install/coverage/lcov-report/utils/git-detector.js.html +190 -0
- package/install/coverage/lcov-report/utils/index.html +191 -0
- package/install/coverage/lcov-report/utils/logger.js.html +277 -0
- package/install/coverage/lcov-report/utils/node-detector.js.html +259 -0
- package/install/coverage/lcov-report/utils/os-detector.js.html +307 -0
- package/install/coverage/lcov-report/utils/yaml-utils.js.html +346 -0
- package/install/coverage/lcov-report/yanstaller/detector.js.html +508 -0
- package/install/coverage/lcov-report/yanstaller/index.html +116 -0
- package/install/coverage/lcov.info +414 -0
- package/install/install.sh +239 -0
- package/install/jest.config.js +33 -0
- package/install/lib/errors.js +61 -0
- package/install/lib/exit-codes.js +54 -0
- package/install/lib/platforms/claude-code.js +86 -0
- package/install/lib/platforms/codex.js +92 -0
- package/install/lib/platforms/copilot-cli.js +123 -0
- package/install/lib/platforms/index.js +14 -0
- package/install/lib/platforms/vscode.js +51 -0
- package/install/lib/utils/config-loader.js +79 -0
- package/install/lib/utils/file-utils.js +104 -0
- package/install/lib/utils/git-detector.js +35 -0
- package/install/lib/utils/logger.js +64 -0
- package/install/lib/utils/node-detector.js +58 -0
- package/install/lib/utils/os-detector.js +74 -0
- package/install/lib/utils/yaml-utils.js +87 -0
- package/install/lib/yanstaller/backuper.js +108 -0
- package/install/lib/yanstaller/detector.js +141 -0
- package/install/lib/yanstaller/index.js +93 -0
- package/install/lib/yanstaller/installer.js +140 -0
- package/install/lib/yanstaller/interviewer.js +88 -0
- package/install/lib/yanstaller/recommender.js +98 -0
- package/install/lib/yanstaller/troubleshooter.js +89 -0
- package/install/lib/yanstaller/validator.js +198 -0
- package/install/lib/yanstaller/wizard.js +109 -0
- package/install/package-npm.json +55 -0
- package/install/package.json +63 -0
- package/install/src/byan-v2/context/copilot-context.js +79 -0
- package/install/src/byan-v2/context/session-state.js +98 -0
- package/install/src/byan-v2/dispatcher/complexity-scorer.js +232 -0
- package/install/src/byan-v2/dispatcher/local-executor.js +221 -0
- package/install/src/byan-v2/dispatcher/task-router.js +122 -0
- package/install/src/byan-v2/dispatcher/task-tool-interface-mock.js +134 -0
- package/install/src/byan-v2/dispatcher/task-tool-interface.js +123 -0
- package/install/src/byan-v2/generation/agent-profile-validator.js +113 -0
- package/install/src/byan-v2/generation/profile-template.js +113 -0
- package/install/src/byan-v2/generation/templates/default-agent.md +49 -0
- package/install/src/byan-v2/generation/templates/test-template.md +1 -0
- package/install/src/byan-v2/index.js +199 -0
- package/install/src/byan-v2/observability/error-tracker.js +105 -0
- package/install/src/byan-v2/observability/logger.js +154 -0
- package/install/src/byan-v2/observability/metrics-collector.js +194 -0
- package/install/src/byan-v2/orchestrator/analysis-state.js +268 -0
- package/install/src/byan-v2/orchestrator/generation-state.js +340 -0
- package/install/src/byan-v2/orchestrator/interview-state.js +271 -0
- package/install/src/byan-v2/orchestrator/state-machine.js +204 -0
- package/install/src/core/cache/cache.js +126 -0
- package/install/src/core/context/context.js +86 -0
- package/install/src/core/dispatcher/dispatcher.js +135 -0
- package/install/src/core/worker-pool/worker-pool.js +194 -0
- package/install/src/core/workflow/workflow-executor.js +220 -0
- package/install/src/index.js +139 -0
- package/install/src/observability/dashboard/dashboard.js +191 -0
- package/install/src/observability/logger/structured-logger.js +254 -0
- package/install/src/observability/metrics/metrics-collector.js +325 -0
- package/install/switch-to-v2.sh +126 -0
- package/install/test-chalk-fix.sh +210 -0
- package/install/test-installer-v2.sh +204 -0
- package/install/test-path-resolution.sh +200 -0
- package/package.json +53 -33
- package/src/byan-v2/context/copilot-context.js +79 -0
- package/src/byan-v2/context/session-state.js +98 -0
- package/src/byan-v2/data/mantras.json +852 -0
- package/src/byan-v2/dispatcher/complexity-scorer.js +232 -0
- package/src/byan-v2/dispatcher/five-whys-analyzer.js +310 -0
- package/src/byan-v2/dispatcher/local-executor.js +221 -0
- package/src/byan-v2/dispatcher/task-router.js +122 -0
- package/src/byan-v2/dispatcher/task-tool-interface-mock.js +134 -0
- package/src/byan-v2/dispatcher/task-tool-interface.js +123 -0
- package/src/byan-v2/generation/agent-profile-validator.js +113 -0
- package/src/byan-v2/generation/mantra-validator.js +416 -0
- package/src/byan-v2/generation/profile-template.js +113 -0
- package/src/byan-v2/generation/templates/default-agent.md +49 -0
- package/src/byan-v2/generation/templates/test-template.md +1 -0
- package/src/byan-v2/index.js +652 -0
- package/src/byan-v2/integration/voice-integration.js +295 -0
- package/src/byan-v2/observability/error-tracker.js +105 -0
- package/src/byan-v2/observability/logger.js +154 -0
- package/src/byan-v2/observability/metrics-collector.js +194 -0
- package/src/byan-v2/orchestrator/active-listener.js +541 -0
- package/src/byan-v2/orchestrator/analysis-state.js +268 -0
- package/src/byan-v2/orchestrator/generation-state.js +340 -0
- package/src/byan-v2/orchestrator/glossary-builder.js +431 -0
- package/src/byan-v2/orchestrator/interview-state.js +353 -0
- package/src/byan-v2/orchestrator/state-machine.js +253 -0
- package/src/core/cache/cache.js +126 -0
- package/src/core/context/context.js +86 -0
- package/src/core/dispatcher/dispatcher.js +135 -0
- package/src/core/worker-pool/worker-pool.js +194 -0
- package/src/core/workflow/workflow-executor.js +220 -0
- package/src/index.js +139 -0
- package/src/observability/dashboard/dashboard.js +191 -0
- package/src/observability/logger/structured-logger.js +254 -0
- package/src/observability/metrics/metrics-collector.js +325 -0
- package/templates/.github/agents/bmad-agent-test-dynamic.md +0 -21
- package/templates/.github/agents/franck.md +0 -379
- /package/{CHANGELOG.md → install/CHANGELOG.md} +0 -0
- /package/{bin → install/bin}/create-byan-agent-backup.js +0 -0
- /package/{bin → install/bin}/create-byan-agent-fixed.js +0 -0
- /package/{bin → install/bin}/create-byan-agent-v2.js +0 -0
- /package/{bin → install/bin}/create-byan-agent.js +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmad-master.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmb-agent-builder.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmb-module-builder.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmb-workflow-builder.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-analyst.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-architect.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-dev.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-pm.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-quick-flow-solo-dev.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-quinn.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-sm.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-tech-writer.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-bmm-ux-designer.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-byan-test.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-byan.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-carmack.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-cis-brainstorming-coach.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-cis-creative-problem-solver.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-cis-design-thinking-coach.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-cis-innovation-strategist.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-cis-presentation-master.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-cis-storyteller.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-marc.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-patnote.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-rachid.md +0 -0
- /package/{templates → install/templates}/.github/agents/bmad-agent-tea-tea.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/agent-builder.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/byan-test.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/byan.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/marc.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/module-builder.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/patnote.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/rachid.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/agents/workflow-builder.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/data/mantras.yaml +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/data/templates.yaml +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/delete-agent-workflow.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/edit-agent-workflow.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/interview-workflow.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/quick-create-workflow.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/templates/base-agent-template.md +0 -0
- /package/{templates → install/templates}/_bmad/bmb/workflows/byan/validate-agent-workflow.md +0 -0
- /package/{templates → install/templates}/_bmad/core/agents/carmack.md +0 -0
package/API-BYAN-V2.md
ADDED
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
# BYAN v2.0 API Documentation
|
|
2
|
+
|
|
3
|
+
Complete API reference for BYAN v2.0 classes and methods.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [ByanV2](#byanv2)
|
|
8
|
+
- [SessionState](#sessionstate)
|
|
9
|
+
- [StateMachine](#statemachine)
|
|
10
|
+
- [AgentProfileValidator](#agentprofilevalidator)
|
|
11
|
+
- [ProfileTemplate](#profiletemplate)
|
|
12
|
+
- [TaskRouter](#taskrouter)
|
|
13
|
+
- [Logger](#logger)
|
|
14
|
+
- [MetricsCollector](#metricscollector)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ByanV2
|
|
19
|
+
|
|
20
|
+
Main class orchestrating BYAN v2 workflow.
|
|
21
|
+
|
|
22
|
+
### Constructor
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
new ByanV2(config?: object)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Parameters:**
|
|
29
|
+
- `config` (optional): Configuration object
|
|
30
|
+
- `sessionId`: Custom session ID (default: auto-generated UUID)
|
|
31
|
+
- `maxQuestions`: Max interview questions (default: 12)
|
|
32
|
+
- `outputDir`: Output directory for agents (default: `./_bmad-output/bmb-creations`)
|
|
33
|
+
- `env`: Environment ('copilot' or 'standalone')
|
|
34
|
+
- `complexityThresholds`: { low: number, medium: number }
|
|
35
|
+
- `sessionState`, `logger`, `stateMachine`: Dependency injection for testing
|
|
36
|
+
|
|
37
|
+
**Example:**
|
|
38
|
+
```javascript
|
|
39
|
+
const byan = new ByanV2({
|
|
40
|
+
maxQuestions: 15,
|
|
41
|
+
outputDir: './my-agents'
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### startSession()
|
|
46
|
+
|
|
47
|
+
Start new interview session and transition to INTERVIEW state.
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
async startSession(): Promise<string>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Returns:** Session ID
|
|
54
|
+
|
|
55
|
+
**Example:**
|
|
56
|
+
```javascript
|
|
57
|
+
const sessionId = await byan.startSession();
|
|
58
|
+
console.log('Session started:', sessionId);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### getNextQuestion()
|
|
62
|
+
|
|
63
|
+
Get next interview question in current phase.
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
async getNextQuestion(): Promise<string>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Returns:** Question text
|
|
70
|
+
|
|
71
|
+
**Throws:** Error if not in INTERVIEW state
|
|
72
|
+
|
|
73
|
+
**Example:**
|
|
74
|
+
```javascript
|
|
75
|
+
const question = await byan.getNextQuestion();
|
|
76
|
+
console.log('Q:', question);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### submitResponse(response)
|
|
80
|
+
|
|
81
|
+
Submit response to current question.
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
async submitResponse(response: string): Promise<{ success: boolean }>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
- `response`: User response (non-empty string)
|
|
89
|
+
|
|
90
|
+
**Returns:** { success: true }
|
|
91
|
+
|
|
92
|
+
**Throws:** Error if response is empty
|
|
93
|
+
|
|
94
|
+
**Example:**
|
|
95
|
+
```javascript
|
|
96
|
+
await byan.submitResponse('My agent will review code');
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### generateProfile()
|
|
100
|
+
|
|
101
|
+
Generate agent profile after completing interview.
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
async generateProfile(): Promise<string>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Returns:** Generated profile content (markdown)
|
|
108
|
+
|
|
109
|
+
**Throws:** Error if called before interview completion
|
|
110
|
+
|
|
111
|
+
**Example:**
|
|
112
|
+
```javascript
|
|
113
|
+
const profile = await byan.generateProfile();
|
|
114
|
+
fs.writeFileSync('agent.md', profile);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### endSession()
|
|
118
|
+
|
|
119
|
+
End current session and transition to COMPLETED state.
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
async endSession(): Promise<{ success: boolean }>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Returns:** { success: true }
|
|
126
|
+
|
|
127
|
+
**Example:**
|
|
128
|
+
```javascript
|
|
129
|
+
await byan.endSession();
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### getMetricsSummary()
|
|
133
|
+
|
|
134
|
+
Get session metrics summary.
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
getMetricsSummary(): object
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Returns:**
|
|
141
|
+
```javascript
|
|
142
|
+
{
|
|
143
|
+
totalSessions: number,
|
|
144
|
+
avgQuestionsPerSession: number,
|
|
145
|
+
successRate: number,
|
|
146
|
+
delegationRate: number,
|
|
147
|
+
questionsAsked: number,
|
|
148
|
+
profilesGenerated: number,
|
|
149
|
+
errors: number
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Example:**
|
|
154
|
+
```javascript
|
|
155
|
+
const metrics = byan.getMetricsSummary();
|
|
156
|
+
console.log('Sessions:', metrics.totalSessions);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### getSessionSummary()
|
|
160
|
+
|
|
161
|
+
Get current session summary.
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
async getSessionSummary(): Promise<object>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Returns:**
|
|
168
|
+
```javascript
|
|
169
|
+
{
|
|
170
|
+
sessionId: string,
|
|
171
|
+
questionsAsked: number,
|
|
172
|
+
state: string,
|
|
173
|
+
timestamp: string (ISO 8601)
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Example:**
|
|
178
|
+
```javascript
|
|
179
|
+
const summary = await byan.getSessionSummary();
|
|
180
|
+
console.log('State:', summary.state);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### isCopilotContext()
|
|
184
|
+
|
|
185
|
+
Check if running in GitHub Copilot CLI context.
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
isCopilotContext(): boolean
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Returns:** true if Copilot CLI environment detected
|
|
192
|
+
|
|
193
|
+
**Example:**
|
|
194
|
+
```javascript
|
|
195
|
+
if (byan.isCopilotContext()) {
|
|
196
|
+
console.log('Running in Copilot CLI');
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## SessionState
|
|
203
|
+
|
|
204
|
+
Manages session state and user responses.
|
|
205
|
+
|
|
206
|
+
### Constructor
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
new SessionState(sessionId: string)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Parameters:**
|
|
213
|
+
- `sessionId`: Unique session identifier
|
|
214
|
+
|
|
215
|
+
### addQuestion(question)
|
|
216
|
+
|
|
217
|
+
Add question to history.
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
addQuestion(question: string): void
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### addResponse(response)
|
|
224
|
+
|
|
225
|
+
Add user response to history.
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
addResponse(response: string): void
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### setAnalysisResults(results)
|
|
232
|
+
|
|
233
|
+
Store analysis results.
|
|
234
|
+
|
|
235
|
+
```javascript
|
|
236
|
+
setAnalysisResults(results: object): void
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Properties
|
|
240
|
+
|
|
241
|
+
- `sessionId`: string - Session ID
|
|
242
|
+
- `currentState`: string - Current state name
|
|
243
|
+
- `questionHistory`: string[] - All questions asked
|
|
244
|
+
- `userResponses`: string[] - All user responses
|
|
245
|
+
- `analysisResults`: object - Analysis results
|
|
246
|
+
- `agentProfileDraft`: string - Draft agent profile
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## StateMachine
|
|
251
|
+
|
|
252
|
+
Manages workflow state transitions.
|
|
253
|
+
|
|
254
|
+
### Constructor
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
new StateMachine(options?: { logger, errorTracker })
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Parameters:**
|
|
261
|
+
- `options.logger`: Logger instance (optional)
|
|
262
|
+
- `options.errorTracker`: ErrorTracker instance (optional)
|
|
263
|
+
|
|
264
|
+
### transition(newState)
|
|
265
|
+
|
|
266
|
+
Transition to new state.
|
|
267
|
+
|
|
268
|
+
```javascript
|
|
269
|
+
async transition(newState: string): Promise<void>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Parameters:**
|
|
273
|
+
- `newState`: Target state ('INTERVIEW', 'ANALYSIS', 'GENERATION', 'COMPLETED', 'ERROR')
|
|
274
|
+
|
|
275
|
+
**Throws:** Error if transition is invalid
|
|
276
|
+
|
|
277
|
+
**Example:**
|
|
278
|
+
```javascript
|
|
279
|
+
await stateMachine.transition('ANALYSIS');
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### getCurrentState()
|
|
283
|
+
|
|
284
|
+
Get current state metadata.
|
|
285
|
+
|
|
286
|
+
```javascript
|
|
287
|
+
getCurrentState(): { name: string, timestamp: number, attempts: number }
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Returns:** State metadata object
|
|
291
|
+
|
|
292
|
+
**Example:**
|
|
293
|
+
```javascript
|
|
294
|
+
const state = stateMachine.getCurrentState();
|
|
295
|
+
console.log('Current state:', state.name);
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### onStateEnter(stateName, callback)
|
|
299
|
+
|
|
300
|
+
Register callback for state entry.
|
|
301
|
+
|
|
302
|
+
```javascript
|
|
303
|
+
onStateEnter(stateName: string, callback: Function): void
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Example:**
|
|
307
|
+
```javascript
|
|
308
|
+
stateMachine.onStateEnter('ANALYSIS', () => {
|
|
309
|
+
console.log('Entering analysis');
|
|
310
|
+
});
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### onStateExit(stateName, callback)
|
|
314
|
+
|
|
315
|
+
Register callback for state exit.
|
|
316
|
+
|
|
317
|
+
```javascript
|
|
318
|
+
onStateExit(stateName: string, callback: Function): void
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## AgentProfileValidator
|
|
324
|
+
|
|
325
|
+
Validates agent profile files.
|
|
326
|
+
|
|
327
|
+
### Constructor
|
|
328
|
+
|
|
329
|
+
```javascript
|
|
330
|
+
new AgentProfileValidator()
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### validate(profileContent)
|
|
334
|
+
|
|
335
|
+
Validate complete agent profile.
|
|
336
|
+
|
|
337
|
+
```javascript
|
|
338
|
+
validate(profileContent: string): { valid: boolean, errors: string[], warnings: string[] }
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Returns:**
|
|
342
|
+
- `valid`: true if profile is valid
|
|
343
|
+
- `errors`: Array of error messages (blocks validation)
|
|
344
|
+
- `warnings`: Array of warning messages (non-blocking)
|
|
345
|
+
|
|
346
|
+
**Validation Rules:**
|
|
347
|
+
- YAML frontmatter required with `name` and `description`
|
|
348
|
+
- Name format: lowercase, alphanumeric, hyphens only
|
|
349
|
+
- Description: 10-200 characters
|
|
350
|
+
- No emojis (Mantra IA-23)
|
|
351
|
+
- File size < 50KB
|
|
352
|
+
- At least one capabilities section
|
|
353
|
+
|
|
354
|
+
**Example:**
|
|
355
|
+
```javascript
|
|
356
|
+
const validator = new AgentProfileValidator();
|
|
357
|
+
const result = validator.validate(profileContent);
|
|
358
|
+
|
|
359
|
+
if (!result.valid) {
|
|
360
|
+
console.error('Errors:', result.errors);
|
|
361
|
+
}
|
|
362
|
+
if (result.warnings.length > 0) {
|
|
363
|
+
console.warn('Warnings:', result.warnings);
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### validateYamlFrontmatter(content)
|
|
368
|
+
|
|
369
|
+
Validate YAML frontmatter only.
|
|
370
|
+
|
|
371
|
+
```javascript
|
|
372
|
+
validateYamlFrontmatter(content: string): { valid: boolean, errors: string[], data: object }
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### validateNameFormat(name)
|
|
376
|
+
|
|
377
|
+
Check if name follows format rules.
|
|
378
|
+
|
|
379
|
+
```javascript
|
|
380
|
+
validateNameFormat(name: string): boolean
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Returns:** true if valid (lowercase, alphanumeric, hyphens)
|
|
384
|
+
|
|
385
|
+
### validateDescriptionLength(description)
|
|
386
|
+
|
|
387
|
+
Check description length.
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
validateDescriptionLength(description: string): boolean
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Returns:** true if 10-200 characters
|
|
394
|
+
|
|
395
|
+
### detectEmojis(text)
|
|
396
|
+
|
|
397
|
+
Detect emoji characters (Mantra IA-23).
|
|
398
|
+
|
|
399
|
+
```javascript
|
|
400
|
+
detectEmojis(text: string): boolean
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Returns:** true if emojis found
|
|
404
|
+
|
|
405
|
+
### checkFileSize(content)
|
|
406
|
+
|
|
407
|
+
Check file size limit.
|
|
408
|
+
|
|
409
|
+
```javascript
|
|
410
|
+
checkFileSize(content: string): boolean
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
**Returns:** true if size <= 50KB
|
|
414
|
+
|
|
415
|
+
### hasCapabilitiesSection(content)
|
|
416
|
+
|
|
417
|
+
Check for capabilities section.
|
|
418
|
+
|
|
419
|
+
```javascript
|
|
420
|
+
hasCapabilitiesSection(content: string): boolean
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**Returns:** true if section found
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## ProfileTemplate
|
|
428
|
+
|
|
429
|
+
Template rendering system with placeholder resolution.
|
|
430
|
+
|
|
431
|
+
### render(template, data)
|
|
432
|
+
|
|
433
|
+
Render template string with data.
|
|
434
|
+
|
|
435
|
+
```javascript
|
|
436
|
+
static render(template: string, data: object): string
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**Parameters:**
|
|
440
|
+
- `template`: Template string with `{{placeholder}}` syntax
|
|
441
|
+
- `data`: Data object for placeholder resolution
|
|
442
|
+
|
|
443
|
+
**Returns:** Rendered template
|
|
444
|
+
|
|
445
|
+
**Example:**
|
|
446
|
+
```javascript
|
|
447
|
+
const template = 'Agent: {{name}}, Role: {{role}}';
|
|
448
|
+
const data = { name: 'CodeReviewer', role: 'Reviewer' };
|
|
449
|
+
const result = ProfileTemplate.render(template, data);
|
|
450
|
+
// "Agent: CodeReviewer, Role: Reviewer"
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### loadTemplate(templateName)
|
|
454
|
+
|
|
455
|
+
Load template from file.
|
|
456
|
+
|
|
457
|
+
```javascript
|
|
458
|
+
static loadTemplate(templateName: string): string
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
**Parameters:**
|
|
462
|
+
- `templateName`: Template filename (without .md extension)
|
|
463
|
+
|
|
464
|
+
**Returns:** Template content
|
|
465
|
+
|
|
466
|
+
**Throws:** Error if template not found
|
|
467
|
+
|
|
468
|
+
**Example:**
|
|
469
|
+
```javascript
|
|
470
|
+
const template = ProfileTemplate.loadTemplate('default-agent');
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### renderFromFile(templateName, data)
|
|
474
|
+
|
|
475
|
+
Load and render template in one call.
|
|
476
|
+
|
|
477
|
+
```javascript
|
|
478
|
+
static renderFromFile(templateName: string, data: object): string
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Example:**
|
|
482
|
+
```javascript
|
|
483
|
+
const profile = ProfileTemplate.renderFromFile('default-agent', {
|
|
484
|
+
agent_name: 'my-agent',
|
|
485
|
+
description: 'My custom agent'
|
|
486
|
+
});
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### validateTemplate(template, requiredPlaceholders)
|
|
490
|
+
|
|
491
|
+
Validate template structure.
|
|
492
|
+
|
|
493
|
+
```javascript
|
|
494
|
+
static validateTemplate(
|
|
495
|
+
template: string,
|
|
496
|
+
requiredPlaceholders?: string[]
|
|
497
|
+
): { valid: boolean, errors: string[], warnings: string[] }
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
**Parameters:**
|
|
501
|
+
- `template`: Template content
|
|
502
|
+
- `requiredPlaceholders`: Array of required placeholder names (optional)
|
|
503
|
+
|
|
504
|
+
**Returns:** Validation result
|
|
505
|
+
|
|
506
|
+
**Example:**
|
|
507
|
+
```javascript
|
|
508
|
+
const result = ProfileTemplate.validateTemplate(template, ['agent_name', 'description']);
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### extractPlaceholders(template)
|
|
512
|
+
|
|
513
|
+
Extract all placeholders from template.
|
|
514
|
+
|
|
515
|
+
```javascript
|
|
516
|
+
static extractPlaceholders(template: string): string[]
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
**Returns:** Array of unique placeholder names
|
|
520
|
+
|
|
521
|
+
**Example:**
|
|
522
|
+
```javascript
|
|
523
|
+
const placeholders = ProfileTemplate.extractPlaceholders('{{name}} {{role}}');
|
|
524
|
+
// ['name', 'role']
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### resolvePlaceholder(path, data)
|
|
528
|
+
|
|
529
|
+
Resolve single placeholder with dot notation support.
|
|
530
|
+
|
|
531
|
+
```javascript
|
|
532
|
+
static resolvePlaceholder(path: string, data: object): any
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**Parameters:**
|
|
536
|
+
- `path`: Placeholder path (supports `obj.prop` and `array.0`)
|
|
537
|
+
- `data`: Data object
|
|
538
|
+
|
|
539
|
+
**Returns:** Resolved value or undefined
|
|
540
|
+
|
|
541
|
+
**Example:**
|
|
542
|
+
```javascript
|
|
543
|
+
const data = { user: { name: 'John' }, tags: ['a', 'b'] };
|
|
544
|
+
ProfileTemplate.resolvePlaceholder('user.name', data); // 'John'
|
|
545
|
+
ProfileTemplate.resolvePlaceholder('tags.0', data); // 'a'
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## TaskRouter
|
|
551
|
+
|
|
552
|
+
Routes tasks based on complexity scoring.
|
|
553
|
+
|
|
554
|
+
### Constructor
|
|
555
|
+
|
|
556
|
+
```javascript
|
|
557
|
+
new TaskRouter()
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### routeTask(task)
|
|
561
|
+
|
|
562
|
+
Route task to appropriate executor.
|
|
563
|
+
|
|
564
|
+
```javascript
|
|
565
|
+
routeTask(task: { prompt: string, type?: string, metadata?: object }): object
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**Returns:**
|
|
569
|
+
```javascript
|
|
570
|
+
{
|
|
571
|
+
executor: 'task' | 'local',
|
|
572
|
+
agentType?: 'task' | 'explore' | 'general-purpose',
|
|
573
|
+
prompt?: string,
|
|
574
|
+
complexity: number,
|
|
575
|
+
reasoning: string
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Example:**
|
|
580
|
+
```javascript
|
|
581
|
+
const router = new TaskRouter();
|
|
582
|
+
const decision = router.routeTask({
|
|
583
|
+
prompt: 'Review this code',
|
|
584
|
+
type: 'code-review'
|
|
585
|
+
});
|
|
586
|
+
console.log('Route to:', decision.executor);
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## Logger
|
|
592
|
+
|
|
593
|
+
Winston-based structured logging.
|
|
594
|
+
|
|
595
|
+
### Constructor
|
|
596
|
+
|
|
597
|
+
```javascript
|
|
598
|
+
new Logger(options?: { logDir, logFile, consoleOutput, level })
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### info(message, data)
|
|
602
|
+
|
|
603
|
+
Log info level message.
|
|
604
|
+
|
|
605
|
+
```javascript
|
|
606
|
+
info(message: string, data?: object): void
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### warn(message, data)
|
|
610
|
+
|
|
611
|
+
Log warning message.
|
|
612
|
+
|
|
613
|
+
```javascript
|
|
614
|
+
warn(message: string, data?: object): void
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### error(message, data)
|
|
618
|
+
|
|
619
|
+
Log error message.
|
|
620
|
+
|
|
621
|
+
```javascript
|
|
622
|
+
error(message: string, data?: object): void
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
**Example:**
|
|
626
|
+
```javascript
|
|
627
|
+
const logger = new Logger();
|
|
628
|
+
logger.info('Task completed', { duration: 1234, success: true });
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
---
|
|
632
|
+
|
|
633
|
+
## MetricsCollector
|
|
634
|
+
|
|
635
|
+
Track task execution and session metrics.
|
|
636
|
+
|
|
637
|
+
### Constructor
|
|
638
|
+
|
|
639
|
+
```javascript
|
|
640
|
+
new MetricsCollector()
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### increment(counterName, amount)
|
|
644
|
+
|
|
645
|
+
Increment counter by name.
|
|
646
|
+
|
|
647
|
+
```javascript
|
|
648
|
+
increment(counterName: string, amount?: number): void
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
**Counters:**
|
|
652
|
+
- `sessionsStarted`
|
|
653
|
+
- `questionsAsked`
|
|
654
|
+
- `analysesCompleted`
|
|
655
|
+
- `profilesGenerated`
|
|
656
|
+
- `errors`
|
|
657
|
+
|
|
658
|
+
**Example:**
|
|
659
|
+
```javascript
|
|
660
|
+
const metrics = new MetricsCollector();
|
|
661
|
+
metrics.increment('sessionsStarted');
|
|
662
|
+
metrics.increment('questionsAsked', 5);
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### getSummary()
|
|
666
|
+
|
|
667
|
+
Get metrics summary.
|
|
668
|
+
|
|
669
|
+
```javascript
|
|
670
|
+
getSummary(): object
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**Returns:**
|
|
674
|
+
```javascript
|
|
675
|
+
{
|
|
676
|
+
totalSessions: number,
|
|
677
|
+
avgQuestionsPerSession: number,
|
|
678
|
+
successRate: number,
|
|
679
|
+
delegationRate: number,
|
|
680
|
+
// ... all counters
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
### reset()
|
|
685
|
+
|
|
686
|
+
Reset all metrics.
|
|
687
|
+
|
|
688
|
+
```javascript
|
|
689
|
+
reset(): void
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## Error Handling
|
|
695
|
+
|
|
696
|
+
All async methods can throw errors. Wrap in try-catch:
|
|
697
|
+
|
|
698
|
+
```javascript
|
|
699
|
+
try {
|
|
700
|
+
await byan.startSession();
|
|
701
|
+
} catch (error) {
|
|
702
|
+
console.error('Failed to start session:', error.message);
|
|
703
|
+
}
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
Common errors:
|
|
707
|
+
- `Response cannot be empty` - submitResponse() with empty string
|
|
708
|
+
- `Not in INTERVIEW state` - getNextQuestion() in wrong state
|
|
709
|
+
- `Cannot generate profile in current state` - generateProfile() before interview complete
|
|
710
|
+
- `Invalid transition from X to Y` - StateMachine invalid transition
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
## TypeScript Support
|
|
715
|
+
|
|
716
|
+
BYAN v2 is written in JavaScript. For TypeScript projects, create type definitions:
|
|
717
|
+
|
|
718
|
+
```typescript
|
|
719
|
+
declare module './src/byan-v2' {
|
|
720
|
+
export default class ByanV2 {
|
|
721
|
+
constructor(config?: ByanConfig);
|
|
722
|
+
startSession(): Promise<string>;
|
|
723
|
+
getNextQuestion(): Promise<string>;
|
|
724
|
+
submitResponse(response: string): Promise<{ success: boolean }>;
|
|
725
|
+
generateProfile(): Promise<string>;
|
|
726
|
+
// ... etc
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface ByanConfig {
|
|
730
|
+
sessionId?: string;
|
|
731
|
+
maxQuestions?: number;
|
|
732
|
+
outputDir?: string;
|
|
733
|
+
env?: 'copilot' | 'standalone';
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
**Version**: 2.0.0-alpha
|
|
741
|
+
**Last Updated**: 2026-02-06
|