Skip to main content
Glama

gitflic-cli

Полный консольный клиент для REST API GitFlic. 100% покрытие · ноль внешних зависимостей · MCP-сервер для AI-агентов.

npm docs node dependencies tests GitFlic REST license

📖 Документация · 🚀 Быстрый старт · 🧩 Команды · 📦 Скачать · 🤖 MCP для AI


gitflic-cli — лёгкий CLI для повседневной работы с GitFlic из терминала, скриптов и AI-агентов: merge-реквесты, обсуждения, задачи, релизы, ветки, теги, коммиты, файлы, вебхуки, окружения, реестр пакетов, CI/CD и администрирование. Все 20 разделов публичного REST API GitFlic обёрнуты в единый бинарник gitflic.

Чем это не является: официальный cli.jar от GitFlic — это серверный инструмент админа (починка LFS/релизов для self-hosted). gitflic-cli — недостающий пользовательский CLI для ежедневной работы.

✨ Почему

  • Ноль зависимостей. Чистый Node ESM (≥18) на глобальном fetch. Никакого npm install.

  • 100% REST API. Все 20 разделов (~199 эндпоинтов со scope-вариантами). Большинство протестировано вживую. → таблица покрытия

  • Дружелюбен к агентам. Каждая команда принимает --format json и пишет стабильный JSON в stdout. Код возврата: 0 при успехе, 1 при HTTP-ошибке. Плюс NDJSON-стриминг (--stream) и авто-пагинация (--all).

  • MCP-сервер для AI (Claude Code, Cursor и т.п.) — типизированные тулы поверх всего CLI.

  • Безопасное хранение токенов — macOS Keychain / Linux libsecret / chmod 0600 fallback (как у gh/glab). Multi-account + per-project bindings.

  • Самодокументирующийся. gitflic help и gitflic <cmd> help показывают все подкоманды и флаги.

Related MCP server: adtk

📦 Установка

Требуется Node 18+.

# npm (рекомендуется) — ноль транзитивных зависимостей
npm install -g gitflic-cli

# или разово, без установки
npx gitflic-cli help
# SSH-клон + установщик (кладёт CLI в ~/.local/share, symlink в ~/.local/bin)
git clone git@gitflic.ru:tikhon/gitflic-cli.git ~/tools/gitflic-cli
cd ~/tools/gitflic-cli && bash install.sh

# Windows / PowerShell
powershell -ExecutionPolicy Bypass -File install.ps1

# Кастомный путь / без symlink / dry-run
bash install.sh --prefix ~/my-tools
bash install.sh --no-symlink
bash install.sh --dry-run

Готовые tar.gz — на странице загрузок.

→ Подробно: Установка

🔐 Аутентификация

gitflic auth login --token xxxx-xxxx-xxxx   # валидирует через /user/me, кладёт в Keychain
gitflic auth status                         # backend + identity

Поддерживаются несколько аккаунтов (auth login --as work, auth switch) и привязка проектов к аккаунтам (auth bind owner/alias work). Альтернатива — GITFLIC_TOKEN в окружении.

→ Подробно: Аутентификация · Multi-account · Безопасность

🚀 Использование

gitflic mr list --project tikhon/gitflic-cli            # список merge-реквестов
gitflic mr create --title "Fix login" --to main         # авто: текущая ветка → default
gitflic mr diff 42                                       # дифф (с декодом HTML-entities)
gitflic mr merge 42 --message "Squash: fix login"

gitflic issue create --title "Bug" --description "..."
gitflic release create --title v1.0.0 --tag v1.0.0
gitflic release upload <uuid> ./build.zip               # ассеты релиза

gitflic branch protection create --scope team --team acme \
  --branch-template "main" --allowed-to-push NO_ONE --allowed-to-merge DEVELOPER

gitflic registry package upload --fmt maven --project me/app \
  ./app.jar com.example app 1.0.0 app.jar               # реестр пакетов

gitflic user me --format json | jq .username           # машинный вывод

gitflic help — полный список, gitflic <cmd> help — справка по модулю.

🧩 Команды

Модуль

Что умеет

auth

login / logout / status / switch / list / bind / unbind — multi-account, per-project

mr

list / view / diff / create / edit / approve / merge / close / cancel / by-commit / comment / discuss + approval rules & MR-settings (team/company)

branch

list / get / default / create / delete / compare / compare-file / commits + branch-protection (project/team/company)

tag

list / get / create + tag-protection (team/company)

release

