diff --git a/agent/cli.py b/agent/cli.py index 4b95da5..a7fcda0 100644 --- a/agent/cli.py +++ b/agent/cli.py @@ -418,6 +418,118 @@ def roadmap(): click.echo("\nπŸ—ΊοΈ Team roadmap:\n") click.echo(content) +# Command: add item to roadmap +@cli.command() +@click.argument("section") +@click.argument("item") +def roadmap_add(section, item): + """Add an item to the roadmap. Sections: inprogress, todo, backlog""" + roadmap_path = os.path.join(BASE_DIR, "knowledge_base", "roadmap", "roadmap.md") + + section_map = { + "inprogress": "### 🟒 In Progress", + "todo": "### 🟑 To Do", + "backlog": "### πŸ”΄ Backlog" + } + + if section not in section_map: + click.echo(f"\n❌ Invalid section. Use: inprogress, todo, backlog\n") + return + + with open(roadmap_path, "r") as f: + content = f.read() + + section_header = section_map[section] + content = content.replace(section_header, f"{section_header}\n- {item}") + + with open(roadmap_path, "w") as f: + f.write(content) + + click.echo(f"\nβœ… Item added to '{section}': {item}\n") + +# Command: move item in roadmap +@cli.command() +@click.argument("item") +@click.argument("to_section") +def roadmap_move(item, to_section): + """Move an item to another section. Sections: inprogress, todo, backlog""" + roadmap_path = os.path.join(BASE_DIR, "knowledge_base", "roadmap", "roadmap.md") + + section_map = { + "inprogress": "### 🟒 In Progress", + "todo": "### 🟑 To Do", + "backlog": "### πŸ”΄ Backlog" + } + + if to_section not in section_map: + click.echo(f"\n❌ Invalid section. Use: inprogress, todo, backlog\n") + return + + with open(roadmap_path, "r") as f: + content = f.read() + + if f"- {item}" not in content: + click.echo(f"\n❌ Item '{item}' not found in roadmap.\n") + return + + content = content.replace(f"- {item}\n", "") + section_header = section_map[to_section] + content = content.replace(section_header, f"{section_header}\n- {item}") + + with open(roadmap_path, "w") as f: + f.write(content) + + click.echo(f"\nβœ… Item moved to '{to_section}': {item}\n") + +# Command: mark roadmap item as completed +@cli.command() +@click.argument("item") +def roadmap_complete(item): + """Mark a roadmap item as completed.""" + roadmap_path = os.path.join(BASE_DIR, "knowledge_base", "roadmap", "roadmap.md") + + with open(roadmap_path, "r") as f: + content = f.read() + + if f"- {item}" not in content: + click.echo(f"\n❌ Item '{item}' not found in roadmap.\n") + return + + content = content.replace(f"- {item}\n", "") + content = content.replace("### βœ… Completed", f"### βœ… Completed\n- {item}") + + with open(roadmap_path, "w") as f: + f.write(content) + + click.echo(f"\nβœ… Item marked as completed: {item}\n") + +# Command: remove roadmap item +@cli.command() +@click.argument("item") +def roadmap_remove(item): + """Remove an item from the roadmap.""" + roadmap_path = os.path.join(BASE_DIR, "knowledge_base", "roadmap", "roadmap.md") + + with open(roadmap_path, "r") as f: + content = f.read() + + if f"- {item}" not in content: + click.echo(f"\n❌ Item '{item}' not found in roadmap.\n") + return + + confirm = click.confirm(f" Are you sure you want to remove '{item}'?", default=False) + + if not confirm: + click.echo(f"\n❌ Removal cancelled.\n") + return + + content = content.replace(f"- {item}\n", "") + + with open(roadmap_path, "w") as f: + f.write(content) + + click.echo(f"\nβœ… Item removed from roadmap: {item}\n") + # Command: show the project history @cli.command() def history(): diff --git a/agent/menu.py b/agent/menu.py index 7623c80..60fd16c 100644 --- a/agent/menu.py +++ b/agent/menu.py @@ -296,7 +296,79 @@ def pull_requests_menu(): elif choice == "⬅️ Back": break +def roadmap_menu(): + """Submenu for Roadmap management.""" + while True: + print("\nπŸ—ΊοΈ Roadmap\n") + + choice = questionary.select( + "What would you like to do?", + choices=[ + "πŸ‘οΈ View Roadmap", + "βž• Add Item", + "πŸ”„ Move Item", + "βœ… Mark as Completed", + "πŸ—‘οΈ Remove Item", + "⬅️ Back" + ] + ).ask() + + if choice == "πŸ‘οΈ View Roadmap": + run_command(["roadmap"]) + wait_for_menu() + elif choice == "βž• Add Item": + section = questionary.select( + "Select section:", + choices=[ + "🟒 In Progress", + "🟑 To Do", + "πŸ”΄ Backlog" + ] + ).ask() + + section_map = { + "🟒 In Progress": "inprogress", + "🟑 To Do": "todo", + "πŸ”΄ Backlog": "backlog" + } + + item = questionary.text("Item description:").ask() + run_command(["roadmap-add", section_map[section], item]) + wait_for_menu() + + elif choice == "πŸ”„ Move Item": + item = questionary.text("Item to move (exact text):").ask() + section = questionary.select( + "Move to section:", + choices=[ + "🟒 In Progress", + "🟑 To Do", + "πŸ”΄ Backlog" + ] + ).ask() + + section_map = { + "🟒 In Progress": "inprogress", + "🟑 To Do": "todo", + "πŸ”΄ Backlog": "backlog" + } + + run_command(["roadmap-move", item, section_map[section]]) + wait_for_menu() + + elif choice == "βœ… Mark as Completed": + item = questionary.text("Item to mark as completed (exact text):").ask() + run_command(["roadmap-complete", item]) + wait_for_menu() + + elif "Remove Item" in choice: + item = questionary.text("Item to remove (exact text):").ask() + run_command(["roadmap-remove", item]) + wait_for_menu() + + elif choice == "⬅️ Back": + break def main(): while True: @@ -318,8 +390,7 @@ def main(): test_cases_menu() elif choice == "πŸ—ΊοΈ Roadmap": - run_command(["roadmap"]) - wait_for_menu() + roadmap_menu() elif choice == "πŸ“œ History": history_menu() diff --git a/knowledge_base/roadmap/roadmap.md b/knowledge_base/roadmap/roadmap.md index 2a4e636..7bf7358 100644 --- a/knowledge_base/roadmap/roadmap.md +++ b/knowledge_base/roadmap/roadmap.md @@ -17,6 +17,8 @@ The team is in the learning phase of test automation. - Integrate the agent with test reports - AI integration for importing external documents +### βœ… Completed + ## Notes - Update this file whenever a step is completed - Responsible for updates: Diogo \ No newline at end of file