glitchgrab 1.19.2 → 1.21.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Turn messy bugs into structured GitHub issues with AI. Drop-in SDK for Next.js apps.
4
4
 
5
- ## Install
5
+ ## How do I install Glitchgrab?
6
6
 
7
7
  ```bash
8
8
  npm install glitchgrab
@@ -10,7 +10,7 @@ npm install glitchgrab
10
10
  bun add glitchgrab
11
11
  ```
12
12
 
13
- ## Quick Start
13
+ ## How do I get started?
14
14
 
15
15
  Wrap your app with `GlitchgrabProvider`:
16
16
 
@@ -27,7 +27,7 @@ export default function RootLayout({ children }) {
27
27
  }
28
28
  ```
29
29
 
30
- ## Session (User Tracking)
30
+ ## How does user session tracking work?
31
31
 
32
32
  Pass a `session` prop so bug reports include the reporter's identity. This lets you trace which user reported each bug.
33
33
 
@@ -73,7 +73,7 @@ interface GlitchgrabSession {
73
73
 
74
74
  The `userId` is stored with every report. Use it to look up which user reported a bug in your own database.
75
75
 
76
- ## Report Button
76
+ ## How do I add a report button?
77
77
 
78
78
  ### Default floating button
79
79
 
@@ -102,7 +102,7 @@ import { ReportButton } from "glitchgrab";
102
102
 
103
103
  The modal handles screenshot capture, preview, upload, retake, and submission. Your custom button just triggers it.
104
104
 
105
- ## Programmatic Reporting
105
+ ## How do I report bugs programmatically?
106
106
 
107
107
  Use the `useGlitchgrab` hook to report bugs from code:
108
108
 
@@ -146,7 +146,7 @@ function FeedbackWidget() {
146
146
 
147
147
  Note: `openReportDialog()` requires a `<ReportButton>` to be mounted somewhere in the component tree. It triggers the same modal with screenshot capture.
148
148
 
149
- ## Keyboard Shortcuts
149
+ ## What keyboard shortcuts are available?
150
150
 
151
151
  Once `GlitchgrabProvider` is mounted, these shortcuts work globally:
152
152
 
@@ -158,7 +158,7 @@ Once `GlitchgrabProvider` is mounted, these shortcuts work globally:
158
158
 
159
159
  No configuration needed — shortcuts are active as long as the provider is in the tree.
160
160
 
161
- ## Fetching Reports by User
161
+ ## How do I fetch reports by user?
162
162
 
163
163
  ### React hook (recommended)
164
164
 
@@ -255,7 +255,7 @@ curl -H "Authorization: Bearer gg_your_token" \
255
255
 
256
256
  | Field | Description |
257
257
  |-------|-------------|
258
- | `id` | Report ID — use this for [managing issues](#managing-issues-approve--reject--close) |
258
+ | `id` | Report ID — use this for [managing issues](#how-do-i-approve-reject-or-close-issues) |
259
259
  | `source` | `SDK_AUTO` (crash) or `SDK_USER_REPORT` (user clicked report) |
260
260
  | `status` | `PENDING`, `PROCESSING`, `CREATED`, `FAILED` |
261
261
  | `reporterPrimaryKey` | The `userId` you passed in the session prop |
@@ -265,7 +265,7 @@ curl -H "Authorization: Bearer gg_your_token" \
265
265
  | `issue.severity` | AI-assigned severity |
266
266
  ```
267
267
 
268
- ## Managing Issues (Approve / Reject / Close)
268
+ ## How do I approve, reject, or close issues?
269
269
 
270
270
  ### React hook
271
271
 
@@ -365,7 +365,7 @@ curl -X POST \
365
365
 
366
366
  ### How to get the report ID
367
367
 
