bugpilot 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. bugpilot-0.1.0/LICENSE +122 -0
  2. bugpilot-0.1.0/MANIFEST.in +14 -0
  3. bugpilot-0.1.0/PKG-INFO +270 -0
  4. bugpilot-0.1.0/README.md +242 -0
  5. bugpilot-0.1.0/bugpilot/__init__.py +5 -0
  6. bugpilot-0.1.0/bugpilot/__main__.py +5 -0
  7. bugpilot-0.1.0/bugpilot/cli.py +2615 -0
  8. bugpilot-0.1.0/bugpilot/cli_json.py +173 -0
  9. bugpilot-0.1.0/bugpilot/core/__init__.py +1 -0
  10. bugpilot-0.1.0/bugpilot/core/agent_runner.py +138 -0
  11. bugpilot-0.1.0/bugpilot/core/artifact_io.py +40 -0
  12. bugpilot-0.1.0/bugpilot/core/artifacts.py +47 -0
  13. bugpilot-0.1.0/bugpilot/core/attachments.py +247 -0
  14. bugpilot-0.1.0/bugpilot/core/branch_policy.py +223 -0
  15. bugpilot-0.1.0/bugpilot/core/cleanup.py +58 -0
  16. bugpilot-0.1.0/bugpilot/core/code_files.py +99 -0
  17. bugpilot-0.1.0/bugpilot/core/config.py +242 -0
  18. bugpilot-0.1.0/bugpilot/core/context.py +436 -0
  19. bugpilot-0.1.0/bugpilot/core/copilot.py +47 -0
  20. bugpilot-0.1.0/bugpilot/core/delivery_instructions.py +106 -0
  21. bugpilot-0.1.0/bugpilot/core/doctor.py +66 -0
  22. bugpilot-0.1.0/bugpilot/core/email_notify.py +316 -0
  23. bugpilot-0.1.0/bugpilot/core/errors.py +105 -0
  24. bugpilot-0.1.0/bugpilot/core/executables.py +87 -0
  25. bugpilot-0.1.0/bugpilot/core/fix_mode_state.py +212 -0
  26. bugpilot-0.1.0/bugpilot/core/fix_mode_store.py +600 -0
  27. bugpilot-0.1.0/bugpilot/core/fix_modes.py +412 -0
  28. bugpilot-0.1.0/bugpilot/core/fix_report.py +124 -0
  29. bugpilot-0.1.0/bugpilot/core/git_history.py +1579 -0
  30. bugpilot-0.1.0/bugpilot/core/git_ops.py +254 -0
  31. bugpilot-0.1.0/bugpilot/core/handoff.py +127 -0
  32. bugpilot-0.1.0/bugpilot/core/identity.py +112 -0
  33. bugpilot-0.1.0/bugpilot/core/input_adapters.py +97 -0
  34. bugpilot-0.1.0/bugpilot/core/instructions.py +337 -0
  35. bugpilot-0.1.0/bugpilot/core/issue.py +487 -0
  36. bugpilot-0.1.0/bugpilot/core/jira.py +886 -0
  37. bugpilot-0.1.0/bugpilot/core/jira_adf.py +167 -0
  38. bugpilot-0.1.0/bugpilot/core/jira_parse.py +442 -0
  39. bugpilot-0.1.0/bugpilot/core/keywords.py +386 -0
  40. bugpilot-0.1.0/bugpilot/core/logging_utils.py +28 -0
  41. bugpilot-0.1.0/bugpilot/core/memory.py +151 -0
  42. bugpilot-0.1.0/bugpilot/core/models.py +322 -0
  43. bugpilot-0.1.0/bugpilot/core/project_settings.py +283 -0
  44. bugpilot-0.1.0/bugpilot/core/prompts.py +567 -0
  45. bugpilot-0.1.0/bugpilot/core/repository_profile.py +739 -0
  46. bugpilot-0.1.0/bugpilot/core/retrieval.py +485 -0
  47. bugpilot-0.1.0/bugpilot/core/review_changes.py +155 -0
  48. bugpilot-0.1.0/bugpilot/core/review_report.py +171 -0
  49. bugpilot-0.1.0/bugpilot/core/run.py +171 -0
  50. bugpilot-0.1.0/bugpilot/core/safe_paths.py +173 -0
  51. bugpilot-0.1.0/bugpilot/core/search.py +765 -0
  52. bugpilot-0.1.0/bugpilot/core/search_terms.py +310 -0
  53. bugpilot-0.1.0/bugpilot/core/setup.py +212 -0
  54. bugpilot-0.1.0/bugpilot/core/user_config.py +211 -0
  55. bugpilot-0.1.0/bugpilot/core/verification_report.py +313 -0
  56. bugpilot-0.1.0/bugpilot/core/workflow.py +2385 -0
  57. bugpilot-0.1.0/bugpilot/mcp_server.py +651 -0
  58. bugpilot-0.1.0/bugpilot.egg-info/PKG-INFO +270 -0
  59. bugpilot-0.1.0/bugpilot.egg-info/SOURCES.txt +63 -0
  60. bugpilot-0.1.0/bugpilot.egg-info/dependency_links.txt +1 -0
  61. bugpilot-0.1.0/bugpilot.egg-info/entry_points.txt +3 -0
  62. bugpilot-0.1.0/bugpilot.egg-info/requires.txt +6 -0
  63. bugpilot-0.1.0/bugpilot.egg-info/top_level.txt +1 -0
  64. bugpilot-0.1.0/pyproject.toml +63 -0
  65. bugpilot-0.1.0/setup.cfg +4 -0