list / get / latest / create / edit / delete + upload / download / delete-file

issue

CRUD + comments + relations + files (link/unlink) + attach

commit

list / get / files / diff / for-file / commit-diff / tag-diff / cherry-pick

blob

get (raw) / download / recursive / file-size

project

CRUD + search/my/shared + members/teams + fork/mirror/import + archive + attachments + change-setting + deploy-token + run-script

user

me / get / projects / followers / following

settings

ssh / oauth / access-token / transport-token / смена email·username·password

team · company

list / my / shared / get / create + members + import (+ team transfer)

environment

environment-protection (team/company)

webhook

list / get / create / edit / delete

registry

package (CRUD + upload/download для maven/npm/pypi/nuget/cargo/conda/… в 3 scope) · repo (Enterprise)

cicd

pipeline + job lifecycle, artifacts, variables, pipeline-lifetime

runner

project / company / instance: list / get / jobs / edit / shutdown / delete

admin · saml

админ-эндпоинты инстанса (нужны права администратора)

→ Полный справочник с примерами: cli-gitflic.ru/commands

✅ Покрытие API

100% — все 20 разделов публичного REST GitFlic (~199 эндпоинтов; со scope-вариантами project/company/team/instance — больше). Часть admin/SAML/Enterprise — code-only (нужны права/редакция инстанса).

→ Подробная таблица по разделам: cli-gitflic.ru/api-coverage

🤖 Для AI-агентов

Каждая команда поддерживает --format json — агент или shell-пайплайн получает стабильный JSON.

# Открытые MR в проекте
gitflic mr list --project tikhon/wave --format json \
  | jq '[._embedded.mergeRequestModelList[] | select(.status.id == "OPENED")] | length'

Есть MCP-сервер (Model Context Protocol) с типизированными тулами поверх CLI — подключается к Claude Code, Cursor и др. После npm i -g gitflic-cli-mcp появляется команда gitflic-mcp; без установки — через npx:

claude mcp add gitflic --env GITFLIC_TOKEN=xxxx -- gitflic-mcp
# или без установки:
claude mcp add gitflic --env GITFLIC_TOKEN=xxxx -- npx -y gitflic-cli-mcp

Набор из 78 тулзов можно сузить, чтобы не «съедать» контекст модели: GITFLIC_MCP_GROUPS=mr,issue (по группам), GITFLIC_MCP_READONLY=1 (только чтение) и др. — либо теми же флагами: gitflic-mcp --groups mr,issue --readonly --no-destructive.

→ MCP-сервер. Для ИИ также опубликованы /llms.txt и /llms-full.txt.

🏗️ Архитектура

gitflic-cli/
├── bin/gitflic              # bash-шим → node lib/gitflic.mjs
├── bin/gitflic.cmd          # Windows .cmd-шим → node lib/gitflic.mjs
├── bin/gitflic.ps1          # PowerShell-шим → node lib/gitflic.mjs
├── lib/
│   ├── gitflic.mjs          # диспетчер команд
│   ├── http.mjs             # fetch + retry + httpText/httpDownload/httpUploadFile
│   ├── secret.mjs           # Keychain / libsecret / chmod 0600
│   ├── paginate.mjs         # --all авто-пагинация + NDJSON streaming
│   ├── format.mjs           # вывод, цвета, htmlUnescape
│   └── cmd/                 # модули команд (mr, branch, release, registry, …)
├── mcp-server/              # Model Context Protocol сервер
├── docs/                    # документация (VitePress → cli-gitflic.ru)
└── install.sh / install.ps1 # установщики

Каждый модуль экспортирует usage и handle(ctx, sub, args, flags). Диспетчер берёт на себя резолв токена, резолв проекта (--project или авто-детект из git) и генерацию help.

🛠️ Разработка

npm test            # 256 unit-тестов (vitest)
npm run build       # lint + тесты + portable tar.gz → dist/
npm run docs:dev    # локальный VitePress dev-server
npm run docs:publish # собрать и задеплоить доку

→ Подробно: Локальная разработка

📄 Лицензия

MIT.

Available Tools

78 tools
gitflic_authA
Read-only

Check authentication: returns the current authenticated user (id, username, email, fullName). Use this first to verify the token works.

Inputs: raw, fields.

gitflic_auth_bindA
DestructiveIdempotent

Bind (owner/alias) to . All subsequent commands scoped to that project resolve to 's token, overriding the active account. Refuses if has no token stored. Use to route different repos to different identities (work vs personal).

Inputs: account (required), project (required), raw.

gitflic_auth_bindingsA
Read-only

List all current project → account bindings. Sorted alphabetically by project.

Inputs: raw, fields.

gitflic_auth_listA
Read-only

List all known accounts (default + named) with masked token values. Marks the active account with '*'. Use before switching or binding to confirm available identities.

Inputs: raw, fields.

gitflic_auth_loginA
Destructive

Validate a GitFlic API token against /user/me, then store it in the OS keychain (macOS Keychain / Linux libsecret) or chmod-0600 file. Refuses to store an invalid token. Use --as to store under a named account; --stdin to read the token from stdin.

Inputs: as, raw, stdin, token, +1 more.

gitflic_auth_logoutA
DestructiveIdempotent

Remove a stored token. Default removes the active account. Pass --as to remove a specific named account. Pass --all to remove every token (and all per-project bindings).

Inputs: as, all, raw.

gitflic_auth_switchA
DestructiveIdempotent

Make the active account. Subsequent tool calls without a per-project binding resolve to this account's token. Refuses if no token is stored for the named account.

Inputs: name (required), raw.

gitflic_auth_unbindA
DestructiveIdempotent

Remove the binding for . Falls back to active-account token resolution for that project afterwards.

Inputs: project (required), raw.

gitflic_blob_filesC
Read-only

List files in the repo (optionally under a sub-path).

Inputs: project (required), raw, path, branch, +1 more.

gitflic_blob_getC
Read-only

Get a file's text content. Binary files are base64-encoded by the server.

Inputs: path (required), project (required), raw, branch, +2 more.

gitflic_branch_createC
DestructiveIdempotent

Create a new branch from an existing one.

Inputs: project (required), newBranch (required), raw, from.

gitflic_branch_defaultC
Read-only

Get the project's default branch.

Inputs: project (required), raw, fields.

gitflic_branch_deleteD
DestructiveIdempotent

Delete a branch.

Inputs: name (required), project (required), raw.

gitflic_branch_getC
Read-only

Get a single branch by name.

Inputs: name (required), project (required), raw, fields.

gitflic_branch_listC
Read-only

List branches in a project.

Inputs: project (required), raw, name, sort, +3 more.

gitflic_branch_protection_createC
DestructiveIdempotent

Create a branch-protection rule.

Inputs: project (required), allowedToPush (required), allowedToMerge (required), branchTemplate (required), +4 more.

gitflic_branch_protection_deleteC
DestructiveIdempotent

Delete a branch-protection rule.

Inputs: uuid (required), project (required), raw.

gitflic_branch_protection_editC
DestructiveIdempotent

Edit a branch-protection rule.

Inputs: uuid (required), project (required), raw, autoMerge, +4 more.

gitflic_branch_protection_getC
Read-only

Get a branch-protection rule by uuid.

Inputs: uuid (required), project (required), raw, fields.

gitflic_branch_protection_listC
Read-only

List branch protection rules.

Inputs: project (required), raw, fields.

gitflic_commit_compareC
Read-only

Compare two commits.

Inputs: source (required), target (required), project (required), raw, +1 more.

gitflic_commit_filesC
Read-only

List files touched by a commit.

Inputs: hash (required), project (required), raw, fields.

gitflic_commit_getC
Read-only

Get one commit by hash.

Inputs: hash (required), project (required), raw, fields.

gitflic_commit_listC
Read-only

List commits (default branch or --branch).

Inputs: project (required), q, raw, sort, +4 more.

gitflic_issue_closeB
DestructiveIdempotent

Close an issue (shortcut: edit with --status CLOSED).

Inputs: id (required), project (required), raw.

gitflic_issue_commentC
Destructive

Add a comment to an issue.

Inputs: id (required), message (required), project (required), raw.

gitflic_issue_comments_deleteC
DestructiveIdempotent

Delete an issue comment.

Inputs: id (required), project (required), commentId (required), raw.

gitflic_issue_comments_editC
DestructiveIdempotent

Edit an existing issue comment.

Inputs: id (required), message (required), project (required), commentId (required), +1 more.

gitflic_issue_comments_listC
Read-only

List comments on an issue.

Inputs: id (required), project (required), raw, fields.

gitflic_issue_createC
DestructiveIdempotent

Create a new issue.

Inputs: title (required), project (required), description (required), raw, +1 more.

gitflic_issue_deleteC
DestructiveIdempotent

Delete an issue. Irreversible.

Inputs: id (required), project (required), raw.

