Skip to main content

Adhoc: Auto-Documenting Codebase Changes

Adhoc is a command-line tool designed to automatically document changes in your codebase. By integrating with language models, it generates detailed explanations of code modifications and compiles them into professional documentation formats such as LaTeX, Markdown, or Word. This tool streamlines the documentation process, making it effortless for developers to maintain up-to-date records of their code evolution.

Table of Contents

Features

  • Automatic Documentation: Generates explanations for code changes using a Language Learning Model (LLM).
  • Multiple Output Formats: Supports documentation in LaTeX, Markdown, and Word formats.
  • Version Control Integration: Detects code changes and commits through simple commands.
  • Configurable Settings: Allows customization of output formats and author information via a configuration file.
  • Extensible Design: Modular structure makes it easy to extend functionalities.

Installation

To install Adhoc, you can use pip:

pip install adhoc-python

Ensure you have the necessary dependencies listed in the requirements.txt file.

Usage

Adhoc provides a set of commands to initialize your project, commit changes, generate documentation, and configure settings. Below is an explanation of each command and how to use it.

Initialization

Before using Adhoc, you need to initialize your project:

adhoc init --model "your ollama model"

What it does:

  • Creates a .Adhoc directory in your project root to store configurations and databases.
  • Initializes a SQLite database to track code changes.
  • Generates an initial codebase summary using an LLM, providing an overview of your existing code.

Committing Changes

After making changes to your codebase, use the following command to commit those changes and generate explanations:

adhoc commit -m "Your commit message"

Options:

  • -m, --message: (Optional) A commit message describing the changes.

What it does:

  • Detects changes since the last commit by comparing snapshots.
  • Generates explanations for the changes using the LLM, incorporating your commit message if provided.
  • Stores the changes and explanations in the database for future reference.

Generating Documentation

To create documentation of your codebase and its changes, run:

adhoc generate

What it does:

  • Retrieves the codebase summary and change explanations from the database.
  • Generates a documentation file in the format specified in your configuration (latex, markdown, or word).
  • The output file (documentation.tex, documentation.md, or documentation.docx) is created in your project directory.

Configuration

Customize Adhoc settings using the adhoc config command:

adhoc config -d md -u "Your Name"

Options:

  • -d, --document-format: Sets the output document format. Accepts md for Markdown, tex for LaTeX, or word for Word documents.
  • -u, --username: Sets the author name to be used in the documentation.

What it does:

  • Updates the configuration file (config.json in the .Adhoc directory) with your preferences.
  • The changes affect how documentation is generated and personalized.

Example:

adhoc config -d word -u "Shreyas"
  • Sets the output format to Word.
  • Sets the author name to "Shreyas".

Requirements

  • Python 3.6 or higher

Dependencies:

  • jinja2
  • requests
  • watchdog
  • python-docx (for Word document generation)

Additional dependencies are listed in requirements.txt.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

A Reflective Note

"Life is an ad hoc affair. It has to be improvised all the time because of the hard fact that everything we do changes what is. This is distressing to people who would like to see things beautifully planned out and settled once and for all. That cannot be."
― Jane Jacobs

Happy coding!

Release files for adhoc-python 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adhoc-python 1.0.2
File Size Uploaded
adhoc_python-1.0.2.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adhoc-python 1.0.2
File Interpreter ABI Platform
adhoc_python-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 33.5 kB

Release files / adhoc_python-1.0.2.tar.gz

Download URL adhoc_python-1.0.2.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b602c502135b4bc19e12e754a53926b3c53f746a617514cb16de3d74306f765
BLAKE2b-256 checksum
How to use checksums
3eddc34271a8255bf877af0687e3b95c0bbf41976cd32615d41591c7c877f79e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / adhoc_python-1.0.2-py3-none-any.whl

Download URL adhoc_python-1.0.2-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8021f5b226246dc3125dd5be4307a3567ada159207aee5ff92afa1ef8436dda9
BLAKE2b-256 checksum
How to use checksums
df063c40479d73dd266b15f223ff86969c1d8f2ce73d68262a8b50ef7a395fce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page