test_completion_behavior.py•3.42 kB
# Aidderall MCP Server - Hierarchical task management for AI assistants
# Copyright (C) 2024 Briam R. <briamr@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
"""Manual test to demonstrate task completion and removal behavior."""
import asyncio
import json
from src.handlers import AidderallHandlers
from src.task_manager import TaskManager
async def test_completion_behavior():
print("=== Testing Completion & Removal Behavior ===\n")
manager = TaskManager()
handlers = AidderallHandlers(manager)
# Create task structure
print("Creating tasks...")
await handlers.handle_create_new_task("Project Alpha", "Main project")
await handlers.handle_extend_current_task("Design", "Design the system")
await handlers.handle_extend_current_task("Review", "Get feedback")
# Show initial state
print("\nInitial state:")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
# Complete the Review task
print("\n--- Completing 'Review' task ---")
complete_result = await handlers.handle_complete_current_task()
print(f"Completed: {complete_result['completed_task_title']}")
print(f"New current: {complete_result['new_current_task_title']}")
# Show state after first completion
print("\nState after completing Review:")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
# Complete the Design task
print("\n--- Completing 'Design' task ---")
complete_result = await handlers.handle_complete_current_task()
print(f"Completed: {complete_result['completed_task_title']}")
# Show state with completed tasks visible
print("\nState after completing Design (tasks stay in structure):")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
# Show completed tasks array
completed = await handlers.handle_get_completed_tasks()
print(f"\nCompleted tasks array has {completed['count']} tasks")
# Remove a completed task
review_id = completed["tasks"][0]["id"] # First completed was Review
print(f"\n--- Removing completed 'Review' task (ID: {review_id}) ---")
remove_result = await handlers.handle_remove_task(review_id)
print(json.dumps(remove_result, indent=2))
# Show final state
print("\nFinal state (Review removed, Design still visible):")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
# Completed tasks still has both
completed = await handlers.handle_get_completed_tasks()
print(
f"\nCompleted tasks array still has {completed['count']} tasks (history preserved)"
)
print("\n=== Test Complete ===")
if __name__ == "__main__":
asyncio.run(test_completion_behavior())