ghosttrap-cli 0.3.4__tar.gz → 0.3.5__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.4
3
+ Version: 0.3.5
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
@@ -314,11 +314,31 @@ async def peek(server_url, token):
314
314
  await asyncio.sleep(60)
315
315
 
316
316
 
317
+ def clear():
318
+ _require_setup()
319
+ config = _load_config()
320
+ token = _get_repo_token(config)
321
+ server = GHOSTTRAP_SERVER.replace("wss://", "https://").replace("/stream/", "")
322
+ url = f"{server}/latest/{token}/"
323
+ 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)
331
+ except Exception as e:
332
+ print(f"error: {e}", file=sys.stderr)
333
+ sys.exit(1)
334
+
335
+
317
336
  def main():
318
337
  parser = argparse.ArgumentParser(prog="ghosttrap", description="Watch for errors from ghosttrap.io")
319
338
  sub = parser.add_subparsers(dest="command")
320
339
 
321
340
  sub.add_parser("setup", help="Claim repos and install Claude Code skill")
341
+ sub.add_parser("clear", help="Skip all outstanding errors")
322
342
 
323
343
  watch_parser = sub.add_parser("watch", help="Stream errors in real time")
324
344
  watch_parser.add_argument("--server", default=GHOSTTRAP_SERVER, help="WebSocket server URL")
@@ -331,6 +351,8 @@ def main():
331
351
  if args.command == "setup":
332
352
  token = get_gh_token()
333
353
  asyncio.run(setup(GHOSTTRAP_SERVER, token))
354
+ elif args.command == "clear":
355
+ clear()
334
356
  elif args.command == "watch":
335
357
  _require_setup()
336
358
  config = _load_config()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.4
3
+ Version: 0.3.5
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.4"
7
+ version = "0.3.5"
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