@toothfairyai/tfcode 1.0.0-beta.6 → 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.
- package/bin/tfcode.js +57 -0
- package/package.json +1 -1
package/bin/tfcode.js
CHANGED
|
@@ -443,6 +443,63 @@ const cli = yargs(hideBin(process.argv))
|
|
|
443
443
|
.wrap(100)
|
|
444
444
|
.help()
|
|
445
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
|
+
})
|
|
446
503
|
.command({
|
|
447
504
|
command: 'setup',
|
|
448
505
|
describe: 'interactive credential setup',
|