@jlongo78/agent-spaces 0.3.2 → 0.3.4
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/bin/postinstall.js +41 -0
- package/bin/spaces.js +9 -0
- package/package.json +2 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Turbopack mangles external module names with a hash suffix.
|
|
4
|
+
// When installed via npm, the standalone server can't resolve these.
|
|
5
|
+
// This script creates aliases so the mangled names resolve correctly.
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const standaloneModules = path.join(__dirname, '..', '.next', 'standalone', 'node_modules');
|
|
11
|
+
|
|
12
|
+
// Only run if this is a standalone (npm) install
|
|
13
|
+
if (!fs.existsSync(standaloneModules)) process.exit(0);
|
|
14
|
+
|
|
15
|
+
// Map of mangled name -> real package name
|
|
16
|
+
const aliases = {
|
|
17
|
+
'better-sqlite3-90e2652d1716b047': 'better-sqlite3',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
for (const [alias, real] of Object.entries(aliases)) {
|
|
21
|
+
const aliasPath = path.join(standaloneModules, alias);
|
|
22
|
+
const realPath = path.join(standaloneModules, real);
|
|
23
|
+
|
|
24
|
+
if (fs.existsSync(realPath) && !fs.existsSync(aliasPath)) {
|
|
25
|
+
try {
|
|
26
|
+
// Try symlink first, fall back to writing a proxy module
|
|
27
|
+
fs.symlinkSync(realPath, aliasPath, 'junction');
|
|
28
|
+
} catch {
|
|
29
|
+
// Symlinks may fail without admin rights — write a proxy instead
|
|
30
|
+
fs.mkdirSync(aliasPath, { recursive: true });
|
|
31
|
+
fs.writeFileSync(
|
|
32
|
+
path.join(aliasPath, 'index.js'),
|
|
33
|
+
`module.exports = require(${JSON.stringify(real)});\n`
|
|
34
|
+
);
|
|
35
|
+
fs.writeFileSync(
|
|
36
|
+
path.join(aliasPath, 'package.json'),
|
|
37
|
+
JSON.stringify({ name: alias, version: '1.0.0', main: 'index.js' }) + '\n'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
package/bin/spaces.js
CHANGED
|
@@ -39,6 +39,14 @@ if (!fs.existsSync(claudeDir)) {
|
|
|
39
39
|
let next;
|
|
40
40
|
if (isStandalone) {
|
|
41
41
|
// npm global install — run the standalone server directly
|
|
42
|
+
// Native modules (better-sqlite3, node-pty) live in the parent package's
|
|
43
|
+
// node_modules, not in the standalone bundle. Add NODE_PATH so they're found.
|
|
44
|
+
const parentNodeModules = path.join(projectDir, 'node_modules');
|
|
45
|
+
const existingNodePath = process.env.NODE_PATH || '';
|
|
46
|
+
const nodePath = existingNodePath
|
|
47
|
+
? `${parentNodeModules}${path.delimiter}${existingNodePath}`
|
|
48
|
+
: parentNodeModules;
|
|
49
|
+
|
|
42
50
|
next = spawn(process.execPath, [standaloneServer], {
|
|
43
51
|
cwd: path.dirname(standaloneServer),
|
|
44
52
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
@@ -47,6 +55,7 @@ if (isStandalone) {
|
|
|
47
55
|
PORT: String(NEXT_INTERNAL_PORT),
|
|
48
56
|
HOSTNAME: '0.0.0.0',
|
|
49
57
|
NODE_ENV: 'production',
|
|
58
|
+
NODE_PATH: nodePath,
|
|
50
59
|
},
|
|
51
60
|
});
|
|
52
61
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jlongo78/agent-spaces",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Agent workspace manager for Claude, Codex, Gemini, and more",
|
|
5
5
|
"bin": {
|
|
6
6
|
"spaces": "./bin/spaces.js"
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"build:server": "cross-env NEXT_PUBLIC_TIER=server STANDALONE=1 next build && node -e \"const fs=require('fs');fs.cpSync('.next/static','.next/standalone/.next/static',{recursive:true});fs.cpSync('public','.next/standalone/public',{recursive:true})\"",
|
|
35
35
|
"build:team": "cross-env NEXT_PUBLIC_TIER=team STANDALONE=1 next build && node -e \"const fs=require('fs');fs.cpSync('.next/static','.next/standalone/.next/static',{recursive:true});fs.cpSync('public','.next/standalone/public',{recursive:true})\"",
|
|
36
36
|
"build:federation": "cross-env NEXT_PUBLIC_TIER=federation STANDALONE=1 next build && node -e \"const fs=require('fs');fs.cpSync('.next/static','.next/standalone/.next/static',{recursive:true});fs.cpSync('public','.next/standalone/public',{recursive:true})\"",
|
|
37
|
+
"postinstall": "node bin/postinstall.js",
|
|
37
38
|
"prepublishOnly": "npm run build",
|
|
38
39
|
"setup-admin": "node bin/setup-admin.js",
|
|
39
40
|
"server:build": "next build",
|