@k1e1n04/mav 0.1.0 → 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
@@ -31,14 +31,33 @@ brew tap k1e1n04/mav https://github.com/k1e1n04/mav.git
31
31
  brew install mav
32
32
  ```
33
33
 
34
- ### npm / pnpm
34
+ ### npm
35
35
 
36
36
  ```bash
37
37
  npm install -g @k1e1n04/mav
38
- # or
38
+ ```
39
+
40
+ Requires Xcode Command Line Tools (macOS) or `build-essential` (Linux) for the native `node-pty` module.
41
+
42
+ ```bash
43
+ # macOS
44
+ xcode-select --install
45
+
46
+ # Ubuntu / Debian
47
+ sudo apt-get install -y build-essential python3
48
+ ```
49
+
50
+ ### pnpm
51
+
52
+ pnpm v10+ blocks install scripts by default. An extra step is needed after install:
53
+
54
+ ```bash
39
55
  pnpm add -g @k1e1n04/mav
56
+ pnpm approve-builds -g # select node-pty to allow its native build
40
57
  ```
41
58
 
59
+ > **Tip:** On macOS, Homebrew handles all of this automatically — use it if you prefer a simpler install.
60
+
42
61
  ### Build from Source
43
62
 
44
63
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k1e1n04/mav",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Multi-agent view — manage multiple AI CLI sessions in one terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,12 +20,14 @@
20
20
  "bin/",
21
21
  "lua/",
22
22
  "plugin/",
23
+ "scripts/",
23
24
  "LICENSE",
24
25
  "README.md"
25
26
  ],
26
27
  "scripts": {
27
28
  "build": "tsc && node scripts/postbuild.mjs",
28
29
  "dev": "tsx bin/mav.ts",
30
+ "postinstall": "node scripts/postinstall.mjs",
29
31
  "test": "vitest run",
30
32
  "test:watch": "vitest",
31
33
  "prepublishOnly": "pnpm test && pnpm build"
@@ -0,0 +1,2 @@
1
+ import { chmodSync } from 'node:fs'
2
+ chmodSync('dist/bin/mav.js', 0o755)
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ // Rebuild node-pty's native binary if it wasn't built during install.
3
+ // Runs automatically when installed via npm.
4
+ // pnpm v10+ also blocks this script unless approved with `pnpm approve-builds -g`.
5
+ import { execSync } from 'node:child_process'
6
+ import { existsSync } from 'node:fs'
7
+ import { dirname } from 'node:path'
8
+ import { createRequire } from 'node:module'
9
+
10
+ const require = createRequire(import.meta.url)
11
+
12
+ function isPtyBuilt() {
13
+ try {
14
+ require('node-pty')
15
+ return true
16
+ } catch (e) {
17
+ const msg = e instanceof Error ? e.message : String(e)
18
+ // Only attempt rebuild when the native binary is missing.
19
+ return !msg.includes('pty.node')
20
+ }
21
+ }
22
+
23
+ if (!isPtyBuilt()) {
24
+ let ptyDir = null
25
+ try {
26
+ ptyDir = dirname(require.resolve('node-pty/package.json'))
27
+ } catch {
28
+ // node-pty not resolvable — nothing to do
29
+ }
30
+
31
+ if (ptyDir && existsSync(ptyDir)) {
32
+ process.stdout.write('[mav] Building node-pty native module...\n')
33
+ try {
34
+ execSync('node-gyp rebuild', { cwd: ptyDir, stdio: 'inherit' })
35
+ process.stdout.write('[mav] node-pty built successfully.\n')
36
+ } catch {
37
+ process.stderr.write('[mav] Warning: Could not build node-pty automatically.\n')
38
+ process.stderr.write('[mav] To fix manually: pnpm rebuild node-pty --global\n')
39
+ process.stderr.write('[mav] Requires build tools: https://github.com/nodejs/node-gyp#installation\n')
40
+ }
41
+ }
42
+ }