maiass 5.8.9 → 5.8.10

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/lib/bootstrap.js CHANGED
@@ -158,6 +158,11 @@ export async function bootstrapProject() {
158
158
  // Step 7: Save configuration
159
159
  await saveConfiguration(config);
160
160
 
161
+ // Step 8: Initialize branch structure if needed (full mode only)
162
+ if (config.features === 'full') {
163
+ await initializeBranchStructure(config.branches);
164
+ }
165
+
161
166
  console.log('');
162
167
  log.success(SYMBOLS.CHECKMARK, 'Project setup complete!');
163
168
  log.info(SYMBOLS.INFO, 'You can modify these settings anytime by editing .env.maiass');
@@ -534,6 +539,119 @@ MAIASS_STAGINGBRANCH=${config.branches.staging}
534
539
  await ensureGitignore();
535
540
  }
536
541
 
542
+ /**
543
+ * Step 8: Initialize branch structure for new repositories
544
+ */
545
+ async function initializeBranchStructure(branchConfig) {
546
+ const { execSync } = await import('child_process');
547
+
548
+ // Check if we're in a git repo
549
+ try {
550
+ execSync('git rev-parse --is-inside-work-tree', { stdio: 'pipe' });
551
+ } catch {
552
+ // Not a git repo, skip
553
+ return;
554
+ }
555
+
556
+ // Check if there are any commits
557
+ let hasCommits = false;
558
+ try {
559
+ execSync('git rev-parse HEAD', { stdio: 'pipe' });
560
+ hasCommits = true;
561
+ } catch {
562
+ // No commits yet
563
+ hasCommits = false;
564
+ }
565
+
566
+ // If there are already commits, check if develop branch exists
567
+ if (hasCommits) {
568
+ try {
569
+ execSync(`git rev-parse --verify ${branchConfig.develop}`, { stdio: 'pipe' });
570
+ // Develop branch exists, nothing to do
571
+ return;
572
+ } catch {
573
+ // Develop branch doesn't exist, offer to create it
574
+ console.log('');
575
+ console.log(colors.BCyan('🌿 Branch Structure Setup'));
576
+ console.log('');
577
+ console.log(`${SYMBOLS.INFO} Your repository has commits but no ${colors.BGreen(branchConfig.develop)} branch.`);
578
+ console.log(`${SYMBOLS.INFO} MAIASS works best with a ${colors.BGreen(branchConfig.develop)} branch for version management.`);
579
+ console.log('');
580
+
581
+ const createBranch = await getSingleCharInput(`Create ${branchConfig.develop} branch from current branch? [Y/n]: `);
582
+ if (createBranch !== 'n') {
583
+ try {
584
+ execSync(`git checkout -b ${branchConfig.develop}`, { stdio: 'inherit' });
585
+ log.success(SYMBOLS.CHECKMARK, `Created and switched to ${colors.BGreen(branchConfig.develop)} branch`);
586
+ } catch (error) {
587
+ log.warning(SYMBOLS.WARNING, `Could not create ${branchConfig.develop} branch: ${error.message}`);
588
+ }
589
+ }
590
+ return;
591
+ }
592
+ }
593
+
594
+ // No commits yet - this is a brand new repo
595
+ console.log('');
596
+ console.log(colors.BCyan('🌿 Branch Structure Setup'));
597
+ console.log('');
598
+ console.log(`${SYMBOLS.INFO} This appears to be a new repository with no commits yet.`);
599
+ console.log(`${SYMBOLS.INFO} MAIASS can set up the recommended branch structure for you:`);
600
+ console.log('');
601
+ console.log(` 1. Create initial commit on ${colors.BGreen(branchConfig.main)} branch`);
602
+ console.log(` 2. Create ${colors.BGreen(branchConfig.develop)} branch from ${branchConfig.main}`);
603
+ console.log(` 3. Switch to ${colors.BGreen(branchConfig.develop)} for development`);
604
+ console.log('');
605
+ console.log(colors.Gray('This ensures MAIASS has the proper branch structure for version management.'));
606
+ console.log('');
607
+
608
+ const setupBranches = await getSingleCharInput('Set up branch structure now? [Y/n]: ');
609
+ if (setupBranches === 'n') {
610
+ log.info(SYMBOLS.INFO, 'Skipping branch setup. You can create branches manually later.');
611
+ return;
612
+ }
613
+
614
+ try {
615
+ // Check if we're on a branch or in detached HEAD
616
+ let currentBranch;
617
+ try {
618
+ currentBranch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8', stdio: 'pipe' }).trim();
619
+ } catch {
620
+ currentBranch = null;
621
+ }
622
+
623
+ // If not on a branch or on wrong branch, create/switch to main
624
+ if (!currentBranch || currentBranch === 'HEAD' || currentBranch !== branchConfig.main) {
625
+ log.info(SYMBOLS.INFO, `Creating ${colors.BGreen(branchConfig.main)} branch...`);
626
+ execSync(`git checkout -b ${branchConfig.main}`, { stdio: 'pipe' });
627
+ }
628
+
629
+ // Create initial commit with the config files
630
+ log.info(SYMBOLS.INFO, 'Creating initial commit...');
631
+ execSync('git add .env.maiass .env.maiass.local .gitignore', { stdio: 'pipe' });
632
+ execSync('git commit -m "Initial commit: MAIASS configuration"', { stdio: 'inherit' });
633
+ log.success(SYMBOLS.CHECKMARK, `Initial commit created on ${colors.BGreen(branchConfig.main)}`);
634
+
635
+ // Create develop branch
636
+ log.info(SYMBOLS.INFO, `Creating ${colors.BGreen(branchConfig.develop)} branch...`);
637
+ execSync(`git checkout -b ${branchConfig.develop}`, { stdio: 'pipe' });
638
+ log.success(SYMBOLS.CHECKMARK, `Created and switched to ${colors.BGreen(branchConfig.develop)} branch`);
639
+
640
+ console.log('');
641
+ log.success(SYMBOLS.CHECKMARK, 'Branch structure initialized successfully!');
642
+ log.info(SYMBOLS.INFO, `You are now on the ${colors.BGreen(branchConfig.develop)} branch and ready to start development.`);
643
+
644
+ } catch (error) {
645
+ console.log('');
646
+ log.warning(SYMBOLS.WARNING, 'Could not automatically set up branch structure');
647
+ log.info(SYMBOLS.INFO, 'You can create branches manually:');
648
+ console.log(` ${colors.Gray(`git checkout -b ${branchConfig.main}`)}`);
649
+ console.log(` ${colors.Gray('git add .')}`);
650
+ console.log(` ${colors.Gray('git commit -m "Initial commit"')}`);
651
+ console.log(` ${colors.Gray(`git checkout -b ${branchConfig.develop}`)}`);
652
+ }
653
+ }
654
+
537
655
  /**
538
656
  * Ensure .gitignore includes necessary patterns
539
657
  */
@@ -551,6 +551,12 @@ async function handleMergeToDevelop(branchInfo, commitResult, options = {}) {
551
551
  const { force = false, silent = false, originalGitInfo = null, autoSwitch = true, versionBump = null, tag = false } = options;
552
552
  const { currentBranch, developBranch, originalBranch } = branchInfo;
553
553
 
554
+ // If no current branch (new repo with no commits), skip merge
555
+ if (!currentBranch || currentBranch === 'null') {
556
+ log.blue(SYMBOLS.INFO, 'New repository with no branch yet, skipping merge workflow');
557
+ return { success: true, skipped: true, newRepo: true };
558
+ }
559
+
554
560
  // If we're already on develop or this was commits-only, skip merge
555
561
  if (currentBranch === developBranch || originalBranch === developBranch) {
556
562
  log.blue(SYMBOLS.INFO, `Already on ${developBranch} branch, skipping merge`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maiass",
3
3
  "type": "module",
4
- "version": "5.8.9",
4
+ "version": "5.8.10",
5
5
  "description": "MAIASS - Modular AI-Augmented Semantic Scribe - Intelligent Git workflow automation",
6
6
  "main": "maiass.mjs",
7
7
  "bin": {