maiass 5.9.56 → 5.10.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.
@@ -454,12 +454,33 @@ function shouldTagRelease(versionBump, forceTag = false) {
454
454
  async function handleVersionManagement(branchInfo, mergeResult, options = {}) {
455
455
  const { versionBump, versionBumpExplicit = false, dryRun = false, tag = false, force = false, silent = false, originalGitInfo = null } = options;
456
456
  const { developBranch } = branchInfo;
457
-
457
+
458
458
  logger.header(SYMBOLS.INFO, 'Version Management Phase');
459
-
460
- // Check if we have version files
459
+
460
+ // Must be on develop branch for version management — check before reading version files
461
+ const currentBranch = getCurrentBranch();
462
+ if (currentBranch !== developBranch) {
463
+ console.error(colors.Red(`${SYMBOLS.CROSS} Version management must be done on ${developBranch} branch`));
464
+ console.error(colors.Red(`${SYMBOLS.CROSS} Current branch: ${currentBranch}`));
465
+ return { success: false, error: `Not on ${developBranch} branch` };
466
+ }
467
+
468
+ // Pull latest develop from remote before reading version files.
469
+ // This ensures we bump from the correct base even if remote has been updated
470
+ // since our last fetch (e.g. a GH Actions bump from a recently merged PR).
471
+ if (remoteExists()) {
472
+ logger.info(SYMBOLS.PULLING, `Pulling latest ${developBranch} before version bump...`);
473
+ const pullResult = executeGitCommand(`git pull origin ${developBranch}`);
474
+ if (!pullResult.success) {
475
+ logger.error(SYMBOLS.CROSS, 'Git operation failed: pull before version bump');
476
+ logger.error(SYMBOLS.CROSS, 'Please resolve any conflicts and try again');
477
+ return { success: false, error: pullResult.error };
478
+ }
479
+ }
480
+
481
+ // Read version files after pull so we have the freshest version on disk
461
482
  const versionInfo = await getCurrentVersion();
462
-
483
+
463
484
  if (!versionInfo.hasVersionFiles) {
464
485
  // Only warn if the user explicitly asked for a version bump
465
486
  if (versionBumpExplicit) {
@@ -468,15 +489,7 @@ async function handleVersionManagement(branchInfo, mergeResult, options = {}) {
468
489
  logger.debug('No version files — skipping version management');
469
490
  return { success: true, skipped: true };
470
491
  }
471
-
472
- // Must be on develop branch for version management
473
- const currentBranch = getCurrentBranch();
474
- if (currentBranch !== developBranch) {
475
- console.error(colors.Red(`${SYMBOLS.CROSS} Version management must be done on ${developBranch} branch`));
476
- console.error(colors.Red(`${SYMBOLS.CROSS} Current branch: ${currentBranch}`));
477
- return { success: false, error: `Not on ${developBranch} branch` };
478
- }
479
-
492
+
480
493
  // Determine new version
481
494
  const newVersion = bumpVersion(versionInfo.current, versionBump);
482
495
  if (!newVersion) {
package/maiass.mjs CHANGED
@@ -7,6 +7,19 @@ import { hideBin } from 'yargs/helpers';
7
7
  import { initLogger, logger } from './lib/logger.js';
8
8
  import { loadEnvironmentConfig, ensureConfigDirectories } from './lib/config.js';
9
9
 
10
+ // If running from a subdirectory of a git repo, cd to the repo root first so
11
+ // that .env.maiass is loaded from the right place and git operations are
12
+ // consistent with the project root.
13
+ import { execSync } from 'child_process';
14
+ try {
15
+ const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
16
+ if (gitRoot && gitRoot !== process.cwd()) {
17
+ process.chdir(gitRoot);
18
+ }
19
+ } catch {
20
+ // Not in a git repo — leave cwd as-is, pipeline will handle it gracefully
21
+ }
22
+
10
23
  // Load environment variables from multiple sources with cross-platform support
11
24
  ensureConfigDirectories();
12
25
  const envConfig = loadEnvironmentConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maiass",
3
3
  "type": "module",
4
- "version": "5.9.56",
4
+ "version": "5.10.2",
5
5
  "description": "AI commit message generator, semantic versioning, and changelog automation for Git. One command stages, commits with AI, bumps version, and merges branches. Free credits on install — no sign-up needed.",
6
6
  "main": "maiass.mjs",
7
7
  "bin": {