├── backend
├── __init__.py
├── app
│ ├── __init__.py
│ ├── api
│ │ ├── __init__.py
│ │ ├── endpoints
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── auth.cpython-312.pyc
│ │ │ │ ├── chat.cpython-312.pyc
│ │ │ │ ├── admin.cpython-312.pyc
│ │ │ │ ├── judge.cpython-312.pyc
│ │ │ │ ├── teams.cpython-312.pyc
│ │ │ │ ├── users.cpython-312.pyc
│ │ │ │ ├── wallet.cpython-312.pyc
│ │ │ │ ├── __init__.cpython-312.pyc
│ │ │ │ ├── replays.cpython-312.pyc
│ │ │ │ ├── challenges.cpython-312.pyc
│ │ │ │ ├── enrollments.cpython-312.pyc
│ │ │ │ ├── leaderboard.cpython-312.pyc
│ │ │ │ ├── achievements.cpython-312.pyc
│ │ │ │ ├── skill_profiles.cpython-312.pyc
│ │ │ │ └── ai_generated_challenges.cpython-312.pyc
│ │ │ ├── teams.py
│ │ │ ├── users.py
│ │ │ ├── leaderboard.py
│ │ │ ├── challenges.py
│ │ │ ├── judge.py
│ │ │ ├── replays.py
│ │ │ ├── enrollments.py
│ │ │ ├── chat.py
│ │ │ ├── skill_profiles.py
│ │ │ ├── wallet.py
│ │ │ ├── achievements.py
│ │ │ └── ai_generated_challenges.py
│ │ ├── __pycache__
│ │ │ ├── api.cpython-312.pyc
│ │ │ └── __init__.cpython-312.pyc
│ │ └── api.py
│ ├── core
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── config.cpython-312.pyc
│ │ │ └── security.cpython-312.pyc
│ │ └── config.py
│ ├── db
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── base.cpython-312.pyc
│ │ │ ├── session.cpython-312.pyc
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── base_class.cpython-312.pyc
│ │ ├── base_class.py
│ │ ├── base.py
│ │ └── session.py
│ ├── models
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── team.cpython-312.pyc
│ │ │ ├── user.cpython-312.pyc
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── challenge.cpython-312.pyc
│ │ ├── team.py
│ │ ├── user.py
│ │ └── challenge.py
│ ├── services
│ │ ├── __init__.py
│ │ ├── ai_judge
│ │ │ ├── __init__.py
│ │ │ ├── rubric.py
│ │ │ └── code_quality.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── ai_judge_service.cpython-312.pyc
│ │ │ └── supabase_service.cpython-312.pyc
│ │ ├── config.py
│ │ ├── github_service.py
│ │ ├── ai_judge_service.py
│ │ └── supabase_service.py
│ ├── __pycache__
│ │ ├── main.cpython-312.pyc
│ │ └── __init__.cpython-312.pyc
│ ├── schemas
│ │ ├── __pycache__
│ │ │ ├── chat.cpython-312.pyc
│ │ │ ├── team.cpython-312.pyc
│ │ │ ├── user.cpython-312.pyc
│ │ │ ├── replay.cpython-312.pyc
│ │ │ ├── wallet.cpython-312.pyc
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── challenge.cpython-312.pyc
│ │ │ ├── enrollment.cpython-312.pyc
│ │ │ ├── achievement.cpython-312.pyc
│ │ │ ├── skill_profile.cpython-312.pyc
│ │ │ └── ai_generated_challenge.cpython-312.pyc
│ │ ├── skill_profile.py
│ │ ├── chat.py
│ │ ├── replay.py
│ │ ├── team.py
│ │ ├── achievement.py
│ │ ├── ai_generated_challenge.py
│ │ ├── enrollment.py
│ │ ├── __init__.py
│ │ ├── wallet.py
│ │ ├── user.py
│ │ └── challenge.py
│ └── main.py
├── db
│ ├── __init__.py
│ └── supabase.sql
├── finetune
│ ├── __init__.py
│ ├── strawberry-phi.parquet
│ ├── convert.py
│ └── readme.md
├── tests
│ ├── __init__.py
│ ├── api
│ │ └── __init__.py
│ ├── services
│ │ └── __init__.py
│ └── conftest.py
├── test.db
├── .env.example
├── Dockerfile
├── pyproject.toml
└── supabase-test.py
├── backend copy
├── app
│ ├── __init__.py
│ ├── api
│ │ ├── __init__.py
│ │ ├── endpoints
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── auth.cpython-312.pyc
│ │ │ │ ├── judge.cpython-312.pyc
│ │ │ │ ├── teams.cpython-312.pyc
│ │ │ │ ├── users.cpython-312.pyc
│ │ │ │ ├── __init__.cpython-312.pyc
│ │ │ │ ├── challenges.cpython-312.pyc
│ │ │ │ └── leaderboard.cpython-312.pyc
│ │ │ ├── teams.py
│ │ │ ├── users.py
│ │ │ ├── leaderboard.py
│ │ │ ├── challenges.py
│ │ │ ├── judge.py
│ │ │ └── auth.py
│ │ ├── __pycache__
│ │ │ ├── api.cpython-312.pyc
│ │ │ └── __init__.cpython-312.pyc
│ │ └── api.py
│ ├── core
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── config.cpython-312.pyc
│ │ │ └── security.cpython-312.pyc
│ │ ├── security.py
│ │ └── config.py
│ ├── db
│ │ ├── __init__.py
│ │ ├── base_class.py
│ │ ├── __pycache__
│ │ │ ├── base.cpython-312.pyc
│ │ │ ├── session.cpython-312.pyc
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── base_class.cpython-312.pyc
│ │ ├── base.py
│ │ └── session.py
│ ├── models
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── team.cpython-312.pyc
│ │ │ ├── user.cpython-312.pyc
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── challenge.cpython-312.pyc
│ │ ├── team.py
│ │ ├── user.py
│ │ └── challenge.py
│ ├── schemas
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── team.cpython-312.pyc
│ │ │ ├── user.cpython-312.pyc
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── challenge.cpython-312.pyc
│ │ ├── team.py
│ │ ├── user.py
│ │ └── challenge.py
│ ├── services
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── ai_judge_service.cpython-312.pyc
│ │ │ └── supabase_service.cpython-312.pyc
│ │ ├── github_service.py
│ │ ├── supabase_service.py
│ │ └── ai_judge_service.py
│ ├── __pycache__
│ │ ├── main.cpython-312.pyc
│ │ └── __init__.cpython-312.pyc
│ └── main.py
├── tests
│ ├── __init__.py
│ ├── api
│ │ └── __init__.py
│ ├── services
│ │ └── __init__.py
│ └── conftest.py
├── test.db
├── finetune
│ ├── strawberry-phi.parquet
│ ├── convert.py
│ └── readme.md
├── .env.example
├── Dockerfile
└── pyproject.toml
├── docs
├── governance
│ ├── founding_league_charter.md
│ ├── financial_management.md
│ ├── conflict_resolution.md
│ ├── decision_making.md
│ └── meritocracy.md
├── changelog.md
├── modules.md
├── performance.md
├── development-guidelines.md
├── environment.md
├── testing.md
└── prompts.md
├── bun.lockb
├── public
└── favicon.ico
├── gpt-engineer.toml
├── jsconfig.json
├── postcss.config.js
├── src
├── lib
│ └── utils.js
├── components
│ ├── ui
│ │ ├── aspect-ratio.jsx
│ │ ├── skeleton.jsx
│ │ ├── collapsible.jsx
│ │ ├── label.jsx
│ │ ├── textarea.jsx
│ │ ├── separator.jsx
│ │ ├── progress.jsx
│ │ ├── input.jsx
│ │ ├── sonner.jsx
│ │ ├── toaster.jsx
│ │ ├── checkbox.jsx
│ │ ├── slider.jsx
│ │ ├── switch.jsx
│ │ ├── tooltip.jsx
│ │ ├── badge.jsx
│ │ ├── hover-card.jsx
│ │ ├── avatar.jsx
│ │ ├── popover.jsx
│ │ ├── date-picker.jsx
│ │ ├── radio-group.jsx
│ │ ├── toggle.jsx
│ │ ├── toggle-group.jsx
│ │ ├── alert.jsx
│ │ ├── scroll-area.jsx
│ │ ├── card.jsx
│ │ ├── tabs.jsx
│ │ ├── resizable.jsx
│ │ ├── accordion.jsx
│ │ ├── button.jsx
│ │ └── input-otp.jsx
│ ├── SponsorSection.jsx
│ ├── CallToAction.jsx
│ ├── HeroSection.jsx
│ ├── ChallengeCard.jsx
│ ├── admin
│ │ ├── ChallengeList.jsx
│ │ ├── SecurityCompliance.jsx
│ │ ├── AnalyticsReporting.jsx
│ │ ├── SystemHealthTab.jsx
│ │ ├── SecurityTab.jsx
│ │ ├── SupportTab.jsx
│ │ ├── GamificationTab.jsx
│ │ ├── APIManagementTab.jsx
│ │ ├── EventsTab.jsx
│ │ ├── BackupRecoveryTab.jsx
│ │ ├── IntegrationsTab.jsx
│ │ ├── LeaderboardTab.jsx
│ │ ├── LocalizationTab.jsx
│ │ ├── NotificationsTab.jsx
│ │ ├── HomeTab.jsx
│ │ ├── modals
│ │ │ ├── BanUserModal.jsx
│ │ │ ├── ChatLogReviewModal.jsx
│ │ │ └── UserEditModal.jsx
│ │ └── SystemConfiguration.jsx
│ ├── Header.jsx
│ └── EnrollmentModal.jsx
├── main.jsx
├── nav-items.jsx
├── pages
│ ├── Index.jsx
│ ├── Analytics.jsx
│ ├── ForgotPassword.jsx
│ └── Home.jsx
├── integrations
│ └── supabase
│ │ ├── hooks
│ │ ├── ai_judging.js
│ │ ├── skill_profiles.js
│ │ ├── auth.js
│ │ ├── chat_messages.js
│ │ ├── wallet.js
│ │ ├── ai_generated_challenges.js
│ │ ├── transactions.js
│ │ ├── challenge_management.js
│ │ ├── replays.js
│ │ ├── profiles.js
│ │ ├── user_achievements.js
│ │ └── achievements.js
│ │ ├── supabase.js
│ │ └── auth.jsx
└── hooks
│ ├── useDocumentation.js
│ └── useOpenAI.js
├── .replit
├── .env
├── .gitignore
├── components.json
├── .gpt_engineer
├── get-user-snapshot.js
├── index.js
└── report-url-change.js
├── .eslintrc.cjs
├── vite.config.js
├── index.html
└── app
└── services
└── supabase_service.py
/backend/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/db/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/core/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/db/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/finetune/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/core/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/db/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/models/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/services/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/tests/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/models/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/schemas/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/app/services/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/tests/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/tests/services/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend copy/tests/services/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/services/ai_judge/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/governance/founding_league_charter.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__init__.py:
--------------------------------------------------------------------------------
1 | from . import judge
2 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__init__.py:
--------------------------------------------------------------------------------
1 | from . import judge
2 |
--------------------------------------------------------------------------------
/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/bun.lockb
--------------------------------------------------------------------------------
/backend/test.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/test.db
--------------------------------------------------------------------------------
/backend/tests/conftest.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | # Define fixtures for testing
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/backend copy/test.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/test.db
--------------------------------------------------------------------------------
/backend copy/tests/conftest.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | # Define fixtures for testing
4 |
--------------------------------------------------------------------------------
/gpt-engineer.toml:
--------------------------------------------------------------------------------
1 | [run]
2 | build = "npm run build"
3 |
4 | [gptengineer-app]
5 | project_id = "..."
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "paths": {
4 | "@/*": ["./src/*"]
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/backend/finetune/strawberry-phi.parquet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/finetune/strawberry-phi.parquet
--------------------------------------------------------------------------------
/backend copy/finetune/strawberry-phi.parquet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/finetune/strawberry-phi.parquet
--------------------------------------------------------------------------------
/backend/app/__pycache__/main.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/__pycache__/main.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/__pycache__/api.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/__pycache__/api.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/db/__pycache__/base.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/db/__pycache__/base.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/db/base_class.py:
--------------------------------------------------------------------------------
1 | # app/db/base_class.py
2 |
3 | from sqlalchemy.orm import declarative_base
4 |
5 | Base = declarative_base()
6 |
--------------------------------------------------------------------------------
/backend copy/app/__pycache__/main.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/__pycache__/main.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/db/base_class.py:
--------------------------------------------------------------------------------
1 | # app/db/base_class.py
2 |
3 | from sqlalchemy.orm import declarative_base
4 |
5 | Base = declarative_base()
6 |
--------------------------------------------------------------------------------
/backend/app/db/__pycache__/session.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/db/__pycache__/session.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/__pycache__/api.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/__pycache__/api.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/db/__pycache__/base.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/db/__pycache__/base.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/core/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/core/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/core/__pycache__/config.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/core/__pycache__/config.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/core/__pycache__/security.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/core/__pycache__/security.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/db/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/db/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/db/__pycache__/base_class.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/db/__pycache__/base_class.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/models/__pycache__/team.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/models/__pycache__/team.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/models/__pycache__/user.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/models/__pycache__/user.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/chat.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/chat.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/team.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/team.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/user.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/user.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/db/__pycache__/session.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/db/__pycache__/session.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/models/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/models/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/replay.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/replay.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/wallet.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/wallet.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/core/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/core/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/core/__pycache__/config.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/core/__pycache__/config.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/core/__pycache__/security.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/core/__pycache__/security.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/db/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/db/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/db/__pycache__/base_class.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/db/__pycache__/base_class.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/models/__pycache__/team.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/models/__pycache__/team.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/models/__pycache__/user.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/models/__pycache__/user.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/schemas/__pycache__/team.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/schemas/__pycache__/team.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/schemas/__pycache__/user.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/schemas/__pycache__/user.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/auth.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/auth.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/chat.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/chat.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/models/__pycache__/challenge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/models/__pycache__/challenge.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/challenge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/challenge.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/enrollment.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/enrollment.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/services/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/services/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/models/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/models/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/admin.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/admin.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/judge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/judge.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/teams.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/teams.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/users.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/users.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/wallet.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/wallet.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/achievement.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/achievement.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/auth.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/auth.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/models/__pycache__/challenge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/models/__pycache__/challenge.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/schemas/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/schemas/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/schemas/__pycache__/challenge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/schemas/__pycache__/challenge.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/services/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/services/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/replays.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/replays.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/skill_profile.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/skill_profile.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/judge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/judge.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/teams.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/teams.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/users.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/users.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/challenges.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/challenges.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/enrollments.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/enrollments.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/leaderboard.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/leaderboard.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/services/__pycache__/ai_judge_service.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/services/__pycache__/ai_judge_service.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/services/__pycache__/supabase_service.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/services/__pycache__/supabase_service.cpython-312.pyc
--------------------------------------------------------------------------------
/src/lib/utils.js:
--------------------------------------------------------------------------------
1 | import { clsx } from "clsx"
2 | import { twMerge } from "tailwind-merge"
3 |
4 | export function cn(...inputs) {
5 | return twMerge(clsx(inputs))
6 | }
7 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/__init__.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/__init__.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/achievements.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/achievements.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/skill_profiles.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/skill_profiles.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/challenges.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/challenges.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/__pycache__/leaderboard.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/api/endpoints/__pycache__/leaderboard.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/services/__pycache__/ai_judge_service.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/services/__pycache__/ai_judge_service.cpython-312.pyc
--------------------------------------------------------------------------------
/backend copy/app/services/__pycache__/supabase_service.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend copy/app/services/__pycache__/supabase_service.cpython-312.pyc
--------------------------------------------------------------------------------
/backend/app/schemas/__pycache__/ai_generated_challenge.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/schemas/__pycache__/ai_generated_challenge.cpython-312.pyc
--------------------------------------------------------------------------------
/src/components/ui/aspect-ratio.jsx:
--------------------------------------------------------------------------------
1 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
2 |
3 | const AspectRatio = AspectRatioPrimitive.Root
4 |
5 | export { AspectRatio }
6 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/__pycache__/ai_generated_challenges.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruvnet/aihl/HEAD/backend/app/api/endpoints/__pycache__/ai_generated_challenges.cpython-312.pyc
--------------------------------------------------------------------------------
/src/main.jsx:
--------------------------------------------------------------------------------
1 | import ReactDOM from "react-dom/client";
2 | import App from "./App.jsx";
3 | import "./index.css";
4 |
5 | ReactDOM.createRoot(document.getElementById("root")).render(
6 |
7 | );
8 |
--------------------------------------------------------------------------------
/backend/app/services/config.py:
--------------------------------------------------------------------------------
1 | judge_model_config = {
2 | "model": "gpt-4o-mini",
3 | "temperature": 0.2,
4 | "api_key_schema": "OPENAI_API_KEY",
5 | "max_tokens": 1000,
6 | "costs": (0.15, 0.6)
7 | }
--------------------------------------------------------------------------------
/backend/.env.example:
--------------------------------------------------------------------------------
1 | SUPABASE_URL=your_supabase_project_url
2 | SUPABASE_KEY=your_supabase_api_key
3 | GITHUB_TOKEN=your_github_token
4 | SECRET_KEY=your_secret_key
5 | ALGORITHM=HS256
6 | ACCESS_TOKEN_EXPIRE_MINUTES=30
7 | OPENAI_API_KEY=your_openai_api_key
8 |
--------------------------------------------------------------------------------
/backend copy/.env.example:
--------------------------------------------------------------------------------
1 | SUPABASE_URL=your_supabase_project_url
2 | SUPABASE_KEY=your_supabase_api_key
3 | GITHUB_TOKEN=your_github_token
4 | SECRET_KEY=your_secret_key
5 | ALGORITHM=HS256
6 | ACCESS_TOKEN_EXPIRE_MINUTES=30
7 | OPENAI_API_KEY=your_openai_api_key
8 |
--------------------------------------------------------------------------------
/.replit:
--------------------------------------------------------------------------------
1 | modules = ["nodejs-20", "web"]
2 | run = "npm run dev"
3 |
4 | [nix]
5 | channel = "stable-24_05"
6 |
7 | [deployment]
8 | run = ["sh", "-c", "npm run dev"]
9 | deploymentTarget = "cloudrun"
10 |
11 | [[ports]]
12 | localPort = 8080
13 | externalPort = 80
14 |
--------------------------------------------------------------------------------
/src/components/ui/skeleton.jsx:
--------------------------------------------------------------------------------
1 | import { cn } from "@/lib/utils"
2 |
3 | function Skeleton({
4 | className,
5 | ...props
6 | }) {
7 | return (
);
8 | }
9 |
10 | export { Skeleton }
11 |
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | VITE_SUPABASE_PROJECT_URL=https://hpkluyywkugnyouucvwr.supabase.co/
2 | VITE_SUPABASE_API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imhwa2x1eXl3a3VnbnlvdXVjdndyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjU3MjYzOTYsImV4cCI6MjA0MTMwMjM5Nn0.3jjJHqj2Q1-5o7zvgvlxCnaZPZKw9-UiqHF8DpZuy0Y
3 |
--------------------------------------------------------------------------------
/backend/app/db/base.py:
--------------------------------------------------------------------------------
1 | # app/db/base.py
2 |
3 | from app.db.base_class import Base # Import Base without causing circular imports
4 |
5 | # Import all models here for Alembic to recognize them
6 | from app.models.user import User
7 | from app.models.challenge import Challenge
8 | from app.models.team import Team
9 |
--------------------------------------------------------------------------------
/backend copy/app/db/base.py:
--------------------------------------------------------------------------------
1 | # app/db/base.py
2 |
3 | from app.db.base_class import Base # Import Base without causing circular imports
4 |
5 | # Import all models here for Alembic to recognize them
6 | from app.models.user import User
7 | from app.models.challenge import Challenge
8 | from app.models.team import Team
9 |
--------------------------------------------------------------------------------
/backend/app/services/github_service.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from app.core.config import settings
3 |
4 | # Define functions to interact with GitHub API
5 | # For example:
6 | def create_challenge_repo(challenge_id: str, title: str) -> str:
7 | # Logic to create a GitHub repository
8 | return "https://github.com/your-org/" + title
9 |
--------------------------------------------------------------------------------
/backend copy/app/services/github_service.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from app.core.config import settings
3 |
4 | # Define functions to interact with GitHub API
5 | # For example:
6 | def create_challenge_repo(challenge_id: str, title: str) -> str:
7 | # Logic to create a GitHub repository
8 | return "https://github.com/your-org/" + title
9 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/teams.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from typing import List
3 | from app.schemas.team import TeamCreate, TeamOut
4 |
5 | router = APIRouter()
6 |
7 | @router.get("/", response_model=List[TeamOut])
8 | async def list_teams():
9 | # List teams logic here
10 | return []
11 |
12 | # Additional endpoints...
13 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/teams.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from typing import List
3 | from app.schemas.team import TeamCreate, TeamOut
4 |
5 | router = APIRouter()
6 |
7 | @router.get("/", response_model=List[TeamOut])
8 | async def list_teams():
9 | # List teams logic here
10 | return []
11 |
12 | # Additional endpoints...
13 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/users.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from typing import List
3 | from app.schemas.user import UserOut
4 |
5 | router = APIRouter()
6 |
7 | @router.get("/{user_id}", response_model=UserOut)
8 | async def get_user_profile(user_id: str):
9 | # Get user profile logic here
10 | return {}
11 |
12 | # Additional endpoints...
13 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/users.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from typing import List
3 | from app.schemas.user import UserOut
4 |
5 | router = APIRouter()
6 |
7 | @router.get("/{user_id}", response_model=UserOut)
8 | async def get_user_profile(user_id: str):
9 | # Get user profile logic here
10 | return {}
11 |
12 | # Additional endpoints...
13 |
--------------------------------------------------------------------------------
/src/components/ui/collapsible.jsx:
--------------------------------------------------------------------------------
1 | import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
2 |
3 | const Collapsible = CollapsiblePrimitive.Root
4 |
5 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
6 |
7 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
8 |
9 | export { Collapsible, CollapsibleTrigger, CollapsibleContent }
10 |
--------------------------------------------------------------------------------
/src/nav-items.jsx:
--------------------------------------------------------------------------------
1 | import { HomeIcon } from "lucide-react";
2 | import Index from "./pages/Index.jsx";
3 |
4 | /**
5 | * Central place for defining the navigation items. Used for navigation components and routing.
6 | */
7 | export const navItems = [
8 | {
9 | title: "Home",
10 | to: "/",
11 | icon: ,
12 | page: ,
13 | },
14 | ];
15 |
--------------------------------------------------------------------------------
/backend copy/app/main.py:
--------------------------------------------------------------------------------
1 | # app/main.py
2 |
3 | from fastapi import FastAPI
4 | from app.api.api import api_router
5 | from app.db.session import engine
6 | from app.db.base import Base # This import registers all models
7 |
8 | # Create database tables
9 | Base.metadata.create_all(bind=engine)
10 |
11 | app = FastAPI(title="AI Hacking League Backend")
12 |
13 | app.include_router(api_router)
14 |
--------------------------------------------------------------------------------
/backend/app/schemas/skill_profile.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from typing import Dict
4 |
5 | class SkillProfileBase(BaseModel):
6 | user_id: UUID
7 | skills: Dict[str, int]
8 |
9 | class SkillProfileCreate(SkillProfileBase):
10 | pass
11 |
12 | class SkillProfileOut(SkillProfileBase):
13 | id: UUID
14 |
15 | class Config:
16 | from_attributes = True
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 | .env
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 | *auth.cpython*
26 | .venv/
27 | *__pycache__/
--------------------------------------------------------------------------------
/backend copy/app/schemas/team.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 |
5 | class TeamBase(BaseModel):
6 | name: str
7 | description: str
8 |
9 | class TeamCreate(TeamBase):
10 | pass
11 |
12 | class TeamOut(TeamBase):
13 | id: UUID
14 | created_by: UUID
15 | created_at: datetime
16 |
17 | class Config:
18 | from_attributes = True
19 |
--------------------------------------------------------------------------------
/backend/app/schemas/chat.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 |
5 | class ChatMessageBase(BaseModel):
6 | user_id: UUID
7 | content: str
8 |
9 | class ChatMessageCreate(ChatMessageBase):
10 | pass
11 |
12 | class ChatMessageOut(ChatMessageBase):
13 | id: UUID
14 | timestamp: datetime
15 |
16 | class Config:
17 | from_attributes = True
--------------------------------------------------------------------------------
/components.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://ui.shadcn.com/schema.json",
3 | "style": "default",
4 | "rsc": false,
5 | "tsx": false,
6 | "tailwind": {
7 | "config": "tailwind.config.js",
8 | "css": "src/index.css",
9 | "baseColor": "slate",
10 | "cssVariables": true,
11 | "prefix": ""
12 | },
13 | "aliases": {
14 | "components": "@/components",
15 | "utils": "@/lib/utils"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/backend copy/app/schemas/user.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel, EmailStr, Field
2 | from uuid import UUID
3 | from datetime import datetime
4 |
5 | class UserBase(BaseModel):
6 | username: str
7 | email: EmailStr
8 |
9 | class UserCreate(UserBase):
10 | password: str
11 |
12 | class UserOut(UserBase):
13 | id: UUID
14 | created_at: datetime
15 |
16 | class Config:
17 | from_attributes = True
18 |
--------------------------------------------------------------------------------
/backend/app/schemas/replay.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 |
5 | class ReplayBase(BaseModel):
6 | challenge_id: UUID
7 | user_id: UUID
8 | replay_data: str
9 |
10 | class ReplayCreate(ReplayBase):
11 | pass
12 |
13 | class ReplayOut(ReplayBase):
14 | id: UUID
15 | created_at: datetime
16 |
17 | class Config:
18 | from_attributes = True
--------------------------------------------------------------------------------
/backend/app/api/endpoints/leaderboard.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from typing import List
3 |
4 | router = APIRouter()
5 |
6 | @router.get("/")
7 | async def get_global_leaderboard():
8 | # Logic to get global leaderboard
9 | return []
10 |
11 | @router.get("/challenge/{challenge_id}")
12 | async def get_challenge_leaderboard(challenge_id: str):
13 | # Logic to get leaderboard for a specific challenge
14 | return []
15 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/leaderboard.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from typing import List
3 |
4 | router = APIRouter()
5 |
6 | @router.get("/")
7 | async def get_global_leaderboard():
8 | # Logic to get global leaderboard
9 | return []
10 |
11 | @router.get("/challenge/{challenge_id}")
12 | async def get_challenge_leaderboard(challenge_id: str):
13 | # Logic to get leaderboard for a specific challenge
14 | return []
15 |
--------------------------------------------------------------------------------
/.gpt_engineer/get-user-snapshot.js:
--------------------------------------------------------------------------------
1 | import { toPng } from "html-to-image";
2 |
3 | export const loadGetUserSnapshotEventListener = () => {
4 | window.addEventListener("blur", () => {
5 | toPng(document.body).then((url) => {
6 | window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "http://localhost:3000");
7 | window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "https://gptengineer.app");
8 | });
9 | });
10 | };
11 |
--------------------------------------------------------------------------------
/.gpt_engineer/index.js:
--------------------------------------------------------------------------------
1 | import { loadGetUserSnapshotEventListener } from "./get-user-snapshot";
2 | import { loadReportUrlChangeEventListener } from "./report-url-change";
3 | import { loadReportErrorEventListener } from "./report-error";
4 |
5 | const main = () => {
6 | if (window.top === window.self) {
7 | return;
8 | }
9 | loadGetUserSnapshotEventListener();
10 | loadReportUrlChangeEventListener();
11 | loadReportErrorEventListener();
12 | };
13 |
14 | main();
15 |
--------------------------------------------------------------------------------
/backend/app/db/session.py:
--------------------------------------------------------------------------------
1 | # app/db/session.py
2 |
3 | from sqlalchemy import create_engine
4 | from sqlalchemy.orm import sessionmaker
5 | from app.db.base_class import Base # Import Base if necessary
6 |
7 | SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db" # Use SQLite for simplicity
8 |
9 | engine = create_engine(
10 | SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
11 | )
12 |
13 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
14 |
--------------------------------------------------------------------------------
/backend copy/app/db/session.py:
--------------------------------------------------------------------------------
1 | # app/db/session.py
2 |
3 | from sqlalchemy import create_engine
4 | from sqlalchemy.orm import sessionmaker
5 | from app.db.base_class import Base # Import Base if necessary
6 |
7 | SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db" # Use SQLite for simplicity
8 |
9 | engine = create_engine(
10 | SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
11 | )
12 |
13 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
14 |
--------------------------------------------------------------------------------
/backend/finetune/convert.py:
--------------------------------------------------------------------------------
1 | import pyarrow.parquet as pq
2 | import pandas as pd
3 | import sys
4 |
5 | # Read the Parquet file
6 | parquet_file = sys.argv[1] # Pass the Parquet file path as an argument
7 | table = pq.read_table(parquet_file)
8 |
9 | # Convert to pandas DataFrame
10 | df = table.to_pandas()
11 |
12 | # Convert to JSONL and save
13 | output_file = 'output.jsonl'
14 | df.to_json(output_file, orient='records', lines=True)
15 |
16 | print(f"Conversion complete. JSONL file saved as {output_file}")
17 |
--------------------------------------------------------------------------------
/backend copy/finetune/convert.py:
--------------------------------------------------------------------------------
1 | import pyarrow.parquet as pq
2 | import pandas as pd
3 | import sys
4 |
5 | # Read the Parquet file
6 | parquet_file = sys.argv[1] # Pass the Parquet file path as an argument
7 | table = pq.read_table(parquet_file)
8 |
9 | # Convert to pandas DataFrame
10 | df = table.to_pandas()
11 |
12 | # Convert to JSONL and save
13 | output_file = 'output.jsonl'
14 | df.to_json(output_file, orient='records', lines=True)
15 |
16 | print(f"Conversion complete. JSONL file saved as {output_file}")
17 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/challenges.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException, status
2 | from typing import List
3 | from app.schemas.challenge import ChallengeCreate, ChallengeOut
4 | from app.services.supabase_service import supabase_client
5 | from app.models.challenge import Challenge
6 |
7 | router = APIRouter()
8 |
9 | @router.get("/", response_model=List[ChallengeOut])
10 | async def list_challenges():
11 | # List challenges logic here
12 | return []
13 |
14 | # Additional endpoints...
15 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/challenges.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException, status
2 | from typing import List
3 | from app.schemas.challenge import ChallengeCreate, ChallengeOut
4 | from app.services.supabase_service import supabase_client
5 | from app.models.challenge import Challenge
6 |
7 | router = APIRouter()
8 |
9 | @router.get("/", response_model=List[ChallengeOut])
10 | async def list_challenges():
11 | # List challenges logic here
12 | return []
13 |
14 | # Additional endpoints...
15 |
--------------------------------------------------------------------------------
/src/pages/Index.jsx:
--------------------------------------------------------------------------------
1 | // Update this page (the content is just a fallback if you fail to update the page)
2 |
3 | const Index = () => {
4 | return (
5 |
6 |
7 |
Welcome to Your Blank App
8 |
Start building your amazing project here!
9 |
10 |
11 | );
12 | };
13 |
14 | export default Index;
15 |
--------------------------------------------------------------------------------
/backend/finetune/readme.md:
--------------------------------------------------------------------------------
1 | # finetune
2 |
3 | ```
4 | import pyarrow.parquet as pq
5 | import pandas as pd
6 | import sys
7 |
8 | # Read the Parquet file
9 | parquet_file = sys.argv[1] # Pass the Parquet file path as an argument
10 | table = pq.read_table(parquet_file)
11 |
12 | # Convert to pandas DataFrame
13 | df = table.to_pandas()
14 |
15 | # Convert to JSONL and save
16 | output_file = 'output.jsonl'
17 | df.to_json(output_file, orient='records', lines=True)
18 |
19 | print(f"Conversion complete. JSONL file saved as {output_file}")
20 | ```
21 |
--------------------------------------------------------------------------------
/backend copy/finetune/readme.md:
--------------------------------------------------------------------------------
1 | # finetune
2 |
3 | ```
4 | import pyarrow.parquet as pq
5 | import pandas as pd
6 | import sys
7 |
8 | # Read the Parquet file
9 | parquet_file = sys.argv[1] # Pass the Parquet file path as an argument
10 | table = pq.read_table(parquet_file)
11 |
12 | # Convert to pandas DataFrame
13 | df = table.to_pandas()
14 |
15 | # Convert to JSONL and save
16 | output_file = 'output.jsonl'
17 | df.to_json(output_file, orient='records', lines=True)
18 |
19 | print(f"Conversion complete. JSONL file saved as {output_file}")
20 | ```
21 |
--------------------------------------------------------------------------------
/backend copy/app/core/security.py:
--------------------------------------------------------------------------------
1 | from datetime import datetime, timedelta
2 | from jose import jwt
3 | from app.core.config import settings
4 |
5 | def create_access_token(data: dict, expires_delta: timedelta = None):
6 | to_encode = data.copy()
7 | expire = datetime.utcnow() + expires_delta if expires_delta else datetime.utcnow() + timedelta(minutes=settings.ACCESS_TOKEN_EXPIRE_MINUTES)
8 | to_encode.update({"exp": expire})
9 | encoded_jwt = jwt.encode(to_encode, settings.SECRET_KEY, algorithm=settings.ALGORITHM)
10 | return encoded_jwt
11 |
--------------------------------------------------------------------------------
/backend/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import FastAPI, Request
2 | from fastapi.responses import RedirectResponse
3 | from app.api.api import api_router
4 | from app.db.session import engine
5 | from app.db.base import Base # This import registers all models
6 |
7 | # Create database tables
8 | Base.metadata.create_all(bind=engine)
9 |
10 | app = FastAPI(title="AI Hacking League Backend")
11 |
12 | app.include_router(api_router)
13 |
14 | @app.post("/token")
15 | async def token_redirect(request: Request):
16 | return RedirectResponse(url="/auth/login", status_code=307)
--------------------------------------------------------------------------------
/backend/app/schemas/team.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 |
6 | class TeamBase(BaseModel):
7 | name: str
8 | description: str
9 |
10 | class TeamCreate(TeamBase):
11 | pass
12 |
13 | class TeamOut(TeamBase):
14 | id: UUID
15 | created_by: UUID
16 | created_at: datetime
17 |
18 | class Config:
19 | from_attributes = True
20 |
21 | class TeamUpdate(TeamBase):
22 | name: Optional[str] = None
23 | description: Optional[str] = None
24 |
--------------------------------------------------------------------------------
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: { browser: true, es2020: true },
4 | extends: [
5 | "eslint:recommended",
6 | "plugin:react/recommended",
7 | "plugin:react/jsx-runtime",
8 | "plugin:react-hooks/recommended",
9 | ],
10 | ignorePatterns: ["dist", ".eslintrc.cjs"],
11 | parserOptions: { ecmaVersion: "latest", sourceType: "module" },
12 | settings: { react: { version: "18.2" } },
13 | plugins: ["react-refresh"],
14 | rules: {
15 | "react/jsx-no-target-blank": "off",
16 | "react/prop-types": "off",
17 | },
18 | };
19 |
--------------------------------------------------------------------------------
/backend/app/schemas/achievement.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 |
6 | class AchievementBase(BaseModel):
7 | name: str
8 | description: str
9 |
10 | class AchievementCreate(AchievementBase):
11 | pass
12 |
13 | class AchievementOut(AchievementBase):
14 | id: UUID
15 | created_at: datetime
16 |
17 | class Config:
18 | from_attributes = True
19 |
20 | class AchievementUpdate(AchievementBase):
21 | name: Optional[str] = None
22 | description: Optional[str] = None
23 |
--------------------------------------------------------------------------------
/src/components/ui/label.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as LabelPrimitive from "@radix-ui/react-label"
3 | import { cva } from "class-variance-authority";
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const labelVariants = cva(
8 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
9 | )
10 |
11 | const Label = React.forwardRef(({ className, ...props }, ref) => (
12 |
13 | ))
14 | Label.displayName = LabelPrimitive.Root.displayName
15 |
16 | export { Label }
17 |
--------------------------------------------------------------------------------
/backend/app/schemas/ai_generated_challenge.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 | from .challenge import DifficultyEnum
6 |
7 | class AIGeneratedChallengeBase(BaseModel):
8 | title: str
9 | description: str
10 | difficulty: DifficultyEnum
11 | ai_prompt: str
12 |
13 | class AIGeneratedChallengeCreate(AIGeneratedChallengeBase):
14 | pass
15 |
16 | class AIGeneratedChallengeOut(AIGeneratedChallengeBase):
17 | id: UUID
18 | created_at: datetime
19 |
20 | class Config:
21 | from_attributes = True
--------------------------------------------------------------------------------
/vite.config.js:
--------------------------------------------------------------------------------
1 | import { fileURLToPath, URL } from "url";
2 | import { defineConfig } from "vite";
3 | import react from "@vitejs/plugin-react";
4 | import { resolve } from "path";
5 |
6 | // https://vitejs.dev/config/
7 | export default defineConfig({
8 | server: {
9 | host: "::",
10 | port: "8080",
11 | },
12 | plugins: [react()],
13 | resolve: {
14 | alias: [
15 | {
16 | find: "@",
17 | replacement: fileURLToPath(new URL("./src", import.meta.url)),
18 | },
19 | {
20 | find: "lib",
21 | replacement: resolve(__dirname, "lib"),
22 | },
23 | ],
24 | },
25 | });
26 |
--------------------------------------------------------------------------------
/backend copy/app/core/config.py:
--------------------------------------------------------------------------------
1 | # app/core/config.py
2 |
3 | import os
4 | from dotenv import load_dotenv
5 |
6 | load_dotenv()
7 |
8 | class Settings:
9 | OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY", "")
10 | SUPABASE_URL: str = os.getenv("SUPABASE_URL", "")
11 | SUPABASE_KEY: str = os.getenv("SUPABASE_KEY", "")
12 | GITHUB_TOKEN: str = os.getenv("GITHUB_TOKEN", "")
13 | SECRET_KEY: str = os.getenv("SECRET_KEY", "your-secret-key")
14 | ALGORITHM: str = os.getenv("ALGORITHM", "HS256")
15 | ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
16 |
17 | settings = Settings()
18 |
--------------------------------------------------------------------------------
/backend/app/schemas/enrollment.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 |
6 | class EnrollmentBase(BaseModel):
7 | user_id: UUID
8 | challenge_id: UUID
9 | team_id: Optional[UUID] = None
10 | status: str = "enrolled"
11 |
12 | class EnrollmentCreate(EnrollmentBase):
13 | pass
14 |
15 | class EnrollmentOut(EnrollmentBase):
16 | id: UUID
17 | score: Optional[float] = None
18 | submitted_at: Optional[datetime] = None
19 | created_at: datetime
20 | updated_at: datetime
21 |
22 | class Config:
23 | from_attributes = True
--------------------------------------------------------------------------------
/backend copy/app/api/api.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from app.api.endpoints import auth, challenges, leaderboard, teams, users, judge
3 |
4 | api_router = APIRouter()
5 | api_router.include_router(auth.router, prefix="/auth", tags=["auth"])
6 | api_router.include_router(challenges.router, prefix="/challenges", tags=["challenges"])
7 | api_router.include_router(leaderboard.router, prefix="/leaderboard", tags=["leaderboard"])
8 | api_router.include_router(teams.router, prefix="/teams", tags=["teams"])
9 | api_router.include_router(users.router, prefix="/users", tags=["users"])
10 | api_router.include_router(judge.router, prefix="/judge", tags=["judge"])
11 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | AI Hacker League
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/backend/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use an official Python runtime as a parent image
2 | FROM python:3.9-slim
3 |
4 | # Set the working directory in the container
5 | WORKDIR /app
6 |
7 | # Copy the current directory contents into the container at /app
8 | COPY . /app
9 |
10 | # Install any needed packages specified in poetry
11 | RUN pip install --no-cache-dir poetry
12 | RUN poetry config virtualenvs.create false
13 | RUN poetry install --no-dev --no-interaction --no-ansi
14 |
15 | # Make port 8000 available to the world outside this container
16 | EXPOSE 8000
17 |
18 | # Run app.main:app when the container launches
19 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
20 |
--------------------------------------------------------------------------------
/backend copy/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use an official Python runtime as a parent image
2 | FROM python:3.9-slim
3 |
4 | # Set the working directory in the container
5 | WORKDIR /app
6 |
7 | # Copy the current directory contents into the container at /app
8 | COPY . /app
9 |
10 | # Install any needed packages specified in poetry
11 | RUN pip install --no-cache-dir poetry
12 | RUN poetry config virtualenvs.create false
13 | RUN poetry install --no-dev --no-interaction --no-ansi
14 |
15 | # Make port 8000 available to the world outside this container
16 | EXPOSE 8000
17 |
18 | # Run app.main:app when the container launches
19 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
20 |
--------------------------------------------------------------------------------
/backend copy/app/services/supabase_service.py:
--------------------------------------------------------------------------------
1 | # app/services/supabase_service.py
2 |
3 | from supabase import create_client, Client
4 | from app.core.config import settings
5 |
6 | def get_supabase_client() -> Client:
7 | try:
8 | if settings.SUPABASE_URL and settings.SUPABASE_KEY:
9 | return create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY)
10 | else:
11 | print("Warning: Supabase URL or Key is missing.")
12 | return None
13 | except Exception as e:
14 | print(f"An error occurred while initializing Supabase client: {e}")
15 | return None
16 |
17 | # Initialize the Supabase client
18 | supabase_client = get_supabase_client()
19 |
--------------------------------------------------------------------------------
/src/components/ui/textarea.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 |
3 | import { cn } from "@/lib/utils"
4 |
5 | const Textarea = React.forwardRef(({ className, ...props }, ref) => {
6 | return (
7 | ()
14 | );
15 | })
16 | Textarea.displayName = "Textarea"
17 |
18 | export { Textarea }
19 |
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/ai_judging.js:
--------------------------------------------------------------------------------
1 | import { useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | export const useEvaluateSubmission = () => {
5 | const queryClient = useQueryClient();
6 | return useMutation({
7 | mutationFn: async ({ challengeId, userId, code }) => {
8 | const { data, error } = await supabase.functions.invoke('evaluate-submission', {
9 | body: { challengeId, userId, code },
10 | });
11 | if (error) throw error;
12 | return data;
13 | },
14 | onSuccess: (_, variables) => {
15 | queryClient.invalidateQueries(['challenge-results', variables.challengeId]);
16 | },
17 | });
18 | };
--------------------------------------------------------------------------------
/docs/changelog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [Unreleased]
4 | ### Added
5 | - Feature: AI-powered code evaluation
6 | - Real-time collaboration tools
7 | - Dynamic leaderboards
8 |
9 | ### Changed
10 | - Improved performance of challenge submission process
11 | - Updated OpenAI integration to use GPT-4
12 |
13 | ### Fixed
14 | - Bug in team creation process
15 | - Issue with real-time updates in leaderboard
16 |
17 | ## [1.0.0] - 2023-04-01
18 | ### Added
19 | - Initial release of AI Hacking League platform
20 | - Basic challenge management
21 | - User authentication and profiles
22 | - Team formation functionality
23 |
24 | ### Security
25 | - Implemented JWT for secure authentication
26 | - Added rate limiting to API endpoints
--------------------------------------------------------------------------------
/src/components/ui/separator.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as SeparatorPrimitive from "@radix-ui/react-separator"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Separator = React.forwardRef((
7 | { className, orientation = "horizontal", decorative = true, ...props },
8 | ref
9 | ) => (
10 |
20 | ))
21 | Separator.displayName = SeparatorPrimitive.Root.displayName
22 |
23 | export { Separator }
24 |
--------------------------------------------------------------------------------
/src/components/ui/progress.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as ProgressPrimitive from "@radix-ui/react-progress"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Progress = React.forwardRef(({ className, value, ...props }, ref) => (
7 |
11 |
14 |
15 | ))
16 | Progress.displayName = ProgressPrimitive.Root.displayName
17 |
18 | export { Progress }
19 |
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/skill_profiles.js:
--------------------------------------------------------------------------------
1 | import { useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | export const useUpdateSkillProfile = () => {
5 | const queryClient = useQueryClient();
6 | return useMutation({
7 | mutationFn: async ({ userId, skillName, skillLevel }) => {
8 | const { data, error } = await supabase
9 | .from('skill_profiles')
10 | .upsert({ user_id: userId, skill_name: skillName, skill_level: skillLevel });
11 | if (error) throw error;
12 | return data;
13 | },
14 | onSuccess: (_, variables) => {
15 | queryClient.invalidateQueries(['skill-profile', variables.userId]);
16 | },
17 | });
18 | };
--------------------------------------------------------------------------------
/backend copy/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.poetry]
2 | name = "ai-hacking-league-backend"
3 | version = "0.1.0"
4 | description = "Backend for the AI Hacking League application"
5 | authors = ["Your Name "]
6 | readme = "README.md"
7 |
8 | [tool.poetry.dependencies]
9 | python = "^3.9"
10 | fastapi = {extras = ["all"], version = "^0.114.2"}
11 | pydantic = ">=2.0,<3.0"
12 | supabase = "^2.7.4"
13 | pyjwt = "^2.9.0"
14 | requests = "^2.32.3"
15 | python-dotenv = "^1.0.1"
16 | sqlalchemy = "^2.0.34"
17 | openai = "^1.45.0"
18 |
19 |
20 | [tool.poetry.group.dev.dependencies]
21 | pytest = "^8.3.3"
22 | pytest-asyncio = "^0.24.0"
23 |
24 | [build-system]
25 | requires = ["poetry-core"]
26 | build-backend = "poetry.core.masonry.api"
27 |
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/judge.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, UploadFile, File, Depends, HTTPException, status
2 | from app.services.ai_judge_service import evaluate_code_submission
3 | from typing import Any
4 |
5 | router = APIRouter()
6 |
7 | @router.post("/submit", response_model=dict)
8 | async def submit_code(file: UploadFile = File(...)) -> Any:
9 | try:
10 | contents = await file.read()
11 | code = contents.decode('utf-8')
12 | evaluation = evaluate_code_submission(code)
13 | if "error" in evaluation:
14 | raise HTTPException(status_code=500, detail=evaluation["error"])
15 | return evaluation
16 | except Exception as e:
17 | raise HTTPException(status_code=500, detail=str(e))
18 |
--------------------------------------------------------------------------------
/backend/app/models/team.py:
--------------------------------------------------------------------------------
1 | # app/models/team.py
2 |
3 | from sqlalchemy import Column, String, DateTime, ForeignKey
4 | from sqlalchemy.dialects.postgresql import UUID
5 | from sqlalchemy.sql import func
6 | import uuid
7 | from app.db.base_class import Base # Import Base directly from base_class.py
8 |
9 | class Team(Base):
10 | __tablename__ = "teams"
11 |
12 | id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
13 | name = Column(String, unique=True, index=True)
14 | description = Column(String)
15 | created_by = Column(UUID(as_uuid=True), ForeignKey("users.id"))
16 | created_at = Column(DateTime(timezone=True), server_default=func.now())
17 | updated_at = Column(DateTime(timezone=True), onupdate=func.now())
18 |
--------------------------------------------------------------------------------
/backend copy/app/models/team.py:
--------------------------------------------------------------------------------
1 | # app/models/team.py
2 |
3 | from sqlalchemy import Column, String, DateTime, ForeignKey
4 | from sqlalchemy.dialects.postgresql import UUID
5 | from sqlalchemy.sql import func
6 | import uuid
7 | from app.db.base_class import Base # Import Base directly from base_class.py
8 |
9 | class Team(Base):
10 | __tablename__ = "teams"
11 |
12 | id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
13 | name = Column(String, unique=True, index=True)
14 | description = Column(String)
15 | created_by = Column(UUID(as_uuid=True), ForeignKey("users.id"))
16 | created_at = Column(DateTime(timezone=True), server_default=func.now())
17 | updated_at = Column(DateTime(timezone=True), onupdate=func.now())
18 |
--------------------------------------------------------------------------------
/app/services/supabase_service.py:
--------------------------------------------------------------------------------
1 | from supabase import create_client, Client
2 | from app.core.config import settings
3 | import logging
4 |
5 | logger = logging.getLogger(__name__)
6 |
7 | def get_supabase_client() -> Client:
8 | try:
9 | if settings.SUPABASE_URL and settings.SUPABASE_KEY:
10 | # Removed 'is_async=True' parameter
11 | return create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY)
12 | else:
13 | logger.error("Supabase URL or Key is missing.")
14 | return None
15 | except Exception as e:
16 | logger.error(f"An error occurred while initializing Supabase client: {e}")
17 | return None
18 |
19 | # Initialize the Supabase client
20 | supabase_client = get_supabase_client()
--------------------------------------------------------------------------------
/backend/app/api/endpoints/judge.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, UploadFile, File, HTTPException
2 | from app.services.ai_judge_service import evaluate_code_submission
3 | from typing import Any
4 |
5 | router = APIRouter()
6 |
7 | @router.post("/submit", response_model=dict)
8 | async def submit_code(file: UploadFile = File(...), language: str = "Python") -> Any:
9 | try:
10 | contents = await file.read()
11 | code = contents.decode('utf-8')
12 | evaluation = evaluate_code_submission(code, language)
13 | if "error" in evaluation:
14 | raise HTTPException(status_code=500, detail=evaluation["error"])
15 | return evaluation
16 | except Exception as e:
17 | raise HTTPException(status_code=500, detail=str(e))
18 |
--------------------------------------------------------------------------------
/src/components/SponsorSection.jsx:
--------------------------------------------------------------------------------
1 | export const SponsorSection = () => {
2 | const sponsors = [
3 | "OpenAI", "Google Cloud", "Microsoft Azure", "AWS", "NVIDIA", "IBM Watson"
4 | ];
5 |
6 | return (
7 |
8 |
9 |
Powered by Industry Leaders
10 |
11 | {sponsors.map((sponsor, index) => (
12 |
13 | {sponsor}
14 |
15 | ))}
16 |
17 |
18 |
19 | );
20 | };
--------------------------------------------------------------------------------
/src/components/ui/input.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 |
3 | import { cn } from "@/lib/utils"
4 |
5 | const Input = React.forwardRef(({ className, type, ...props }, ref) => {
6 | return (
7 | ( )
15 | );
16 | })
17 | Input.displayName = "Input"
18 |
19 | export { Input }
20 |
--------------------------------------------------------------------------------
/backend/app/schemas/__init__.py:
--------------------------------------------------------------------------------
1 | from .user import UserBase, UserCreate, UserOut
2 | from .challenge import ChallengeBase, ChallengeCreate, ChallengeOut, DifficultyEnum
3 | from .team import TeamBase, TeamCreate, TeamOut
4 | from .enrollment import EnrollmentBase, EnrollmentCreate, EnrollmentOut
5 | from .achievement import AchievementBase, AchievementCreate, AchievementOut
6 | from .chat import ChatMessageBase, ChatMessageCreate, ChatMessageOut
7 | from .replay import ReplayBase, ReplayCreate, ReplayOut
8 | from .wallet import WalletBase, WalletCreate, WalletOut, TransactionBase, TransactionCreate, TransactionOut
9 | from .skill_profile import SkillProfileBase, SkillProfileCreate, SkillProfileOut
10 | from .ai_generated_challenge import AIGeneratedChallengeBase, AIGeneratedChallengeCreate, AIGeneratedChallengeOut
--------------------------------------------------------------------------------
/backend/app/schemas/wallet.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 |
6 | class WalletBase(BaseModel):
7 | user_id: UUID
8 | balance: float = 0.0
9 |
10 | class WalletCreate(WalletBase):
11 | pass
12 |
13 | class WalletOut(WalletBase):
14 | id: UUID
15 | created_at: datetime
16 | updated_at: datetime
17 |
18 | class Config:
19 | from_attributes = True
20 |
21 | class TransactionBase(BaseModel):
22 | wallet_id: UUID
23 | amount: float
24 | type: str
25 |
26 | class TransactionCreate(TransactionBase):
27 | pass
28 |
29 | class TransactionOut(TransactionBase):
30 | id: UUID
31 | timestamp: datetime
32 |
33 | class Config:
34 | from_attributes = True
--------------------------------------------------------------------------------
/backend copy/app/schemas/challenge.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel, Field
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 | from enum import Enum
6 |
7 | class DifficultyEnum(str, Enum):
8 | Easy = "Easy"
9 | Medium = "Medium"
10 | Hard = "Hard"
11 | Expert = "Expert"
12 |
13 | class ChallengeBase(BaseModel):
14 | title: str
15 | description: str
16 | difficulty: DifficultyEnum
17 | start_time: datetime
18 | end_time: datetime
19 | max_participants: int
20 |
21 | class ChallengeCreate(ChallengeBase):
22 | pass
23 |
24 | class ChallengeOut(ChallengeBase):
25 | id: UUID
26 | current_participants: int
27 | github_repo_url: Optional[str]
28 | created_at: datetime
29 |
30 | class Config:
31 | from_attributes = True
32 |
--------------------------------------------------------------------------------
/backend/app/models/user.py:
--------------------------------------------------------------------------------
1 | # app/models/user.py
2 |
3 | from sqlalchemy import Column, String, Boolean, DateTime
4 | from sqlalchemy.dialects.postgresql import UUID
5 | from sqlalchemy.sql import func
6 | import uuid
7 | from app.db.base_class import Base # Import Base directly from base_class.py
8 |
9 | class User(Base):
10 | __tablename__ = "users"
11 |
12 | id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
13 | username = Column(String, unique=True, index=True)
14 | email = Column(String, unique=True, index=True)
15 | hashed_password = Column(String)
16 | is_active = Column(Boolean, default=True)
17 | is_superuser = Column(Boolean, default=False)
18 | created_at = Column(DateTime(timezone=True), server_default=func.now())
19 | updated_at = Column(DateTime(timezone=True), onupdate=func.now())
20 |
--------------------------------------------------------------------------------
/backend copy/app/models/user.py:
--------------------------------------------------------------------------------
1 | # app/models/user.py
2 |
3 | from sqlalchemy import Column, String, Boolean, DateTime
4 | from sqlalchemy.dialects.postgresql import UUID
5 | from sqlalchemy.sql import func
6 | import uuid
7 | from app.db.base_class import Base # Import Base directly from base_class.py
8 |
9 | class User(Base):
10 | __tablename__ = "users"
11 |
12 | id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
13 | username = Column(String, unique=True, index=True)
14 | email = Column(String, unique=True, index=True)
15 | hashed_password = Column(String)
16 | is_active = Column(Boolean, default=True)
17 | is_superuser = Column(Boolean, default=False)
18 | created_at = Column(DateTime(timezone=True), server_default=func.now())
19 | updated_at = Column(DateTime(timezone=True), onupdate=func.now())
20 |
--------------------------------------------------------------------------------
/backend/db/supabase.sql:
--------------------------------------------------------------------------------
1 | -- Enable RLS on users table
2 | ALTER TABLE users ENABLE ROW LEVEL SECURITY;
3 |
4 | -- Drop existing policies if they exist
5 | DROP POLICY IF EXISTS "Users can view own profile" ON users;
6 | DROP POLICY IF EXISTS "Users can insert own profile" ON users;
7 | DROP POLICY IF EXISTS "Users can update own profile" ON users;
8 |
9 | -- Create policies for users table
10 | CREATE POLICY "Users can view own profile" ON users
11 | FOR SELECT USING (auth.uid() = id);
12 |
13 | CREATE POLICY "Users can insert own profile" ON users
14 | FOR INSERT WITH CHECK (auth.uid() = id);
15 |
16 | CREATE POLICY "Users can update own profile" ON users
17 | FOR UPDATE USING (auth.uid() = id);
18 |
19 | -- Allow public access for user registration
20 | CREATE POLICY "Allow public insert for registration" ON users
21 | FOR INSERT WITH CHECK (true);
22 |
--------------------------------------------------------------------------------
/src/components/CallToAction.jsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@/components/ui/button";
2 | import { Link } from 'react-router-dom';
3 |
4 | export const CallToAction = () => (
5 |
6 |
7 |
Ready to Code for High Stakes?
8 |
9 | Join thousands of AI developers in the ultimate speed coding challenge.
10 | Prove your skills and compete for substantial cash prizes!
11 |
12 |
13 | Sign Up Now
14 |
15 |
16 |
17 | );
--------------------------------------------------------------------------------
/backend/app/schemas/user.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel, EmailStr, Field
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 |
6 | class UserBase(BaseModel):
7 | username: str
8 | email: EmailStr
9 |
10 | class UserCreate(UserBase):
11 | password: str
12 |
13 | class UserUpdate(BaseModel):
14 | username: Optional[str] = None
15 | email: Optional[EmailStr] = None
16 | password: Optional[str] = None
17 | is_active: Optional[bool] = None
18 | is_superuser: Optional[bool] = None
19 |
20 | class UserOut(UserBase):
21 | id: UUID
22 | created_at: datetime
23 | is_active: bool
24 | is_superuser: bool
25 |
26 | class Config:
27 | from_attributes = True
28 |
29 | class UserInDB(UserOut):
30 | hashed_password: str
31 |
32 | class UserLogin(BaseModel):
33 | email: EmailStr
34 | password: str
35 |
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/auth.js:
--------------------------------------------------------------------------------
1 | import { useMutation } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | export const useRegister = () => {
11 | return useMutation({
12 | mutationFn: async ({ email, password, username }) => {
13 | const { data, error } = await supabase.auth.signUp({
14 | email,
15 | password,
16 | });
17 | if (error) throw error;
18 |
19 | // Create a profile for the new user
20 | const { error: profileError } = await supabase
21 | .from('profiles')
22 | .insert([{ id: data.user.id, username }]);
23 |
24 | if (profileError) throw profileError;
25 |
26 | return data;
27 | },
28 | });
29 | };
--------------------------------------------------------------------------------
/backend copy/app/api/endpoints/auth.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException, status
2 | from app.schemas.user import UserCreate, UserOut
3 | from app.core.security import create_access_token
4 | from app.services.supabase_service import supabase_client
5 | from app.models.user import User
6 | from datetime import timedelta
7 | from typing import Any
8 |
9 | router = APIRouter()
10 |
11 | @router.post("/register", response_model=UserOut)
12 | async def register(user_in: UserCreate) -> Any:
13 | # Registration logic here
14 | return user_in
15 |
16 | @router.post("/login")
17 | async def login():
18 | # Login logic here
19 | pass
20 |
21 | @router.post("/logout")
22 | async def logout():
23 | # Logout logic here
24 | pass
25 |
26 | @router.get("/me", response_model=UserOut)
27 | async def get_current_user():
28 | # Get current user logic here
29 | pass
30 |
--------------------------------------------------------------------------------
/backend/app/services/ai_judge/rubric.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel, Field
2 |
3 | class RubricItem(BaseModel):
4 | name: str
5 | prompt: str
6 | description: str | None = None
7 | weight: float | int = 1
8 | metadata: dict = {}
9 |
10 |
11 | class Rubric(BaseModel):
12 | name: str
13 | description: str
14 | items: dict[str, RubricItem]
15 | metadata: dict = {}
16 |
17 | @property
18 | def analysis_types(self):
19 | return list(self.items.keys())
20 |
21 | @property
22 | def normalized_weight(self):
23 | return {
24 | item.name: item.weight / self.ttl_weights for item in self.items.values()
25 | }
26 |
27 | @property
28 | def ttl_weights(self):
29 | return sum([
30 | item.weight for item in self.items.values()
31 | ])
32 |
33 | __all__ = ["Rubric", "RubricItem"]
34 |
--------------------------------------------------------------------------------
/backend/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.poetry]
2 | name = "ai-hacking-league-backend"
3 | version = "0.1.0"
4 | description = "Backend for the AI Hacking League application"
5 | authors = ["Your Name "]
6 | readme = "README.md"
7 |
8 | [tool.poetry.dependencies]
9 | python = "^3.10"
10 | fastapi = {extras = ["all"], version = "^0.114.2"}
11 | pydantic = ">=2.0,<3.0"
12 | supabase = "^2.7.4"
13 | pyjwt = "^2.9.0"
14 | requests = "^2.32.3"
15 | python-dotenv = "^1.0.1"
16 | sqlalchemy = "^2.0.34"
17 | openai = "^1.45.0"
18 | cachetools = "^5.5.0"
19 | uvicorn = "^0.22.0"
20 | python-jose = "^3.3.0"
21 | passlib = "^1.7.4"
22 | lionagi = "^0.2.11"
23 | ipython = "^8.28.0"
24 |
25 | [tool.poetry.group.dev.dependencies]
26 | pytest = "^8.3.3"
27 | pytest-asyncio = "^0.24.0"
28 | poetry-plugin-export = "^1.8.0"
29 |
30 | [build-system]
31 | requires = ["poetry-core"]
32 | build-backend = "poetry.core.masonry.api"
33 |
--------------------------------------------------------------------------------
/src/components/ui/sonner.jsx:
--------------------------------------------------------------------------------
1 | import { useTheme } from "next-themes"
2 | import { Toaster as Sonner } from "sonner"
3 |
4 | const Toaster = ({
5 | ...props
6 | }) => {
7 | const { theme = "system" } = useTheme()
8 |
9 | return (
10 | ( )
25 | );
26 | }
27 |
28 | export { Toaster }
29 |
--------------------------------------------------------------------------------
/src/components/ui/toaster.jsx:
--------------------------------------------------------------------------------
1 | import {
2 | Toast,
3 | ToastClose,
4 | ToastDescription,
5 | ToastProvider,
6 | ToastTitle,
7 | ToastViewport,
8 | } from "@/components/ui/toast"
9 | import { useToast } from "@/components/ui/use-toast"
10 |
11 | export function Toaster() {
12 | const { toasts } = useToast()
13 |
14 | return (
15 | (
16 | {toasts.map(function ({ id, title, description, action, ...props }) {
17 | return (
18 | (
19 |
20 | {title && {title} }
21 | {description && (
22 | {description}
23 | )}
24 |
25 | {action}
26 |
27 | )
28 | );
29 | })}
30 |
31 | )
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/docs/modules.md:
--------------------------------------------------------------------------------
1 | # Modules and Dependencies
2 |
3 | ## Dependency Management
4 | - Install: `npm install package-name`
5 | - Update: `npm update package-name`
6 | - Remove: `npm uninstall package-name`
7 |
8 | ## Key Project Dependencies
9 | - React: UI library
10 | - Vite: Build tool and development server
11 | - Supabase: Backend and real-time database
12 | - OpenAI: AI integration for code evaluation and assistance
13 | - React Query: Data fetching and state management
14 | - Tailwind CSS: Utility-first CSS framework
15 |
16 | ## Optimizing Imports
17 | - Use ES6 import syntax for tree-shaking
18 | - Implement dynamic imports for code-splitting
19 | - Avoid importing entire libraries when only specific functions are needed
20 |
21 | ## Module-Specific Guidelines
22 | ### OpenAI
23 | - Use the provided `useOpenAI` hook for API calls
24 | - Keep API key secure in environment variables
25 |
26 | ### Supabase
27 | - Use React Query hooks for data fetching
28 | - Implement real-time subscriptions for live updates
--------------------------------------------------------------------------------
/docs/performance.md:
--------------------------------------------------------------------------------
1 | # Performance Optimization Guide
2 |
3 | ## Code-Splitting
4 | - Use dynamic imports for route-based code splitting
5 | - Implement React.lazy for component-level code splitting
6 |
7 | Example:
8 | ```javascript
9 | const LazyComponent = React.lazy(() => import('./LazyComponent'));
10 | ```
11 |
12 | ## Bundle Optimization
13 | - Enable tree-shaking in Vite config
14 | - Use ES6 module syntax for better tree-shaking
15 | - Analyze bundle size with tools like `rollup-plugin-visualizer`
16 |
17 | ## Gzip/Brotli Compression
18 | - Enable compression in your hosting platform (e.g., Vercel, Netlify)
19 | - For custom servers, use compression middleware:
20 | ```javascript
21 | const compression = require('compression');
22 | app.use(compression());
23 | ```
24 |
25 | ## API Optimization
26 | - Implement caching with React Query
27 | - Use pagination for large data sets
28 | - Optimize API payload size
29 | - Implement debouncing for frequent API calls (e.g., real-time collaboration)
--------------------------------------------------------------------------------
/docs/development-guidelines.md:
--------------------------------------------------------------------------------
1 | # Development Guidelines
2 |
3 | ## Project Setup
4 | 1. Clone the repository
5 | 2. Install dependencies: `npm install`
6 | 3. Set up environment variables (see Environment Setup Documentation)
7 | 4. Start the development server: `npm run dev`
8 |
9 | ## Coding Standards
10 | - Use ESLint for linting (configuration in `.eslintrc.js`)
11 | - Use Prettier for code formatting
12 | - Follow React best practices and hooks guidelines
13 |
14 | ## Module Structure
15 | - Use feature-based folder structure
16 | - Keep components small and focused
17 | - Use lazy loading for larger components
18 |
19 | ## OpenAI Integration
20 | - Store API key in `.env` file
21 | - Use the `useOpenAI` hook for API calls
22 | - Manage prompts in a separate file for easy updates
23 |
24 | ## Best Practices
25 | - Write unit tests for critical functions
26 | - Use React Query for efficient data fetching
27 | - Optimize renders using React.memo and useMemo
28 | - Implement error boundaries for robust error handling
--------------------------------------------------------------------------------
/docs/environment.md:
--------------------------------------------------------------------------------
1 | # Environment Setup Documentation
2 |
3 | ## Local Environment Setup
4 | 1. Install Node.js (v14+ recommended)
5 | 2. Install npm (comes with Node.js)
6 | 3. Clone the project repository
7 | 4. Run `npm install` in the project root
8 |
9 | ## Environment Variable Management
10 | 1. Create a `.env` file in the project root
11 | 2. Add necessary variables:
12 | ```
13 | VITE_SUPABASE_URL=your_supabase_url
14 | VITE_SUPABASE_API_KEY=your_supabase_api_key
15 | VITE_OPENAI_API_KEY=your_openai_api_key
16 | ```
17 | 3. Use `import.meta.env.VITE_VARIABLE_NAME` to access variables in code
18 |
19 | ## Development vs Production Environments
20 | - Use `.env.development` for development-specific variables
21 | - Use `.env.production` for production-specific variables
22 | - Ensure sensitive data is not committed to version control
23 |
24 | ## Secure Variable Storage
25 | - Use 1Password or similar tool for team-wide secret management
26 | - Integrate with CI/CD pipelines for secure deployment
--------------------------------------------------------------------------------
/backend/supabase-test.py:
--------------------------------------------------------------------------------
1 | from supabase import create_client, Client
2 | import os
3 |
4 | SUPABASE_URL = "https://hpkluyywkugnyouucvwr.supabase.co/"
5 | SUPABASE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imhwa2x1eXl3a3VnbnlvdXVjdndyIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyNTcyNjM5NiwiZXhwIjoyMDQxMzAyMzk2fQ.JpAxQZTEGx5xjn79h9b-se-YqVkaEi-mTWycvioP7Tg"
6 |
7 | # Create a Supabase client
8 | supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
9 |
10 | # Query the users table
11 | def get_users():
12 | try:
13 | response = supabase.table('users').select('*').execute()
14 |
15 | # Check if data exists in the response
16 | if response.data:
17 | print(f"Users: {response.data}")
18 | else:
19 | print("No data returned from the query.")
20 | except Exception as e:
21 | # Handle exceptions and print error message
22 | print(f"An error occurred: {e}")
23 |
24 | # Call the function to get users
25 | get_users()
26 |
--------------------------------------------------------------------------------
/src/components/ui/checkbox.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
3 | import { Check } from "lucide-react"
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const Checkbox = React.forwardRef(({ className, ...props }, ref) => (
8 |
15 |
16 |
17 |
18 |
19 | ))
20 | Checkbox.displayName = CheckboxPrimitive.Root.displayName
21 |
22 | export { Checkbox }
23 |
--------------------------------------------------------------------------------
/src/components/ui/slider.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as SliderPrimitive from "@radix-ui/react-slider"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Slider = React.forwardRef(({ className, ...props }, ref) => (
7 |
11 |
13 |
14 |
15 |
17 |
18 | ))
19 | Slider.displayName = SliderPrimitive.Root.displayName
20 |
21 | export { Slider }
22 |
--------------------------------------------------------------------------------
/.gpt_engineer/report-url-change.js:
--------------------------------------------------------------------------------
1 | export const loadReportUrlChangeEventListener = () => {
2 | /**
3 | * Listen to URL changes and report them to the parent window
4 | *
5 | * See https://stackoverflow.com/a/46428962
6 | * The Navigation API https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API seemed promising,
7 | * but it is not supported in all major browsers.
8 | */
9 | const observeUrlChange = () => {
10 | let oldHref = document.location.href;
11 | const body = document.querySelector("body");
12 | const observer = new MutationObserver(() => {
13 | if (oldHref !== document.location.href) {
14 | oldHref = document.location.href;
15 | window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "https://run.gptengineer.app");
16 | window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "http://localhost:3000");
17 | }
18 | });
19 | observer.observe(body, { childList: true, subtree: true });
20 | };
21 |
22 | window.addEventListener("load", observeUrlChange);
23 | };
--------------------------------------------------------------------------------
/backend/app/api/endpoints/replays.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.replay import ReplayCreate, ReplayOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=ReplayOut)
9 | async def create_replay(replay: ReplayCreate):
10 | # Logic to create a replay
11 | return {"id": "123", "challenge_id": replay.challenge_id, "user_id": replay.user_id, "replay_data": replay.replay_data}
12 |
13 | @router.get("/", response_model=List[ReplayOut])
14 | async def list_replays():
15 | # Logic to list replays
16 | return []
17 |
18 | @router.get("/{replay_id}", response_model=ReplayOut)
19 | async def get_replay(replay_id: str):
20 | # Logic to get a specific replay
21 | return {"id": replay_id, "challenge_id": "challenge456", "user_id": "user123", "replay_data": "Replay data here"}
22 |
23 | @router.delete("/{replay_id}")
24 | async def delete_replay(replay_id: str):
25 | # Logic to delete a replay
26 | return {"message": "Replay deleted successfully"}
27 |
--------------------------------------------------------------------------------
/src/components/ui/switch.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as SwitchPrimitives from "@radix-ui/react-switch"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Switch = React.forwardRef(({ className, ...props }, ref) => (
7 |
14 |
18 |
19 | ))
20 | Switch.displayName = SwitchPrimitives.Root.displayName
21 |
22 | export { Switch }
23 |
--------------------------------------------------------------------------------
/src/components/ui/tooltip.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as TooltipPrimitive from "@radix-ui/react-tooltip"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const TooltipProvider = TooltipPrimitive.Provider
7 |
8 | const Tooltip = TooltipPrimitive.Root
9 |
10 | const TooltipTrigger = TooltipPrimitive.Trigger
11 |
12 | const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (
13 |
21 | ))
22 | TooltipContent.displayName = TooltipPrimitive.Content.displayName
23 |
24 | export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
25 |
--------------------------------------------------------------------------------
/backend/app/models/challenge.py:
--------------------------------------------------------------------------------
1 | # app/models/challenge.py
2 |
3 | from sqlalchemy import Column, String, Integer, DateTime, Enum
4 | from sqlalchemy.dialects.postgresql import UUID
5 | from sqlalchemy.sql import func
6 | import uuid
7 | import enum
8 | from app.db.base_class import Base # Import Base directly from base_class.py
9 |
10 | class DifficultyEnum(str, enum.Enum):
11 | Easy = "Easy"
12 | Medium = "Medium"
13 | Hard = "Hard"
14 | Expert = "Expert"
15 |
16 | class Challenge(Base):
17 | __tablename__ = "challenges"
18 |
19 | id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
20 | title = Column(String)
21 | description = Column(String)
22 | difficulty = Column(Enum(DifficultyEnum))
23 | start_time = Column(DateTime(timezone=True))
24 | end_time = Column(DateTime(timezone=True))
25 | max_participants = Column(Integer)
26 | current_participants = Column(Integer, default=0)
27 | github_repo_url = Column(String)
28 | created_at = Column(DateTime(timezone=True), server_default=func.now())
29 | updated_at = Column(DateTime(timezone=True), onupdate=func.now())
30 |
--------------------------------------------------------------------------------
/src/components/ui/badge.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { cva } from "class-variance-authority";
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const badgeVariants = cva(
7 | "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8 | {
9 | variants: {
10 | variant: {
11 | default:
12 | "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13 | secondary:
14 | "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15 | destructive:
16 | "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17 | outline: "text-foreground",
18 | },
19 | },
20 | defaultVariants: {
21 | variant: "default",
22 | },
23 | }
24 | )
25 |
26 | function Badge({
27 | className,
28 | variant,
29 | ...props
30 | }) {
31 | return (
);
32 | }
33 |
34 | export { Badge, badgeVariants }
35 |
--------------------------------------------------------------------------------
/backend copy/app/models/challenge.py:
--------------------------------------------------------------------------------
1 | # app/models/challenge.py
2 |
3 | from sqlalchemy import Column, String, Integer, DateTime, Enum
4 | from sqlalchemy.dialects.postgresql import UUID
5 | from sqlalchemy.sql import func
6 | import uuid
7 | import enum
8 | from app.db.base_class import Base # Import Base directly from base_class.py
9 |
10 | class DifficultyEnum(str, enum.Enum):
11 | Easy = "Easy"
12 | Medium = "Medium"
13 | Hard = "Hard"
14 | Expert = "Expert"
15 |
16 | class Challenge(Base):
17 | __tablename__ = "challenges"
18 |
19 | id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
20 | title = Column(String)
21 | description = Column(String)
22 | difficulty = Column(Enum(DifficultyEnum))
23 | start_time = Column(DateTime(timezone=True))
24 | end_time = Column(DateTime(timezone=True))
25 | max_participants = Column(Integer)
26 | current_participants = Column(Integer, default=0)
27 | github_repo_url = Column(String)
28 | created_at = Column(DateTime(timezone=True), server_default=func.now())
29 | updated_at = Column(DateTime(timezone=True), onupdate=func.now())
30 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/enrollments.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.enrollment import EnrollmentCreate, EnrollmentOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=EnrollmentOut)
9 | async def create_enrollment(enrollment: EnrollmentCreate):
10 | # Logic to create an enrollment
11 | return {"id": "123", "user_id": enrollment.user_id, "challenge_id": enrollment.challenge_id}
12 |
13 | @router.get("/", response_model=List[EnrollmentOut])
14 | async def list_enrollments():
15 | # Logic to list enrollments
16 | return []
17 |
18 | @router.get("/{enrollment_id}", response_model=EnrollmentOut)
19 | async def get_enrollment(enrollment_id: str):
20 | # Logic to get a specific enrollment
21 | return {"id": enrollment_id, "user_id": "user123", "challenge_id": "challenge456"}
22 |
23 | @router.delete("/{enrollment_id}")
24 | async def delete_enrollment(enrollment_id: str):
25 | # Logic to delete an enrollment
26 | return {"message": "Enrollment deleted successfully"}
27 |
--------------------------------------------------------------------------------
/src/components/ui/hover-card.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const HoverCard = HoverCardPrimitive.Root
7 |
8 | const HoverCardTrigger = HoverCardPrimitive.Trigger
9 |
10 | const HoverCardContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
11 |
20 | ))
21 | HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
22 |
23 | export { HoverCard, HoverCardTrigger, HoverCardContent }
24 |
--------------------------------------------------------------------------------
/src/components/ui/avatar.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as AvatarPrimitive from "@radix-ui/react-avatar"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Avatar = React.forwardRef(({ className, ...props }, ref) => (
7 |
11 | ))
12 | Avatar.displayName = AvatarPrimitive.Root.displayName
13 |
14 | const AvatarImage = React.forwardRef(({ className, ...props }, ref) => (
15 |
19 | ))
20 | AvatarImage.displayName = AvatarPrimitive.Image.displayName
21 |
22 | const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => (
23 |
30 | ))
31 | AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
32 |
33 | export { Avatar, AvatarImage, AvatarFallback }
34 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/chat.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.chat import ChatMessageCreate, ChatMessageOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=ChatMessageOut)
9 | async def create_chat_message(message: ChatMessageCreate):
10 | # Logic to create a chat message
11 | return {"id": "123", "user_id": message.user_id, "content": message.content, "timestamp": "2023-05-01T12:00:00Z"}
12 |
13 | @router.get("/", response_model=List[ChatMessageOut])
14 | async def list_chat_messages():
15 | # Logic to list chat messages
16 | return []
17 |
18 | @router.get("/{message_id}", response_model=ChatMessageOut)
19 | async def get_chat_message(message_id: str):
20 | # Logic to get a specific chat message
21 | return {"id": message_id, "user_id": "user123", "content": "Hello, world!", "timestamp": "2023-05-01T12:00:00Z"}
22 |
23 | @router.delete("/{message_id}")
24 | async def delete_chat_message(message_id: str):
25 | # Logic to delete a chat message
26 | return {"message": "Chat message deleted successfully"}
27 |
--------------------------------------------------------------------------------
/src/components/ui/popover.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as PopoverPrimitive from "@radix-ui/react-popover"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Popover = PopoverPrimitive.Root
7 |
8 | const PopoverTrigger = PopoverPrimitive.Trigger
9 |
10 | const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
11 |
12 |
21 |
22 | ))
23 | PopoverContent.displayName = PopoverPrimitive.Content.displayName
24 |
25 | export { Popover, PopoverTrigger, PopoverContent }
26 |
--------------------------------------------------------------------------------
/backend copy/app/services/ai_judge_service.py:
--------------------------------------------------------------------------------
1 | import openai
2 | from app.core.config import settings
3 |
4 | openai.api_key = settings.OPENAI_API_KEY
5 |
6 | def evaluate_code_submission(code: str) -> dict:
7 | # Define the prompt for the AI
8 | prompt = f"""
9 | You are an AI code reviewer. Evaluate the following code submission based on the following criteria:
10 | 1. Functionality (40%): How well does the solution solve the given problem?
11 | 2. Innovation (30%): Does the solution present novel approaches or creative use of AI technologies?
12 | 3. Efficiency (20%): How optimized and performant is the code?
13 | 4. Code Quality (10%): Is the code well-structured, readable, and following best practices?
14 |
15 | Provide a score out of 100 and detailed feedback for each criterion.
16 |
17 | Code Submission:
18 | {code}
19 | """
20 | try:
21 | response = openai.ChatCompletion.create(
22 | model="gpt-4",
23 | messages=[
24 | {"role": "user", "content": prompt}
25 | ]
26 | )
27 | evaluation = response['choices'][0]['message']['content']
28 | return {"evaluation": evaluation}
29 | except Exception as e:
30 | return {"error": str(e)}
31 |
--------------------------------------------------------------------------------
/backend/app/schemas/challenge.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel, Field
2 | from uuid import UUID
3 | from datetime import datetime
4 | from typing import Optional
5 | from enum import Enum
6 |
7 | class DifficultyEnum(str, Enum):
8 | Easy = "Easy"
9 | Medium = "Medium"
10 | Hard = "Hard"
11 | Expert = "Expert"
12 |
13 | class ChallengeBase(BaseModel):
14 | title: str
15 | description: str
16 | difficulty: DifficultyEnum
17 | start_time: datetime
18 | end_time: datetime
19 | max_participants: int
20 |
21 | class ChallengeCreate(ChallengeBase):
22 | pass
23 |
24 | class ChallengeOut(ChallengeBase):
25 | id: UUID
26 | current_participants: int
27 | github_repo_url: Optional[str]
28 | created_at: datetime
29 |
30 | class Config:
31 | from_attributes = True
32 |
33 | class ChallengeUpdate(ChallengeBase):
34 | title: Optional[str] = None
35 | description: Optional[str] = None
36 | difficulty: Optional[DifficultyEnum] = None
37 | start_time: Optional[datetime] = None
38 | end_time: Optional[datetime] = None
39 | max_participants: Optional[int] = None
40 | current_participants: Optional[int] = None
41 | github_repo_url: Optional[str] = None
42 |
--------------------------------------------------------------------------------
/src/components/ui/date-picker.jsx:
--------------------------------------------------------------------------------
1 | import { format } from "date-fns";
2 | import { Calendar as CalendarIcon } from "lucide-react";
3 |
4 | import { cn } from "@/lib/utils";
5 | import { Button } from "@/components/ui/button";
6 | import { Calendar } from "@/components/ui/calendar";
7 | import {
8 | Popover,
9 | PopoverContent,
10 | PopoverTrigger,
11 | } from "@/components/ui/popover";
12 |
13 | export function DatePicker({ date, onDateChange, className }) {
14 | return (
15 |
16 |
17 |
25 |
26 | {date ? format(date, "PPP") : Pick a date }
27 |
28 |
29 |
30 |
36 |
37 |
38 | );
39 | }
40 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/skill_profiles.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.skill_profile import SkillProfileCreate, SkillProfileOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=SkillProfileOut)
9 | async def create_skill_profile(profile: SkillProfileCreate):
10 | # Logic to create a skill profile
11 | return {"id": "123", "user_id": profile.user_id, "skills": profile.skills}
12 |
13 | @router.get("/{user_id}", response_model=SkillProfileOut)
14 | async def get_skill_profile(user_id: str):
15 | # Logic to get a user's skill profile
16 | return {"id": "123", "user_id": user_id, "skills": {"python": 8, "javascript": 7}}
17 |
18 | @router.put("/{user_id}", response_model=SkillProfileOut)
19 | async def update_skill_profile(user_id: str, profile: SkillProfileCreate):
20 | # Logic to update a skill profile
21 | return {"id": "123", "user_id": user_id, "skills": profile.skills}
22 |
23 | @router.delete("/{user_id}")
24 | async def delete_skill_profile(user_id: str):
25 | # Logic to delete a skill profile
26 | return {"message": "Skill profile deleted successfully"}
27 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/wallet.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.wallet import WalletCreate, WalletOut, TransactionCreate, TransactionOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=WalletOut)
9 | async def create_wallet(wallet: WalletCreate):
10 | # Logic to create a wallet
11 | return {"id": "123", "user_id": wallet.user_id, "balance": 0}
12 |
13 | @router.get("/{user_id}", response_model=WalletOut)
14 | async def get_wallet(user_id: str):
15 | # Logic to get a user's wallet
16 | return {"id": "123", "user_id": user_id, "balance": 1000}
17 |
18 | @router.post("/transactions", response_model=TransactionOut)
19 | async def create_transaction(transaction: TransactionCreate):
20 | # Logic to create a transaction
21 | return {"id": "123", "wallet_id": transaction.wallet_id, "amount": transaction.amount, "type": transaction.type, "timestamp": "2023-05-01T12:00:00Z"}
22 |
23 | @router.get("/transactions/{wallet_id}", response_model=List[TransactionOut])
24 | async def list_transactions(wallet_id: str):
25 | # Logic to list transactions for a wallet
26 | return []
27 |
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/chat_messages.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | export const useAddChatMessage = () => {
11 | const queryClient = useQueryClient();
12 | return useMutation({
13 | mutationFn: async ({ challengeId, userId, message }) => {
14 | const { data, error } = await supabase
15 | .from('chat_messages')
16 | .insert([{ challenge_id: challengeId, user_id: userId, message }]);
17 | if (error) throw error;
18 | return data;
19 | },
20 | onSuccess: (_, variables) => {
21 | queryClient.invalidateQueries(['chat-messages', variables.challengeId]);
22 | },
23 | });
24 | };
25 |
26 | export const useLatestChatMessages = (challengeId) => useQuery({
27 | queryKey: ['chat-messages', challengeId],
28 | queryFn: () => fromSupabase(supabase
29 | .from('chat_messages')
30 | .select('*')
31 | .eq('challenge_id', challengeId)
32 | .order('created_at', { ascending: false })
33 | .limit(10)
34 | ),
35 | });
--------------------------------------------------------------------------------
/src/components/HeroSection.jsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@/components/ui/button";
2 | import { Link } from 'react-router-dom';
3 |
4 | export const HeroSection = () => (
5 |
6 |
7 |
8 | Hacker League: Rapid Development Challenge
9 |
10 |
11 | Join the ultimate AI speed coding competition with real rewards. Build functional AI applications in minutes,
12 | showcase your rapid development skills, and compete for substantial cash prizes.
13 |
14 |
15 |
16 | View Challenges
17 |
18 |
19 | Join Now
20 |
21 |
22 |
23 |
24 | );
--------------------------------------------------------------------------------
/backend/app/services/ai_judge/code_quality.py:
--------------------------------------------------------------------------------
1 | from .rubric import Rubric, RubricItem
2 |
3 | functionality = RubricItem(
4 | name="functionality",
5 | prompt="Assess how well the code meets the functional requirements.",
6 | weight=2,
7 | )
8 |
9 | readability = RubricItem(
10 | name="readability",
11 | prompt="Evaluate the readability and clarity of the code.",
12 | weight=1,
13 | )
14 |
15 | efficiency = RubricItem(
16 | name="efficiency",
17 | prompt="Examine the efficiency of the algorithms used.",
18 | weight=0.8,
19 | )
20 |
21 | style_compliance = RubricItem(
22 | name="style_compliance",
23 | prompt="Check adherence to coding style guidelines.",
24 | weight=0.5,
25 | )
26 |
27 | error_handling = RubricItem(
28 | name="error_handling",
29 | prompt="Analyze the robustness of error handling mechanisms.",
30 | weight=1,
31 | )
32 |
33 | code_quality_rubric = Rubric(
34 | name="code_quality_rubric",
35 | description="Used for assessing code submissions in programming challenges.",
36 | items = {
37 | i.name : i for i in [
38 | functionality, readability, efficiency, style_compliance, error_handling
39 | ]
40 | }
41 | )
42 |
43 | __all__ = ["code_quality_rubric"]
--------------------------------------------------------------------------------
/src/integrations/supabase/supabase.js:
--------------------------------------------------------------------------------
1 | import { createClient } from '@supabase/supabase-js';
2 |
3 | const supabaseUrl = import.meta.env.VITE_SUPABASE_PROJECT_URL;
4 | const supabaseKey = import.meta.env.VITE_SUPABASE_API_KEY;
5 |
6 | let supabase;
7 |
8 | if (!supabaseUrl || !supabaseKey) {
9 | console.error('Supabase configuration is missing. Please set VITE_SUPABASE_PROJECT_URL and VITE_SUPABASE_API_KEY in your .env file.');
10 | supabase = {
11 | auth: {
12 | signInWithPassword: () => Promise.reject(new Error('Supabase is not configured')),
13 | signOut: () => Promise.reject(new Error('Supabase is not configured')),
14 | onAuthStateChange: () => ({ data: { subscription: { unsubscribe: () => {} } } }),
15 | getSession: () => Promise.resolve({ data: { session: null } }),
16 | },
17 | from: () => ({
18 | select: () => Promise.reject(new Error('Supabase is not configured')),
19 | insert: () => Promise.reject(new Error('Supabase is not configured')),
20 | update: () => Promise.reject(new Error('Supabase is not configured')),
21 | delete: () => Promise.reject(new Error('Supabase is not configured')),
22 | }),
23 | };
24 | } else {
25 | supabase = createClient(supabaseUrl, supabaseKey);
26 | }
27 |
28 | export { supabase };
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/wallet.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | /*
11 | ### wallet
12 |
13 | | name | type | format | required |
14 | |------------|--------------------------|-----------|----------|
15 | | user_id | uuid | uuid | true |
16 | | balance | numeric | numeric | false |
17 | | updated_at | timestamp with time zone | timestamp | false |
18 | */
19 |
20 | export const useWallet = (userId) => useQuery({
21 | queryKey: ['wallet', userId],
22 | queryFn: () => fromSupabase(supabase.from('wallet').select('*').eq('user_id', userId).single()),
23 | });
24 |
25 | export const useUpdateWallet = () => {
26 | const queryClient = useQueryClient();
27 | return useMutation({
28 | mutationFn: ({ user_id, ...updateData }) => fromSupabase(supabase.from('wallet').update(updateData).eq('user_id', user_id)),
29 | onSuccess: (_, variables) => {
30 | queryClient.invalidateQueries(['wallet', variables.user_id]);
31 | },
32 | });
33 | };
--------------------------------------------------------------------------------
/src/components/ui/radio-group.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3 | import { Circle } from "lucide-react"
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const RadioGroup = React.forwardRef(({ className, ...props }, ref) => {
8 | return ( );
9 | })
10 | RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
11 |
12 | const RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => {
13 | return (
14 | (
21 |
22 |
23 |
24 | )
25 | );
26 | })
27 | RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
28 |
29 | export { RadioGroup, RadioGroupItem }
30 |
--------------------------------------------------------------------------------
/docs/testing.md:
--------------------------------------------------------------------------------
1 | # Testing Guide
2 |
3 | ## Unit Tests
4 | - Framework: Vitest
5 | - Run tests: `npm run test`
6 | - Write tests in `__tests__` directories or with `.test.js` suffix
7 |
8 | Example:
9 | ```javascript
10 | import { render, screen } from '@testing-library/react';
11 | import MyComponent from './MyComponent';
12 |
13 | test('renders component', () => {
14 | render( );
15 | expect(screen.getByText('Hello')).toBeInTheDocument();
16 | });
17 | ```
18 |
19 | ## Integration Testing
20 | - Test API integrations with OpenAI and Supabase
21 | - Use mock data for consistent results
22 | - Test real-time features and state management
23 |
24 | ## End-to-End Testing
25 | - Framework: Cypress
26 | - Run E2E tests: `npm run test:e2e`
27 | - Write tests in `cypress/integration` directory
28 |
29 | Example:
30 | ```javascript
31 | describe('Challenge Page', () => {
32 | it('submits code and receives feedback', () => {
33 | cy.visit('/challenge/1');
34 | cy.get('#code-editor').type('console.log("Hello, World!")');
35 | cy.get('#submit-button').click();
36 | cy.get('#feedback').should('contain', 'Evaluation complete');
37 | });
38 | });
39 | ```
40 |
41 | ## Automated Testing
42 | - Set up GitHub Actions for CI/CD
43 | - Run tests on pull requests and before deployments
44 | - Configure test coverage reports
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/ai_generated_challenges.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | export const useAIGeneratedChallenges = () => useQuery({
11 | queryKey: ['ai-generated-challenges'],
12 | queryFn: () => fromSupabase(supabase.from('ai_generated_challenges').select('*')),
13 | });
14 |
15 | export const useAddAIGeneratedChallenge = () => {
16 | const queryClient = useQueryClient();
17 | return useMutation({
18 | mutationFn: async (challengePrompt) => {
19 | const { data, error } = await supabase.functions.invoke('generate-ai-challenge', {
20 | body: { prompt: challengePrompt },
21 | });
22 | if (error) throw error;
23 | return data;
24 | },
25 | onSuccess: () => {
26 | queryClient.invalidateQueries('ai-generated-challenges');
27 | },
28 | });
29 | };
30 |
31 | export const useLatestAIGeneratedChallenge = () => useQuery({
32 | queryKey: ['latest-ai-generated-challenge'],
33 | queryFn: () => fromSupabase(supabase.from('ai_generated_challenges').select('*').order('created_at', { ascending: false }).limit(1).single()),
34 | });
--------------------------------------------------------------------------------
/src/pages/Analytics.jsx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
2 |
3 | const Analytics = () => {
4 | return (
5 |
6 |
Analytics
7 |
8 |
9 |
10 | Performance Metrics
11 |
12 |
13 | Performance graphs placeholder
14 |
15 |
16 |
17 |
18 |
19 | AI-Generated Insights
20 |
21 |
22 | AI insights placeholder
23 |
24 |
25 |
26 |
27 |
28 | Skill Breakdown
29 |
30 |
31 | Skill breakdown chart placeholder
32 |
33 |
34 |
35 |
36 |
37 | Improvement Suggestions
38 |
39 |
40 | AI-powered improvement suggestions placeholder
41 |
42 |
43 |
44 | );
45 | };
46 |
47 | export default Analytics;
--------------------------------------------------------------------------------
/backend/app/core/config.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dotenv import load_dotenv
3 | import logging
4 |
5 | # Set up logging
6 | logging.basicConfig(level=logging.DEBUG)
7 | logger = logging.getLogger(__name__)
8 |
9 | # Load the .env file
10 | dotenv_path = os.path.join(os.path.dirname(__file__), '..', '..', '.env')
11 | load_dotenv(dotenv_path=dotenv_path)
12 |
13 | logger.debug(f"Current working directory: {os.getcwd()}")
14 | logger.debug(f".env file path: {dotenv_path}")
15 |
16 | class Settings:
17 | SUPABASE_URL: str = os.getenv("SUPABASE_URL", "")
18 | SUPABASE_KEY: str = os.getenv("SUPABASE_KEY", "")
19 | SUPABASE_SERVICE_ROLE_KEY: str = os.getenv("SUPABASE_SERVICE_ROLE_KEY", "")
20 | GITHUB_TOKEN: str = os.getenv("GITHUB_TOKEN", "")
21 | SECRET_KEY: str = os.getenv("SECRET_KEY", "your-secret-key")
22 | ALGORITHM: str = os.getenv("ALGORITHM", "HS256")
23 | ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
24 | OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY", "")
25 |
26 | def __init__(self):
27 | logger.debug(f"SUPABASE_URL: {'set' if self.SUPABASE_URL else 'not set'}")
28 | logger.debug(f"SUPABASE_KEY: {'set' if self.SUPABASE_KEY else 'not set'}")
29 | logger.debug(f"SUPABASE_SERVICE_ROLE_KEY: {'set' if self.SUPABASE_SERVICE_ROLE_KEY else 'not set'}")
30 |
31 | settings = Settings()
--------------------------------------------------------------------------------
/docs/prompts.md:
--------------------------------------------------------------------------------
1 | # Prompt Engineering Documentation
2 |
3 | ## Creating Prompts
4 | 1. Define the task clearly
5 | 2. Provide context and examples
6 | 3. Specify the desired output format
7 | 4. Test prompts with various inputs
8 |
9 | ## Optimizing Prompts
10 | - Use clear and concise language
11 | - Break complex tasks into smaller steps
12 | - Iterate based on AI responses
13 | - Fine-tune temperature and max tokens settings
14 |
15 | ## Common Errors
16 | - API rate limiting: Implement exponential backoff
17 | - Incomplete responses: Adjust max tokens or break into multiple requests
18 | - Context length exceeded: Summarize or chunk input data
19 |
20 | ## Real-World Examples
21 | ### Judging System Prompt
22 | ```
23 | Evaluate the following code submission for a [CHALLENGE_NAME] challenge:
24 | [CODE_SUBMISSION]
25 |
26 | Provide scores and feedback for:
27 | 1. Functionality (0-10):
28 | 2. Innovation (0-10):
29 | 3. Efficiency (0-10):
30 | 4. Code Quality (0-10):
31 |
32 | Detailed feedback:
33 | [Your analysis here]
34 | ```
35 |
36 | ### Skill Assessment Prompt
37 | ```
38 | Analyze the following code sample:
39 | [CODE_SAMPLE]
40 |
41 | Provide insights on:
42 | 1. Coding style and consistency
43 | 2. Use of language-specific features
44 | 3. Potential optimizations
45 | 4. Overall skill level assessment
46 |
47 | Detailed feedback:
48 | [Your analysis here]
49 | ```
--------------------------------------------------------------------------------
/src/components/ChallengeCard.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 | import { Link } from 'react-router-dom';
5 |
6 | const ChallengeCard = ({ challenge }) => {
7 | return (
8 |
9 |
10 |
11 | {challenge.title}
12 | {challenge.icon}
13 |
14 |
15 |
16 | {challenge.description}
17 |
18 | Difficulty: {challenge.difficulty}
19 | Participants: {challenge.participants}
20 |
21 |
22 | Reward: {challenge.reward}
23 | Sponsor: {challenge.sponsor}
24 |
25 |
26 | View Challenge
27 |
28 |
29 |
30 | );
31 | };
32 |
33 | export default ChallengeCard;
--------------------------------------------------------------------------------
/src/components/ui/toggle.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as TogglePrimitive from "@radix-ui/react-toggle"
3 | import { cva } from "class-variance-authority";
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const toggleVariants = cva(
8 | "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
9 | {
10 | variants: {
11 | variant: {
12 | default: "bg-transparent",
13 | outline:
14 | "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
15 | },
16 | size: {
17 | default: "h-10 px-3",
18 | sm: "h-9 px-2.5",
19 | lg: "h-11 px-5",
20 | },
21 | },
22 | defaultVariants: {
23 | variant: "default",
24 | size: "default",
25 | },
26 | }
27 | )
28 |
29 | const Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => (
30 |
34 | ))
35 |
36 | Toggle.displayName = TogglePrimitive.Root.displayName
37 |
38 | export { Toggle, toggleVariants }
39 |
--------------------------------------------------------------------------------
/src/hooks/useDocumentation.js:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from 'react';
2 |
3 | export const useDocumentation = () => {
4 | const [docs, setDocs] = useState([]);
5 |
6 | useEffect(() => {
7 | const fetchDocs = async () => {
8 | // In a real application, this would fetch from a database or API
9 | const adminPanel = await import('../documentation/AdminPanel.jsx');
10 | const technicalDocs = await import('../documentation/TechnicalDocumentation.jsx');
11 | const deployment = await import('../documentation/Deployment.jsx');
12 | const customization = await import('../documentation/Customization.jsx');
13 | const codeLibraries = await import('../documentation/CodeLibrariesOverview.jsx');
14 |
15 | setDocs([
16 | { content: adminPanel.default().props.children },
17 | { content: technicalDocs.default().props.children },
18 | { content: deployment.default().props.children },
19 | { content: customization.default().props.children },
20 | { content: codeLibraries.default().props.children },
21 | ]);
22 | };
23 |
24 | fetchDocs();
25 | }, []);
26 |
27 | const getRelevantDocs = async (query) => {
28 | // In a real application, this would use a more sophisticated search algorithm
29 | return docs.filter(doc =>
30 | doc.content.toLowerCase().includes(query.toLowerCase())
31 | );
32 | };
33 |
34 | return { getRelevantDocs };
35 | };
--------------------------------------------------------------------------------
/src/components/admin/ChallengeList.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Button } from "@/components/ui/button";
3 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
4 |
5 | const ChallengeList = ({ challenges, onEdit, onDelete }) => {
6 | return (
7 |
8 |
9 |
10 | Title
11 | Difficulty
12 | Start Time
13 | End Time
14 | Actions
15 |
16 |
17 |
18 | {challenges.map((challenge) => (
19 |
20 | {challenge.title}
21 | {challenge.difficulty}
22 | {new Date(challenge.startTime).toLocaleString()}
23 | {new Date(challenge.endTime).toLocaleString()}
24 |
25 | onEdit(challenge)}>Edit
26 | onDelete(challenge.id)}>Delete
27 |
28 |
29 | ))}
30 |
31 |
32 | );
33 | };
34 |
35 | export default ChallengeList;
36 |
--------------------------------------------------------------------------------
/src/components/ui/toggle-group.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
3 |
4 | import { cn } from "@/lib/utils"
5 | import { toggleVariants } from "@/components/ui/toggle"
6 |
7 | const ToggleGroupContext = React.createContext({
8 | size: "default",
9 | variant: "default",
10 | })
11 |
12 | const ToggleGroup = React.forwardRef(({ className, variant, size, children, ...props }, ref) => (
13 |
17 |
18 | {children}
19 |
20 |
21 | ))
22 |
23 | ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
24 |
25 | const ToggleGroupItem = React.forwardRef(({ className, children, variant, size, ...props }, ref) => {
26 | const context = React.useContext(ToggleGroupContext)
27 |
28 | return (
29 | (
36 | {children}
37 | )
38 | );
39 | })
40 |
41 | ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
42 |
43 | export { ToggleGroup, ToggleGroupItem }
44 |
--------------------------------------------------------------------------------
/backend/app/api/api.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter
2 | from app.api.endpoints import auth, challenges, leaderboard, teams, users, judge, enrollments, achievements, chat, replays, wallet, skill_profiles, ai_generated_challenges, admin
3 |
4 | api_router = APIRouter()
5 | api_router.include_router(auth.router, prefix="/auth", tags=["auth"])
6 | api_router.include_router(challenges.router, prefix="/challenges", tags=["challenges"])
7 | api_router.include_router(leaderboard.router, prefix="/leaderboard", tags=["leaderboard"])
8 | api_router.include_router(teams.router, prefix="/teams", tags=["teams"])
9 | api_router.include_router(users.router, prefix="/users", tags=["users"])
10 | api_router.include_router(judge.router, prefix="/judge", tags=["judge"])
11 | api_router.include_router(enrollments.router, prefix="/enrollments", tags=["enrollments"])
12 | api_router.include_router(achievements.router, prefix="/achievements", tags=["achievements"])
13 | api_router.include_router(chat.router, prefix="/chat", tags=["chat"])
14 | api_router.include_router(replays.router, prefix="/replays", tags=["replays"])
15 | api_router.include_router(wallet.router, prefix="/wallet", tags=["wallet"])
16 | api_router.include_router(skill_profiles.router, prefix="/skill-profiles", tags=["skill-profiles"])
17 | api_router.include_router(ai_generated_challenges.router, prefix="/ai-generated-challenges", tags=["ai-generated-challenges"])
18 | api_router.include_router(admin.router, prefix="/admin", tags=["admin"])
19 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/achievements.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.achievement import AchievementCreate, AchievementOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=AchievementOut)
9 | async def create_achievement(achievement: AchievementCreate):
10 | # Logic to create an achievement
11 | return {"id": "123", "name": achievement.name, "description": achievement.description}
12 |
13 | @router.get("/", response_model=List[AchievementOut])
14 | async def list_achievements():
15 | # Logic to list achievements
16 | return []
17 |
18 | @router.get("/{achievement_id}", response_model=AchievementOut)
19 | async def get_achievement(achievement_id: str):
20 | # Logic to get a specific achievement
21 | return {"id": achievement_id, "name": "Achievement Name", "description": "Achievement Description"}
22 |
23 | @router.put("/{achievement_id}", response_model=AchievementOut)
24 | async def update_achievement(achievement_id: str, achievement: AchievementCreate):
25 | # Logic to update an achievement
26 | return {"id": achievement_id, "name": achievement.name, "description": achievement.description}
27 |
28 | @router.delete("/{achievement_id}")
29 | async def delete_achievement(achievement_id: str):
30 | # Logic to delete an achievement
31 | return {"message": "Achievement deleted successfully"}
32 |
--------------------------------------------------------------------------------
/backend/app/services/ai_judge_service.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from IPython.display import display, Markdown
3 | from lionagi import Branch, iModel
4 | from aiocache import cached
5 | from ai_judge.rubric import Rubric
6 | from ai_judge.form import CodeAnalysisForm
7 | from config import judge_model_config
8 |
9 |
10 | @cached(ttl=3600)
11 | async def judge_code(
12 | code_submission: str,
13 | rubric: Rubric,
14 | instruction: str = None,
15 | context: str = None,
16 | model_config: dict = None,
17 | display_message: bool = True,
18 | verbose: bool = False,
19 | language: str = "Python",
20 | ) -> CodeAnalysisForm:
21 | branch = Branch(imodel=iModel(**(model_config or judge_model_config)))
22 | form = CodeAnalysisForm(
23 | code_submission=code_submission,
24 | rubric=rubric,
25 | instruction=instruction,
26 | context=context,
27 | language=language,
28 | )
29 | if verbose:
30 | print("Evaluating code submission...")
31 | form = await branch.chat(form=form)
32 | if display_message:
33 | print(form.display_message)
34 | return form.to_dict()
35 |
36 |
37 | async def main():
38 | from ai_judge.code_quality import code_quality_rubric
39 | from ai_judge.sample_codes import code1
40 |
41 | return await judge_code(
42 | code_submission=code1,
43 | rubric=code_quality_rubric,
44 | )
45 |
46 | if __name__ == "__main__":
47 | asyncio.run(main())
--------------------------------------------------------------------------------
/src/pages/ForgotPassword.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react';
2 | import { Link } from 'react-router-dom';
3 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
4 | import { Input } from "@/components/ui/input";
5 | import { Button } from "@/components/ui/button";
6 |
7 | const ForgotPassword = () => {
8 | const [email, setEmail] = useState('');
9 |
10 | const handleSubmit = (e) => {
11 | e.preventDefault();
12 | // TODO: Implement forgot password logic
13 | console.log('Forgot password email:', email);
14 | };
15 |
16 | return (
17 |
18 |
19 |
20 | Forgot Password
21 |
22 |
23 |
33 |
34 | Remember your password? Login
35 |
36 |
37 |
38 |
39 | );
40 | };
41 |
42 | export default ForgotPassword;
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/transactions.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | /*
11 | ### transactions
12 |
13 | | name | type | format | required |
14 | |-------------|--------------------------|-----------|----------|
15 | | id | uuid | uuid | true |
16 | | user_id | uuid | uuid | false |
17 | | amount | numeric | numeric | false |
18 | | type | text | string | false |
19 | | description | text | string | false |
20 | | created_at | timestamp with time zone | timestamp | false |
21 | */
22 |
23 | export const useTransactions = (userId) => useQuery({
24 | queryKey: ['transactions', userId],
25 | queryFn: () => fromSupabase(supabase.from('transactions').select('*').eq('user_id', userId)),
26 | });
27 |
28 | export const useAddTransaction = () => {
29 | const queryClient = useQueryClient();
30 | return useMutation({
31 | mutationFn: (newTransaction) => fromSupabase(supabase.from('transactions').insert([newTransaction])),
32 | onSuccess: (_, variables) => {
33 | queryClient.invalidateQueries(['transactions', variables.user_id]);
34 | },
35 | });
36 | };
--------------------------------------------------------------------------------
/src/components/ui/alert.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { cva } from "class-variance-authority";
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const alertVariants = cva(
7 | "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
8 | {
9 | variants: {
10 | variant: {
11 | default: "bg-background text-foreground",
12 | destructive:
13 | "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
14 | },
15 | },
16 | defaultVariants: {
17 | variant: "default",
18 | },
19 | }
20 | )
21 |
22 | const Alert = React.forwardRef(({ className, variant, ...props }, ref) => (
23 |
28 | ))
29 | Alert.displayName = "Alert"
30 |
31 | const AlertTitle = React.forwardRef(({ className, ...props }, ref) => (
32 |
36 | ))
37 | AlertTitle.displayName = "AlertTitle"
38 |
39 | const AlertDescription = React.forwardRef(({ className, ...props }, ref) => (
40 |
44 | ))
45 | AlertDescription.displayName = "AlertDescription"
46 |
47 | export { Alert, AlertTitle, AlertDescription }
48 |
--------------------------------------------------------------------------------
/src/components/ui/scroll-area.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => (
7 |
11 |
12 | {children}
13 |
14 |
15 |
16 |
17 | ))
18 | ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
19 |
20 | const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => (
21 |
33 |
34 |
35 | ))
36 | ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
37 |
38 | export { ScrollArea, ScrollBar }
39 |
--------------------------------------------------------------------------------
/src/components/admin/SecurityCompliance.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
3 | import { Shield, Key, Database, Zap } from 'lucide-react';
4 | import SecurityTab from './SecurityTab';
5 | import APIManagementTab from './APIManagementTab';
6 | import BackupRecoveryTab from './BackupRecoveryTab';
7 | import SystemHealthTab from './SystemHealthTab';
8 |
9 | const SecurityCompliance = () => {
10 | return (
11 |
12 |
Security & Compliance
13 |
Manage security settings, API access, backups, and system health.
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | );
30 | };
31 |
32 | export default SecurityCompliance;
--------------------------------------------------------------------------------
/src/components/admin/AnalyticsReporting.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
3 | import { BarChart2, DollarSign, Users, Trophy } from 'lucide-react';
4 | import AnalyticsTab from './AnalyticsTab';
5 | import FinanceTab from './FinanceTab';
6 | import LeaderboardTab from './LeaderboardTab';
7 | import EventsTab from './EventsTab';
8 |
9 | const AnalyticsReporting = () => {
10 | return (
11 |
12 |
Analytics & Reporting
13 |
Access platform analytics, financial data, leaderboards, and event metrics.
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | );
30 | };
31 |
32 | export default AnalyticsReporting;
--------------------------------------------------------------------------------
/src/components/admin/SystemHealthTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const SystemHealthTab = () => {
6 | return (
7 |
8 |
9 |
10 | Server Performance
11 |
12 |
13 | Monitor Server Metrics
14 | View real-time server performance statistics.
15 | View Server Metrics
16 |
17 |
18 |
19 |
20 |
21 | API Usage
22 |
23 |
24 | API Call Statistics
25 | Monitor API usage and performance.
26 | View API Stats
27 |
28 |
29 |
30 |
31 |
32 | Error Logs
33 |
34 |
35 | System Error Reports
36 | Review recent system errors and exceptions.
37 | View Error Logs
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default SystemHealthTab;
--------------------------------------------------------------------------------
/src/components/admin/SecurityTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const SecurityTab = () => {
6 | return (
7 |
8 |
9 |
10 | Security Settings
11 |
12 |
13 | Access Logs
14 | Review recent admin access logs and suspicious activities.
15 | View Access Logs
16 |
17 |
18 |
19 |
20 |
21 | Compliance Tools
22 |
23 |
24 | GDPR Compliance
25 | Manage data protection and privacy settings.
26 | Configure GDPR Settings
27 |
28 |
29 |
30 |
31 |
32 | Security Audits
33 |
34 |
35 | Schedule Security Audit
36 | Set up regular security audits for the platform.
37 | Schedule Audit
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default SecurityTab;
--------------------------------------------------------------------------------
/src/components/admin/SupportTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const SupportTab = () => {
6 | return (
7 |
8 |
9 |
10 | User Feedback
11 |
12 |
13 | Review User Feedback
14 | View and respond to user feedback and suggestions.
15 | View Feedback
16 |
17 |
18 |
19 |
20 |
21 | Support Tickets
22 |
23 |
24 | Manage Support Tickets
25 | Handle open support tickets and user inquiries.
26 | Open Ticket Dashboard
27 |
28 |
29 |
30 |
31 |
32 | Knowledge Base
33 |
34 |
35 | Update Help Articles
36 | Manage and update the platform's knowledge base and FAQs.
37 | Edit Knowledge Base
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default SupportTab;
--------------------------------------------------------------------------------
/src/components/admin/GamificationTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const GamificationTab = () => {
6 | return (
7 |
8 |
9 |
10 | Achievements
11 |
12 |
13 | Manage Achievements
14 | Create and edit user achievements and badges.
15 | Edit Achievements
16 |
17 |
18 |
19 |
20 |
21 | XP System
22 |
23 |
24 | Configure XP and Levels
25 | Adjust the experience points system and user levels.
26 | Configure XP System
27 |
28 |
29 |
30 |
31 |
32 | Leaderboards
33 |
34 |
35 | Leaderboard Settings
36 | Manage global and challenge-specific leaderboards.
37 | Edit Leaderboard Settings
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default GamificationTab;
--------------------------------------------------------------------------------
/src/components/admin/APIManagementTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const APIManagementTab = () => {
6 | return (
7 |
8 |
9 |
10 | API Keys
11 |
12 |
13 | Manage API Keys
14 | Create, revoke, and manage API keys for developers.
15 | Manage API Keys
16 |
17 |
18 |
19 |
20 |
21 | API Usage Monitoring
22 |
23 |
24 | Monitor API Usage
25 | Track and analyze API usage across the platform.
26 | View API Analytics
27 |
28 |
29 |
30 |
31 |
32 | API Documentation
33 |
34 |
35 | Update API Docs
36 | Manage and update the API documentation for developers.
37 | Edit API Documentation
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default APIManagementTab;
--------------------------------------------------------------------------------
/src/components/admin/EventsTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const EventsTab = () => {
6 | return (
7 |
8 |
9 |
10 | Special Events
11 |
12 |
13 | Manage Special Events
14 | Create and manage special AI hacking events.
15 | Create New Event
16 |
17 |
18 |
19 |
20 |
21 | Seasonal Challenges
22 |
23 |
24 | Seasonal Challenge Management
25 | Set up and configure seasonal AI challenges.
26 | Manage Seasonal Challenges
27 |
28 |
29 |
30 |
31 |
32 | Event Analytics
33 |
34 |
35 | Event Performance Metrics
36 | View analytics and performance data for past events.
37 | View Event Analytics
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default EventsTab;
--------------------------------------------------------------------------------
/src/components/admin/BackupRecoveryTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const BackupRecoveryTab = () => {
6 | return (
7 |
8 |
9 |
10 | Database Backups
11 |
12 |
13 | Manage Backups
14 | Schedule and manage automated database backups.
15 | Configure Backup Schedule
16 |
17 |
18 |
19 |
20 |
21 | System Restore Points
22 |
23 |
24 | Create Restore Points
25 | Set up system restore points for quick recovery.
26 | Create Restore Point
27 |
28 |
29 |
30 |
31 |
32 | Data Recovery
33 |
34 |
35 | Restore Data
36 | Restore data from previous backups or restore points.
37 | Start Recovery Process
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default BackupRecoveryTab;
--------------------------------------------------------------------------------
/src/components/admin/IntegrationsTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const IntegrationsTab = () => {
6 | return (
7 |
8 |
9 |
10 | Third-Party Services
11 |
12 |
13 | Manage Integrations
14 | Configure and manage third-party service integrations.
15 | View Integrations
16 |
17 |
18 |
19 |
20 |
21 | API Connections
22 |
23 |
24 | External API Management
25 | Set up and monitor connections to external APIs.
26 | Manage API Connections
27 |
28 |
29 |
30 |
31 |
32 | Webhook Configuration
33 |
34 |
35 | Set Up Webhooks
36 | Configure webhooks for real-time data updates.
37 | Configure Webhooks
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default IntegrationsTab;
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/challenge_management.js:
--------------------------------------------------------------------------------
1 | import { useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | export const useStartChallenge = () => {
5 | const queryClient = useQueryClient();
6 | return useMutation({
7 | mutationFn: async (challengeId) => {
8 | const { data, error } = await supabase.functions.invoke('start-challenge', {
9 | body: { challengeId },
10 | });
11 | if (error) throw error;
12 | return data;
13 | },
14 | onSuccess: () => {
15 | queryClient.invalidateQueries('challenges');
16 | },
17 | });
18 | };
19 |
20 | export const useEndChallenge = () => {
21 | const queryClient = useQueryClient();
22 | return useMutation({
23 | mutationFn: async (challengeId) => {
24 | const { data, error } = await supabase.functions.invoke('end-challenge', {
25 | body: { challengeId },
26 | });
27 | if (error) throw error;
28 | return data;
29 | },
30 | onSuccess: () => {
31 | queryClient.invalidateQueries('challenges');
32 | },
33 | });
34 | };
35 |
36 | export const useUpdateScore = () => {
37 | const queryClient = useQueryClient();
38 | return useMutation({
39 | mutationFn: async ({ challengeId, userId, score }) => {
40 | const { data, error } = await supabase.functions.invoke('update-score', {
41 | body: { challengeId, userId, score },
42 | });
43 | if (error) throw error;
44 | return data;
45 | },
46 | onSuccess: () => {
47 | queryClient.invalidateQueries('challenges');
48 | },
49 | });
50 | };
--------------------------------------------------------------------------------
/src/components/admin/LeaderboardTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const LeaderboardTab = () => {
6 | return (
7 |
8 |
9 |
10 | Leaderboard Management
11 |
12 |
13 | Global Leaderboard
14 | Manage and adjust the global leaderboard rankings.
15 | View Global Leaderboard
16 |
17 |
18 |
19 |
20 |
21 | Challenge Leaderboards
22 |
23 |
24 | Manage Challenge Rankings
25 | View and modify leaderboards for specific challenges.
26 | Manage Challenge Leaderboards
27 |
28 |
29 |
30 |
31 |
32 | Historical Data
33 |
34 |
35 | Access Past Rankings
36 | View and export historical leaderboard data.
37 | Access Historical Data
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default LeaderboardTab;
--------------------------------------------------------------------------------
/src/components/admin/LocalizationTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 |
5 | const LocalizationTab = () => {
6 | return (
7 |
8 |
9 |
10 | Language Settings
11 |
12 |
13 | Manage Supported Languages
14 | Add, remove, or update supported languages for the platform.
15 | Edit Language Settings
16 |
17 |
18 |
19 |
20 |
21 | Translation Management
22 |
23 |
24 | Update Translations
25 | Edit and manage translations for all supported languages.
26 | Manage Translations
27 |
28 |
29 |
30 |
31 |
32 | Localization Preview
33 |
34 |
35 | Preview Localized Content
36 | Test and preview how content appears in different languages.
37 | Open Preview Tool
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default LocalizationTab;
--------------------------------------------------------------------------------
/src/components/ui/card.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 |
3 | import { cn } from "@/lib/utils"
4 |
5 | const Card = React.forwardRef(({ className, ...props }, ref) => (
6 |
10 | ))
11 | Card.displayName = "Card"
12 |
13 | const CardHeader = React.forwardRef(({ className, ...props }, ref) => (
14 |
18 | ))
19 | CardHeader.displayName = "CardHeader"
20 |
21 | const CardTitle = React.forwardRef(({ className, ...props }, ref) => (
22 |
26 | ))
27 | CardTitle.displayName = "CardTitle"
28 |
29 | const CardDescription = React.forwardRef(({ className, ...props }, ref) => (
30 |
34 | ))
35 | CardDescription.displayName = "CardDescription"
36 |
37 | const CardContent = React.forwardRef(({ className, ...props }, ref) => (
38 |
39 | ))
40 | CardContent.displayName = "CardContent"
41 |
42 | const CardFooter = React.forwardRef(({ className, ...props }, ref) => (
43 |
47 | ))
48 | CardFooter.displayName = "CardFooter"
49 |
50 | export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
51 |
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/replays.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | export const useReplays = (challengeId) => useQuery({
11 | queryKey: ['replays', challengeId],
12 | queryFn: () => fromSupabase(supabase.from('coding_actions').select('*').eq('challenge_id', challengeId)),
13 | });
14 |
15 | export const useAddReplay = () => {
16 | const queryClient = useQueryClient();
17 | return useMutation({
18 | mutationFn: async (replayData) => {
19 | const { data, error } = await supabase.from('coding_actions').insert([replayData]);
20 | if (error) throw error;
21 | return data;
22 | },
23 | onSuccess: (_, variables) => {
24 | queryClient.invalidateQueries(['replays', variables.challenge_id]);
25 | },
26 | });
27 | };
28 |
29 | export const useLatestReplay = (challengeId) => useQuery({
30 | queryKey: ['latest-replay', challengeId],
31 | queryFn: () => fromSupabase(supabase.from('coding_actions').select('*').eq('challenge_id', challengeId).order('created_at', { ascending: false }).limit(1)),
32 | });
33 |
34 | export const useGenerateReplayVisualization = () => {
35 | return useMutation({
36 | mutationFn: async (challengeId) => {
37 | const { data, error } = await supabase.functions.invoke('generate-replay-visualization', {
38 | body: { challengeId },
39 | });
40 | if (error) throw error;
41 | return data;
42 | },
43 | });
44 | };
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/profiles.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | /*
11 | ### profiles
12 |
13 | | name | type | format | required |
14 | |-----------------|--------------------------|-----------|----------|
15 | | id | uuid | uuid | true |
16 | | username | text | string | false |
17 | | full_name | text | string | false |
18 | | avatar_url | text | string | false |
19 | | website | text | string | false |
20 | | github_username | text | string | false |
21 | | created_at | timestamp with time zone | timestamp | false |
22 | | updated_at | timestamp with time zone | timestamp | false |
23 | */
24 |
25 | export const useProfile = (userId) => useQuery({
26 | queryKey: ['profile', userId],
27 | queryFn: () => fromSupabase(supabase.from('profiles').select('*').eq('id', userId).single()),
28 | });
29 |
30 | export const useUpdateProfile = () => {
31 | const queryClient = useQueryClient();
32 | return useMutation({
33 | mutationFn: ({ id, ...updateData }) => fromSupabase(supabase.from('profiles').update(updateData).eq('id', id)),
34 | onSuccess: (_, variables) => {
35 | queryClient.invalidateQueries(['profile', variables.id]);
36 | },
37 | });
38 | };
--------------------------------------------------------------------------------
/src/components/ui/tabs.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as TabsPrimitive from "@radix-ui/react-tabs"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const Tabs = TabsPrimitive.Root
7 |
8 | const TabsList = React.forwardRef(({ className, ...props }, ref) => (
9 |
16 | ))
17 | TabsList.displayName = TabsPrimitive.List.displayName
18 |
19 | const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (
20 |
27 | ))
28 | TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
29 |
30 | const TabsContent = React.forwardRef(({ className, ...props }, ref) => (
31 |
38 | ))
39 | TabsContent.displayName = TabsPrimitive.Content.displayName
40 |
41 | export { Tabs, TabsList, TabsTrigger, TabsContent }
42 |
--------------------------------------------------------------------------------
/src/components/ui/resizable.jsx:
--------------------------------------------------------------------------------
1 | import { GripVertical } from "lucide-react"
2 | import * as ResizablePrimitive from "react-resizable-panels"
3 |
4 | import { cn } from "@/lib/utils"
5 |
6 | const ResizablePanelGroup = ({
7 | className,
8 | ...props
9 | }) => (
10 |
16 | )
17 |
18 | const ResizablePanel = ResizablePrimitive.Panel
19 |
20 | const ResizableHandle = ({
21 | withHandle,
22 | className,
23 | ...props
24 | }) => (
25 | div]:rotate-90",
28 | className
29 | )}
30 | {...props}>
31 | {withHandle && (
32 |
34 |
35 |
36 | )}
37 |
38 | )
39 |
40 | export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
41 |
--------------------------------------------------------------------------------
/docs/governance/financial_management.md:
--------------------------------------------------------------------------------
1 | # AI Hacker League Financial Management Policy
2 |
3 | ## Purpose
4 |
5 | This policy outlines the financial management practices of the AI Hacker League to ensure transparency, accountability, and responsible stewardship of resources.
6 |
7 | ## Budget Planning and Approval
8 |
9 | 1. An annual budget will be prepared by the Treasurer and approved by the Board of Directors.
10 | 2. The budget will be reviewed quarterly and adjusted as necessary.
11 |
12 | ## Income Management
13 |
14 | 1. All income will be recorded and deposited promptly.
15 | 2. Donations will be acknowledged within 7 days of receipt.
16 |
17 | ## Expenditure Controls
18 |
19 | 1. All expenditures must be authorized in accordance with the approved budget.
20 | 2. Expenditures over $5,000 require Board approval.
21 | 3. Reimbursements require receipts and must be approved by the Treasurer.
22 |
23 | ## Financial Reporting
24 |
25 | 1. Monthly financial reports will be prepared by the Treasurer.
26 | 2. Quarterly financial statements will be presented to the Board.
27 | 3. An annual financial report will be made available to all members.
28 |
29 | ## Audit
30 |
31 | 1. An independent audit will be conducted annually.
32 | 2. The audit report will be reviewed by the Board and made available to members.
33 |
34 | ## Conflict of Interest
35 |
36 | 1. Board members and staff must disclose any potential conflicts of interest.
37 | 2. Members with conflicts of interest must recuse themselves from related financial decisions.
38 |
39 | ## Investment Policy
40 |
41 | 1. Funds not needed for immediate operations may be invested in low-risk, ethical investments.
42 | 2. The investment strategy will be reviewed annually by the Board.
43 |
--------------------------------------------------------------------------------
/backend/app/api/endpoints/ai_generated_challenges.py:
--------------------------------------------------------------------------------
1 | from fastapi import APIRouter, Depends, HTTPException
2 | from typing import List
3 | from app.schemas.ai_generated_challenge import AIGeneratedChallengeCreate, AIGeneratedChallengeOut
4 | from app.services.supabase_service import supabase_client
5 |
6 | router = APIRouter()
7 |
8 | @router.post("/", response_model=AIGeneratedChallengeOut)
9 | async def create_ai_generated_challenge(challenge: AIGeneratedChallengeCreate):
10 | # Logic to create an AI-generated challenge
11 | return {"id": "123", "title": challenge.title, "description": challenge.description, "difficulty": challenge.difficulty}
12 |
13 | @router.get("/", response_model=List[AIGeneratedChallengeOut])
14 | async def list_ai_generated_challenges():
15 | # Logic to list AI-generated challenges
16 | return []
17 |
18 | @router.get("/{challenge_id}", response_model=AIGeneratedChallengeOut)
19 | async def get_ai_generated_challenge(challenge_id: str):
20 | # Logic to get a specific AI-generated challenge
21 | return {"id": challenge_id, "title": "AI Challenge", "description": "Description here", "difficulty": "medium"}
22 |
23 | @router.put("/{challenge_id}", response_model=AIGeneratedChallengeOut)
24 | async def update_ai_generated_challenge(challenge_id: str, challenge: AIGeneratedChallengeCreate):
25 | # Logic to update an AI-generated challenge
26 | return {"id": challenge_id, "title": challenge.title, "description": challenge.description, "difficulty": challenge.difficulty}
27 |
28 | @router.delete("/{challenge_id}")
29 | async def delete_ai_generated_challenge(challenge_id: str):
30 | # Logic to delete an AI-generated challenge
31 | return {"message": "AI-generated challenge deleted successfully"}
32 |
--------------------------------------------------------------------------------
/src/hooks/useOpenAI.js:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from 'react';
2 | import OpenAI from 'openai';
3 |
4 | export const useOpenAI = () => {
5 | const [openai, setOpenai] = useState(null);
6 | const [error, setError] = useState(null);
7 |
8 | useEffect(() => {
9 | const storedSettings = JSON.parse(localStorage.getItem('llmSettings') || '{}');
10 | const apiKey = storedSettings.apiKey;
11 |
12 | if (!apiKey) {
13 | setError('OpenAI API key is missing. Please set it in the LLM settings.');
14 | return;
15 | }
16 |
17 | try {
18 | const openaiInstance = new OpenAI({
19 | apiKey: apiKey,
20 | dangerouslyAllowBrowser: true // Note: This is for demo purposes. In production, use server-side calls.
21 | });
22 | setOpenai(openaiInstance);
23 | } catch (err) {
24 | setError('Failed to initialize OpenAI client: ' + err.message);
25 | }
26 | }, []);
27 |
28 | const sendMessage = async (message, context) => {
29 | if (error) return error;
30 | if (!openai) return 'OpenAI is not initialized';
31 |
32 | try {
33 | const response = await openai.chat.completions.create({
34 | model: "gpt-3.5-turbo",
35 | messages: [
36 | { role: "system", content: "You are a helpful assistant for the AI Hacking League admin panel. Use the following context to answer questions: " + context },
37 | { role: "user", content: message }
38 | ],
39 | });
40 |
41 | return response.choices[0].message.content;
42 | } catch (error) {
43 | console.error('Error sending message to OpenAI:', error);
44 | return 'An error occurred while processing your request.';
45 | }
46 | };
47 |
48 | return { sendMessage, error };
49 | };
--------------------------------------------------------------------------------
/src/components/ui/accordion.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import * as AccordionPrimitive from "@radix-ui/react-accordion"
3 | import { ChevronDown } from "lucide-react"
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const Accordion = AccordionPrimitive.Root
8 |
9 | const AccordionItem = React.forwardRef(({ className, ...props }, ref) => (
10 |
11 | ))
12 | AccordionItem.displayName = "AccordionItem"
13 |
14 | const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => (
15 |
16 | svg]:rotate-180",
20 | className
21 | )}
22 | {...props}>
23 | {children}
24 |
25 |
26 |
27 | ))
28 | AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
29 |
30 | const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => (
31 |
35 | {children}
36 |
37 | ))
38 |
39 | AccordionContent.displayName = AccordionPrimitive.Content.displayName
40 |
41 | export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
42 |
--------------------------------------------------------------------------------
/src/components/admin/NotificationsTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Button } from "@/components/ui/button";
4 | import { Input } from "@/components/ui/input";
5 | import { Textarea } from "@/components/ui/textarea";
6 |
7 | const NotificationsTab = () => {
8 | return (
9 |
10 |
11 |
12 | Broadcast Notifications
13 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 | Email Templates
26 |
27 |
28 | Manage Email Templates
29 | Edit and create email templates for various system notifications.
30 | Edit Templates
31 |
32 |
33 |
34 |
35 |
36 | Notification Settings
37 |
38 |
39 | Configure Notification Preferences
40 | Set up default notification settings for users.
41 | Configure Settings
42 |
43 |
44 |
45 | );
46 | };
47 |
48 | export default NotificationsTab;
--------------------------------------------------------------------------------
/docs/governance/conflict_resolution.md:
--------------------------------------------------------------------------------
1 | # AI Hacker League Conflict Resolution Policy
2 |
3 | ## Purpose
4 |
5 | The purpose of this policy is to provide a clear and fair process for resolving conflicts within the AI Hacker League community. We believe that addressing conflicts promptly and constructively is essential for maintaining a positive and productive environment for all members.
6 |
7 | ## Principles
8 |
9 | 1. Respect: All parties involved in a conflict should treat each other with respect and dignity.
10 | 2. Fairness: The conflict resolution process should be fair and impartial.
11 | 3. Confidentiality: Information shared during the conflict resolution process should be kept confidential.
12 | 4. Timeliness: Conflicts should be addressed promptly to prevent escalation.
13 |
14 | ## Process
15 |
16 | 1. Direct Communication: Parties involved in a conflict are encouraged to first attempt to resolve the issue through direct, respectful communication.
17 |
18 | 2. Mediation: If direct communication is unsuccessful, either party may request mediation from a designated community mediator.
19 |
20 | 3. Formal Complaint: If mediation is unsuccessful, a formal complaint may be filed with the Conflict Resolution Committee.
21 |
22 | 4. Investigation: The Conflict Resolution Committee will investigate the complaint, gathering information from all parties involved.
23 |
24 | 5. Resolution: Based on the investigation, the Committee will propose a resolution, which may include:
25 | - Recommendations for behavior changes
26 | - Temporary or permanent restrictions on community participation
27 | - Other actions deemed appropriate to resolve the conflict
28 |
29 | 6. Appeal: Parties may appeal the decision to the Board of Directors within 14 days of receiving the resolution.
30 |
--------------------------------------------------------------------------------
/src/components/Header.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react';
2 | import { Moon, Sun, Menu as MenuIcon } from 'lucide-react';
3 | import { useTheme } from 'next-themes';
4 | import { Link } from 'react-router-dom';
5 | import { Button } from "@/components/ui/button";
6 |
7 | const Header = ({ onOpenNav }) => {
8 | const [mounted, setMounted] = useState(false);
9 | const { theme, setTheme } = useTheme();
10 |
11 | useState(() => setMounted(true), []);
12 |
13 | if (!mounted) return null;
14 |
15 | return (
16 |
43 | );
44 | };
45 |
46 | export default Header;
47 |
--------------------------------------------------------------------------------
/src/components/ui/button.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { Slot } from "@radix-ui/react-slot"
3 | import { cva } from "class-variance-authority";
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const buttonVariants = cva(
8 | "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
9 | {
10 | variants: {
11 | variant: {
12 | default: "bg-primary text-primary-foreground hover:bg-primary/90",
13 | destructive:
14 | "bg-destructive text-destructive-foreground hover:bg-destructive/90",
15 | outline:
16 | "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17 | secondary:
18 | "bg-secondary text-secondary-foreground hover:bg-secondary/80",
19 | ghost: "hover:bg-accent hover:text-accent-foreground",
20 | link: "text-primary underline-offset-4 hover:underline",
21 | },
22 | size: {
23 | default: "h-10 px-4 py-2",
24 | sm: "h-9 rounded-md px-3",
25 | lg: "h-11 rounded-md px-8",
26 | icon: "h-10 w-10",
27 | },
28 | },
29 | defaultVariants: {
30 | variant: "default",
31 | size: "default",
32 | },
33 | }
34 | )
35 |
36 | const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
37 | const Comp = asChild ? Slot : "button"
38 | return (
39 | ( )
43 | );
44 | })
45 | Button.displayName = "Button"
46 |
47 | export { Button, buttonVariants }
48 |
--------------------------------------------------------------------------------
/src/components/admin/HomeTab.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 | import { Users, Settings, BarChart2, Shield } from 'lucide-react';
4 |
5 | const HomeTab = () => {
6 | const sections = [
7 | { id: 'community', label: 'Community Management', icon: Users, description: 'Manage users, challenges, and content moderation.' },
8 | { id: 'system', label: 'System Configuration', icon: Settings, description: 'Configure platform settings, AI judging, and notifications.' },
9 | { id: 'analytics', label: 'Analytics & Reporting', icon: BarChart2, description: 'Access detailed platform analytics and generate reports.' },
10 | { id: 'security', label: 'Security & Compliance', icon: Shield, description: 'Manage security settings, backups, and compliance tools.' },
11 | ];
12 |
13 | return (
14 |
15 |
Welcome to the Admin Dashboard
16 |
17 | This dashboard provides comprehensive tools for managing the AI Hacking League platform.
18 | Select a section to get started:
19 |
20 |
21 | {sections.map((section) => (
22 |
23 |
24 |
25 |
26 | {section.label}
27 |
28 |
29 |
30 | {section.description}
31 |
32 |
33 | ))}
34 |
35 |
36 | );
37 | };
38 |
39 | export default HomeTab;
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/user_achievements.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | /*
11 | ### user_achievements
12 |
13 | | name | type | format | required |
14 | |----------------|--------------------------|-----------|----------|
15 | | user_id | uuid | uuid | true |
16 | | achievement_id | uuid | uuid | true |
17 | | earned_at | timestamp with time zone | timestamp | false |
18 |
19 | Foreign Key Relationships:
20 | - achievement_id references achievements.id
21 | */
22 |
23 | export const useUserAchievements = (userId) => useQuery({
24 | queryKey: ['user_achievements', userId],
25 | queryFn: () => fromSupabase(supabase.from('user_achievements').select('*').eq('user_id', userId)),
26 | });
27 |
28 | export const useAddUserAchievement = () => {
29 | const queryClient = useQueryClient();
30 | return useMutation({
31 | mutationFn: (newAchievement) => fromSupabase(supabase.from('user_achievements').insert([newAchievement])),
32 | onSuccess: (_, variables) => {
33 | queryClient.invalidateQueries(['user_achievements', variables.user_id]);
34 | },
35 | });
36 | };
37 |
38 | export const useDeleteUserAchievement = () => {
39 | const queryClient = useQueryClient();
40 | return useMutation({
41 | mutationFn: ({ user_id, achievement_id }) => fromSupabase(supabase.from('user_achievements').delete().match({ user_id, achievement_id })),
42 | onSuccess: (_, variables) => {
43 | queryClient.invalidateQueries(['user_achievements', variables.user_id]);
44 | },
45 | });
46 | };
--------------------------------------------------------------------------------
/docs/governance/decision_making.md:
--------------------------------------------------------------------------------
1 | # AI Hacker League Decision-Making Framework
2 |
3 | ## Purpose
4 |
5 | This framework outlines the process for making decisions within the AI Hacker League, ensuring that decisions are made efficiently, transparently, and in alignment with our mission and values.
6 |
7 | ## Types of Decisions
8 |
9 | 1. Operational Decisions: Made by relevant team members or committees.
10 | 2. Strategic Decisions: Made by the Board of Directors.
11 | 3. Community-wide Decisions: May involve member voting or consultation.
12 |
13 | ## Decision-Making Process
14 |
15 | 1. Identify the Issue: Clearly define the decision to be made.
16 |
17 | 2. Gather Information: Collect relevant data and perspectives.
18 |
19 | 3. Develop Options: Generate potential solutions or courses of action.
20 |
21 | 4. Evaluate Options: Assess each option against predetermined criteria.
22 |
23 | 5. Make the Decision:
24 | - For operational decisions: Team lead or committee chair decides.
25 | - For strategic decisions: Board vote (simple majority).
26 | - For community-wide decisions: Member vote or Board decision based on community input.
27 |
28 | 6. Communicate the Decision: Inform all relevant stakeholders.
29 |
30 | 7. Implement and Review: Put the decision into action and monitor outcomes.
31 |
32 | ## Consensus and Voting
33 |
34 | - Strive for consensus when possible.
35 | - When voting is necessary, a simple majority (>50%) is required unless otherwise specified in the bylaws.
36 |
37 | ## Transparency
38 |
39 | - Decision-making processes and outcomes will be documented and made available to members.
40 | - Regular updates on major decisions will be communicated to the community.
41 |
42 | ## Appeals
43 |
44 | - Decisions can be appealed to the next level of authority within 14 days.
45 | - The appeal process will be overseen by an independent committee.
46 |
--------------------------------------------------------------------------------
/src/components/admin/modals/BanUserModal.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
3 | import { Button } from "@/components/ui/button";
4 | import { Textarea } from "@/components/ui/textarea";
5 | import { Label } from "@/components/ui/label";
6 |
7 | const BanUserModal = ({ user, isOpen, onClose, onConfirm, isBanning = true }) => {
8 | const [reason, setReason] = useState('');
9 |
10 | const handleSubmit = (e) => {
11 | e.preventDefault();
12 | onConfirm(reason);
13 | setReason('');
14 | };
15 |
16 | return (
17 |
18 |
19 |
20 | {isBanning ? 'Ban User' : 'Unban User'}
21 |
22 |
23 |
24 |
25 |
User
26 |
{user.username}
27 |
28 |
29 | {isBanning ? 'Ban' : 'Unban'} Reason
30 | setReason(e.target.value)}
34 | placeholder={`Reason for ${isBanning ? 'banning' : 'unbanning'} the user...`}
35 | />
36 |
37 |
38 |
39 | Cancel
40 | {isBanning ? 'Ban User' : 'Unban User'}
41 |
42 |
43 |
44 |
45 | );
46 | };
47 |
48 | export default BanUserModal;
49 |
--------------------------------------------------------------------------------
/src/components/EnrollmentModal.jsx:
--------------------------------------------------------------------------------
1 | import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "@/components/ui/dialog";
2 | import { Button } from "@/components/ui/button";
3 | import { useState } from 'react';
4 |
5 | const EnrollmentModal = ({ isOpen, onClose, challenge }) => {
6 | const [isEnrolling, setIsEnrolling] = useState(false);
7 |
8 | const handleEnroll = async () => {
9 | setIsEnrolling(true);
10 | // TODO: Implement actual enrollment logic here, including payment processing
11 | await new Promise(resolve => setTimeout(resolve, 1000)); // Simulating API call
12 | setIsEnrolling(false);
13 | onClose();
14 | // TODO: Show success message or update UI to reflect enrollment
15 | };
16 |
17 | if (!challenge) return null;
18 |
19 | return (
20 |
21 |
22 |
23 | Enroll in Challenge
24 |
25 | You are about to enroll in the "{challenge.title}" challenge.
26 |
27 |
28 |
29 |
Difficulty: {challenge.difficulty}
30 |
Current Participants: {challenge.participants}
31 |
Buy-in Amount: ${challenge.buyIn}
32 |
Potential Prize: {challenge.prize.amount} {challenge.prize.currency}
33 |
34 |
35 | Cancel
36 |
37 | {isEnrolling ? 'Processing...' : `Confirm Enrollment ($${challenge.buyIn})`}
38 |
39 |
40 |
41 |
42 | );
43 | };
44 |
45 | export default EnrollmentModal;
--------------------------------------------------------------------------------
/src/components/admin/modals/ChatLogReviewModal.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
3 | import { Button } from "@/components/ui/button";
4 | import { ScrollArea } from "@/components/ui/scroll-area";
5 |
6 | const ChatLogReviewModal = ({ onClose }) => {
7 | const [chatLogs, setChatLogs] = useState([
8 | { id: 1, user: 'User1', message: 'Hello, how are you?', timestamp: '2024-03-15T10:30:00Z' },
9 | { id: 2, user: 'User2', message: 'I\'m good, thanks!', timestamp: '2024-03-15T10:31:00Z' },
10 | // Add more mock chat logs as needed
11 | ]);
12 |
13 | const handleDeleteMessage = (id) => {
14 | setChatLogs(chatLogs.filter(log => log.id !== id));
15 | };
16 |
17 | return (
18 |
19 |
20 |
21 | Chat Log Review
22 |
23 |
24 | {chatLogs.map((log) => (
25 |
26 |
27 | {log.user}
28 | {new Date(log.timestamp).toLocaleString()}
29 |
30 |
{log.message}
31 |
handleDeleteMessage(log.id)}>
32 | Delete Message
33 |
34 |
35 | ))}
36 |
37 |
38 | Close
39 |
40 |
41 |
42 | );
43 | };
44 |
45 | export default ChatLogReviewModal;
--------------------------------------------------------------------------------
/backend/app/services/supabase_service.py:
--------------------------------------------------------------------------------
1 | from supabase import create_client, Client
2 | from app.core.config import settings
3 | import logging
4 |
5 | logger = logging.getLogger(__name__)
6 |
7 | def get_supabase_client() -> Client:
8 | try:
9 | if settings.SUPABASE_URL and settings.SUPABASE_KEY:
10 | logger.debug(f"Initializing Supabase client with URL: {settings.SUPABASE_URL}")
11 | logger.debug(f"Using API Key (last 4 chars): ...{settings.SUPABASE_KEY[-4:]}")
12 | return create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY)
13 | else:
14 | logger.error("Supabase URL or Key is missing.")
15 | return None
16 | except Exception as e:
17 | logger.exception(f"An error occurred while initializing Supabase client: {e}")
18 | return None
19 |
20 | def get_admin_supabase_client() -> Client:
21 | try:
22 | if settings.SUPABASE_URL and settings.SUPABASE_SERVICE_ROLE_KEY:
23 | logger.debug(f"Initializing Admin Supabase client with URL: {settings.SUPABASE_URL}")
24 | logger.debug(f"Using Service Role Key (last 4 chars): ...{settings.SUPABASE_SERVICE_ROLE_KEY[-4:]}")
25 | return create_client(settings.SUPABASE_URL, settings.SUPABASE_SERVICE_ROLE_KEY)
26 | else:
27 | logger.error("Supabase URL or Service Role Key is missing.")
28 | return None
29 | except Exception as e:
30 | logger.exception(f"An error occurred while initializing Admin Supabase client: {e}")
31 | return None
32 |
33 | # Initialize the Supabase clients
34 | supabase_client = get_supabase_client()
35 | admin_supabase_client = get_admin_supabase_client()
36 |
37 | if supabase_client:
38 | logger.info("Supabase client initialized successfully.")
39 | else:
40 | logger.warning("Failed to initialize Supabase client.")
41 |
42 | if admin_supabase_client:
43 | logger.info("Admin Supabase client initialized successfully.")
44 | else:
45 | logger.warning("Failed to initialize Admin Supabase client.")
--------------------------------------------------------------------------------
/src/integrations/supabase/auth.jsx:
--------------------------------------------------------------------------------
1 | import { useState, useEffect, createContext, useContext } from 'react';
2 | import { supabase } from './supabase.js';
3 | import { useQueryClient } from '@tanstack/react-query';
4 | import { Auth } from '@supabase/auth-ui-react';
5 | import { ThemeSupa } from '@supabase/auth-ui-shared';
6 |
7 | const SupabaseAuthContext = createContext();
8 |
9 | export const SupabaseAuthProvider = ({ children }) => {
10 | return (
11 |
12 | {children}
13 |
14 | );
15 | }
16 |
17 | export const SupabaseAuthProviderInner = ({ children }) => {
18 | const [session, setSession] = useState(null);
19 | const [loading, setLoading] = useState(true);
20 | const queryClient = useQueryClient();
21 |
22 | useEffect(() => {
23 | const getSession = async () => {
24 | setLoading(true);
25 | const { data: { session } } = await supabase.auth.getSession();
26 | setSession(session);
27 | setLoading(false);
28 | };
29 |
30 | const { data: authListener } = supabase.auth.onAuthStateChange((event, session) => {
31 | setSession(session);
32 | queryClient.invalidateQueries('user');
33 | });
34 |
35 | getSession();
36 |
37 | return () => {
38 | authListener.subscription.unsubscribe();
39 | setLoading(false);
40 | };
41 | }, [queryClient]);
42 |
43 | const logout = async () => {
44 | await supabase.auth.signOut();
45 | setSession(null);
46 | queryClient.invalidateQueries('user');
47 | setLoading(false);
48 | };
49 |
50 | return (
51 |
52 | {children}
53 |
54 | );
55 | };
56 |
57 | export const useSupabaseAuth = () => {
58 | return useContext(SupabaseAuthContext);
59 | };
60 |
61 | export const SupabaseAuthUI = () => (
62 |
68 | );
--------------------------------------------------------------------------------
/src/components/ui/input-otp.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { OTPInput, OTPInputContext } from "input-otp"
3 | import { Dot } from "lucide-react"
4 |
5 | import { cn } from "@/lib/utils"
6 |
7 | const InputOTP = React.forwardRef(({ className, containerClassName, ...props }, ref) => (
8 |
13 | ))
14 | InputOTP.displayName = "InputOTP"
15 |
16 | const InputOTPGroup = React.forwardRef(({ className, ...props }, ref) => (
17 |
18 | ))
19 | InputOTPGroup.displayName = "InputOTPGroup"
20 |
21 | const InputOTPSlot = React.forwardRef(({ index, className, ...props }, ref) => {
22 | const inputOTPContext = React.useContext(OTPInputContext)
23 | const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
24 |
25 | return (
26 | (
34 | {char}
35 | {hasFakeCaret && (
36 |
40 | )}
41 |
)
42 | );
43 | })
44 | InputOTPSlot.displayName = "InputOTPSlot"
45 |
46 | const InputOTPSeparator = React.forwardRef(({ ...props }, ref) => (
47 |
48 |
49 |
50 | ))
51 | InputOTPSeparator.displayName = "InputOTPSeparator"
52 |
53 | export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
54 |
--------------------------------------------------------------------------------
/src/pages/Home.jsx:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from 'react';
2 | import { Button } from "@/components/ui/button";
3 | import { Link } from 'react-router-dom';
4 | import { HeroSection } from '../components/HeroSection';
5 | import { FeatureSection } from '../components/FeatureSection';
6 | import { UpcomingChallenges } from '../components/UpcomingChallenges';
7 | import { CallToAction } from '../components/CallToAction';
8 | import { SponsorSection } from '../components/SponsorSection';
9 |
10 | const Home = () => {
11 | const [upcomingChallenges, setUpcomingChallenges] = useState([]);
12 |
13 | useEffect(() => {
14 | setUpcomingChallenges([
15 | {
16 | id: 1,
17 | title: 'Rapid AI Chatbot Showdown',
18 | date: '2024-03-15',
19 | difficulty: 'Medium',
20 | timeLimit: '30 min',
21 | participants: 120,
22 | maxParticipants: 200,
23 | buyIn: 50,
24 | prize: '$7,500',
25 | xp: 1000,
26 | icon: 'Zap',
27 | },
28 | {
29 | id: 2,
30 | title: 'Neural Network Nemesis',
31 | date: '2024-03-22',
32 | difficulty: 'Hard',
33 | timeLimit: '45 min',
34 | participants: 80,
35 | maxParticipants: 150,
36 | buyIn: 100,
37 | prize: '$15,000',
38 | xp: 2000,
39 | icon: 'Brain',
40 | },
41 | {
42 | id: 3,
43 | title: 'AI for Good: Climate Hack',
44 | date: '2024-03-29',
45 | difficulty: 'Easy',
46 | timeLimit: '20 min',
47 | participants: 250,
48 | maxParticipants: 500,
49 | buyIn: 25,
50 | prize: '$5,000 + $7,000 to charity',
51 | xp: 800,
52 | icon: 'Flame',
53 | },
54 | ]);
55 | }, []);
56 |
57 | return (
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | );
66 | };
67 |
68 | export default Home;
--------------------------------------------------------------------------------
/src/components/admin/SystemConfiguration.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
3 | import { Settings, Bell, Globe, Bot, Shield, Github } from 'lucide-react';
4 | import ConfigTab from './ConfigTab';
5 | import NotificationsTab from './NotificationsTab';
6 | import LocalizationTab from './LocalizationTab';
7 | import LLMSettingsTab from './LLMSettingsTab';
8 | import SecurityTab from './SecurityTab';
9 | import GitHubIntegrationTab from './GitHubIntegrationTab';
10 |
11 | const SystemConfiguration = () => {
12 | return (
13 |
14 |
System Configuration
15 |
Manage system settings, notifications, localization, LLM settings, security, and GitHub integration.
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | );
38 | };
39 |
40 | export default SystemConfiguration;
41 |
--------------------------------------------------------------------------------
/docs/governance/meritocracy.md:
--------------------------------------------------------------------------------
1 | # AI Hacker League Meritocracy Policy
2 |
3 | ## Purpose
4 |
5 | This policy outlines the AI Hacker League's commitment to a meritocratic system that recognizes and rewards individual contributions, skills, and achievements within our community.
6 |
7 | ## Principles
8 |
9 | 1. Equal Opportunity: All members have equal opportunities to contribute and advance based on their merits.
10 | 2. Transparency: The criteria for recognition and advancement are clearly communicated and consistently applied.
11 | 3. Continuous Improvement: We encourage and support ongoing learning and skill development.
12 | 4. Fairness: Evaluations are based on objective criteria and demonstrable achievements.
13 |
14 | ## Recognition and Advancement
15 |
16 | 1. Skill Levels: Members can progress through defined skill levels based on their contributions and achievements.
17 | 2. Badges and Achievements: Specific accomplishments are recognized through a system of badges and achievements.
18 | 3. Leadership Roles: Leadership positions are filled based on demonstrated skills, contributions, and community trust.
19 |
20 | ## Evaluation Process
21 |
22 | 1. Regular Assessments: Member contributions are assessed regularly through peer reviews and objective metrics.
23 | 2. Feedback: Members receive constructive feedback on their performance and areas for improvement.
24 | 3. Appeals: A fair process is in place for members to appeal evaluation decisions.
25 |
26 | ## Balancing Meritocracy and Inclusivity
27 |
28 | 1. Mentorship: Experienced members are encouraged to mentor newcomers.
29 | 2. Diversity Considerations: We actively work to identify and remove barriers that may prevent underrepresented groups from fully participating in the meritocratic system.
30 | 3. Holistic Evaluation: While technical skills are important, we also value soft skills, community building, and other forms of contribution.
31 |
32 | ## Continuous Improvement of the System
33 |
34 | 1. Regular Review: The meritocracy system itself is reviewed annually to ensure it remains fair and effective.
35 | 2. Community Input: Members are encouraged to provide feedback on the meritocracy system.
36 |
--------------------------------------------------------------------------------
/src/integrations/supabase/hooks/achievements.js:
--------------------------------------------------------------------------------
1 | import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2 | import { supabase } from '../supabase';
3 |
4 | const fromSupabase = async (query) => {
5 | const { data, error } = await query;
6 | if (error) throw new Error(error.message);
7 | return data;
8 | };
9 |
10 | /*
11 | ### achievements
12 |
13 | | name | type | format | required |
14 | |-------------|------|--------|----------|
15 | | id | uuid | uuid | true |
16 | | name | text | string | true |
17 | | description | text | string | false |
18 | | icon_url | text | string | false |
19 | */
20 |
21 | export const useAchievements = () => useQuery({
22 | queryKey: ['achievements'],
23 | queryFn: () => fromSupabase(supabase.from('achievements').select('*')),
24 | });
25 |
26 | export const useAchievement = (id) => useQuery({
27 | queryKey: ['achievement', id],
28 | queryFn: () => fromSupabase(supabase.from('achievements').select('*').eq('id', id).single()),
29 | });
30 |
31 | export const useAddAchievement = () => {
32 | const queryClient = useQueryClient();
33 | return useMutation({
34 | mutationFn: (newAchievement) => fromSupabase(supabase.from('achievements').insert([newAchievement])),
35 | onSuccess: () => {
36 | queryClient.invalidateQueries('achievements');
37 | },
38 | });
39 | };
40 |
41 | export const useUpdateAchievement = () => {
42 | const queryClient = useQueryClient();
43 | return useMutation({
44 | mutationFn: ({ id, ...updateData }) => fromSupabase(supabase.from('achievements').update(updateData).eq('id', id)),
45 | onSuccess: (_, variables) => {
46 | queryClient.invalidateQueries(['achievement', variables.id]);
47 | queryClient.invalidateQueries('achievements');
48 | },
49 | });
50 | };
51 |
52 | export const useDeleteAchievement = () => {
53 | const queryClient = useQueryClient();
54 | return useMutation({
55 | mutationFn: (id) => fromSupabase(supabase.from('achievements').delete().eq('id', id)),
56 | onSuccess: () => {
57 | queryClient.invalidateQueries('achievements');
58 | },
59 | });
60 | };
--------------------------------------------------------------------------------
/src/components/admin/modals/UserEditModal.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
3 | import { Button } from "@/components/ui/button";
4 | import { Input } from "@/components/ui/input";
5 | import { Label } from "@/components/ui/label";
6 |
7 | const UserEditModal = ({ user, onClose }) => {
8 | const [editedUser, setEditedUser] = useState(user || {});
9 |
10 | const handleInputChange = (e) => {
11 | const { name, value } = e.target;
12 | setEditedUser({ ...editedUser, [name]: value });
13 | };
14 |
15 | const handleSubmit = (e) => {
16 | e.preventDefault();
17 | // TODO: Implement user update logic here
18 | console.log('Updated user:', editedUser);
19 | onClose();
20 | };
21 |
22 | return (
23 |
24 |
25 |
26 | {user ? 'Edit User' : 'Add New User'}
27 |
28 |
29 |
50 |
51 | Cancel
52 | Save Changes
53 |
54 |
55 |
56 |
57 | );
58 | };
59 |
60 | export default UserEditModal;
--------------------------------------------------------------------------------