diff --git a/.codacy/codacy.yaml b/.codacy/codacy.yaml index d6b4300..2b74c93 100644 --- a/.codacy/codacy.yaml +++ b/.codacy/codacy.yaml @@ -1,7 +1,8 @@ runtimes: - - node@20.0.0 + - node@22.2.0 - python@3.11.11 tools: - eslint@8.57.0 - pylint@3.3.6 + - semgrep@1.78.0 - trivy@0.66.0 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..526c8a3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=lf \ No newline at end of file diff --git a/.github/instructions/codacy.instructions.md b/.github/instructions/codacy.instructions.md index ceca312..cb073c4 100644 --- a/.github/instructions/codacy.instructions.md +++ b/.github/instructions/codacy.instructions.md @@ -6,13 +6,6 @@ # Codacy Rules Configuration for AI behavior when interacting with Codacy's MCP Server -## using any tool that accepts the arguments: `provider`, `organization`, or `repository` -- ALWAYS use: - - provider: gh - - organization: tim-dickey - - repository: trivia-app -- Avoid calling `git remote -v` unless really necessary - ## CRITICAL: After ANY successful `edit_file` or `reapply` operation - YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with: - `rootPath`: set to the workspace path diff --git a/.gitignore b/.gitignore index db8ba70..8a1e74f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ wheels/ .installed.cfg *.egg venv/ -.venv/ env/ ENV/ @@ -71,3 +70,8 @@ Thumbs.db # Alembic backend/alembic/versions/*.pyc + +# Codacy +.codacy/cli-config.yaml +.codacy/tools-configs/ +.codacy/logs/ diff --git a/.venv/Scripts/python.exe b/.venv/Scripts/python.exe new file mode 100644 index 0000000..8186f87 Binary files /dev/null and b/.venv/Scripts/python.exe differ diff --git a/CHANGELOG.md b/CHANGELOG.md index efdab45..5a1c9f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Backend - **CRITICAL**: Migrated from `python-jose` to `PyJWT` (2.10.1) to address CVE vulnerabilities - **CRITICAL**: Updated `fastapi` from 0.109.0 to 0.115.6 (fixes ReDoS vulnerability in Content-Type header parsing) -- Updated `cryptography` to 44.0.1 (fixes CVE-2024-12797) +- **CRITICAL**: Updated `cryptography` to 46.0.5 (fixes subgroup validation vulnerability for SECT curves; CVE affecting ≤ 46.0.4) - Updated `uvicorn` from 0.27.0 to 0.34.0 (includes security patches) - Updated `pydantic-settings` from 2.1.0 to 2.12.0 - Updated `email-validator` from 2.1.0 to 2.2.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 35241f8..186245b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,17 @@ Before you begin, ensure you have: ```bash git remote add upstream https://github.com/ORIGINAL_OWNER/trivia-app.git ``` -4. **Follow the setup instructions** in the [README.md](README.md) +4. **Set up Python virtual environment**: + ```bash + cd backend + # IMPORTANT: Use 'venv' as the directory name (not '.venv') + # This project standardizes on 'venv/' for consistency across all environments + python -m venv venv + source venv/bin/activate # macOS/Linux + # or: venv\Scripts\activate # Windows + pip install -r requirements.txt + ``` +5. **Follow the remaining setup instructions** in the [README.md](README.md) ## 🔨 How to Contribute diff --git a/DEPENDENCY_UPDATE_SUMMARY.md b/DEPENDENCY_UPDATE_SUMMARY.md index c349197..6d59870 100644 --- a/DEPENDENCY_UPDATE_SUMMARY.md +++ b/DEPENDENCY_UPDATE_SUMMARY.md @@ -11,7 +11,7 @@ Successfully updated all outdated dependencies with security patches as requeste 1. **python-jose → PyJWT Migration** ✅ - **Removed**: `python-jose[cryptography]==3.4.0` (had CVE vulnerabilities) - **Added**: `PyJWT==2.10.1` (secure, actively maintained) - - **Added**: `cryptography==44.0.1` (for PyJWT cryptographic algorithms) + - **Added**: `cryptography==46.0.5` (for PyJWT cryptographic algorithms; fixes subgroup validation vulnerability for SECT curves) - **Code Changes**: Updated `backend/core/security.py` - Changed import: `from jose import jwt, JWTError` → `import jwt` and `from jwt.exceptions import PyJWTError` - Updated exception handling to use `PyJWTError` instead of `JWTError` @@ -24,8 +24,8 @@ Successfully updated all outdated dependencies with security patches as requeste 3. **Cryptography Security Fix** ✅ - **Before**: N/A - - **After**: `cryptography==44.0.1` - - **Fix**: Addresses CVE-2024-12797 (low severity) + - **After**: `cryptography==46.0.5` + - **Fix**: Addresses subgroup validation vulnerability for SECT curves (CVE affecting versions ≤ 46.0.4) #### Other Backend Updates 4. **uvicorn**: `0.27.0` → `0.34.0` (includes security patches) diff --git a/ISSUE_CREATION_INSTRUCTIONS.md b/ISSUE_CREATION_INSTRUCTIONS.md index 7c028fa..8fc64b5 100644 --- a/ISSUE_CREATION_INSTRUCTIONS.md +++ b/ISSUE_CREATION_INSTRUCTIONS.md @@ -19,13 +19,13 @@ Code review of PR #20 documented critical issues. All necessary files have been ✅ **Complete**: All infrastructure and documentation - Issue JSON files (P0, P1, P2) in `_bmad-output/implementation-artifacts/` -- **Consolidated Issues Log** in `_bmad-output/implementation-artifacts/issues-log.json` (20 issues) -- **Recommended**: `scripts/create-issues-from-log.py` - Creates all 20 issues and updates log -- **Alternative**: `scripts/create-github-issues.py` - Creates only 15 code review issues +- **Consolidated Issues Log** in `_bmad-output/implementation-artifacts/issues-log.json` (issue count varies; current log has 20) +- **Recommended**: `scripts/create-issues-from-log.py` - Creates all issues in log (count varies) and updates log +- **Alternative**: `scripts/create-github-issues.py` - Creates code review issues from JSON files (count varies) - Bash scripts in `scripts/` directory - Comprehensive documentation in `_bmad-output/implementation-artifacts/issues-creation-guide.md` -❌ **Pending**: Actual GitHub issues creation (20 issues total: 15 from code review + 5 from PRD validation) +❌ **Pending**: Actual GitHub issues creation (count varies; current log has 20: 15 from code review + 5 from PRD validation) ## Why Issues Weren't Created Automatically @@ -43,14 +43,14 @@ The automated scripts require GitHub CLI (`gh`) authentication, which is not ava gh auth login ``` -2. **Run the consolidated log script** (creates all 20 issues): +2. **Run the consolidated log script** (creates all issues in log; count varies): ```bash cd /home/runner/work/trivia-app/trivia-app python3 scripts/create-issues-from-log.py ``` This will: - - Create all 20 issues automatically (15 code review + 5 PRD validation) + - Create all issues automatically (count varies; current log has 20: 15 code review + 5 PRD validation) - Apply correct labels (priority:critical, priority:high, priority:medium, etc.) - Update `issues-log.json` with GitHub issue numbers automatically - Update status and date fields in the log @@ -62,23 +62,23 @@ The automated scripts require GitHub CLI (`gh`) authentication, which is not ava python3 scripts/create-github-issues.py ``` - This creates only the 15 code review issues and generates a separate tracking file. Does not update `issues-log.json` or include PRD validation issues. + This creates the code review issues from JSON files (count varies) and generates a separate tracking file. Does not update `issues-log.json` or include PRD validation issues. ### Option 2: Manual Creation via Web UI Visit https://github.com/tim-dickey/trivia-app/issues/new for each issue and use the content from: 1. **Consolidated Issues Log** (RECOMMENDED): `_bmad-output/implementation-artifacts/issues-log.md` - - Contains all 20 issues (15 code review + 5 PRD validation) + - Contains all issues in log (count varies; current log has 20: 15 code review + 5 PRD validation) - Well-formatted with all details - Organized by priority (P0, P1, P2) 2. **Detailed Documentation**: `_bmad-output/implementation-artifacts/all-issues-to-create.md` - - Contains 15 code review issues with full body text + - Contains the code review issues with full body text (count varies) - Each issue separated by `---ISSUE-SEPARATOR---` 3. **JSON Data Files** (for API/automation): - - `_bmad-output/implementation-artifacts/issues-log.json` - All 20 issues consolidated + - `_bmad-output/implementation-artifacts/issues-log.json` - consolidated issues (count varies; current log has 20) - `_bmad-output/implementation-artifacts/code-review-issues-p0.json` - 5 P0 Critical issues - `_bmad-output/implementation-artifacts/code-review-issues-p1.json` - 5 P1 High priority issues - `_bmad-output/implementation-artifacts/code-review-issues-p2.json` - 5 P2 Medium priority issues @@ -98,11 +98,11 @@ curl -X POST \ ## Issue Summary -**Total: 20 issues - 5.4 days effort** +**Total: Example from 2026-02-02 review (future reviews may differ)** ### Sources -- **Code Review 2026-02-02**: 15 issues (PR #20 findings) -- **PRD Validation 2026-01-24**: 5 issues (requirements improvements) +- **Code Review 2026-02-02**: Example issues from PR #20 findings +- **PRD Validation 2026-01-24**: Example issues from requirements improvements ### P0 (Critical) - 5 issues - 2.6 days effort 1. **[P0] Consolidate CI/CD Workflows** (3h) - Eliminate duplicate test runs @@ -139,7 +139,7 @@ curl -X POST \ ## Verification After creating the issues, verify: -- [ ] All 20 issues created +- [ ] All issues created (count varies) - [ ] Correct labels applied (priority:critical, priority:high, priority:medium, etc.) - [ ] Issue numbers tracked in `issues-log.json` - [ ] Issues are properly linked in project board (if applicable) @@ -155,7 +155,7 @@ After creating the issues, verify: ## Additional Resources -- **Consolidated Issues Log**: `_bmad-output/implementation-artifacts/issues-log.md` (all 20 issues) +- **Consolidated Issues Log**: `_bmad-output/implementation-artifacts/issues-log.md` (all issues in log; current log has 20) - **Issues Log JSON**: `_bmad-output/implementation-artifacts/issues-log.json` (machine-readable) - **Full documentation**: `_bmad-output/implementation-artifacts/issues-creation-guide.md` - **Action items detail**: `_bmad-output/implementation-artifacts/action-items-2026-02-02.md` (916 lines) diff --git a/README.md b/README.md index 28bc143..03f1676 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,8 @@ This starts only PostgreSQL and Redis containers. cd backend # Create virtual environment +# IMPORTANT: Use 'venv' as the directory name (not '.venv') +# This project standardizes on 'venv/' for consistency python -m venv venv # Activate virtual environment diff --git a/VENV_SETUP.md b/VENV_SETUP.md index 6ec49d9..c28116b 100644 --- a/VENV_SETUP.md +++ b/VENV_SETUP.md @@ -111,6 +111,7 @@ pytest ## Notes +- **Naming Convention**: This project uses `venv/` as the standard virtual environment directory name (NOT `.venv/`). Please use `python -m venv venv` to maintain consistency. - **Global Installation**: The global Python installation has NOT been modified. All dependencies are isolated in the venv directory. - **Compatibility**: SQLAlchemy and Pydantic were upgraded to versions compatible with Python 3.13. - **.gitignore**: The `venv/` directory is already configured in `.gitignore` and will not be committed to the repository. diff --git a/_bmad-output/implementation-artifacts/code-review-issues-tracking.md b/_bmad-output/implementation-artifacts/code-review-issues-tracking.md new file mode 100644 index 0000000..3203983 --- /dev/null +++ b/_bmad-output/implementation-artifacts/code-review-issues-tracking.md @@ -0,0 +1,24 @@ +# Code Review Issues Tracking + +Generated: 2026-02-07 16:51:44 +Source: Code Review 2026-02-02 + +## Created Issues + +**Note**: P0-3 (Implement WebSocket Infrastructure for Real-Time Features) from the source JSON was not created as a GitHub issue during the initial creation run. This may have been intentional or an oversight during the creation process. + +### P0 (Critical) + +- [ ] #61 - [P0] Consolidate CI/CD Workflows to Eliminate Duplicate Test Runs +- [ ] #62 - [P0] Implement Organization Scoping Middleware for Multi-Tenancy +- [ ] #63 - [P0] Fix Test Database Configuration (PostgreSQL in CI) +- [ ] #64 - [P0] Document Required GitHub Secrets for CI/CD + +### P1 (High) + +- [ ] #65 - [P1] Update Outdated Dependencies with Security Patches +- [ ] #66 - [P1] Add Frontend CI Workflow for Quality Validation +- [ ] #67 - [P1] Expand CodeQL Security Analysis to Python and TypeScript +- [ ] #68 - [P1] Add Application Services to Docker Compose +- [ ] #69 - [P1] Add Security Headers Middleware + diff --git a/backend/docker-entrypoint.sh b/backend/docker-entrypoint.sh index c1682f4..92b5a7e 100644 --- a/backend/docker-entrypoint.sh +++ b/backend/docker-entrypoint.sh @@ -8,9 +8,14 @@ echo "===================================" echo "Starting Trivia App Backend..." echo "===================================" +# Extract database connection details from DATABASE_URL or use defaults +DB_HOST="${PGHOST:-postgres}" +DB_USER="${PGUSER:-trivia_user}" +DB_NAME="${PGDATABASE:-trivia_db}" + # Wait for PostgreSQL to be ready echo "Waiting for PostgreSQL to be ready..." -until pg_isready -h postgres -U trivia_user -d trivia_db; do +until pg_isready -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME"; do echo "PostgreSQL is unavailable - sleeping" sleep 2 done diff --git a/backend/requirements.txt b/backend/requirements.txt index ab81d63..8c28ac8 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -12,7 +12,7 @@ psycopg[binary]==3.3.2 # PostgreSQL adapter # Authentication & Security pyjwt==2.10.1 -cryptography==44.0.1 # For PyJWT cryptographic algorithms +cryptography==46.0.5 # For PyJWT cryptographic algorithms passlib[bcrypt]==1.7.4 bcrypt==4.0.1 python-multipart==0.0.22 @@ -22,9 +22,9 @@ celery==5.3.4 redis==5.0.1 #Ensure actual Redis server version (container or cloud) is reasonably current # Validation & Settings -pydantic==2.12.5 +pydantic==2.12.5 # Track FastAPI reasonably closely; upgrade Pydantic within the same major version when needed, not arbitrarily pydantic-settings==2.12.0 -email-validator==2.2.0 # Track FastAPI reasonably closely; upgrade Pydantic within the same major version when needed, not arbitrarily +email-validator==2.2.0 # Testing pytest==9.0.2 diff --git a/docker-compose.yml b/docker-compose.yml index 8cd6084..b84fc3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: environment: - DATABASE_URL=postgresql://trivia_user:trivia_pass@postgres:5432/trivia_db - REDIS_URL=redis://redis:6379/0 - - SECRET_KEY=dev-secret-key-change-in-production-use-openssl-rand-hex-32 + - SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production-use-openssl-rand-hex-32} - DEBUG=True - CORS_ORIGINS=["http://localhost:5173","http://localhost:3000"] - APP_NAME=trivia-app diff --git a/docs/CI_CD.md b/docs/CI_CD.md index a9af4a3..e0d4957 100644 --- a/docs/CI_CD.md +++ b/docs/CI_CD.md @@ -1,7 +1,9 @@ # CI/CD Pipeline Documentation -> **Last Updated**: February 5, 2026 +> **Last Updated**: February 7, 2026 > **Status**: Consolidated workflows - Single CI for PRs, scheduled security scans +> +> **Recent Change**: Removed `.venv/` support from project. Only `venv/` should be used for Python virtual environments. This standardization supersedes any previous configurations or documentation that mentioned `.venv/`. ## Overview @@ -46,8 +48,10 @@ The following tools are configured for code analysis: To optimize analysis time, the following paths are excluded from Codacy analysis: +**Note**: As of February 7, 2026, the project has standardized on `venv/` for Python virtual environments. While `venv/` is the standard, both `venv/` and `.venv/` should remain in `.gitignore` to prevent accidental commits of local environments. + - `node_modules/**` - Node.js dependencies -- `venv/**` - Python virtual environments +- `venv/**`, `.venv/**` - Python virtual environments (**use `venv/` only**) - `__pycache__/**` - Python bytecode cache - `.pytest_cache/**` - Pytest cache - `backend/alembic/versions/**` - Auto-generated database migrations @@ -524,6 +528,7 @@ Set these in: **Repository Settings** → **Secrets and variables** → **Action | Date | Change | Author | |------|--------|--------| +| 2026-02-07 | **Removed `.venv/` support - standardized on `venv/` only** | PR #58 (supersedes prior `.venv` guidance) | | 2026-02-02 | Initial CI/CD documentation | Documentation update | | 2026-02-01 | Added Codacy and CodeQL workflows | PR #21 | diff --git a/docs/CODE_REVIEW_TEST_RESULTS.md b/docs/CODE_REVIEW_TEST_RESULTS.md index 0d48239..a6fe540 100644 --- a/docs/CODE_REVIEW_TEST_RESULTS.md +++ b/docs/CODE_REVIEW_TEST_RESULTS.md @@ -66,7 +66,7 @@ Success Rate: 100% (for completed files) | Test | Status | Details | |------|--------|----------| -| `test_acceptance_criteria_present` | ✅ PASS | All 15 issues have acceptance criteria | +| `test_acceptance_criteria_present` | ✅ PASS | All 15 issues (2026-02-02 review) have acceptance criteria | | `test_acceptance_criteria_format` | ✅ PASS | Criteria use proper checkbox format | **Summary**: All acceptance criteria are properly formatted with minimum 2 criteria per issue. @@ -109,7 +109,7 @@ Success Rate: 100% (for completed files) |------|--------|----------| | No duplicate IDs | ✅ | All IDs unique | | Sequential numbering | ✅ | P0-1 through P2-5, properly sequenced | -| Total distribution | ✅ | 15 issues across 3 complete files | +| Total distribution | ✅ | 15 issues across 3 files for the 2026-02-02 review | ## Quality Metrics @@ -143,7 +143,7 @@ Average effort estimate: 3.8 hours ### Issue Generation Process ✅ **JSON → GitHub Issues Conversion** -- All 15 issues successfully converted to GitHub issues +- All 15 issues from the 2026-02-02 review successfully converted to GitHub issues - Labels properly applied - Body content correctly formatted as Markdown - Priority levels reflected in labels @@ -162,9 +162,9 @@ Average effort estimate: 3.8 hours - Clear connection between review and created issues ✅ **Completeness** -- 5 P0 issues covering critical blockers -- 5 P1 issues covering high-priority work -- 5 P2 issues covering improvements +- 5 P0 issues covering critical blockers (2026-02-02 review) +- 5 P1 issues covering high-priority work (2026-02-02 review) +- 5 P2 issues covering improvements (2026-02-02 review) - P3 template ready for additional issues ## Workflow Process Verification @@ -186,7 +186,7 @@ Average effort estimate: 3.8 hours ### Phase 4: Issue Creation ✅ - Script: [scripts/create-github-issues.py](../../scripts/create-github-issues.py) -- All 15 issues created successfully +- All 15 issues from the 2026-02-02 review created successfully - Labels and metadata correct ### Phase 5: Documentation ✅ diff --git a/docs/ISSUE_GENERATION_PROCESS.md b/docs/ISSUE_GENERATION_PROCESS.md index eacc7a1..2650110 100644 --- a/docs/ISSUE_GENERATION_PROCESS.md +++ b/docs/ISSUE_GENERATION_PROCESS.md @@ -2,7 +2,7 @@ ## Overview -This document describes the complete process for generating GitHub issues from JSON files, supporting all 4 priority levels (P0-P3). +This document describes the complete process for generating GitHub issues from JSON files, supporting all 4 priority levels (P0-P3). The issue count varies based on BMAD review results. ## Priority Levels @@ -75,6 +75,17 @@ cd trivia-app python3 scripts/create-github-issues.py ``` +```powershell +# Method 3: PowerShell wrapper +cd trivia-app +./scripts/run-issue-creation.ps1 +``` + +**WSL Notes**: +- Run `gh auth login` inside WSL (Windows auth does not carry over). +- If you see `^M` or `command not found`, convert line endings: + `sed -i 's/\r$//' scripts/run-issue-creation.sh` + ### Output The script provides: diff --git a/docs/TEST_FRAMEWORK.md b/docs/TEST_FRAMEWORK.md index 427164e..1659a25 100644 --- a/docs/TEST_FRAMEWORK.md +++ b/docs/TEST_FRAMEWORK.md @@ -6,7 +6,7 @@ This document describes the test framework configuration for the trivia-app back ## Testing Dependencies -The source of truth for backend test dependencies is `backend/requirements.txt`. Use the project `venv` and install dependencies before running tests. +The source of truth for backend test dependencies is `backend/requirements.txt`. Use the project `venv` (not `.venv`) and install dependencies before running tests. Key testing-related packages (current requirements): - `pytest==9.0.2` diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f094700..60899e8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "@tanstack/react-query": "^5.8.4", - "axios": "^1.6.2", + "axios": "^1.13.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.20.0", @@ -2368,13 +2368,13 @@ } }, "node_modules/axios": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.4.tgz", - "integrity": "sha512-1wVkUaAO6WyaYtCkcYCOx12ZgpGf9Zif+qXa4n+oYzK558YryKqiL6UWwd5DqiH3VRW0GYhTZQ/vlgJrCoNQlg==", + "version": "1.13.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz", + "integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==", "license": "MIT", "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.4", + "follow-redirects": "^1.15.11", + "form-data": "^4.0.5", "proxy-from-env": "^1.1.0" } }, diff --git a/frontend/package.json b/frontend/package.json index b54cb03..2f897f3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,14 +11,16 @@ "test:coverage": "vitest --coverage" }, "dependencies": { + "@tanstack/react-query": "^5.8.4", + "axios": "^1.13.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.20.0", - "zustand": "^4.4.7", - "@tanstack/react-query": "^5.8.4", - "axios": "^1.6.2" + "zustand": "^4.4.7" }, "devDependencies": { + "@testing-library/jest-dom": "^6.1.5", + "@testing-library/react": "^14.1.2", "@types/react": "^18.3.18", "@types/react-dom": "^18.3.5", "@typescript-eslint/eslint-plugin": "^6.14.0", @@ -28,13 +30,11 @@ "eslint": "^8.55.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", + "jsdom": "^23.0.1", "postcss": "^8.4.32", "tailwindcss": "^3.4.18", "typescript": "^5.7.3", "vite": "^5.4.19", - "vitest": "^1.0.4", - "@testing-library/react": "^14.1.2", - "@testing-library/jest-dom": "^6.1.5", - "jsdom": "^23.0.1" + "vitest": "^1.0.4" } } diff --git a/scripts/README.md b/scripts/README.md index fcf38b3..9bd454d 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -44,7 +44,7 @@ python3 scripts/create-p1-issues.py Creates GitHub issues from the consolidated `issues-log.json` file which includes all issues from multiple sources (code review, PRD validation, etc.). **Features**: -- Creates issues from consolidated log (20 issues total) +- Creates issues from consolidated log (issue count varies by review) - Tracks created issues by updating the log file - Skips already-created issues - Updates GitHub issue numbers in the log @@ -69,7 +69,7 @@ python3 scripts/create-issues-from-log.py Creates GitHub issues from the original code review JSON files (P0, P1, P2). **Features**: -- Creates 15 code review issues +- Creates code review issues from JSON files (issue count varies by review) - Validates JSON structure - Generates tracking file @@ -107,16 +107,28 @@ bash scripts/run-issue-creation.sh --- +### 6. run-issue-creation.ps1 + +PowerShell wrapper script that calls the Python automation with proper setup. + +**Usage**: +```powershell +./scripts/run-issue-creation.ps1 +``` + +--- + ## Comparison | Script | Issues | Source | Tracking | Best For | |--------|--------|--------|----------|----------| | **create-p1-issues.py** | 5 | P1 JSON | p1-issues-created.json | **Creating P1 issues only** | | **create-p1-issues.sh** | 5 | P1 JSON | None | **Bash users, P1 only** | -| **create-issues-from-log.py** | 20 | Consolidated log | Updates log file | **Most comprehensive, all issues** | -| create-github-issues.py | 15 | Code review JSONs | Separate tracking file | Code review issues only | -| create-code-review-issues.sh | 15 | Inline bash | Manual | Bash users, selective creation | -| run-issue-creation.sh | 15 | Via Python | Via Python script | Simple wrapper | +| **create-issues-from-log.py** | Varies | Consolidated log | Updates log file | **Most comprehensive, all issues** | +| create-github-issues.py | Varies | Code review JSONs | Separate tracking file | Code review issues only | +| create-code-review-issues.sh | Varies | Inline bash | Manual | Bash users, selective creation | +| run-issue-creation.sh | Varies | Via Python | Via Python script | Simple wrapper (bash) | +| run-issue-creation.ps1 | Varies | Via Python | Via Python script | Simple wrapper (PowerShell) | ## Recommended Workflow @@ -134,7 +146,7 @@ python3 scripts/create-p1-issues.py ### Create All Issues ```bash -# Create all 20 issues from consolidated log +# Create all issues from consolidated log python3 scripts/create-issues-from-log.py ``` @@ -153,20 +165,20 @@ The script is **idempotent** - it will: Example output: ``` -â„šī¸ 15 issues already created, skipping: +â„šī¸ Issues already created, skipping: - LOG-001: #23 [P0] Consolidate CI/CD Workflows - LOG-002: #24 [P0] Organization Scoping Middleware ... -Creating 5 new issues... +Creating new issues... ``` ## Issue Log Structure -The consolidated log includes: -- **20 total issues** - - 15 from Code Review 2026-02-02 - - 5 from PRD Validation 2026-01-24 +The consolidated log includes (issue count varies by review): +- **Example**: 20 total issues (current log) + - 15 from Code Review 2026-02-02 (current log) + - 5 from PRD Validation 2026-01-24 (current log) - **Priorities**: 5 P0 (Critical), 5 P1 (High), 10 P2 (Medium) - **Total Effort**: 5.9 days (47.25 hours) diff --git a/scripts/create-github-issues.py b/scripts/create-github-issues.py index 0fb0f57..bf24168 100644 --- a/scripts/create-github-issues.py +++ b/scripts/create-github-issues.py @@ -10,13 +10,14 @@ """ import json +import os import subprocess import sys import time from pathlib import Path from typing import List, Dict, Tuple, Optional -REPO = "tim-dickey/trivia-app" +REPO = (os.environ.get("GITHUB_REPOSITORY") or "").strip() or "tim-dickey/trivia-app" SCRIPT_DIR = Path(__file__).parent ISSUES_DIR = SCRIPT_DIR.parent / "_bmad-output/implementation-artifacts" diff --git a/scripts/run-issue-creation.ps1 b/scripts/run-issue-creation.ps1 new file mode 100644 index 0000000..7b331c4 --- /dev/null +++ b/scripts/run-issue-creation.ps1 @@ -0,0 +1,54 @@ +param( + [string]$Repo +) + +$ErrorActionPreference = 'Stop' + +$repo = if ($env:GITHUB_REPOSITORY) { $env:GITHUB_REPOSITORY } else { 'tim-dickey/trivia-app' } + + # Fallback: derive from git remote URL if available + if (-not $Repo) { + $gitCmd = Get-Command git -ErrorAction SilentlyContinue + if ($null -ne $gitCmd) { + try { + $remoteUrl = git remote get-url origin 2>$null + if ($remoteUrl) { + # Handle SSH and HTTPS GitHub URLs, extracting owner/repo + if ($remoteUrl -match '[:/](?[^/]+)/(?[^/\.]+)(?:\.git)?$') { + $Repo = "$($Matches['owner'])/$($Matches['name'])" + } + } + } catch { + # Ignore errors and allow final fallback + } + } + } + + # Final fallback: original hardcoded repository + if (-not $Repo) { + $Repo = 'tim-dickey/trivia-app' + } + } +} + +$repo = $Repo +Write-Host '============================================================' +Write-Host 'Creating GitHub Issues from Code Review Findings' +Write-Host '============================================================' +Write-Host '' +Write-Host "Repository: $repo" +Write-Host '' +Write-Host 'Note: Issue count varies based on BMAD review results' +Write-Host 'This may take a few minutes...' +Write-Host '' +Write-Host 'Please wait while issues are created...' + +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$env:GITHUB_REPOSITORY = $repo + +$pythonCmd = Get-Command py -ErrorAction SilentlyContinue +if ($null -ne $pythonCmd) { + & py -3 "$scriptDir\create-github-issues.py" +} else { + & python "$scriptDir\create-github-issues.py" +} diff --git a/scripts/run-issue-creation.sh b/scripts/run-issue-creation.sh index 286f005..93e02a0 100644 --- a/scripts/run-issue-creation.sh +++ b/scripts/run-issue-creation.sh @@ -16,7 +16,7 @@ echo "" # Note: This script should be run with proper GitHub authentication # If gh is not authenticated, it will use the current session's credentials -echo "Note: Creating 20 issues (5 P0, 5 P1, 5 P2, 5 P3)" +echo "Note: Issue count varies based on BMAD review results" echo "This may take a few minutes..." echo ""