Warning, /swf-testbed/GEMINI.md is written in an unsupported language. File is not indexed.
0001 # Gemini Guidance
0002
0003 This file provides critical operational guidance for the Gemini agent working within the SWF testbed ecosystem.
0004
0005 ## **CRITICAL: Command Execution in the Virtual Environment**
0006
0007 **1. Virtual Environment Directory:**
0008 The virtual environment for this project is named `.venv` (a hidden directory), not `venv`. Always use this correct path.
0009
0010 **2. Execution Method:**
0011 To ensure commands run reliably, you **MUST** use the full, absolute path to the python executable within the `.venv` directory. This is the most robust method and avoids issues with shell environment persistence.
0012
0013 - **Python Executable Path:** `/Users/wenaus/github/swf-testbed/.venv/bin/python3`
0014
0015 First, ensure all dependencies are installed by running the `install.sh` script once.
0016 ```bash
0017 # Run this once to set up or update dependencies
0018 cd /Users/wenaus/github/swf-testbed && source ./install.sh
0019 ```
0020
0021 ### Correct Procedure for Subsequent Commands:
0022
0023 Directly execute commands using the venv's python.
0024
0025 **Example: Running a Django migration in `swf-monitor`**
0026 ```bash
0027 /Users/wenaus/github/swf-testbed/.venv/bin/python3 /Users/wenaus/github/swf-monitor/src/manage.py migrate
0028 ```
0029
0030 **Example: Running the Django development server**
0031 ```bash
0032 /Users/wenaus/github/swf-testbed/.venv/bin/python3 /Users/wenaus/github/swf-monitor/src/manage.py runserver 8001 &
0033 ```
0034
0035 ---
0036
0037 ## **CRITICAL: Checklist for Renaming Components**
0038
0039 Renaming components has far-reaching side effects. A simple rename requires a systematic, multi-step check to ensure the application remains stable. The following checklist is based on recent failures and must be followed for any renaming task.
0040
0041 **Example Scenario:** Renaming a view from `old_name` to `new_name`.
0042
0043 1. **Rename the View Function:**
0044 * In `views.py`, change `def old_name(request):` to `def new_name(request):`.
0045
0046 2. **Update URL Configuration (`urls.py`):**
0047 * **Update Import:** Change `from .views import old_name` to `from .views import new_name`.
0048 * **Update `path()`:** Change `path('...', old_name, ...)` to `path('...', new_name, ...)`.
0049 * **Update URL Name:** Change `name='old_name'` to `name='new_name'`. This is critical for template tags.
0050 * **Check URL Parameters:** Ensure any captured URL parameters (e.g., `<str:table_name>`) match the arguments in the new view function's signature.
0051
0052 3. **Update Templates (`*.html`):**
0053 * **Find and Replace `{% url %}` tags:** Search all templates for `{% url 'monitor_app:old_name' %}` and replace it with `{% url 'monitor_app:new_name' %}`.
0054 * **Rename Template File:** If the view renders a template with a corresponding name (e.g., `old_name.html`), rename the file to `new_name.html`.
0055
0056 4. **Global Code Search:**
0057 * Perform a project-wide search for the string `"old_name"` to find any other references in Python code, JavaScript, or comments.
0058
0059 5. **Verification:**
0060 * **Run `manage.py check`:** This is the most important step. It will catch most `ImportError`, `NameError`, and `NoReverseMatch` issues without needing to run the server.
0061 * **Restart and Test:** Only after the check passes, restart the server and manually test the affected pages.