Skip to content

Commit 65da91e

Browse files
committed
feat(doctor): add --issue mode and GitHub bug report template
Adds a guided 'bunx @cortexkit/opencode-magic-context@latest doctor --issue' flow that collects environment, sanitized config, and the last 200 log lines into a ready-to-submit Markdown report, then either submits it directly via 'gh issue create' or opens the prefilled browser URL with a local file to paste. - New diagnostics module collects plugin/OpenCode versions, cross-platform paths, opencode/tui plugin registration state, cache version, storage stats, conflict detection, log file size, and recent historian dump summaries. - New logs module builds the issue markdown with path/username sanitization and a 200-line log tail. - runIssueFlow() reuses existing clack prompts and falls back from 'gh' to the bug_report.yml prefilled URL when gh is missing. - Adds .github/ISSUE_TEMPLATE/bug_report.yml pointing users at 'doctor --issue' for diagnostics, plus config.yml contact links. - README documents the new flag alongside --force. Verified locally with bun collectDiagnostics — paths are sanitized, real plugin version detected, storage + log sizes reported.
1 parent f004326 commit 65da91e

8 files changed

Lines changed: 657 additions & 3 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Bug Report
2+
description: Report a bug or unexpected behavior in Magic Context
3+
labels: ["bug"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for reporting! To make debugging faster, please run:
9+
10+
```
11+
bunx @cortexkit/opencode-magic-context@latest doctor --issue
12+
```
13+
14+
That command collects environment info, your sanitized config, and the last 200 log lines into a local file. You can paste its contents into the Diagnostics field below, or let it submit the issue directly via `gh`.
15+
16+
- type: input
17+
id: title
18+
attributes:
19+
label: Short description
20+
placeholder: "ctx_reduce is not dropping tool outputs even after execute threshold"
21+
validations:
22+
required: true
23+
24+
- type: textarea
25+
id: description
26+
attributes:
27+
label: What happened?
28+
description: Describe the problem, what you expected, and what you observed. Include repro steps if you have them.
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: diagnostics
34+
attributes:
35+
label: Diagnostics
36+
description: Paste the output of `bunx @cortexkit/opencode-magic-context@latest doctor --issue` here, or fill in the sections below manually.
37+
render: markdown
38+
39+
- type: input
40+
id: plugin_version
41+
attributes:
42+
label: Plugin version
43+
placeholder: "0.8.6"
44+
45+
- type: input
46+
id: opencode_version
47+
attributes:
48+
label: OpenCode version
49+
placeholder: "1.4.3"
50+
51+
- type: input
52+
id: platform
53+
attributes:
54+
label: Platform
55+
placeholder: "macOS arm64 / linux x64 / windows x64"
56+
57+
- type: dropdown
58+
id: client
59+
attributes:
60+
label: Client
61+
options:
62+
- OpenCode Desktop
63+
- OpenCode TUI (CLI)
64+
- OpenCode Web
65+
- Unknown
66+
validations:
67+
required: true
68+
69+
- type: textarea
70+
id: logs
71+
attributes:
72+
label: Log output (optional)
73+
description: |
74+
Contents of the magic-context log, trimmed to the relevant section and sanitized
75+
(remove your username and home path). The log lives under the system temp directory —
76+
on macOS/Linux it's typically `/tmp/magic-context.log` or under `$TMPDIR`.
77+
render: shell

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Documentation
4+
url: https://github.com/cortexkit/opencode-magic-context#readme
5+
about: Check the README for configuration, setup, and feature docs before filing an issue.
6+
- name: Configuration reference
7+
url: https://github.com/cortexkit/opencode-magic-context/blob/master/CONFIGURATION.md
8+
about: Full reference for magic-context.jsonc options.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ Use `--force` to force-clear the plugin cache even when versions match (fixes br
147147
bunx @cortexkit/opencode-magic-context@latest doctor --force
148148
```
149149

150+
Hit a real bug? Use `--issue` to collect environment, sanitized config, and the last 200 log lines into a ready-to-submit report. It can also open the issue directly via `gh` if you have it installed:
151+
152+
```bash
153+
bunx @cortexkit/opencode-magic-context@latest doctor --issue
154+
```
155+
150156
---
151157

152158
## What Your Agent Gets

0 commit comments

Comments
 (0)