maxxcode 0.0.0-stage → 0.1.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.
package/README.md CHANGED
@@ -1,3 +1,72 @@
1
- # Temporary Holding Version
1
+ # maxxcode
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install and launch [Maxx](https://github.com/fractal-solutions/runemaxx), a native desktop coding agent, via npm.
4
+
5
+ This package downloads the matching Maxx release binary from GitHub Releases on install, then provides a `maxxcode` command to launch it.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g maxxcode
11
+ # or
12
+ bun add -g maxxcode
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ maxxcode
19
+ ```
20
+
21
+ This launches the Maxx desktop app. `maxx-agent` is bundled alongside it internally; you do not need to run it directly.
22
+
23
+ ## Supported platforms
24
+
25
+ - `win32/x64`
26
+ - `darwin/arm64`
27
+ - `linux/x64`
28
+
29
+ These match the current GitHub Release assets.
30
+
31
+ ## How it works
32
+
33
+ 1. On `postinstall`, the package detects your platform/arch.
34
+ 2. It downloads the corresponding `Maxx-v<version>-<platform>.<ext>` asset from [GitHub Releases](https://github.com/fractal-solutions/runemaxx/releases).
35
+ 3. It extracts the bundle into the package `vendor/` directory.
36
+ 4. The `maxxcode` command launches `runemaxx` from that bundle.
37
+
38
+ ## Notes
39
+
40
+ - This installs a **desktop GUI app**, not a CLI coding agent.
41
+ - If `postinstall` scripts are disabled (`--ignore-scripts`), the binary will not be downloaded. Reinstall with scripts enabled or download a release manually.
42
+ - If download fails, check [Releases](https://github.com/fractal-solutions/runemaxx/releases) and install manually.
43
+ - Release integrity checksums are recommended for future hardening; the current installer downloads directly from the GitHub release asset.
44
+
45
+ ## Publishing
46
+
47
+ The npm package version must match the Maxx release tag (`npm/package.json` version `0.1.2` corresponds to GitHub Release tag `v0.1.2`). The installer downloads `Maxx-v<version>-<platform>.<ext>` from [GitHub Releases](https://github.com/fractal-solutions/runemaxx/releases), so publish the app release first.
48
+
49
+ ### GitHub Actions (recommended)
50
+
51
+ 1. Add an `NPM_TOKEN` repository secret with npm publish access.
52
+ 2. Ensure `npm/package.json` version matches the release tag (without the `v` prefix).
53
+ 3. Publish via `.github/workflows/npm-publish.yml`:
54
+ - **Automatic**: runs when a GitHub Release is published.
55
+ - **Manual**: Actions → "Publish npm package" → Run workflow, provide tag like `v0.1.2`.
56
+
57
+ The workflow checks out the tag, verifies version/tag match, and runs `npm publish --provenance --access public` from `npm/`.
58
+
59
+ ### Manual publish
60
+
61
+ ```bash
62
+ cd npm
63
+ npm login
64
+ npm pack --dry-run # verify contents
65
+ npm publish --access public
66
+ ```
67
+
68
+ Before publishing, confirm the matching GitHub Release assets exist for all supported platforms.
69
+
70
+ ## License
71
+
72
+ MIT
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { spawn } from 'node:child_process';
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const vendorDir = path.join(__dirname, '..', 'vendor', 'Maxx');
9
+ const bin = path.join(vendorDir, process.platform === 'win32' ? 'runemaxx.exe' : 'runemaxx');
10
+
11
+ if (!existsSync(bin)) {
12
+ console.error('[maxxcode] Maxx binary not found. Try reinstalling: npm install maxxcode');
13
+ console.error(`[maxxcode] Expected: ${bin}`);
14
+ process.exit(1);
15
+ }
16
+
17
+ const child = spawn(bin, process.argv.slice(2), {
18
+ detached: true,
19
+ stdio: 'ignore',
20
+ cwd: vendorDir,
21
+ });
22
+ child.unref();
package/lib/install.js ADDED
@@ -0,0 +1,111 @@
1
+ import { createWriteStream, existsSync, mkdirSync, rmSync, chmodSync, renameSync } from 'node:fs';
2
+ import { promises as fs } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { spawnSync } from 'node:child_process';
6
+ import https from 'node:https';
7
+ import { pipeline } from 'node:stream/promises';
8
+
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const pkgPath = path.join(__dirname, '..', 'package.json');
11
+ const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf8'));
12
+
13
+ const REPO = 'fractal-solutions/runemaxx';
14
+ const VERSION = pkg.version;
15
+ const TAG = `v${VERSION}`;
16
+
17
+ function assetFor(platform, arch) {
18
+ if (platform === 'win32' && arch === 'x64') return { name: `Maxx-${TAG}-windows-x64.zip`, ext: 'zip', bin: 'runemaxx.exe', agent: 'maxx-agent.exe' };
19
+ if (platform === 'darwin' && arch === 'arm64') return { name: `Maxx-${TAG}-macos-arm64.tar.gz`, ext: 'tar.gz', bin: 'runemaxx', agent: 'maxx-agent' };
20
+ if (platform === 'linux' && arch === 'x64') return { name: `Maxx-${TAG}-linux-x64.tar.gz`, ext: 'tar.gz', bin: 'runemaxx', agent: 'maxx-agent' };
21
+ return null;
22
+ }
23
+
24
+ function download(url, dest, redirects = 0) {
25
+ if (redirects > 5) throw new Error(`Too many redirects: ${url}`);
26
+ return new Promise((resolve, reject) => {
27
+ https.get(url, { headers: { 'User-Agent': 'maxxcode-npm-installer' } }, (res) => {
28
+ if ([301, 302, 303, 307, 308].includes(res.statusCode) && res.headers.location) {
29
+ res.resume();
30
+ resolve(download(res.headers.location, dest, redirects + 1));
31
+ return;
32
+ }
33
+ if (res.statusCode !== 200) {
34
+ res.resume();
35
+ reject(new Error(`Download failed (${res.statusCode}) for ${url}`));
36
+ return;
37
+ }
38
+ const out = createWriteStream(dest);
39
+ pipeline(res, out).then(resolve, reject);
40
+ }).on('error', reject);
41
+ });
42
+ }
43
+
44
+ function extract(archive, dest, ext) {
45
+ mkdirSync(dest, { recursive: true });
46
+ if (ext === 'zip') {
47
+ const r = spawnSync('powershell', ['-NoProfile', '-Command', `Expand-Archive -LiteralPath '${archive.replace(/'/g, "''")}' -DestinationPath '${dest.replace(/'/g, "''")}' -Force`], { stdio: 'inherit' });
48
+ if (r.status !== 0) throw new Error('Failed to extract zip with PowerShell Expand-Archive.');
49
+ return;
50
+ }
51
+ const r = spawnSync('tar', ['-xzf', archive, '-C', dest], { stdio: 'inherit' });
52
+ if (r.status !== 0) throw new Error('Failed to extract tar.gz with tar.');
53
+ }
54
+
55
+ async function main() {
56
+ const asset = assetFor(process.platform, process.arch);
57
+ if (!asset) {
58
+ console.warn(`[maxxcode] No prebuilt release for ${process.platform}/${process.arch}. Skipping binary install.`);
59
+ console.warn('[maxxcode] Supported: win32/x64, darwin/arm64, linux/x64.');
60
+ return;
61
+ }
62
+
63
+ const vendorDir = path.join(__dirname, '..', 'vendor');
64
+ const installDir = path.join(vendorDir, 'Maxx');
65
+ const metaPath = path.join(vendorDir, 'install.json');
66
+ const binPath = path.join(installDir, asset.bin);
67
+
68
+ if (existsSync(metaPath) && existsSync(binPath)) {
69
+ try {
70
+ const meta = JSON.parse(await fs.readFile(metaPath, 'utf8'));
71
+ if (meta.version === VERSION && meta.asset === asset.name) {
72
+ console.log(`[maxxcode] Maxx ${VERSION} already installed.`);
73
+ return;
74
+ }
75
+ } catch { /* reinstall */ }
76
+ }
77
+
78
+ const url = `https://github.com/${REPO}/releases/download/${TAG}/${asset.name}`;
79
+ const tmpDir = path.join(vendorDir, '.tmp');
80
+ rmSync(tmpDir, { recursive: true, force: true });
81
+ mkdirSync(tmpDir, { recursive: true });
82
+ const archivePath = path.join(tmpDir, asset.name);
83
+
84
+ console.log(`[maxxcode] Downloading ${asset.name} (${TAG})...`);
85
+ await download(url, archivePath);
86
+
87
+ console.log('[maxxcode] Extracting...');
88
+ rmSync(installDir, { recursive: true, force: true });
89
+ extract(archivePath, vendorDir, asset.ext);
90
+
91
+ if (!existsSync(binPath)) {
92
+ // Some archives may extract differently; try to locate.
93
+ throw new Error(`Expected binary not found after extract: ${binPath}`);
94
+ }
95
+
96
+ if (process.platform !== 'win32') {
97
+ chmodSync(binPath, 0o755);
98
+ const agentPath = path.join(installDir, asset.agent);
99
+ if (existsSync(agentPath)) chmodSync(agentPath, 0o755);
100
+ }
101
+
102
+ await fs.writeFile(metaPath, JSON.stringify({ version: VERSION, tag: TAG, asset: asset.name, platform: process.platform, arch: process.arch }, null, 2));
103
+ rmSync(tmpDir, { recursive: true, force: true });
104
+ console.log(`[maxxcode] Installed Maxx ${VERSION}. Run 'maxxcode' to launch.`);
105
+ }
106
+
107
+ main().catch((err) => {
108
+ console.error(`[maxxcode] Install failed: ${err.message}`);
109
+ console.error('[maxxcode] You can manually download a release from https://github.com/fractal-solutions/runemaxx/releases');
110
+ process.exit(1);
111
+ });
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "maxxcode",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2",
4
+ "description": "Install and launch the Maxx desktop coding agent from GitHub Releases.",
5
+ "type": "module",
6
+ "bin": {
7
+ "maxxcode": "./bin/maxxcode.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node ./lib/install.js"
11
+ },
12
+ "files": [
13
+ "bin/",
14
+ "lib/",
15
+ "README.md"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/fractal-solutions/runemaxx.git",
23
+ "directory": "npm"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/fractal-solutions/runemaxx/issues"
27
+ },
28
+ "homepage": "https://github.com/fractal-solutions/runemaxx#readme",
29
+ "license": "MIT"
30
+ }