Documentation

Everything you need to integrate GitSense into your workflow

Quick Start

Get started with GitSense in less than 5 minutes.

1. Connect Your Repository

Click the "Connect GitHub" button and authorize GitSense to access your repositories.

OAuth Scopes Required
repo:read        # Read repository contents
pull_requests    # Access PR metadata
commit_status    # Read commit information

2. Select Repositories

Choose which repositories you want GitSense to analyze. You can select all repositories or specific ones.

3. Wait for Initial Scan

GitSense will perform an initial scan of your repository history. This typically takes 30-60 seconds for most repos.

Note: The initial scan analyzes your commit history, PR patterns, and code structure. Larger repositories may take longer.

4. Start Using GitSense

Once the scan is complete, GitSense will automatically analyze new PRs and provide insights.

Installation

GitSense can be installed as a GitHub App or integrated via API.

GitHub App (Recommended)

  1. Visit the GitSense GitHub App page
  2. Click "Install" and select your organization
  3. Choose repository access (all or selected)
  4. Authorize the installation

API Integration

For custom integrations, use the GitSense API:

cURL
curl -X POST https://api.git-sense.dev/v1/repos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "repo_url": "https://github.com/owner/repo",
    "features": ["pr_summary", "risk_radar"]
  }'

Authentication

GitSense uses OAuth 2.0 for secure authentication with GitHub and GitLab.

OAuth Flow

  1. User clicks "Connect GitHub"
  2. Redirected to GitHub authorization page
  3. User approves requested permissions
  4. GitHub redirects back with authorization code
  5. GitSense exchanges code for access token

API Keys

For programmatic access, generate an API key from your dashboard:

Example Request
curl https://api.git-sense.dev/v1/analyze \
  -H "Authorization: Bearer gs_live_abc123..."
Security: Never commit API keys to your repository. Use environment variables or secret management tools.

API Reference

The GitSense API allows you to programmatically access all features.

Base URL

https://api.git-sense.dev/v1

Common Endpoints

POST
/repos
Add a new repository
GET
/repos/:id/prs
List PRs for a repository
GET
/prs/:id/analysis
Get PR analysis results
POST
/chat
Ask a question about your repo

PR Summary

Automatically generate plain-English summaries for every pull request.

How It Works

When a new PR is opened, GitSense analyzes:

  • Changed files and line counts
  • Commit messages and patterns
  • Code structure modifications
  • Related PRs and issues

Configuration

Customize summary generation in your repository settings:

.gitsense.yml
pr_summary:
  enabled: true
  auto_comment: true
  include_related_prs: true
  highlight_breaking_changes: true

Risk Radar

Detect potential issues before they reach production.

Risk Factors

Risk Radar analyzes multiple dimensions:

  • Breaking Changes: API signature modifications, removed functions
  • Test Coverage: New code without corresponding tests
  • High Churn Files: Files changed frequently (potential hotspots)
  • Blast Radius: Number of services/modules affected
  • Complexity: Cyclomatic complexity increases

Risk Scores

Each PR receives a risk score from 0-10:

  • 0-3 (Low): Safe to merge with standard review
  • 4-6 (Medium): Requires careful review and testing
  • 7-10 (High): Needs senior review and comprehensive testing

Review Copilot

Get intelligent code review suggestions powered by AI.

Suggestion Types

Review Copilot provides multiple types of suggestions:

Security

  • SQL injection vulnerabilities
  • XSS attack vectors
  • Hardcoded secrets or credentials
  • Insecure cryptographic practices

Performance

  • Inefficient algorithms (O(n²) loops)
  • Memory leaks
  • Unnecessary database queries
  • Missing indexes

Architecture

  • Single Responsibility Principle violations
  • Tight coupling issues
  • Missing error handling
  • Code duplication

Repo Chat

Ask questions about your codebase in natural language.

Example Queries

  • "How does authentication work in this project?"
  • "Where is the payment processing logic?"
  • "What files handle user registration?"
  • "Show me all API endpoints related to orders"
  • "How do we handle rate limiting?"

Using the API

POST /chat
curl -X POST https://api.git-sense.dev/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "repo_id": "123",
    "question": "How does authentication work?",
    "include_code": true
  }'

Auto Release Notes

Generate release notes automatically from merged PRs.

Generating Release Notes

Release notes can be generated via the dashboard or API:

POST /releases
curl -X POST https://api.git-sense.dev/v1/releases \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "repo_id": "123",
    "from_tag": "v1.0.0",
    "to_tag": "v1.1.0",
    "format": "markdown"
  }'

Customization

Customize release note format:

.gitsense.yml
release_notes:
  categories:
    - features
    - bug_fixes
    - breaking_changes
    - chores
  exclude_labels:
    - wip
    - internal

Webhooks

Receive real-time notifications when events occur.

Available Events

  • pr.analyzed - PR analysis completed
  • risk.detected - High risk issue found
  • review.suggested - New review suggestion
  • release.generated - Release notes created

Webhook Payload

Example Payload
{
  "event": "pr.analyzed",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "pr_id": "847",
    "repo": "owner/repo",
    "risk_score": 3.2,
    "summary": "Refactors payment processing...",
    "url": "https://github.com/owner/repo/pull/847"
  }
}

GitHub Integration

GitSense integrates seamlessly with GitHub.

Features

  • Automatic PR comments with analysis
  • Status checks for risk scores
  • GitHub Actions integration
  • Issue linking and tracking

GitHub Actions

.github/workflows/gitsense.yml
name: GitSense Analysis
on: [pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: gitsense/analyze-action@v1
        with:
          api-key: ${{ secrets.GITSENSE_API_KEY }}
          fail-on-high-risk: true

GitLab Integration

Full support for GitLab repositories and merge requests.

Setup

  1. Go to GitSense dashboard
  2. Click "Connect GitLab"
  3. Authorize GitSense application
  4. Select repositories to analyze

GitLab CI/CD

.gitlab-ci.yml
gitsense:
  stage: test
  script:
    - curl -X POST https://api.git-sense.dev/v1/analyze
      -H "Authorization: Bearer $GITSENSE_API_KEY"
      -d '{"mr_id": "$CI_MERGE_REQUEST_IID"}'
  only:
    - merge_requests

Slack Integration

Get GitSense notifications in Slack.

Setup

  1. Install GitSense Slack app
  2. Connect to your workspace
  3. Configure notification preferences
  4. Choose channels for alerts

Notification Types

  • High-risk PR alerts
  • Review suggestions
  • Daily/weekly summaries
  • Team analytics reports

Jira Integration

Link PRs to Jira issues automatically.

Features

  • Automatic issue detection from PR titles
  • PR status updates in Jira
  • Risk scores in issue comments
  • Release notes linked to versions

Configuration

Configure Jira integration in your GitSense dashboard under Settings → Integrations → Jira.