diff --git a/README.md b/README.md index 289eb16..423a328 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ The official [GitLink](https://www.gitlink.org.cn) CLI tool — built for humans | Category | Capabilities | |----------|-------------| -| 📦 Repo | List, create, fork, delete repositories, view repo info, insights, and interactions | +| 📦 Repo | List, create, fork, delete repositories, view repo info, insights, interactions, and ignore templates | | 🐛 Issue | Create, update, close, batch close, comment on issues | | 🔖 Label | Create, list, update, delete issue labels | | 🔀 PR | Create, merge, review pull requests, view changed files | @@ -216,6 +216,10 @@ gitlink-cli user +me # List repositories gitlink-cli repo +list +# List built-in .gitignore templates +gitlink-cli ignore +list +gitlink-cli ignore +list --name Go + # View repository info gitlink-cli repo +info --owner Gitlink --repo forgeplus diff --git a/README.zh-CN.md b/README.zh-CN.md index ce6f964..5c0a2bf 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -103,7 +103,7 @@ | 分类 | 能力 | |------|------| -| 📦 仓库 | 列出、创建、Fork、删除仓库,查看仓库信息、洞察数据和互动状态 | +| 📦 仓库 | 列出、创建、Fork、删除仓库,查看仓库信息、洞察数据、互动状态和忽略文件模板 | | 🐛 Issue | 创建、更新、关闭、批量关闭、评论 Issue | | 🔖 标签 | 创建、列出、更新、删除 Issue 标签 | | 🔀 PR | 创建、合并、Review Pull Request,查看变更文件 | @@ -227,6 +227,10 @@ gitlink-cli user +me # 列出仓库 gitlink-cli repo +list +# 列出内置 .gitignore 模板 +gitlink-cli ignore +list +gitlink-cli ignore +list --name Go + # 查看仓库信息 gitlink-cli repo +info --owner Gitlink --repo forgeplus diff --git a/doc/changes/ignore-template-shortcuts.md b/doc/changes/ignore-template-shortcuts.md new file mode 100644 index 0000000..522c867 --- /dev/null +++ b/doc/changes/ignore-template-shortcuts.md @@ -0,0 +1,21 @@ +# Ignore Template Shortcuts + +## Summary + +Added `gitlink-cli ignore +list` to expose GitLink's `.gitignore` template catalog from the CLI. This fills the OpenAPI wrapper gap for `GET /ignores` and helps repository bootstrap workflows pick a valid ignore template before creating a project. + +## Commands + +| Command | Method / Endpoint | Purpose | +| --- | --- | --- | +| `ignore +list` | `GET /ignores` | List all built-in `.gitignore` templates | +| `ignore +list --name Go` | `GET /ignores?name=Go` | Filter templates by name | + +## Validation + +```bash +GOPROXY=https://goproxy.cn,direct go test ./shortcuts/ignore ./shortcuts +go vet ./shortcuts/ignore ./shortcuts +go run . ignore --help +go run . ignore +list --help +``` diff --git a/skills/README.md b/skills/README.md index af78bca..9e2cb38 100644 --- a/skills/README.md +++ b/skills/README.md @@ -73,6 +73,8 @@ skills/ │ ├── REFERENCE.md # 仓库 API 参考 │ └── examples/ │ └── repo-workflow.md # 仓库管理工作流 +├── gitlink-ignore/ # .gitignore 模板 +│ └── SKILL.md # 忽略模板查询指南 ├── gitlink-issue/ # Issue 管理 │ ├── SKILL.md # Issue 操作指南 │ ├── REFERENCE.md # Issue API 参考 @@ -135,6 +137,7 @@ skills/ |-------|------|----------| | **gitlink-shared** | 认证、全局参数、API 参考、安全规则、分支约定 | `auth login`, `auth status` | | **gitlink-repo** | 仓库管理与洞察 | `repo +list`, `repo +info`, `repo +languages`, `repo +contributors`, `repo +code-stats`, `repo +follow`, `repo +like` | +| **gitlink-ignore** | 忽略模板 | `ignore +list` | | **gitlink-issue** | Issue 管理 | `issue +create`, `issue +list`, `issue +view`, `issue +close`, `issue +batch-close` | | **gitlink-pr** | Pull Request | `pr +list`, `pr +create`, `pr +view`, `pr +merge`, `pr +versions`, `pr +version-diff`, `pr +reviews`, `pr +review` | | **gitlink-member** | 仓库成员管理 | `member +list`, `member +add`, `member +batch-add`, `member +role`, `member +invite-link` | @@ -253,6 +256,7 @@ gitlink-cli org +info -i Gitlink - [gitlink-release/SKILL.md](gitlink-release/SKILL.md) - Release 命令 - [gitlink-pipeline/SKILL.md](gitlink-pipeline/SKILL.md) - Pipeline 命令 - [gitlink-search/SKILL.md](gitlink-search/SKILL.md) - 搜索命令 +- [gitlink-ignore/SKILL.md](gitlink-ignore/SKILL.md) - 忽略模板命令 **组织和用户**: - [gitlink-org/SKILL.md](gitlink-org/SKILL.md) - 组织命令 diff --git a/skills/gitlink-ignore/SKILL.md b/skills/gitlink-ignore/SKILL.md new file mode 100644 index 0000000..9be7a24 --- /dev/null +++ b/skills/gitlink-ignore/SKILL.md @@ -0,0 +1,40 @@ +--- +name: gitlink-ignore +version: 1.0.0 +description: "GitLink .gitignore 模板查询:列出/筛选平台内置忽略文件模板,用于创建仓库或补齐工程化配置。" +metadata: + requires: + bins: ["gitlink-cli"] + cliHelp: "gitlink-cli ignore --help" +--- + +# gitlink-ignore + +**CRITICAL — 开始前必须先阅读 [`../gitlink-shared/SKILL.md`](../gitlink-shared/SKILL.md),其中包含认证、权限处理和 API 注意事项。** + +## Shortcuts + +| Shortcut | 说明 | 需要认证 | +| --- | --- | --- | +| `ignore +list` | 查看 GitLink 内置 `.gitignore` 模板列表 | 否 | + +## 使用示例 + +```bash +# 列出所有模板 +gitlink-cli ignore +list + +# 按名称筛选模板 +gitlink-cli ignore +list --name Go +gitlink-cli ignore +list --name Python +``` + +## Agent 使用建议 + +- 创建仓库前,可用 `ignore +list --name <语言>` 检查平台是否支持对应 `.gitignore` 模板。 +- 结合 `repo +create --ignore-id `(如果当前版本支持)或 raw API 创建仓库时填入模板 ID。 +- 该命令只读,不会修改任何仓库状态。 + +## OpenAPI + +- `GET /ignores?name=`