ghosttrap-cli 0.3.23__tar.gz → 0.3.25__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.23
3
+ Version: 0.3.25
4
4
  Summary: Watch for errors streaming from ghosttrap.io
5
5
  Project-URL: Homepage, https://github.com/alex-rowley/ghosttrap-cli
6
6
  Requires-Python: >=3.10
@@ -27,7 +27,7 @@ def _harden_signals():
27
27
  except (OSError, ValueError):
28
28
  pass
29
29
 
30
- __version__ = "0.3.23"
30
+ __version__ = "0.3.25"
31
31
 
32
32
  GHOSTTRAP_SERVER = "wss://ghosttrap.io/stream/"
33
33
  CONFIG_DIR = os.path.expanduser("~/.ghosttrap")
@@ -75,13 +75,17 @@ Read `~/.ghosttrap/config.json` for state. It contains:
75
75
 
76
76
  1. Detect the current repo from `git config --get remote.origin.url` (returns `owner/name`).
77
77
  2. Find a matching entry in config by looking for one whose `owner`/`name` equals the detected slug. If no match, tell the user to run `ghosttrap setup`. (The owner/name on a config entry auto-refreshes from the server when the repo is renamed or transferred, so always match against the entry's stored owner/name, not the config key.)
78
- 3. If `sdk_installed` is false or missing: install the SDK (`pip install ghosttrap-sdk`), wire `ghosttrap.init("<token>")` into the app startup. For Django projects, also add `"ghosttrap.django.GhostTrapApp"` to INSTALLED_APPS (re-attaches logging handler after Django's dictConfig) and `"ghosttrap.django.GhostTrapMiddleware"` to MIDDLEWARE (catches unhandled view exceptions). The SDK auto-hooks into Celery task_failure if Celery is installed, and attaches a logging handler for logger.exception() calls. Use whatever pattern the project already uses for configuration (env vars, settings files, hardcoded — match the existing style). Then update the config: set `sdk_installed: true`, `sdk_version`, `init_file` to record what you did. Only pass `send_user=True` to `init()` if the user explicitly asks for user context in reports — it's PII and stays off by default.
78
+ 3. If `sdk_installed` is false or missing: install the SDK (`pip install ghosttrap-sdk`), wire `ghosttrap.init("<token>")` into the app startup. For Django projects, also add `"ghosttrap.django.GhostTrapApp"` to INSTALLED_APPS (re-attaches logging handler after Django's dictConfig) and `"ghosttrap.django.GhostTrapMiddleware"` to MIDDLEWARE (catches unhandled view exceptions). The SDK auto-hooks into Celery task_failure if Celery is installed, catches unhandled exceptions in background threads (threading.excepthook), and attaches a logging handler for logger.exception() calls. Bare `logger.error(...)` calls with no exception are NOT reported unless the user explicitly asks — then pass `trap_logs=True` to `init()` (sdk >= 0.4.7); warn them that chatty codebases will flood. Use whatever pattern the project already uses for configuration (env vars, settings files, hardcoded — match the existing style). Then update the config: set `sdk_installed: true`, `sdk_version`, `init_file` to record what you did. Only pass `send_user=True` to `init()` if the user explicitly asks for user context in reports — it's PII and stays off by default.
79
79
  4. Run `ghosttrap peek --clear` with `run_in_background: true`. The `--clear` flag skips any stale backlog from prior sessions so you only get fresh errors.
80
80
 
81
81
  ## Manual capture
82
82
 
83
83
  For caught exceptions or non-exception conditions the user explicitly wants reported, use `ghosttrap.trap(exc_or_message)` from app code — pass an exception instance or a string. Synthetic string events arrive as type `TrappedEvent` with the caller's stack. Only wire this in when the user asks for it; don't add `trap()` calls speculatively.
84
84
 
85
+ ## Browser errors
86
+
87
+ If the user wants browser-side JavaScript errors captured (often described as "console errors that never reach ghosttrap"), the SDK's Django integration ships a same-origin relay (ghosttrap-sdk >= 0.4.6). Wire it in only when asked: add `path("ghosttrap/", include("ghosttrap.django.urls"))` to the root URLconf and `<script src="{% static 'ghosttrap/ghosttrap.js' %}" defer></script>` to the base template. Browser events then arrive like any other error — JS error type, page URL in the traceback header, JS stack as frames (minified if the app's bundles are; there is no source-map support).
88
+
85
89
  ## When peek returns
86
90
 
87
91
  1. **Immediately restart peek** in the background before doing anything else — this ensures you're listening for the next error while you work on the current one. Use plain `ghosttrap peek` here (no `--clear`) — you only want to skip backlog at session start.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.23
3
+ Version: 0.3.25
4
4
  Summary: Watch for errors streaming from ghosttrap.io
5
5
  Project-URL: Homepage, https://github.com/alex-rowley/ghosttrap-cli
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ghosttrap-cli"
7
- version = "0.3.23"
7
+ version = "0.3.25"
8
8
  description = "Watch for errors streaming from ghosttrap.io"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes