"""DevKit — Flask app factory.""" import os from flask import Flask from flask_wtf.csrf import CSRFProtect _csrf = CSRFProtect() def create_app(): app = Flask(__name__, template_folder="templates") app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "dev-devkit-2026") app.config["MAX_CONTENT_LENGTH"] = 30 * 1024 * 1024 _csrf.init_app(app) from app.home.routes import bp as home_bp app.register_blueprint(home_bp) from app.tools.schema_detective.routes import bp as schema_detective_bp app.register_blueprint(schema_detective_bp, url_prefix='/schema-detective') from app.tools.test_forge.routes import bp as test_forge_bp app.register_blueprint(test_forge_bp, url_prefix='/test-forge') from app.tools.sql_whisperer.routes import bp as sql_whisperer_bp app.register_blueprint(sql_whisperer_bp, url_prefix='/sql-whisperer') from app.tools.doc_forge.routes import bp as doc_forge_bp app.register_blueprint(doc_forge_bp, url_prefix='/doc-forge') from app.tools.changelog_ai.routes import bp as changelog_ai_bp app.register_blueprint(changelog_ai_bp, url_prefix='/changelog-ai') from app.tools.git_narrator.routes import bp as git_narrator_bp app.register_blueprint(git_narrator_bp, url_prefix='/git-narrator') from flask import jsonify @app.errorhandler(Exception) def _handle_exc(e): code = getattr(e, "code", 500) return jsonify({"error": str(e)}), code return app