@k1e1n04/mav 0.1.0 → 0.1.1
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/package.json +3 -1
- package/scripts/postbuild.mjs +2 -0
- package/scripts/postinstall.mjs +42 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k1e1n04/mav",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Rebuild node-pty's native binary if it wasn't built during install.
|
|
3
|
+
// pnpm v9+ blocks transitive dependency install scripts by default, so
|
|
4
|
+
// we trigger the build here from the package's own postinstall.
|
|
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
|
+
}
|