Skip to main content

@idiomark/adapter-gitlab

GitLab adapter for Idiomark extraction.

Features​

  • User Profile: Fetch user profile information including bio, location, organization, job title
  • Commits: Commit history from user's projects
  • Issues: Issues created by the user
  • Merge Requests: Merge requests (PRs) created by the user
  • Comments: Notes and comments on issues and merge requests
  • Snippets: Code snippets created by the user

Authentication​

Uses Bearer token authentication with a personal access token.

Getting a GitLab Personal Access Token​

  1. Go to GitLab Settings -> Access Tokens
  2. Create a token with read_user, read_api, read_repository scopes
  3. Use the token in the adapter constructor

Rate Limits​

The adapter automatically handles rate limiting by:

  • Tracking request count in a sliding window
  • Waiting for reset when approaching the limit (90% threshold)
  • Resetting counters after each minute window

Usage​

import { GitLabAdapter } from '@idiomark/adapter-gitlab'

const adapter = new GitLabAdapter({
token: 'your_gitlab_token',
instanceUrl: 'https://gitlab.com/api/v4' // Optional, defaults to gitlab.com
})

// Authenticate
const authenticated = await adapter.authenticate()

// Fetch data
const data = await adapter.fetchData({
limit: 100,
startDate: new Date('2024-01-01'),
endDate: new Date('2024-12-31'),
includeReplies: true
})

// Extract raw text for analysis
const result = await adapter.extractRawText({ limit: 100 })

Data Types​

TypeDescription
profileUser profile information
commitGit commits with messages
issueIssues with descriptions and labels
merge_requestMerge requests with discussions
commentNotes and comments on issues/MRs
snippetCode snippets

Self-Hosted GitLab Instances​

For self-hosted GitLab instances, provide the instance URL:

const adapter = new GitLabAdapter({
token: 'your_token',
instanceUrl: 'https://gitlab.example.com/api/v4'
})

API Methods​

  • authenticate() - Authenticate and fetch user profile
  • fetchData(options) - Fetch all relevant data for personality analysis
  • fetchUserProfile() - Fetch user profile information
  • fetchCommits(options) - Fetch commits from user's projects
  • fetchIssues(options) - Fetch issues created by user
  • fetchMergeRequests(options) - Fetch merge requests created by user
  • fetchComments(options) - Fetch comments on issues and MRs
  • fetchSnippets(options) - Fetch code snippets
  • extractRawText(options) - Extract raw text content for analysis
  • healthCheck() - Check adapter health and latency
  • reset() - Reset cached data
  • dispose() - Dispose of resources

License​

MIT