diff --git a/codetide/__init__.py b/codetide/__init__.py index 8674046..870c494 100644 --- a/codetide/__init__.py +++ b/codetide/__init__.py @@ -15,6 +15,7 @@ from typing import Optional, List, Tuple, Union, Dict from datetime import datetime, timezone from pathlib import Path +import traceback import asyncio import pygit2 import time @@ -292,7 +293,7 @@ async def _process_single_file( logger.debug(f"Processing file: {filepath}") return await parser.parse_file(filepath, self.rootpath) except Exception as e: - logger.warning(f"Failed to process {filepath}: {str(e)}") + logger.warning(f"Failed to process {filepath}: {str(e)}\n\n{traceback.format_exc()}") return None def _add_results_to_codebase( @@ -419,6 +420,7 @@ def _get_changed_files(self) -> Tuple[List[Path], bool]: # Check for deleted files for stored_file_path in self.files: if stored_file_path not in files: + logger.info(f"detected deletion: {stored_file_path}") file_deletion_detected = True break diff --git a/codetide/agents/tide/prompts.py b/codetide/agents/tide/prompts.py index c3287a6..dec1929 100644 --- a/codetide/agents/tide/prompts.py +++ b/codetide/agents/tide/prompts.py @@ -407,6 +407,14 @@ Ensure high coverage by including unit, integration, and end-to-end tests that address edge cases and follow best practices. """ + +CMD_BRAINSTORM_PROMPT = """ +You are strictly prohibited from writing or generating any code until the user explicitly asks you to do so. +For now, you must put on the hat of a solutions architect: your role is to discuss, brainstorm, and collaboratively explore possible solutions, architectures, and implementation strategies with the user. +Ask clarifying questions, propose alternatives, and help the user refine requirements or approaches. +Maintain a conversational flow, encourage user input, and do not proceed to code generation under any circumstances until the user gives a clear instruction to generate code. +""" + CMD_CODE_REVIEW_PROMPT = """ Review the following code submission for bugs, style inconsistencies, and performance issues. Provide specific, actionable feedback to improve code quality, maintainability, and adherence to established coding standards. diff --git a/codetide/agents/tide/ui/__init__.py b/codetide/agents/tide/ui/__init__.py new file mode 100644 index 0000000..767ebea --- /dev/null +++ b/codetide/agents/tide/ui/__init__.py @@ -0,0 +1,5 @@ +from .app import serve + +__all__ = [ + "serve" +] \ No newline at end of file diff --git a/codetide/agents/tide/ui/agent_tide_ui.py b/codetide/agents/tide/ui/agent_tide_ui.py index f2e24f8..58a4b86 100644 --- a/codetide/agents/tide/ui/agent_tide_ui.py +++ b/codetide/agents/tide/ui/agent_tide_ui.py @@ -9,7 +9,7 @@ "Install it with: pip install codetide[agents-ui]" ) from e -from codetide.agents.tide.prompts import CMD_CODE_REVIEW_PROMPT, CMD_COMMIT_PROMPT, CMD_TRIGGER_PLANNING_STEPS, CMD_WRITE_TESTS_PROMPT +from codetide.agents.tide.prompts import CMD_BRAINSTORM_PROMPT, CMD_CODE_REVIEW_PROMPT, CMD_COMMIT_PROMPT, CMD_TRIGGER_PLANNING_STEPS, CMD_WRITE_TESTS_PROMPT from codetide.agents.tide.defaults import DEFAULT_AGENT_TIDE_LLM_CONFIG_PATH from codetide.agents.tide.ui.defaults import PLACEHOLDER_LLM_CONFIG from codetide.agents.tide.agent import AgentTide @@ -42,7 +42,8 @@ def __init__(self, project_path: Path = Path("./"), history :Optional[list]=None "plan": CMD_TRIGGER_PLANNING_STEPS, "review": CMD_CODE_REVIEW_PROMPT, "test": CMD_WRITE_TESTS_PROMPT, - "commit": CMD_COMMIT_PROMPT + "commit": CMD_COMMIT_PROMPT, + "brainstorm": CMD_BRAINSTORM_PROMPT } self.session_id = session_id if session_id else ulid() @@ -50,7 +51,8 @@ def __init__(self, project_path: Path = Path("./"), history :Optional[list]=None {"id": "review", "icon": "search-check", "description": "Review file(s) or object(s)"}, {"id": "test", "icon": "flask-conical", "description": "Test file(s) or object(s)"}, {"id": "commit", "icon": "git-commit", "description": "Commit changed files"}, - {"id": "plan", "icon": "notepad-text-dashed", "description": "Create a step-by-step task plan"} + {"id": "plan", "icon": "notepad-text-dashed", "description": "Create a step-by-step task plan"}, + {"id": "brainstorm", "icon": "brain-circuit", "description": "Brainstorm and discuss solutions (no code generation)"} ] async def load(self): diff --git a/codetide/agents/tide/ui/app.py b/codetide/agents/tide/ui/app.py index b53be52..13c8b01 100644 --- a/codetide/agents/tide/ui/app.py +++ b/codetide/agents/tide/ui/app.py @@ -448,7 +448,23 @@ def serve( def main(): - parser = argparse.ArgumentParser(description="Launch the Tide UI server.") + parser = argparse.ArgumentParser( + description="Launch the Tide UI server.", + epilog=( + "\nAvailable commands and what they do:\n" + " --host Host to bind to (default: None)\n" + " --port Port to bind to (default: 9753)\n" + " --root-path Root path for the app (default: None)\n" + " --ssl-certfile Path to SSL certificate file (default: None)\n" + " --ssl-keyfile Path to SSL key file (default: None)\n" + " --ws-per-message-deflate WebSocket per-message deflate (true/false, default: true)\n" + " --ws-protocol WebSocket protocol (default: auto)\n" + " --project-path Path to the project directory (default: ./)\n" + " --config-path Path to the config file (default: .agent_tide_config.yml)\n" + " -h, --help Show this help message and exit\n" + ), + formatter_class=argparse.RawDescriptionHelpFormatter + ) parser.add_argument("--host", type=str, default=None, help="Host to bind to") parser.add_argument("--port", type=int, default=AGENT_TIDE_PORT, help="Port to bind to") parser.add_argument("--root-path", type=str, default=None, help="Root path for the app") diff --git a/codetide/search/__init__.py b/codetide/search/__init__.py new file mode 100644 index 0000000..e69de29