ghosttrap-cli 0.3.5__tar.gz → 0.3.7__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.5
3
+ Version: 0.3.7
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
@@ -47,7 +47,9 @@ Your app needs [ghosttrap-sdk](https://github.com/alex-rowley/ghosttrap-sdk) to
47
47
  |---------|-------------|
48
48
  | `ghosttrap setup` | Claim a repo, install the Claude Code skill |
49
49
  | `ghosttrap peek` | Wait for the next error, print it, exit |
50
+ | `ghosttrap peek --clear` | Skip outstanding errors, then wait for the next one |
50
51
  | `ghosttrap watch` | Stream all errors continuously |
52
+ | `ghosttrap clear` | Skip all outstanding errors |
51
53
 
52
54
  ## How it works
53
55
 
@@ -38,7 +38,9 @@ Your app needs [ghosttrap-sdk](https://github.com/alex-rowley/ghosttrap-sdk) to
38
38
  |---------|-------------|
39
39
  | `ghosttrap setup` | Claim a repo, install the Claude Code skill |
40
40
  | `ghosttrap peek` | Wait for the next error, print it, exit |
41
+ | `ghosttrap peek --clear` | Skip outstanding errors, then wait for the next one |
41
42
  | `ghosttrap watch` | Stream all errors continuously |
43
+ | `ghosttrap clear` | Skip all outstanding errors |
42
44
 
43
45
  ## How it works
44
46
 
@@ -314,20 +314,30 @@ async def peek(server_url, token):
314
314
  await asyncio.sleep(60)
315
315
 
316
316
 
317
+ def _advance_cursor(config, token):
318
+ since = config.get("cursor", 0)
319
+ server = GHOSTTRAP_SERVER.replace("wss://", "https://").replace("/stream/", "")
320
+ url = f"{server}/latest/{token}/?since={since}"
321
+ req = urllib.request.Request(url, headers={"User-Agent": "ghosttrap-cli"})
322
+ with urllib.request.urlopen(req, timeout=10) as resp:
323
+ data = json.loads(resp.read())
324
+ latest_id = data.get("latest_id", 0)
325
+ pending = data.get("pending", 0)
326
+ config["cursor"] = latest_id
327
+ _save_config(config)
328
+ return pending
329
+
330
+
317
331
  def clear():
318
332
  _require_setup()
319
333
  config = _load_config()
320
334
  token = _get_repo_token(config)
321
- server = GHOSTTRAP_SERVER.replace("wss://", "https://").replace("/stream/", "")
322
- url = f"{server}/latest/{token}/"
323
335
  try:
324
- req = urllib.request.Request(url, headers={"User-Agent": "ghosttrap-cli"})
325
- with urllib.request.urlopen(req, timeout=10) as resp:
326
- data = json.loads(resp.read())
327
- latest_id = data.get("latest_id", 0)
328
- config["cursor"] = latest_id
329
- _save_config(config)
330
- print(f"cleared — cursor set to {latest_id}", file=sys.stderr)
336
+ pending = _advance_cursor(config, token)
337
+ if pending:
338
+ print(f"cleared {pending} error(s)", file=sys.stderr)
339
+ else:
340
+ print(f"nothing to clear", file=sys.stderr)
331
341
  except Exception as e:
332
342
  print(f"error: {e}", file=sys.stderr)
333
343
  sys.exit(1)
@@ -345,6 +355,7 @@ def main():
345
355
 
346
356
  peek_parser = sub.add_parser("peek", help="Wait for the next error then exit")
347
357
  peek_parser.add_argument("--server", default=GHOSTTRAP_SERVER, help="WebSocket server URL")
358
+ peek_parser.add_argument("--clear", action="store_true", help="Skip outstanding errors before waiting")
348
359
 
349
360
  args = parser.parse_args()
350
361
 
@@ -362,6 +373,12 @@ def main():
362
373
  _require_setup()
363
374
  config = _load_config()
364
375
  token = _get_repo_token(config)
376
+ if args.clear:
377
+ try:
378
+ _advance_cursor(config, token)
379
+ except Exception as e:
380
+ print(f"error: {e}", file=sys.stderr)
381
+ sys.exit(1)
365
382
  asyncio.run(peek(args.server, token))
366
383
  else:
367
384
  parser.print_help()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.5
3
+ Version: 0.3.7
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
@@ -47,7 +47,9 @@ Your app needs [ghosttrap-sdk](https://github.com/alex-rowley/ghosttrap-sdk) to
47
47
  |---------|-------------|
48
48
  | `ghosttrap setup` | Claim a repo, install the Claude Code skill |
49
49
  | `ghosttrap peek` | Wait for the next error, print it, exit |
50
+ | `ghosttrap peek --clear` | Skip outstanding errors, then wait for the next one |
50
51
  | `ghosttrap watch` | Stream all errors continuously |
52
+ | `ghosttrap clear` | Skip all outstanding errors |
51
53
 
52
54
  ## How it works
53
55
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ghosttrap-cli"
7
- version = "0.3.5"
7
+ version = "0.3.7"
8
8
  description = "Watch for errors streaming from ghosttrap.io"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes