docs: finalize webhook shortcut docs

This commit is contained in:
Mengz 2026-05-19 15:54:31 +08:00
parent 83a642a72d
commit 2f84f3c62e
5 changed files with 28 additions and 16 deletions

View File

@ -13,7 +13,7 @@ The official [GitLink](https://www.gitlink.org.cn) CLI tool — built for humans
## Why gitlink-cli?
- **Agent-Native Design** — 12 structured [Skills](./skills/) out of the box, compatible with Claude Code, OpenClaw, and other AI platforms — Agents can operate GitLink with zero extra setup
- **Agent-Native Design** — 13 structured [Skills](./skills/) out of the box, compatible with Claude Code, OpenClaw, and other AI platforms — Agents can operate GitLink with zero extra setup
- **Wide Coverage** — Repository, Issue, PR, Webhook, Branch, Release, CI, Org, Search, User — all core domains covered
- **AI-Friendly & Optimized** — Every command is tested with real Agents, featuring concise parameters, smart defaults, and structured output
- **Cross-Platform** — Runs on macOS, Linux, and Windows (x64/arm64), install via `npm install -g @gitlink-ai/cli` in one command, binary auto-downloaded

View File

@ -5,7 +5,7 @@
[![Go Version](https://img.shields.io/badge/Go-1.26%2B-blue.svg)](https://golang.org)
[![npm version](https://img.shields.io/npm/v/@gitlink-ai/cli.svg)](https://www.npmjs.com/package/@gitlink-ai/cli)
[GitLink确实开源](https://www.gitlink.org.cn) 官方 CLI 工具 — 为人类和 AI Agent 双重设计。支持 **macOS、Linux、Windows**覆盖仓库管理、Issue 追踪、Pull Request、Webhook、CI/CD 和 AI 自动化工作流,包含 40+ 命令和 12 个 AI Agent [Skills](./skills/)。
[GitLink确实开源](https://www.gitlink.org.cn) 官方 CLI 工具 — 为人类和 AI Agent 双重设计。支持 **macOS、Linux、Windows**覆盖仓库管理、Issue 追踪、Pull Request、Webhook、CI/CD 和 AI 自动化工作流,包含 40+ 命令和 13 个 AI Agent [Skills](./skills/)。
**[English](./README.md)**
@ -13,7 +13,7 @@
## 为什么选择 gitlink-cli
- **Agent-Native 设计** — 开箱即用 11 个结构化 [Skills](./skills/),兼容 Claude Code — Agent 零配置即可操作 GitLink
- **Agent-Native 设计** — 开箱即用 13 个结构化 [Skills](./skills/),兼容 Claude Code — Agent 零配置即可操作 GitLink
- **广泛覆盖** — 仓库、Issue、PR、Webhook、分支、Release、CI、组织、搜索、用户 — 核心功能全覆盖
- **AI 友好 & 优化** — 每条命令都经过真实 Agent 测试,简洁参数、智能默认值、结构化输出
- **跨平台** — macOS、Linux、Windows (x64/arm64) 全支持,`npm` 一条命令安装
@ -287,7 +287,7 @@ git push gitlink
## AI Agent Skills
`skills/` 目录包含 11 个 Claude Code Agent Skill 文件,支持 AI 自动化操作 GitLink 平台。
`skills/` 目录包含 13 个 Claude Code Agent Skill 文件,支持 AI 自动化操作 GitLink 平台。
详见 [skills/README.md](skills/README.md)

View File

@ -0,0 +1,12 @@
# Webhook Shortcut
新增 `webhook` Shortcut 组,支持:
- `webhook +list`
- `webhook +create`
- `webhook +view`
- `webhook +update`
- `webhook +delete`
- `webhook +test`
同时补充了对应单元测试、帮助文档和示例说明。

View File

@ -11,9 +11,9 @@ import (
"github.com/gitlink-org/gitlink-cli/shortcuts/pr"
"github.com/gitlink-org/gitlink-cli/shortcuts/release"
"github.com/gitlink-org/gitlink-cli/shortcuts/repo"
"github.com/gitlink-org/gitlink-cli/shortcuts/webhook"
"github.com/gitlink-org/gitlink-cli/shortcuts/search"
"github.com/gitlink-org/gitlink-cli/shortcuts/user"
"github.com/gitlink-org/gitlink-cli/shortcuts/webhook"
)
// RegisterAll mounts all shortcut groups onto the root command.

View File

@ -24,14 +24,14 @@ func TestWebhookCreateBuildsPayload(t *testing.T) {
defer server.Close()
err := runWebhookShortcut(t, server, "create", map[string]string{
"url": "https://example.com/hook",
"events": "push,create",
"type": "slack",
"content-type": "form",
"http-method": "GET",
"secret": "abc123",
"url": "https://example.com/hook",
"events": "push,create",
"type": "slack",
"content-type": "form",
"http-method": "GET",
"secret": "abc123",
"branch-filter": "master",
"active": "false",
"active": "false",
})
if err != nil {
t.Fatalf("create shortcut failed: %v", err)
@ -55,8 +55,8 @@ func TestWebhookUpdatePreservesExistingFields(t *testing.T) {
"id": float64(68),
"type": "gitea",
"url": "https://old.example.com/hook",
"content_type": "json",
"http_method": "POST",
"content_type": "json",
"http_method": "POST",
"secret": "old-secret",
"branch_filter": "*",
"events": []interface{}{"push", "create"},
@ -72,8 +72,8 @@ func TestWebhookUpdatePreservesExistingFields(t *testing.T) {
defer server.Close()
err := runWebhookShortcut(t, server, "update", map[string]string{
"id": "68",
"url": "https://new.example.com/hook",
"id": "68",
"url": "https://new.example.com/hook",
"active": "false",
})
if err != nil {