redmine-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Redmine CLI

Redmine CLI

A CLI for the Redmine REST API. Use
redmine <command> --help
for detailed flags and examples — this skill only covers what
--help
cannot tell you.
这是一款基于Redmine REST API的CLI工具。使用
redmine <command> --help
可查看详细的参数和示例——本技能仅涵盖
--help
未提及的内容。

Available Commands

可用命令

Only these top-level commands exist. Do NOT invent subcommands that aren't listed here — run
redmine <command> --help
to discover subcommands.
CommandPurpose
issues
Create, list, get, update, close, reopen, assign, comment, delete, search, browse issues
projects
List, get, create, update, delete projects; list project members
time
Log, list, get, update, delete, summarize time entries
versions
Create, list, get, update, delete project versions (milestones)
memberships
List, get, create, update, delete project memberships
users
List, get, create, update, delete users
groups
List, get, create, update, delete groups; add/remove users
categories
List issue categories
trackers
List trackers
statuses
List issue statuses
search
Search issues, wiki, news, messages, or browse results
auth
Login, logout, list, switch, and check status of authentication profiles
wiki
List, get, create, update, delete wiki pages
api
Make raw authenticated API requests
仅存在以下顶级命令。请勿自行发明未列出的子命令——运行
redmine <command> --help
以查看子命令。
命令用途
issues
创建、列出、获取、更新、关闭、重新打开、分配、评论、删除、搜索、浏览问题
projects
列出、获取、创建、更新、删除项目;列出项目成员
time
记录、列出、获取、更新、删除、汇总工时条目
versions
创建、列出、获取、更新、删除项目版本(里程碑)
memberships
列出、获取、创建、更新、删除项目成员关系
users
列出、获取、创建、更新、删除用户
groups
列出、获取、创建、更新、删除组;添加/移除用户
categories
列出问题分类
trackers
列出追踪器
statuses
列出问题状态
search
搜索问题、维基、新闻、消息,或浏览结果
auth
登录、登出、列出、切换及检查认证配置文件状态
wiki
列出、获取、创建、更新、删除维基页面
api
发起已认证的原始API请求

Setup

设置

If the
redmine
command is not found, install it:
bash
curl -fsSL https://raw.githubusercontent.com/aarondpn/redmine-cli/main/install.sh | bash
Then run
redmine auth login
for interactive configuration. Use
redmine config
to verify an existing setup.
如果未找到
redmine
命令,请进行安装:
bash
curl -fsSL https://raw.githubusercontent.com/aarondpn/redmine-cli/main/install.sh | bash
然后运行
redmine auth login
进行交互式配置。使用
redmine config
验证现有配置。

Critical Rules

重要规则

  • Always use
    -o json
    when you need to parse output programmatically. JSON goes to stdout only; stderr is separate.
  • Use
    --limit 0
    to fetch ALL results. The default limit is 100.
  • All name-accepting flags (--project, --tracker, --status, --priority, --assignee, --category, --version, --activity) resolve human-readable names automatically. You don't need to look up IDs first.
  • --assignee me
    refers to the current API user.
  • --status "*"
    shows all issues regardless of status (default is
    open
    ).
  • 当需要以编程方式解析输出时,务必使用
    -o json
    。JSON仅输出到stdout;stderr是单独的输出流。
  • **使用
    --limit 0
    **以获取所有结果。默认限制为100条。
  • 所有接受名称的参数(--project、--tracker、--status、--priority、--assignee、--category、--version、--activity)会自动解析人类可读的名称。无需预先查找ID。
  • **
    --assignee me
    **指代当前API用户。
  • **
    --status "*"
    **显示所有状态的问题(默认是
    open
    )。

When Something Doesn't Work: Stop and Use
--help

遇到问题时:停止操作并使用
--help

Do NOT guess, loop, or retry with invented flags/subcommands. If a command fails or you're unsure about the correct syntax:
  1. Run
    redmine <command> --help
    (or
    redmine <command> <subcommand> --help
    ) to see the actual available options, flags, and subcommands.
  2. Read the help output carefully — it is authoritative and always up to date. Trust it over your own assumptions.
  3. Never invent flags or subcommands that aren't shown in
    --help
    . If you think an option should exist but it doesn't appear in the help, it doesn't exist.
  4. Do not loop — if the same command fails twice, stop and re-read the help output. Do not keep retrying with slight variations hoping one will work.
  5. Parse output with
    -o json
    and standard JSON tools (jq)
    — never use Python scripts, awk hacks, or regex to parse CLI output. The CLI's JSON output is well-structured; use it.
  6. Ask the user if the help output doesn't clarify things — that's better than spiraling through failed attempts.
请勿猜测、循环或使用自行发明的参数/子命令重试。如果命令执行失败或不确定正确语法:
  1. 运行
    redmine <command> --help
    (或
    redmine <command> <subcommand> --help
    )查看实际可用的选项、参数和子命令。
  2. 仔细阅读帮助输出——它是权威且始终最新的。请相信帮助内容而非自身假设。
  3. 绝不要发明未在
    --help
    中显示的参数或子命令
    。如果认为某个选项应该存在但未在帮助中显示,那它实际上并不存在。
  4. 不要循环重试——如果同一命令失败两次,请停止操作并重新阅读帮助输出。不要不断尝试微小的变体以期成功。
  5. 使用
    -o json
    和标准JSON工具(如jq)解析输出
    ——绝不要使用Python脚本、awk技巧或正则表达式解析CLI输出。CLI的JSON输出结构清晰,请直接使用。
  6. 如果帮助输出未明确说明,请询问用户——这比不断尝试失败的操作更好。

Permission Gotcha: Users & Groups

权限陷阱:用户与组

Resolving users and groups by name requires admin privileges. If you get a permission error:
  • Do NOT retry with the same name
  • Use
    me
    for the current user
  • To discover user IDs without admin access, extract them from other sources:
    • redmine issues list --project <project> -o json
      — the
      assigned_to
      and
      author
      fields contain user IDs and names
    • redmine memberships list --project <project> -o json
      — lists all project members with their IDs
    • redmine issues get <id> --journals -o json
      — journal entries contain user references
通过名称解析用户和组需要管理员权限。如果遇到权限错误:
  • 请勿使用相同名称重试
  • 对当前用户使用
    me
  • 若没有管理员权限,可从其他来源获取用户ID:
    • redmine issues list --project <project> -o json
      ——
      assigned_to
      author
      字段包含用户ID和名称
    • redmine memberships list --project <project> -o json
      ——列出所有项目成员及其ID
    • redmine issues get <id> --journals -o json
      ——日志条目包含用户引用

Workflow: Resolving Ambiguous Values

工作流:解析模糊值

When a command needs a value from a fixed set (tracker, status, priority, category, version, assignee) and you're not sure of the exact name:
  1. Query options first:
    redmine trackers list -o json
    ,
    redmine statuses list -o json
    , etc.
  2. Present choices to the user via AskUserQuestion with a formatted list
  3. Use the confirmed value in the command
For users/groups, if the list endpoint fails with a permission error, use the workarounds from the section above instead.
当命令需要从固定集合(追踪器、状态、优先级、分类、版本、经办人)中取值且不确定确切名称时:
  1. 先查询选项
    redmine trackers list -o json
    redmine statuses list -o json
    等。
  2. 通过AskUserQuestion向用户展示可选列表
  3. 在命令中使用用户确认的值
对于用户/组,如果列表端点因权限错误无法访问,请使用上述部分的解决方法。

After Creating Resources

创建资源后

When you create an issue, project, user, or other resource, the CLI returns the new ID. Offer the user a clickable URL so they can open it in the browser:
  • Issues:
    redmine issues open <id>
    opens the issue directly. You can also provide the URL:
    <server>/issues/<id>
  • Projects:
    <server>/projects/<identifier>
  • Users:
    <server>/users/<id>
  • Time entries:
    <server>/time_entries/<id>/edit
Get the server URL from
redmine config
(or from the JSON output's hints). Always mention the URL or the
open
command after a successful create so the user can quickly navigate to the new resource.
当创建问题、项目、用户或其他资源时,CLI会返回新资源的ID。请为用户提供可点击的URL,以便他们在浏览器中打开:
  • 问题
    redmine issues open <id>
    可直接打开问题。也可提供URL:
    <server>/issues/<id>
  • 项目
    <server>/projects/<identifier>
  • 用户
    <server>/users/<id>
  • 工时条目
    <server>/time_entries/<id>/edit
redmine config
(或JSON输出的提示)中获取服务器URL。成功创建资源后,务必告知用户URL或
open
命令,以便他们快速访问新资源。

Non-Obvious Behaviors

非直观行为

  • redmine issues list
    defaults to
    --status open
    . Use
    --status closed
    ,
    --status "*"
    , or a specific status name.
  • redmine issues get <id> --journals
    includes comments/history. Also available:
    --children
    ,
    --relations
    .
  • redmine issues update
    only sends flags you explicitly pass — omitted flags are not changed.
  • If
    --project
    is omitted, the configured default project is used (set via
    redmine auth login
    ).
  • Projects can accumulate hundreds of versions, most of them closed or locked. When you need a version for a new issue, time entry, or similar workflow, always start from
    redmine versions list --open
    so the shortlist stays small and you don't pick a version that can no longer accept work.
  • Any date flag (
    --due-date
    ,
    --date
    ,
    --from
    ,
    --to
    ) accepts the literal keyword
    today
    as a shortcut for the current date.
  • redmine issues list
    默认使用
    --status open
    。可使用
    --status closed
    --status "*"
    或特定状态名称。
  • redmine issues get <id> --journals
    包含评论/历史记录。还可使用
    --children
    --relations
    参数。
  • redmine issues update
    仅发送你明确传入的参数——未传入的参数不会被修改。
  • 如果省略
    --project
    ,将使用配置的默认项目(通过
    redmine auth login
    设置)。
  • 项目可能累积数百个版本,其中大多数已关闭或锁定。当需要为新问题、工时条目或类似工作流选择版本时,请始终从
    redmine versions list --open
    开始,这样候选列表会更小,且不会选择无法再接受工作的版本。
  • 任何日期参数(
    --due-date
    --date
    --from
    --to
    )都接受字面关键字
    today
    作为当前日期的快捷方式。