@hamp10/agentforge 0.2.21 → 0.2.23

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.
@@ -1,15 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
  // Runs automatically after `npm install -g @hamp10/agentforge`.
3
3
  // Ensures the npm global bin directory is on PATH so users can just type:
4
- // agentforge start
4
+ // agentforge setup
5
5
  // Works on macOS, Linux (including Raspberry Pi).
6
6
 
7
7
  import { existsSync, readFileSync, appendFileSync } from 'fs';
8
8
  import { homedir } from 'os';
9
9
  import path from 'path';
10
+ import { execFileSync } from 'child_process';
10
11
 
11
- // The bin directory is wherever node lives — npm links `agentforge` there too.
12
- const binDir = path.dirname(process.execPath);
12
+ function npmPrefix() {
13
+ if (process.env.npm_config_prefix) return process.env.npm_config_prefix;
14
+ try {
15
+ return execFileSync('npm', ['config', 'get', 'prefix'], {
16
+ encoding: 'utf8',
17
+ stdio: ['ignore', 'pipe', 'ignore'],
18
+ }).trim();
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
24
+ const prefix = npmPrefix();
25
+ const binDir = prefix
26
+ ? (process.platform === 'win32' ? prefix : path.join(prefix, 'bin'))
27
+ : path.dirname(process.execPath);
13
28
 
14
29
  // If already on PATH, nothing to do.
15
30
  const pathDirs = (process.env.PATH || '').split(path.delimiter).map(d => d.replace(/\/$/, ''));
@@ -49,7 +64,7 @@ try {
49
64
  console.log('');
50
65
  console.log(`✅ AgentForge: added to PATH in ${profileFile}`);
51
66
  console.log(` Open a new terminal (or run: source ${profileFile})`);
52
- console.log(' Then type: agentforge start');
67
+ console.log(' Then type: agentforge setup');
53
68
  console.log('');
54
69
  } catch (err) {
55
70
  // Non-fatal — just tell the user what to add manually.
@@ -57,6 +72,6 @@ try {
57
72
  console.log(`⚠️ AgentForge: could not update ${profileFile} automatically.`);
58
73
  console.log(' Add this line to your shell profile manually:');
59
74
  console.log(` export PATH="${binDir}:$PATH"`);
60
- console.log(' Then open a new terminal and type: agentforge start');
75
+ console.log(' Then open a new terminal and type: agentforge setup');
61
76
  console.log('');
62
77
  }