maiass 5.10.4 → 5.10.5
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/maiass-pipeline.js +14 -76
- package/lib/update-check.js +53 -0
- package/package.json +1 -1
package/lib/maiass-pipeline.js
CHANGED
|
@@ -15,6 +15,7 @@ import { handleVersionCommand } from './version-command.js';
|
|
|
15
15
|
import { getSingleCharInput, getLineInput } from './input-utils.js';
|
|
16
16
|
import { updateChangelog as updateChangelogNew } from './changelog.js';
|
|
17
17
|
import { displayHeader } from './header.js';
|
|
18
|
+
import { checkForUpdates } from './update-check.js';
|
|
18
19
|
import { execSync } from 'child_process';
|
|
19
20
|
import path from 'path';
|
|
20
21
|
import fs from 'fs';
|
|
@@ -723,81 +724,6 @@ async function handleReleaseBranchWorkflow(newVersion, versionInfo, developBranc
|
|
|
723
724
|
}
|
|
724
725
|
}
|
|
725
726
|
|
|
726
|
-
/**
|
|
727
|
-
* Check for MAIASS version updates from npm registry
|
|
728
|
-
* @param {string} currentVersion - Current version to compare against
|
|
729
|
-
* @returns {Promise<Object>} Update check result
|
|
730
|
-
*/
|
|
731
|
-
async function checkForUpdates(currentVersion) {
|
|
732
|
-
try {
|
|
733
|
-
// Set a timeout to prevent hanging
|
|
734
|
-
const controller = new AbortController();
|
|
735
|
-
const timeoutId = setTimeout(() => controller.abort(), 3000); // 3 second timeout
|
|
736
|
-
|
|
737
|
-
const response = await fetch('https://registry.npmjs.org/maiass-dev', {
|
|
738
|
-
headers: {
|
|
739
|
-
'Accept': 'application/vnd.npm.install-v1+json',
|
|
740
|
-
'User-Agent': 'MAIASS-Version-Checker'
|
|
741
|
-
},
|
|
742
|
-
signal: controller.signal
|
|
743
|
-
});
|
|
744
|
-
|
|
745
|
-
clearTimeout(timeoutId);
|
|
746
|
-
|
|
747
|
-
if (!response.ok) {
|
|
748
|
-
return { updateAvailable: false, error: `HTTP ${response.status}` };
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
const registryData = await response.json();
|
|
752
|
-
const latestVersion = registryData['dist-tags']?.latest;
|
|
753
|
-
const releaseUrl = 'https://www.npmjs.com/package/maiass-dev';
|
|
754
|
-
|
|
755
|
-
if (!latestVersion) {
|
|
756
|
-
return { updateAvailable: false, error: 'No latest version found in npm registry' };
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
// Simple version comparison (assumes semantic versioning)
|
|
760
|
-
const current = currentVersion.split('.').map(num => parseInt(num, 10));
|
|
761
|
-
const latest = latestVersion.split('.').map(num => parseInt(num, 10));
|
|
762
|
-
|
|
763
|
-
let updateAvailable = false;
|
|
764
|
-
for (let i = 0; i < Math.max(current.length, latest.length); i++) {
|
|
765
|
-
const currentPart = current[i] || 0;
|
|
766
|
-
const latestPart = latest[i] || 0;
|
|
767
|
-
if (latestPart > currentPart) {
|
|
768
|
-
updateAvailable = true;
|
|
769
|
-
break;
|
|
770
|
-
} else if (latestPart < currentPart) {
|
|
771
|
-
break;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
return {
|
|
776
|
-
updateAvailable,
|
|
777
|
-
currentVersion,
|
|
778
|
-
latestVersion,
|
|
779
|
-
releaseUrl,
|
|
780
|
-
error: null
|
|
781
|
-
};
|
|
782
|
-
} catch (error) {
|
|
783
|
-
// Handle timeout and other errors gracefully
|
|
784
|
-
const errorMsg = error.name === 'AbortError' ? 'Request timeout' : error.message;
|
|
785
|
-
return { updateAvailable: false, error: errorMsg };
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
/**
|
|
790
|
-
* Display version information and update status
|
|
791
|
-
* @param {string} currentVersion - Current MAIASS version
|
|
792
|
-
*/
|
|
793
|
-
async function displayVersionInfo(currentVersion) {
|
|
794
|
-
// Display current version
|
|
795
|
-
logger.info(SYMBOLS.INFO, `MAIASS ${colors.Cyan(currentVersion)}`);
|
|
796
|
-
|
|
797
|
-
// Note: Update checking is disabled for nodemaiass as it's in active development
|
|
798
|
-
// and not following npm registry releases. Bashmaiass uses Homebrew for updates.
|
|
799
|
-
// TODO: Re-enable when nodemaiass is published to npm with stable releases
|
|
800
|
-
}
|
|
801
727
|
|
|
802
728
|
/**
|
|
803
729
|
* Main MAIASS pipeline orchestrator
|
|
@@ -818,6 +744,10 @@ export async function runMaiassPipeline(options = {}) {
|
|
|
818
744
|
|
|
819
745
|
// Display branded header with MAIASS's own version (not project version)
|
|
820
746
|
displayHeader(MAIASS_VERSION);
|
|
747
|
+
|
|
748
|
+
// Kick off update check in the background immediately so the network request
|
|
749
|
+
// runs concurrently with the rest of the pipeline — result shown at the end
|
|
750
|
+
const updateCheckPromise = checkForUpdates(MAIASS_VERSION);
|
|
821
751
|
|
|
822
752
|
// Get git info early to show current branch
|
|
823
753
|
const originalGitInfo = getGitInfo();
|
|
@@ -944,7 +874,15 @@ export async function runMaiassPipeline(options = {}) {
|
|
|
944
874
|
const topupEndpoint = process.env.MAIASS_TOPUP_ENDPOINT || 'https://maiass.net/top-up';
|
|
945
875
|
console.log(`${colors.BMagenta('Credit top-up link:')} ${colors.Blue(`${topupEndpoint}/${subscriptionId}`)}`);
|
|
946
876
|
}
|
|
947
|
-
|
|
877
|
+
|
|
878
|
+
// Show update notice if a newer version was found (check started at pipeline top)
|
|
879
|
+
const updateInfo = await updateCheckPromise;
|
|
880
|
+
if (updateInfo.updateAvailable) {
|
|
881
|
+
console.log('');
|
|
882
|
+
console.log(colors.Yellow(` ⬆ Update available: ${updateInfo.currentVersion} → ${updateInfo.latestVersion}`));
|
|
883
|
+
console.log(colors.Gray(` Run: npm install -g maiass`));
|
|
884
|
+
}
|
|
885
|
+
|
|
948
886
|
return {
|
|
949
887
|
success: true,
|
|
950
888
|
branchInfo,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check npm registry for a newer version of maiass.
|
|
3
|
+
* Resolves quickly (3s timeout) and never throws — callers can fire-and-forget.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} currentVersion - The currently running version (e.g. "5.10.3")
|
|
6
|
+
* @param {Function} [fetchFn] - Optional fetch override for testing
|
|
7
|
+
* @returns {Promise<{updateAvailable: boolean, currentVersion: string, latestVersion?: string, error?: string}>}
|
|
8
|
+
*/
|
|
9
|
+
export async function checkForUpdates(currentVersion, fetchFn = fetch) {
|
|
10
|
+
try {
|
|
11
|
+
const controller = new AbortController();
|
|
12
|
+
const timeoutId = setTimeout(() => controller.abort(), 3000); // 3s timeout
|
|
13
|
+
|
|
14
|
+
const response = await fetchFn('https://registry.npmjs.org/maiass', {
|
|
15
|
+
headers: {
|
|
16
|
+
'Accept': 'application/vnd.npm.install-v1+json',
|
|
17
|
+
'User-Agent': 'MAIASS-Version-Checker'
|
|
18
|
+
},
|
|
19
|
+
signal: controller.signal
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
clearTimeout(timeoutId);
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
return { updateAvailable: false, currentVersion, error: `HTTP ${response.status}` };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
const latestVersion = data['dist-tags']?.latest;
|
|
30
|
+
|
|
31
|
+
if (!latestVersion) {
|
|
32
|
+
return { updateAvailable: false, currentVersion, error: 'No latest version in registry' };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Semantic version comparison — compares each part left to right
|
|
36
|
+
const current = currentVersion.split('.').map(n => parseInt(n, 10));
|
|
37
|
+
const latest = latestVersion.split('.').map(n => parseInt(n, 10));
|
|
38
|
+
|
|
39
|
+
let updateAvailable = false;
|
|
40
|
+
for (let i = 0; i < Math.max(current.length, latest.length); i++) {
|
|
41
|
+
const c = current[i] || 0;
|
|
42
|
+
const l = latest[i] || 0;
|
|
43
|
+
if (l > c) { updateAvailable = true; break; }
|
|
44
|
+
if (l < c) { break; }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return { updateAvailable, currentVersion, latestVersion };
|
|
48
|
+
|
|
49
|
+
} catch (error) {
|
|
50
|
+
const msg = error.name === 'AbortError' ? 'Request timeout' : error.message;
|
|
51
|
+
return { updateAvailable: false, currentVersion, error: msg };
|
|
52
|
+
}
|
|
53
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maiass",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.10.
|
|
4
|
+
"version": "5.10.5",
|
|
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": {
|