@toothfairyai/tfcode 1.0.0-beta.5 → 1.0.0-beta.7

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/tfcode.js +69 -39
  2. package/package.json +1 -1
package/bin/tfcode.js CHANGED
@@ -284,50 +284,23 @@ async function interactiveSetup() {
284
284
 
285
285
  log('');
286
286
 
287
- // Step 2: API Key (hidden)
287
+ // Step 2: API Key
288
288
  log(`${COLORS.bold}Step 2: API Key${COLORS.reset}`);
289
- log(`${COLORS.dim}Your API key will be hidden as you type${COLORS.reset}`);
289
+ log(`${COLORS.dim}Paste or type your API key${COLORS.reset}`);
290
290
  log('');
291
291
 
292
292
  const apiKey = await new Promise((resolve) => {
293
- if (!process.stdin.isTTY) {
294
- const rl = readline.createInterface({
295
- input: process.stdin,
296
- output: process.stdout
297
- });
298
- rl.question('Enter your API Key: ', (answer) => {
299
- rl.close();
300
- resolve(answer.trim());
301
- });
302
- return;
303
- }
304
-
305
- process.stdout.write('Enter your API Key: ');
306
- let input = '';
307
- const stdin = process.stdin;
308
-
309
- stdin.setRawMode(true);
310
- stdin.setEncoding('utf8');
311
- stdin.resume();
312
-
313
- const onKeypress = (str) => {
314
- if (str === '\n' || str === '\r' || str === '\u0004') {
315
- stdin.setRawMode(false);
316
- stdin.pause();
317
- stdin.removeListener('data', onKeypress);
318
- process.stdout.write('\n');
319
- resolve(input);
320
- } else if (str === '\u0003') {
321
- process.stdout.write('\n');
322
- process.exit();
323
- } else if (str === '\u007F' || str === '\b') {
324
- input = input.slice(0, -1);
325
- } else if (str.length === 1 && str.charCodeAt(0) >= 32) {
326
- input += str;
327
- }
328
- };
293
+ const rl = readline.createInterface({
294
+ input: process.stdin,
295
+ output: process.stdout
296
+ });
329
297
 
330
- stdin.on('data', onKeypress);
298
+ // Simple approach - just show the input (API keys are long anyway)
299
+ // This allows paste and works reliably
300
+ rl.question('Enter your API Key: ', (answer) => {
301
+ rl.close();
302
+ resolve(answer.trim());
303
+ });
331
304
  });
332
305
 
333
306
  if (!apiKey) {
@@ -470,6 +443,63 @@ const cli = yargs(hideBin(process.argv))
470
443
  .wrap(100)
471
444
  .help()
472
445
  .alias('help', 'h')
446
+ .command({
447
+ command: '*',
448
+ describe: 'start tfcode TUI',
449
+ handler: async () => {
450
+ // Try to run the full TUI
451
+ const { spawn } = require('child_process');
452
+ const { existsSync } = require('fs');
453
+ const { join } = require('path');
454
+
455
+ // Check if we're in the source repo
456
+ const possiblePaths = [
457
+ join(__dirname, '..', 'src', 'index.ts'),
458
+ join(__dirname, '..', '..', '..', 'src', 'index.ts'),
459
+ ];
460
+
461
+ let srcPath = null;
462
+ for (const p of possiblePaths) {
463
+ if (existsSync(p)) {
464
+ srcPath = p;
465
+ break;
466
+ }
467
+ }
468
+
469
+ if (srcPath) {
470
+ // Run via bun or tsx
471
+ const runner = process.env.TFCODE_RUNNER || (existsSync('/usr/local/bin/bun') ? 'bun' : 'npx');
472
+ const args = runner === 'bun' ? ['run', srcPath] : ['tsx', srcPath];
473
+
474
+ const child = spawn(runner, args, {
475
+ stdio: 'inherit',
476
+ cwd: __dirname,
477
+ env: { ...process.env }
478
+ });
479
+
480
+ child.on('exit', (code) => {
481
+ process.exit(code || 0);
482
+ });
483
+ } else {
484
+ // Not in source repo - show message
485
+ log('');
486
+ log(`${COLORS.bold}${COLORS.cyan}tfcode${COLORS.reset} - ToothFairyAI's AI coding assistant`);
487
+ log('');
488
+ log('The full TUI requires the compiled binary.');
489
+ log('');
490
+ log('Available commands:');
491
+ log(` ${COLORS.cyan}tfcode setup${COLORS.reset} Interactive credential setup`);
492
+ log(` ${COLORS.cyan}tfcode validate${COLORS.reset} Test your credentials`);
493
+ log(` ${COLORS.cyan}tfcode sync${COLORS.reset} Sync tools from workspace`);
494
+ log(` ${COLORS.cyan}tfcode tools list${COLORS.reset} List synced tools`);
495
+ log('');
496
+ log(`${COLORS.dim}For full TUI, build from source:${COLORS.reset}`);
497
+ log(`${COLORS.dim} git clone https://github.com/ToothFairyAI/tfcode${COLORS.reset}`);
498
+ log(`${COLORS.dim} cd tfcode/packages/tfcode && bun install && bun run src/index.ts${COLORS.reset}`);
499
+ log('');
500
+ }
501
+ }
502
+ })
473
503
  .command({
474
504
  command: 'setup',
475
505
  describe: 'interactive credential setup',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toothfairyai/tfcode",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "ToothFairyAI's official AI coding agent",
5
5
  "keywords": ["toothfairyai", "ai", "coding", "cli"],
6
6
  "author": "ToothFairyAI",