catalog/repos/aarondpn--redmine-cli.md

129 lines
4.6 KiB
Markdown
Raw Normal View History

2026-04-06 22:24:03 +08:00
# Redmine命令行工具
`CLI` `Redmine` `项目管理` `Go` `命令行`
<p align="center">
<img src="docs/public/favicon.svg" alt="redmine-cli logo" width="120" />
</p>
<h1 align="center">redmine-cli</h1>
<p align="center">
用于 <a href="https://www.redmine.org/">Redmine</a> 项目管理的命令行界面工具。
</p>
<p align="center">
<a href="https://github.com/aarondpn/redmine-cli/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/aarondpn/redmine-cli/ci.yml?style=for-the-badge&logo=githubactions&logoColor=white&label=CI" alt="CI"></a>
<a href="https://github.com/aarondpn/redmine-cli/releases/latest"><img src="https://img.shields.io/github/v/release/aarondpn/redmine-cli?style=for-the-badge&logo=github&logoColor=white" alt="Release"></a>
<a href="https://go.dev/"><img src="https://img.shields.io/github/go-mod/go-version/aarondpn/redmine-cli?style=for-the-badge&logo=go&logoColor=white" alt="Go"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge&logo=opensourceinitiative&logoColor=white" alt="License"></a>
</p>
<p align="center">
<a href="https://www.redmine.org/projects/redmine/wiki/changelog"><img src="https://img.shields.io/badge/Redmine-4.x-B32024?style=for-the-badge&logo=redmine&logoColor=white" alt="Redmine 4.x"></a>
<a href="https://www.redmine.org/projects/redmine/wiki/changelog"><img src="https://img.shields.io/badge/Redmine-5.x-B32024?style=for-the-badge&logo=redmine&logoColor=white" alt="Redmine 5.x"></a>
<a href="https://www.redmine.org/projects/redmine/wiki/changelog"><img src="https://img.shields.io/badge/Redmine-6.x-B32024?style=for-the-badge&logo=redmine&logoColor=white" alt="Redmine 6.x"></a>
</p>
## 安装
### HomebrewmacOS 和 Linux
```bash
brew tap aarondpn/tap
brew install redmine
```
同时会为 bash、zsh 和 fish 安装 shell 补全功能。
### 快速安装脚本
```bash
curl -fsSL https://raw.githubusercontent.com/aarondpn/redmine-cli/main/install.sh | bash
```
自动检测您的操作系统和架构,下载最新版本并进行校验和验证,安装到 `~/.local/bin`
### 通过 Go 安装
```bash
go install github.com/aarondpn/redmine-cli@latest
```
### 手动下载
从 [GitHub Releases](https://github.com/aarondpn/redmine-cli/releases/latest) 获取适合您平台的最新版本:
| 平台 | 架构 | 下载 |
|-----------|------|------|
| Linux | x86_64 | `redmine-linux-amd64.tar.gz` |
| Linux | ARM64 | `redmine-linux-arm64.tar.gz` |
| macOS | Intel | `redmine-darwin-amd64.tar.gz` |
| macOS | Apple Silicon | `redmine-darwin-arm64.tar.gz` |
| Windows | x86_64 | `redmine-windows-amd64.zip` |
### 更新
```bash
redmine update
```
在替换二进制文件前,通过 SHA256 校验和下载并验证最新版本。
## 快速上手
```bash
# 配置您的 Redmine 服务器和 API 密钥
redmine init
# 列出问题
redmine issues list
# 查看特定问题
redmine issues view 123
# 记录工时
redmine time log
```
运行 `redmine --help` 查看所有可用命令。
## 与 AI 智能体配合使用
redmine-cli 内置了一个 [agent skill](https://github.com/anthropics/skills),可以教会 AI 编程智能体Claude Code、Cursor 等)如何高效使用该 CLI。该技能涵盖输出格式、分页、过滤、名称解析和常见工作流——让智能体知道使用 `-o json`、通过查询解决歧义值,并正确使用各种标志而无需猜测。
### 安装技能
```bash
# 全局安装(在所有项目中可用)
redmine install-skill --global
# 或仅为当前项目安装
redmine install-skill
```
底层使用 [skills](https://github.com/anthropics/skills) CLI`npx skills add`),需要安装 Node.js。
### 智能体学到什么
安装后,智能体将:
- 对所有命令使用 `-o json` 以获取机器可读的输出
- 捕获 `-o json` 时保持 `stderr` 独立JSON 仅写入 `stdout`
- 在创建或更新问题之前查询可用选项(跟踪器、状态、版本等),而不是猜测值
- 当值存在歧义时,向用户展示选项供其选择
- 使用 `--limit``--offset` 处理分页
- 使用名称解析(例如 `--assignee "张三"` 而非 `--assignee 42`
- 使用 `me` 简写代替 `--assignee me`
### 手动配置
如果不想使用技能安装程序,可以直接在智能体配置中添加技能引用。对于 Claude Code`.claude/settings.json` 中添加:
```json
{
"skills": ["aarondpn/redmine-cli:redmine-cli"]
}
```
或将 [`skills/redmine-cli/SKILL.md`](skills/redmine-cli/SKILL.md) 的内容复制到项目的 `CLAUDE.md` 或等效的智能体指令文件中。