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:
Load configuration from JSON file
Extract files matching include/exclude patterns
Process and combine content into knowledge base file(s)
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
- 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_staging¶
Directory where staging files will be stored.
- 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.