feat: implement Trello board management
Add 5 board management tools extending the Trello client: - trello_create_board — create a new board - trello_rename_board — rename an existing board - trello_archive_board — close/archive a board - trello_open_board — re-open a closed board - trello_board_details — view board with lists and members Includes board name-to-ID resolution, 16 new tests, and spec doc. Issue: #2
This commit is contained in:
@@ -8,8 +8,13 @@ from trello_plugin.tools import (
|
||||
PLUGIN_TOOLS,
|
||||
PLUGIN_VERSION,
|
||||
check_requirements,
|
||||
trello_archive_board,
|
||||
trello_board_details,
|
||||
trello_create_board,
|
||||
trello_disconnect,
|
||||
trello_list_boards,
|
||||
trello_open_board,
|
||||
trello_rename_board,
|
||||
trello_verify_credentials,
|
||||
)
|
||||
|
||||
@@ -22,4 +27,9 @@ __all__ = [
|
||||
"trello_verify_credentials",
|
||||
"trello_list_boards",
|
||||
"trello_disconnect",
|
||||
"trello_create_board",
|
||||
"trello_rename_board",
|
||||
"trello_archive_board",
|
||||
"trello_open_board",
|
||||
"trello_board_details",
|
||||
]
|
||||
@@ -76,6 +76,105 @@ def trello_disconnect() -> str:
|
||||
return _respond({"success": True, "message": "Trello credentials cleared from memory. Next tool call will re-read TRELLO_API_KEY and TRELLO_TOKEN from environment and reconnect automatically."})
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tools — Board Management
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def trello_create_board(name: str, default_lists: bool = True) -> str: # noqa: FBT001, FBT002
|
||||
"""Create a new Trello board.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
name : str
|
||||
The name for the new board.
|
||||
default_lists : bool, optional
|
||||
Whether to create default lists (default: True).
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
JSON with board id, name, and URL on success.
|
||||
"""
|
||||
client = _get_client()
|
||||
result = client.create_board(name=name, default_lists=default_lists)
|
||||
return _respond(result)
|
||||
|
||||
|
||||
def trello_rename_board(board_id: str, name: str) -> str:
|
||||
"""Rename an existing Trello board.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
board_id : str
|
||||
Board ID or name.
|
||||
name : str
|
||||
The new name for the board.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
JSON with updated board details on success.
|
||||
"""
|
||||
client = _get_client()
|
||||
result = client.rename_board(board_id=board_id, name=name)
|
||||
return _respond(result)
|
||||
|
||||
|
||||
def trello_archive_board(board_id: str) -> str:
|
||||
"""Close/archive a Trello board.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
board_id : str
|
||||
Board ID or name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
JSON with success message.
|
||||
"""
|
||||
client = _get_client()
|
||||
result = client.archive_board(board_id=board_id)
|
||||
return _respond(result)
|
||||
|
||||
|
||||
def trello_open_board(board_id: str) -> str:
|
||||
"""Re-open a closed/archived Trello board.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
board_id : str
|
||||
Board ID or name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
JSON with success message.
|
||||
"""
|
||||
client = _get_client()
|
||||
result = client.open_board(board_id=board_id)
|
||||
return _respond(result)
|
||||
|
||||
|
||||
def trello_board_details(board_id: str) -> str:
|
||||
"""View details of a Trello board, including its lists and members.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
board_id : str
|
||||
Board ID or name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
JSON with board details including lists and members.
|
||||
"""
|
||||
client = _get_client()
|
||||
result = client.board_details(board_id=board_id)
|
||||
return _respond(result)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Plugin metadata (used by Hermes plugin loader)
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -87,6 +186,11 @@ PLUGIN_TOOLS = [
|
||||
trello_verify_credentials,
|
||||
trello_list_boards,
|
||||
trello_disconnect,
|
||||
trello_create_board,
|
||||
trello_rename_board,
|
||||
trello_archive_board,
|
||||
trello_open_board,
|
||||
trello_board_details,
|
||||
]
|
||||
PLUGIN_REQUIRES_ENV = ["TRELLO_API_KEY", "TRELLO_TOKEN"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user