368
- Use the [Fetching Reports API](#fetching-reports-by-user) to list reports. Each report has an `id` field — use that as `REPORT_ID`.
368
+ Use the [Fetching Reports API](#how-do-i-fetch-reports-by-user) to list reports. Each report has an `id` field — use that as `REPORT_ID`.
369
369
 
370
370
  ### How it works
371
371
 
@@ -374,7 +374,7 @@ Use the [Fetching Reports API](#fetching-reports-by-user) to list reports. Each
374
374
  3. Approve/reject/close via API or dashboard buttons
375
375
  4. Labels and state sync directly to GitHub — GitHub is the source of truth
376
376
 
377
- ## Conversation Thread (Comments)
377
+ ## How do I add comments to a report?
378
378
 
379
379
  Each report has a conversation thread powered by GitHub issue comments. No extra database — comments live on GitHub.
380
380
 
@@ -430,7 +430,7 @@ The comment is posted to the GitHub issue with attribution: "Commented by: **Viv
430
430
 
431
431
  Click any report on the Reports page to see the full conversation thread. Reply directly from the dashboard — comments sync to GitHub.
432
432
 
433
- ## Error Boundary
433
+ ## How do I add an error boundary?
434
434
 
435
435
  Wrap components to auto-capture React errors:
436
436
 
@@ -442,7 +442,7 @@ import { GlitchgrabErrorBoundary } from "glitchgrab";
442
442
  </GlitchgrabErrorBoundary>
443
443
  ```
444
444
 
445
- ## Configuration
445
+ ## What configuration options are available?
446
446
 
447
447
  | Prop | Type | Default | Description |
448
448
  |------|------|---------|-------------|
@@ -455,7 +455,7 @@ import { GlitchgrabErrorBoundary } from "glitchgrab";
455
455
  | `onReportSent` | `(result: ReportResult) => void` | - | Called after a report is sent |
456
456
  | `fallback` | `ReactNode` | - | Error boundary fallback UI |
457
457
 
458
- ## Auto-Capture
458
+ ## How does auto-capture work?
459
459
 
460
460
  In production (`NODE_ENV=production`), the SDK automatically captures:
461
461
  - Unhandled JavaScript errors
@@ -466,7 +466,7 @@ In production (`NODE_ENV=production`), the SDK automatically captures:
466
466
 
467
467
  Auto-capture is **disabled in development** to avoid noisy issues.
468
468
 
469
- ## What gets included in each report
469
+ ## What data is included in each report?
470
470
 
471
471
  - Description from the user
472
472
  - Screenshot (auto-captured or uploaded)
package/dist/index.d.mts CHANGED
@@ -109,6 +109,12 @@ interface UseGlitchgrabReturn {
109
109
  description?: string;
110
110
  type?: ReportType;
111
111
  }) => void;
112
+ /**
113
+ * Optional: polish user-written description text via the Glitchgrab AI enhance endpoint.
114
+ * Fixes grammar / clarity only — never invents details or changes meaning.
115
+ * Returns the polished text, or the original text on any failure (never throws).
116
+ */
117
+ enhanceText: (text: string) => Promise<string>;
112
118
  /** The token being used */
113
119
  token: string;
114
120
  /** The base URL of the Glitchgrab API */
@@ -288,6 +294,12 @@ declare function captureContext(visitedPages: string[]): CapturedContext;
288
294
  * Never throws — returns null on failure.
289
295
  */
290
296
  declare function sendReport(payload: ReportPayload, baseUrl?: string): Promise<ReportResult | null>;
297
+ /**
298
+ * Polish raw description text via the Glitchgrab AI enhance endpoint.
299
+ * Returns the polished text on success, or the original text on any failure.
300
+ * Never throws.
301
+ */
302
+ declare function enhanceText(text: string, token: string, baseUrl?: string): Promise<string>;
291
303
 
292
304
  declare function computeSignature(params: {
293
305
  errorMessage: string | undefined;
@@ -297,4 +309,4 @@ declare function computeSignature(params: {
297
309
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
298
310
  declare function clearDedupCache(): void;
299
311
 
300
- export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
312
+ export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
package/dist/index.d.ts CHANGED
@@ -109,6 +109,12 @@ interface UseGlitchgrabReturn {
109
109
  description?: string;
110
110
  type?: ReportType;
111
111
  }) => void;
112
+ /**
113
+ * Optional: polish user-written description text via the Glitchgrab AI enhance endpoint.
114
+ * Fixes grammar / clarity only — never invents details or changes meaning.
115
+ * Returns the polished text, or the original text on any failure (never throws).
116
+ */
117
+ enhanceText: (text: string) => Promise<string>;
112
118
  /** The token being used */
113
119
  token: string;
114
120
  /** The base URL of the Glitchgrab API */
@@ -288,6 +294,12 @@ declare function captureContext(visitedPages: string[]): CapturedContext;
288
294
  * Never throws — returns null on failure.
289
295
  */
290
296
  declare function sendReport(payload: ReportPayload, baseUrl?: string): Promise<ReportResult | null>;
297
+ /**
298
+ * Polish raw description text via the Glitchgrab AI enhance endpoint.
299
+ * Returns the polished text on success, or the original text on any failure.
300
+ * Never throws.
301
+ */
302
+ declare function enhanceText(text: string, token: string, baseUrl?: string): Promise<string>;
291
303
 
292
304
  declare function computeSignature(params: {
293
305
  errorMessage: string | undefined;
@@ -297,4 +309,4 @@ declare function computeSignature(params: {
297
309
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
298
310
  declare function clearDedupCache(): void;
299
311
 
300
- export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
312
+ export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };