Skip to content

Commit cce336f

Browse files
authored
Merge pull request #551 from cecli-dev/v0.100.4
V0.100.4
2 parents e53c2cd + 52c9ab1 commit cce336f

86 files changed

Lines changed: 1243 additions & 181 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cecli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from packaging import version
22

3-
__version__ = "0.100.2.dev"
3+
__version__ = "0.100.4.dev"
44
safe_version = __version__
55

66
try:

cecli/coders/base_coder.py

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from cecli.exceptions import LiteLLMExceptions
4343
from cecli.helpers import command_parser, coroutines, nested, responses
4444
from cecli.helpers.conversation import ConversationService, MessageTag
45+
from cecli.helpers.file_system import FileSystemService
4546
from cecli.helpers.io_proxy import IOProxy
4647
from cecli.helpers.observations.service import ObservationService
4748
from cecli.helpers.profiler import TokenProfiler
@@ -459,9 +460,7 @@ def __init__(
459460

460461
self.context_compaction_max_tokens = context_compaction_max_tokens
461462
self.context_compaction_summary_tokens = context_compaction_summary_tokens
462-
self.max_reflections = (
463-
3 if self.edit_format == "agent" else nested.getter(self.args, "max_reflections", 3)
464-
)
463+
self.max_reflections = nested.getter(self.args, "max_reflections", 3)
465464

466465
if not fnames:
467466
fnames = []
@@ -547,7 +546,6 @@ def __init__(
547546

548547
self.data_cache = {
549548
"repo": {"last_key": "", "read_only_count": None},
550-
"relative_files": None,
551549
}
552550

553551
self.repo = repo
@@ -594,6 +592,12 @@ def __init__(
594592
if not self.repo:
595593
self.root = utils.find_common_root(self.abs_fnames)
596594

595+
# Initialize the FileSystemService singleton for all agents
596+
FileSystemService.get_instance(
597+
root=self.root if hasattr(self, "root") else ".",
598+
repo=self.repo if hasattr(self, "repo") else None,
599+
)
600+
597601
if read_only_fnames:
598602
self.abs_read_only_fnames = set()
599603
for fname in read_only_fnames:
@@ -3226,7 +3230,7 @@ async def check_for_file_mentions(self, content):
32263230
group = ConfirmGroup(new_mentions)
32273231
for rel_fname in sorted(new_mentions):
32283232
message = "Add file to the chat?"
3229-
if self.args.tui:
3233+
if self.args and self.args.tui:
32303234
message = f"Add file to the chat? ({rel_fname})"
32313235

32323236
if await self.io.confirm_ask(
@@ -3909,37 +3913,16 @@ def is_file_safe(self, fname):
39093913
return
39103914

39113915
def get_all_relative_files(self):
3912-
if self.repo_map and self.repo:
3913-
try:
3914-
staged_files_hash = hash(
3915-
str([item.a_path for item in self.repo.repo.index.diff("HEAD")])
3916-
)
3917-
if (
3918-
staged_files_hash == self.data_cache["repo"]["last_key"]
3919-
and self.data_cache["relative_files"]
3920-
):
3921-
return self.data_cache["relative_files"]
3922-
except ANY_GIT_ERROR as err:
3923-
# Handle git errors gracefully - fall back to getting tracked files
3924-
if self.verbose:
3925-
self.io.tool_warning(f"Git error while checking staged files: {err}")
3926-
# Continue to get tracked files normally
3927-
3928-
if self.repo:
3929-
if hasattr(self.repo, "workspace_path") and self.repo.workspace_path:
3930-
files = self.repo.get_workspace_files()
3931-
elif not self.repo.cecli_ignore_file or not self.repo.cecli_ignore_file.is_file():
3932-
files = self.repo.get_tracked_files()
3933-
else:
3934-
files = self.repo.get_non_ignored_files_from_root()
3935-
else:
3936-
files = self.get_inchat_relative_files()
3937-
# This is quite slow in large repos
3938-
# files = [fname for fname in files if self.is_file_safe(fname)]
3939-
3940-
self.data_cache["relative_files"] = sorted(set(files))
3941-
3942-
return self.data_cache["relative_files"]
3916+
"""Get all files known to the file service singleton."""
3917+
fs = FileSystemService.get_instance()
3918+
if fs.trie:
3919+
# Auto-rebuild if the repository state has changed
3920+
# (e.g., new commits, staged files, or HEAD change)
3921+
if fs.needs_rebuild():
3922+
fs.rebuild()
3923+
files = fs.list_all()
3924+
return files
3925+
return self.get_inchat_relative_files()
39433926

39443927
def get_all_abs_files(self):
39453928
files = self.get_all_relative_files()

cecli/commands/agent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class AgentCommand(BaseCommand):
99
"Enter agent mode to autonomously discover and manage relevant files. If no prompt"
1010
" provided, switches to agent mode."
1111
)
12+
show_completion_notification = True
1213

1314
@classmethod
1415
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/agent_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class AgentModelCommand(BaseCommand):
1010
NORM_NAME = "agent-model"
1111
DESCRIPTION = "Switch the Agent Model to a new LLM"
12-
show_completion_notification = False
12+
show_completion_notification = True
1313

1414
@classmethod
1515
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/architect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ArchitectCommand(BaseCommand):
99
"Enter architect/editor mode using 2 different models. If no prompt provided, switches to"
1010
" architect/editor mode."
1111
)
12+
show_completion_notification = True
1213

1314
@classmethod
1415
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/ask.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class AskCommand(BaseCommand):
99
"Ask questions about the code base without editing any files. If no prompt provided,"
1010
" switches to ask mode."
1111
)
12+
show_completion_notification = True
1213

1314
@classmethod
1415
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class CodeCommand(BaseCommand):
77
NORM_NAME = "code"
88
DESCRIPTION = "Ask for changes to your code. If no prompt provided, switches to code mode."
9+
show_completion_notification = True
910

1011
@classmethod
1112
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/command_prefix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class CommandPrefixCommand(BaseCommand):
88
NORM_NAME = "command-prefix"
99
DESCRIPTION = "Change command prefix for all running commands"
10+
show_completion_notification = True
1011

1112
@classmethod
1213
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/commit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class CommitCommand(BaseCommand):
99
NORM_NAME = "commit"
1010
DESCRIPTION = "Commit edits to the repo made outside the chat (commit message optional)"
11+
show_completion_notification = True
1112

1213
@classmethod
1314
async def execute(cls, io, coder, args, **kwargs):

cecli/commands/compact.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class CompactCommand(BaseCommand):
55
NORM_NAME = "compact"
66
DESCRIPTION = "Force compaction of the chat history context"
7+
show_completion_notification = True
78

89
@classmethod
910
async def execute(cls, io, coder, args, **kwargs):

0 commit comments

Comments
 (0)