@betterbugs/cli 0.0.0-stage → 0.1.0

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.
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@betterbugs/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "BetterBugs CLI: read, file and act on BetterBugs bug reports from the terminal, CI and coding agents.",
5
+ "license": "MIT",
6
+ "author": "BetterBugs",
7
+ "homepage": "https://betterbugs.io",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/betterbugs/cli.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/betterbugs/cli/issues"
14
+ },
15
+ "keywords": [
16
+ "betterbugs",
17
+ "cli",
18
+ "bug-reporting",
19
+ "bug-tracking",
20
+ "debugging",
21
+ "ci",
22
+ "agents"
23
+ ],
24
+ "type": "module",
25
+ "bin": {
26
+ "betterbugs": "dist/index.js",
27
+ "bbug": "dist/index.js",
28
+ "bb": "dist/index.js"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "skills",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "engines": {
37
+ "node": ">=20.18.1"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "provenance": true
42
+ }
43
+ }
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: betterbugs-debug
3
+ description: Investigate and fix a BetterBugs bug report with the `betterbugs` CLI. Use when the user mentions a BetterBugs bug id or link, asks why a reported bug happens, or asks you to fix or triage a BetterBugs report.
4
+ ---
5
+
6
+ # Debugging a BetterBugs bug report
7
+
8
+ BetterBugs captures what happened in the user's browser: console, network, the steps they took, screenshots, video and a session replay. The `betterbugs` CLI turns a report into files you can read selectively. Reading in the right order is what keeps your context small and your diagnosis right.
9
+
10
+ ## Order of operations
11
+
12
+ 1. **Pull first.** Run `betterbugs pull <id>`. Never start with unfiltered `get` commands; they return a lot of data.
13
+ - It writes `.betterbugs/<id>/` and prints a short summary. Add `--no-media` if you only need text.
14
+ 2. **Read `.betterbugs/<id>/manifest.json` → `signals` first.** Form a hypothesis before reading anything else. `probableCauses` is ranked, strongest first.
15
+ 3. **Read `network-errors.json`, then `console.json` filtered to errors.** Network failures with their bodies usually name the cause; console errors usually show where the client broke.
16
+ - For one-off questions use filtered commands instead of opening whole files:
17
+ - `betterbugs get network <id> --status 5xx --bodies errors`
18
+ - `betterbugs get console <id> --level error --tail 50`
19
+ - `betterbugs get events <id> --errors-only` (one timeline of failures and steps)
20
+ 4. **Read `steps.md`** to understand what the user did right before the failure.
21
+ 5. **Read `comments.md` before investigating further**, so you don't repeat findings people already posted.
22
+ 6. **Open screenshots only when the logs run out** (`media/`). They cost the most context.
23
+ 7. **Never paste whole files into context.** Grep the files and cite line numbers.
24
+
25
+ ## Things to keep in mind
26
+
27
+ - If `README.md` or `bug.json` says **Tech Mode was off**, missing console or network logs do **not** mean there were no errors.
28
+ - Data is redacted (tokens, cookies, password fields). `[REDACTED]` values are not the bug.
29
+ - Media URLs are public CDN links. Don't paste them into public places.
30
+ - Exit codes: `3` log in (`betterbugs auth login`), `4` missing permission or scope, `5` not found, `10` partial (pull wrote everything except some media).
31
+
32
+ ## When you have found the cause
33
+
34
+ 1. Fix the code and run the relevant tests.
35
+ 2. Post the finding on the bug, anchored to the moment of failure when there is a recording:
36
+
37
+ ```
38
+ betterbugs comment <id> "Root cause: <one sentence>. Fixed in <branch/PR>." --at <ms>
39
+ ```
40
+
41
+ 3. Only if the user asks, change the status: `betterbugs update <id> --status resolved`.
42
+
43
+ ## Useful commands
44
+
45
+ | Need | Command |
46
+ | --------------------------- | ------------------------------------------------------------- |
47
+ | Summary + signals | `betterbugs get bug <id>` |
48
+ | Everything as files | `betterbugs pull <id>` |
49
+ | Failed requests with bodies | `betterbugs get network <id> --status failed --bodies errors` |
50
+ | Console errors | `betterbugs get console <id> --level error` |
51
+ | What the user did | `betterbugs get steps <id> --tail 30` |
52
+ | Environment | `betterbugs get env <id>` |
53
+ | Prior discussion | `betterbugs get comments <id>` |
54
+ | Open bugs | `betterbugs list bugs --status open --since 7d` |
55
+ | Full command list (JSON) | `betterbugs agent-context` |
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: betterbugs-proof
3
+ description: Prove a BetterBugs bug is fixed with the `betterbugs` CLI. Generate a repro test, show it fails before the fix and passes after, then record the proof on the bug (test result, fixing PR, links). Use after fixing a bug that has a BetterBugs id, or when the user asks to verify or close one.
4
+ ---
5
+
6
+ # Proving a fix
7
+
8
+ A fix is proven when a test that reproduces the bug fails on the old code and passes on the new code, and that evidence is recorded on the bug where the team can see it.
9
+
10
+ ## 1. Get a reproduction test
11
+
12
+ ```
13
+ betterbugs repro <id> --framework playwright --out ./e2e
14
+ ```
15
+
16
+ - Read the generated spec before running it. It is a starting point; fix selectors and setup until it reproduces the reported behaviour.
17
+ - If the repo uses Selenium, pass `--framework selenium` (with `--language python` or `java`).
18
+
19
+ ## 2. Show it fails before the fix
20
+
21
+ Run the spec on the commit before your fix (or with the fix stashed). It must fail for the reason in the report, not for a setup problem. If it passes, the test does not reproduce the bug: improve it first.
22
+
23
+ ## 3. Show it passes after the fix
24
+
25
+ ```
26
+ npx playwright test e2e/repro-<id>.spec.ts --reporter=json > result.json
27
+ ```
28
+
29
+ ## 4. Record the proof on the bug
30
+
31
+ ```
32
+ betterbugs comment <id> --from-test-result ./result.json \
33
+ --message "Repro passes on branch fix/<topic> (failed before the fix)"
34
+ betterbugs add resource <id> <pull-request-url> --label "Fix PR"
35
+ ```
36
+
37
+ - `--from-test-result` attaches the pass/fail summary as a verification on the bug and posts it as a comment.
38
+ - If there is a recording of the fixed behaviour filed as another bug, link it: `betterbugs link bug <proof-id> <id> --type fixes`.
39
+
40
+ ## 5. Status
41
+
42
+ Only change the status when the user asks, or when the team's process says a verified fix closes the bug: `betterbugs update <id> --status resolved`.
43
+
44
+ ## Don't
45
+
46
+ - Don't claim a fix is proven from a test that never failed.
47
+ - Don't paste whole test logs into comments; the verification keeps the summary and the comment links to it.
48
+ - Don't run generated tests against production data.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: betterbugs-report
3
+ description: File a BetterBugs bug report from a failing test or a bug you reproduced, with the `betterbugs` CLI. Use when a test fails in a way a human should look at, when CI should report an end-to-end failure, or when the user asks you to report a bug to BetterBugs.
4
+ ---
5
+
6
+ # Filing a BetterBugs report
7
+
8
+ A good report lets someone else (or another agent) find the cause without re-running anything: a clear title, the page, what was expected, and the evidence: video or screenshot, console, network and steps.
9
+
10
+ ## Decide whether to file
11
+
12
+ - **File** for real regressions: a failing end-to-end test, an error you reproduced, a broken user flow.
13
+ - **Don't file** for expected failures, known-flaky tests (unless the user asked), or failures caused by your own unfinished change. Say why you didn't file.
14
+ - **Check first:** `betterbugs list bugs --status open --search "<key words>"`. If it's already reported, comment on that bug instead (`betterbugs comment <id> "…"`).
15
+
16
+ ## From a Playwright failure (preferred in CI)
17
+
18
+ ```
19
+ betterbugs create bug --from-playwright test-results/<failed-test-folder>/ \
20
+ --title "E2E: checkout total wrong with a coupon" \
21
+ --url "$STAGING_URL/checkout" \
22
+ --tag ci --tag e2e \
23
+ --dedupe-key "e2e:<suite>:<test title>:<branch>"
24
+ ```
25
+
26
+ - It reads `video.webm`, `trace.zip`, `test-failed-*.png` and `error-context.md` and attaches console, network and steps from the trace.
27
+ - **Always set `--dedupe-key`** in CI, so reruns of the same failure update one report instead of filing many. Make it stable across reruns and specific to the test: `${suite}:${test title}:${branch}`.
28
+
29
+ ## From scratch
30
+
31
+ ```
32
+ betterbugs create bug --title "<what is broken, in user terms>" --url "<page>" \
33
+ --description-file notes.md \
34
+ --screenshot shot.png \
35
+ --console console.json --network requests.har \
36
+ --priority high
37
+ ```
38
+
39
+ Use `--video recording.webm` instead of (or as well as) `--screenshot` when you have a recording.
40
+
41
+ - **Title:** the symptom, not the cause ("Order total ignores coupon", not "Fix calcTotals").
42
+ - **Description:** steps to reproduce, expected result, actual result, and the environment (branch, commit, browser).
43
+ - **Evidence:** attach at least one of screenshot or video. Add console and network when you have them; they're redacted before upload.
44
+ - **Payloads:** `betterbugs create bug @payload.json` (or `-` for stdin) takes the full payload when you're building it programmatically.
45
+
46
+ ## After filing
47
+
48
+ - **Print the link:** `create bug` prints the bug id and its web URL; put the URL in your summary or the CI step summary.
49
+ - **Add later evidence:** use `betterbugs attach <id> <file…>`, or `betterbugs add console <id> <file>` / `betterbugs add network <id> <file.har>`.
50
+ - **Exit codes:**
51
+ - `0` filed (or deduplicated)
52
+ - `3` not logged in (set `BETTERBUGS_TOKEN` in CI)
53
+ - `4` missing permission
54
+ - `8` plan limit (stop and tell the user)
55
+ - `9` the server rejected the payload (check the message)