maiass 5.7.31

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.
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MAIASS: Modular AI-Augmented Semantic Scribe
4
+ * Standalone bundled version for distribution
5
+ */
6
+
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+
10
+ // Embedded version and config (updated during build)
11
+ const MAIASS_VERSION = "5.3.6";
12
+ const MAIASS_CONFIG = {
13
+ name: "maiass",
14
+ description: "MAIASS: Modular AI-Augmented Semantic Scribe - CLI tool for AI-augmented development",
15
+ version: MAIASS_VERSION
16
+ };
17
+
18
+ // Simple argument parsing
19
+ const args = process.argv.slice(2);
20
+ const firstArg = args[0];
21
+
22
+ // Handle version flag
23
+ if (args.includes('--version') || args.includes('-v')) {
24
+ console.log(MAIASS_VERSION);
25
+ process.exit(0);
26
+ }
27
+
28
+ // Handle help flag
29
+ if (args.includes('--help') || args.includes('-h') || firstArg === 'help') {
30
+ console.log(`\nMAIASS v${MAIASS_VERSION}`);
31
+ console.log('Modular AI-Augmented Semantic Scribe\n');
32
+ console.log('Usage: maiass [command] [options]\n');
33
+ console.log('Commands:');
34
+ console.log(' hello Print hello world');
35
+ console.log(' version Show version information');
36
+ console.log(' check-updates Check for available updates');
37
+ console.log('\nOptions:');
38
+ console.log(' --help, -h Show this help message');
39
+ console.log(' --version, -v Show version');
40
+ console.log('\nThis is a bundled Node.js version with limited functionality.');
41
+ console.log('For full features, install from source or use the bash version.');
42
+ console.log('\nHomepage: https://github.com/vsmash/maiass');
43
+ process.exit(0);
44
+ }
45
+
46
+ // Simple color utilities
47
+ const colors = {
48
+ green: (text) => `\x1b[32m${text}\x1b[0m`,
49
+ cyan: (text) => `\x1b[36m${text}\x1b[0m`,
50
+ yellow: (text) => `\x1b[33m${text}\x1b[0m`,
51
+ red: (text) => `\x1b[31m${text}\x1b[0m`,
52
+ bold: (text) => `\x1b[1m${text}\x1b[0m`
53
+ };
54
+
55
+ // Check for updates function
56
+ async function checkForUpdates() {
57
+ try {
58
+ console.log(colors.cyan('šŸ” Checking for MAIASS updates...'));
59
+
60
+ const https = require('https');
61
+ const url = 'https://api.github.com/repos/vsmash/maiass/releases/latest';
62
+
63
+ return new Promise((resolve, reject) => {
64
+ const req = https.get(url, {
65
+ headers: {
66
+ 'User-Agent': 'MAIASS-CLI'
67
+ }
68
+ }, (res) => {
69
+ let data = '';
70
+ res.on('data', (chunk) => data += chunk);
71
+ res.on('end', () => {
72
+ try {
73
+ const release = JSON.parse(data);
74
+ const latestVersion = release.tag_name?.replace('v', '') || release.name;
75
+
76
+ if (latestVersion && latestVersion !== MAIASS_VERSION) {
77
+ console.log(colors.yellow(`šŸ“¦ Update available: ${MAIASS_VERSION} → ${latestVersion}`));
78
+ console.log(colors.cyan('šŸŗ Update with: brew upgrade maiass'));
79
+ console.log(colors.cyan('šŸ“– Or visit: https://github.com/vsmash/maiass/releases'));
80
+ } else {
81
+ console.log(colors.green('āœ… You have the latest version!'));
82
+ }
83
+ resolve(true);
84
+ } catch (e) {
85
+ console.log(colors.yellow('āš ļø Could not parse update information'));
86
+ resolve(false);
87
+ }
88
+ });
89
+ });
90
+
91
+ req.on('error', (err) => {
92
+ console.log(colors.yellow('āš ļø Could not check for updates (offline?)'));
93
+ resolve(false);
94
+ });
95
+
96
+ req.setTimeout(5000, () => {
97
+ req.destroy();
98
+ console.log(colors.yellow('āš ļø Update check timed out'));
99
+ resolve(false);
100
+ });
101
+ });
102
+ } catch (error) {
103
+ console.log(colors.yellow('āš ļø Could not check for updates'));
104
+ return false;
105
+ }
106
+ }
107
+
108
+ // Command routing
109
+ async function main() {
110
+ const command = firstArg || 'hello';
111
+
112
+ switch (command) {
113
+ case 'hello':
114
+ console.log(colors.cyan('\nšŸš€ Hello from MAIASS!'));
115
+ console.log(colors.bold(`Version: ${MAIASS_VERSION}`));
116
+ console.log('\nThis is the bundled Node.js version with basic functionality.');
117
+ console.log('For full features, see: https://github.com/vsmash/maiass');
118
+
119
+ // Auto-check for updates
120
+ console.log('');
121
+ await checkForUpdates();
122
+ break;
123
+
124
+ case 'version':
125
+ console.log(colors.bold(`MAIASS v${MAIASS_VERSION}`));
126
+ console.log(`Node.js ${process.version}`);
127
+ console.log(`Platform: ${process.platform} ${process.arch}`);
128
+ break;
129
+
130
+ case 'check-updates':
131
+ await checkForUpdates();
132
+ break;
133
+
134
+ default:
135
+ console.log(colors.red(`āŒ Unknown command: ${command}`));
136
+ console.log(colors.cyan('Run `maiass --help` for available commands.'));
137
+ console.log('\nNote: This bundled version has limited functionality.');
138
+ console.log('For full MAIASS features, install from source:');
139
+ console.log('https://github.com/vsmash/maiass');
140
+ process.exit(1);
141
+ }
142
+ }
143
+
144
+ // Run main function
145
+ main().catch(error => {
146
+ console.error(colors.red('āŒ Error:'), error.message);
147
+ process.exit(1);
148
+ });
package/maiass.cjs ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CommonJS wrapper for maiass.mjs to ensure pkg compatibility
4
+ * This file serves as an entry point that pkg can properly handle
5
+ */
6
+
7
+ // Import the ES module using dynamic import with detailed error handling
8
+ (async () => {
9
+ try {
10
+ // Check if we're running in pkg environment
11
+ const isPkg = typeof process.pkg !== 'undefined';
12
+
13
+ if (isPkg) {
14
+ // In pkg environment, try different import approaches
15
+ console.log('Running in pkg environment, attempting ES module import...');
16
+ }
17
+
18
+ const module = await import('./maiass.mjs');
19
+ // console.log('ES module imported successfully');
20
+ } catch (error) {
21
+ console.error('Error starting maiass:');
22
+ console.error('Error type:', error.constructor.name);
23
+ console.error('Error message:', error.message);
24
+ console.error('Error stack:', error.stack);
25
+
26
+ // Check if it's a specific pkg-related error
27
+ if (error.message.includes('Invalid host defined options')) {
28
+ console.error('\nThis appears to be a pkg/yargs compatibility issue.');
29
+ console.error('Try running with Node.js directly: node maiass.cjs');
30
+ }
31
+
32
+ process.exit(1);
33
+ }
34
+ })();
package/maiass.mjs ADDED
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env node
2
+ // MAIASS: Modular AI-Augmented Semantic Scribe
3
+ import path from 'path';
4
+ import fs from 'fs';
5
+ import yargs from 'yargs';
6
+ import { hideBin } from 'yargs/helpers';
7
+ import { initLogger, logger } from './lib/logger.js';
8
+ import { loadEnvironmentConfig, ensureConfigDirectories } from './lib/config.js';
9
+
10
+ // Load environment variables from multiple sources with cross-platform support
11
+ ensureConfigDirectories();
12
+ const envConfig = loadEnvironmentConfig();
13
+
14
+ // Initialize logger with environment variables
15
+ initLogger(envConfig);
16
+
17
+ // Add a visible debug message
18
+ const debugLine = '─'.repeat(60);
19
+ logger.debug(debugLine);
20
+ logger.debug('DEBUG MODE ENABLED - VERBOSE LOGGING ACTIVE');
21
+ logger.debug('MAIASS_DEBUG is set to: ' + (envConfig.MAIASS_DEBUG || 'false'));
22
+ logger.debug(debugLine);
23
+
24
+ // Example: print version and a colorful welcome
25
+ import colors from './lib/colors.js';
26
+
27
+ // get the version from package.json (ES module compatible, cross-platform)
28
+ const __dirname = path.dirname(new URL(import.meta.url).pathname.replace(/^\/(\w):/, '$1:'));
29
+ const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json')));
30
+ const version = packageJson.version;
31
+
32
+ // Import env display utility
33
+ import { displayEnvironmentVariables } from './lib/env-display.js';
34
+ import { getGitInfo, displayGitInfo, validateBranchForOperations } from './lib/git-info.js';
35
+ import { commitThis } from './lib/commit.js';
36
+ import { handleConfigCommand } from './lib/config-command.js';
37
+ import { handleVersionCommand } from './lib/version-command.js';
38
+ import { handleMaiassCommand } from './lib/maiass-command.js';
39
+ import { handleAccountInfoCommand } from './lib/account-info.js';
40
+ import { SYMBOLS } from './lib/symbols.js';
41
+
42
+ // Simple CLI setup for pkg compatibility
43
+ const args = process.argv.slice(2);
44
+ const firstArg = args[0];
45
+
46
+ // Check if first argument is a version bump type
47
+ const versionBumpTypes = ['major', 'minor', 'patch'];
48
+ let command = 'maiass'; // Default to maiass workflow
49
+ let versionBump = null;
50
+
51
+ if (firstArg && versionBumpTypes.includes(firstArg)) {
52
+ // First arg is a version bump type, use it for maiass workflow
53
+ versionBump = firstArg;
54
+ command = 'maiass';
55
+ } else if (firstArg && !firstArg.startsWith('-')) {
56
+ // First arg is a command
57
+ command = firstArg;
58
+ } else {
59
+ // No command specified or starts with flag, default to maiass
60
+ command = 'maiass';
61
+ }
62
+
63
+ // Handle --auto flag (must be before other processing)
64
+ if (args.includes('--auto') || args.includes('-a')) {
65
+ // Override all auto-yes variables for non-interactive mode
66
+ process.env.MAIASS_AUTO_STAGE_UNSTAGED = 'true';
67
+ process.env.MAIASS_AUTO_PUSH_COMMITS = 'true';
68
+ process.env.MAIASS_AUTO_MERGE_TO_DEVELOP = 'true';
69
+ process.env.MAIASS_AUTO_APPROVE_AI_SUGGESTIONS = 'true';
70
+
71
+ if (process.env.MAIASS_DEBUG === 'true') {
72
+ logger.debug('[DEBUG] Auto-mode enabled - all prompts will be skipped');
73
+ }
74
+ }
75
+
76
+ // Handle version flag
77
+ if (args.includes('--version') || args.includes('-v')) {
78
+ console.log(version);
79
+ process.exit(0);
80
+ }
81
+
82
+ // Handle help flag
83
+ if (args.includes('--help') || args.includes('-h') || command === 'help') {
84
+ console.log(`\nMAIASS v${version}`);
85
+ console.log('Usage: maiass [version-bump] [options]\n');
86
+ console.log('Version Bump (runs full MAIASS workflow):');
87
+ console.log(' maiass Run MAIASS workflow (default: patch bump)');
88
+ console.log(' maiass minor Run MAIASS workflow with minor version bump');
89
+ console.log(' maiass major Run MAIASS workflow with major version bump');
90
+ console.log(' maiass patch Run MAIASS workflow with patch version bump');
91
+ console.log('\nOther Commands:');
92
+ console.log(' hello Print hello world');
93
+ console.log(' env Display environment variables');
94
+ console.log(' git-info Display git repository information');
95
+ console.log(' config Manage configuration');
96
+ console.log(' version Manage version information');
97
+ console.log(' account-info Show your account status (masked token)');
98
+ console.log('\nOptions:');
99
+ console.log(' --auto Enable all auto-yes functionality (non-interactive mode)');
100
+ console.log(' --commits-only, -c Generate AI commits without version management');
101
+ console.log(' --auto-stage Automatically stage all changes');
102
+ console.log(' --help, -h Show this help message');
103
+ console.log(' --version, -v Show version');
104
+ console.log(' --dry-run Run without making changes');
105
+ console.log(' --force Skip confirmation prompts');
106
+ console.log(' --silent Suppress non-essential output');
107
+ process.exit(0);
108
+ }
109
+
110
+ // Command routing
111
+ switch (command) {
112
+ case 'hello':
113
+ console.log(colors.BCyan('Hello from MAIASS!'));
114
+ break;
115
+
116
+ case 'env':
117
+ displayEnvironmentVariables();
118
+ break;
119
+
120
+ case 'git-info':
121
+ const gitInfo = getGitInfo();
122
+ displayGitInfo(gitInfo);
123
+ break;
124
+
125
+ case 'config':
126
+ handleConfigCommand(process.argv.slice(3));
127
+ break;
128
+
129
+ case 'version':
130
+ handleVersionCommand(process.argv.slice(3));
131
+ break;
132
+
133
+ case 'account-info':
134
+ handleAccountInfoCommand({
135
+ json: args.includes('--json')
136
+ });
137
+ break;
138
+
139
+ case 'maiass':
140
+ // Handle the main MAIASS workflow
141
+ handleMaiassCommand({
142
+ _: process.argv.slice(2).filter(arg => !arg.startsWith('--')),
143
+ 'commits-only': args.includes('--commits-only') || args.includes('-c'),
144
+ 'auto-stage': args.includes('--auto-stage'),
145
+ 'auto': args.includes('--auto'),
146
+ 'version-bump': versionBump,
147
+ 'dry-run': args.includes('--dry-run') || args.includes('-d'),
148
+ force: args.includes('--force') || args.includes('-f'),
149
+ silent: args.includes('--silent') || args.includes('-s'),
150
+ tag: getArgValue(args, '--tag') || getArgValue(args, '-t')
151
+ });
152
+ break;
153
+
154
+ default:
155
+ console.error(`Unknown command: ${command}`);
156
+ console.log('Run `maiass --help` for available commands.');
157
+ process.exit(1);
158
+ }
159
+
160
+ // Helper function to get argument values
161
+ function getArgValue(args, flag) {
162
+ const index = args.indexOf(flag);
163
+ if (index !== -1 && index < args.length - 1) {
164
+ return args[index + 1];
165
+ }
166
+ return null;
167
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "maiass",
3
+ "type": "module",
4
+ "version": "5.7.31",
5
+ "description": "MAIASS - Modular AI-Augmented Semantic Scribe - Intelligent Git workflow automation",
6
+ "main": "maiass.mjs",
7
+ "bin": {
8
+ "maiass": "./maiass.mjs",
9
+ "maiass-setup": "./setup-env.js"
10
+ },
11
+ "author": "Velvary Pty Ltd",
12
+ "license": "GPL-3.0-only",
13
+ "engines": {
14
+ "node": ">=18.0.0"
15
+ },
16
+ "keywords": [
17
+ "git",
18
+ "automation",
19
+ "workflow",
20
+ "ai",
21
+ "commit",
22
+ "version",
23
+ "cli"
24
+ ],
25
+ "scripts": {
26
+ "start": "node maiass.mjs",
27
+ "build": "./scripts/build-bundled.sh",
28
+ "build:all": "./scripts/advanced-build.sh all",
29
+ "build:pkg": "./scripts/advanced-build.sh pkg",
30
+ "build:bun": "./scripts/advanced-build.sh bun",
31
+ "build:nexe": "./scripts/advanced-build.sh nexe",
32
+ "build:source": "./scripts/advanced-build.sh source",
33
+ "build:legacy": "node build.js",
34
+ "test": "node test/test-runner.js"
35
+ },
36
+ "dependencies": {
37
+ "chalk": "^5.4.1",
38
+ "dotenv": "^16.4.5",
39
+ "yargs": "^17.7.2"
40
+ },
41
+ "devDependencies": {
42
+ "nexe": "^5.0.0-beta.4",
43
+ "pkg": "^5.8.1"
44
+ }
45
+ }
package/setup-env.js ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ // Helper script to set up environment variables in secure locations
3
+ import { getSecureEnvPath, getConfigEnvPath, ensureConfigDirectories } from './lib/config.js';
4
+ import fs from 'fs';
5
+ import readline from 'readline';
6
+
7
+ const rl = readline.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ });
11
+
12
+ function prompt(question) {
13
+ return new Promise((resolve) => {
14
+ rl.question(question, resolve);
15
+ });
16
+ }
17
+
18
+ async function setupEnvironment() {
19
+ console.log('šŸ”§ MAIASS Environment Setup');
20
+ console.log('===============================\n');
21
+
22
+ ensureConfigDirectories();
23
+
24
+ const secureEnvPath = getSecureEnvPath();
25
+ const configEnvPath = getConfigEnvPath();
26
+
27
+ console.log(`Secure variables will be stored in: ${secureEnvPath}`);
28
+ console.log(`General config will be stored in: ${configEnvPath}\n`);
29
+
30
+ // Check if files already exist
31
+ const secureExists = fs.existsSync(secureEnvPath);
32
+ const configExists = fs.existsSync(configEnvPath);
33
+
34
+ if (secureExists || configExists) {
35
+ console.log('āš ļø Configuration files already exist:');
36
+ if (secureExists) console.log(` - ${secureEnvPath}`);
37
+ if (configExists) console.log(` - ${configEnvPath}`);
38
+
39
+ const overwrite = await prompt('\nDo you want to update them? (y/N): ');
40
+ if (overwrite.toLowerCase() !== 'y') {
41
+ console.log('Setup cancelled.');
42
+ rl.close();
43
+ return;
44
+ }
45
+ }
46
+
47
+ // Collect sensitive variables
48
+ console.log('\nšŸ“ Setting up sensitive variables (stored securely):');
49
+ const maiassKey = await prompt('MAIASS API Key (optional): ');
50
+
51
+ // Collect general config
52
+ console.log('\nāš™ļø Setting up general configuration:');
53
+ const defaultBranch = await prompt('Default branch name (default: main): ') || 'main';
54
+ const developBranch = await prompt('Development branch name (default: develop): ') || 'develop';
55
+
56
+ // Write secure env file
57
+ if (maiassKey.trim()) {
58
+ const secureContent = `# Sensitive environment variables for MAIASS
59
+ # This file is stored in a secure OS-specific location
60
+ MAIASS_API_KEY=${maiassKey.trim()}
61
+ `;
62
+ fs.writeFileSync(secureEnvPath, secureContent, { mode: 0o600 }); // Secure permissions
63
+ console.log(`āœ… Secure variables saved to: ${secureEnvPath}`);
64
+ }
65
+
66
+ // Write general config file
67
+ const configContent = `# General configuration for MAIASS
68
+ # This file contains non-sensitive settings
69
+ DEFAULT_BRANCH=${defaultBranch}
70
+ DEVELOP_BRANCH=${developBranch}
71
+ MAIASS_VERSION=0.2.0
72
+ `;
73
+ fs.writeFileSync(configEnvPath, configContent);
74
+ console.log(`āœ… General config saved to: ${configEnvPath}`);
75
+
76
+ console.log('\nšŸŽ‰ Environment setup complete!');
77
+ console.log('\nYou can also create project-specific .env files in your working directories.');
78
+ console.log('Priority order: .env (cwd) > ~/.maiass.env > config.env > secure.env');
79
+
80
+ rl.close();
81
+ }
82
+
83
+ setupEnvironment().catch(console.error);