Documentation

Everything you need to integrate GitDraft into your development workflow.

Getting Started

Welcome to GitDraft! This guide will help you set up and start using GitDraft in minutes.

Prerequisites

  • Git installed on your machine
  • Node.js 16+ (for CLI tool)
  • Approved whitelist access

Installation

Install the GitDraft CLI tool globally:

npm install -g gitdraft

Authentication

Authenticate with your GitDraft account:

gd auth login

CLI Tool

The GitDraft CLI is your primary interface for pushing drafts and managing your workflow.

Basic Commands

# Push current changes to draft
gd push

# Push with a custom message
gd push -m "Refactoring auth module"

# View draft status
gd status

# List all your drafts
gd list

# Share a draft with teammates
gd share <draft-id>

# View AI analysis results
gd analyze <draft-id>

Configuration

Configure GitDraft for your project:

# Initialize GitDraft in your repo
gd init

# Set confidence threshold
gd config set confidence-threshold 85

# Enable auto-test generation
gd config set auto-tests true

VS Code Extension

The VS Code extension provides real-time AI suggestions directly in your editor.

Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "GitDraft"
  4. Click Install

Features

  • Inline confidence scores
  • AI-powered code suggestions
  • Draft management sidebar
  • One-click push to draft

GitHub Action

Integrate GitDraft into your CI/CD pipeline with our GitHub Action.

Setup

Add this to your .github/workflows/gitdraft.yml:

name: GitDraft Check

on: [pull_request]

jobs:
  gitdraft:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: gitdraft/action@v1
        with:
          token: ${{ secrets.GITDRAFT_TOKEN }}
          min-confidence: 80

API Reference

Use the GitDraft API to build custom integrations.

Authentication

All API requests require an API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Endpoints

# Create a draft
POST /api/v1/drafts

# Get draft analysis
GET /api/v1/drafts/:id/analysis

# Share a draft
POST /api/v1/drafts/:id/share

# List all drafts
GET /api/v1/drafts

Best Practices

1. Use Descriptive Draft Messages

Help AI understand your intent by providing clear context:

gd push -m "Refactoring user authentication to use JWT tokens"

2. Review AI Suggestions Carefully

AI is powerful but not perfect. Always review suggestions before applying them.

3. Set Appropriate Confidence Thresholds

For critical code, use higher thresholds (90+). For experimental features, 70-80 is fine.

4. Leverage Collaborative Sketching

Share drafts early with your team to catch issues before they reach production.

5. Train AI on Your Team's Style

The more you use GitDraft, the better it learns your team's coding patterns and preferences.

Need Help?

Can't find what you're looking for? Contact our support team or join our Discord community.