chat / adapter-gitlab
AGENTS.md2.4k starsChanged 20 days agoMITView on GitHub
Guidance for coding agents working inside the GitLab adapter package. The top-level repository AGENTS.md covers monorepo-wide build, lint, and release rules. Read it first. @chat-adapter/gitlab connects a Chat SDK bot to merge request and issue comments on GitLab.com, GitLab Self-Managed, and GitLab Dedicated: - Webhook endpoint at /api/webhooks/gitlab for Note Hook (comments) and Emoji Hook (reactions) events. - Webhook verification with a signing token (Standard Webhooks webhook-signature, GitLab 19.0+), a secret token (X-Gitlab-Token), or a custom webhookVerifier. - REST API…
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 128
Never log the access token or webhook tokens.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — @chat-adapter/gitlab
Guidance for coding agents working inside the GitLab adapter package. The top-level repository AGENTS.md covers monorepo-wide build, lint, and release rules. Read it first.
Overview
@chat-adapter/gitlab connects a Chat SDK bot to merge request and issue
comments on GitLab.com, GitLab Self-Managed, and GitLab Dedicated:
- Webhook endpoint at
/api/webhooks/gitlabforNote Hook(comments) andEmoji Hook(reactions) events. - Webhook verification with a signing token (Standard Webhooks
webhook-signature, GitLab 19.0+), a secret token (X-Gitlab-Token), or a customwebhookVerifier. - REST API v4 over
fetchwith one access token (GITLAB_TOKEN). There is no SDK dependency. - Bot identity (
userName,botUserId) detected fromGET /userduringinitialize()unless configured.ensureBotIdentity()retries the lookup when a comment arrives and the ID is still unknown (at most every 30 seconds).isSelf()compares user IDs, falling back to a configured username. With neither known, comments are dropped with a warning so the bot can't reply to itself.
Directory layout
packages/adapter-gitlab/
├── src/
│ ├── index.ts # GitLabAdapter + createGitLabAdapter
│ ├── index.test.ts
│ ├── cards.ts # Card → GLFM markdown
│ ├── cards.test.ts
│ ├── markdown.ts # GitLabFormatConverter (mdast ↔ GLFM)
│ ├── markdown.test.ts
│ ├── subclass.test-d.ts
│ └── types.ts # config, thread ID, REST and webhook types
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── vitest.config.ts
└── README.mdBuild, test, typecheck
pnpm --filter @chat-adapter/gitlab build
pnpm --filter @chat-adapter/gitlab test
pnpm --filter @chat-adapter/gitlab typecheckThread ID format
gitlab:{projectId}:mr:{iid}
gitlab:{projectId}:issue:{iid}
gitlab:{projectId}:{mr|issue}:{iid}:{discussionId}projectIdis the numeric project ID, which survives project renames and transfers. Never encode the project path: it contains/.- Note Hook and Emoji Hook payloads carry each note's
discussion_id, including top-level (type: null) comments, so every webhook note maps to its discussion thread andpostMessagereplies inside that discussion. Replying to a top-level comment turns it into a thread in GitLab's UI. - Webhooks never produce the merge request or issue thread
(
gitlab:{projectId}:{mr|issue}:{iid}).listThreadsreturns it, posting to it creates a new top-level comment, andfetchMessageson it returns every comment except system and internal notes, paged byx-next-page. encodeThreadId/decodeThreadIdare the only sanctioned constructors.- The channel ID is
gitlab:{projectId}.
Webhook handling
- Notes with an
actionother thancreate(edits) are ignored, as are system notes and commit or snippet comments. - Internal notes,
Confidential Note Hookevents, andevent_type: "confidential_note"are ignored on purpose. Replying would post their content into a public comment. For the same reason,fetchMessagesdrops internal notes andfetchMessagereturnsnullfor one: the bot's token can read them, but a reply built from history is public. isMentionis set by the adapter:@userNamecounts only outside inline code, code blocks, and block quotes.metadata.editedis alwaysfalse. GitLab bumpsupdated_aton resolve and thread conversion, and the API has no last-edited field.- The signing token is the
whsec_value, with the prefix optional (32 bytes: 43 base64 characters plus=). Malformed tokens throw at construction. - Webhook notes are normalized into the REST
GitLabNoteshape (object_attributes.notebecomesbody, the top-leveluserbecomesauthor) so parsing has one code path. - Older payloads use
YYYY-MM-DD HH:MM:SS UTCtimestamps;parseGitLabDatehandles both formats.
REST API notes
- Edits and deletes use the notes API (
/notes/:note_id) for every note, including discussion notes. - Emoji reactions use
/notes/:note_id/award_emoji.GITLAB_EMOJI_NAMESholds the normalized emoji whose Slack-style shortcode isn't GitLab's canonical award name; everything else uses the shortcode. Incoming award names are reverse-mapped through the same table. - List endpoints paginate with
x-next-page;requestAllfollows it up toMAX_PAGES.listThreadsand merge request or issuefetchMessagesreturn the header asnextCursorinstead, withper_pagecapped at 100. - The
listThreadsroot message is the merge request description (or title), not a note. Its ID ismr-{iid}.notePathrejects non-numeric IDs withValidationError, andfetchMessagereturnsnullfor them. - Errors map to
@chat-adapter/sharederrors: 400 and 422ValidationErrorwith GitLab's reason, 401AuthenticationError, 403PermissionError, 404ResourceNotFoundError, 429AdapterRateLimitError, anything elseNetworkError. - Streaming is buffered and posted once: GitLab rejects empty note bodies, so
the default post-then-edit fallback can't post a placeholder. An empty
stream throws
ValidationError. - Strings,
{ raw },{ markdown }, and streamed text are posted as written apart from emoji placeholders, so GitLab references (~label,!12,#12) render. AST input is serialized with remark.
Coding conventions
- Named exports only. Webhook and REST types live in
types.ts. - Top-level regex literals.
- Never log the access token or webhook tokens.
Releases
Behavioral changes need a changeset (pnpm changeset, choose
@chat-adapter/gitlab, plus chat if a public type changed).
Where to look next
- User-facing docs:
apps/docs/content/adapters/official/gitlab.mdx - Core Adapter contract:
packages/chat/src/types.ts - GitLab webhook events: https://docs.gitlab.com/user/project/integrations/webhook_events/
Trending
Less talk lately.thin dataabout the whole repository
Who's talking about vercel/chat
- @camilleroux.com“Un SDK TypeScript unifié pour créer des chatbots qui fonctionnent sur Slack, Teams, Google Chat, Discord, …”Bluesky · Mar 3, 2026 · 3 likes
- amoai-tech/mdeai“Send one WhatsApp reply instead of seven”GitHub · Oct 14, 2026 · 2 reactions
- luminik-io/alfred“docs: record chat runtime decision”GitHub · Jun 7, 2026 · 2 reactions
- Chinchill-AI/chat-sdk-python“feat(slack): Socket Mode transport (vercel/chat#162)”GitHub · May 8, 2026 · 2 reactions
- ausdisau/mapableau-new“chore(deps): bump @chat-adapter/state-memory from 4.30.0 to 4.39.0”GitHub · Aug 21, 2026 · 1 reactions
The biggest 5 of 9 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 9
Talked about on Bluesky and GitHub (9 times).
On Bluesky · 5
- Mar 3, 2026Un SDK TypeScript unifié pour créer des chatbots qui fonctionnent sur Slack, Teams, Google Chat, Discord, GitHub et Linear. Code une fois,… — @camilleroux.com3 likes and reposts
- Mar 7, 2026github.com/vercel/chat GitHub - vercel/chat: A unified TypeScript SDK for building chat bots across Slack, Microsoft Te... — @technews4869.bsky.social1 likes and repost
- Mar 7, 2026チャットアプリ開発に使える統一SDKを提供するツールらしい 様々なプラットフォーム対応で便利そうだな yug1224 starred vercel/chat https://github.com/vercel/chat — @yug1224.com1 likes and repost
- Mar 5, 2026Vercel lance Chat SDK : un SDK TypeScript unifié pour créer des bots multi-plateformes — @news.humancoders.com1 likes and repost
- Feb 27, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 vercel / chat ⭐ 871 (+121) 🗒 TypeScript A unified TypeScript SDK for building chat bots across Slack,… — @github-trending-js.bsky.social1 likes and repost
On GitHub · 4
- Oct 14, 2026Send one WhatsApp reply instead of seven — amoai-tech/mdeai2 reactions · 16 comments
- Jun 7, 2026docs: record chat runtime decision — luminik-io/alfred2 reactions · 1 comment
- May 8, 2026feat(slack): Socket Mode transport (vercel/chat#162) — Chinchill-AI/chat-sdk-python2 reactions · 4 comments
- Aug 21, 2026chore(deps): bump @chat-adapter/state-memory from 4.30.0 to 4.39.0 — ausdisau/mapableau-new1 reaction · 1 comment
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository48 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apps/docs/AGENTS.mdAGENTS.md
- chat-sdkAGENTS.md
- packages/adapter-discord/AGENTS.mdAGENTS.md
- packages/adapter-gchat/AGENTS.mdAGENTS.md
- packages/adapter-github/AGENTS.mdAGENTS.md
- packages/adapter-instagram/AGENTS.mdAGENTS.md
- packages/adapter-linear/AGENTS.mdAGENTS.md
- packages/adapter-messenger/AGENTS.mdAGENTS.md
- packages/adapter-notion/AGENTS.mdAGENTS.md
- packages/adapter-slack/AGENTS.mdAGENTS.md
- packages/adapter-teams/AGENTS.mdAGENTS.md
- packages/adapter-telegram/AGENTS.mdAGENTS.md
- packages/adapter-twitch/AGENTS.mdAGENTS.md
- packages/adapter-web/AGENTS.mdAGENTS.md
- packages/adapter-whatsapp/AGENTS.mdAGENTS.md
- packages/catalog/AGENTS.mdAGENTS.md
- packages/create-chat-sdk/AGENTS.mdAGENTS.md
- packages/create-chat-sdk/_template/AGENTS.mdAGENTS.md
- packages/state-ioredis/AGENTS.mdAGENTS.md
- packages/state-memory/AGENTS.mdAGENTS.md
- packages/state-pg/AGENTS.mdAGENTS.md
- packages/state-redis/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- packages/adapter-discord/CLAUDE.mdCLAUDE.md
- packages/adapter-gchat/CLAUDE.mdCLAUDE.md
- packages/adapter-github/CLAUDE.mdCLAUDE.md
- packages/adapter-gitlab/CLAUDE.mdCLAUDE.md
- packages/adapter-linear/CLAUDE.mdCLAUDE.md
- packages/adapter-messenger/CLAUDE.mdCLAUDE.md
- packages/adapter-slack/CLAUDE.mdCLAUDE.md
- packages/adapter-teams/CLAUDE.mdCLAUDE.md
- packages/adapter-telegram/CLAUDE.mdCLAUDE.md
- packages/adapter-web/CLAUDE.mdCLAUDE.md
- packages/adapter-whatsapp/CLAUDE.mdCLAUDE.md
- packages/catalog/CLAUDE.mdCLAUDE.md
- packages/create-chat-sdk/CLAUDE.mdCLAUDE.md
- packages/create-chat-sdk/_template/CLAUDE.mdCLAUDE.md
- packages/state-ioredis/CLAUDE.mdCLAUDE.md
- packages/state-memory/CLAUDE.mdCLAUDE.md
- packages/state-pg/CLAUDE.mdCLAUDE.md
- packages/state-redis/CLAUDE.mdCLAUDE.md
- add-adapterSkill
- technical-writerSkill
- chat-sdkSkill
- chat-sdkSkill
- chat-sdkSkill
- chat-sdkSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

