autocommit.commands

Functions

diff_all_files([context, max_content_size, ...])

Print the diff between the staged version and the head for all modified files

diff_file(file[, context])

Print the diff between the staged version of the file and the head

ls_files([indicate_changes, only_changed])

List all files in the repository

print_file(file[, start_line, num_lines, staged])

Print the contents of the file.

autocommit.commands.print_file(file: str, start_line: int = 0, num_lines: int = 200, staged: bool = True, *, repository: Repository)[source]

Print the contents of the file.

Warning

this command does not actually read anything from the working directory, only from git objects and the staging area. This is mainly for security reasons (we do not want to give the LLM access to the filesystem).

Parameters:
  • file (or if the) – The file to print

  • start_line (int, optional) – The starting line. Defaults to 0.

  • num_lines (int, optional) – The number of lines to print. Defaults to 20.

  • staged (bool, optional) – Whether to print the staged version of the file

  • False (if available. Defaults to True. If)

  • file

  • area (is not in the staging)

  • used. (the latest tracked version is)

  • repository (Repository) – The current git repository

autocommit.commands.ls_files(indicate_changes: bool = True, only_changed: bool = False, *, repository: Repository)[source]

List all files in the repository

Parameters:
  • indicate_changes (bool, optional) – Whether to indicate changes in the files.

  • only_changed (bool, optional) – Whether to only list files that have changes.

  • repository (Repository) – The current git repository

Returns:

A list of all files in the repository

Return type:

list[str]

autocommit.commands.diff_file(file: str, context: int = 5, *, repository: Repository)[source]

Print the diff between the staged version of the file and the head

Parameters:
  • file (str) – The file to print the diff of

  • context (int, optional) – The number of lines of context to print. Defaults to 5.

  • repository (Repository) – The current git repository

autocommit.commands.diff_all_files(context: int = 5, *, repository: Repository, max_content_size=-1, max_total_size=90000)[source]

Print the diff between the staged version and the head for all modified files

Parameters:
  • context (int, optional) – The number of lines of context to print. Defaults to 5.

  • repository (Repository) – The current git repository

  • max_content_size (int, optional) – The maximum size of the content to print for one file

  • max_total_size (int, optional) – The maximum total size of the content to print if True, we automatically cut off the largest files to fit in this size