test_zen_state.py•2.99 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 zen state behavior."""
import asyncio
from src.handlers import AidderallHandlers
from src.task_manager import TaskManager
async def test_zen_state():
print("=== Testing Zen State Behavior ===\n")
manager = TaskManager()
handlers = AidderallHandlers(manager)
# Initial zen state (empty)
print("Initial state:")
result = await handlers.handle_get_current_task()
print(f"Current task response: {result['message']}")
print(f"Is zen state: {manager.is_zen_state}\n")
# Create tasks
print("Creating tasks...")
await handlers.handle_create_new_task("Write Documentation", "Write the user guide")
await handlers.handle_extend_current_task("Draft", "Write first draft")
await handlers.handle_extend_current_task("Review", "Review and edit")
# Not zen with incomplete tasks
print("\nWith incomplete tasks:")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
print(f"Is zen state: {manager.is_zen_state}\n")
# Complete all tasks
print("Completing all tasks...")
await handlers.handle_complete_current_task() # Complete Review
await handlers.handle_complete_current_task() # Complete Draft
await handlers.handle_complete_current_task() # Complete Write Documentation
# Zen state with all tasks completed
print("\nAfter completing all tasks:")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
print(f"Is zen state: {manager.is_zen_state}\n")
# Get current task in zen state
result = await handlers.handle_get_current_task()
print(f"Current task response: {result['message']}")
# Remove some tasks
print("\nRemoving some completed tasks...")
completed = await handlers.handle_get_completed_tasks()
task_id = completed["tasks"][0]["id"]
await handlers.handle_remove_task(task_id)
print("After removing one task:")
big_picture = await handlers.handle_get_big_picture()
print(big_picture["structure"])
print(f"Is zen state: {manager.is_zen_state}")
print("\n=== Test Complete ===")
if __name__ == "__main__":
asyncio.run(test_zen_state())