@betterbugs/cli 0.1.0 → 0.1.2

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 (3) hide show
  1. package/README.md +140 -281
  2. package/dist/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,303 +1,162 @@
1
- # betterbugs — the BetterBugs CLI
1
+ # BetterBugs CLI
2
2
 
3
- Read, file and act on BetterBugs bug reports from the terminal, CI pipelines and coding agents.
4
- Built from the "BetterBugs CLI Engineering and Product Scope" document.
3
+ Read, file and act on [BetterBugs](https://betterbugs.io) bug reports from your terminal, CI pipelines and coding agents.
5
4
 
6
5
  ```bash
7
- betterbugs auth login # browser login (or --token from stdin for CI)
6
+ npm install -g @betterbugs/cli
7
+
8
+ betterbugs auth login # log in through your browser
8
9
  betterbugs list bugs --status open --since 7d
9
- betterbugs get bug <id> # summary + ranked signals
10
- betterbugs pull <id> # .betterbugs/<id>/ for an agent to navigate
11
- betterbugs comment <id> "Root cause: …" --at 42100
10
+ betterbugs get bug <id> # summary, environment and the most useful signals
11
+ betterbugs pull <id> # the whole report as files, for you or an agent
12
+ betterbugs comment <id> "Root cause: …"
12
13
  betterbugs update <id> --status resolved
13
14
  ```
14
15
 
15
- The package installs the same CLI under three names: `betterbugs`, `bbug` and `bb`. Scripts, CI and docs use `betterbugs`.
16
-
17
- ## Status
18
-
19
- **Phase 1 (read path + agent enablement): implemented on the CLI side.**
20
-
21
- | Area | Commands |
22
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
23
- | Auth & setup | `auth login` (browser, `--force`, `--login-timeout`, `--token`), `auth status` / `whoami`, `auth refresh`, `auth logout [--all] [--local]`, `auth token --print`, `init`, `config set\|unset\|list`, `doctor`, `agent-context` |
24
- | Skills | `skills list\|get\|source\|path\|install` (ships `betterbugs-debug`) |
25
- | Lists | `list workspaces`, `list projects`, `list bugs`, `list assignable-users` |
26
- | Bug reads | `get bug\|console\|network\|steps\|env\|metadata\|events\|comments\|screenshots\|video\|replay\|attachments\|activity\|viewers\|assignees` |
27
- | Agent | `pull` |
28
- | Writes | `comment`, `update` |
29
- | CLI management | `open`, `alias install`, `upgrade`, `uninstall` |
30
-
31
- **Phase 2 (write path and CI): implemented on the CLI side.**
32
-
33
- | Area | Commands |
34
- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | --- | --- | ------------------------------------------------------------------------ |
35
- | Filing bugs | `create bug` (flags, `@payload.json` or `-`, `--from-playwright <dir>`, `--trim`, `--dedupe-key`), `attach`, `add console`, `add network`, `get feature-credits` |
36
- | Comments | `edit comment`, `delete comment`, `react`, `unreact`, `list reactions` |
37
- | Tags | `list tags`, `create tag`, `update tag`, `delete tag` |
38
- | Bug management | `move bug`, `archive bug`, `restore bug`, `delete bug`, `share bug`, `update privacy`; `update <id>` is now `update bug <id>` (the old form still works) |
39
- | Tokens | `list tokens [--all] [--service]`, `get token`, `create token [--access read | write] [--expires 30d | 4w | 6mo | 1y]`or`create token --service [--scopes]`, `delete token`, `list scopes` |
40
- | SDK API keys | `list api-keys`, `create api-key`, `regenerate api-key`, `expire api-key`, `delete api-key` |
41
- | CI | `docs/ci.md` (GitHub Actions, GitLab and CircleCI recipes), skill `betterbugs-report` |
42
-
43
- **How `create bug` works:**
44
-
45
- - It mirrors the extension:
46
- 1. `POST …/bug`
47
- 2. Upload the files to bb-api's authenticated `…/project/:projectId/bug/:id/files` route (older servers without it: `/upload/upload-bug-files/:id`)
48
- 3. A finishing `PATCH` (this is what makes bb-api count the evidence, move files and fire `bug.created`)
49
- - Console, network and steps are uploaded in the extension's evidence format (LOGS_VERSION 2), **redacted first**. Text attachments (`--attach` .har/.json/.log/.txt…) are redacted the same way unless `--no-redact`; binary files are uploaded as they are.
50
- - `--dedupe-key` becomes a project-namespaced `idempotency-key`. bb-api updates the bug it created for that key instead of filing another.
51
- - `--trim` uses a `videoTrimming` credit, the same as the extension. On the Free plan it exits 8 when none are left.
52
-
53
- **Known gaps in Phase 2:**
54
-
55
- - **`--since 12h` / `30m`:** bb-api filters whole UTC days; the CLI drops the extra rows locally (and warns).
56
- - **Creation source:** with the bb-api `betterbugs-cli` branch (B7), bugs filed with the CLI's browser login or a personal / service token get `creationSource: CLI` (filter with `list bugs --source cli`). bb-api reads it from the session or token (`UserSession.isCli`), never from a header. Older servers file them as Chrome-extension captures.
57
- - **Service-token attribution:** bb-api records the creating admin as the reporter of bugs filed with a service token; the CLI adds a "Filed by <service> (service token)" metadata line. A separate non-human reporter needs a product decision (seats, notifications).
58
- - **Privacy is per project:** bb-api only stores privacy at project level, so `update privacy` sets it for the whole project.
59
- - **Permanent delete:** OAuth and personal / service tokens can only move bugs to the trash, and `delete bug --permanent` is refused for them. A browser login is a normal BetterBugs session and follows the web app's rules.
60
- - **Annotations:** `create bug --screenshot shot.png --annotations marks.json` draws `rect`, `arrow`, `line`, `highlight`, `redact` and `text` shapes into a PNG screenshot before upload. Only the annotated image is uploaded, so a `redact` box hides what is under it. Example: `[{"type":"redact","x":0,"y":0,"w":300,"h":40},{"type":"arrow","from":[500,300],"to":[420,220]},{"type":"text","x":420,"y":180,"text":"Total missing"}]`.
61
-
62
- **Phase 3 (repro, verification, AI, links): implemented.**
63
-
64
- | Area | Commands |
65
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
66
- | Repro | `repro <id> --framework playwright | selenium [--language] [--dry-run]` |
67
- | Verification | `comment --from-test-result <file> [--message]` (Playwright/Jest JSON, JUnit XML; records a verification + comment), `comment --reply-to <commentId>` |
68
- | Links | `link bug`, `unlink bug`, `add resource`, `remove resource`, `get links` |
69
- | AI | `generate steps [--from-image | --from-video]`, `debug`, `ask`, `get chat`, `transcribe [--wait]`, `get transcription [--segments]`, `get video-analysis`, `analyze video` |
70
- | Recording | `get frames` (local ffmpeg; exit 13 if missing), `get chapters` (bb-api's chapters endpoint, X4; computed locally against older servers) |
71
- | Bulk / other | `export bugs --format json | csv`, `get backend-logs`, `list bugs --type --order-by --order` |
72
- | Distribution | `packaging/homebrew/betterbugs.rb`, skill `betterbugs-proof` |
73
-
74
- **Not done in Phase 3:**
75
-
76
- - **B13 (server-side redaction):** built as an opt-in, forward-only workspace setting (`set preferences server-redaction=on`, admins). It redacts the evidence of bugs created after it is turned on; stored evidence is never rewritten. The CLI still redacts before upload and before writing files.
77
- - **OS keychain storage:** opt in with `betterbugs config set credential-store keychain` (or `BETTERBUGS_CREDENTIAL_STORE=keychain`). Tokens go to the macOS keychain or the Secret Service (`secret-tool`); on Windows they are DPAPI-encrypted. Secrets go to those tools on stdin, never as arguments. Switching moves saved logins, and `doctor` shows the store in use. On macOS the item is created by `/usr/bin/security`, so other programs running as you can read it through that tool without a prompt: it keeps tokens out of files and backups, but it is not a boundary against your own processes.
78
- - **`get backend-logs`:** targets bb-api's backend-logs module, which only exists on the `sentry-cloudwatch-mcp` branch. On servers without it, the CLI says so.
79
-
80
- **Phase 5 (ecosystem): implemented.** PDF Phase 4 (native recording) is still skipped, as agreed.
81
-
82
- | Area | What |
83
- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
84
- | Shell completion | `completion bash | zsh | fish | powershell`: commands, flags, flag values (statuses, priorities, enums, comma lists) and paths. Each Tab runs the hidden `\_\_complete`, which needs no login or network |
85
- | Live updates | `list bugs --watch [--events created,updated,ready,commented] [--max-events n]`: server-sent events from bb-api (backend item **X5**, `GET /workspace/:id/bug-events`). Resumes with Last-Event-ID; NDJSON in JSON mode; `ready` means the evidence is uploaded and safe to pull |
86
- | Git hooks | `check commit-msg <file>` (bug references exist), `check artifacts` (no `.betterbugs/` evidence staged); setups in `docs/hooks.md` |
87
- | Cookbook | `docs/cookbook.md`: automation built on `agent-context` and `--json` (generated LLM tools, react to new bugs, routing, digests, closing the loop on merge, exports, exit codes) |
88
-
89
- **Phase 6 (account, workspaces, members, projects): implemented.**
90
-
91
- | Area | Commands |
92
- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
93
- | Your account | `get profile`, `update profile`, `change email` (codes to both inboxes; interactive), `get\|update\|reset notifications`, `get bug-count [--new]`, `list sessions`, `delete account --preview` |
94
- | Invitations | `list invitations`, `accept invitation`, `decline invitation`, `join <invite-link>`, `leave workspace`, `leave project`, `list workspaces --joinable` |
95
- | Workspaces | `get workspace`, `create workspace`, `update workspace`, `archive\|restore workspace`, `enable\|disable workspace`, `get usage`, `get ai-credits`, `get dashboard [--assigned-to-me] [--all-projects]`, `list audit-logs`, `get\|set preferences [--me]`, `transfer ownership` |
96
- | Domains, SSO | `list domains`, `add domain`, `remove domain`, `verify domain [--wait]` (has the SDK or recorder loaded there?), `update sso`, `sync scim [--auto on\|off]` |
97
- | Members | `list members [--status] [--role] [--query]`, `invite member`, `resend invite`, `update member`, `remove member [--dry-run]`, `get\|update\|reset invite-link`, `request\|approve\|reject role-upgrade`, `update guest-approval` |
98
- | Projects | `get project`, `create project`, `update project`, `enable\|disable project`, `archive\|restore project`, `delete project` (disable, archive, delete and `reset project-invite-link` need the project named as an argument or `--project`; they never fall back to the default project), `list projects --archived`, `get storage`, `mark seen`, `preview resolution-email` |
99
- | Project members | `list project-members`, `add project-member`, `invite project-member`, `update project-member`, `remove project-member`, `request access`, `list access-requests`, `approve\|reject access-request`, `get\|update\|reset project-invite-link` |
100
- | Saved filters | `list filters`, `get filter`, `create filter`, `update filter`, `delete filter`, `list bugs --filter <id\|name>`. Stored in the web app's view format, so CLI filters and web views are the same objects |
101
- | Recording links | `list recording-links [--all-projects]`, `get recording-link`, `create recording-link [--title-template] [--reference]`, `update recording-link`, `delete recording-link`, `send recording-link-guide`, `list bugs --recording-link <id>` |
102
-
103
- **Deliberately web-only:** bb-api refuses apps and access tokens for deleting an account, deleting a workspace, and deleting a project permanently. `delete account`, `delete workspace` and `delete project --permanent` exit 4 and print the web page to do it. `archive workspace`, and `delete project` (trash for 30 days), work from the CLI.
104
-
105
- **bb-api changes in Phase 6 (`betterbugs-cli` branch):**
106
-
107
- - **X4 recording-link templates:**
108
- - Recording links gain `titleTemplate` and `reference` (Prisma fields; no migration on MongoDB).
109
- - Bugs recorded through a link get the rendered title and a "Reference" metadata row.
110
- - Responses carry `shareUrl`, built from the server's `RECORDING_LINK_ENDPOINT`.
111
- - **Security fixes found while mapping the routes:**
112
- - Recording links were readable and editable by id from any workspace, including the bugs recorded through them. They are now scoped to the path workspace and the link's project.
113
- - Creating or moving a link now checks that its project is in the workspace.
114
- - A saved filter is reachable only through its own project, and a private one only by its owner.
115
- - Verified domains can only be deleted through their own workspace.
116
- - SCIM sync settings need a workspace admin, and the `workspace.sso` scope for tokens.
117
- - Account deletion refuses apps and tokens.
118
- - Service tokens can't act on their creator's account (`/auth` routes).
119
- - **Bug fixes:**
120
- - `GET ai-credits` no longer fails when there is no preference row.
121
- - A reset user preference no longer swallows later saves.
122
- - Recording-link `expiresAt` sent as JSON is now validated.
123
- - Project API-key regenerate (`apiKey.reGenerate`) and `GET user-preference` (`workspace.getUserPreference`) needed scopes no plan granted, so they always failed for tokens and billing-enabled workspaces. Both scopes are now in the plans, and a spec fails if any route needs a scope that no plan grants.
124
-
125
- **Not done in Phase 6:**
126
-
127
- - **Avatars and logos:** there is no `--avatar` or `--logo`; image upload needs an authenticated upload route (B7).
128
- - **Enable/disable for recording links:** bb-api has no route for it. Links are only disabled when their project is archived.
129
- - **`--metadata` on recording links:** bb-api's `unchangedMetadata` drives the Intercom integration, so it stays server-set. Use `--reference` instead.
130
- - **`send recording-link-guide`:** bb-api sends a fixed setup guide, not a particular link.
131
- - **Account routes ignore OAuth scopes:** bb-api's `/auth` routes (profile, email change, leave, join) accept any login, even a read-only token. Adding `user.*` scopes there needs a product decision.
132
-
133
- **Phase 7 (integrations and log sources): implemented.**
134
-
135
- All 18 tools are described as data in `src/integrations/catalog.ts`: their lookups, push target and how they connect. The commands are generated from it.
136
-
137
- | Area | Commands |
138
- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
139
- | Connections | `list integrations [--project-level]`, `connect <tool> [--wait]`, `disconnect <tool> [--all]`, `update integration-key proofhub\|bugasura`, `exclude project <p> --from <tool> [--undo]`, `list connected-projects` |
140
- | Lookups | `list <tool>-<resource> [--limit] [--after]` (paged, 100 by default), e.g. `list jira-projects`, `list jira-fields --project-key WEB --type Bug`, `list github-labels --repo acme/shop`, `list linear-statuses --team ENG`, `list slack-channels` (`betterbugs agent-context` lists them all) |
141
- | Push | `push <bug> --to jira\|linear\|github\|gitlab\|asana\|clickup\|trello\|notion\|azure\|basecamp\|zoho\|proofhub\|bugasura\|slack\|msteams` with the tool's target flags, `--assignee`, `--label`, `--priority`, `--due`, `--parent`, `--field key=value`. Not pushed twice unless `--again` |
142
- | Automations | `set automation --tool <tool> [target flags] [--project-level] [--source web-sdk=all]`, `remove automation`, `list automation-overlaps` |
143
- | Log sources | `connect cloudwatch --aws-account-id`, `test connection cloudwatch`, `get log-settings`, `update log-settings --region --log-group --time-range`, `list cloudwatch-log-groups`, `list cloudwatch-log-events`, `list sentry-projects`, `list sentry-issues` |
144
-
145
- **How connecting works:**
146
-
147
- - **OAuth tools:** the provider redirects back to the web app, so `connect` opens the approval page in the browser. With `--wait` it waits until the connection exists.
148
- - **API-key tools:** ProofHub and Bugasura read their key from stdin.
149
- - **CloudWatch:** prints the external id for the IAM role.
150
- - **Integration routes are called as bb-api version 12, as the web app does.** Below that, bb-api hides seven tools and turns project-level connects into workspace-level ones.
151
- - **Lookups and pushes go through the bug's (or current) project,** so bb-api uses your project connection and falls back to your workspace one.
152
-
153
- **bb-api changes in Phase 7:**
154
-
155
- - **Basecamp could leak tokens.** Basecamp push sent the user's Basecamp token to any URL the caller supplied. It now only posts inside the user's own Basecamp accounts.
156
- - **Scope checks restored:**
157
- - Basecamp's scope checks were commented out, so any BetterBugs token could use every Basecamp route. They are back on, and `basecamp.assignees` is in the plans.
158
- - Bugasura had no scope checks, and its exclude-project used `azure.excludeProject`. All its routes are now scoped; three read scopes were added to the plans.
159
- - ProofHub's `update-api-key` now needs `proofhub.update`.
160
- - **Credentials no longer reach apps.** The integration lists returned your stored Jira, GitHub, Slack and other tokens and API keys to any app with read access. Apps and access tokens no longer get tokens, keys or secrets back; the web app is unchanged.
161
- - **`gitlab/self-hosted` no longer echoes the OAuth client secret.**
162
- - **Removing a workspace automation** could delete a project-level one; it is now limited to the workspace-wide automation.
163
-
164
- **Known limits in Phase 7:**
165
-
166
- - **OAuth connect needs a browser.** bb-api exchanges the code at the web app's fixed redirect URI.
167
- - **GitLab self-managed** creates a row on every `self-hosted` call, and the row is unusable until the browser step completes (a bb-api behaviour, unchanged).
168
- - **Pushes are not deduplicated by bb-api.** The CLI checks the bug's existing pushes before pushing.
169
- - **Free plan push credits:** bb-api charges one credit even when a push fails.
170
- - **Small bb-api quirks the CLI works around rather than fixes:**
171
- - Asana `--section` is sent as a My Tasks section.
172
- - ClickUp ignores a parent task.
173
- - Zoho list routes return 500 when Zoho is not connected.
174
- - GitHub, GitLab, Asana and ClickUp swallow provider errors; the CLI reports "did not create the issue".
175
- - **Webhook CRUD and deliveries** are Phase 8.
176
-
177
- **Phase 8 (webhooks, OAuth apps, billing): implemented.** The roadmap is complete except PDF Phase 4 (native recording).
178
-
179
- | Area | Commands |
180
- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
181
- | Webhooks | `list webhooks`, `get webhook`, `create webhook --url [--projects] [--header Name=value\|Name=@file\|Name=@-] [--field] [--form-data]`, `update webhook [--pause\|--resume]`, `delete webhook`, `test webhook <id>\|--url` |
182
- | Signing secret | `get webhook-secret [--reveal]`, `create webhook-secret`, `rotate webhook-secret [--no-grace]`, `expire webhook-secret` |
183
- | Deliveries | `list webhook-deliveries [--webhook] [--result] [--since]`, `get webhook-delivery`, `resend webhook-delivery` |
184
- | OAuth apps | `list oauth-apps`, `get oauth-app`, `create oauth-app --name --redirect-uri [--type public] [--scopes]`, `update oauth-app [--enable\|--disable]`, `delete oauth-app`, `rotate oauth-app-secret` |
185
- | Subscription | `get subscription`, `preview plan [--seats] [--guests]`, `change plan …` (previews, then asks), `cancel subscription [--now]`, `keep subscription`, `update payment-method` (opens the web app) |
186
- | Invoices and details | `list invoices`, `get invoice <txn> [--open]`, `get\|update billing-profile [--me]`, `list\|add\|remove billing-email`, `get\|update business`, `redeem prime-club` |
187
-
188
- **Webhooks:**
189
-
190
- - bb-api has one event, `bug.created`, sent once a bug's evidence is uploaded.
191
- - Deliveries are signed with the workspace secret (`X-BetterBugs-Signature: t=…,v1=<HMAC-SHA256 of "t.body">`) and retried at 1m, 5m and 30m. See cookbook recipe 16 for verifying a signature.
192
- - Header values are never shown to the CLI.
193
-
194
- **Billing:**
195
-
196
- - `change plan` charges the saved card at once (prorated), so it previews and confirms first; scripts pass `--yes`.
197
- - Starting a paid plan and changing the card happen in the web app, because Paddle takes card details there.
198
-
199
- **bb-api changes in Phase 8:**
200
-
201
- - **Billing could act on other workspaces.**
202
- - Cancel, preview and plan change trusted a Paddle subscription id sent by the client, and invoices trusted a transaction id. An admin of one workspace could cancel or re-plan another workspace's subscription, or read its invoices. All four now only act on the workspace's own subscription and transactions.
203
- - The plan-change payload went to Paddle unchecked, so it could carry discounts or another price. It is now limited to seat items at BetterBugs' own prices.
204
- - **Billing scopes:**
205
- - No billing route checked an OAuth scope, so a read-only token of an admin could change or cancel the plan.
206
- - Apps and access tokens now need the admin-level `workspace.subscription` scope, which is now in the plans so it can be granted.
207
- - The Paddle customer token is admin-only.
208
- - New `GET subscription/prices` lists the seat prices, so clients can switch between monthly and yearly.
209
- - **Webhook headers:** custom header values (often the receiver's credentials) were returned to every member, guests included, and to apps. Members who can manage a webhook still see them in the web app; everyone else, and every app or token, gets them masked.
210
- - **Webhook scopes:** revealing the signing secret now needs `workspace.webhook.update`, and `test-connection` (an outbound signed request) needs `workspace.webhook.create`.
211
- - **OAuth apps:**
212
- - Any member could create, change, delete or rotate the workspace's OAuth apps; now only admins can.
213
- - A redirect URI could be any string. The consent page opens that URI, so a `javascript:` value would run in the web app's origin. Redirect URIs must now be https, http on localhost, or an app scheme (RFC 8252).
214
-
215
- **Known limits in Phase 8:**
216
-
217
- - **One webhook event:** bb-api sends only `bug.created`, so there is no `--events` flag.
218
- - **Webhook header secrets:** pass credentials as `--header Authorization=@file` or `=@-` (stdin) so they stay out of shell history and `ps`; an inline value for a credential-like header prints a warning.
219
- - **`test webhook <id>`** doesn't send the webhook's stored headers (they are never given to the CLI); add them with `--header`.
220
- - **Paid plans start in the web app,** as does changing the card.
221
- - **Deleting an OAuth app** doesn't revoke the tokens it already issued (a bb-api behaviour, unchanged).
222
- - **Invoice amounts** come from Paddle's payout totals as bb-api stores them.
223
-
224
- `betterbugs agent-context` prints the whole surface (flags, enums, scopes, output shapes) as JSON.
225
-
226
- ### What works against today's bb-api, and what waits on backend work
227
-
228
- | Feature | Today | Needs |
229
- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
230
- | Every read/write command | ✅ with a browser login, or a personal/service token (`BETTERBUGS_TOKEN`, or `auth login --token`) | — |
231
- | `auth login` (browser, the admin CLI's `bba login` flow) | ✅ with the bb-api `betterbugs-cli` branch (`/auth/cli/config`, `/auth/cli/authorize`, `/auth/cli/token`, `/auth/cli/refresh`; Prisma model `UserCliAuthCode`, `UserSession.isCli`) and bb-app `/cli/authorize` deployed. The session is an ordinary BetterBugs login (8 h access token, 90-day rotating refresh token), so it has no OAuth scopes and needs no paid plan | implemented |
232
- | `auth login --token` with a PAT / service token | ✅ `bb_pat_…` (read or write; `/user/personal-access-token`, Team / Enterprise) or `bb_svc_…` (workspace, chosen scopes; `/oauth/tokens`) from `betterbugs create token` or bb-app Settings → Access tokens | Implemented, settings page included |
233
- | `auth logout` server-side | ✅ ends the browser-login session with `POST /auth/logout` (`--local` skips it) | implemented |
234
- | Uploads (`create bug`, `attach`, `add …`) | ✅ through the authenticated `POST .../bug/:id/files` (scope `bug.updateAttachments`); older servers fall back to the extension's unauthenticated `/upload` route | **B7**: implemented (the extension's `/upload/*` routes still need auth on the client side) |
235
- | Console/network/steps filters | ✅ sent to the server (`GET /bug/:id/logs?section=…`); a real-regex `--grep` and older servers filter locally | **B4**: implemented |
236
- | `--limit/--after` | ✅ bb-api's own cursor on `list bugs` / `export bugs` (time sorts); offsets elsewhere | **B5**: implemented |
237
- | `get bug` signals | ✅ from `GET /bug/:id/logs?view=summary`; computed locally against older servers | **B6**: implemented |
238
- | Comment timestamps | ✅ `comment --at` sends `atMs`; comments come back with `atMs` | **B9**: implemented |
239
- | Missing scope | ✅ 403 `SCOPE_MISSING` with `requiredScope` (exit 4 naming the scope); the old 400 is still understood | **B3**: implemented |
240
- | Rate limits | ✅ 429 with `Retry-After` (reads retry once); one budget per token across routes (`RATE_LIMIT_TOKEN_PER_MINUTE`, default 600) | **B14**: implemented |
241
- | Request IDs, minimum CLI version | ✅ `X-Request-Id` echoed and logged; `X-BetterBugs-CLI-Min-Version` from `CLI_MIN_VERSION` | **B15 / B16**: implemented |
242
- | Server-side redaction | ✅ opt-in: `set preferences server-redaction=on` (admins), new bugs only | **B13**: implemented |
243
- | Playwright trace | ✅ `create bug --from-playwright … --upload-trace` stores trace.zip (raw, not redacted); `get bug` links Playwright's trace viewer | **B10**: implemented (alignment stays client-side) |
244
- | `list bugs --watch` | ✅ with the bb-api `betterbugs-cli` branch (X5: `GET /workspace/:id/bug-events`); older servers get exit 5 with a hint | **X5**: implemented |
245
- | Recording-link `--title-template`, `--reference`, share URLs | ✅ with the bb-api `betterbugs-cli` branch; older servers drop the two fields (the CLI warns) and return no `shareUrl` | **X4** (recording links): implemented |
246
- | Phase 6 scopes for personal/service tokens (workspace, member, project, filter, recording-link) | ✅ after re-running `POST /seed/oauth-cli-client/:pin` so the `betterbugs-cli` client (which personal tokens belong to) gets them; existing tokens are created again. Browser logins have no scopes | — |
247
- | Phase 7 scopes for personal/service tokens (integrations) | ✅ after re-running `GET /seed/oauth-scopes/:pin` (creates the new Bugasura, Basecamp and other scopes), then `POST /seed/oauth-cli-client/:pin` | — |
248
- | Billing from the CLI | ✅ with the bb-api `betterbugs-cli` branch (billing routes check `workspace.subscription` for tokens). For personal/service tokens, re-run `GET /seed/oauth-scopes/:pin` and `POST /seed/oauth-cli-client/:pin`. Member/guest seat changes only: switch monthly ↔ yearly in the web app (the other interval's prices are only available there) | — |
249
-
250
- ## Development
16
+ The package installs the same CLI under three names: **`betterbugs`**, **`bbug`** and **`bb`**.
17
+ Use whichever you like day to day; scripts and docs use `betterbugs`.
18
+
19
+ ## Install
20
+
21
+ **npm** (Node.js 20.18.1 or newer):
251
22
 
252
23
  ```bash
253
- yarn install
254
- yarn dev -- get bug <id> # run from source (tsx)
255
- yarn run check # typecheck + lint + tests (`yarn check` alone is Yarn's lockfile check)
256
- yarn run test # node:test suites under test/
257
- yarn run deps:audit # high/critical advisories in the bundled dependencies
258
- yarn build # bundles to dist/ (the published package has no runtime dependencies)
259
- node dist/index.js --help
24
+ npm install -g @betterbugs/cli
260
25
  ```
261
26
 
262
- Point at another environment with `BETTERBUGS_API_URL` / `BETTERBUGS_APP_URL` (https only, except localhost).
27
+ **Homebrew:**
263
28
 
264
- > `package.json` pins `rollup` to `@rollup/wasm-node` via `resolutions`. Some Windows machines block rollup's
265
- > native binary (Application Control); the WASM build behaves the same everywhere, just a little slower.
29
+ ```bash
30
+ brew install betterbugs/tap/betterbugs
31
+ ```
266
32
 
267
- ### CI and releases
33
+ **Run without installing:**
268
34
 
269
- - **CI:** `.github/workflows/ci.yml` runs typecheck, lint, tests, build and a bundle smoke test on macOS, Ubuntu and Windows × Node 20/22, plus `deps:audit`.
270
- - **Release:** this repository is private and never published directly (`"private": true`). The public package is `@betterbugs/cli` on npm (it installs the commands `betterbugs`, `bbug` and `bb`), published from the public repository `betterbugs/cli`, the same way `@betterbugs/web-sdk` is:
271
- 1. Bump `version` in `package.json` (the only place it is set) and push a `v<version>` tag here.
272
- 2. `.github/workflows/release.yml` runs `yarn run check` on all three OSes, builds, runs `scripts/prepare-public.mjs` and pushes `build-public/` to `betterbugs/cli` with the tag. `build-public/package.json` is `package.build.json` (name, MIT licence, repository, `publishConfig`) plus the version.
273
- 3. Publish a GitHub release for that tag in `betterbugs/cli`. Its `publish.yml` (source: `packaging/public-repo/`) publishes to npm with provenance (prereleases go to the `next` dist-tag), then renders the Homebrew formula from the published tarball's sha256 and attaches `betterbugs.rb` to the release. Copy it to `Formula/betterbugs.rb` in the `betterbugs/tap` repository.
274
- - **Secrets:** `PUBLIC_REPO_TOKEN` here (a fine-grained personal access token for `betterbugs/cli` only, Contents and Workflows: Read and write); `NPM_TOKEN` in `betterbugs/cli`.
35
+ ```bash
36
+ npx @betterbugs/cli --help
37
+ ```
38
+
39
+ `get frames` uses [ffmpeg](https://ffmpeg.org) if it is installed; everything else needs nothing extra.
40
+
41
+ > **`bb` already taken?** If another tool (for example Babashka) owns `bb`, npm may refuse to install over it.
42
+ > `bbug` and `betterbugs` always work, and `betterbugs alias install` adds `bb` as a shell alias instead.
43
+
44
+ ## Log in
45
+
46
+ ```bash
47
+ betterbugs auth login # opens BetterBugs in your browser; click "Activate"
48
+ betterbugs whoami
49
+ ```
275
50
 
276
- ## Layout
51
+ For CI and other non-interactive use, create a token (`betterbugs create token`, or in the web app under
52
+ Settings → Access tokens) and pass it on **stdin**. Tokens are never accepted as command-line arguments.
277
53
 
54
+ ```bash
55
+ echo "$BETTERBUGS_TOKEN" | betterbugs auth login --token
278
56
  ```
279
- src/
280
- index.ts entry
281
- cli/ run (commander wiring), runtime (context, auth, resolution), spec, registry, globals, scopes, io
282
- core/ api.ts (the ONLY file with bb-api routes), http, errors (exit codes), config, credentials, settings, media, paths, logger
283
- auth/cli-login.ts browser login like `bba login` (loopback + PKCE S256 + state → /cli/authorize), refresh, logout
284
- logs/ evidence normalisation, filters, records, signals (ported from betterbugs-mcp)
285
- artifacts/ HAR conversion, README generation for `pull`
286
- redact/ credential redaction (log-redact.ts copied from betterbugs-mcp) + configurable redactor
287
- output/ JSON envelope, human tables
288
- commands/ one module per area; each exports CommandSpec[]
289
- skills/ markdown skills shipped in the package
57
+
58
+ On a machine without a browser, `BETTERBUGS_NO_BROWSER=1 betterbugs auth login` prints the URL to open elsewhere.
59
+
60
+ Pin a workspace and project for a repository so you don't have to pass `--workspace` / `--project` every time:
61
+
62
+ ```bash
63
+ betterbugs init # writes ./.betterbugs.json
290
64
  ```
291
65
 
292
- ## Adding a command
66
+ ## What you can do
67
+
68
+ **Read bugs**
69
+
70
+ - `list bugs` with filters: `--status`, `--since`, `--assignee`, `--filter <saved filter>`, `--watch` for live updates
71
+ - `get bug <id>`, plus `get console`, `get network`, `get steps`, `get env`, `get comments`, `get screenshots`, `get video`, `get replay` and more
72
+ - `export bugs --format json` or `--format csv`
73
+
74
+ **Work on bugs**
75
+
76
+ - `comment <id> "text"`, with `--at <ms>` to point at a moment in the recording
77
+ - `update <id> --status resolved`, `--assignee`, `--priority`, tags
78
+ - `link bug`, `move bug`, `archive bug`, `share bug`
79
+ - `push <id> --to jira` (also Linear, GitHub, GitLab, Asana, ClickUp, Trello, Notion, Azure DevOps, Basecamp, Zoho,
80
+ ProofHub, Bugasura, Slack and Microsoft Teams)
81
+
82
+ **File bugs**
83
+
84
+ - `create bug --title … --attach file.har`, or from a JSON payload
85
+ - `create bug --from-playwright test-results/` files one report per failed Playwright test, with traces and screenshots
86
+ - `--dedupe-key` updates the same report on reruns instead of filing duplicates
87
+ - Console logs, network logs and text attachments are **redacted before upload**
88
+
89
+ **Debug and verify**
90
+
91
+ - `repro <id> --framework playwright` generates a reproduction test
92
+ - `comment <id> --from-test-result result.json` records that a fix was verified
93
+ - `debug <id>`, `ask <id> "…"` and `generate steps` use BetterBugs AI
293
94
 
294
- 1. Add a `CommandSpec` (`defineCommand({...})`) in `src/commands/<area>.ts` and export it in that module's list.
295
- 2. Add a typed method to `src/core/api.ts` (routes live nowhere else).
296
- 3. Return `{ data, human, pagination?, truncated?, warnings? }`; never print to stdout directly.
297
- 4. Add its bb-api scopes to `spec.scopes` and, if new, to `src/cli/scopes.ts`.
95
+ **Manage**
96
+
97
+ Workspaces, projects, members, saved filters, recording links, integrations, webhooks, OAuth apps, access tokens and
98
+ billing. Run `betterbugs --help` or `betterbugs <command> --help` for everything.
99
+
100
+ ## For coding agents
101
+
102
+ `betterbugs pull <id>` writes the report to `.betterbugs/<id>/` as plain files an agent can read: a `README.md` to start
103
+ from, the bug, environment, console log, `network.har`, steps, comments and screenshots. Credentials are redacted by
104
+ default.
105
+
106
+ Install the bundled agent skills (debug a bug, file a report, prove a fix) for Claude Code, Cursor, Codex or OpenCode:
107
+
108
+ ```bash
109
+ betterbugs skills install # Claude Code
110
+ betterbugs skills install --target cursor,codex
111
+ ```
112
+
113
+ `betterbugs agent-context --json` describes every command, flag, value and output shape as JSON.
114
+
115
+ ## Scripting and CI
116
+
117
+ - Add `--json` for stable JSON output. It is the default for read commands when stdout isn't a terminal.
118
+ - Destructive commands ask for confirmation; pass `--yes` in scripts.
119
+ - Exit codes are stable: `0` ok, `1` error, `2` usage, `3` not logged in, `4` forbidden or missing scope,
120
+ `5` not found, `6` rate limited, `7` network, `8` plan limit, `9` validation, `10` partial, `11` not ready,
121
+ `13` missing dependency, `130` cancelled.
122
+
123
+ Guides:
124
+
125
+ - [CI recipes](https://github.com/betterbugs/cli/blob/main/docs/ci.md): GitHub Actions, GitLab CI and CircleCI
126
+ - [Git hooks](https://github.com/betterbugs/cli/blob/main/docs/hooks.md): check bug references in commit messages
127
+ - [Cookbook](https://github.com/betterbugs/cli/blob/main/docs/cookbook.md): automation built on `--json`
128
+
129
+ ## Shell completion
130
+
131
+ ```bash
132
+ echo 'eval "$(betterbugs completion zsh)"' >> ~/.zshrc # after compinit
133
+ echo 'eval "$(betterbugs completion bash)"' >> ~/.bashrc
134
+ betterbugs completion fish > ~/.config/fish/conf.d/betterbugs.fish
135
+ ```
136
+
137
+ PowerShell: add `betterbugs completion powershell | Out-String | Invoke-Expression` to your `$PROFILE`.
138
+
139
+ ## Configuration
140
+
141
+ - `betterbugs config set <key> <value>` for your user config, `--local` for `./.betterbugs.json`
142
+ - `--profile <name>` switches between saved logins (several accounts)
143
+ - `betterbugs config set credential-store keychain` keeps tokens in the OS keychain instead of a file
144
+ - `betterbugs doctor` checks your setup
145
+
146
+ ## Security
147
+
148
+ - Credentials are stored with owner-only permissions, or in the OS keychain if you opt in.
149
+ - Console logs, network logs and attachments are redacted before they are uploaded, printed or written to disk.
150
+ - Browser login uses PKCE and a callback bound to `127.0.0.1` only.
151
+ - Output to a terminal is stripped of escape sequences that bug data could carry.
152
+
153
+ ## Upgrade and uninstall
154
+
155
+ ```bash
156
+ betterbugs upgrade # npm install -g @betterbugs/cli@latest
157
+ betterbugs uninstall # removes saved logins and config, then the package
158
+ ```
298
159
 
299
- ## Contracts
160
+ ## License
300
161
 
301
- - **Exit codes** (stable from v1.0.0): 0 ok, 1 error, 2 usage, 3 not logged in, 4 forbidden/missing scope, 5 not found, 6 rate limited, 7 network, 8 plan limit, 9 validation, 10 partial, 11 not ready, 13 missing dependency, 130 cancelled at a prompt (Ctrl-C / Ctrl-D). 12/14/15/16 are reserved for recording.
302
- - **JSON envelope**: `{ apiVersion: "v1", data, pagination?, truncated?, warnings[] }`; errors `{ apiVersion, error: { code, message, hint, requestId } }` on stdout.
303
- - **Security**: BetterBugs tokens are never accepted as arguments (`auth login --token` reads stdin), and webhook header secrets can come from a file or stdin (`--header Name=@file`); an inline credential-like header value prints a warning; credentials file `0600` (refused if world-readable on POSIX; on Windows mode bits don't apply, so `doctor` reads the file's ACL and flags it if Everyone/Users can read it); https enforced; redaction on by default before anything reaches stdout or disk; no auth header is sent to the media CDN. `auth login` binds its callback to 127.0.0.1 only, ignores any callback whose `state` doesn't match, shows success in the browser only after the code exchange succeeds, and sends the PKCE verifier only to the API; the server stores the one-time code and refresh token as hashes. `auth login --token` saves a token only after BetterBugs confirms it (`--no-verify` saves it unchecked when the API can't be reached). Output to a terminal is stripped of escape sequences that bug data could carry (window titles, links, clipboard writes); colours and piped/JSON output are unchanged.
162
+ MIT
package/dist/index.js CHANGED
@@ -3462,7 +3462,7 @@ function toCliError(err) {
3462
3462
  }
3463
3463
 
3464
3464
  // src/version.ts
3465
- var VERSION = true ? "0.1.0" : "0.0.0-dev";
3465
+ var VERSION = true ? "0.1.2" : "0.0.0-dev";
3466
3466
  var OUTPUT_API_VERSION = "v1";
3467
3467
 
3468
3468
  // src/output/render.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterbugs/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "BetterBugs CLI: read, file and act on BetterBugs bug reports from the terminal, CI and coding agents.",
5
5
  "license": "MIT",
6
6
  "author": "BetterBugs",