Back to home

LJH-snow

dsh-tool-gitlab

No description

Stars
0
Language
TypeScript
Created
Aug 14, 2026
Updated
Aug 14, 2026

Introduction

dsh-tool-gitlab

English | 中文

A Cordis tool plugin that gives DeepSeek Harness (dsh) enterprise-grade GitLab capabilities. Agents can review merge requests end-to-end (changes, discussions, approvals), observe and trigger CI/CD pipelines, audit group/project membership, and work their personal todo inbox — in natural language.

Built on the official "everything is a plugin" architecture via ctx.tools.register(defineTool(...)), following the official adding-a-tool contract. Designed for self-managed GitLab (baseUrl override) and enterprise governance workflows.

Install

Install directly from GitHub (no npm publish needed):

npm install github:LJH-snow/dsh-tool-gitlab
# or a specific branch/tag
npm install github:LJH-snow/dsh-tool-gitlab#main

Or from a local checkout:

git clone https://github.com/LJH-snow/dsh-tool-gitlab
cd dsh-tool-gitlab
npm install && npm run build   # builds to lib/
npm install /path/to/dsh-tool-gitlab

Once published to npm, it will also be installable as npm install @libai168/dsh-tool-gitlab.

Requires @deepseek-ai/cordis (^4.0.1) and @deepseek-ai/dsh-tools (^0.1.0-rc.6) as peer dependencies, provided by the host dsh runtime.

Configuration

Load the plugin in a dsh composition config (cordis.yml):

- name: 'dsh-tool-gitlab'
  config:
    token: 'glpat_xxx'      # GitLab PAT (optional; required for write tools, approvals, CI triggers, and personal tools)
    baseUrl: 'https://gitlab.com/api/v4'   # optional; point at your self-managed GitLab, e.g. https://gitlab.example.com/api/v4
    timeoutMs: 15000        # optional, request timeout in ms (default 15000)

Full example: examples/cordis.yml.

Security: read-only tools work without a token. Write tools, MR approval, pipeline triggering, code search on private projects, current-user, and todos require a token. Prefer a minimal-scope PAT (e.g. api + read_repository scopes as needed) and never commit it.

Enterprise differentiators

AreaGitLab plugin toolsWhat the GitHub plugin has
Merge Request lifecyclegitlab_get_mr_changes (per-file diffs), gitlab_list_mr_discussions (review threads), gitlab_reply_mr_discussion, gitlab_resolve_mr_discussion, gitlab_get_mr_approvals (approval rules), gitlab_approve_mr, gitlab_merge_mr (squash)PR draft + merge only
CI/CDgitlab_list_pipelines, gitlab_get_pipeline (stages), gitlab_get_job_log (full trace), gitlab_trigger_pipelineworkflow run list only
Org & governancegitlab_list_group_projects, gitlab_list_subgroups, gitlab_list_group_members, gitlab_list_project_members (Guest→Owner access levels), gitlab_add_*_member, gitlab_update_*_member, gitlab_remove_*_member
Project managementgitlab_create_project, gitlab_delete_project (delete-kind UI cards)
Group managementgitlab_create_group, gitlab_delete_group; gitlab_transfer_project, gitlab_archive_project, gitlab_unarchive_project
Automation & CI configgitlab_list/create/delete_project_webhook, gitlab_list/create/update/delete_project_variable (values never exposed)
Personal workbenchgitlab_list_todos (assigned / approval-required / mentioned), gitlab_get_current_user
Release & DevOpsgitlab_list_releases, gitlab_list_milestones, gitlab_list_environments, gitlab_list_labelsreleases list only
Self-managedbaseUrl override for on-premises GitLabGitHub Enterprise baseUrl
Review UXsearch-card MR changes, diff-card file writes, terminal-card job logsgeneric/search cards

Tools

Read-only

