ghosttrap-cli 0.3.7__tar.gz → 0.3.8__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.
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/PKG-INFO +1 -1
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli/cli.py +17 -2
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli.egg-info/PKG-INFO +1 -1
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/pyproject.toml +1 -1
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/README.md +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli/__init__.py +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli.egg-info/SOURCES.txt +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli.egg-info/dependency_links.txt +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli.egg-info/entry_points.txt +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli.egg-info/requires.txt +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/ghosttrap_cli.egg-info/top_level.txt +0 -0
- {ghosttrap_cli-0.3.7 → ghosttrap_cli-0.3.8}/setup.cfg +0 -0
|
@@ -59,14 +59,18 @@ Read `~/.ghosttrap/config.json` for state. It contains:
|
|
|
59
59
|
1. Detect the current repo from `git config --get remote.origin.url`.
|
|
60
60
|
2. Look it up in the config. If the repo isn't there, tell the user to run `ghosttrap setup`.
|
|
61
61
|
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.
|
|
62
|
-
4. Run `ghosttrap peek` with `run_in_background: true`.
|
|
62
|
+
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.
|
|
63
63
|
|
|
64
64
|
## When peek returns
|
|
65
65
|
|
|
66
|
-
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.
|
|
66
|
+
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.
|
|
67
67
|
2. Read the JSON output: `error.repo`, `error.type`, `error.message`, `error.traceback` (list of strings), `error.frames` (list of `{file, line, function, code}`).
|
|
68
68
|
3. Open the file from the last frame, diagnose, fix.
|
|
69
69
|
|
|
70
|
+
## Other commands
|
|
71
|
+
|
|
72
|
+
- `ghosttrap clear` — manually skip outstanding errors without waiting. Useful if the user explicitly wants to drop the queue.
|
|
73
|
+
|
|
70
74
|
## Rules
|
|
71
75
|
|
|
72
76
|
- Always `run_in_background: true` for peek — it blocks.
|
|
@@ -251,6 +255,15 @@ def _write_skill():
|
|
|
251
255
|
f.write(SKILL_CONTENT)
|
|
252
256
|
|
|
253
257
|
|
|
258
|
+
def _refresh_skill_if_stale():
|
|
259
|
+
if not os.path.exists(SKILL_FILE):
|
|
260
|
+
return
|
|
261
|
+
with open(SKILL_FILE) as f:
|
|
262
|
+
if f.read() != SKILL_CONTENT:
|
|
263
|
+
_write_skill()
|
|
264
|
+
print("ghosttrap skill file updated", file=sys.stderr)
|
|
265
|
+
|
|
266
|
+
|
|
254
267
|
async def setup(server_url, token):
|
|
255
268
|
config = _load_config()
|
|
256
269
|
|
|
@@ -366,11 +379,13 @@ def main():
|
|
|
366
379
|
clear()
|
|
367
380
|
elif args.command == "watch":
|
|
368
381
|
_require_setup()
|
|
382
|
+
_refresh_skill_if_stale()
|
|
369
383
|
config = _load_config()
|
|
370
384
|
token = _get_repo_token(config)
|
|
371
385
|
asyncio.run(watch(args.server, token))
|
|
372
386
|
elif args.command == "peek":
|
|
373
387
|
_require_setup()
|
|
388
|
+
_refresh_skill_if_stale()
|
|
374
389
|
config = _load_config()
|
|
375
390
|
token = _get_repo_token(config)
|
|
376
391
|
if args.clear:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|