phewsh 0.11.8 → 0.11.9

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/commands/session.js +66 -12
  2. package/package.json +1 -1
@@ -214,13 +214,25 @@ async function main() {
214
214
  console.log('');
215
215
 
216
216
  if (!config?.apiKey) {
217
- console.log(` ${yellow('')} No API key configured.`);
218
- console.log(` ${g('Run')} /login ${g('to set up identity + API key')}`);
219
- console.log(` ${g('Or')} /key ${g('to add an API key directly')}`);
217
+ console.log(` ${b(w('Welcome to PHEWSH.'))}`);
218
+ console.log(` ${g('Your AI knows your project. No more re-explaining.')}`);
219
+ console.log('');
220
+ console.log(` ${w('To get started, you need an API key from one of these:')}`);
221
+ console.log('');
222
+ console.log(` ${cyan('1')} ${b('Anthropic')} ${g('(recommended)')}`);
223
+ console.log(` ${g('console.anthropic.com/settings/keys')}`);
224
+ console.log(` ${g('Direct access to Claude. Best quality.')}`);
225
+ console.log('');
226
+ console.log(` ${cyan('2')} ${b('OpenRouter')}`);
227
+ console.log(` ${g('openrouter.ai/keys')}`);
228
+ console.log(` ${g('One key, many models (Claude, GPT, Gemini, etc.)')}`);
229
+ console.log('');
230
+ console.log(` ${g('Got a key? Type')} /key ${g('to paste it in.')}`);
231
+ console.log(` ${g('Want cloud sync too?')} /login ${g('connects your identity.')}`);
220
232
  console.log('');
221
233
  } else if (!config.apiKey.startsWith('sk-')) {
222
- console.log(` ${yellow('')} Stored API key looks invalid (doesn't start with sk-).`);
223
- console.log(` ${g('Run')} /key ${g('to set a valid Anthropic API key')}`);
234
+ console.log(` ${yellow('!')} Stored API key looks invalid.`);
235
+ console.log(` ${g('Run')} /key ${g('to set a new one')}`);
224
236
  console.log('');
225
237
  config.apiKey = null; // Don't try to use a bad key
226
238
  }
@@ -256,7 +268,11 @@ async function main() {
256
268
  }
257
269
 
258
270
  console.log('');
259
- console.log(` ${g('type naturally · /help for commands · /quit to exit')}`);
271
+ if (!config?.apiKey) {
272
+ console.log(` ${g('type')} /key ${g('to get started · /help for all commands · /quit to exit')}`);
273
+ } else {
274
+ console.log(` ${g('type naturally · /help for commands · /quit to exit')}`);
275
+ }
260
276
  console.log('');
261
277
 
262
278
  const rl = readline.createInterface({
@@ -534,20 +550,52 @@ async function main() {
534
550
  }
535
551
 
536
552
  if (cmd === 'key') {
553
+ if (cmdArg) {
554
+ // Inline: /key sk-ant-...
555
+ const apiKey = cmdArg.trim();
556
+ config = loadConfig() || {};
557
+ if (apiKey.startsWith('sk-ant-') || apiKey.startsWith('sk-')) {
558
+ config.apiKey = apiKey;
559
+ config.provider = 'anthropic';
560
+ saveConfig(config);
561
+ console.log(` ${green('●')} Anthropic API key saved. You're ready to go — just type.\n`);
562
+ } else if (apiKey.startsWith('sk-or-')) {
563
+ config.apiKey = apiKey;
564
+ config.provider = 'openrouter';
565
+ saveConfig(config);
566
+ console.log(` ${green('●')} OpenRouter API key saved. You're ready to go — just type.\n`);
567
+ } else {
568
+ config.apiKey = apiKey;
569
+ saveConfig(config);
570
+ console.log(` ${green('●')} API key saved. You're ready to go — just type.\n`);
571
+ }
572
+ rl.prompt();
573
+ return;
574
+ }
575
+ console.log('');
576
+ console.log(` ${b('Where to get an API key:')}`);
577
+ console.log('');
578
+ console.log(` ${cyan('Anthropic')} ${g('(recommended)')}`);
579
+ console.log(` ${g('1.')} Go to ${w('console.anthropic.com/settings/keys')}`);
580
+ console.log(` ${g('2.')} Create key → copy it (starts with sk-ant-)`)
581
+ console.log('');
582
+ console.log(` ${cyan('OpenRouter')} ${g('(multi-model)')}`);
583
+ console.log(` ${g('1.')} Go to ${w('openrouter.ai/keys')}`);
584
+ console.log(` ${g('2.')} Create key → copy it (starts with sk-or-)`)
585
+ console.log('');
537
586
  const keyRl = readline.createInterface({ input: process.stdin, output: process.stdout });
538
- keyRl.question(`\n Anthropic API key (starts with sk-ant-)\n > `, (apiKey) => {
587
+ keyRl.question(` Paste your API key\n > `, (apiKey) => {
539
588
  keyRl.close();
540
589
  apiKey = apiKey.trim();
541
590
  if (!apiKey) {
542
591
  console.log(` ${g('Cancelled')}\n`);
543
- } else if (!apiKey.startsWith('sk-ant-') && !apiKey.startsWith('sk-')) {
544
- console.log(` ${yellow('!')} That doesn't look like an Anthropic API key.`);
545
- console.log(` ${g('Anthropic keys start with sk-ant- — get one at console.anthropic.com')}\n`);
546
592
  } else {
547
593
  config = loadConfig() || {};
548
594
  config.apiKey = apiKey;
595
+ if (apiKey.startsWith('sk-or-')) config.provider = 'openrouter';
596
+ else config.provider = 'anthropic';
549
597
  saveConfig(config);
550
- console.log(` ${green('●')} API key saved\n`);
598
+ console.log(`\n ${green('●')} API key saved. You're ready — just type naturally.\n`);
551
599
  }
552
600
  rl.prompt();
553
601
  });
@@ -646,7 +694,13 @@ async function main() {
646
694
 
647
695
  // Regular input → send to AI
648
696
  if (!config?.apiKey) {
649
- console.log(`\n ${yellow('')} No API key configured. Run /key to set one.\n`);
697
+ console.log('');
698
+ console.log(` ${yellow('Almost there!')} You need an API key to chat.`);
699
+ console.log(` Type ${w('/key')} and paste one in — takes 10 seconds.`);
700
+ console.log('');
701
+ console.log(` ${g('Get a key:')} ${cyan('console.anthropic.com/settings/keys')}`);
702
+ console.log(` ${g('Or try:')} ${cyan('openrouter.ai/keys')}`);
703
+ console.log('');
650
704
  rl.prompt();
651
705
  return;
652
706
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phewsh",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
4
4
  "description": "Turn intent into action. Structure your thinking, execute your next step.",
5
5
  "bin": {
6
6
  "phewsh": "bin/phewsh.js"