Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jira-ai-bug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
jira-ai-bug
Link a Jira Bug by key, get AI root-cause analysis and fix suggestions, then generate a fix report (Jira key, root cause, changed files) when the issue is resolved.
- analyze: Fetch Jira Bug, search repo by keywords, collect git diff, optionally call AI for root cause and suggested fixes. Use
--no-aito skip AI and only output context. - report: Write a Markdown fix doc to
docs/jira-fixes/<KEY>-fix.md(Jira, root cause, suggested fix, changed files, verification).
Install
In any project (recommended):
npm install -D jira-ai-bug
# or
pnpm add -D jira-ai-bug
yarn add -D jira-ai-bugGlobal (optional):
npm install -g jira-ai-bugSetup
In your project root, copy
.env.exampleto.envand fill in:JIRA_BASE_URL– e.g.https://your-domain.atlassian.netJIRA_EMAIL– your Jira emailJIRA_API_TOKEN– create at Atlassian API tokensAI_API_KEY(optional) – for AI analysis; omit or use--no-aito skip AI
Add to your project
.gitignore(if not already):.env .jira-ai-analysis
Usage
Run from the project root (where your .env and git repo are).
Analyze a Bug (with AI if AI_API_KEY is set):
npx jira-ai-bug analyze PD-17851Analyze without AI (Jira + repo search + git diff only):
npx jira-ai-bug analyze PD-17851 --no-aiGenerate fix report after fixing the bug:
npx jira-ai-bug report PD-17851Output: docs/jira-fixes/PD-17851-fix.md with Jira key, summary, root cause, suggested fix, changed files (from git diff --name-only), and verification section.
When using --no-ai, a prompt file docs/jira-fixes/<KEY>-analyze-prompt.md is also generated. Open it in Cursor, select all, and ask the built-in AI: “请根据以上 Jira Bug 与代码上下文分析根因并给出修改建议” to get analysis without an external API key.
With npm scripts
In package.json:
{
"scripts": {
"jira:analyze": "jira-ai-bug analyze",
"jira:analyze:no-ai": "jira-ai-bug analyze --no-ai",
"jira:report": "jira-ai-bug report"
}
}Then:
pnpm jira:analyze PD-17851 --no-ai
pnpm jira:report PD-17851Env and options
| Variable | Required | Description |
|---|---|---|
JIRA_BASE_URL |
Yes (for Jira) | Jira Cloud base URL |
JIRA_EMAIL |
Yes | Jira account email |
JIRA_API_TOKEN |
Yes | Jira API token |
AI_BASE_URL |
No | Default https://api.openai.com |
AI_API_KEY |
No | Required only for AI analysis; use --no-ai to skip |
AI_MODEL |
No | Default gpt-4o-mini |
JIRA_AI_BUG_SEARCH_DIRS |
No | Comma-separated dirs to search (default: src, lib, packages/main/src, packages/AMC) |
Publish to GitHub / npm
- Create a new GitHub repo and push the contents of the
jira-ai-bugfolder (or clone this repo and copy the folder). - In
package.json, setrepository.urlto your repo URL. - To publish to npm:
npm publish(ensure you have an npm account and are logged in).
After publishing, anyone can install with:
pnpm add -D jira-ai-bugLicense
MIT