feat: add tmdb-cli skill — The Movie Database API CLI #9

Merged
magnus merged 1 commit from feat/tmdb-cli-skill into main 2026-05-21 23:29:41 -04:00
Contributor

CLI wrapper for TMDb API v3. Commands: movie search/discover/upcoming, tv search/discover, trending, genre list, certification list. Free API key from themoviedb.org.

Signed-off-by: Jasper magnus@groktop.us

CLI wrapper for TMDb API v3. Commands: movie search/discover/upcoming, tv search/discover, trending, genre list, certification list. Free API key from themoviedb.org. Signed-off-by: Jasper <magnus@groktop.us>
CLI wrapper for TMDb API v3. Commands: movie search/discover/upcoming,
tv search/discover, trending, genre list, certification list.

All cli-builder patterns: --json, --dry-run, --quiet, --verbose,
lazy auth, emit() dual-output, structured logging, pre-parsed
global flags. Auth via TMDB_ACCESS_TOKEN or TMDB_API_KEY.

Signed-off-by: Jasper <magnus@groktop.us>
magnus merged commit 3900ecc63d into main 2026-05-21 23:29:41 -04:00
jasper left a comment

Automated first-pass code review from Jasper. See inline comments.

Automated first-pass code review from Jasper. See inline comments.
Author
Contributor

Syntax error on lines 22-23. ENV_TOKEN=*** "") and ENV_API_KEY=*** "") are invalid Python — the script won't run at all. Likely intended to be: ENV_TOKEN = os.getenv("TMDB_ACCESS_TOKEN", ""). Needs fixing before merge.

**Syntax error on lines 22-23.** `ENV_TOKEN=*** "")` and `ENV_API_KEY=*** "")` are invalid Python — the script won't run at all. Likely intended to be: `ENV_TOKEN = os.getenv("TMDB_ACCESS_TOKEN", "")`. Needs fixing before merge.
jasper left a comment

Review comment from Jasper (automated review) — additional findings.

Review comment from Jasper (automated review) — additional findings.
Author
Contributor

Bug: tv search dispatches to cmd_movie_search (line 384). The dispatch for tv search calls cmd_movie_search(), which calls client.search_movie() — so tmdb-cli tv search --term "severance" returns movie results, not TV results. This is a copy-paste bug.

Fix: define a cmd_tv_search function that calls client.search_tv() (mirroring cmd_movie_search with the TV variant), and update the dispatch on line 384 to call it.

**Bug: `tv search` dispatches to `cmd_movie_search` (line 384).** The dispatch for `tv search` calls `cmd_movie_search()`, which calls `client.search_movie()` — so `tmdb-cli tv search --term "severance"` returns movie results, not TV results. This is a copy-paste bug. Fix: define a `cmd_tv_search` function that calls `client.search_tv()` (mirroring `cmd_movie_search` with the TV variant), and update the dispatch on line 384 to call it.
jasper left a comment

Additional findings from Jasper (automated review).

Additional findings from Jasper (automated review).
Author
Contributor

Bug: now-playing registered in argparse (line 353) but has no dispatch case (line 382). The now-playing subparser is created, but the main dispatch block only handles search, discover, and upcoming for movienow-playing falls through to else: parser.print_help(). Running tmdb-cli movie now-playing will print the help text and do nothing else.

Fix: add an elif args.action == "now-playing" dispatch case, or define a dedicated cmd_now_playing function.

**Bug: `now-playing` registered in argparse (line 353) but has no dispatch case (line 382).** The `now-playing` subparser is created, but the main dispatch block only handles `search`, `discover`, and `upcoming` for `movie` — `now-playing` falls through to `else: parser.print_help()`. Running `tmdb-cli movie now-playing` will print the help text and do nothing else. Fix: add an `elif args.action == "now-playing"` dispatch case, or define a dedicated `cmd_now_playing` function.
Author
Contributor

Bug: genre dispatch looks for "list" in argv (line 390) but argparse has no list subcommand. The parser is created as sub.add_parser("genre") with a --type flag — the expected invocation is tmdb-cli genre --type movie. But the dispatch code does filtered_argv.index("list") which will raise ValueError: 'list' is not in list because "list" is not part of the argv.

Same issue on line 392 for certification: tmdb-cli certification has no "list" token in argv.

