From c1593938097ceb686483f5b8cf7dafdcebcb25e6 Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 12 Aug 2025 07:18:55 -0700 Subject: [PATCH 1/5] Add 500 error simulation middleware and HTMX integration --- .roomodes | 44 ++++++++++++ .../document_symbols_cache_v23-06-25.pkl | Bin 0 -> 2592 bytes .serena/project.yml | 68 ++++++++++++++++++ app/__init__.py | 23 ++++++ app/templates/base.html | 9 +++ 5 files changed, 144 insertions(+) create mode 100644 .roomodes create mode 100644 .serena/cache/python/document_symbols_cache_v23-06-25.pkl create mode 100644 .serena/project.yml diff --git a/.roomodes b/.roomodes new file mode 100644 index 0000000..03c56f3 --- /dev/null +++ b/.roomodes @@ -0,0 +1,44 @@ +customModes: + - slug: user-story-creator + name: 📝 User Story Creator + roleDefinition: | + You are an agile requirements specialist focused on creating clear, valuable user stories. Your expertise includes: + - Crafting well-structured user stories following the standard format + - Breaking down complex requirements into manageable stories + - Identifying acceptance criteria and edge cases + - Ensuring stories deliver business value + - Maintaining consistent story quality and granularity + whenToUse: | + Use this mode when you need to create user stories, break down requirements into manageable pieces, or define acceptance criteria for features. Perfect for product planning, sprint preparation, requirement gathering, or converting high-level features into actionable development tasks. + description: Create structured agile user stories + groups: + - read + - edit + - command + source: project + customInstructions: | + Expected User Story Format: + + Title: [Brief descriptive title] + + As a [specific user role/persona], + I want to [clear action/goal], + So that [tangible benefit/value]. + + Acceptance Criteria: + 1. [Criterion 1] + 2. [Criterion 2] + 3. [Criterion 3] + + Story Types to Consider: + - Functional Stories (user interactions and features) + - Non-functional Stories (performance, security, usability) + - Epic Breakdown Stories (smaller, manageable pieces) + - Technical Stories (architecture, infrastructure) + + Edge Cases and Considerations: + - Error scenarios + - Permission levels + - Data validation + - Performance requirements + - Security implications diff --git a/.serena/cache/python/document_symbols_cache_v23-06-25.pkl b/.serena/cache/python/document_symbols_cache_v23-06-25.pkl new file mode 100644 index 0000000000000000000000000000000000000000..4c85537e7b9017daa047272a643d20cebb09c76a GIT binary patch literal 2592 zcmb_d-*3`T6kf6-Fep=TW@^}`@nL3eg|N}#gT^13#wLr=#W&Ji+6(7qr6r|z{zyz* zO!i>zmTZi@u+x0!yXX7v`P$#wzm=th`0tn86h+eQ8ezaA+S}>=*gha$ zk4mxOlDfNFDev#Ordu|h=B`sMSDKZ2jqEkeYK6*%+*IwFPdbR#I)wT7bIg2KTDnMu z#BWon5UE~7!YKY%^O#Sil@nP9NJyNBhSFN#Vv%AOVj*wkK({o`MWIJM>O?H?KM$B- zX$V>1P#9LKA>#n^+>rV>naFs7LsWBo>>>}D6uT|v(HDkcK+vIvA4JSGTzX7?JTC(q&HR+r%Pkv!x|SW2YO zO8Q+w+R8&lJ?hIZqC-RZC9Ixv4!1`TE3tOM=^=hI~ zRk<hN@DnH(Rt$_NvXAYwp*}j!Da=No!T7N-8xIS9dg2x)-#WZ+D1K+L)9p zrYm!4x(=)iytnjA()CVV-Z=!<>%*{84WsEAcwM_jphnz~c+qds?JET_(N_}7W6nyh z{8yvC5=%}Ee9V+id+x56vLVI#f~q|Z5l-(qb$ ze%~R#KEc17=zcnde-eTGn4F_ISZdE^DSY95{}%hkC508xh@ma2N{{a(`wYfzH8!uQMMXf3zCF SfWs;LjXz#5;VAxi@tyxd>Y7vl literal 0 HcmV?d00001 diff --git a/.serena/project.yml b/.serena/project.yml new file mode 100644 index 0000000..888d339 --- /dev/null +++ b/.serena/project.yml @@ -0,0 +1,68 @@ +# language of the project (csharp, python, rust, java, typescript, go, cpp, or ruby) +# * For C, use cpp +# * For JavaScript, use typescript +# Special requirements: +# * csharp: Requires the presence of a .sln file in the project folder. +language: python + +# whether to use the project's gitignore file to ignore files +# Added on 2025-04-07 +ignore_all_files_in_gitignore: true +# list of additional paths to ignore +# same syntax as gitignore, so you can use * and ** +# Was previously called `ignored_dirs`, please update your config if you are using that. +# Added (renamed)on 2025-04-07 +ignored_paths: [] + +# whether the project is in read-only mode +# If set to true, all editing tools will be disabled and attempts to use them will result in an error +# Added on 2025-04-18 +read_only: false + + +# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details. +# Below is the complete list of tools for convenience. +# To make sure you have the latest list of tools, and to view their descriptions, +# execute `uv run scripts/print_tool_overview.py`. +# +# * `activate_project`: Activates a project by name. +# * `check_onboarding_performed`: Checks whether project onboarding was already performed. +# * `create_text_file`: Creates/overwrites a file in the project directory. +# * `delete_lines`: Deletes a range of lines within a file. +# * `delete_memory`: Deletes a memory from Serena's project-specific memory store. +# * `execute_shell_command`: Executes a shell command. +# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced. +# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type). +# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type). +# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes. +# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file. +# * `initial_instructions`: Gets the initial instructions for the current project. +# Should only be used in settings where the system prompt cannot be set, +# e.g. in clients you have no control over, like Claude Desktop. +# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol. +# * `insert_at_line`: Inserts content at a given line in a file. +# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol. +# * `list_dir`: Lists files and directories in the given directory (optionally with recursion). +# * `list_memories`: Lists memories in Serena's project-specific memory store. +# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building). +# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context). +# * `read_file`: Reads a file within the project directory. +# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store. +# * `remove_project`: Removes a project from the Serena configuration. +# * `replace_lines`: Replaces a range of lines within a file with new content. +# * `replace_symbol_body`: Replaces the full definition of a symbol. +# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen. +# * `search_for_pattern`: Performs a search for a pattern in the project. +# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase. +# * `switch_modes`: Activates modes by providing a list of their names +# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information. +# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task. +# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed. +# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store. +excluded_tools: [] + +# initial prompt for the project. It will always be given to the LLM upon activating the project +# (contrary to the memories, which are loaded on demand). +initial_prompt: "" + +project_name: "email-organizer" diff --git a/app/__init__.py b/app/__init__.py index fae8d2e..3853f63 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -11,10 +11,33 @@ login_manager.login_view = 'auth.login' login_manager.login_message = 'Please log in to access this page.' login_manager.login_message_category = 'warning' +from flask import Flask, request, make_response +from flask_sqlalchemy import SQLAlchemy +from flask_login import LoginManager +from config import config +from app.models import db, Base, User +from flask_migrate import Migrate + +# Initialize Flask-Login +login_manager = LoginManager() +login_manager.login_view = 'auth.login' +login_manager.login_message = 'Please log in to access this page.' +login_manager.login_message_category = 'warning' + + def create_app(config_name='default'): app = Flask(__name__, static_folder='static', static_url_path='/static') app.config.from_object(config[config_name]) + # Add middleware to simulate 500 errors + @app.before_request + def check_for_simulate_500(): + # Check if the X-Simulate-500 header is present + if request.headers.get('X-Simulate-500'): + response = make_response({'error': 'Simulated server error'}, 500) + response.headers['Content-Type'] = 'application/json' + return response + # Initialize extensions db.init_app(app) migrate = Migrate(app, db) diff --git a/app/templates/base.html b/app/templates/base.html index ec36c3b..874eb69 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -57,5 +57,14 @@ {% block content %}{% endblock %} {% block modal %}{% endblock %} + \ No newline at end of file From 93b5bc091ca8bdfa3a809e3df67bb98db389ba8a Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 12 Aug 2025 07:24:56 -0700 Subject: [PATCH 2/5] Add HTMX error handling with toast notifications for 5xx errors --- app/templates/base.html | 44 +++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/app/templates/base.html b/app/templates/base.html index 874eb69..51b449f 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -57,14 +57,46 @@ {% block content %}{% endblock %} {% block modal %}{% endblock %} + + + + + \ No newline at end of file From 3385a8b7cbd5a85615b89875031dbb008e6c37dd Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 12 Aug 2025 20:23:01 -0700 Subject: [PATCH 3/5] Improve toast notification styling and add X icon for closing --- app/templates/base.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/templates/base.html b/app/templates/base.html index 51b449f..9d0eca0 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -60,10 +60,12 @@ -