@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
- Go to GitLab Settings -> Access Tokens
- Create a token with
read_user,read_api,read_repositoryscopes - Use the token in the adapter constructor
Rate Limits
- Requests: 2000 per minute for authenticated users
- Documentation: https://docs.gitlab.com/ee/api/rest/
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
| Type | Description |
|---|---|
profile | User profile information |
commit | Git commits with messages |
issue | Issues with descriptions and labels |
merge_request | Merge requests with discussions |
comment | Notes and comments on issues/MRs |
snippet | Code 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 profilefetchData(options)- Fetch all relevant data for personality analysisfetchUserProfile()- Fetch user profile informationfetchCommits(options)- Fetch commits from user's projectsfetchIssues(options)- Fetch issues created by userfetchMergeRequests(options)- Fetch merge requests created by userfetchComments(options)- Fetch comments on issues and MRsfetchSnippets(options)- Fetch code snippetsextractRawText(options)- Extract raw text content for analysishealthCheck()- Check adapter health and latencyreset()- Reset cached datadispose()- Dispose of resources
License
MIT