ToolDescriptionToken
gitlab_get_projectProject metadata (id, full path, stars, default branch, visibility)no
gitlab_search_projectsSearch projects by name (optionally scoped to a group)no
gitlab_list_group_projectsProjects in a group, with optional subgroup inclusionno
gitlab_list_subgroupsSubgroups of a group (org hierarchy)no
gitlab_list_group_membersGroup members with access levels (Guest/Reporter/Developer/Maintainer/Owner)no
gitlab_list_project_membersProject members with access levelsno
gitlab_list_issuesList issues (state/assignee filters)no
gitlab_get_issueIssue details (description included)no
gitlab_list_mrsList merge requests (state filter, draft/conflict flags)no
gitlab_get_mrMR details: merge status, CI pipeline, conflicts, squashno
gitlab_get_mr_changesChanged files with per-file diff hunksno
gitlab_get_mr_approvalsApproval status: approvers, required/left, per-rule stateno
gitlab_list_mr_discussionsReview threads with notes and resolution stateno
gitlab_list_commitsCommits (branch/author filters)no
gitlab_get_fileRead a repository file (base64-decoded, ref support)no
gitlab_list_branchesBranches with latest SHAsno
gitlab_list_labelsProject labels with colorsno
gitlab_list_milestonesMilestones with due dates and statesno
gitlab_list_releasesReleases with tags, authors, and datesno
gitlab_list_environmentsDeployment environments with states and URLsno
gitlab_list_pipelinesCI/CD pipelines (ref/status filters)no
gitlab_get_pipelinePipeline details with stagesno
gitlab_get_job_logFull job log trace (terminal card in UI)no*
gitlab_search_codeBlob code search inside a projectprivate projects
gitlab_get_current_userAuthenticated user identityyes
gitlab_list_todosPending todos (assigned, approval-required, mentioned)yes
gitlab_list_project_webhooksWebhook URLs and enabled event types (metadata only)private projects
gitlab_list_project_variablesCI/CD variable keys and options — values are never returnedprivate projects

Write operations

ToolDescriptionToken
gitlab_create_issueCreate an issue (labels supported)yes
gitlab_comment_issueComment on an issueyes
gitlab_update_issueOpen or close an issueyes
gitlab_create_mrCreate a merge request (draft supported)yes
gitlab_comment_mrComment on a merge requestyes
gitlab_reply_mr_discussionReply to a review discussion threadyes
gitlab_resolve_mr_discussionResolve/unresolve a review discussion threadyes
gitlab_approve_mrApprove a merge request (approval flow)yes
gitlab_merge_mrMerge a merge request (squash supported)yes
gitlab_trigger_pipelineTrigger a CI/CD pipeline for a refyes
gitlab_create_branchCreate a branch from a refyes
gitlab_write_fileCreate/update a file via a commit (diff card in UI)yes
gitlab_create_projectCreate a project (visibility, namespace, README init)yes
gitlab_delete_projectPermanently delete a project (delete-kind UI card)yes
gitlab_add_group_memberAdd a member to a group (guest→owner)yes
gitlab_update_group_memberChange a group member's access levelyes
gitlab_remove_group_memberRemove a member from a group (delete-kind UI card)yes
gitlab_add_project_memberAdd a member to a project (guest→owner)yes
gitlab_update_project_memberChange a project member's access levelyes
gitlab_remove_project_memberRemove a member from a project (delete-kind UI card)yes
gitlab_create_groupCreate a group (visibility, path)yes
gitlab_delete_groupPermanently delete a group and all its projects (delete-kind UI card)yes
gitlab_transfer_projectTransfer a project to another namespace (move-kind UI card)yes
gitlab_archive_projectArchive a project (read-only for everyone)yes
gitlab_unarchive_projectUnarchive a projectyes
gitlab_create_project_webhookCreate a webhook that pushes events to a URLyes
gitlab_delete_project_webhookDelete a webhook (delete-kind UI card)yes
gitlab_create_project_variableCreate a CI/CD variable (value sent once, never echoed)yes
gitlab_update_project_variableUpdate a CI/CD variable (value never echoed)yes
gitlab_delete_project_variableDelete a CI/CD variable (delete-kind UI card)yes

Behavior contract (per the official execute contract)

  • Business failures are canonical values: missing project/issue/MR → { found: false }; MR creation failure (branch missing / MR exists) → { created: false, reason }; merge blocked (conflicts/checks) → { merged: false, reason }; no token → clear reason/authenticated: false values.
  • Only infrastructure errors throw: invalid token (401), forbidden (403), rate limit (429).
  • Cancellable: every request forwards exec.signal, with a default 15s timeout.

Development

npm install
npm run typecheck   # type check
npm test            # unit tests (vitest)
npm run build       # build to lib/

See DEVELOPMENT.md for plans and decisions.

Publishing

  1. The package is published under your npm scope: @libai168/dsh-tool-gitlab (npm publishing requires a granular access token with 2FA bypass enabled, or trusted publishing).
  2. npm run build, then npm publish --access public.
  3. Add the dsh-plugin topic to your GitHub repo for ecosystem discovery.

License

MIT