Spaces:
Running
Running
chore: set up GSSOC contributor workflow on dev branch
Browse files- Add CI workflow (ci.yml) scoped to dev only β backend lint, TS check, Next.js build
- Add PR template with dev-branch checklist
- Add bug report & feature request issue templates (YAML structured)
- Add CODEOWNERS β admin auto-assigned on every PR
- Add CONTRIBUTING.md β full contributor guide with branch rules
- Restrict deploy.yml and devsecops.yml to main push only (no PRs, no dev)
- .github/CODEOWNERS +18 -0
- .github/ISSUE_TEMPLATE/bug_report.yml +84 -0
- .github/ISSUE_TEMPLATE/config.yml +6 -0
- .github/ISSUE_TEMPLATE/feature_request.yml +69 -0
- .github/pull_request_template.md +54 -0
- .github/workflows/ci.yml +113 -0
- .github/workflows/deploy.yml +8 -3
- .github/workflows/devsecops.yml +2 -3
- CONTRIBUTING.md +150 -0
.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CODEOWNERS
|
| 2 |
+
# These users are auto-requested for review on every PR.
|
| 3 |
+
# Syntax: <file-pattern> <@github-username>
|
| 4 |
+
|
| 5 |
+
# Global owner β reviews everything
|
| 6 |
+
* @param20h
|
| 7 |
+
|
| 8 |
+
# Backend
|
| 9 |
+
backend/ @param20h
|
| 10 |
+
|
| 11 |
+
# Frontend
|
| 12 |
+
frontend/ @param20h
|
| 13 |
+
|
| 14 |
+
# CI / Infra β these should never change without admin review
|
| 15 |
+
.github/ @param20h
|
| 16 |
+
Dockerfile @param20h
|
| 17 |
+
docker-compose.yml @param20h
|
| 18 |
+
render.yaml @param20h
|
.github/ISSUE_TEMPLATE/bug_report.yml
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: π Bug Report
|
| 2 |
+
description: Report a bug or unexpected behavior
|
| 3 |
+
labels: ["bug", "needs-triage"]
|
| 4 |
+
assignees: []
|
| 5 |
+
|
| 6 |
+
body:
|
| 7 |
+
- type: markdown
|
| 8 |
+
attributes:
|
| 9 |
+
value: |
|
| 10 |
+
Thanks for taking the time to file a bug report! Please fill this out as completely as possible.
|
| 11 |
+
|
| 12 |
+
- type: textarea
|
| 13 |
+
id: description
|
| 14 |
+
attributes:
|
| 15 |
+
label: Describe the Bug
|
| 16 |
+
description: A clear description of what the bug is.
|
| 17 |
+
placeholder: "When I do X, Y happens instead of Z."
|
| 18 |
+
validations:
|
| 19 |
+
required: true
|
| 20 |
+
|
| 21 |
+
- type: textarea
|
| 22 |
+
id: reproduction
|
| 23 |
+
attributes:
|
| 24 |
+
label: Steps to Reproduce
|
| 25 |
+
description: How do we reproduce this bug?
|
| 26 |
+
placeholder: |
|
| 27 |
+
1. Go to '...'
|
| 28 |
+
2. Click on '...'
|
| 29 |
+
3. See error
|
| 30 |
+
validations:
|
| 31 |
+
required: true
|
| 32 |
+
|
| 33 |
+
- type: textarea
|
| 34 |
+
id: expected
|
| 35 |
+
attributes:
|
| 36 |
+
label: Expected Behavior
|
| 37 |
+
description: What should have happened?
|
| 38 |
+
validations:
|
| 39 |
+
required: true
|
| 40 |
+
|
| 41 |
+
- type: textarea
|
| 42 |
+
id: screenshots
|
| 43 |
+
attributes:
|
| 44 |
+
label: Screenshots / Logs
|
| 45 |
+
description: Paste any relevant error output or screenshots here.
|
| 46 |
+
|
| 47 |
+
- type: dropdown
|
| 48 |
+
id: area
|
| 49 |
+
attributes:
|
| 50 |
+
label: Area Affected
|
| 51 |
+
multiple: true
|
| 52 |
+
options:
|
| 53 |
+
- Backend (FastAPI)
|
| 54 |
+
- Frontend (Next.js)
|
| 55 |
+
- RAG / Embeddings
|
| 56 |
+
- Authentication
|
| 57 |
+
- File Upload
|
| 58 |
+
- Chat / Streaming
|
| 59 |
+
- Docker / Deployment
|
| 60 |
+
- Documentation
|
| 61 |
+
validations:
|
| 62 |
+
required: true
|
| 63 |
+
|
| 64 |
+
- type: input
|
| 65 |
+
id: python-version
|
| 66 |
+
attributes:
|
| 67 |
+
label: Python Version (if backend issue)
|
| 68 |
+
placeholder: "e.g. 3.11"
|
| 69 |
+
|
| 70 |
+
- type: input
|
| 71 |
+
id: node-version
|
| 72 |
+
attributes:
|
| 73 |
+
label: Node.js Version (if frontend issue)
|
| 74 |
+
placeholder: "e.g. 20.x"
|
| 75 |
+
|
| 76 |
+
- type: checkboxes
|
| 77 |
+
id: checklist
|
| 78 |
+
attributes:
|
| 79 |
+
label: Checklist
|
| 80 |
+
options:
|
| 81 |
+
- label: I have searched existing issues and this is not a duplicate.
|
| 82 |
+
required: true
|
| 83 |
+
- label: I am targeting the `dev` branch, not `main`.
|
| 84 |
+
required: true
|
.github/ISSUE_TEMPLATE/config.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
blank_issues_enabled: false
|
| 2 |
+
|
| 3 |
+
contact_links:
|
| 4 |
+
- name: π¬ Discussion / Questions
|
| 5 |
+
url: https://github.com/param20h/PDF-Assistant-RAG/discussions
|
| 6 |
+
about: Ask questions and discuss ideas before opening issues.
|
.github/ISSUE_TEMPLATE/feature_request.yml
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: β¨ Feature Request
|
| 2 |
+
description: Suggest a new feature or enhancement
|
| 3 |
+
labels: ["enhancement", "needs-triage"]
|
| 4 |
+
assignees: []
|
| 5 |
+
|
| 6 |
+
body:
|
| 7 |
+
- type: markdown
|
| 8 |
+
attributes:
|
| 9 |
+
value: |
|
| 10 |
+
Got an idea? Great! Please describe it clearly so we can discuss and prioritize it.
|
| 11 |
+
|
| 12 |
+
- type: textarea
|
| 13 |
+
id: problem
|
| 14 |
+
attributes:
|
| 15 |
+
label: Problem / Motivation
|
| 16 |
+
description: What problem does this solve? What's the current limitation?
|
| 17 |
+
placeholder: "I find it frustrating when..."
|
| 18 |
+
validations:
|
| 19 |
+
required: true
|
| 20 |
+
|
| 21 |
+
- type: textarea
|
| 22 |
+
id: solution
|
| 23 |
+
attributes:
|
| 24 |
+
label: Proposed Solution
|
| 25 |
+
description: What do you want to happen?
|
| 26 |
+
validations:
|
| 27 |
+
required: true
|
| 28 |
+
|
| 29 |
+
- type: textarea
|
| 30 |
+
id: alternatives
|
| 31 |
+
attributes:
|
| 32 |
+
label: Alternatives Considered
|
| 33 |
+
description: Any other approaches you considered?
|
| 34 |
+
|
| 35 |
+
- type: dropdown
|
| 36 |
+
id: area
|
| 37 |
+
attributes:
|
| 38 |
+
label: Which area does this affect?
|
| 39 |
+
multiple: true
|
| 40 |
+
options:
|
| 41 |
+
- Backend (FastAPI)
|
| 42 |
+
- Frontend (Next.js)
|
| 43 |
+
- RAG / Embeddings
|
| 44 |
+
- Authentication
|
| 45 |
+
- File Upload
|
| 46 |
+
- Chat / Streaming
|
| 47 |
+
- Docker / Deployment
|
| 48 |
+
- Documentation
|
| 49 |
+
- New Area
|
| 50 |
+
validations:
|
| 51 |
+
required: true
|
| 52 |
+
|
| 53 |
+
- type: dropdown
|
| 54 |
+
id: difficulty
|
| 55 |
+
attributes:
|
| 56 |
+
label: Estimated Difficulty
|
| 57 |
+
options:
|
| 58 |
+
- "π’ Easy (good first issue)"
|
| 59 |
+
- "π‘ Medium"
|
| 60 |
+
- "π΄ Hard / Needs discussion"
|
| 61 |
+
|
| 62 |
+
- type: checkboxes
|
| 63 |
+
id: checklist
|
| 64 |
+
attributes:
|
| 65 |
+
label: Checklist
|
| 66 |
+
options:
|
| 67 |
+
- label: I have searched existing issues and this is not a duplicate.
|
| 68 |
+
required: true
|
| 69 |
+
- label: I am willing to work on this myself (optional but appreciated!).
|
.github/pull_request_template.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## π PR Checklist
|
| 2 |
+
|
| 3 |
+
> Thank you for contributing to **PDF-Assistant-RAG**! π
|
| 4 |
+
> Please fill out this template before submitting. PRs without it filled in will be closed.
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
### π Related Issue
|
| 9 |
+
Closes #<!-- issue number -->
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
### π What does this PR do?
|
| 14 |
+
<!-- A clear and concise description of the changes. -->
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
### ποΈ Type of Change
|
| 19 |
+
<!-- Check all that apply -->
|
| 20 |
+
- [ ] π Bug fix
|
| 21 |
+
- [ ] β¨ New feature
|
| 22 |
+
- [ ] π§ Refactor / code cleanup
|
| 23 |
+
- [ ] π Documentation update
|
| 24 |
+
- [ ] π¨ UI / styling change
|
| 25 |
+
- [ ] βοΈ CI / tooling / config change
|
| 26 |
+
- [ ] π§ͺ Tests
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
### π§ͺ How was this tested?
|
| 31 |
+
<!-- Describe how you verified your changes work. -->
|
| 32 |
+
- [ ] Ran the backend locally (`uvicorn app.main:app --reload`)
|
| 33 |
+
- [ ] Ran the frontend locally (`npm run dev` inside `frontend/`)
|
| 34 |
+
- [ ] Tested the affected API endpoints manually
|
| 35 |
+
- [ ] Added / updated tests
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
### πΈ Screenshots (if UI change)
|
| 40 |
+
<!-- Drag and drop screenshots here -->
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
### β οΈ Anything to flag for reviewers?
|
| 45 |
+
<!-- Anything tricky, uncertain, or worth discussing? -->
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
### β
Self-Review Checklist
|
| 50 |
+
- [ ] My branch is based on **`dev`**, not `main`
|
| 51 |
+
- [ ] I have not added any secrets / API keys
|
| 52 |
+
- [ ] I have not modified `main` branch or any HuggingFace deployment config
|
| 53 |
+
- [ ] My code follows the existing style (no unnecessary formatting changes)
|
| 54 |
+
- [ ] I have updated relevant docs / comments if needed
|
.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI β Dev Branch
|
| 2 |
+
|
| 3 |
+
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 4 |
+
# Only runs on:
|
| 5 |
+
# β’ Pushes to dev
|
| 6 |
+
# β’ PRs targeting dev
|
| 7 |
+
# NEVER triggers on main β HuggingFace deployment is safe.
|
| 8 |
+
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 9 |
+
on:
|
| 10 |
+
push:
|
| 11 |
+
branches: ["dev"]
|
| 12 |
+
pull_request:
|
| 13 |
+
branches: ["dev"]
|
| 14 |
+
|
| 15 |
+
jobs:
|
| 16 |
+
# ββ 1. Backend Lint & Import Check βββββββββββββββββββββ
|
| 17 |
+
backend-check:
|
| 18 |
+
name: π Backend β Lint & Import Check
|
| 19 |
+
runs-on: ubuntu-latest
|
| 20 |
+
|
| 21 |
+
steps:
|
| 22 |
+
- name: Checkout code
|
| 23 |
+
uses: actions/checkout@v4
|
| 24 |
+
|
| 25 |
+
- name: Set up Python 3.11
|
| 26 |
+
uses: actions/setup-python@v5
|
| 27 |
+
with:
|
| 28 |
+
python-version: "3.11"
|
| 29 |
+
cache: "pip"
|
| 30 |
+
cache-dependency-path: backend/requirements.txt
|
| 31 |
+
|
| 32 |
+
- name: Install dependencies
|
| 33 |
+
run: |
|
| 34 |
+
pip install --upgrade pip
|
| 35 |
+
pip install flake8 flake8-bugbear
|
| 36 |
+
# Install project deps (skip heavy ML libs with stub extras)
|
| 37 |
+
pip install -r backend/requirements.txt --quiet || true
|
| 38 |
+
|
| 39 |
+
- name: Flake8 lint (errors only, no style noise)
|
| 40 |
+
run: |
|
| 41 |
+
flake8 backend/app \
|
| 42 |
+
--max-line-length=120 \
|
| 43 |
+
--select=E9,F63,F7,F82 \
|
| 44 |
+
--count \
|
| 45 |
+
--show-source \
|
| 46 |
+
--statistics
|
| 47 |
+
|
| 48 |
+
- name: Check all Python modules import cleanly
|
| 49 |
+
env:
|
| 50 |
+
SECRET_KEY: ci-dummy-secret
|
| 51 |
+
DATABASE_URL: sqlite:///./ci_test.db
|
| 52 |
+
HF_TOKEN: ci-dummy-token
|
| 53 |
+
UPLOAD_DIR: /tmp/uploads
|
| 54 |
+
CHROMA_PERSIST_DIR: /tmp/chroma
|
| 55 |
+
run: |
|
| 56 |
+
python -c "import sys; sys.path.insert(0, 'backend'); from app.config import settings; print('β
Config imports OK')" || true
|
| 57 |
+
|
| 58 |
+
# ββ 2. Frontend Build Check βββββββββββββββββββββββββββββ
|
| 59 |
+
frontend-check:
|
| 60 |
+
name: βοΈ Frontend β TypeScript & Build
|
| 61 |
+
runs-on: ubuntu-latest
|
| 62 |
+
|
| 63 |
+
steps:
|
| 64 |
+
- name: Checkout code
|
| 65 |
+
uses: actions/checkout@v4
|
| 66 |
+
|
| 67 |
+
- name: Set up Node.js 20
|
| 68 |
+
uses: actions/setup-node@v4
|
| 69 |
+
with:
|
| 70 |
+
node-version: "20"
|
| 71 |
+
cache: "npm"
|
| 72 |
+
cache-dependency-path: frontend/package-lock.json
|
| 73 |
+
|
| 74 |
+
- name: Install dependencies
|
| 75 |
+
working-directory: frontend
|
| 76 |
+
run: npm ci
|
| 77 |
+
|
| 78 |
+
- name: TypeScript type-check
|
| 79 |
+
working-directory: frontend
|
| 80 |
+
run: npx tsc --noEmit
|
| 81 |
+
|
| 82 |
+
- name: ESLint
|
| 83 |
+
working-directory: frontend
|
| 84 |
+
run: npm run lint
|
| 85 |
+
|
| 86 |
+
- name: Next.js build (production bundle check)
|
| 87 |
+
working-directory: frontend
|
| 88 |
+
run: npm run build
|
| 89 |
+
env:
|
| 90 |
+
NEXT_PUBLIC_API_URL: http://localhost:8000
|
| 91 |
+
|
| 92 |
+
# ββ 3. PR Size Gate βββββββββββββββββββββββββββββββββββββ
|
| 93 |
+
pr-size-check:
|
| 94 |
+
name: π PR Size Check
|
| 95 |
+
runs-on: ubuntu-latest
|
| 96 |
+
if: github.event_name == 'pull_request'
|
| 97 |
+
|
| 98 |
+
steps:
|
| 99 |
+
- name: Checkout code
|
| 100 |
+
uses: actions/checkout@v4
|
| 101 |
+
with:
|
| 102 |
+
fetch-depth: 0
|
| 103 |
+
|
| 104 |
+
- name: Count changed lines
|
| 105 |
+
run: |
|
| 106 |
+
LINES=$(git diff --stat origin/${{ github.base_ref }}...HEAD | tail -1)
|
| 107 |
+
echo "Changes: $LINES"
|
| 108 |
+
INSERTIONS=$(git diff --numstat origin/${{ github.base_ref }}...HEAD | awk '{sum+=$1} END{print sum}')
|
| 109 |
+
if [ "$INSERTIONS" -gt 1000 ]; then
|
| 110 |
+
echo "β οΈ PR is very large ($INSERTIONS lines added). Please consider splitting it."
|
| 111 |
+
else
|
| 112 |
+
echo "β
PR size looks good ($INSERTIONS lines added)."
|
| 113 |
+
fi
|
.github/workflows/deploy.yml
CHANGED
|
@@ -2,9 +2,14 @@ name: Docker Image CI
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
env:
|
| 10 |
REGISTRY: ghcr.io
|
|
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
+
# β οΈ PRODUCTION ONLY β never triggered by dev or PRs
|
| 6 |
+
branches: ["main"]
|
| 7 |
+
# Ignore doc-only changes to avoid unnecessary image builds
|
| 8 |
+
paths-ignore:
|
| 9 |
+
- "**.md"
|
| 10 |
+
- ".github/ISSUE_TEMPLATE/**"
|
| 11 |
+
- ".github/pull_request_template.md"
|
| 12 |
+
- "CONTRIBUTING.md"
|
| 13 |
|
| 14 |
env:
|
| 15 |
REGISTRY: ghcr.io
|
.github/workflows/devsecops.yml
CHANGED
|
@@ -2,9 +2,8 @@ name: DevSecOps Pipeline
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
branches: [ "main" ]
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
security-scans:
|
|
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
+
# β οΈ PRODUCTION ONLY β security scans run on main only
|
| 6 |
+
branches: ["main"]
|
|
|
|
| 7 |
|
| 8 |
jobs:
|
| 9 |
security-scans:
|
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributing to PDF-Assistant-RAG π€
|
| 2 |
+
|
| 3 |
+
Welcome! This project is open for contributions under **GirlScript Summer of Code (GSSOC)**.
|
| 4 |
+
Read this guide fully before opening a PR β it keeps things smooth for everyone.
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## π Important Branch Rules
|
| 9 |
+
|
| 10 |
+
| Branch | Purpose | Who pushes? |
|
| 11 |
+
|--------|---------|------------|
|
| 12 |
+
| `main` | Production (deployed to HuggingFace Spaces) | **Admin only** |
|
| 13 |
+
| `dev` | Integration β all contributor PRs target here | Contributors via PRs |
|
| 14 |
+
| `feature/*` | New features | Contributors |
|
| 15 |
+
| `fix/*` | Bug fixes | Contributors |
|
| 16 |
+
| `docs/*` | Documentation only | Contributors |
|
| 17 |
+
|
| 18 |
+
> β οΈ **Never open a PR targeting `main`.** It will be closed automatically.
|
| 19 |
+
> β οΈ **Never modify `deploy.yml`, `render.yaml`, or HuggingFace config.**
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## π Getting Started
|
| 24 |
+
|
| 25 |
+
### 1. Fork & Clone
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
# Fork on GitHub, then:
|
| 29 |
+
git clone https://github.com/<your-username>/PDF-Assistant-RAG.git
|
| 30 |
+
cd PDF-Assistant-RAG
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
### 2. Add upstream remote
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
git remote add upstream https://github.com/param20h/PDF-Assistant-RAG.git
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### 3. Always branch from `dev`
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
git fetch upstream
|
| 43 |
+
git checkout -b feature/my-cool-feature upstream/dev
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## π οΈ Local Development Setup
|
| 49 |
+
|
| 50 |
+
### Backend (FastAPI)
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
cd backend
|
| 54 |
+
python -m venv .venv
|
| 55 |
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 56 |
+
pip install -r requirements.txt
|
| 57 |
+
|
| 58 |
+
# Copy env template
|
| 59 |
+
cp ../.env.example .env # Fill in your own dev values
|
| 60 |
+
|
| 61 |
+
uvicorn app.main:app --reload --port 8000
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### Frontend (Next.js)
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
cd frontend
|
| 68 |
+
npm install
|
| 69 |
+
npm run dev # Runs on http://localhost:3000
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Make sure the backend is running first β the frontend proxies API requests to `localhost:8000`.
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## π¬ Opening a Pull Request
|
| 77 |
+
|
| 78 |
+
1. **Pick an issue** β comment "I'd like to work on this" before starting
|
| 79 |
+
2. **Create your branch** from `dev` (see above)
|
| 80 |
+
3. **Make your changes** β keep commits focused and well-named
|
| 81 |
+
4. **Push and open a PR targeting `dev`**
|
| 82 |
+
5. **Fill in the PR template** completely
|
| 83 |
+
6. **Wait for CI to pass** β the `CI β Dev Branch` workflow must be green
|
| 84 |
+
7. **Address review feedback** β the admin (@param20h) is auto-assigned as reviewer
|
| 85 |
+
|
| 86 |
+
### Commit Message Format
|
| 87 |
+
|
| 88 |
+
```
|
| 89 |
+
type: short description (max 72 chars)
|
| 90 |
+
|
| 91 |
+
Optional longer explanation if needed.
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
**Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
|
| 95 |
+
|
| 96 |
+
Examples:
|
| 97 |
+
```
|
| 98 |
+
feat: add PDF page count to document card
|
| 99 |
+
fix: scroll to bottom on new message
|
| 100 |
+
docs: add local setup instructions to README
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
---
|
| 104 |
+
|
| 105 |
+
## β
CI Checks
|
| 106 |
+
|
| 107 |
+
Every PR to `dev` automatically runs:
|
| 108 |
+
|
| 109 |
+
| Check | What it does |
|
| 110 |
+
|-------|-------------|
|
| 111 |
+
| π **Backend Lint** | `flake8` on `backend/app/` (errors only) |
|
| 112 |
+
| βοΈ **Frontend Type Check** | `tsc --noEmit` |
|
| 113 |
+
| βοΈ **ESLint** | `npm run lint` |
|
| 114 |
+
| βοΈ **Next.js Build** | Full production build to catch runtime errors |
|
| 115 |
+
| π **PR Size Gate** | Warns if PR is unusually large |
|
| 116 |
+
|
| 117 |
+
All checks must be green before your PR can be merged.
|
| 118 |
+
|
| 119 |
+
---
|
| 120 |
+
|
| 121 |
+
## π« What NOT to do
|
| 122 |
+
|
| 123 |
+
- Don't push directly to `main` or `dev` β always use PRs
|
| 124 |
+
- Don't commit `.env` files or API keys/secrets
|
| 125 |
+
- Don't add large binary files without discussing first
|
| 126 |
+
- Don't change CI/deployment workflows without admin approval
|
| 127 |
+
- Don't open multiple PRs for the same issue
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
## π·οΈ Issue Labels
|
| 132 |
+
|
| 133 |
+
| Label | Meaning |
|
| 134 |
+
|-------|---------|
|
| 135 |
+
| `good first issue` | Great for beginners |
|
| 136 |
+
| `bug` | Something is broken |
|
| 137 |
+
| `enhancement` | New feature request |
|
| 138 |
+
| `needs-triage` | Needs admin review |
|
| 139 |
+
| `help wanted` | Open for contributors |
|
| 140 |
+
| `wip` | Work in progress |
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## π¬ Need Help?
|
| 145 |
+
|
| 146 |
+
Open a [Discussion](https://github.com/param20h/PDF-Assistant-RAG/discussions) before opening an issue if you're unsure. Mentors and the admin check discussions regularly.
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
Thanks for contributing! Every PR, no matter how small, makes a difference. π
|