V Vant Docs

Multi-Git Provider Support

Vant now supports multiple git providers through a universal abstraction layer. This enables branching |

Supported Providers

| Provider

Auto-Detection

Vant automatically detects which provider to use based on your git remote URL:

# GitHub
git remote add origin https://github.com/owner/repo

# GitLab  
git remote add origin https://gitlab.com/owner/repo

# Bitbucket
git remote add origin https://bitbucket.org/owner/repo

Configuration

GitHub

export GITHUB_TOKEN=ghp_xxx
export GITHUB_REPO=owner/repo

GitLab

export GITLAB_TOKEN=glpat_xxx
export GITLAB_REPO=owner/repo

Bitbucket

export BITBUCKET_TOKEN=xxx
export BITBUCKET_WORKSPACE=workspace
export BITBUCKET_REPO=repo

Usage in Code

const { getProvider |
- detectProvider } = require('vant').providers;

// Auto-detect provider
const provider = getProvider();

// Or specify explicitly
const provider = getProvider('github');

// Check if configured
if (provider.isConfigured()) {
  // Use provider API
  await provider.checkout('agents/my-agent');
  await provider.commit('Made changes');
  await provider.push();
  
  // Create PR
  const pr = await provider.createPR({
    source: 'agents/my-agent',
    target: 'main',
    title: 'My PR Title',
    body: 'Description'
  });
}

Branch Module Integration

The lib/branch.js module now automatically uses providers:

const branch = require('vant').branch;

const status = await branch.status();
console.log(status.provider); // 'github' |
- 'gitlab' |
- 'bitbucket' |
- 'cli'

const pr = await branch.createPR({
  source: 'agents/my-agent',
  target: 'main',
  title: 'Feature PR'
});

API Reference

GitProvider Methods

| Method

Fallback Behavior

If no provider token is configured |