gitflic_issue_editC
DestructiveIdempotent

Edit an issue's title, description, status, assignee, or labels.

Inputs: id (required), project (required), raw, label, +4 more.

gitflic_issue_listC
Read-only

List issues. Filter by --status if needed.

Inputs: project (required), q, raw, page, +7 more.

gitflic_issue_relations_listC
Read-only

List issue relations (linked/related/blocks).

Inputs: id (required), project (required), raw, fields.

gitflic_issue_reopenC
Destructive

Reopen a closed issue.

Inputs: id (required), project (required), raw.

gitflic_issue_viewC
Read-only

Get one issue by localId.

Inputs: id (required), project (required), raw, fields.

gitflic_mr_approveA
Destructive

Toggle approve on a merge request (calling twice removes the approval).

Inputs: id (required), project (required), raw.

gitflic_mr_by_commitC
Read-only

Find MR(s) containing a specific commit hash. Optionally filter by status.

Inputs: hash (required), project (required), raw, fields, +1 more.

gitflic_mr_cancelC
DestructiveIdempotent

Cancel a merge request.

Inputs: id (required), project (required), raw.

gitflic_mr_closeC
DestructiveIdempotent

Close a merge request.

Inputs: id (required), project (required), raw.

gitflic_mr_commentB
Destructive

Add a comment to a merge request. For inline-anchored comments, pass new_path/new_line and old_path/old_line.

Inputs: id (required), message (required), project (required), raw, +4 more.

gitflic_mr_createA
DestructiveIdempotent

Create a new merge request. description is required (GitFlic rejects empty MR descriptions). If from is omitted, uses current git branch; if to is omitted, uses project default branch.

Inputs: title (required), project (required), description (required), to, +4 more.

gitflic_mr_diffB
Read-only

Get the file-level diff for a merge request (hunks + per-line annotations).

Inputs: id (required), project (required), all, raw, +4 more.

gitflic_mr_discuss_deleteC
DestructiveIdempotent

Delete a discussion thread on a merge request.

Inputs: id (required), project (required), discussionUuid (required), raw.

gitflic_mr_discuss_listA
Read-only

List discussions (with replies) on a merge request.

Inputs: id (required), project (required), all, raw, +3 more.

gitflic_mr_discuss_replyC
Destructive

Reply to a discussion thread on a merge request.

Inputs: id (required), message (required), project (required), discussionUuid (required), +1 more.

gitflic_mr_discuss_resolveC
DestructiveIdempotent

Resolve a discussion thread on a merge request.

Inputs: id (required), project (required), discussionUuid (required), raw.

gitflic_mr_editC
DestructiveIdempotent

Edit MR title/description/target. Source branch cannot change.

Inputs: id (required), project (required), to, raw, +4 more.

gitflic_mr_listB
Read-only

List merge requests in a project. Returns array with localId, title, status, author, source/target branches.

Inputs: project (required), q, raw, page, +8 more.

gitflic_mr_mergeB
Destructive

Merge a merge request. May fail with MergeCheckException if branch protection requires more approvals.

Inputs: id (required), project (required), raw, message, +1 more.

gitflic_mr_viewB
Read-only

Get one merge request by its localId. Returns full MR object including description, status, conflicts, canMerge.

Inputs: id (required), project (required), raw, fields.

gitflic_project_createC
DestructiveIdempotent

Create a new project.

Inputs: alias (required), title (required), raw, language, +4 more.

gitflic_project_editA
DestructiveIdempotent

Edit project title, description, or language (via change-setting). Visibility and default branch are not editable over the REST API.

Inputs: project (required), raw, title, language, +1 more.

gitflic_project_getC
Read-only

Resolve an owner/alias to its UUID + metadata.

Inputs: project (required), raw, fields.

gitflic_project_listA
Read-only

List accessible projects, including team projects. Defaults to scope shared; filter by owner alias.

Inputs: q, all, raw, page, +8 more.

gitflic_project_list_myA
Read-only

List projects owned by the current user. Use gitflic_project_list with scope shared for team and member projects.

Inputs: q, all, raw, page, +6 more.

gitflic_project_member_inviteC
Destructive

Invite a user to a project with a role.

Inputs: role (required), project (required), userAlias (required), raw.

gitflic_project_member_listC
Read-only

List project members.

Inputs: project (required), raw, fields.

gitflic_project_resolveA
Read-onlyIdempotent

Resolve a project owner/alias to its UUID + defaultBranch. Cached locally; needed before most other calls.

