ghosttrap-cli 0.3.6__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.6
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,25 +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
- since = config.get("cursor", 0)
322
- server = GHOSTTRAP_SERVER.replace("wss://", "https://").replace("/stream/", "")
323
- url = f"{server}/latest/{token}/?since={since}"
324
335
  try:
325
- req = urllib.request.Request(url, headers={"User-Agent": "ghosttrap-cli"})
326
- with urllib.request.urlopen(req, timeout=10) as resp:
327
- data = json.loads(resp.read())
328
- latest_id = data.get("latest_id", 0)
329
- pending = data.get("pending", 0)
330
- config["cursor"] = latest_id
331
- _save_config(config)
332
- if pending:
333
- print(f"cleared {pending} error(s)", file=sys.stderr)
334
- else:
335
- print(f"nothing to clear", 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)
336
341
  except Exception as e:
337
342
  print(f"error: {e}", file=sys.stderr)
338
343
  sys.exit(1)
@@ -350,6 +355,7 @@ def main():
350
355
 
351
356
  peek_parser = sub.add_parser("peek", help="Wait for the next error then exit")
352
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")
353
359
 
354
360
  args = parser.parse_args()
355
361
 
@@ -367,6 +373,12 @@ def main():
367
373
  _require_setup()
368
374
  config = _load_config()
369
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)
370
382
  asyncio.run(peek(args.server, token))
371
383
  else:
372
384
  parser.print_help()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.6
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.6"
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