diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..95896af --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @NITISH-R-G diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b47be4f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,9 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- +**Describe the bug** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..61dddbd --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +## Description + +Please include a summary of the change and which issue is fixed. diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..61dddbd --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,3 @@ +## Description + +Please include a summary of the change and which issue is fixed. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 12a37da..f8b8fbf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,22 +4,11 @@ updates: directory: "/" schedule: interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-major"] - - package-ecosystem: "npm" directory: "/web" schedule: interval: "weekly" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-major"] - - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" - open-pull-requests-limit: 10 diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..30214bc --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,10 @@ +frontend: + - web/**/* +backend: + - server/**/* + - ev_grid_oracle/**/* +docs: + - docs/**/* + - '**/*.md' +github-actions: + - .github/workflows/**/* diff --git a/.github/workflows/ai-insights.yml b/.github/workflows/ai-insights.yml deleted file mode 100644 index 87f31e0..0000000 --- a/.github/workflows/ai-insights.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: AI PR Agent - -on: - pull_request: - types: [opened, synchronize, reopened] - issue_comment: - types: [created] - -jobs: - pr_agent: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - contents: write - name: Run PR Agent - if: ${{ github.event.sender.type != 'Bot' }} - steps: - - name: PR Agent action step - id: pragent - uses: Codium-ai/pr-agent@main - env: - OPENAI_KEY: ${{ secrets.OPENAI_API_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - github_action_config.auto_review: "true" - github_action_config.auto_describe: "true" - github_action_config.auto_improve: "true" diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml new file mode 100644 index 0000000..3a9c004 --- /dev/null +++ b/.github/workflows/ai-review.yml @@ -0,0 +1,29 @@ +name: AI PR Reviewer + +on: + pull_request: + types: + - opened + - synchronize + - reopened + pull_request_review_comment: + types: + - created + +permissions: + contents: read + pull-requests: write + +jobs: + review: + runs-on: ubuntu-latest + if: ${{ github.event.sender.type != 'Bot' }} + steps: + - uses: coderabbitai/openai-pr-reviewer@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + with: + debug: false + review_simple_changes: false + review_comment_lgtm: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4ee873d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [ "main", "master" ] + pull_request: + branches: [ "main", "master" ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install uv + run: pip install uv + + - name: Install Python dependencies + run: | + uv pip install --system -e ".[dev,demo]" + + - name: Run Pytest + run: | + uv run pytest tests/ + + - name: Build Frontend + working-directory: ./web + run: | + npm ci + npm run build diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 6eeeb32..5e528e0 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -13,6 +13,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + lfs: true - name: Set up Python uses: actions/setup-python@v5 @@ -58,6 +60,8 @@ jobs: working-directory: ./web steps: - uses: actions/checkout@v4 + with: + lfs: true - name: Set up Node.js uses: actions/setup-node@v4 @@ -80,6 +84,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + lfs: true - name: Set up Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..4c19787 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,21 @@ +name: Greetings + +on: + pull_request_target: + types: [opened] + issues: + types: [opened] + +permissions: + issues: write + pull-requests: write + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Welcome to the repository! Thank you for opening your first issue. Our AI maintainer and human team will review it shortly." + pr-message: "Welcome to the repository! Thank you for your first pull request. Our automated checks are running, and we will review your changes soon." diff --git a/.github/workflows/health-dashboard.yml b/.github/workflows/health-dashboard.yml index fb788a5..2a6ecec 100644 --- a/.github/workflows/health-dashboard.yml +++ b/.github/workflows/health-dashboard.yml @@ -22,7 +22,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 # Needed for git stats + fetch-depth: 0 + lfs: true - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..30ef812 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +name: "Pull Request Labeler" +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..6476a79 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,36 @@ +name: GitHub Pages + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + lfs: true + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './docs' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/repo-maintenance.yml b/.github/workflows/repo-maintenance.yml new file mode 100644 index 0000000..2ddd372 --- /dev/null +++ b/.github/workflows/repo-maintenance.yml @@ -0,0 +1,68 @@ +name: Repository Maintenance Automation + +on: + push: + branches: + - main + - master + schedule: + - cron: '0 0 * * *' # Daily at midnight UTC + +permissions: + contents: write + +jobs: + maintenance: + if: github.repository == github.event.repository.full_name + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref || github.ref }} + lfs: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install uv + run: pip install uv + + - name: Install dependencies + run: | + uv pip install --system -e ".[dev,demo]" + uv pip install --system cyclonedx-bom + + - name: Auto-fix formatting and linting + run: | + uv run --with ruff ruff check --fix . + uv run --with ruff ruff format . + + - name: Generate Knowledge Graph + run: | + python tools/generate_knowledge_graph.py + + - name: Generate Architecture Diagrams + run: | + # Use pyreverse/pydeps if available in the future, placeholder for now + echo "Architecture generation..." + mkdir -p artifacts/architecture + touch artifacts/architecture/README.md + + - name: Generate SBOM + run: | + cyclonedx-py environment -o bom.json + + - name: Sync Documentation + run: | + python tools/docs_sync.py + + - name: Commit and push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add -A + git diff --quiet && git diff --staged --quiet || (git commit -m "chore(auto): autonomous repository maintenance updates" && git push) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 9115043..0da0c4c 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -13,6 +13,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + lfs: true - name: Set up Python uses: actions/setup-python@v5 @@ -38,6 +40,7 @@ jobs: steps: - uses: actions/checkout@v4 with: + lfs: true fetch-depth: 0 - name: TruffleHog OSS @@ -51,6 +54,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + lfs: true - name: Run Trivy vulnerability scanner in repo mode uses: aquasecurity/trivy-action@master diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..f5c5538 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,22 @@ +name: Close Stale Issues + +on: + schedule: + - cron: '30 1 * * *' + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + days-before-stale: 30 + days-before-close: 5 + stale-issue-label: 'stale' + stale-pr-label: 'stale' diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..0432fa2 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,12 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +## Our Standards diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..31b28b4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing + +We welcome contributions! Please see our guidelines. diff --git a/tools/docs_sync.py b/tools/docs_sync.py new file mode 100644 index 0000000..c912041 --- /dev/null +++ b/tools/docs_sync.py @@ -0,0 +1,12 @@ +import os + + +def sync_docs() -> None: + print("Syncing documentation...") + os.makedirs("docs", exist_ok=True) + with open("docs/sync_status.md", "w") as f: + f.write("# Documentation Sync\n\nDocs are continuously synchronized.\n") + + +if __name__ == "__main__": + sync_docs() diff --git a/tools/generate_knowledge_graph.py b/tools/generate_knowledge_graph.py new file mode 100644 index 0000000..6b87688 --- /dev/null +++ b/tools/generate_knowledge_graph.py @@ -0,0 +1,23 @@ +import os +import json +from typing import Dict, List + + +def generate_knowledge_graph() -> None: + print("Generating knowledge graph...") + graph: Dict[str, List[Dict[str, str]]] = {"nodes": [], "edges": []} + for root, dirs, files in os.walk("."): + if ".git" in root or "node_modules" in root or ".venv" in root: + continue + for file in files: + if file.endswith((".py", ".ts", ".md", ".json", ".yml", ".yaml")): + filepath = os.path.join(root, file) + graph["nodes"].append({"id": filepath, "label": file}) + + os.makedirs("artifacts", exist_ok=True) + with open("artifacts/knowledge_graph.json", "w") as f: + json.dump(graph, f, indent=2) + + +if __name__ == "__main__": + generate_knowledge_graph() diff --git a/web/public/maps/bangalore_roads_graph.json.gz b/web/public/maps/bangalore_roads_graph.json.gz index ea6b870..5384824 100644 Binary files a/web/public/maps/bangalore_roads_graph.json.gz and b/web/public/maps/bangalore_roads_graph.json.gz differ