{
  "version": "1.0",
  "last_updated": "January 21, 2025 at 11:32 AM",
  "project": {
    "name": "CursorFocus",
    "version": "1.0.0",
    "language": "python",
    "framework": "none",
    "type": "application",
    "description": "This project is designed to enhance the Cursor IDE by providing automated project analysis and management tools. It dynamically generates a project overview, monitors for changes, and provides automated rules generation, enabling developers to quickly understand and navigate their codebase while ensuring project consistency. The system leverages a combination of file system analysis, code parsing, and AI-powered rules generation to offer a unique and streamlined development experience."
  },
  "ai_behavior": {
    "code_generation": {
      "style": {
        "prefer": [
          "Consistent use of snake_case for variables and function names (e.g., `file_path`, `analyze_file_content`).",
          "Use of docstrings for function and class documentation.",
          "Consistent use of f-strings for string formatting (e.g., `f\"Error analyzing file {file_path}: {e}\"`).",
          "Use of `os.path.join` for path manipulation.",
          "Use of `with open(...)` for file handling.",
          "Consistent use of `logging` module for debugging and error reporting.",
          "Use of `try...except` blocks for error handling.",
          "Use of `set` data structures for storing unique values and fast lookups (e.g., `BINARY_EXTENSIONS`, `IGNORED_NAMES`).",
          "Use of `re` module for pattern matching.",
          "Use of type hints for function parameters and return values (e.g., `file_path: str`, `-> List[str]`).",
          "Clear and concise comments to explain complex logic.",
          "Use of list comprehensions and generator expressions for concise code.",
          "Consistent use of single quotes or double quotes for strings, but mostly double quotes when embedding variables",
          "Use of `json` module for handling JSON data.",
          "Use of `shutil` module for file system operations.",
          "Use of `datetime` module for date and time operations",
          "Use of `tempfile` module for temporary files and directories",
          "Use of `zipfile` module for handling ZIP archives",
          "Use of `requests` module for HTTP requests"
        ],
        "avoid": [
          "Inconsistent naming conventions.",
          "Lack of documentation.",
          "Inconsistent string formatting.",
          "Direct string concatenation for paths.",
          "Unclosed file handles.",
          "Using `print` statements for debugging (except in `config.py`).",
          "Catching generic exceptions without logging the error.",
          "Using lists when sets would be more appropriate.",
          "Inconsistent use of quotes.",
          "Unnecessary loops when list comprehensions would be more concise."
        ]
      },
      "error_handling": {
        "prefer": [
          "Use of `try...except` blocks to catch potential exceptions.",
          "Logging exceptions with the `logging` module.",
          "Returning default values or empty lists/dictionaries in case of errors.",
          "Specific exception handling (e.g., `UnicodeDecodeError`, `re.error`) where possible.",
          "Avoiding bare `except` blocks."
        ],
        "avoid": [
          "Ignoring exceptions without logging.",
          "Using `print` statements for error reporting (except in `config.py`).",
          "Letting exceptions crash the program without handling them."
        ]
      },
      "performance": {
        "prefer": [
          "Use of `set` for fast lookups.",
          "Use of `os.path.exists` instead of catching `FileNotFoundError`.",
          "Use of list comprehensions and generator expressions for concise operations.",
          "Avoid unnecessary string concatenation.",
          "Use of `os.walk` for efficient file system traversal.",
          "Caching results when possible (e.g., `_scan_cache` in `project_detector.py`)."
        ],
        "avoid": [
          "Unnecessary loops.",
          "Inefficient string operations.",
          "Repeatedly reading the same files.",
          "Performing heavy computations without caching."
        ]
      },
      "suggest_patterns": {
        "improve": [
          "Consider using a more robust configuration management system for complex configurations.",
          "Explore using a dedicated library for handling regular expressions for more complex patterns.",
          "Implement more sophisticated dependency analysis techniques for larger projects.",
          "Improve the performance of file scanning by using techniques like multiprocessing."
        ],
        "avoid": [
          "Suggesting major architectural changes that deviate from the current project's design.",
          "Introducing external libraries that are not already used in the project."
        ]
      },
      "module_organization": {
        "structure": [
          "The project is organized into several modules, each responsible for a specific functionality.",
          "The main modules include `analyzers.py`, `auto_updater.py`, `config.py`, `content_generator.py`, `focus.py`, `project_detector.py`, `rules_analyzer.py`, `rules_generator.py`, `rules_watcher.py`, and `setup.py`.",
          "`config.py` handles the project configuration.",
          "`analyzers.py` contains code analysis related functions.",
          "`auto_updater.py` handles the application auto-update functionality.",
          "`content_generator.py` generates the focus content based on project analysis.",
          "`focus.py` is the main entry point for the application.",
          "`project_detector.py` detects the project type.",
          "`rules_analyzer.py` analyzes the project for rules generation.",
          "`rules_generator.py` generates the rules files.",
          "`rules_watcher.py` watches file system events for changes.",
          "`setup.py` provides a command-line interface for managing projects."
        ],
        "dependencies": [
          "`analyzers.py` depends on `config.py` and `logging`.",
          "`auto_updater.py` depends on `os`, `requests`, `json`, `shutil`, `datetime`, `logging`, `typing`, `tempfile`, and `zipfile`.",
          "`content_generator.py` depends on `os`, `datetime`, `analyzers.py`, `project_detector.py`, `config.py`, `re`, and `logging`.",
          "`focus.py` depends on `os`, `time`, `datetime`, `config.py`, `content_generator.py`, `rules_analyzer.py`, `rules_generator.py`, `rules_watcher.py`, `logging`, and `auto_updater.py`.",
          "`project_detector.py` depends on `os`, `json`, `re`, `config.py` and `time`.",
          "`rules_analyzer.py` depends on `os` and `json`.",
          "`rules_generator.py` depends on `os`, `json`, `typing`, `datetime`, `google.generativeai`, `re`, `rules_analyzer.py`, and `dotenv`.",
          "`rules_watcher.py` depends on `os`, `time`, `typing`, `watchdog.observers`, `watchdog.events`, `rules_generator.py`, and `project_detector.py`.",
          "`setup.py` depends on `os`, `json`, `argparse`, `logging`, `sys` and `project_detector.py`"
        ],
        "responsibilities": {
          "analyzers.py": "Analyzes code files for functions and determines if files should be ignored based on extension or name.",
          "auto_updater.py": "Checks for updates to the application and downloads/installs new versions.",
          "config.py": "Loads and provides access to the application configuration, including file extensions, ignored names, and regex patterns.",
          "content_generator.py": "Generates the Focus.md file content by scanning the project structure, analyzing files, and formatting the output.",
          "focus.py": "The main application entry point; sets up and monitors projects, and manages updates.",
          "project_detector.py": "Detects the type of a given project based on its files, and provides project descriptions.",
          "rules_analyzer.py": "Analyzes a project to extract information about its name, language, framework and type.",
          "rules_generator.py": "Generates rules files for Cursor IDE, based on project analysis and using Gemini AI.",
          "rules_watcher.py": "Monitors project directories for file changes and triggers updates to the .cursorrules file.",
          "setup.py": "Provides command-line interface for setting up and managing projects."
        },
        "rules": [
          "Each module should have a clear responsibility.",
          "Dependencies between modules should be explicit and minimized.",
          "Configuration should be centralized in `config.py`.",
          "Logging should be used for debugging and error reporting.",
          "Error handling should be consistent and robust.",
          "Each module should be responsible for its own error handling and not rely on the caller to handle them.",
          "File system operations should be handled consistently using `os` and `shutil` modules.",
          "Regular expressions should be used for pattern matching.",
          "External APIs should be called only after verifying the required credentials."
        ],
        "naming": {
          "variables": "Use snake_case (e.g., `file_path`, `project_name`).",
          "functions": "Use snake_case (e.g., `analyze_file_content`, `get_directory_structure`).",
          "classes": "Use PascalCase (e.g., `AutoUpdater`, `RulesAnalyzer`).",
          "constants": "Use uppercase with underscores (e.g., `BINARY_EXTENSIONS`, `IGNORED_NAMES`).",
          "configuration": "Use lowercase dictionary keys (e.g., `project_path`, `update_interval`)."
        }
      }
    }
  }
}