Implement: US: Authenticate and Connect to Trello Account #5

Merged
crisleo94 merged 2 commits from feature/trello-auth into main 2026-05-26 22:46:26 +00:00
Owner

Implemented: Trello Authentication & Connection Plugin

Changes

  • TrelloClient class in src/trello_plugin/client.py — REST API wrapper for Trello
  • 3 tools in src/trello_plugin/tools.py:
    • trello_verify_credentials — verify API key/token against Trello API
    • trello_list_boards — list accessible boards
    • trello_disconnect — clear in-memory credentials
  • 18 tests in tests/test_auth.py covering all success and error paths
  • Spec document in docs/backend/trello-auth-spec.md
  • pyproject.toml for package setup with dev dependencies

Configuration

Users set TRELLO_API_KEY and TRELLO_TOKEN environment variables. No interactive UI needed — credentials are read from env at runtime.

Acceptance Criteria Covered

  • 1.1: Provide Trello API Key and Token (env vars)
  • 1.2: Verify credentials with Trello API
  • 1.3: List accessible Trello boards
  • 1.4: Disconnect from Trello (clear credentials)

Closes #1

## Implemented: Trello Authentication & Connection Plugin ### Changes - **TrelloClient** class in `src/trello_plugin/client.py` — REST API wrapper for Trello - **3 tools** in `src/trello_plugin/tools.py`: - `trello_verify_credentials` — verify API key/token against Trello API - `trello_list_boards` — list accessible boards - `trello_disconnect` — clear in-memory credentials - **18 tests** in `tests/test_auth.py` covering all success and error paths - **Spec document** in `docs/backend/trello-auth-spec.md` - **pyproject.toml** for package setup with dev dependencies ### Configuration Users set `TRELLO_API_KEY` and `TRELLO_TOKEN` environment variables. No interactive UI needed — credentials are read from env at runtime. ### Acceptance Criteria Covered - ✅ 1.1: Provide Trello API Key and Token (env vars) - ✅ 1.2: Verify credentials with Trello API - ✅ 1.3: List accessible Trello boards - ✅ 1.4: Disconnect from Trello (clear credentials) Closes #1
marko added 1 commit 2026-05-26 21:33:45 +00:00
Add TrelloClient for Trello REST API interaction with env-var-based
credential management (TRELLO_API_KEY, TRELLO_TOKEN).

Implements:
- trello_verify_credentials — verify API key/token against Trello API
- trello_list_boards — list accessible Trello boards
- trello_disconnect — clear in-memory credentials

Includes full test suite (18 tests), spec document, and plugin metadata.

Issue: #1
Owner

Reid's Review — PR #5 on HermesFactory/trello-plugin

Verdict: 🔴 Changes Required


🔴 Blocking Issues

These MUST be resolved before this PR can be merged.

  • [File: src/trello_plugin/client.py | Line ~25] missing type hints on class attribute
    The TrelloClient class defines api_key, token, and _session attributes implicitly in __init__. These should be declared at the class level with type annotations for proper static analysis.

  • [File: src/trello_plugin/client.py | Line ~92] missing type guard for Any return
    The _get method returns dict[str, Any] but the response has two different shapes: error vs success. Consider using TypedDict or a discriminated union to distinguish these.

  • [File: tests/test_auth.py | Line ~59] unused import pattern
    The clear_env fixture manually manipulates os.environ instead of using monkeypatch which is pytest-recommended. Either use monkeypatch or remove the misleading comment.


🟡 Suggestions (Non-Blocking)

These are recommendations for improvement.

  • [File: src/trello_plugin/tools.py] The trello_disconnect message says "Reconnect by calling trello_verify_credentials after setting TRELLO_API_KEY and TRELLO_TOKEN" but the client auto-reconnects on next tool call if env vars are set. Consider aligning messaging.

  • [File: src/trello_plugin/client.py] Consider adding a docstring to the module-level constant TRELLO_API_BASE.


📋 AC Coverage

Based on linked issue #1

  • 1.1 Hermes Agent User can provide Trello API Key and Token
  • 1.2 Hermes Agent can verify Trello credentials
  • 1.3 Hermes Agent can list accessible Trello boards
  • 1.4 Hermes Agent can disconnect from Trello
