create-byan-agent 2.6.1 → 2.6.2

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/README.md CHANGED
@@ -224,6 +224,7 @@ BYAN contient **27 agents spécialisés** organisés en **5 modules** :
224
224
  | Agent | Persona | Rôle | Cas d'usage typique |
225
225
  |-------|---------|------|---------------------|
226
226
  | **jimmy** | Jimmy | Spécialiste documentation technique — Runbooks, Infrastructure, Déploiement, Procédures, Web. Publie dans Outline Wiki via API REST | Documenter un runbook serveur, une procédure de déploiement ou une config infrastructure |
227
+ | **mike** | Mike | Gestionnaire de projet Leantime — Projets, Tâches, Sprints, Milestones, Commentaires via API JSON-RPC 2.0 | Créer un sprint, assigner des tâches, suivre l'avancement d'un projet |
227
228
 
228
229
  ---
229
230
 
@@ -436,7 +436,8 @@ async function install() {
436
436
  { name: 'carmack', label: 'Carmack - Token Optimizer [worker]', checked: false }
437
437
  ],
438
438
  'Custom Agents': [
439
- { name: 'jimmy', label: 'Jimmy - Technical Documentation Specialist (Runbooks, Infra, Deploy, Web — Outline Wiki) [worker]', checked: false }
439
+ { name: 'jimmy', label: 'Jimmy - Technical Documentation Specialist (Runbooks, Infra, Deploy, Web — Outline Wiki) [worker]', checked: false },
440
+ { name: 'mike', label: 'Mike - Project Manager Specialist (Projects, Tasks, Sprints, Milestones — Leantime) [worker]', checked: false }
440
441
  ]
441
442
  };
442
443
 
@@ -1345,7 +1346,7 @@ async function install() {
1345
1346
  output_folder: "{project-root}/_byan-output",
1346
1347
  platform: isManual ? manualSelection.platforms.join(',') : platform,
1347
1348
  install_mode: installMode,
1348
- byan_version: v2Installed ? '2.0.0-alpha.1' : '1.0.0'
1349
+ byan_version: BYAN_VERSION
1349
1350
  };
1350
1351
 
1351
1352
  // Add installed agents list for MANUAL mode
@@ -1553,4 +1554,230 @@ program
1553
1554
  .version(BYAN_VERSION)
1554
1555
  .action(install);
1555
1556
 
