@jlongo78/agent-spaces 0.3.1 → 0.3.3
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/spaces.js +44 -15
- package/package.json +1 -1
package/bin/spaces.js
CHANGED
|
@@ -16,11 +16,15 @@ console.log(' Spaces - Agent Workspace Manager');
|
|
|
16
16
|
console.log(' =================================');
|
|
17
17
|
console.log('');
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
const
|
|
21
|
-
|
|
19
|
+
// Detect standalone build (npm global install) vs full .next (git clone)
|
|
20
|
+
const standaloneServer = path.join(projectDir, '.next', 'standalone', 'server.js');
|
|
21
|
+
const fullBuildDir = path.join(projectDir, '.next', 'BUILD_ID');
|
|
22
|
+
const isStandalone = fs.existsSync(standaloneServer);
|
|
23
|
+
const isFullBuild = fs.existsSync(fullBuildDir);
|
|
24
|
+
|
|
25
|
+
if (!isStandalone && !isFullBuild) {
|
|
22
26
|
console.error(' Error: No build found.');
|
|
23
|
-
console.error(' Run "npm run build" first, or install via "npm install -g agent-spaces".');
|
|
27
|
+
console.error(' Run "npm run build" first, or install via "npm install -g @jlongo78/agent-spaces".');
|
|
24
28
|
process.exit(1);
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -32,17 +36,42 @@ if (!fs.existsSync(claudeDir)) {
|
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
// Spawn Next.js production server on an internal port
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
let next;
|
|
40
|
+
if (isStandalone) {
|
|
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
|
+
|
|
50
|
+
next = spawn(process.execPath, [standaloneServer], {
|
|
51
|
+
cwd: path.dirname(standaloneServer),
|
|
52
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
53
|
+
env: {
|
|
54
|
+
...process.env,
|
|
55
|
+
PORT: String(NEXT_INTERNAL_PORT),
|
|
56
|
+
HOSTNAME: '0.0.0.0',
|
|
57
|
+
NODE_ENV: 'production',
|
|
58
|
+
NODE_PATH: nodePath,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
// git clone — use next start
|
|
63
|
+
next = spawn('npx', ['next', 'start', '--port', String(NEXT_INTERNAL_PORT)], {
|
|
64
|
+
cwd: projectDir,
|
|
65
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
66
|
+
env: {
|
|
67
|
+
...process.env,
|
|
68
|
+
PORT: String(NEXT_INTERNAL_PORT),
|
|
69
|
+
HOSTNAME: '0.0.0.0',
|
|
70
|
+
NODE_ENV: 'production',
|
|
71
|
+
},
|
|
72
|
+
shell: true,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
46
75
|
|
|
47
76
|
let nextReady = false;
|
|
48
77
|
|