Skip to content
← Public packages

@kody/kody-factory

Forkable multi-project software factory: signals, priority queue, project UI, sweep job. Agent runners and Sentry reach it by events.

FollowFork

Files

gitlab.ts

25 lines · 753 B · TypeScript
import type { RepoAdapter, RepoHost } from './types.ts'

export const gitlabRepoAdapter: RepoAdapter = {
	id: 'gitlab',
	displayName: 'GitLab',
	parseRef(ref) {
		const cleaned = ref.replace(/^https?:\/\/gitlab\.com\//, '').replace(/\.git$/, '')
		return { ref: cleaned, defaultBranch: 'main' }
	},
	changeRequestUrl({ ref, branch, title }) {
		return `https://gitlab.com/${ref}/-/merge_requests/new?merge_request[source_branch]=${encodeURIComponent(branch)}&merge_request[title]=${encodeURIComponent(title)}`
	},
}

export const gitlabRepoHost: RepoHost = {
	id: 'gitlab',
	async proposeChange(input) {
		return {
			ok: false,
			note: input.dryRun
				? `dry-run GitLab change on ${input.repo.ref}`
				: 'GitLab adapter is a stub in v1.',
		}
	},
}