关于 youtrack
youtrack 是通过 `yt` CLI 操作 YouTrack 实例的技能,适用于管理项目与问题的用户。它支持搜索、创建、更新问题及处理评论,并默认输出 JSON,便于解析。
主要功能
- 01搜索并查看问题
- 02创建和更新问题
- 03管理问题评论
- 04列出项目与敏捷看板
- 05支持 JSON 与文本输出
适用场景
- 01按查询条件筛选未解决问题
- 02创建问题并填写描述或父级
- 03更新问题状态并添加评论
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ billpeet/ agent-skills --skill youtrack安装后在 Claude Code 中输入/youtrack确认已加载。
详细介绍
YouTrack
使用 yt CLI 与 YouTrack 实例交互。所有命令默认输出 JSON,便于可靠解析。
设置
配置一次即可(凭据保存在 ~/.config/yt-cli/config.json):
yt setup --url https://your-instance.youtrack.cloud --token <permanent-api-token>
或者使用环境变量(优先级高于配置文件):
export YOUTRACK_BASE_URL=https://your-instance.youtrack.cloud
export YOUTRACK_TOKEN=<permanent-api-token>
工单
搜索
yt issue search "<query>" --format json --pretty
yt issue search "project: MyProject #Unresolved assignee: me" --top 20 --format json
yt issue search "tag: bug" --top 10 --skip 0 --format json
YouTrack 查询语法:project: PROJ、#Unresolved、assignee: me、priority: Critical、tag: bug、自由文本等。
获取单个工单
yt issue get PROJ-123 --format json --pretty
创建工单
yt issue create --project PROJ --summary "Summary here" --description "Details" --format json
yt issue create --project PROJ --summary "Summary here" --description "First paragraph\n\nScope:\n- Item one\n- Item two" --format json
yt issue create --project PROJ --summary "Summary here" --agile "Continuous Improvement" --parent PROJ-123 --format json
多行描述和评论
创建或更新工单描述,或添加评论时,请在带引号的参数中使用转义换行序列(\n),以保留段落和列表格式:
yt issue create --project PROJ --summary "Example" --description "First paragraph\n\nScope:\n- Item one\n- Item two" --format json
yt issue comment PROJ-123 --text "Implemented changes:\n- Added API endpoint\n- Updated tests" --format json
除非你有意让 YouTrack 中显示字面文本 \n,否则不要将换行符二次转义为 \\n。yt CLI 会在发送文本到 YouTrack 前将 \n 转换为实际换行符。如果你的 shell/工具支持,也可以使用字面换行符,但对于 Agent 来说,转义的 \n 是最安全、可移植的形式。
更新工单
yt issue update PROJ-123 --summary "New summary" --format json
yt issue update PROJ-123 --description "Updated description" --format json
yt issue update PROJ-123 --description "First paragraph\n\nScope:\n- Item one\n- Item two" --format json
yt issue update PROJ-123 --field "Priority=Critical" --field "State=In Progress" --format json
yt issue update PROJ-123 --agile "Continuous Improvement" --parent PROJ-456 --format json
自定义字段使用 --field "Name=Value",可重复指定多个字段。使用 --agile 将工单添加到看板/当前冲刺,使用 --parent 将工单设为另一个工单的子任务,以用于基于功能的泳道。
评论
列出评论:
yt issue comments PROJ-123 --format json --pretty
添加评论:
yt issue comment PROJ-123 --text "Comment text here" --format json
项目
yt project list --format json --pretty
敏捷看板
yt agile list --format json --pretty
用户
获取已通过身份验证的用户:
yt user me --format json --pretty
输出格式
所有命令均支持 --format json(紧凑格式)或 --format text(便于阅读)。添加 --pretty 可输出带缩进的 JSON。
退出代码:0 = 成功,1 = 错误。错误以 JSON 格式写入 stderr。
分页
在 issue search 中使用 --top <n>(默认值为 50)和 --skip <n>(默认值为 0)进行分页。
常见工作流
查找并更新工单:
yt issue search "summary: login bug #Unresolved" --format json --top 5
yt issue update PROJ-42 --field "State=In Progress" --agile "Continuous Improvement"
yt issue comment PROJ-42 --text "Started investigating — reproducible in staging."
创建并确认:
yt issue create --project PROJ --summary "Fix null pointer in auth flow" --description "Stack trace: ..." --format json --pretty
分配到看板和功能泳道:
yt agile list --format json --pretty
yt issue update PROJ-42 --agile "Continuous Improvement" --parent PROJ-123 --format json --pretty