Skip to main content

Repositories

Connect your Git repositories to Dendrite for automatic documentation generation.

Connecting a Repository

Via GitHub App

The easiest way - install the Dendrite GitHub App:
  1. Go to Settings > Integrations > GitHub
  2. Click Install GitHub App
  3. Select repositories to connect
  4. Dendrite syncs automatically on push

Via URL

Connect any Git repository by URL:
BrainzLab::Dendrite.connect_repository(
  url: "https://github.com/acme/api",
  branch: "main",
  access_token: "ghp_xxx" # for private repos
)

Via SSH

For private repositories with SSH:
BrainzLab::Dendrite.connect_repository(
  url: "[email protected]:acme/api.git",
  branch: "main",
  ssh_key: ENV["DENDRITE_SSH_KEY"]
)

Repository Settings

Configure how Dendrite processes your repository:
repo = BrainzLab::Dendrite.repository("acme-api")

repo.configure(
  # Files to include/exclude
  include_patterns: ["app/**/*.rb", "lib/**/*.rb"],
  exclude_patterns: ["vendor/**", "node_modules/**"],

  # Sync settings
  auto_sync: true,
  sync_on_push: true,

  # Documentation settings
  language: "ruby",
  framework: "rails"
)

Sync Status

Check the sync status of a repository:
repo = BrainzLab::Dendrite.repository("acme-api")

puts repo.sync_status
# => :synced, :syncing, :pending, :failed

puts repo.last_synced_at
# => 2024-01-15 10:30:00 UTC

puts repo.last_commit
# => "abc1234 - Add user authentication"

Manual Sync

Trigger a manual sync:
BrainzLab::Dendrite.sync_repository("acme-api")
Or sync all repositories:
BrainzLab::Dendrite.sync_all

Processing Pipeline

When Dendrite syncs a repository:
  1. Clone/Pull - Fetches latest code from Git
  2. Parse - Analyzes code with tree-sitter (AST)
  3. Chunk - Breaks code into meaningful segments
  4. Embed - Generates embeddings with local model
  5. Store - Saves to pgvector for search
  6. Generate - Creates wiki pages with Claude

Supported Languages

LanguageParserFramework Support
Rubytree-sitter-rubyRails, Sinatra
Pythontree-sitter-pythonDjango, Flask
JavaScripttree-sitter-javascriptExpress, Next.js
TypeScripttree-sitter-typescriptNestJS
Gotree-sitter-goGin, Echo

Webhooks

Receive notifications when sync completes:
BrainzLab::Dendrite.on_sync_complete do |repo, status|
  if status == :success
    puts "#{repo.name} synced successfully"
  else
    puts "#{repo.name} sync failed: #{status.error}"
  end
end