@phnx-labs/agents-cli 1.14.7 → 1.15.0

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.
@@ -13,8 +13,15 @@ const SHIMS_DIR = path.join(HOME, '.agents-system', 'shims');
13
13
  const SYSTEM_DIR = path.join(HOME, '.agents-system');
14
14
  const USER_DIR = path.join(HOME, '.agents');
15
15
 
16
- // Only run for global installs
17
- if (!process.env.npm_config_global && !process.argv.includes('-g')) {
16
+ // For local installs, create directories and show a message
17
+ const isGlobalInstall = process.env.npm_config_global || process.argv.includes('-g');
18
+ if (!isGlobalInstall) {
19
+ // Still create user directories for local installs
20
+ fs.mkdirSync(USER_DIR, { recursive: true, mode: 0o700 });
21
+ console.log(`
22
+ agents-cli installed locally.
23
+ To complete setup, run: npx agents init
24
+ `);
18
25
  process.exit(0);
19
26
  }
20
27
 
@@ -165,17 +172,38 @@ async function main() {
165
172
  return;
166
173
  }
167
174
 
168
- // Default: print PATH instructions, then offer aliases interactively.
169
- console.log(`
170
- agents-cli installed.
171
- To enable version-aware shims, add the following line to your shell config:
175
+ // Default: offer to auto-add shims to PATH (like homebrew does)
176
+ const rcFile = getShellRc();
177
+ let alreadyConfigured = false;
178
+ if (fs.existsSync(rcFile)) {
179
+ const content = fs.readFileSync(rcFile, 'utf-8');
180
+ alreadyConfigured = content.includes('.agents-system/shims');
181
+ }
172
182
 
173
- ${exportLine}
183
+ console.log(`\nagents-cli installed.`);
174
184
 
175
- (zsh: ~/.zshrc, bash: ~/.bashrc, fish: ~/.config/fish/config.fish)
185
+ if (!alreadyConfigured && process.stdin.isTTY && process.stdout.isTTY) {
186
+ const answer = await ask(`\nAdd shims to PATH in ~/${path.basename(rcFile)}? [Y/n] `);
187
+ if (answer === '' || answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
188
+ const addition = `\n# agents-cli: version switching for AI coding agents\n${exportLine}\n`;
189
+ fs.mkdirSync(path.dirname(rcFile), { recursive: true });
190
+ fs.appendFileSync(rcFile, addition);
191
+ console.log(`\n Added ${SHIMS_DIR} to PATH in ${path.basename(rcFile)}`);
192
+ console.log(` Restart your shell or run: source ~/${path.basename(rcFile)}\n`);
193
+ } else {
194
+ console.log(`
195
+ To enable version-aware shims, add this to your shell config:
176
196
 
177
- Or re-run with AGENTS_INIT_SHELL=1 to have the installer add it for you.
197
+ ${exportLine}
178
198
  `);
199
+ }
200
+ } else if (!alreadyConfigured) {
201
+ console.log(`
202
+ To enable version-aware shims, add this to your shell config:
203
+
204
+ ${exportLine}
205
+ `);
206
+ }
179
207
 
180
208
  const choice = await promptForAliases();
181
209
  if (choice === 'install') {