## Reid's Review — PR #5 on HermesFactory/trello-plugin **Verdict:** 🔴 Changes Required --- ### 🔴 Blocking Issues > These MUST be resolved before this PR can be merged. - **[File: src/trello_plugin/client.py | Line ~25]** `missing type hints on class attribute` The `TrelloClient` class defines `api_key`, `token`, and `_session` attributes implicitly in `__init__`. These should be declared at the class level with type annotations for proper static analysis. - **[File: src/trello_plugin/client.py | Line ~92]** `missing type guard for Any return` The `_get` method returns `dict[str, Any]` but the response has two different shapes: error vs success. Consider using `TypedDict` or a discriminated union to distinguish these. - **[File: tests/test_auth.py | Line ~59]** `unused import pattern` The `clear_env` fixture manually manipulates `os.environ` instead of using `monkeypatch` which is pytest-recommended. Either use `monkeypatch` or remove the misleading comment. --- ### 🟡 Suggestions (Non-Blocking) > These are recommendations for improvement. - **[File: src/trello_plugin/tools.py]** The `trello_disconnect` message says "Reconnect by calling trello_verify_credentials after setting TRELLO_API_KEY and TRELLO_TOKEN" but the client auto-reconnects on next tool call if env vars are set. Consider aligning messaging. - **[File: src/trello_plugin/client.py]** Consider adding a docstring to the module-level constant `TRELLO_API_BASE`. --- ### 📋 AC Coverage > Based on linked issue #1 - [x] **1.1** Hermes Agent User can provide Trello API Key and Token - [x] **1.2** Hermes Agent can verify Trello credentials - [x] **1.3** Hermes Agent can list accessible Trello boards - [x] **1.4** Hermes Agent can disconnect from Trello
marko added 1 commit 2026-05-26 22:22:39 +00:00
- Add class-level type annotations on TrelloClient (api_key, token, _session)
- Add TypedDict response contracts with TypeGuard narrowing for _request
- Replace os.environ manipulation with monkeypatch in tests
- Align disconnect message with auto-reconnect behavior
- Add docstring for TRELLO_API_BASE constant
- Add _post and _put request helpers for future endpoints
crisleo94 approved these changes 2026-05-26 22:46:17 +00:00
crisleo94 merged commit 44c53f8015 into main 2026-05-26 22:46:26 +00:00
Owner

Reid's Review — PR #5 on HermesFactory/trello-plugin

Verdict: Approved — Blocking issues resolved


📋 AC Coverage

Based on linked issue #1

  • 1.1 Hermes Agent User can provide Trello API Key and Token — Users set env vars, plugin reads them at runtime
  • 1.2 Hermes Agent can verify Trello credentials — trello_verify_credentials tool calls /members/me endpoint with clear success/failure feedback
  • 1.3 Hermes Agent can list accessible Trello boards — trello_list_boards tool fetches and returns board list with id, name, url, closed, starred fields
  • 1.4 Hermes Agent can disconnect from Trello — trello_disconnect clears in-memory client credentials; documented that token revocation requires Trello account settings

🔍 Code Quality Notes

The previously identified blocking issues have been resolved:

  • Class-level type hints now declared (api_key: str, token: str, _session: requests.Session)
  • TypedDict response contracts (SuccessResponse, ErrorResponse) with TypeGuard helper _is_success() used correctly
  • Test fixtures use monkeypatch properly instead of manual os.environ manipulation

All methods have comprehensive docstrings and proper error handling. No further blocking issues found.

## Reid's Review — PR #5 on HermesFactory/trello-plugin **Verdict:** ✅ Approved — Blocking issues resolved --- ### 📋 AC Coverage > Based on linked issue #1 - [x] **1.1** Hermes Agent User can provide Trello API Key and Token — Users set env vars, plugin reads them at runtime - [x] **1.2** Hermes Agent can verify Trello credentials — `trello_verify_credentials` tool calls `/members/me` endpoint with clear success/failure feedback - [x] **1.3** Hermes Agent can list accessible Trello boards — `trello_list_boards` tool fetches and returns board list with id, name, url, closed, starred fields - [x] **1.4** Hermes Agent can disconnect from Trello — `trello_disconnect` clears in-memory client credentials; documented that token revocation requires Trello account settings --- ### 🔍 Code Quality Notes The previously identified blocking issues have been resolved: - ✅ Class-level type hints now declared (`api_key: str`, `token: str`, `_session: requests.Session`) - ✅ TypedDict response contracts (`SuccessResponse`, `ErrorResponse`) with `TypeGuard` helper `_is_success()` used correctly - ✅ Test fixtures use `monkeypatch` properly instead of manual os.environ manipulation All methods have comprehensive docstrings and proper error handling. No further blocking issues found.
Sign in to join this conversation.
No Reviewers
No labels
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: HermesFactory/trello-plugin#5