@@ -12,9 +12,8 @@ import { handleError, Errors } from '../utils/errorHandler';
1212
1313export async function fixCommand ( options : { yes ?: boolean } = { } ) {
1414 try {
15- console . log ( chalk . bold . cyan ( '\n🔧 TunePrompt Fix\n' ) ) ;
15+ console . log ( '' ) ;
1616
17- // License check with better error
1817 const spinner = ora ( 'Checking license...' ) . start ( ) ;
1918 const licenseValid = await checkLicense ( ) ;
2019
@@ -26,39 +25,32 @@ export async function fixCommand(options: { yes?: boolean } = {}) {
2625
2726 spinner . succeed ( 'License validated' ) ;
2827
29- // Load failed tests with error handling
3028 const failedTests = await getFailedTests ( ) ;
3129
3230 if ( failedTests . length === 0 ) {
3331 throw Errors . NO_FAILED_TESTS ;
3432 }
3533
36- console . log ( chalk . yellow ( `\nFound ${ failedTests . length } failed test(s):\n ` ) ) ;
34+ console . log ( chalk . yellow ( `\n ${ failedTests . length } failed test(s):` ) ) ;
3735
3836 failedTests . forEach ( ( test : FailedTest , index : number ) => {
39- const modelInfo = test . config ?. model ? ` [Target: ${ test . config . provider || 'unknown' } /${ test . config . model } ]` : '' ;
40- console . log ( `${ index + 1 } . ${ chalk . bold ( test . description ) } ${ chalk . cyan ( modelInfo ) } ` ) ;
41- console . log ( ` Score: ${ chalk . red ( test . score . toFixed ( 2 ) ) } (threshold: ${ test . threshold } )` ) ;
37+ console . log ( chalk . gray ( ` ${ index + 1 } . ${ test . description } — score: ${ chalk . red ( test . score . toFixed ( 2 ) ) } / ${ test . threshold } ` ) ) ;
4238 } ) ;
4339
4440 // Step 3: Ask which tests to fix
4541 let selectedIndexes : number [ ] = [ ] ;
4642 if ( options . yes ) {
4743 selectedIndexes = failedTests . map ( ( _ , i ) => i ) ;
48- console . log ( chalk . gray ( `\nNon-interactive mode: Automatic selection of all ${ failedTests . length } tests.` ) ) ;
4944 } else {
5045 const response = await inquirer . prompt ( [ {
5146 type : 'checkbox' ,
5247 name : 'selectedIndexes' ,
5348 message : 'Which tests would you like to fix?' ,
54- choices : failedTests . map ( ( test : FailedTest , index : number ) => {
55- const modelInfo = test . config ?. model ? ` [${ test . config . provider || 'unknown' } /${ test . config . model } ]` : '' ;
56- return {
57- name : `${ test . description } (score: ${ test . score . toFixed ( 2 ) } )${ modelInfo } ` ,
58- value : index ,
59- checked : true
60- } ;
61- } )
49+ choices : failedTests . map ( ( test : FailedTest , index : number ) => ( {
50+ name : `${ test . description } (${ test . score . toFixed ( 2 ) } )` ,
51+ value : index ,
52+ checked : true
53+ } ) )
6254 } ] ) ;
6355 selectedIndexes = response . selectedIndexes ;
6456 }
@@ -78,8 +70,8 @@ export async function fixCommand(options: { yes?: boolean } = {}) {
7870 const test = failedTests [ index ] ;
7971 const suite = await getSuiteTests ( test . id ) ;
8072
81- const modelInfo = test . config ?. model ? ` (Target: ${ test . config . model } )` : '' ;
82- console . log ( chalk . bold ( `\n\n ━━━ Fixing: ${ test . description } ${ modelInfo } ━━━\n` ) ) ;
73+ const modelInfo = test . config ?. model ? ` (${ test . config . model } )` : '' ;
74+ console . log ( chalk . bold ( `\n━━━ ${ test . description } ${ modelInfo } ━━━\n` ) ) ;
8375
8476 try {
8577 const result = await optimizer . optimize ( test , suite ) ;
@@ -104,8 +96,7 @@ export async function fixCommand(options: { yes?: boolean } = {}) {
10496
10597 if ( action === 'apply' ) {
10698 await applyFix ( test , result . optimizedPrompt ) ;
107- console . log ( `\n${ chalk . bgGreen . black ( ' DONE ' ) } ${ chalk . green ( 'Prompt updated in:' ) } ${ chalk . bold ( test . id ) } ` ) ;
108- console . log ( chalk . gray ( 'The next run will use this new prompt.\n' ) ) ;
99+ console . log ( chalk . green ( ` ✓ Updated: ${ test . id } ` ) ) ;
109100 } else if ( action === 'edit' ) {
110101 console . log ( chalk . gray ( '\nOpening editor... (Save and close to apply)\n' ) ) ;
111102 const { edited } = await inquirer . prompt ( [ {
@@ -126,8 +117,7 @@ export async function fixCommand(options: { yes?: boolean } = {}) {
126117 }
127118 }
128119
129- console . log ( chalk . bold . green ( '\n\n✨ Fix session complete!\n' ) ) ;
130- console . log ( chalk . gray ( 'Run `tuneprompt run` to verify your fixes.\n' ) ) ;
120+ console . log ( chalk . bold . green ( '\n✨ Done. Run `tuneprompt run` to verify.\n' ) ) ;
131121
132122 // After fix completes
133123 const license = getLicenseInfo ( ) ;
@@ -145,20 +135,9 @@ export async function fixCommand(options: { yes?: boolean } = {}) {
145135}
146136
147137function showUpgradePrompt ( ) {
148- console . log ( chalk . yellow ( '\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━' ) ) ;
149- console . log ( chalk . bold ( '🔒 Premium Feature: Auto-Fix Engine\n' ) ) ;
150- console . log ( 'The ' + chalk . cyan ( 'fix' ) + ' command uses advanced AI to automatically' ) ;
151- console . log ( 'repair your failing prompts.\n' ) ;
152- console . log ( chalk . bold ( 'What you get:' ) ) ;
153- console . log ( ' ✅ AI-powered prompt optimization' ) ;
154- console . log ( ' ✅ Shadow testing before applying fixes' ) ;
155- console . log ( ' ✅ Interactive diff viewer' ) ;
156- console . log ( ' ✅ Unlimited fix attempts\n' ) ;
157-
158- console . log ( chalk . bold ( 'Get Premium:' ) ) ;
159- console . log ( ` 1. Buy a license: ${ chalk . blue . underline ( 'https://www.tuneprompt.xyz/pricing' ) } ` ) ;
160- console . log ( ` 2. Activate: ${ chalk . gray ( 'tuneprompt activate <your-key>' ) } \n` ) ;
161- console . log ( chalk . yellow ( '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' ) ) ;
138+ console . log ( chalk . yellow ( '\n🔒 Premium feature. Get access:' ) ) ;
139+ console . log ( chalk . gray ( ` ${ chalk . blue . underline ( 'https://www.tuneprompt.xyz/pricing' ) } ` ) ) ;
140+ console . log ( chalk . gray ( ` Then: ${ chalk . white ( 'tuneprompt activate <key>' ) } \n` ) ) ;
162141}
163142
164143async function showDiff ( original : string , optimized : string , reasoning : string ) {
0 commit comments