AgentSkillsCN

redmine-cli

通过Redmine REST API,以类似`red-cli`的界面,从命令行管理Redmine问题/工单。使用`~/.red/config.json`进行身份验证(服务器地址与API密钥),并可在`./.red/config.json`中选择性地配置本地覆盖项。当需要创建问题(默认为任务追踪器)、列出问题/项目、查看问题(含日志)、添加日志备注/评论(公开或私密)、编辑问题字段(主题、描述、状态、优先级、追踪器、父级、指派对象)、管理问题关系(相关、阻塞、重复、先于、后于)、按日志ID更新或移除现有评论(日志)、对列表进行筛选/排序/分页,或排查Redmine CLI配置问题(项目ID/用户ID、多实例模式下的`--rid`)时,可使用此工具。该技能会在Redmine、red-cli、问题创建/列表/查看/备注/编辑/关联/评论、子任务、父级、关系、`--rid`、`.red/config.json`、API密钥、项目ID、用户ID,或通过CLI自动化Redmine操作时自动触发。

SKILL.md
--- frontmatter
name: redmine-cli
description: "Manage Redmine issues/tickets from the command line via the Redmine REST API using a `red-cli`-style interface. Uses `~/.red/config.json` for auth (server + api-key) with optional local overrides in `./.red/config.json`. Use when you need to create issues (defaults to Task tracker), list issues/projects, view issues (with journals), add journal notes/comments (public or private), edit issue fields (subject, description, status, priority, tracker, parent, assigned-to), manage issue relations (relates, blocks, duplicates, precedes, follows), update/remove existing comments (journals) by journal id, filter/sort/paginate lists, or troubleshoot Redmine CLI configuration (project-id/user-id, multi-instance `--rid`). Triggers on Redmine, red-cli, issue create/list/view/note/edit/relate/comment, subtask, parent, relation, `--rid`, `.red/config.json`, `api-key`, `project-id`, `user-id`, or requests to automate Redmine from a CLI."

Redmine CLI

Use the bundled scripts/redmine_cli.py (no external dependencies) to interact with Redmine from the terminal. It reads auth/config from ~/.red/config.json (and optionally ./.red/config.json as an override).

Quick start

  1. Create a Redmine API key (Redmine UI: My account -> API access key).
  2. Create ~/.red/config.json (v1 / single-instance format):
json
{
  "api-key": "YOUR_API_KEY",
  "editor": "",
  "pager": "",
  "project": "",
  "project-id": 0,
  "server": "https://redmine.example.com",
  "user-id": 0
}
  1. Verify connectivity:
bash
python scripts/redmine_cli.py project list --json | head

Multi-instance (--rid) (optional)

If your ~/.red/config.json uses a v2 / multi-server structure (like the reference red-cli), select a server with --rid:

bash
python scripts/redmine_cli.py issue list --rid prod
python scripts/redmine_cli.py issue list --rid 1

Common tasks

List projects (default output is TSV; use --json for automation):

bash
python scripts/redmine_cli.py project list
python scripts/redmine_cli.py project list --json

List issues (uses project-id from config unless --all or issue list all):

bash
python scripts/redmine_cli.py issue list
python scripts/redmine_cli.py issue list --json --limit 10 --page 1
python scripts/redmine_cli.py issue list --query "login fails" --status_id 1 --sort priority
python scripts/redmine_cli.py issue list --issue-urls
python scripts/redmine_cli.py issue list --project   # include project column in output

List available projects, trackers, statuses, and priorities (useful before creating issues):

bash
python scripts/redmine_cli.py issue meta

Create an issue (defaults to "Task" tracker; use --tracker to override by name):

bash
python scripts/redmine_cli.py issue create --project-id 1 --subject "New feature request" --json
python scripts/redmine_cli.py issue create --subject "Bug fix" --description "Details here" --json
python scripts/redmine_cli.py issue create --subject "Subtask" --parent-id 123 --json
python scripts/redmine_cli.py issue create --subject "A bug" --tracker Bug --priority-id 3 --json

Get an issue:

bash
python scripts/redmine_cli.py issue view 12345
python scripts/redmine_cli.py issue view 12345 --journals

List all issues across projects:

bash
python scripts/redmine_cli.py issue list all
python scripts/redmine_cli.py issue list --all

List only issues assigned to the current user:

bash
python scripts/redmine_cli.py issue list me

Add a journal note to an issue:

bash
python scripts/redmine_cli.py issue note 12345 -m "Fixed in commit abc123"
python scripts/redmine_cli.py issue note 12345 -m "Customer-visible" --private
python scripts/redmine_cli.py issue note 12345 --message-file ./notes.md
python scripts/redmine_cli.py issue note 12345 --message-file - < ./notes.md

Edit issue fields (subject, description, status, priority, tracker, parent, assigned-to):

bash
python scripts/redmine_cli.py issue edit 12345 --description "New description"
python scripts/redmine_cli.py issue edit 12345 --description-file ./description.md
python scripts/redmine_cli.py issue edit 12345 --subject "Renamed" --status-id 2
python scripts/redmine_cli.py issue edit 12345 --parent-id 100       # make it a subtask
python scripts/redmine_cli.py issue edit 12345 --assigned-to-id 5 --priority-id 3

Manage issue relations (relates, blocks, duplicates, precedes, follows):

bash
python scripts/redmine_cli.py issue relate add 12345 67890                    # relates (default)
python scripts/redmine_cli.py issue relate add 12345 67890 --type blocks      # 12345 blocks 67890
python scripts/redmine_cli.py issue relate list 12345                          # list relations
python scripts/redmine_cli.py issue relate list 12345 --json
python scripts/redmine_cli.py issue relate remove 42                           # delete by relation id

Update/remove an existing comment (journal):

  1. Find the journal id in issue view --journals output: issue.journals[].id
  2. Update or remove:
bash
python scripts/redmine_cli.py issue comment update 5993 -m "Updated comment text"
python scripts/redmine_cli.py issue comment update 5993 --message-file ./comment.md
python scripts/redmine_cli.py issue comment remove 5993

Show current user info:

bash
python scripts/redmine_cli.py user me

Troubleshooting

  • HTTP 401/403: API key missing/invalid, REST API disabled, or insufficient permissions.
  • HTTP 404: wrong base URL (ensure it is the Redmine root, not a sub-path like /projects).
  • Config not found: ensure ~/.red/config.json exists and is valid JSON.

References

  • Redmine REST API notes (endpoints, payloads, filters): references/rest-api.md