Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Repository Code Ownership
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

* @sagardhadke
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 🐛 Bug Report
description: Report an issue or bug in Java Course Tracker.
title: "[BUG]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report this issue! Please provide sufficient detail so we can reproduce and fix it.

- type: textarea
id: description
attributes:
label: Bug Description
description: A clear and concise description of what the bug is.
placeholder: Describe what happened...
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Steps to Reproduce
description: Step-by-step instructions to reproduce the behavior.
placeholder: |
1. Open the app at '...'
2. Click on '...'
3. Scroll down to '....'
4. See error
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true

- type: input
id: environment
attributes:
label: Browser & OS
description: What browser and operating system were you using?
placeholder: e.g. Chrome 132 on Windows 11 / macOS Sequoia
validations:
required: false
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 🚀 Feature Request
description: Suggest an idea or enhancement for Java Course Tracker.
title: "[FEAT]: "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Have an idea to make Java Course Tracker even better? Tell us about it!

- type: textarea
id: problem
attributes:
label: Problem or Motivation
description: Is your feature request related to a problem or user pain point?
placeholder: I'm always frustrated when...
validations:
required: true

- type: textarea
id: solution
attributes:
label: Proposed Feature / Solution
description: Describe the solution you'd like to see implemented.
placeholder: A clear and concise description of what you want to happen.
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Describe any alternative solutions or workarounds you've considered.
validations:
required: false
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Summary of Changes
<!-- Provide a clear, high-level summary of the motivation, changes, and architectural impact. -->

## Changes Made
-

## Verification & Testing Performed
- [ ] Automated unit & integration tests pass: `npm test`
- [ ] Production build succeeds: `npm run build`
- [ ] Linter checks pass: `npm run lint`
- [ ] Local manual/browser testing verified: `npm run dev`

## Security & Repository Hygiene Checklist
- [ ] **No Secrets:** Confirmed no API keys, tokens, credentials, or private keys are staged.
- [ ] **No Personal Emails:** Confirmed no personal emails (`@gmail.com`) are hardcoded.
- [ ] **No Forbidden Tooling Files:** Confirmed no agent/tooling files (`AGENTS.md`, `CLAUDE.md`, `.agents/`, `.cursor/`, etc.) are tracked.
- [ ] **No Debug/Temp Artifacts:** Confirmed no `.log`, `report-temp/`, coverage, or temporary files are added.
- [ ] **Clean Gitignore:** Any new temporary directories or secrets are added to `.gitignore`.
102 changes: 102 additions & 0 deletions .github/scripts/forbidden-files-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/env node
import { execSync } from 'child_process';
import fs from 'fs';

const FORBIDDEN_FILE_PATTERNS = [
/^AGENTS\.md$/i,
/^CLAUDE\.md$/i,
/^GEMINI\.md$/i,
/^\.agents\//i,
/^\.cursor\//i,
/^\.claude\//i,
/^\.windsurf\//i,
/^docs\/bugs\//i,
/^report-temp\//i,
/\.log$/i,
/^\.env/i,
/\.pem$/i,
/\.key$/i,
/^coverage\//i,
/^test-results\//i,
/^playwright-report\//i,
];

const SECRET_PATTERNS = [
{ name: 'Google API Key', regex: /AIzaSy[A-Za-z0-9_-]{30,}/ },
{ name: 'OpenAI API Key', regex: /sk-[A-Za-z0-9_-]{20,}/ },
{ name: 'Anthropic API Key', regex: /sk-ant-[A-Za-z0-9_-]{20,}/ },
{ name: 'GitHub Token', regex: /(?:ghp_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{82})/ },
{ name: 'AWS Access Key', regex: /AKIA[0-9A-Z]{16}/ },
{ name: 'Private Key Header', regex: /-----BEGIN [A-Z ]*PRIVATE KEY-----/ },
{ name: 'Personal Gmail', regex: /[a-zA-Z0-9_.+-]+@gmail\.com/i },
];

// Determine mode: staged files or all tracked files (CI mode)
const isCI = process.argv.includes('--ci');

let filesToCheck = [];

try {
if (isCI) {
const output = execSync('git ls-files', { encoding: 'utf-8' });
filesToCheck = output.split('\n').map(s => s.trim()).filter(Boolean);
} else {
const output = execSync('git diff --cached --name-only --diff-filter=ACMR', { encoding: 'utf-8' });
filesToCheck = output.split('\n').map(s => s.trim()).filter(Boolean);
}
} catch (err) {
console.error('Failed to retrieve git file list:', err.message);
process.exit(1);
}

let hasErrors = false;

// 1. Check forbidden file paths
for (const file of filesToCheck) {
const normalized = file.replace(/\\/g, '/');
for (const pattern of FORBIDDEN_FILE_PATTERNS) {
if (pattern.test(normalized)) {
console.error(`❌ [FORBIDDEN FILE] Tracked/staged file matches forbidden pattern: ${normalized}`);
hasErrors = true;
}
}
}

