main¶

Knowledge Base Builder for GitHub Repositories.

A tool that fetches and consolidates documentation from GitHub repositories into knowledge base files for AI-powered assistance. This allows repository owners to create searchable knowledge bases without complex setup.

Key features:

  • Configurable file inclusion/exclusion via pattern matching

  • Automatic GitHub release publishing with knowledge base assets

  • CI/CD integration via GitHub Actions

Main workflow:

  1. Load configuration from JSON file

  2. Extract files matching include/exclude patterns

  3. Process and combine content into knowledge base file(s)

  4. Publish knowledge base file(s) to GitHub as release assets

class esclusive_ai_for_github_repo.main.EnvVar[source]¶

Environment variables lazy loader.

  • `Default environment variables

<https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables>`_

property GITHUB_TOKEN: str¶

Ref:

esclusive_ai_for_github_repo.main.get_url_content(url: str) str[source]¶

Fetch and return the content of a URL as a string.

class esclusive_ai_for_github_repo.main.Paths(dir_project_root: Path)[source]¶

Path manager for the knowledge base builder.

Centralizes all file path handling to ensure consistent locations for inputs, outputs, and temporary files across the application. This prevents hardcoded paths and makes directory structure changes easier to implement.

Directory structure:

property dir_tmp: Path¶

Temporary directory for working files.

property path_esclusive_ai_for_github_repo_config_json: Path¶

Path to the configuration JSON file.

property path_prompt_md: Path¶

Path to the prompt.md file for AI Prompt.

property dir_staging¶

Directory where staging files will be stored.

property dir_document_groups: Path¶

Path to the consolidated knowledge base output file.

class esclusive_ai_for_github_repo.main.DocumentGroup(name: str, include: list[str], exclude: list[str])[source]¶
class esclusive_ai_for_github_repo.main.Config(document_groups: list[DocumentGroup])[source]¶

Configuration for the knowledge base builder.

esclusive_ai_for_github_repo.main.build_knowledge_base(paths: Paths, config: Config)[source]¶

Build the knowledge base from all configured sources.

This is the main processing function that extracts content from the repository and combines it into a single knowledge base file.

esclusive_ai_for_github_repo.main.create_tag(repo: <module 'github.Repository' from '/Users/sanhehu/Documents/GitHub/esclusive-ai-for-github-repo/.venv/lib/python3.11/site-packages/github/Repository.py'>)[source]¶

Create a Git tag for the knowledge base release.

Creates a tag pointing to the latest commit on the default branch, which will be used for the GitHub release.

esclusive_ai_for_github_repo.main.create_release(repo: <module 'github.Repository' from '/Users/sanhehu/Documents/GitHub/esclusive-ai-for-github-repo/.venv/lib/python3.11/site-packages/github/Repository.py'>)[source]¶

Create or get the GitHub release for publishing the knowledge base.

Checks if a release with the specified name already exists. If not, creates a new one.

esclusive_ai_for_github_repo.main.upload_assets(release: <module 'github.Repository' from '/Users/sanhehu/Documents/GitHub/esclusive-ai-for-github-repo/.venv/lib/python3.11/site-packages/github/Repository.py'>, paths: ~esclusive_ai_for_github_repo.main.Paths, config: ~esclusive_ai_for_github_repo.main.Config)[source]¶

Upload knowledge base files as assets to the GitHub release.

Replaces any existing assets with the same names to ensure the release always has the latest versions of all document groups.

esclusive_ai_for_github_repo.main.publish_knowledge_base(paths: Paths, config: Config)[source]¶

Publish all document group files to GitHub releases.

This is the main publishing function that handles GitHub authentication, release creation, and asset uploading for all document groups.