maiass 5.10.4 → 5.10.6
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/CODE_OF_CONDUCT.md +27 -0
- package/CONTRIBUTING.md +38 -0
- package/lib/maiass-pipeline.js +14 -76
- package/lib/update-check.js +53 -0
- package/package.json +3 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We are committed to making participation in this project a respectful and harassment-free experience for everyone.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Expected behaviour:
|
|
10
|
+
- Be respectful and constructive in all interactions
|
|
11
|
+
- Accept feedback gracefully
|
|
12
|
+
- Focus on what is best for the project and its users
|
|
13
|
+
|
|
14
|
+
Unacceptable behaviour:
|
|
15
|
+
- Harassment, insults, or personal attacks of any kind
|
|
16
|
+
- Trolling or deliberately disruptive behaviour
|
|
17
|
+
- Publishing others' private information without consent
|
|
18
|
+
|
|
19
|
+
## Enforcement
|
|
20
|
+
|
|
21
|
+
Instances of unacceptable behaviour may be reported by contacting the maintainer at [mark@pottie.com](mailto:mark@pottie.com). All reports will be reviewed and responded to.
|
|
22
|
+
|
|
23
|
+
Maintainers reserve the right to remove, edit, or reject comments, commits, and other contributions that violate this code of conduct.
|
|
24
|
+
|
|
25
|
+
## Attribution
|
|
26
|
+
|
|
27
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing to MAIASS
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## Reporting Issues
|
|
6
|
+
|
|
7
|
+
- Search [existing issues](https://github.com/vsmash/nodemaiass/issues) before opening a new one
|
|
8
|
+
- Include your OS, Node.js version, and `maiass --version` output
|
|
9
|
+
- For bugs, include the full error output and the command you ran
|
|
10
|
+
|
|
11
|
+
## Pull Requests
|
|
12
|
+
|
|
13
|
+
1. Fork the repo and create a branch from `develop`
|
|
14
|
+
2. Make your changes following the code style below
|
|
15
|
+
3. Add or update tests if relevant (`npm run test:unit`)
|
|
16
|
+
4. Ensure all tests pass (`npm run test:unit && npm test`)
|
|
17
|
+
5. Submit a PR against `develop` — not `main`
|
|
18
|
+
|
|
19
|
+
## Code Style
|
|
20
|
+
|
|
21
|
+
- ES modules (`import`/`export`, `.js` extensions)
|
|
22
|
+
- No comments unless the *why* is non-obvious
|
|
23
|
+
- No new dependencies without discussion
|
|
24
|
+
|
|
25
|
+
## Development Setup
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/vsmash/nodemaiass.git
|
|
29
|
+
cd nodemaiass
|
|
30
|
+
npm install
|
|
31
|
+
node maiass.mjs --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
See [docs/development.md](docs/development.md) for full details.
|
|
35
|
+
|
|
36
|
+
## Questions
|
|
37
|
+
|
|
38
|
+
Open a [GitHub Discussion](https://github.com/vsmash/nodemaiass/discussions) or file an issue.
|
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.6",
|
|
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": {
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"maiass.mjs",
|
|
25
25
|
"setup-env.js",
|
|
26
26
|
"README.md",
|
|
27
|
+
"CONTRIBUTING.md",
|
|
28
|
+
"CODE_OF_CONDUCT.md",
|
|
27
29
|
"LICENSE"
|
|
28
30
|
],
|
|
29
31
|
"engines": {
|