@jlongo78/agent-spaces 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/bin/spaces.js +35 -15
  2. 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
- // Verify build exists
20
- const buildDir = path.join(projectDir, '.next');
21
- if (!fs.existsSync(buildDir)) {
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,33 @@ if (!fs.existsSync(claudeDir)) {
32
36
  }
33
37
 
34
38
  // Spawn Next.js production server on an internal port
35
- const next = spawn('npx', ['next', 'start', '--port', String(NEXT_INTERNAL_PORT)], {
36
- cwd: projectDir,
37
- stdio: ['ignore', 'pipe', 'pipe'],
38
- env: {
39
- ...process.env,
40
- PORT: String(NEXT_INTERNAL_PORT),
41
- HOSTNAME: '0.0.0.0',
42
- NODE_ENV: 'production',
43
- },
44
- shell: true,
45
- });
39
+ let next;
40
+ if (isStandalone) {
41
+ // npm global install — run the standalone server directly
42
+ next = spawn(process.execPath, [standaloneServer], {
43
+ cwd: path.dirname(standaloneServer),
44
+ stdio: ['ignore', 'pipe', 'pipe'],
45
+ env: {
46
+ ...process.env,
47
+ PORT: String(NEXT_INTERNAL_PORT),
48
+ HOSTNAME: '0.0.0.0',
49
+ NODE_ENV: 'production',
50
+ },
51
+ });
52
+ } else {
53
+ // git clone — use next start
54
+ next = spawn('npx', ['next', 'start', '--port', String(NEXT_INTERNAL_PORT)], {
55
+ cwd: projectDir,
56
+ stdio: ['ignore', 'pipe', 'pipe'],
57
+ env: {
58
+ ...process.env,
59
+ PORT: String(NEXT_INTERNAL_PORT),
60
+ HOSTNAME: '0.0.0.0',
61
+ NODE_ENV: 'production',
62
+ },
63
+ shell: true,
64
+ });
65
+ }
46
66
 
47
67
  let nextReady = false;
48
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jlongo78/agent-spaces",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Agent workspace manager for Claude, Codex, Gemini, and more",
5
5
  "bin": {
6
6
  "spaces": "./bin/spaces.js"