@@ -2,8 +2,8 @@ import * as path from 'path'
22import * as fs from 'fs/promises'
33import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
44import { replace_symbols } from '@/views/prompt/backend/utils/symbols/replace-symbols'
5+ import { cli_requirements } from '@/constants/instructions'
56import {
6-
77 EDIT_FORMAT_INSTRUCTIONS_DIFF ,
88 EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE ,
99 EDIT_FORMAT_INSTRUCTIONS_TRUNCATED ,
@@ -60,8 +60,12 @@ export const build_cli_prompt = async (params: {
6060 }
6161
6262 let files_section = ''
63+ let are_all_files_preloaded = false
64+ let are_any_files_preloaded = false
6365
6466 if ( total_content_length <= 20000 ) {
67+ are_all_files_preloaded = true
68+ are_any_files_preloaded = files_data . length > 0
6569 const file_blocks = files_data . map ( ( data ) =>
6670 data . content !== undefined
6771 ? `### File: \`${ data . relative_path } \`\n\n\`\`\`\n${ data . content } \n\`\`\``
@@ -83,11 +87,13 @@ export const build_cli_prompt = async (params: {
8387 file_blocks . push (
8488 `### File: \`${ data . relative_path } \`\n\n\`\`\`\n${ data . content } \n\`\`\``
8589 )
90+ are_any_files_preloaded = true
8691 } else {
8792 file_blocks . push ( `### Large file: \`${ data . relative_path } \`` )
8893 }
8994 } else {
9095 file_blocks . push ( `### File: \`${ data . relative_path } \`\n\n\`\`\`\n\n\`\`\`` )
96+ are_any_files_preloaded = true
9197 }
9298 }
9399
@@ -108,12 +114,20 @@ export const build_cli_prompt = async (params: {
108114 }
109115 }
110116
117+ const requirement = are_all_files_preloaded
118+ ? cli_requirements . preloaded_files
119+ : are_any_files_preloaded
120+ ? cli_requirements . referenced_files_with_some_preloaded
121+ : cli_requirements . referenced_files_only
122+
123+ const requirements_section = `# Requirements\n\n${ requirement } `
111124 const task_section = `# Task\n\n${ processed_query } `
112125
113126 const parts = [
114127 files_section ,
115128 skill_definitions ,
116129 output_formatting_section ,
130+ requirements_section ,
117131 task_section
118132 ] . filter ( ( p ) => p . trim ( ) != '' )
119133
0 commit comments