feat: accept Polymarket URLs as input#12
Conversation
Commands `markets get` and `events get` now accept full Polymarket URLs (e.g. https://polymarket.com/event/my-event/my-market) in addition to numeric IDs and plain slugs. The CLI extracts the appropriate slug automatically — market slug for `markets get`, event slug for `events get`.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| parsed.event_slug | ||
| }; | ||
| return ResolvedId::Slug(slug); | ||
| } |
There was a problem hiding this comment.
Market URL without market slug misresolves
Medium Severity
When prefer_market is true, resolve_id falls back to event_slug if the Polymarket URL has no market_slug. This makes markets get treat an event-only URL as a market slug and call market_by_slug with an event slug, which can lead to incorrect lookups or confusing failures.
There was a problem hiding this comment.
Intentional. When the URL has no market slug, falling back to the event slug is better than erroring -- it gives the API a chance to resolve it (works when event/market slugs match, which is common for single-market events).
When it doesn't match, the API returns a clear 404 ("slug not found"), same as typing any wrong slug. No silent misresolution is possible.


Summary
markets getandevents getnow accept full Polymarket URLs in addition to numeric IDs and slugsmarkets get, event slug forevents get)www., query strings, fragments, and trailing slashesMotivation
Agents and scripts commonly receive Polymarket URLs from users. This removes the need to manually extract slugs before passing them to the CLI.
Test plan
resolve_idlogicNote
Low Risk
Small, isolated CLI input-parsing change with thorough unit/integration test coverage; main risk is edge-case misparsing leading to fetching the wrong slug.
Overview
markets getandevents getnow accept full Polymarket URLs in addition to numeric IDs and slugs by introducingparse_polymarket_url/resolve_idand routing lookups based on the resolvedResolvedId.URL handling normalizes scheme/
www, strips query/fragment/trailing slashes, and picks the market slug formarkets get(when present) vs the event slug forevents get; coverage is added via new unit tests incommands/mod.rsplus integration tests ensuring URLs aren’t rejected at CLI parsing.Written by Cursor Bugbot for commit b977baa. This will update automatically on new commits. Configure here.