Ticketron(tix)
JIRA的智能CLI助手,由LLM提供支持。
电梯间距
Ticketron(tix)简化了直接从命令行与JIRA的交互。通过以下方式利用大型语言模型(LLM)的强大功能 jira-mcp-server OpenAI,它允许您使用自然语言或简洁的命令创建和搜索JIRA票证。主要目标是简化您的工作流程,通过自动添加相关上下文使票务管理更快、更直观。
特性
- 使用自然语言创建JIRA问题(
tix create ...) - 使用JQL搜索JIRA问题(
tix search ...) - 通过LLM生成上下文票证(使用OpenAI)
- 配置管理(
tix config init|show|locate|set-key) - 安全的API密钥存储(操作系统密钥链或环境变量)
- LLM上下文管理(
tix context show|edit|add) - Shell补全支持(Bash、Zsh、Fish、PowerShell)
- 结构化输出格式(JSON、YAML、TSV)
- 结构化日志记录,便于调试
安装
先决条件
- 去: 版本1.23.8或更高版本。
- jira mcp服务器: 访问正在运行的实例 jira mcp服务器 (JIRA通信所需)。
- OpenAI API密钥: LLM功能所必需的。
- 制造商: 开发任务(构建、测试、linting)所需。
安装命令
go install github.com/karolswdev/ticketron/cmd/tix@latest确保您的 $GOPATH/bin 或 $HOME/go/bin 在你的 PATH.
壳牌完井
tix 支持为Bash、Zsh、Fish和PowerShell生成shell完成脚本。
要为shell生成脚本,请使用 completion 命令:
# For Bash
tix completion bash
# For Zsh
tix completion zsh
# For Fish
tix completion fish
# For PowerShell
tix completion powershell按照命令打印的说明将完成项加载到当前会话中,或将其配置为自动加载。
Bash示例(添加到 ~/.bashrc 或 ~/.bash_profile):
source
# Alternative: Use Environment Variable
# export TICKETRON_LLM_API_KEY=""- 创建您的第一张票:
# Example: Create a bug report (uses LLM if description is provided)
tix create bug "Login button unresponsive" --description "When clicking the login button on the main page, nothing happens. Check console logs."配置
Ticketron要求配置文件存储在 ~/.ticketron/。您可以使用以下命令初始化默认配置目录和模板文件:
tix config init此命令创建 ~/.ticketron/ 如果目录不存在,则使用默认模板文件填充它(config.yaml, links.yaml, system_prompt.txt, context.md).它 不 处理API密钥设置。
OpenAI API密钥
OpenAI API密钥是LLM功能所必需的,并且出于安全原因必须单独配置。您有两个选择:
- 推荐:使用操作系统钥匙链:
tix config set-key 此命令将您的密钥安全地存储在操作系统的密钥链中。 ticketron 将自动从那里检索它。
- 备选方案:环境变量:
设置 TICKETRON_LLM_API_KEY 环境变量:
export TICKETRON_LLM_API_KEY=""如果在钥匙链中找不到钥匙,应用程序将使用此变量。
配置文件
在中找到关键配置文件 ~/.ticketron/:
config.yaml:主要配置。
- mcp_server.url:您跑步的URL jira-mcp-server. - 其他设置,如默认项目、问题类型、日志级别。 - 注: 这 openai.api_key 是 不再存储在此处.
links.yaml:将短项目别名映射到完整的JIRA项目密钥和默认问题类型。
- 例子:
links:
- name: WEB
key: WEBPROJECT
default_issue_type: Story
- name: API
key: BACKENDAPI
default_issue_type: Task
- name: DS
key: DATASCIENCE
default_issue_type: Bugsystem_prompt.txt:包含在创建票证期间用于指示LLM的系统提示。修改此设置以调整LLM的行为。context.md:为LLM提供有关您的项目、团队或常见票证模式的持久上下文。
使用 tix config show 查看当前配置(不包括API密钥),以及 tix config locate 查找配置目录。
基本用法
使用 tix --version 以显示应用程序版本。
创建票证
# Create a bug with a simple title
tix create bug "Login fails on checkout page"
# Create a story for a specific project (using alias from links.yaml)
tix create --type Story --project WEB "Implement new user profile page design"
# Create a task with more detail (will be processed by LLM)
tix create task "Refactor auth module to use JWT" --description "The current session management is outdated. We need to switch to JWT for better security and scalability. Update login, logout, and token refresh endpoints."
# Create a ticket interactively (prompts for confirmation before sending)
tix create -i bug "UI glitch on settings page"
# Create a ticket and output the result as JSON
tix create task "Setup CI pipeline" -o json搜索门票
# Search using natural language (processed by LLM to generate JQL)
tix search "my open bugs in the WEB project"
# Search using explicit JQL
tix search --jql "project = WEB AND status = 'In Progress' ORDER BY created DESC"
# Search for unresolved tickets assigned to you
tix search --jql "assignee = currentUser() AND resolution = Unresolved"
# Search for tickets and output results as JSON
tix search "my open tasks" -o json
# Search and output specific fields as JSON
tix search "status = Done" -o json -f key,fields.summary,fields.status.name
# Search and output results as YAML
tix search "my open tasks" -o yaml
# Search and output results as TSV (Tab-Separated Values)
tix search "project = API" -o tsv
# Search and output specific fields as TSV
tix search "project = API" -o tsv -f key,fields.issuetype.name,fields.summary
管理配置
# Initialize configuration files
tix config init
# Show current configuration values
tix config show
# Show the location of the configuration directory
tix config locate
# Securely set the OpenAI API key in the OS keychain
tix config set-key 管理LLM上下文
这 context.md 文件为LLM提供持久上下文。您可以使用 tix context 命令:
# Show the current content of the context file
tix context show
# Open the context file in your default editor ($EDITOR)
tix context edit
# Add a new line of text to the context file
tix context add "Remember to always include the component name in bug reports."发展
此项目使用 Makefile 简化常见的开发任务。确保你有 make 安装。
- 构建: 编译
tix二元的。
make build- 测试: 运行单元和集成测试。
make test- 棉绒: 运行Go linter(
golangci-lint).
make lint- 格式: 使用格式化Go源代码
gofmt.
make fmt- 所有检查: 运行格式、lint和测试目标。
make check请参阅 Makefile 对于其他可用目标。
贡献
请注意,此项目随附 贡献者行为准则参与此项目即表示您同意遵守其条款。
看 贡献.md 了解如何做出贡献的详细信息。
许可证
该项目根据MIT许可证获得许可。有关详细信息,请参阅LICENSE文件。
