@ememzyvisuals/max 1.0.0

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/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @ememzyvisuals/max
2
+
3
+ **MAX — Production CLI AI Agent**
4
+
5
+ Created by Ememzyvisuals (Emmanuel Ariyo)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @ememzyvisuals/max
11
+ ```
12
+
13
+ This automatically downloads the correct binary for your OS and architecture.
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ max # Interactive REPL
19
+ max chat "your question" # Single message
20
+ max plan "your task" # Multi-agent ULTRAPLAN
21
+ max code "prompt" --lang rust # Generate code
22
+ max buddy status # Check your /buddy
23
+ max --help # All commands
24
+ ```
25
+
26
+ ## Set API Key
27
+
28
+ ```bash
29
+ export GROQ_API_KEY=your_key # Recommended (fast + free tier)
30
+ ```
31
+
32
+ Full docs: https://github.com/ememzyvisuals/max
package/bin/max.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ // bin/max.js — MAX CLI entry point (npm wrapper)
3
+ // Created by Ememzyvisuals (Emmanuel Ariyo)
4
+
5
+ 'use strict';
6
+
7
+ const { spawn } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+ const os = require('os');
11
+
12
+ function getBinaryPath() {
13
+ const platform = os.platform(); // linux, darwin, win32
14
+ const arch = os.arch(); // x64, arm64
15
+
16
+ let binaryName;
17
+ if (platform === 'win32') {
18
+ binaryName = 'max.exe';
19
+ } else {
20
+ binaryName = 'max';
21
+ }
22
+
23
+ // Look for binary installed by postinstall script
24
+ const localBin = path.join(__dirname, '..', '.bin', binaryName);
25
+ if (fs.existsSync(localBin)) {
26
+ return localBin;
27
+ }
28
+
29
+ // Fallback: look in PATH
30
+ return binaryName;
31
+ }
32
+
33
+ const bin = getBinaryPath();
34
+ const args = process.argv.slice(2);
35
+
36
+ const child = spawn(bin, args, {
37
+ stdio: 'inherit',
38
+ env: process.env,
39
+ });
40
+
41
+ child.on('error', (err) => {
42
+ if (err.code === 'ENOENT') {
43
+ console.error('\n [MAX] Binary not found. Try reinstalling:\n');
44
+ console.error(' npm install -g @ememzyvisuals/max\n');
45
+ console.error(' Or install manually from GitHub Releases:');
46
+ console.error(' https://github.com/ememzyvisuals/max/releases\n');
47
+ } else {
48
+ console.error(' [MAX] Error:', err.message);
49
+ }
50
+ process.exit(1);
51
+ });
52
+
53
+ child.on('close', (code) => {
54
+ process.exit(code || 0);
55
+ });
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@ememzyvisuals/max",
3
+ "version": "1.0.0",
4
+ "description": "MAX — Production CLI AI Agent by Ememzyvisuals (Emmanuel Ariyo)",
5
+ "author": "Ememzyvisuals (Emmanuel Ariyo) <Ememzyvisuals@gmail.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/ememzyvisuals/max",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/ememzyvisuals/max.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ememzyvisuals/max/issues"
14
+ },
15
+ "keywords": [
16
+ "ai",
17
+ "cli",
18
+ "agent",
19
+ "llm",
20
+ "offline",
21
+ "groq",
22
+ "openai",
23
+ "terminal"
24
+ ],
25
+ "bin": {
26
+ "max": "./bin/max.js"
27
+ },
28
+ "scripts": {
29
+ "postinstall": "node scripts/install.js"
30
+ },
31
+ "files": [
32
+ "bin/",
33
+ "scripts/",
34
+ "README.md"
35
+ ],
36
+ "engines": {
37
+ "node": ">=16.0.0"
38
+ }
39
+ }
@@ -0,0 +1,188 @@
1
+ #!/usr/bin/env node
2
+ // scripts/install.js — MAX postinstall binary downloader
3
+ // Created by Ememzyvisuals (Emmanuel Ariyo)
4
+
5
+ 'use strict';
6
+
7
+ const https = require('https');
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const os = require('os');
11
+ const { execSync } = require('child_process');
12
+ const zlib = require('zlib');
13
+
14
+ const GITHUB_REPO = 'ememzyvisuals/max';
15
+ const PKG_VERSION = require('../package.json').version;
16
+ const BASE_URL = `https://github.com/${GITHUB_REPO}/releases/download/v${PKG_VERSION}`;
17
+ const BIN_DIR = path.join(__dirname, '..', '.bin');
18
+
19
+ // ── Platform detection ──────────────────────────────────────────────────────
20
+
21
+ function getTarget() {
22
+ const platform = os.platform();
23
+ const arch = os.arch();
24
+
25
+ const platformMap = {
26
+ linux: {
27
+ x64: { artifact: 'max-linux-x86_64.tar.gz', binary: 'max-linux-x86_64' },
28
+ arm64: { artifact: 'max-linux-arm64.tar.gz', binary: 'max-linux-arm64' },
29
+ },
30
+ darwin: {
31
+ x64: { artifact: 'max-macos-x86_64.tar.gz', binary: 'max-macos-x86_64' },
32
+ arm64: { artifact: 'max-macos-arm64.tar.gz', binary: 'max-macos-arm64' },
33
+ },
34
+ win32: {
35
+ x64: { artifact: 'max-windows-x86_64.zip', binary: 'max-windows-x86_64.exe' },
36
+ },
37
+ };
38
+
39
+ const plat = platformMap[platform];
40
+ if (!plat) {
41
+ throw new Error(`Unsupported platform: ${platform}`);
42
+ }
43
+
44
+ const target = plat[arch];
45
+ if (!target) {
46
+ throw new Error(`Unsupported architecture: ${arch} on ${platform}`);
47
+ }
48
+
49
+ return { platform, arch, ...target };
50
+ }
51
+
52
+ // ── Download helpers ────────────────────────────────────────────────────────
53
+
54
+ function download(url, dest) {
55
+ return new Promise((resolve, reject) => {
56
+ const file = fs.createWriteStream(dest);
57
+
58
+ function get(url) {
59
+ https.get(url, (res) => {
60
+ // Follow redirects (GitHub releases use 302)
61
+ if (res.statusCode === 301 || res.statusCode === 302) {
62
+ return get(res.headers.location);
63
+ }
64
+ if (res.statusCode !== 200) {
65
+ return reject(new Error(`Download failed: HTTP ${res.statusCode} for ${url}`));
66
+ }
67
+ res.pipe(file);
68
+ file.on('finish', () => file.close(resolve));
69
+ file.on('error', (err) => {
70
+ fs.unlink(dest, () => reject(err));
71
+ });
72
+ }).on('error', (err) => {
73
+ fs.unlink(dest, () => reject(err));
74
+ });
75
+ }
76
+
77
+ get(url);
78
+ });
79
+ }
80
+
81
+ function extractTarGz(archivePath, destDir) {
82
+ return new Promise((resolve, reject) => {
83
+ const gunzip = zlib.createGunzip();
84
+ const tar = require('child_process').spawn('tar', ['-xzf', archivePath, '-C', destDir]);
85
+ tar.on('close', (code) => {
86
+ if (code === 0) resolve();
87
+ else reject(new Error(`tar exited with code ${code}`));
88
+ });
89
+ tar.on('error', reject);
90
+ });
91
+ }
92
+
93
+ function extractZip(archivePath, destDir) {
94
+ // Use PowerShell on Windows
95
+ execSync(
96
+ `powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${destDir}' -Force"`,
97
+ { stdio: 'inherit' }
98
+ );
99
+ }
100
+
101
+ // ── Main install flow ────────────────────────────────────────────────────────
102
+
103
+ async function install() {
104
+ console.log('\n MAX — Installing binary...');
105
+ console.log(' Created by Ememzyvisuals (Emmanuel Ariyo)');
106
+ console.log(' https://github.com/ememzyvisuals/max\n');
107
+
108
+ let target;
109
+ try {
110
+ target = getTarget();
111
+ } catch (err) {
112
+ console.error(` [ERROR] ${err.message}`);
113
+ console.error(' Please install manually: https://github.com/ememzyvisuals/max/releases');
114
+ process.exit(1);
115
+ }
116
+
117
+ console.log(` Platform: ${target.platform} (${target.arch})`);
118
+ console.log(` Artifact: ${target.artifact}`);
119
+ console.log(` Version: v${PKG_VERSION}\n`);
120
+
121
+ if (!fs.existsSync(BIN_DIR)) {
122
+ fs.mkdirSync(BIN_DIR, { recursive: true });
123
+ }
124
+
125
+ const artifactUrl = `${BASE_URL}/${target.artifact}`;
126
+ const archivePath = path.join(BIN_DIR, target.artifact);
127
+ const finalBinName = os.platform() === 'win32' ? 'max.exe' : 'max';
128
+ const finalBinPath = path.join(BIN_DIR, finalBinName);
129
+
130
+ // Download
131
+ process.stdout.write(' Downloading...');
132
+ try {
133
+ await download(artifactUrl, archivePath);
134
+ process.stdout.write(' ✓\n');
135
+ } catch (err) {
136
+ process.stdout.write(' ✗\n');
137
+ console.error(` [ERROR] Download failed: ${err.message}`);
138
+ console.error(` URL: ${artifactUrl}`);
139
+ console.error(' Install manually: https://github.com/ememzyvisuals/max/releases');
140
+ process.exit(1);
141
+ }
142
+
143
+ // Extract
144
+ process.stdout.write(' Extracting...');
145
+ try {
146
+ if (target.artifact.endsWith('.tar.gz')) {
147
+ await extractTarGz(archivePath, BIN_DIR);
148
+ } else {
149
+ extractZip(archivePath, BIN_DIR);
150
+ }
151
+ process.stdout.write(' ✓\n');
152
+ } catch (err) {
153
+ process.stdout.write(' ✗\n');
154
+ console.error(` [ERROR] Extraction failed: ${err.message}`);
155
+ process.exit(1);
156
+ }
157
+
158
+ // Rename extracted binary to 'max' / 'max.exe'
159
+ const extractedBin = path.join(BIN_DIR, target.binary);
160
+ if (fs.existsSync(extractedBin) && extractedBin !== finalBinPath) {
161
+ fs.renameSync(extractedBin, finalBinPath);
162
+ }
163
+
164
+ // Set executable permissions on Unix
165
+ if (os.platform() !== 'win32') {
166
+ fs.chmodSync(finalBinPath, 0o755);
167
+ }
168
+
169
+ // Cleanup archive
170
+ fs.unlinkSync(archivePath);
171
+
172
+ // Verify installation
173
+ process.stdout.write(' Verifying...');
174
+ try {
175
+ const version = execSync(`"${finalBinPath}" --version`, { encoding: 'utf8' }).trim();
176
+ process.stdout.write(' ✓\n');
177
+ console.log(`\n MAX ${version} installed successfully!`);
178
+ console.log(' Run: max --help\n');
179
+ } catch (err) {
180
+ process.stdout.write(' ✗\n');
181
+ console.error(' [WARN] Could not verify binary. Try running: max --version');
182
+ }
183
+ }
184
+
185
+ install().catch((err) => {
186
+ console.error(' [FATAL]', err.message);
187
+ process.exit(1);
188
+ });