Inputs: project (required), raw, fields.

gitflic_release_createC
DestructiveIdempotent

Create a new release.

Inputs: title (required), project (required), raw, tag, +2 more.

gitflic_release_deleteC
DestructiveIdempotent

Delete a release.

Inputs: uuid (required), project (required), raw.

gitflic_release_editC
DestructiveIdempotent

Edit release metadata.

Inputs: uuid (required), project (required), raw, tag, +3 more.

gitflic_release_getC
Read-only

Get one release by uuid.

Inputs: uuid (required), project (required), raw, fields.

gitflic_release_latestC
Read-only

Get the most recent release.

Inputs: project (required), raw, fields.

gitflic_release_listC
Read-only

List releases.

Inputs: project (required), q, raw, tag, +4 more.

gitflic_tag_createC
DestructiveIdempotent

Create a new tag (lightweight or annotated).

Inputs: name (required), project (required), raw, branch, +2 more.

gitflic_tag_getA
Read-only

Get a tag by name. NOTE: GitFlic returns 400 for project-scoped tag get; prefer tag list.

Inputs: name (required), project (required), raw, fields.

gitflic_tag_listC
Read-only

List tags.

Inputs: project (required), raw, name, sort, +3 more.

gitflic_user_followersC
Read-only

List a user's followers.

Inputs: alias (required), q, raw, limit, +1 more.

gitflic_user_getC
Read-only

Get a user by alias.

Inputs: alias (required), raw, fields.

gitflic_user_meA
Read-only

Get the current authenticated user (id, username, email, name, fullName).

Inputs: raw, fields.

gitflic_user_projectsC
Read-only

List public projects of a user.

Inputs: alias (required), q, raw, sort, +4 more.

gitflic_webhook_createC
DestructiveIdempotent

Create a webhook. Pass one or more event names.

Inputs: url (required), project (required), raw, event, +1 more.

gitflic_webhook_deleteC
DestructiveIdempotent

Delete a webhook by uuid.

Inputs: uuid (required), project (required), raw.

gitflic_webhook_getC
Read-only

Get one webhook by uuid.

Inputs: uuid (required), project (required), raw, fields.

gitflic_webhook_listB
Read-only

List webhooks for a project.

Inputs: project (required), raw, event, limit, +1 more.

gitflic_webhook_reveal_secretA
DestructiveIdempotent

Reveal the raw signing secret of a webhook. SENSITIVE: by default the MCP masks secrets (returns secretSet:true/false). This tool returns the actual secret value and is marked destructive so the MCP host prompts for approval before it runs. Use only when the user explicitly needs the secret value.

Inputs: uuid (required), project (required), raw.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 78 tools

    Disambiguation3/5

    Most tools are scoped by resource and action, but several pairs overlap enough to cause misselection: project_get vs project_resolve, auth vs user_me, mr_cancel vs mr_close, and issue_close vs issue_edit with status CLOSED. Descriptions help clarify some cases, but the boundaries are not consistently crisp.

    Naming Consistency4/5

    All tools use snake_case with the gitflic_ prefix, and most follow a predictable resource_action pattern such as gitflic_mr_create or gitflic_issue_comment. Minor deviations like gitflic_auth, gitflic_user_me, gitflic_project_list_my, and gitflic_mr_by_commit keep it from being fully consistent.

    Tool Count2/5

    With 78 tools, the surface is far larger than the recommended 3-15 range and is heavy for an agent to navigate reliably. The domain is broad and the tools are grouped by resource, but many CRUD/auth variants could be consolidated or exposed more selectively.

    Completeness4/5

    Coverage is strong across projects, merge requests, issues, comments, branches, tags, releases, commits, webhooks, users, and authentication. Some expected lifecycle operations are missing or partial, such as project delete, tag delete, webhook edit, and MR reviewer assignment, but most core workflows are supported.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Full-coverage GitLab MCP server with 44 tools across 18 resource types. Agent-optimized CQRS design — one tool call handles complete multi-step operations. Supports OAuth 2.1, read-only mode, stdio/SSE/StreamableHTTP transports, and GraphQL-native work items with full hierarchy (epics,issues,etc)
      1,922 npm
      8
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Model Context Protocol (MCP) server for GitLab — exposes 1006 GitLab REST & GraphQL API operations as MCP tools (42 meta-tools / 57 enterprise), 24 resources, 38 prompts, and 17 completion types for AI assistants. Written in Go, single static binary, stdio and HTTP transport.
      2
      49
      MIT