bugpilot-0.1.0/LICENSE ADDED
@@ -0,0 +1,122 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Shiwei Xing
6
+
7
+ Licensed Work: BugPilot CLI and Tools Version 0.1.0.
8
+ This includes the bugpilot command-line tool and
9
+ Python package, the bugpilot-mcp server, the
10
+ bugpilot-investigate skill for Claude Code, the helper
11
+ scripts and installer tooling, and the accompanying
12
+ documentation and tests, as distributed in the BugPilot
13
+ repository and its Python packages for that version.
14
+ It does not include the BugPilot for VS Code extension,
15
+ which is licensed separately in extension/LICENSE.txt,
16
+ or third-party components identified as separately
17
+ licensed.
18
+
19
+ The Licensed Work is © 2026 Shiwei Xing.
20
+
21
+ Additional Use Grant: You may make production use of the Licensed Work
22
+ for the internal purposes of you or your organization,
23
+ including commercial software development and use of
24
+ the Licensed Work while providing software development
25
+ services to clients.
26
+
27
+ This grant does not include offering the Licensed Work,
28
+ or a substantially similar product or service based on
29
+ the Licensed Work, to third parties as a hosted,
30
+ managed, embedded, redistributed, or otherwise
31
+ competing offering. Such an offering requires a
32
+ separate commercial license from the Licensor.
33
+
34
+ Change Date: 2030-10-08
35
+
36
+ Change License: Apache License, Version 2.0
37
+
38
+ For alternative commercial licensing arrangements, contact the Licensor
39
+ through the BugPilot GitHub repository: https://github.com/xsw7910/bugpilot
40
+
41
+ Third-party components are licensed separately as identified in the
42
+ applicable third-party notices.
43
+
44
+ Notice
45
+
46
+ The Business Source License (this document, or the “License”) is not an Open
47
+ Source license. However, the Licensed Work will eventually be made available
48
+ under an Open Source License, as stated in this License.
49
+
50
+ -----------------------------------------------------------------------------
51
+
52
+ Business Source License 1.1
53
+
54
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
55
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
56
+
57
+ Terms
58
+
59
+ The Licensor hereby grants you the right to copy, modify, create derivative
60
+ works, redistribute, and make non-production use of the Licensed Work. The
61
+ Licensor may make an Additional Use Grant, above, permitting limited
62
+ production use.
63
+
64
+ Effective on the Change Date, or the fourth anniversary of the first publicly
65
+ available distribution of a specific version of the Licensed Work under this
66
+ License, whichever comes first, the Licensor hereby grants you rights under
67
+ the terms of the Change License, and the rights granted in the paragraph
68
+ above terminate.
69
+
70
+ If your use of the Licensed Work does not comply with the requirements
71
+ currently in effect as described in this License, you must purchase a
72
+ commercial license from the Licensor, its affiliated entities, or authorized
73
+ resellers, or you must refrain from using the Licensed Work.
74
+
75
+ All copies of the original and modified Licensed Work, and derivative works
76
+ of the Licensed Work, are subject to this License. This License applies
77
+ separately for each version of the Licensed Work and the Change Date may vary
78
+ for each version of the Licensed Work released by Licensor.
79
+
80
+ You must conspicuously display this License on each original or modified copy
81
+ of the Licensed Work. If you receive the Licensed Work in original or
82
+ modified form from a third party, the terms and conditions set forth in this
83
+ License apply to your use of that work.
84
+
85
+ Any use of the Licensed Work in violation of this License will automatically
86
+ terminate your rights under this License for the current and all other
87
+ versions of the Licensed Work.
88
+
89
+ This License does not grant you any right in any trademark or logo of
90
+ Licensor or its affiliates (provided that you may use a trademark or logo of
91
+ Licensor as expressly required by this License).
92
+
93
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
94
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
95
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
96
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
97
+ TITLE.
98
+
99
+ MariaDB hereby grants you permission to use this License’s text to license
100
+ your works, and to refer to it using the trademark “Business Source License”,
101
+ as long as you comply with the Covenants of Licensor below.
102
+
103
+ Covenants of Licensor
104
+
105
+ In consideration of the right to use this License’s text and the “Business
106
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
107
+ other recipients of the licensed work to be provided by Licensor:
108
+
109
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
110
+ or a license that is compatible with GPL Version 2.0 or a later version,
111
+ where “compatible” means that software provided under the Change License can
112
+ be included in a program with software provided under GPL Version 2.0 or a
113
+ later version. Licensor may specify additional Change Licenses without
114
+ limitation.
115
+
116
+ 2. To either: (a) specify an additional grant of rights to use that does not
117
+ impose any additional restriction on the right granted in this License, as
118
+ the Additional Use Grant; or (b) insert the text “None”.
119
+
120
+ 3. To specify a Change Date.
121
+
122
+ 4. Not to modify this License in any other way.
@@ -0,0 +1,14 @@
1
+ # What the source distribution carries, beyond the package itself.
2
+ #
3
+ # `tests/` is pruned: it is this repository's test suite, not something an
4
+ # installer needs. Its work item ids are synthetic (the convention is in
5
+ # `tests/test_publishable.py`), and `docs/` is repository history, not package
6
+ # documentation — so neither belongs in the sdist.
7
+ #
8
+ # Checked, not assumed: `python -m build` put 19 test files in the sdist before
9
+ # this file existed.
10
+ prune tests
11
+ prune docs
12
+ prune extension
13
+ prune scripts
14
+ prune installer
@@ -0,0 +1,270 @@
1
+ Metadata-Version: 2.4
2
+ Name: bugpilot
3
+ Version: 0.1.0
4
+ Summary: Turn a Jira issue or a bug you describe into focused code context for AI coding agents
5
+ Author: Shiwei Xing
6
+ License-Expression: BUSL-1.1
7
+ Project-URL: Repository, https://github.com/xsw7910/bugpilot
8
+ Project-URL: Issues, https://github.com/xsw7910/bugpilot/issues
9
+ Keywords: ai,debugging,bug-fixing,jira,code-context,developer-tools,claude,codex
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Bug Tracking
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest>=8; extra == "test"
25
+ Provides-Extra: mcp
26
+ Requires-Dist: mcp>=2; extra == "mcp"
27
+ Dynamic: license-file
28
+
29
+ # BugPilot
30
+
31
+ BugPilot turns a Jira issue — or a bug you describe yourself — into focused code context for your AI coding agent. It reads the issue, searches the repository, looks at related git history and similar past fixes, and writes a task package the agent can work from. Then it stops: you hand the package to the agent you use, and you stay in control of every commit.
32
+
33
+ It comes as a command-line tool (`bugpilot`), an MCP server (`bugpilot-mcp`) and a VS Code extension, which all share the same core.
34
+
35
+ ## Key features
36
+
37
+ - **Two ways in.** A Jira issue key (`JR-12345`) or a plain description of the bug. Jira is optional.
38
+ - **Focused context.** Code search with ranked files and matched lines, related git history, similar past fixes from shared memory, and the issue's own details, collected into `.ai/<issue>/context.md`.
39
+ - **One task for the agent.** `task.md` carries BugPilot's safety rules, what the repository is, your team's and your own instructions, the verification the project expects, the branch rules and the AI Fix Mode for this attempt.
40
+ - **Repository-neutral.** Nothing is assumed about languages or frameworks: a Repository Profile describes the repository, auto-detected from its build files or written by you.
41
+ - **Safe by default.** Preparing never launches an agent, never deletes your earlier artifacts, never commits, pushes or merges, and never edits a protected branch.
42
+ - **Results you can check.** The agent writes `fix_report.md`; reviews and verification evidence are recorded separately, in your words, and nothing is called verified that was not.
43
+
44
+ ## Requirements
45
+
46
+ - Python 3.10 or later.
47
+ - Git.
48
+ - [ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`) on `PATH` for code search.
49
+ - Optional: a Jira Cloud site with an API token, to work from Jira issues.
50
+ - Optional: an AI coding agent — Claude Code, Codex CLI, GitHub Copilot CLI or any other — to hand the task to.
51
+
52
+ ## Installation
53
+
54
+ Install BugPilot with pipx:
55
+
56
+ ```powershell
57
+ pipx install bugpilot
58
+ ```
59
+
60
+ Or with pip:
61
+
62
+ ```powershell
63
+ python -m pip install bugpilot
64
+ ```
65
+
66
+ Verify:
67
+
68
+ ```powershell
69
+ bugpilot --version
70
+ ```
71
+
72
+ Expected:
73
+
74
+ ```text
75
+ bugpilot 0.1.0
76
+ ```
77
+
78
+ The MCP server needs the optional MCP SDK: `pipx install "bugpilot[mcp]"`, or `python -m pip install "bugpilot[mcp]"`.
79
+
80
+ **Development installation.** To run BugPilot from a checkout of this repository instead:
81
+
82
+ ```powershell
83
+ git clone https://github.com/xsw7910/bugpilot.git
84
+ cd bugpilot
85
+ pipx install . # or: python -m pip install .
86
+ ```
87
+
88
+ Add the MCP server with `pipx install ".[mcp]"`. Working on BugPilot itself (editable install, tests, a standalone executable) is in [Development](#development).
89
+
90
+ ## First run
91
+
92
+ Run BugPilot from the root of the repository you want to fix — it writes its files there:
93
+
94
+ ```powershell
95
+ cd path\to\your-repo
96
+ bugpilot doctor # Python, git, ripgrep, Jira, agents
97
+ bugpilot bug --description "Saving a record with no selection crashes"
98
+ ```
99
+
100
+ That prepares `.ai/<work item>/` and prints the line to hand to your agent:
101
+
102
+ ```text
103
+ Read .ai/<work item>/task.md and complete the workflow.
104
+ ```
105
+
106
+ Add BugPilot's two folders to the repository's `.gitignore` before the first run — they hold generated files and fetched issue text:
107
+
108
+ ```gitignore
109
+ .ai/
110
+ .ai_memory/
111
+ ```
112
+
113
+ `bugpilot doctor` reports whether git ignores them (`ai_artifacts_ignored`).
114
+
115
+ ## Manual issue workflow
116
+
117
+ A bug you describe is a first-class input; it needs no Jira at all.
118
+
119
+ ```powershell
120
+ bugpilot bug --description "Exporting with an empty filter writes an empty file" --title "Empty export"
121
+ bugpilot bug --description-file bug.md --hint "Start in the export dialog's filter handling"
122
+ bugpilot bug --description "..." --attach .\crash.log --attach .\screenshot.png
123
+ ```
124
+
125
+ - `--hint` points the agent at where you think the fix belongs; it is guidance, checked against the evidence.
126
+ - `--attach` copies files into `.ai/<work item>/attachments/` and names them in the task.
127
+ - Each hand-written bug gets its own `local_<timestamp>` work item.
128
+
129
+ ## Jira setup
130
+
131
+ ```powershell
132
+ bugpilot setup # asks for the site, your email and an API token, and checks them
133
+ bugpilot bug JR-12345 # prepare from a real Jira issue
134
+ ```
135
+
136
+ - The site is `https://your-company.atlassian.net`-style: `https://` only, with no user name, password, query or fragment. Redirects are followed only within the same site. There is no option to allow plain `http://`.
137
+ - Where BugPilot reads the site, email and token: the environment first (`JIRA_BASE_URL`, `JIRA_EMAIL`, `JIRA_TOKEN`), then `~/.bugpilot/config.toml` (written by `bugpilot setup`; `bugpilot jira-site set` changes only the site). The VS Code extension's Jira Setup writes the site to the same file and keeps the email and token in VS Code's secret storage.
138
+ - Real Jira is required by default. `--allow-mock` allows clearly marked demo data for trying BugPilot without a Jira site.
139
+ - BugPilot reads Jira. It writes to Jira only when you ask it to post one comment (see [Notifications](#notifications)); it never transitions, assigns or edits fields.
140
+
141
+ ## Repository Profile
142
+
143
+ `task.md` describes the repository in a **Repository Context** section, from its profile:
144
+
145
+ - **Auto-detect** (default): high-confidence facts from the repository's own build and package files (`CMakeLists.txt`, `pyproject.toml`, `package.json`, `Cargo.toml`, `go.mod`, `pom.xml`, Gradle, `*.sln`, …) and its guidance files (`AGENTS.md`, `CONTRIBUTING.md`, …). Source files are never scanned and nothing is guessed.
146
+ - **Generic**: no language, framework or tooling assumption.
147
+ - **Custom**: details you write — languages, frameworks, application type, build system, test framework, codebase notes.
148
+
149
+ The profile is saved in `.bugpilot/repository_profile.json` in the repository (commit it to share it). No file means Auto-detect.
150
+
151
+ ```powershell
152
+ bugpilot repository-profile # what is configured, and what Auto-detect finds
153
+ bugpilot repository-profile set --mode generic
154
+ ```
155
+
156
+ ## User / Project Instructions
157
+
158
+ Two optional Markdown files add your own guidance to every `task.md`:
159
+
160
+ - **Project / Team Instructions** — `<repo>/.bugpilot/instructions.md` — the repository's rules, meant to be committed and shared: "Maintain Windows and Linux compatibility.", "Run module tests with `make check`."
161
+ - **User Instructions** — `~/.bugpilot/instructions.md` — your own preferences, for every repository: "Prefer small focused changes."
162
+
163
+ Each is at most 20,000 characters; a file that cannot be used (a link, not UTF-8, too long) is left out with a warning, never cut short. Saving empty text removes the file. Their text is never written to a log.
164
+
165
+ ```powershell
166
+ bugpilot instructions # both, and what they say
167
+ bugpilot instructions set --scope project --from-file team.md
168
+ bugpilot instructions set --scope user --clear
169
+ ```
170
+
171
+ **Precedence.** `task.md` lists its layers in this order, and the earlier one wins a conflict:
172
+
173
+ 1. BugPilot safety rules
174
+ 2. Repository context
175
+ 3. Project / team instructions (with the project's Verification Policy)
176
+ 4. User instructions
177
+ 5. AI Fix Mode
178
+ 6. Developer hint
179
+
180
+ So a team's "do not add new dependencies" beats one developer's "prefer library X". No instruction can loosen a safety rule: the task tells the agent to ignore one that tries — "commit directly to main", say — and to record the conflict.
181
+
182
+ ## Verification Policy and branch naming
183
+
184
+ Two project settings, saved in `.bugpilot/project_settings.json` (commit it to share it):
185
+
186
+ - **Verification Policy** — what level of checking the project expects from a fix: run relevant tests (on), run existing static checks (on), run the full test suite (off), report what was not run (on). `task.md` states it in four lines; it names no commands — your project instructions can. How an attempt verifies stays the Fix Mode's.
187
+ - **Branch naming** — the name a new branch gets when the branch policy calls for one: `feature/{issue}-{slug}` by default, or a template such as `bugfix/{issue}-{slug}`. Only `{issue}` and `{slug}` are substituted; `{issue}` is required, so two issues never share a branch, and a template that could make an unsafe ref is refused. It never creates or switches a branch, and a work item keeps the branch it already has.
188
+
189
+ ```powershell
190
+ bugpilot project-settings # current values, or the defaults
191
+ bugpilot project-settings set --from-file settings.json # {"verification": {...}, "branch_naming": {"template": "bugfix/{issue}-{slug}"}}
192
+ ```
193
+
194
+ ## Fix Modes
195
+
196
+ A Fix Mode decides *how* the agent approaches a bug — how far to investigate, how to implement, how to verify, what to report. It never decides what the agent may do.
197
+
198
+ - **Standard Fix** (`standard`) is the default. The other built-ins are **Conservative Fix**, **Investigate First** (no source changes in that pass), **Test-Driven Fix** and **Deep Analysis**.
199
+ - Choose one with `--fix-mode <id>`; the choice is recorded with the work item and reused when it is prepared again.
200
+ - Custom modes are JSON files: yours in `~/.bugpilot/fix_modes/`, the project's in `<repo>/.bugpilot/fix_modes/`. Start from `bugpilot fix-mode duplicate <builtin> <new-id> --scope user|project`.
201
+
202
+ ## Branch Policy
203
+
204
+ BugPilot never creates or switches branches itself; `task.md` tells the agent which branch to work on, by the policy you choose with `--branch-policy`:
205
+
206
+ - **`current`** (default): work on the checked-out branch. Only on `main`/`master` or a detached HEAD does the agent stop and ask to create a branch.
207
+ - **`per-issue`**: one branch for the work item, created once and reused.
208
+ - **`ask`**: the agent asks before editing which branch to use.
209
+
210
+ Preparing a work item again — a rebuild, a resume, a retry — never calls for a new branch. Under every policy `main` and `master` are never edited, committed to or pushed.
211
+
212
+ ## Security and safety
213
+
214
+ - **Nothing runs by default.** `bugpilot bug` prepares and stops. An agent is launched only with `--launch-agent claude|copilot`.
215
+ - **No delivery.** BugPilot never runs `git add`, `git commit`, `git push`, merges or opens pull requests. The agent asks before committing, and never pushes `main`/`master` or force-pushes.
216
+ - **Nothing deleted unless asked.** Only `--fresh` and `clean` delete, only BugPilot's own `.ai/<issue>/`, and never through a symbolic link or junction. Every write under `.ai/` and `.ai_memory/` refuses links the same way.
217
+ - **No programs from your repository.** `git`, `rg` and agent CLIs are found on `PATH`'s absolute entries only, never in the current folder.
218
+ - **Jira credentials stay out of artifacts.** Tokens are never written to generated files, logs or command lines.
219
+ - **AI review is read-only.** The VS Code extension's captured review runs without a shell or editing tools; BugPilot gives it the diff itself.
220
+
221
+ More in [docs/safety.md](https://github.com/xsw7910/bugpilot/blob/main/docs/safety.md).
222
+
223
+ ## Privacy
224
+
225
+ - Generated artifacts (`.ai/`) and shared memory (`.ai_memory/`) contain repository context: code excerpts, file paths, git history and fetched issue text. AI prompts built from them carry the same. Keep both folders out of source control unless you mean to share them.
226
+ - Project / Team Instructions and project settings in `.bugpilot/` are meant to be committed and shared. User Instructions in `~/.bugpilot/` are personal.
227
+ - Jira credentials are never written to generated artifacts.
228
+
229
+ ## CLI usage
230
+
231
+ ```powershell
232
+ bugpilot bug JR-12345 # prepare from Jira (keeps existing artifacts, launches nothing)
233
+ bugpilot bug JR-12345 --fresh # delete .ai/JR-12345/ first, then prepare
234
+ bugpilot bug JR-12345 --fix-mode conservative --branch-policy per-issue
235
+ bugpilot status JR-12345 # where a work item stands
236
+ bugpilot check-results JR-12345 # has the agent written fix_report.md?
237
+ bugpilot summarize-results JR-12345 # the report's status and a validation checklist
238
+ bugpilot review-package JR-12345 # a review prompt for any reviewer
239
+ bugpilot record-review JR-12345 --summary "..."
240
+ bugpilot retry-prompt JR-12345 # a second attempt, from your feedback
241
+ bugpilot clean JR-12345 # remove .ai/JR-12345/ (memory is kept)
242
+ ```
243
+
244
+ Add `--json` (queries) or `--json-lines` (`bug`) for machine-readable output. `bugpilot --help` and `bugpilot <command> --help` list every command and option.
245
+
246
+ ## Notifications
247
+
248
+ When a fix is ready BugPilot can tell people, if you ask: one Jira comment (`bugpilot jira-comment <ISSUE> --execute`, or `summarize-results` with `BUGPILOT_AUTO_JIRA_COMMENT=true`), or an email at the commit gate over Microsoft Graph or SMTP. Both are opt-in and preview by default. See [docs/notifications.md](https://github.com/xsw7910/bugpilot/blob/main/docs/notifications.md).
249
+
250
+ ## VS Code extension
251
+
252
+ The extension puts the whole workflow in a panel: the issue or a description, the steps and their results, Fix with AI, review and verification, and Advanced Settings for everything above. It uses the same `bugpilot` CLI. See [extension/README.md](https://github.com/xsw7910/bugpilot/blob/main/extension/README.md).
253
+
254
+ ## MCP server and Claude Code skill
255
+
256
+ `bugpilot-mcp` lets an agent drive BugPilot itself by calling tools ([docs/mcp_setup.md](https://github.com/xsw7910/bugpilot/blob/main/docs/mcp_setup.md)). A Claude Code skill in `skills/bugpilot-investigate/` tells Claude Code when to run the CLI ([docs/skill_setup.md](https://github.com/xsw7910/bugpilot/blob/main/docs/skill_setup.md)).
257
+
258
+ ## Development
259
+
260
+ Contributor setup — editable install, the Python and extension test suites, building the wheel, a standalone executable or the Windows installer — is in [docs/development.md](https://github.com/xsw7910/bugpilot/blob/main/docs/development.md). The architecture is described in [docs/architecture.md](https://github.com/xsw7910/bugpilot/blob/main/docs/architecture.md).
261
+
262
+ External code contributions are not currently accepted. Bug reports and feature requests are welcome through [GitHub Issues](https://github.com/xsw7910/bugpilot/issues).
263
+
264
+ ## Licence
265
+
266
+ BugPilot is source-available, not open source, under the Business Source License 1.1. The command-line tool, the `bugpilot-mcp` server, the Claude Code skill, the scripts, the installer tooling and the documentation in this repository are licensed as BugPilot CLI and Tools ([LICENSE](https://github.com/xsw7910/bugpilot/blob/main/LICENSE)); the VS Code extension has its own licence file, [extension/LICENSE.txt](https://github.com/xsw7910/bugpilot/blob/main/extension/LICENSE.txt), with the same terms and itself as the Licensed Work.
267
+
268
+ The licence lets you copy, modify, redistribute and make non-production use of BugPilot. Its Additional Use Grant adds production use for the internal purposes of you or your organization, including commercial software development and use while providing software development services to clients. Offering BugPilot, or a substantially similar product or service based on it, to third parties as a hosted, managed, embedded, redistributed or otherwise competing offering is not part of that grant and needs a separate commercial licence; for one, contact the Licensor through the [BugPilot GitHub repository](https://github.com/xsw7910/bugpilot). Each version becomes available under the Apache License 2.0 on its Change Date, or on the fourth anniversary of that version's first public release if that comes first. This is a summary; the licence files are authoritative.
269
+
270
+ Third-party components keep their own licences: the extension's codicons icon font is CC BY 4.0 ([extension/THIRD_PARTY_NOTICES.md](https://github.com/xsw7910/bugpilot/blob/main/extension/THIRD_PARTY_NOTICES.md)).
@@ -0,0 +1,242 @@
1
+ # BugPilot
2
+
3
+ BugPilot turns a Jira issue — or a bug you describe yourself — into focused code context for your AI coding agent. It reads the issue, searches the repository, looks at related git history and similar past fixes, and writes a task package the agent can work from. Then it stops: you hand the package to the agent you use, and you stay in control of every commit.
4
+
5
+ It comes as a command-line tool (`bugpilot`), an MCP server (`bugpilot-mcp`) and a VS Code extension, which all share the same core.
6
+
7
+ ## Key features
8
+
9
+ - **Two ways in.** A Jira issue key (`JR-12345`) or a plain description of the bug. Jira is optional.
10
+ - **Focused context.** Code search with ranked files and matched lines, related git history, similar past fixes from shared memory, and the issue's own details, collected into `.ai/<issue>/context.md`.
11
+ - **One task for the agent.** `task.md` carries BugPilot's safety rules, what the repository is, your team's and your own instructions, the verification the project expects, the branch rules and the AI Fix Mode for this attempt.
12
+ - **Repository-neutral.** Nothing is assumed about languages or frameworks: a Repository Profile describes the repository, auto-detected from its build files or written by you.
13
+ - **Safe by default.** Preparing never launches an agent, never deletes your earlier artifacts, never commits, pushes or merges, and never edits a protected branch.
14
+ - **Results you can check.** The agent writes `fix_report.md`; reviews and verification evidence are recorded separately, in your words, and nothing is called verified that was not.
15
+
16
+ ## Requirements
17
+
18
+ - Python 3.10 or later.
19
+ - Git.
20
+ - [ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`) on `PATH` for code search.
21
+ - Optional: a Jira Cloud site with an API token, to work from Jira issues.
22
+ - Optional: an AI coding agent — Claude Code, Codex CLI, GitHub Copilot CLI or any other — to hand the task to.
23
+
24
+ ## Installation
25
+
26
+ Install BugPilot with pipx:
27
+
28
+ ```powershell
29
+ pipx install bugpilot
30
+ ```
31
+
32
+ Or with pip:
33
+
34
+ ```powershell
35
+ python -m pip install bugpilot
36
+ ```
37
+
38
+ Verify:
39
+
40
+ ```powershell
41
+ bugpilot --version
42
+ ```
43
+
44
+ Expected:
45
+
46
+ ```text
47
+ bugpilot 0.1.0
48
+ ```
49
+
50
+ The MCP server needs the optional MCP SDK: `pipx install "bugpilot[mcp]"`, or `python -m pip install "bugpilot[mcp]"`.
51
+
52
+ **Development installation.** To run BugPilot from a checkout of this repository instead:
53
+
54
+ ```powershell
55
+ git clone https://github.com/xsw7910/bugpilot.git
56
+ cd bugpilot
57
+ pipx install . # or: python -m pip install .
58
+ ```
59
+
60
+ Add the MCP server with `pipx install ".[mcp]"`. Working on BugPilot itself (editable install, tests, a standalone executable) is in [Development](#development).
61
+
62
+ ## First run
63
+
64
+ Run BugPilot from the root of the repository you want to fix — it writes its files there:
65
+
66
+ ```powershell
67
+ cd path\to\your-repo
68
+ bugpilot doctor # Python, git, ripgrep, Jira, agents
69
+ bugpilot bug --description "Saving a record with no selection crashes"
70
+ ```
71
+
72
+ That prepares `.ai/<work item>/` and prints the line to hand to your agent:
73
+
74
+ ```text
75
+ Read .ai/<work item>/task.md and complete the workflow.
76
+ ```
77
+
78
+ Add BugPilot's two folders to the repository's `.gitignore` before the first run — they hold generated files and fetched issue text:
79
+
80
+ ```gitignore
81
+ .ai/
82
+ .ai_memory/
83
+ ```
84
+
85
+ `bugpilot doctor` reports whether git ignores them (`ai_artifacts_ignored`).
86
+
87
+ ## Manual issue workflow
88
+
89
+ A bug you describe is a first-class input; it needs no Jira at all.
90
+
91
+ ```powershell
92
+ bugpilot bug --description "Exporting with an empty filter writes an empty file" --title "Empty export"
93
+ bugpilot bug --description-file bug.md --hint "Start in the export dialog's filter handling"
94
+ bugpilot bug --description "..." --attach .\crash.log --attach .\screenshot.png
95
+ ```
96
+
97
+ - `--hint` points the agent at where you think the fix belongs; it is guidance, checked against the evidence.
98
+ - `--attach` copies files into `.ai/<work item>/attachments/` and names them in the task.
99
+ - Each hand-written bug gets its own `local_<timestamp>` work item.
100
+
101
+ ## Jira setup
102
+
103
+ ```powershell
104
+ bugpilot setup # asks for the site, your email and an API token, and checks them
105
+ bugpilot bug JR-12345 # prepare from a real Jira issue
106
+ ```
107
+
108
+ - The site is `https://your-company.atlassian.net`-style: `https://` only, with no user name, password, query or fragment. Redirects are followed only within the same site. There is no option to allow plain `http://`.
109
+ - Where BugPilot reads the site, email and token: the environment first (`JIRA_BASE_URL`, `JIRA_EMAIL`, `JIRA_TOKEN`), then `~/.bugpilot/config.toml` (written by `bugpilot setup`; `bugpilot jira-site set` changes only the site). The VS Code extension's Jira Setup writes the site to the same file and keeps the email and token in VS Code's secret storage.
110
+ - Real Jira is required by default. `--allow-mock` allows clearly marked demo data for trying BugPilot without a Jira site.
111
+ - BugPilot reads Jira. It writes to Jira only when you ask it to post one comment (see [Notifications](#notifications)); it never transitions, assigns or edits fields.
112
+
113
+ ## Repository Profile
114
+
115
+ `task.md` describes the repository in a **Repository Context** section, from its profile:
116
+
117
+ - **Auto-detect** (default): high-confidence facts from the repository's own build and package files (`CMakeLists.txt`, `pyproject.toml`, `package.json`, `Cargo.toml`, `go.mod`, `pom.xml`, Gradle, `*.sln`, …) and its guidance files (`AGENTS.md`, `CONTRIBUTING.md`, …). Source files are never scanned and nothing is guessed.
118
+ - **Generic**: no language, framework or tooling assumption.
119
+ - **Custom**: details you write — languages, frameworks, application type, build system, test framework, codebase notes.
120
+
121
+ The profile is saved in `.bugpilot/repository_profile.json` in the repository (commit it to share it). No file means Auto-detect.
122
+
123
+ ```powershell
124
+ bugpilot repository-profile # what is configured, and what Auto-detect finds
125
+ bugpilot repository-profile set --mode generic
126
+ ```
127
+
128
+ ## User / Project Instructions
129
+
130
+ Two optional Markdown files add your own guidance to every `task.md`:
131
+
132
+ - **Project / Team Instructions** — `<repo>/.bugpilot/instructions.md` — the repository's rules, meant to be committed and shared: "Maintain Windows and Linux compatibility.", "Run module tests with `make check`."
133
+ - **User Instructions** — `~/.bugpilot/instructions.md` — your own preferences, for every repository: "Prefer small focused changes."
134
+
135
+ Each is at most 20,000 characters; a file that cannot be used (a link, not UTF-8, too long) is left out with a warning, never cut short. Saving empty text removes the file. Their text is never written to a log.
136
+
137
+ ```powershell
138
+ bugpilot instructions # both, and what they say
139
+ bugpilot instructions set --scope project --from-file team.md
140
+ bugpilot instructions set --scope user --clear
141
+ ```
142
+
143
+ **Precedence.** `task.md` lists its layers in this order, and the earlier one wins a conflict:
144
+
145
+ 1. BugPilot safety rules
146
+ 2. Repository context
147
+ 3. Project / team instructions (with the project's Verification Policy)
148
+ 4. User instructions
149
+ 5. AI Fix Mode
150
+ 6. Developer hint
151
+
152
+ So a team's "do not add new dependencies" beats one developer's "prefer library X". No instruction can loosen a safety rule: the task tells the agent to ignore one that tries — "commit directly to main", say — and to record the conflict.
153
+
154
+ ## Verification Policy and branch naming
155
+
156
+ Two project settings, saved in `.bugpilot/project_settings.json` (commit it to share it):
157
+
158
+ - **Verification Policy** — what level of checking the project expects from a fix: run relevant tests (on), run existing static checks (on), run the full test suite (off), report what was not run (on). `task.md` states it in four lines; it names no commands — your project instructions can. How an attempt verifies stays the Fix Mode's.
159
+ - **Branch naming** — the name a new branch gets when the branch policy calls for one: `feature/{issue}-{slug}` by default, or a template such as `bugfix/{issue}-{slug}`. Only `{issue}` and `{slug}` are substituted; `{issue}` is required, so two issues never share a branch, and a template that could make an unsafe ref is refused. It never creates or switches a branch, and a work item keeps the branch it already has.
160
+
161
+ ```powershell
162
+ bugpilot project-settings # current values, or the defaults
163
+ bugpilot project-settings set --from-file settings.json # {"verification": {...}, "branch_naming": {"template": "bugfix/{issue}-{slug}"}}
164
+ ```
165
+
166
+ ## Fix Modes
167
+
168
+ A Fix Mode decides *how* the agent approaches a bug — how far to investigate, how to implement, how to verify, what to report. It never decides what the agent may do.
169
+
170
+ - **Standard Fix** (`standard`) is the default. The other built-ins are **Conservative Fix**, **Investigate First** (no source changes in that pass), **Test-Driven Fix** and **Deep Analysis**.
171
+ - Choose one with `--fix-mode <id>`; the choice is recorded with the work item and reused when it is prepared again.
172
+ - Custom modes are JSON files: yours in `~/.bugpilot/fix_modes/`, the project's in `<repo>/.bugpilot/fix_modes/`. Start from `bugpilot fix-mode duplicate <builtin> <new-id> --scope user|project`.
173
+
174
+ ## Branch Policy
175
+
176
+ BugPilot never creates or switches branches itself; `task.md` tells the agent which branch to work on, by the policy you choose with `--branch-policy`:
177
+
178
+ - **`current`** (default): work on the checked-out branch. Only on `main`/`master` or a detached HEAD does the agent stop and ask to create a branch.
179
+ - **`per-issue`**: one branch for the work item, created once and reused.
180
+ - **`ask`**: the agent asks before editing which branch to use.
181
+
182
+ Preparing a work item again — a rebuild, a resume, a retry — never calls for a new branch. Under every policy `main` and `master` are never edited, committed to or pushed.
183
+
184
+ ## Security and safety
185
+
186
+ - **Nothing runs by default.** `bugpilot bug` prepares and stops. An agent is launched only with `--launch-agent claude|copilot`.
187
+ - **No delivery.** BugPilot never runs `git add`, `git commit`, `git push`, merges or opens pull requests. The agent asks before committing, and never pushes `main`/`master` or force-pushes.
188
+ - **Nothing deleted unless asked.** Only `--fresh` and `clean` delete, only BugPilot's own `.ai/<issue>/`, and never through a symbolic link or junction. Every write under `.ai/` and `.ai_memory/` refuses links the same way.
189
+ - **No programs from your repository.** `git`, `rg` and agent CLIs are found on `PATH`'s absolute entries only, never in the current folder.
190
+ - **Jira credentials stay out of artifacts.** Tokens are never written to generated files, logs or command lines.
191
+ - **AI review is read-only.** The VS Code extension's captured review runs without a shell or editing tools; BugPilot gives it the diff itself.
192
+
193
+ More in [docs/safety.md](https://github.com/xsw7910/bugpilot/blob/main/docs/safety.md).
194
+
195
+ ## Privacy
196
+
197
+ - Generated artifacts (`.ai/`) and shared memory (`.ai_memory/`) contain repository context: code excerpts, file paths, git history and fetched issue text. AI prompts built from them carry the same. Keep both folders out of source control unless you mean to share them.
198
+ - Project / Team Instructions and project settings in `.bugpilot/` are meant to be committed and shared. User Instructions in `~/.bugpilot/` are personal.
199
+ - Jira credentials are never written to generated artifacts.
200
+
201
+ ## CLI usage
202
+
203
+ ```powershell
204
+ bugpilot bug JR-12345 # prepare from Jira (keeps existing artifacts, launches nothing)
205
+ bugpilot bug JR-12345 --fresh # delete .ai/JR-12345/ first, then prepare
206
+ bugpilot bug JR-12345 --fix-mode conservative --branch-policy per-issue
207
+ bugpilot status JR-12345 # where a work item stands
208
+ bugpilot check-results JR-12345 # has the agent written fix_report.md?
209
+ bugpilot summarize-results JR-12345 # the report's status and a validation checklist
210
+ bugpilot review-package JR-12345 # a review prompt for any reviewer
211
+ bugpilot record-review JR-12345 --summary "..."
212
+ bugpilot retry-prompt JR-12345 # a second attempt, from your feedback
213
+ bugpilot clean JR-12345 # remove .ai/JR-12345/ (memory is kept)
214
+ ```
215
+
216
+ Add `--json` (queries) or `--json-lines` (`bug`) for machine-readable output. `bugpilot --help` and `bugpilot <command> --help` list every command and option.
217
+
218
+ ## Notifications
219
+
220
+ When a fix is ready BugPilot can tell people, if you ask: one Jira comment (`bugpilot jira-comment <ISSUE> --execute`, or `summarize-results` with `BUGPILOT_AUTO_JIRA_COMMENT=true`), or an email at the commit gate over Microsoft Graph or SMTP. Both are opt-in and preview by default. See [docs/notifications.md](https://github.com/xsw7910/bugpilot/blob/main/docs/notifications.md).
221
+
222
+ ## VS Code extension
223
+
224
+ The extension puts the whole workflow in a panel: the issue or a description, the steps and their results, Fix with AI, review and verification, and Advanced Settings for everything above. It uses the same `bugpilot` CLI. See [extension/README.md](https://github.com/xsw7910/bugpilot/blob/main/extension/README.md).
225
+
226
+ ## MCP server and Claude Code skill
227
+
228
+ `bugpilot-mcp` lets an agent drive BugPilot itself by calling tools ([docs/mcp_setup.md](https://github.com/xsw7910/bugpilot/blob/main/docs/mcp_setup.md)). A Claude Code skill in `skills/bugpilot-investigate/` tells Claude Code when to run the CLI ([docs/skill_setup.md](https://github.com/xsw7910/bugpilot/blob/main/docs/skill_setup.md)).
229
+
230
+ ## Development
231
+
232
+ Contributor setup — editable install, the Python and extension test suites, building the wheel, a standalone executable or the Windows installer — is in [docs/development.md](https://github.com/xsw7910/bugpilot/blob/main/docs/development.md). The architecture is described in [docs/architecture.md](https://github.com/xsw7910/bugpilot/blob/main/docs/architecture.md).
233
+
234
+ External code contributions are not currently accepted. Bug reports and feature requests are welcome through [GitHub Issues](https://github.com/xsw7910/bugpilot/issues).
235
+
236
+ ## Licence
237
+
238
+ BugPilot is source-available, not open source, under the Business Source License 1.1. The command-line tool, the `bugpilot-mcp` server, the Claude Code skill, the scripts, the installer tooling and the documentation in this repository are licensed as BugPilot CLI and Tools ([LICENSE](https://github.com/xsw7910/bugpilot/blob/main/LICENSE)); the VS Code extension has its own licence file, [extension/LICENSE.txt](https://github.com/xsw7910/bugpilot/blob/main/extension/LICENSE.txt), with the same terms and itself as the Licensed Work.
239
+
240
+ The licence lets you copy, modify, redistribute and make non-production use of BugPilot. Its Additional Use Grant adds production use for the internal purposes of you or your organization, including commercial software development and use while providing software development services to clients. Offering BugPilot, or a substantially similar product or service based on it, to third parties as a hosted, managed, embedded, redistributed or otherwise competing offering is not part of that grant and needs a separate commercial licence; for one, contact the Licensor through the [BugPilot GitHub repository](https://github.com/xsw7910/bugpilot). Each version becomes available under the Apache License 2.0 on its Change Date, or on the fourth anniversary of that version's first public release if that comes first. This is a summary; the licence files are authoritative.
241
+
242
+ Third-party components keep their own licences: the extension's codicons icon font is CC BY 4.0 ([extension/THIRD_PARTY_NOTICES.md](https://github.com/xsw7910/bugpilot/blob/main/extension/THIRD_PARTY_NOTICES.md)).
@@ -0,0 +1,5 @@
1
+ """bugpilot prepare-only workflow prototype."""
2
+
3
+ # The one version string. pyproject.toml reads it (`[tool.setuptools.dynamic]`), and
4
+ # so do `bugpilot --version`, `doctor --json`, the MCP server and the Jira User-Agent.
5
+ __version__ = "0.1.0"