// 2. Check for secret patterns in staged diff or tracked files
if (isCI) {
for (const file of filesToCheck) {
// Skip binary files and test assets
if (!fs.existsSync(file) || file.endsWith('.png') || file.endsWith('.jpg') || file.endsWith('.ico') || file.endsWith('.svg')) {
continue;
}
const content = fs.readFileSync(file, 'utf-8');
for (const rule of SECRET_PATTERNS) {
if (rule.regex.test(content)) {
// Exclude safe dynamic fixtures like ['sk', '-proj-'].join('')
console.error(`❌ [SECRET SCAN] File ${file} matches pattern: ${rule.name}`);
hasErrors = true;
}
}
}
} else {
// Staged diff check
try {
const stagedDiff = execSync('git diff --cached', { encoding: 'utf-8' });
for (const rule of SECRET_PATTERNS) {
if (rule.regex.test(stagedDiff)) {
console.error(`❌ [SECRET SCAN] Staged diff contains forbidden pattern: ${rule.name}`);
hasErrors = true;
}
}
} catch (err) {
console.error('Failed to check git diff:', err.message);
}
}

if (hasErrors) {
console.error('\n🚨 Security verification failed. Please remove forbidden files or secrets before proceeding.');
process.exit(1);
} else {
console.log(`✅ Security check passed. ${filesToCheck.length} files scanned with 0 violations.`);
process.exit(0);
}
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI & Security Quality Gate

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
security-audit:
name: Security & Forbidden Files Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js 22
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
run: npm ci

- name: Verify Forbidden Files & Secrets
run: node .github/scripts/forbidden-files-check.js --ci

- name: Run Dependency Vulnerability Audit
run: npm audit --audit-level=high

test-and-build:
name: Lint, Test & Production Build
runs-on: ubuntu-latest
needs: security-audit
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js 22
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
run: npm ci

- name: Run Linter (Oxlint)
run: npm run lint

- name: Run Vitest Suite
run: npm test

- name: Run Production Build
run: npm run build
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ dist-ssr
*.sln
*.sw?

# Private and internal handoff documentation
# Private, internal handoff documentation, and scratch files
PROJECT_HANDOFF_PROMPT.md
PRIVATE_DEV_HANDOFF.md
PROJECT_CONTEXT*.md
*_HANDOFF*.md
report-temp/
local-testing/
playwright-report/
test-results/
coverage/
scratch/

# Environment, credentials, and secrets
.env
Expand All @@ -51,7 +54,16 @@ service-account*.json

# AI tooling, agent configuration, and internal documentation
AGENTS.md
CLAUDE.md
GEMINI.md
.agents/
.cursor/
.claude/
.gemini/
.antigravity/
.windsurf/
.aider*
.copilot/
docs/bugs/

# Sample test and course XML files
Expand All @@ -60,3 +72,4 @@ sample-test-course.xml




2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node .github/scripts/forbidden-files-check.js
npm test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
59 changes: 59 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Contributing to Java Course Tracker

Thank you for your interest in contributing to **Java Course Tracker**! We are committed to maintaining a clean, secure, and production-ready repository.

---

## Engineering & Development Workflow

To ensure high code quality, security, and stability, all contributors must follow this standard GitHub workflow:

### 1. Branching Strategy
* **Never push directly to `main`**. Direct pushes to `main` are strictly forbidden and blocked by GitHub branch protection.
* Always create a focused, descriptive feature or bug-fix branch off the latest `main`:
```bash
git checkout main
git pull origin main
git checkout -b feat/your-feature-name
# or
git checkout -b fix/your-bug-fix
```

### 2. Local Verification Before Committing
Before committing your changes locally, ensure all automated verification checks pass:
```bash
# Run unit & component tests
npm test

# Run code linter
npm run lint

# Verify production build compiles without warnings
npm run build

# Run end-to-end tests (if UI flows were modified)
npm run test:e2e
```

### 3. Local Pre-commit Security Checks
This repository uses **Husky** to enforce pre-commit checks:
* Any staged files matching forbidden patterns (`.env*`, `AGENTS.md`, `CLAUDE.md`, `.agents/`, `docs/bugs/`, `report-temp/`, `*.log`, `*.key`, `*.pem`) will cause the commit to abort.
* Any staged diff matching unmasked API keys or personal `@gmail.com` addresses will cause the commit to abort.
* Do not bypass pre-commit hooks (`--no-verify`).

### 4. Opening a Pull Request
1. Push your feature branch to your GitHub fork or origin:
```bash
git push origin feat/your-feature-name
```
2. Open a Pull Request targeting `main`.
3. Fill out the PR template completely, checking off the security and verification checklist.
4. **Wait for CI to pass:** GitHub Actions will run automated security audits, forbidden-file checks, linting, tests, and production build checks.
5. Once all CI checks pass and code review approval is obtained, the branch may be squash-merged into `main`.

---

## Code Standards
* **React 19 Hooks & Idioms:** Ensure functional components are clean, dependencies are properly specified in `useEffect`/`useMemo`/`useCallback`, and asynchronous state updates in tests are wrapped in `act(...)`.
* **Zero Secrets:** Never hardcode credentials, private tokens, or test keys in source code. Dynamic string builders must be used for mock test fixtures.
* **No Telemetry / Offline-First:** Preserve the 100% client-side privacy guarantee. Do not introduce remote analytics or tracking beacons.
Loading
Loading