Skip to content

Let reconcile observe M-Team (API key) and use the saved site credential - #29

Merged
tonycoder-hub merged 1 commit into
mainfrom
feat/mteam-reconcile-api-key
Oct 16, 2026
Merged

tonycoder-hub merged 1 commit into
mainfrom
feat/mteam-reconcile-api-key

Conversation

@tonycoder-hub

Copy link
Copy Markdown
Owner

Summary

reconcile report --site-ref mteam/ID was refused because live site detail read only a piped cookie. This adds:

  • --site-live: uses the credential ptctl site login saved for the site. Nothing is read from stdin for the site; it is read only after every credential-free gate passes. With a downloader in the same command, --site-live --password-stdin leaves stdin to the downloader password alone.
  • --site-api-key-stdin: pipes an API key, for API-key sites (M-Team).
  • site_api_key in the --credential-bundle-stdin bundle: allowed in place of site_cookie. Exactly one of the two must be present.

A site credential whose method the site does not accept is a usage error before any request. For a bundle, this is checked after the read, and still before any request.

Deliberate public-text changes

  • The combined-reads usage error was combined live site and downloader reads require --credential-bundle-stdin. It is now ... require --credential-bundle-stdin, or --site-live with --password-stdin.
  • The site-detail-only usage error now lists --site-cookie-stdin, --site-api-key-stdin, or --site-live.
  • New usage errors:
    • --site-cookie-stdin, --site-api-key-stdin, --site-live, and --credential-bundle-stdin are mutually exclusive
    • --site-live cannot be explicitly disabled
    • combined --site-live and downloader reads require --password-stdin
    • the existing site %q does not support %s authentication, now also from reconcile
  • The reconcile help paragraph and the --credential-bundle-stdin flag description mention the new flags and field.

Report JSON, stop reasons, exit codes, route IDs and origins are unchanged. The existing cookie and bundle paths behave as before.

Tests

internal/cli/reconcile_site_credentials_test.go covers:

  • an API key from stdin;
  • --site-live with a saved cookie and with a saved API key, without reading stdin;
  • --site-live plus qBittorrent, where stdin carries only the downloader password;
  • a bundle with site_api_key;
  • refusal before any request for a bundle with both site fields, with neither, with an invalid key, or with a cookie for an API-key site;
  • usage errors before any stdin read: mutual exclusion, --site-live=false, a wrong method, a missing saved file, --site-live plus a client without --password-stdin, and a stdin site credential plus a client;
  • an unsafe (0644) saved file is refused without showing its content.

All fixtures are synthetic canaries.

Live check

I ran this against M-Team with a throwaway HOME, the API key saved by site login --api-key-stdin, a synthetic one-file torrent and stdin set to /dev/null:

reconcile report --site-ref mteam/<public id> --site-live

  • Result: observed_current_ref, origin https://api2.m-team.cc, route mteam.torrent_detail_api.v1, one request.
  • No signed-link field appeared, and the key did not appear in any output.
  • The temp HOME was deleted afterwards.

Docs

  • docs/guide/reconcile.md
  • docs/AUTOMATION.md
  • docs/MTEAM_ADAPTER.md: the new Reconciliation section; it is removed from "Not supported yet".
  • docs/ADDING_A_SITE.md: the gap table; the remaining cookie-only checks are in the bonus commands.
  • docs/ARCHITECTURE.md
  • docs/TJUPT_ADAPTER.md
  • docs/THREAT_MODEL.md

🤖 Generated with Claude Code

reconcile report read live site detail only with a piped cookie, so
--site-ref mteam/ID was refused. It now takes:

- --site-live: the credential 'ptctl site login' saved for the site,
  read after every credential-free gate; with a downloader, stdin then
  carries only the --password-stdin downloader password
- --site-api-key-stdin: a piped API key for API-key sites
- site_api_key in the --credential-bundle-stdin bundle, in place of
  site_cookie (exactly one of the two)

A site credential of a method the site does not accept is a usage error
before any request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tonycoder-hub
tonycoder-hub merged commit 89feb32 into main Oct 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant