GitWise API & Core Components

This document provides an overview of GitWise’s internal structure, focusing on key classes and modules that developers might interact with or want to understand for contribution or advanced usage.

1. Core Git Operations: gitwise.core.git_manager.GitManager

All direct Git interactions are centralized in the gitwise.core.git_manager.GitManager class. This class uses subprocess to execute Git commands.

Initialization

To use the GitManager, instantiate it. You can optionally provide a path to a Git repository; otherwise, it defaults to the current working directory.

from gitwise.core.git_manager import GitManager

# Initialize for the current directory's repository
git_m = GitManager()

# Initialize for a specific repository path
# git_m_specific_path = GitManager(path="/path/to/your/repo")

Key Public Methods of GitManager

Below are some of the core methods provided by GitManager. Refer to the source code for a complete list and detailed arguments.

(For a full list of methods and their parameters, please refer to gitwise/core/git_manager.py)

2. Feature Logic (gitwise.features)

Core functionalities of GitWise commands are encapsulated within feature classes in the gitwise.features package. These classes utilize GitManager for Git operations and the LLM router for AI assistance.

features.add.AddFeature

features.commit.CommitFeature

features.push.PushFeature

features.pr.PrFeature

features.changelog.ChangelogFeature

3. LLM Interaction (gitwise.llm)

4. Configuration (gitwise.config)

5. Prompts (gitwise.prompts)

6. Command Line Interface (gitwise.cli)

Best Practices

(This section can be retained or updated from the old API doc if relevant to internal development)

  1. Commit Messages: Use conventional commit format.
  2. Branch Names: Use prefixes like feature/, fix/.
  3. Pull Requests: Create from feature branches, include clear descriptions.
  4. Changelog: Keep [Unreleased] up to date, use semantic versioning.

Error Handling

(This section can be retained or updated)

Contributing

Contributions to the API and core logic are welcome! Please see CONTRIBUTING.md for guidelines.