ghosttrap-cli 0.3.21__tar.gz → 0.3.23__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.21 → ghosttrap_cli-0.3.23}/PKG-INFO +5 -4
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/README.md +4 -3
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli/cli.py +26 -8
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli.egg-info/PKG-INFO +5 -4
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/pyproject.toml +1 -1
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli/__init__.py +0 -0
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli.egg-info/SOURCES.txt +0 -0
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli.egg-info/dependency_links.txt +0 -0
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli.egg-info/entry_points.txt +0 -0
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli.egg-info/requires.txt +0 -0
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/ghosttrap_cli.egg-info/top_level.txt +0 -0
- {ghosttrap_cli-0.3.21 → ghosttrap_cli-0.3.23}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ghosttrap-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.23
|
|
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
|
|
@@ -52,18 +52,19 @@ If you want to manually flag a caught exception or a non-exception condition, ca
|
|
|
52
52
|
| `ghosttrap peek --clear` | Skip outstanding errors, then wait for the next one |
|
|
53
53
|
| `ghosttrap last` | Fetch the most recent error and exit (no waiting) |
|
|
54
54
|
| `ghosttrap last --clear` | Fetch the most recent error and skip everything older |
|
|
55
|
-
| `ghosttrap watch` |
|
|
55
|
+
| `ghosttrap watch` | Deprecated — `peek` reconnects until an error arrives, which covers the streaming case |
|
|
56
56
|
| `ghosttrap list [n]` | Print a numbered summary of the most recent `n` errors (default 10, max 50). Doesn't move the cursor. |
|
|
57
57
|
| `ghosttrap show <i>` | Full details for row `i` from the last `list` (1-based). Doesn't move the cursor. |
|
|
58
58
|
| `ghosttrap clear` | Skip all outstanding errors |
|
|
59
59
|
| `ghosttrap nuke` | Permanently delete every server-side row for the current repo (errors + token). Requires typed confirmation. |
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Every command except `setup` and `nuke` accepts `--repo owner/name` to target a specific claimed repo when you're not inside its working tree (e.g. `ghosttrap peek --repo alex-rowley/ghosttrap-cli`). Otherwise the repo is detected from cwd. `nuke` is intentionally cwd-locked.
|
|
62
62
|
|
|
63
63
|
## How it works
|
|
64
64
|
|
|
65
65
|
- **Setup** authenticates with GitHub (via the active `gh` account) to prove you have access to the repo, then saves a repo token locally. If your active `gh` account can't see the repo, setup fails with a clear message; switch with `gh auth switch` and retry.
|
|
66
|
-
- **Peek**
|
|
66
|
+
- **Peek** connects to ghosttrap.io using that token — no GitHub auth needed after setup
|
|
67
|
+
- If the connection drops or the server closes an idle socket, peek reconnects with a 60-second backoff for as long as it runs — it only exits once it has delivered an error (or hit a real failure, which it reports on stderr)
|
|
67
68
|
- Errors that arrive while you're offline are replayed on next connect (cursor-based, no duplicates)
|
|
68
69
|
- Repos are tracked by GitHub's immutable repo id, so a rename or transfer doesn't require any action — the next connect picks up the new `owner/name` and your token keeps working
|
|
69
70
|
- Local state is stored in `~/.ghosttrap/config.json`, keyed by GitHub repo id
|
|
@@ -43,18 +43,19 @@ If you want to manually flag a caught exception or a non-exception condition, ca
|
|
|
43
43
|
| `ghosttrap peek --clear` | Skip outstanding errors, then wait for the next one |
|
|
44
44
|
| `ghosttrap last` | Fetch the most recent error and exit (no waiting) |
|
|
45
45
|
| `ghosttrap last --clear` | Fetch the most recent error and skip everything older |
|
|
46
|
-
| `ghosttrap watch` |
|
|
46
|
+
| `ghosttrap watch` | Deprecated — `peek` reconnects until an error arrives, which covers the streaming case |
|
|
47
47
|
| `ghosttrap list [n]` | Print a numbered summary of the most recent `n` errors (default 10, max 50). Doesn't move the cursor. |
|
|
48
48
|
| `ghosttrap show <i>` | Full details for row `i` from the last `list` (1-based). Doesn't move the cursor. |
|
|
49
49
|
| `ghosttrap clear` | Skip all outstanding errors |
|
|
50
50
|
| `ghosttrap nuke` | Permanently delete every server-side row for the current repo (errors + token). Requires typed confirmation. |
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Every command except `setup` and `nuke` accepts `--repo owner/name` to target a specific claimed repo when you're not inside its working tree (e.g. `ghosttrap peek --repo alex-rowley/ghosttrap-cli`). Otherwise the repo is detected from cwd. `nuke` is intentionally cwd-locked.
|
|
53
53
|
|
|
54
54
|
## How it works
|
|
55
55
|
|
|
56
56
|
- **Setup** authenticates with GitHub (via the active `gh` account) to prove you have access to the repo, then saves a repo token locally. If your active `gh` account can't see the repo, setup fails with a clear message; switch with `gh auth switch` and retry.
|
|
57
|
-
- **Peek**
|
|
57
|
+
- **Peek** connects to ghosttrap.io using that token — no GitHub auth needed after setup
|
|
58
|
+
- If the connection drops or the server closes an idle socket, peek reconnects with a 60-second backoff for as long as it runs — it only exits once it has delivered an error (or hit a real failure, which it reports on stderr)
|
|
58
59
|
- Errors that arrive while you're offline are replayed on next connect (cursor-based, no duplicates)
|
|
59
60
|
- Repos are tracked by GitHub's immutable repo id, so a rename or transfer doesn't require any action — the next connect picks up the new `owner/name` and your token keeps working
|
|
60
61
|
- Local state is stored in `~/.ghosttrap/config.json`, keyed by GitHub repo id
|
|
@@ -27,7 +27,7 @@ def _harden_signals():
|
|
|
27
27
|
except (OSError, ValueError):
|
|
28
28
|
pass
|
|
29
29
|
|
|
30
|
-
__version__ = "0.3.
|
|
30
|
+
__version__ = "0.3.23"
|
|
31
31
|
|
|
32
32
|
GHOSTTRAP_SERVER = "wss://ghosttrap.io/stream/"
|
|
33
33
|
CONFIG_DIR = os.path.expanduser("~/.ghosttrap")
|
|
@@ -67,8 +67,9 @@ description: Production error monitoring via ghosttrap.io. Trigger when starting
|
|
|
67
67
|
# Ghosttrap
|
|
68
68
|
|
|
69
69
|
Read `~/.ghosttrap/config.json` for state. It contains:
|
|
70
|
-
- `repos`: map keyed by GitHub repo id (stringified int) to `{"github_id": int, "owner": str, "name": str, "token": "t_xxx", "sdk_installed": bool, "sdk_version": str, "init_file": str}`.
|
|
70
|
+
- `repos`: map keyed by GitHub repo id (stringified int) to `{"github_id": int, "owner": str, "name": str, "token": "t_xxx", "sdk_installed": bool, "sdk_version": str, "init_file": str}`. Entries may also carry `recent`, the error ids cached by the last `ghosttrap list` (managed by the CLI — leave it alone).
|
|
71
71
|
- `cursor`: last seen error ID
|
|
72
|
+
- `skill_baseline`: the previous release's skill text, used to 3-way-merge skill updates with local edits. Never edit or delete it.
|
|
72
73
|
|
|
73
74
|
## On session start
|
|
74
75
|
|
|
@@ -89,17 +90,19 @@ For caught exceptions or non-exception conditions the user explicitly wants repo
|
|
|
89
90
|
|
|
90
91
|
## Other commands
|
|
91
92
|
|
|
92
|
-
- `ghosttrap last` — fetch the single most recent error and exit immediately, no waiting. Useful when the user wants to look at the latest error without
|
|
93
|
+
- `ghosttrap last` — fetch the single most recent error and exit immediately, no waiting. Useful when the user wants to look at the latest error without blocking on a peek. Add `--clear` to also skip everything older in one shot.
|
|
93
94
|
- `ghosttrap list [n]` — print a numbered summary of the most recent `n` errors (default 10, max 50). Does not move the cursor. Caches the ordered ids in config so a follow-up `ghosttrap show <i>` returns full details for that row.
|
|
94
95
|
- `ghosttrap show <i>` — full details for the i-th row from the most recent `ghosttrap list`. Does not move the cursor.
|
|
95
96
|
- `ghosttrap clear` — manually skip outstanding errors without waiting. Useful if the user explicitly wants to drop the queue.
|
|
96
97
|
- `ghosttrap nuke` — permanently delete every server-side row for the current repo (errors + the Repo row + its token). Requires the user to type the repo name `owner/name` to confirm. Only run if the user explicitly asks to wipe server data — never proactively. After it succeeds the token is dead; the user would need to `ghosttrap setup` again to use this repo.
|
|
97
98
|
|
|
99
|
+
`peek` and every command above except `nuke` accept `--repo owner/name` to target another claimed repo when the cwd isn't inside it (e.g. `ghosttrap list --repo owner/name`).
|
|
100
|
+
|
|
98
101
|
## Rules
|
|
99
102
|
|
|
100
103
|
- Always `run_in_background: true` for peek — it blocks.
|
|
101
104
|
- Don't run multiple peeks at once.
|
|
102
|
-
-
|
|
105
|
+
- Peek reconnects by itself (60s backoff) when the connection drops — a quiet peek is waiting, not hung. It only exits after printing an error event, or with a message on stderr if something is actually wrong; restart it only in that second case.
|
|
103
106
|
- After installing/updating the SDK, write the state back to config.json.
|
|
104
107
|
"""
|
|
105
108
|
|
|
@@ -234,12 +237,22 @@ def _get_repo_entry(config, requested=None):
|
|
|
234
237
|
for k, entry in repos.items():
|
|
235
238
|
if f"{entry.get('owner')}/{entry.get('name')}" == cwd_repo:
|
|
236
239
|
return k, entry
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
if cwd_repo:
|
|
241
|
+
print(f"error: {cwd_repo} is not in your config. run 'ghosttrap setup' to claim it, or pass --repo owner/name.", file=sys.stderr)
|
|
242
|
+
else:
|
|
243
|
+
print("error: not inside a git repo with a github remote, and no --repo given.", file=sys.stderr)
|
|
244
|
+
available = sorted(
|
|
245
|
+
f"{e.get('owner')}/{e.get('name')}"
|
|
246
|
+
for e in repos.values()
|
|
247
|
+
if e.get('owner') and e.get('name')
|
|
248
|
+
)
|
|
249
|
+
if available:
|
|
250
|
+
print(f"available: {', '.join(available)}", file=sys.stderr)
|
|
251
|
+
sys.exit(1)
|
|
239
252
|
|
|
240
253
|
|
|
241
254
|
def _get_repo_token(config, requested=None):
|
|
242
|
-
"""Get the repo token. If `requested` is 'owner/name', match strictly. Else cwd, else
|
|
255
|
+
"""Get the repo token. If `requested` is 'owner/name', match strictly. Else cwd, else error out."""
|
|
243
256
|
_, entry = _get_repo_entry(config, requested)
|
|
244
257
|
return entry["token"]
|
|
245
258
|
|
|
@@ -730,7 +743,7 @@ def main():
|
|
|
730
743
|
clear_parser = sub.add_parser("clear", help="Skip all outstanding errors")
|
|
731
744
|
clear_parser.add_argument("--repo", help="Target repo as owner/name (overrides cwd detection)")
|
|
732
745
|
|
|
733
|
-
watch_parser = sub.add_parser("watch", help="
|
|
746
|
+
watch_parser = sub.add_parser("watch", help="Deprecated: stream errors in real time (use peek)")
|
|
734
747
|
watch_parser.add_argument("--server", default=GHOSTTRAP_SERVER, help="WebSocket server URL")
|
|
735
748
|
watch_parser.add_argument("--repo", help="Target repo as owner/name (overrides cwd detection)")
|
|
736
749
|
|
|
@@ -761,6 +774,11 @@ def main():
|
|
|
761
774
|
elif args.command == "clear":
|
|
762
775
|
clear(requested=args.repo)
|
|
763
776
|
elif args.command == "watch":
|
|
777
|
+
print(
|
|
778
|
+
"warning: 'watch' is deprecated and may be removed in a future release — "
|
|
779
|
+
"'peek' now reconnects until an error arrives.",
|
|
780
|
+
file=sys.stderr,
|
|
781
|
+
)
|
|
764
782
|
_require_setup()
|
|
765
783
|
_refresh_skill_if_stale()
|
|
766
784
|
config = _load_config()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ghosttrap-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.23
|
|
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
|
|
@@ -52,18 +52,19 @@ If you want to manually flag a caught exception or a non-exception condition, ca
|
|
|
52
52
|
| `ghosttrap peek --clear` | Skip outstanding errors, then wait for the next one |
|
|
53
53
|
| `ghosttrap last` | Fetch the most recent error and exit (no waiting) |
|
|
54
54
|
| `ghosttrap last --clear` | Fetch the most recent error and skip everything older |
|
|
55
|
-
| `ghosttrap watch` |
|
|
55
|
+
| `ghosttrap watch` | Deprecated — `peek` reconnects until an error arrives, which covers the streaming case |
|
|
56
56
|
| `ghosttrap list [n]` | Print a numbered summary of the most recent `n` errors (default 10, max 50). Doesn't move the cursor. |
|
|
57
57
|
| `ghosttrap show <i>` | Full details for row `i` from the last `list` (1-based). Doesn't move the cursor. |
|
|
58
58
|
| `ghosttrap clear` | Skip all outstanding errors |
|
|
59
59
|
| `ghosttrap nuke` | Permanently delete every server-side row for the current repo (errors + token). Requires typed confirmation. |
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Every command except `setup` and `nuke` accepts `--repo owner/name` to target a specific claimed repo when you're not inside its working tree (e.g. `ghosttrap peek --repo alex-rowley/ghosttrap-cli`). Otherwise the repo is detected from cwd. `nuke` is intentionally cwd-locked.
|
|
62
62
|
|
|
63
63
|
## How it works
|
|
64
64
|
|
|
65
65
|
- **Setup** authenticates with GitHub (via the active `gh` account) to prove you have access to the repo, then saves a repo token locally. If your active `gh` account can't see the repo, setup fails with a clear message; switch with `gh auth switch` and retry.
|
|
66
|
-
- **Peek**
|
|
66
|
+
- **Peek** connects to ghosttrap.io using that token — no GitHub auth needed after setup
|
|
67
|
+
- If the connection drops or the server closes an idle socket, peek reconnects with a 60-second backoff for as long as it runs — it only exits once it has delivered an error (or hit a real failure, which it reports on stderr)
|
|
67
68
|
- Errors that arrive while you're offline are replayed on next connect (cursor-based, no duplicates)
|
|
68
69
|
- Repos are tracked by GitHub's immutable repo id, so a rename or transfer doesn't require any action — the next connect picks up the new `owner/name` and your token keeps working
|
|
69
70
|
- Local state is stored in `~/.ghosttrap/config.json`, keyed by GitHub repo id
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|