create-byan-agent 1.2.1 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,110 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.3] - 2026-02-03
9
+
10
+ ### Added
11
+ - **E2E Test Suite** - Automated end-to-end testing before npm publish
12
+ - Tests complete installation flow (7 steps)
13
+ - Validates directory structure, agent files, config, platform stubs
14
+ - Smoke tests for all 8 YANSTALLER modules
15
+ - Runs automatically via `prepublishOnly` hook
16
+ - Prevents broken releases (caught 8 bugs before production)
17
+ - Command: `npm run test:e2e`
18
+ - Documentation: TEST-E2E-GUIDE.md
19
+
20
+ ### Fixed
21
+ - **CRITICAL BUG #1**: Fixed recommender crash when platforms is undefined
22
+ - `recommender.recommend()` now properly handles both direct detection object and options wrapper
23
+ - Added default empty array for platforms parameter in `getRecommendedAgents()`
24
+ - Added null-check before calling `.some()` on platforms array
25
+ - Fixed display of detected platforms in CLI (was showing "[object Object]")
26
+
27
+ - **CRITICAL BUG #2**: Fixed backup crash on wrong parameter format
28
+ - Fixed `backuper.backup()` call - now passes bmadPath directly instead of object wrapper
29
+
30
+ - **CRITICAL BUG #3**: Fixed installation result property access
31
+ - Fixed `installResult` property access - uses `agentsInstalled` instead of `installedAgents.length`
32
+ - Removed references to non-existent properties (`createdDirectories`, `generatedStubs`)
33
+ - Added error reporting for installation failures
34
+
35
+ - **CRITICAL BUG #4**: Fixed wizard crash on undefined properties
36
+ - Added null-checks for `config.agents`, `config.targetPlatforms`, `config.platforms`
37
+ - Fixed wizard call to pass correct config object with all required properties
38
+ - Prevents crash when displaying installation summary
39
+
40
+ - **CRITICAL BUG #5**: Fixed agent templates not found
41
+ - Limited recommendations to available agents only (byan, rachid, patnote, marc, etc.)
42
+ - Removed recommendations for non-existent agents (architect, dev, quinn, pm, ux-designer, tech-writer)
43
+ - Prevents installation failures due to missing template files
44
+
45
+ - **CRITICAL BUG #6**: Fixed missing fileUtils.readDir function
46
+ - Added `readDir()` function to file-utils.js
47
+ - Fixes validator crashes when checking workflow directories
48
+ - Properly exports readDir in module.exports
49
+
50
+ - **CRITICAL BUG #7**: Fixed installer config parameter mismatch
51
+ - Fixed installer.install() call to pass `targetPlatforms` instead of `platforms`
52
+ - Config file now created correctly during installation
53
+ - Matches InstallConfig typedef definition
54
+
55
+ - **BUG #8**: Removed carmack from recommendations
56
+ - carmack.md template does not exist in templates/_bmad/
57
+ - Removed from baseAgents to prevent installation failures
58
+ - Updated E2E test to not expect carmack agent
59
+
60
+ ## [1.2.2] - 2026-02-03
61
+
62
+ ### Added
63
+ - **E2E Test Suite** - Automated end-to-end testing before npm publish
64
+ - Tests complete installation flow (7 steps)
65
+ - Validates directory structure, agent files, config, platform stubs
66
+ - Smoke tests for all 8 YANSTALLER modules
67
+ - Runs automatically via `prepublishOnly` hook
68
+ - Prevents broken releases (caught 7 bugs before production)
69
+ - Command: `npm run test:e2e`
70
+ - Documentation: TEST-E2E-GUIDE.md
71
+
72
+ ### Fixed
73
+ - **CRITICAL BUG #1**: Fixed recommender crash when platforms is undefined
74
+ - `recommender.recommend()` now properly handles both direct detection object and options wrapper
75
+ - Added default empty array for platforms parameter in `getRecommendedAgents()`
76
+ - Added null-check before calling `.some()` on platforms array
77
+ - Fixed display of detected platforms in CLI (was showing "[object Object]")
78
+
79
+ - **CRITICAL BUG #2**: Fixed backup crash on wrong parameter format
80
+ - Fixed `backuper.backup()` call - now passes bmadPath directly instead of object wrapper
81
+
82
+ - **CRITICAL BUG #3**: Fixed installation result property access
83
+ - Fixed `installResult` property access - uses `agentsInstalled` instead of `installedAgents.length`
84
+ - Removed references to non-existent properties (`createdDirectories`, `generatedStubs`)
85
+ - Added error reporting for installation failures
86
+
87
+ - **CRITICAL BUG #4**: Fixed wizard crash on undefined properties
88
+ - Added null-checks for `config.agents`, `config.targetPlatforms`, `config.platforms`
89
+ - Fixed wizard call to pass correct config object with all required properties
90
+ - Prevents crash when displaying installation summary
91
+
92
+ - **CRITICAL BUG #5**: Fixed agent templates not found
93
+ - Limited recommendations to available agents only (byan, rachid, patnote, carmack, marc, etc.)
94
+ - Removed recommendations for non-existent agents (architect, dev, quinn, pm, ux-designer, tech-writer)
95
+ - Prevents installation failures due to missing template files
96
+
97
+ - **CRITICAL BUG #6**: Fixed missing fileUtils.readDir function
98
+ - Added `readDir()` function to file-utils.js
99
+ - Fixes validator crashes when checking workflow directories
100
+ - Properly exports readDir in module.exports
101
+
102
+ - **CRITICAL BUG #7**: Fixed installer config parameter mismatch
103
+ - Fixed installer.install() call to pass `targetPlatforms` instead of `platforms`
104
+ - Config file now created correctly during installation
105
+ - Matches InstallConfig typedef definition
106
+
107
+ - **BUG #8**: Removed carmack from recommendations
108
+ - carmack.md template does not exist in templates/_bmad/
109
+ - Removed from baseAgents to prevent installation failures
110
+ - Updated E2E test to not expect carmack agent
111
+
8
112
  ## [1.2.1] - 2026-02-03
9
113
 
10
114
  ### Changed
package/README.md CHANGED
@@ -846,7 +846,7 @@ SOFTWARE.
846
846
 
847
847
  # šŸ—ļø YANSTALLER - Intelligent BYAN Installer
848
848
 
849
- [![Version](https://img.shields.io/badge/version-1.2.1-blue.svg)](https://www.npmjs.com/package/create-byan-agent)
849
+ [![Version](https://img.shields.io/badge/version-1.2.3-blue.svg)](https://www.npmjs.com/package/create-byan-agent)
850
850
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
851
851
  [![Node](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org)
852
852
  [![Tests](https://img.shields.io/badge/tests-168%20passing-success.svg)](#tests)
@@ -14,7 +14,7 @@ const wizard = require('../lib/yanstaller/wizard');
14
14
  const backuper = require('../lib/yanstaller/backuper');
15
15
  const logger = require('../lib/utils/logger');
16
16
 
17
- const YANSTALLER_VERSION = '1.2.0';
17
+ const YANSTALLER_VERSION = '1.2.3';
18
18
 
19
19
  // ASCII Art Banner
20
20
  const banner = `
@@ -52,7 +52,8 @@ async function main() {
52
52
  logger.info(chalk.bold('\nšŸ” STEP 1/7: Detection\n'));
53
53
  const detection = await detector.detect({ projectRoot });
54
54
 
55
- logger.info(`āœ“ Platforms detected: ${chalk.cyan(detection.platforms.join(', ') || 'none')}`);
55
+ const platformNames = detection.platforms ? detection.platforms.map(p => p.name).join(', ') : 'none';
56
+ logger.info(`āœ“ Platforms detected: ${chalk.cyan(platformNames)}`);
56
57
  if (detection.projectType) {
57
58
  logger.info(`āœ“ Project type: ${chalk.cyan(detection.projectType)}`);
58
59
  }
@@ -79,7 +80,8 @@ async function main() {
79
80
  if (answers.createBackup) {
80
81
  logger.info(chalk.bold('\nšŸ’¾ STEP 4/7: Backup\n'));
81
82
  try {
82
- const backup = await backuper.backup({ projectRoot });
83
+ const bmadPath = path.join(projectRoot, '_bmad');
84
+ const backup = await backuper.backup(bmadPath);
83
85
  logger.info(`āœ“ Backup created: ${chalk.cyan(backup.backupPath)}`);
84
86
  } catch (error) {
85
87
  logger.warn(`⚠ Backup failed (non-critical): ${error.message}`);
@@ -93,15 +95,16 @@ async function main() {
93
95
  const installResult = await installer.install({
94
96
  projectRoot,
95
97
  agents: answers.agents,
96
- platforms: answers.targetPlatforms,
98
+ targetPlatforms: answers.targetPlatforms,
97
99
  userName: answers.userName,
98
100
  language: answers.language,
99
101
  mode: answers.mode
100
102
  });
101
103
 
102
- logger.info(`āœ“ Installed ${chalk.cyan(installResult.installedAgents.length)} agents`);
103
- logger.info(`āœ“ Created ${chalk.cyan(installResult.createdDirectories)} directories`);
104
- logger.info(`āœ“ Generated ${chalk.cyan(installResult.generatedStubs)} platform stubs`);
104
+ logger.info(`āœ“ Installed ${chalk.cyan(installResult.agentsInstalled)} agents`);
105
+ if (installResult.errors && installResult.errors.length > 0) {
106
+ logger.warn(`⚠ ${installResult.errors.length} installation errors`);
107
+ }
105
108
 
106
109
  // STEP 6: VALIDATE - 10 Automated Checks
107
110
  logger.info(chalk.bold('\nāœ… STEP 6/7: Validation\n'));
@@ -122,8 +125,10 @@ async function main() {
122
125
  // STEP 7: WIZARD - Post-Install Actions
123
126
  logger.info(chalk.bold('\nšŸ§™ STEP 7/7: Post-Install Wizard\n'));
124
127
  await wizard.show({
125
- installedAgents: installResult.installedAgents,
126
- platforms: answers.targetPlatforms,
128
+ agents: answers.agents,
129
+ targetPlatforms: answers.targetPlatforms,
130
+ mode: answers.mode,
131
+ projectRoot,
127
132
  userName: answers.userName,
128
133
  language: answers.language
129
134
  });
@@ -92,6 +92,16 @@ async function writeFile(filePath, content) {
92
92
  await fs.writeFile(filePath, content, 'utf8');
93
93
  }
94
94
 
95
+ /**
96
+ * Read directory contents
97
+ *
98
+ * @param {string} dirPath - Directory path
99
+ * @returns {Promise<string[]>} - Array of file/directory names
100
+ */
101
+ async function readDir(dirPath) {
102
+ return fs.readdir(dirPath);
103
+ }
104
+
95
105
  module.exports = {
96
106
  copy,
97
107
  exists,
@@ -100,5 +110,6 @@ module.exports = {
100
110
  readJSON,
101
111
  writeJSON,
102
112
  readFile,
103
- writeFile
113
+ writeFile,
114
+ readDir
104
115
  };
@@ -22,11 +22,15 @@ const fileUtils = require('../utils/file-utils');
22
22
  /**
23
23
  * Analyze project and recommend configuration
24
24
  *
25
- * @param {import('./detector').DetectionResult} detection - Detection results
25
+ * @param {Object} options - Options object
26
+ * @param {string} [options.projectRoot] - Project root path
27
+ * @param {import('./detector').DetectionResult} options.detection - Detection results
26
28
  * @returns {Promise<Recommendation>}
27
29
  */
28
- async function recommend(detection) {
29
- const projectRoot = process.cwd();
30
+ async function recommend(options) {
31
+ // Support both old API (direct detection) and new API (options object)
32
+ const detection = options.detection || options;
33
+ const projectRoot = options.projectRoot || process.cwd();
30
34
 
31
35
  // 1. Analyze project type
32
36
  let projectType = 'unknown';
@@ -40,7 +44,8 @@ async function recommend(detection) {
40
44
  }
41
45
 
42
46
  // 2. Recommend agents based on type + platforms
43
- const agents = getRecommendedAgents(projectType, detection.platforms);
47
+ const platforms = detection.platforms || [];
48
+ const agents = getRecommendedAgents(projectType, platforms);
44
49
 
45
50
  // 3. Determine mode
46
51
  const mode = agents.length > 10 ? 'full' : 'minimal';
@@ -167,22 +172,27 @@ function detectFramework(deps) {
167
172
  * Get recommended agents based on project type
168
173
  *
169
174
  * @param {string} projectType - Project type
170
- * @param {Array} platforms - Detected platforms
175
+ * @param {Array} platforms - Detected platforms (array of platform objects)
171
176
  * @returns {string[]} - Agent names
172
177
  */
173
- function getRecommendedAgents(projectType, platforms) {
174
- const baseAgents = ['byan', 'rachid', 'patnote', 'carmack'];
178
+ function getRecommendedAgents(projectType, platforms = []) {
179
+ // Only recommend agents that exist in templates/_bmad/
180
+ // Available: byan, byan-test, rachid, patnote, marc, agent-builder, module-builder, workflow-builder
181
+ const availableAgents = ['byan', 'byan-test', 'rachid', 'patnote', 'marc', 'agent-builder', 'module-builder', 'workflow-builder'];
182
+
183
+ const baseAgents = ['byan', 'rachid', 'patnote'];
175
184
 
176
185
  // Add MARC if Copilot CLI detected
177
- if (platforms.some(p => p.name === 'copilot-cli' && p.detected)) {
186
+ if (platforms && platforms.some(p => p.name === 'copilot-cli' && p.detected)) {
178
187
  baseAgents.push('marc');
179
188
  }
180
189
 
190
+ // Simple recommendations based on available agents only
181
191
  const recommendations = {
182
- frontend: [...baseAgents, 'ux-designer', 'dev', 'quinn'],
183
- backend: [...baseAgents, 'architect', 'dev', 'quinn'],
184
- fullstack: [...baseAgents, 'architect', 'dev', 'ux-designer', 'quinn', 'pm'],
185
- library: [...baseAgents, 'dev', 'tech-writer', 'quinn'],
192
+ frontend: [...baseAgents],
193
+ backend: [...baseAgents],
194
+ fullstack: [...baseAgents],
195
+ library: [...baseAgents],
186
196
  unknown: baseAgents
187
197
  };
188
198
 
@@ -25,12 +25,30 @@ async function show(config) {
25
25
  logger.info(chalk.gray('═'.repeat(60)));
26
26
  logger.info('');
27
27
 
28
- // Show installation summary
28
+ // Show installation summary with null-checks
29
29
  logger.info(chalk.bold('šŸ“Š Installation Summary:'));
30
- logger.info(` • Agents installed: ${chalk.cyan(config.agents.length)}`);
31
- logger.info(` • Platforms: ${chalk.cyan(config.targetPlatforms.join(', '))}`);
32
- logger.info(` • Mode: ${chalk.cyan(config.mode)}`);
33
- logger.info(` • Location: ${chalk.gray(config.projectRoot)}`);
30
+
31
+ if (config && config.agents && Array.isArray(config.agents)) {
32
+ logger.info(` • Agents installed: ${chalk.cyan(config.agents.length)}`);
33
+ } else {
34
+ logger.info(` • Agents installed: ${chalk.cyan(0)}`);
35
+ }
36
+
37
+ if (config && config.targetPlatforms && Array.isArray(config.targetPlatforms)) {
38
+ logger.info(` • Platforms: ${chalk.cyan(config.targetPlatforms.join(', '))}`);
39
+ } else if (config && config.platforms && Array.isArray(config.platforms)) {
40
+ logger.info(` • Platforms: ${chalk.cyan(config.platforms.join(', '))}`);
41
+ } else {
42
+ logger.info(` • Platforms: ${chalk.cyan('none')}`);
43
+ }
44
+
45
+ if (config && config.mode) {
46
+ logger.info(` • Mode: ${chalk.cyan(config.mode)}`);
47
+ }
48
+
49
+ if (config && config.projectRoot) {
50
+ logger.info(` • Location: ${chalk.gray(config.projectRoot)}`);
51
+ }
34
52
  logger.info('');
35
53
 
36
54
  const choices = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "NPX installer for BYAN ecosystem - Agent creators (BYAN, BYAN-Test) with deployment (RACHID), integration (MARC), updates (PATNOTE), and optimization (CARMACK)",
5
5
  "bin": {
6
6
  "create-byan-agent": "bin/create-byan-agent.js"
@@ -9,7 +9,10 @@
9
9
  "start": "node bin/create-byan-agent.js",
10
10
  "test": "jest",
11
11
  "test:watch": "jest --watch",
12
- "test:coverage": "jest --coverage"
12
+ "test:coverage": "jest --coverage",
13
+ "test:e2e": "node test-e2e.js",
14
+ "pretest:e2e": "echo '\nšŸ” Running E2E test before publish...\n'",
15
+ "prepublishOnly": "npm run test:e2e"
13
16
  },
14
17
  "keywords": [
15
18
  "byan",