diff --git a/aider/coder.py b/aider/coder.py index 374e96702..f6deb9029 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -168,7 +168,10 @@ class Coder: if self.abs_fnames: files_content = prompts.files_content_prefix files_content += self.get_files_content() - all_content += files_content + else: + files_content = prompts.files_no_full_files + + all_content += files_content other_files = set(self.get_all_abs_files()) - set(self.abs_fnames) repo_content = self.repo_map.get_repo_map(self.abs_fnames, other_files) diff --git a/aider/prompts.py b/aider/prompts.py index e33f0632d..0a53e5188 100644 --- a/aider/prompts.py +++ b/aider/prompts.py @@ -8,14 +8,12 @@ Take requests for changes to the supplied code. If the request is ambiguous, ask questions. Once you understand the request you MUST: -1. List the files you need to modify. +1. List the files you need to modify. If they are *read-only* ask the user to make them *read-write* using the file's full path name. 2. Think step-by-step and explain the needed changes. 3. Describe each change with an *edit block* per the example below. """ -system_reminder = """Base any edits off the files shown in the user's last msg. - -You MUST format EVERY code change with an *edit block* like this: +system_reminder = """You MUST format EVERY code change with an *edit block* like this: ```python some/dir/example.py @@ -29,11 +27,11 @@ some/dir/example.py def add(a,b): >>>>>>> UPDATED +Every *edit block* must be fenced w/triple backticks with the correct code language. +Every *edit block* must start with the full path! *NEVER* propose edit blocks for *read-only* files. The ORIGINAL section must be an *exact* set of lines from the file: - NEVER SKIP LINES! - Include all original leading spaces and indentation! -Every *edit block* must be fenced w/triple backticks with the correct code language. -Every *edit block* must start with the full path! Edits to different parts of a file each need their own *edit block*. @@ -54,11 +52,13 @@ files_content_gpt_no_edits = "I didn't see any properly formatted edits in your files_content_local_edits = "I edited the files myself." -files_content_prefix = "Propose changes to *only* these files (ask before editing others):\n" +files_content_prefix = "These are the *read-write* files:\n" + +files_no_full_files = "I am not sharing any *read-write* files yet." repo_content_prefix = ( - "Here is a map of all the {other}files{ctags_msg}. You *must* ask with the" - " full path before editing these:\n\n" + "All the files below here are *read-only* files. Notice that files in directories are indented." + " Use their parent dirs to build their full path.\n" ) diff --git a/aider/repomap.py b/aider/repomap.py index c4796b78b..577b7973d 100644 --- a/aider/repomap.py +++ b/aider/repomap.py @@ -122,6 +122,7 @@ class RepoMap: def split_path(self, path): path = os.path.relpath(path, self.root) + return [path] return fname_to_components(path, True) def get_tags(self, filename):