feat: add analytics event hooks to file watcher

This commit is contained in:
Paul Gauthier 2024-12-09 10:31:57 -08:00 committed by Paul Gauthier (aider)
parent a997dd6c49
commit 89bc3b6b16
2 changed files with 3 additions and 0 deletions

View file

@ -858,6 +858,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
ignores.append(args.aiderignore) ignores.append(args.aiderignore)
if args.watch_files: if args.watch_files:
# AI pass analytics in
file_watcher = FileWatcher(coder, gitignores=ignores, verbose=args.verbose) file_watcher = FileWatcher(coder, gitignores=ignores, verbose=args.verbose)
coder.file_watcher = file_watcher coder.file_watcher = file_watcher

View file

@ -171,6 +171,7 @@ class FileWatcher:
if fname in self.coder.abs_fnames: if fname in self.coder.abs_fnames:
continue continue
# AI: fire an event()
self.coder.abs_fnames.add(fname) self.coder.abs_fnames.add(fname)
rel_fname = self.coder.get_rel_fname(fname) rel_fname = self.coder.get_rel_fname(fname)
self.io.tool_output(f"Added {rel_fname} to the chat") self.io.tool_output(f"Added {rel_fname} to the chat")
@ -179,6 +180,7 @@ class FileWatcher:
if not has_bangs: if not has_bangs:
return "" return ""
# fire a different event. AI!
self.io.tool_output("Processing your request...") self.io.tool_output("Processing your request...")
res = """ res = """