ghosttrap-cli 0.3.22__tar.gz → 0.3.24__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.22
3
+ Version: 0.3.24
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.22"
30
+ __version__ = "0.3.24"
31
31
 
32
32
  GHOSTTRAP_SERVER = "wss://ghosttrap.io/stream/"
33
33
  CONFIG_DIR = os.path.expanduser("~/.ghosttrap")
@@ -82,6 +82,10 @@ Read `~/.ghosttrap/config.json` for state. It contains:
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.
@@ -237,12 +241,22 @@ def _get_repo_entry(config, requested=None):
237
241
  for k, entry in repos.items():
238
242
  if f"{entry.get('owner')}/{entry.get('name')}" == cwd_repo:
239
243
  return k, entry
240
- k = next(iter(repos))
241
- return k, repos[k]
244
+ if cwd_repo:
245
+ print(f"error: {cwd_repo} is not in your config. run 'ghosttrap setup' to claim it, or pass --repo owner/name.", file=sys.stderr)
246
+ else:
247
+ print("error: not inside a git repo with a github remote, and no --repo given.", file=sys.stderr)
248
+ available = sorted(
249
+ f"{e.get('owner')}/{e.get('name')}"
250
+ for e in repos.values()
251
+ if e.get('owner') and e.get('name')
252
+ )
253
+ if available:
254
+ print(f"available: {', '.join(available)}", file=sys.stderr)
255
+ sys.exit(1)
242
256
 
243
257
 
244
258
  def _get_repo_token(config, requested=None):
245
- """Get the repo token. If `requested` is 'owner/name', match strictly. Else cwd, else first."""
259
+ """Get the repo token. If `requested` is 'owner/name', match strictly. Else cwd, else error out."""
246
260
  _, entry = _get_repo_entry(config, requested)
247
261
  return entry["token"]
248
262
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.22
3
+ Version: 0.3.24
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.22"
7
+ version = "0.3.24"
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