These dispatch cases need to pass the remaining args differently — either using argparse's parse_known_args with the full remaining argv, or restructuring the dispatch to not rely on finding literal tokens.

**Bug: `genre` dispatch looks for `"list"` in argv (line 390) but argparse has no `list` subcommand.** The parser is created as `sub.add_parser("genre")` with a `--type` flag — the expected invocation is `tmdb-cli genre --type movie`. But the dispatch code does `filtered_argv.index("list")` which will raise `ValueError: 'list' is not in list` because `"list"` is not part of the argv. Same issue on line 392 for `certification`: `tmdb-cli certification` has no `"list"` token in argv. These dispatch cases need to pass the remaining args differently — either using argparse's `parse_known_args` with the full remaining argv, or restructuring the dispatch to not rely on finding literal tokens.
Author
Contributor

Style: argparse setup uses semicolons and extremely long lines (lines 350-359). Lines like:

s2 = msub.add_parser("discover", ...); s2.add_argument("--genre"); s2.add_argument("--certification"); ...

are ~350-400 characters long and hard to read. Chaining statements with semicolons is non-Pythonic. Consider breaking each add_argument onto its own line for readability.

**Style: argparse setup uses semicolons and extremely long lines (lines 350-359).** Lines like: ```python s2 = msub.add_parser("discover", ...); s2.add_argument("--genre"); s2.add_argument("--certification"); ... ``` are ~350-400 characters long and hard to read. Chaining statements with semicolons is non-Pythonic. Consider breaking each `add_argument` onto its own line for readability.
jasper left a comment

Jasper's First-Pass Code Review Summary

Bugs found (must fix before merge):

  1. Syntax error (lines 22-23): ENV_TOKEN=*** "" and ENV_API_KEY=*** "" are invalid Python — the script will crash on import with a SyntaxError. Needs ENV_TOKEN = os.getenv("TMDB_ACCESS_TOKEN", "").

  2. TV search calls movie search (line 384): tv search dispatches to cmd_movie_search(), which calls client.search_movie(). Users searching for TV shows will get movie results. Needs a cmd_tv_search function.

  3. now-playing has no dispatch (line 382): The subparser is registered in argparse (line 353) but the dispatch block doesn't handle it — runs parser.print_help() instead.

  4. genre and certification dispatches look for "list" in argv (lines 390, 392): filtered_argv.index("list") will raise ValueError since tmdb-cli genre --type movie and tmdb-cli certification don't contain the token "list".

Style (recommended but not blocking):

  1. Semicolons and 350+ char lines in argparse setup (lines 350-359): Readability suffers.

Missing:

  1. No test suite: Consider adding a basic test file (even a smoke test) to validate the CLI works end-to-end.

Passed review: API client structure, error handling, lazy auth, global flags pattern, formatting functions — all solid. The cli-builder conventions (emit(), --json, --dry-run, --quiet/--verbose) are applied correctly.

## Jasper's First-Pass Code Review Summary **Bugs found (must fix before merge):** 1. **Syntax error (lines 22-23):** `ENV_TOKEN=*** ""` and `ENV_API_KEY=*** ""` are invalid Python — the script will crash on import with a SyntaxError. Needs `ENV_TOKEN = os.getenv("TMDB_ACCESS_TOKEN", "")`. 2. **TV search calls movie search (line 384):** `tv search` dispatches to `cmd_movie_search()`, which calls `client.search_movie()`. Users searching for TV shows will get movie results. Needs a `cmd_tv_search` function. 3. **`now-playing` has no dispatch (line 382):** The subparser is registered in argparse (line 353) but the dispatch block doesn't handle it — runs `parser.print_help()` instead. 4. **`genre` and `certification` dispatches look for `"list"` in argv (lines 390, 392):** `filtered_argv.index("list")` will raise ValueError since `tmdb-cli genre --type movie` and `tmdb-cli certification` don't contain the token `"list"`. **Style (recommended but not blocking):** 5. **Semicolons and 350+ char lines in argparse setup (lines 350-359):** Readability suffers. **Missing:** 6. **No test suite:** Consider adding a basic test file (even a smoke test) to validate the CLI works end-to-end. **Passed review:** API client structure, error handling, lazy auth, global flags pattern, formatting functions — all solid. The `cli-builder` conventions (emit(), --json, --dry-run, --quiet/--verbose) are applied correctly.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
magnus/agent-skills!9
No description provided.