1557
+ // Update Command
1558
+ program
1559
+ .command('update')
1560
+ .description('Mettre a jour BYAN vers la derniere version npm')
1561
+ .option('--dry-run', 'Analyser sans appliquer les changements')
1562
+ .option('--force', 'Forcer la mise a jour meme si deja a jour')
1563
+ .action(async (options) => {
1564
+ const installPath = process.cwd();
1565
+
1566
+ // Import update modules
1567
+ const Analyzer = require('../../update-byan-agent/lib/analyzer');
1568
+ const Backup = require('../../update-byan-agent/lib/backup');
1569
+ const CustomizationDetector = require('../../update-byan-agent/lib/customization-detector');
1570
+
1571
+ try {
1572
+ // Step 1: Check version
1573
+ const spinner = ora('Verification version...').start();
1574
+ const analyzer = new Analyzer(installPath);
1575
+ const versionInfo = await analyzer.checkVersion();
1576
+ spinner.succeed(`Version actuelle: ${versionInfo.current}, npm: ${versionInfo.latest}`);
1577
+
1578
+ if (versionInfo.upToDate && !options.force) {
1579
+ console.log(chalk.green('\nBYAN est deja a jour!'));
1580
+ console.log(chalk.gray(` Version actuelle: ${versionInfo.current}`));
1581
+ return;
1582
+ }
1583
+
1584
+ if (options.dryRun) {
1585
+ console.log(chalk.cyan('\nMode dry-run: Aucune modification appliquee'));
1586
+ console.log(chalk.gray(` Mise a jour disponible: ${versionInfo.current} -> ${versionInfo.latest}`));
1587
+ return;
1588
+ }
1589
+
1590
+ // Step 2: Confirm update
1591
+ const { confirmUpdate } = await inquirer.prompt([{
1592
+ type: 'confirm',
1593
+ name: 'confirmUpdate',
1594
+ message: `Mettre a jour BYAN ${versionInfo.current} -> ${versionInfo.latest}?`,
1595
+ default: true
1596
+ }]);
1597
+
1598
+ if (!confirmUpdate) {
1599
+ console.log(chalk.yellow('Mise a jour annulee'));
1600
+ return;
1601
+ }
1602
+
1603
+ // Step 3: Detect customizations
1604
+ const detectorSpinner = ora('Detection des personnalisations...').start();
1605
+ const detector = new CustomizationDetector(installPath);
1606
+ const customizations = await detector.detectCustomizations();
1607
+ detectorSpinner.succeed(`${customizations.length} fichiers a preserver detectes`);
1608
+
1609
+ // Step 4: Create backup
1610
+ const backupSpinner = ora('Creation backup...').start();
1611
+ const backup = new Backup(installPath);
1612
+ const backupPath = await backup.create();
1613
+ backupSpinner.succeed(`Backup cree: ${path.basename(backupPath)}`);
1614
+
1615
+ // Step 5: Preserve customizations
1616
+ const preserveSpinner = ora('Sauvegarde des personnalisations...').start();
1617
+ const tempDir = path.join(installPath, '.byan-update-temp');
1618
+ if (fs.existsSync(tempDir)) {
1619
+ await fs.remove(tempDir);
1620
+ }
1621
+ await fs.ensureDir(tempDir);
1622
+
1623
+ for (const custom of customizations) {
1624
+ if (await fs.pathExists(custom.path)) {
1625
+ const relativePath = path.relative(installPath, custom.path);
1626
+ const tempPath = path.join(tempDir, relativePath);
1627
+ const tempParent = path.dirname(tempPath);
1628
+
1629
+ await fs.ensureDir(tempParent);
1630
+ await fs.copy(custom.path, tempPath);
1631
+ }
1632
+ }
1633
+ preserveSpinner.succeed('Personnalisations sauvegardees');
1634
+
1635
+ // Step 6: Download and install latest version
1636
+ const updateSpinner = ora('Telechargement derniere version...').start();
1637
+ try {
1638
+ // Remove current _byan directory
1639
+ const byanDir = path.join(installPath, '_byan');
1640
+ if (await fs.pathExists(byanDir)) {
1641
+ await fs.remove(byanDir);
1642
+ }
1643
+
1644
+ // Run npm install to get latest create-byan-agent
1645
+ execSync('npm install --no-save create-byan-agent@latest', {
1646
+ cwd: installPath,
1647
+ stdio: 'pipe'
1648
+ });
1649
+
1650
+ // Copy _byan from node_modules to project root
1651
+ const nodeModulesByan = path.join(installPath, 'node_modules', 'create-byan-agent', '_byan');
1652
+ if (await fs.pathExists(nodeModulesByan)) {
1653
+ await fs.copy(nodeModulesByan, byanDir);
1654
+ } else {
1655
+ throw new Error('_byan directory not found in npm package');
1656
+ }
1657
+
1658
+ updateSpinner.succeed('Derniere version installee');
1659
+ } catch (error) {
1660
+ updateSpinner.fail('Erreur installation');
1661
+
1662
+ // Rollback
1663
+ const rollbackSpinner = ora('Restauration backup...').start();
1664
+ await backup.restore(backupPath);
1665
+ rollbackSpinner.succeed('Backup restaure');
1666
+
1667
+ throw error;
1668
+ }
1669
+
1670
+ // Step 7: Restore customizations
1671
+ const restoreSpinner = ora('Restauration personnalisations...').start();
1672
+ for (const custom of customizations) {
1673
+ const relativePath = path.relative(installPath, custom.path);
1674
+ const tempPath = path.join(tempDir, relativePath);
1675
+
1676
+ if (await fs.pathExists(tempPath)) {
1677
+ const targetParent = path.dirname(custom.path);
1678
+ await fs.ensureDir(targetParent);
1679
+ await fs.copy(tempPath, custom.path);
1680
+ }
1681
+ }
1682
+ restoreSpinner.succeed('Personnalisations restaurees');
1683
+
1684
+ // Cleanup temp directory
1685
+ if (await fs.pathExists(tempDir)) {
1686
+ await fs.remove(tempDir);
1687
+ }
1688
+
1689
+ // Update version in config.yaml
1690
+ const configPath = path.join(installPath, '_byan', 'bmb', 'config.yaml');
1691
+ if (await fs.pathExists(configPath)) {
1692
+ const configContent = await fs.readFile(configPath, 'utf8');
1693
+ const config = yaml.load(configContent);
1694
+ config.byan_version = versionInfo.latest;
1695
+ await fs.writeFile(configPath, yaml.dump(config), 'utf8');
1696
+ }
1697
+
1698
+ console.log('');
1699
+ console.log(chalk.green.bold('Mise a jour terminee avec succes!'));
1700
+ console.log(chalk.gray(` ${versionInfo.current} -> ${versionInfo.latest}`));
1701
+ console.log('');
1702
+ console.log(chalk.cyan('Fichiers preserves:'));
1703
+ customizations.forEach(c => {
1704
+ console.log(chalk.gray(` ✓ ${path.relative(installPath, c.path)}`));
1705
+ });
1706
+ console.log('');
1707
+
1708
+ } catch (error) {
1709
+ console.error('');
1710
+ console.error(chalk.red.bold('Erreur lors de la mise a jour:'));
1711
+ console.error(chalk.red(` ${error.message}`));
1712
+ console.error('');
1713
+ console.error(chalk.yellow('Le backup est disponible dans _byan.backup/'));
1714
+ console.error(chalk.gray('Restaurer avec: npx create-byan-agent restore'));
1715
+ process.exit(1);
1716
+ }
1717
+ });
1718
+
1719
+ // Restore Command
1720
+ program
1721
+ .command('restore')
1722
+ .description('Restaurer BYAN depuis backup')
1723
+ .option('-p, --path <path>', 'Chemin du backup (dernier par defaut)')
1724
+ .action(async (options) => {
1725
+ const Backup = require('../../update-byan-agent/lib/backup');
1726
+ const spinner = ora('Restauration backup...').start();
1727
+
1728
+ try {
1729
+ const installPath = process.cwd();
1730
+ const backup = new Backup(installPath);
1731
+
1732
+ await backup.restore(options.path);
1733
+
1734
+ spinner.succeed('Backup restaure avec succes');
1735
+ console.log(chalk.green('\nBYAN restaure depuis backup'));
1736
+
1737
+ } catch (error) {
1738
+ spinner.fail('Erreur restauration backup');
1739
+ console.error(chalk.red(` ${error.message}`));
1740
+ process.exit(1);
1741
+ }
1742
+ });
1743
+
1744
+ // Check Version Command
1745
+ program
1746
+ .command('check')
1747
+ .description('Verifier version actuelle vs derniere version npm')
1748
+ .action(async () => {
1749
+ const Analyzer = require('../../update-byan-agent/lib/analyzer');
1750
+ const spinner = ora('Verification version BYAN...').start();
1751
+
1752
+ try {
1753
+ const installPath = process.cwd();
1754
+ const analyzer = new Analyzer(installPath);
1755
+
1756
+ const versionInfo = await analyzer.checkVersion();
1757
+
1758
+ spinner.succeed('Verification terminee');
1759
+
1760
+ console.log('');
1761
+ console.log(chalk.bold('Informations de version:'));
1762
+ console.log(chalk.gray(' Version actuelle: ') + chalk.cyan(versionInfo.current));
1763
+ console.log(chalk.gray(' Version npm: ') + chalk.cyan(versionInfo.latest));
1764
+ console.log('');
1765
+
1766
+ if (versionInfo.upToDate) {
1767
+ console.log(chalk.green(' ✓ BYAN est a jour!'));
1768
+ } else if (versionInfo.needsUpdate) {
1769
+ console.log(chalk.yellow(' → Une mise a jour est disponible'));
1770
+ console.log(chalk.gray(' Executer: npx create-byan-agent update'));
1771
+ } else if (versionInfo.ahead) {
1772
+ console.log(chalk.blue(' → Version dev en avance sur npm'));
1773
+ }
1774
+ console.log('');
1775
+
1776
+ } catch (error) {
1777
+ spinner.fail('Erreur verification version');
1778
+ console.error(chalk.red(` ${error.message}`));
1779
+ process.exit(1);
1780
+ }
1781
+ });
1782
+
1556
1783
  program.parse(process.argv);
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: 'mike'
3
+ description: 'Mike - Gestionnaire de Projet Spécialiste Leantime (Projets, Tâches, Sprints, Milestones)'
4
+ ---
5
+
6
+ You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
7
+
8
+ <agent-activation CRITICAL="TRUE">
9
+ 1. LOAD the FULL agent file from {project-root}/_byan/agents/mike.md
10
+ 2. READ its entire contents - this contains the complete agent persona, menu, and instructions
11
+ 3. FOLLOW every step in the <activation> section precisely
12
+ 4. DISPLAY the welcome/greeting as instructed
13
+ 5. PRESENT the numbered menu
14
+ 6. WAIT for user input before proceeding
15
+ </agent-activation>