Skip to content

refactor: unify duplicate project registries into a shared projects database#985

Merged
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
nishtha-agarwal-211:refactor/unify-project-registries-979
Jun 4, 2026
Merged

refactor: unify duplicate project registries into a shared projects database#985
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
nishtha-agarwal-211:refactor/unify-project-registries-979

Conversation

@nishtha-agarwal-211
Copy link
Copy Markdown
Contributor

Description

This Pull Request addresses issue #979 by refactoring duplicate, hardcoded project lists across several files into a single, unified project registry database. This ensures consistency and makes it much easier to add or update mini-projects in the future without duplicating files or lists.

Fixes #979

Proposed Changes

  1. Central JSON Registry Database:

    • Created projects_registry.json at the root of the project to act as the single source of truth.
    • Structured the schema to capture metadata for all 18 Python mini-projects: name, emoji, category, difficulty, description, keywords, and path.
    • Created a symbolic link web-app/projects_registry.json pointing to ../projects_registry.json to allow the static Web App to resolve the JSON locally.
  2. Refactored CLI Search (search_projects.py):

    • Replaced the hardcoded PROJECTS list with a dynamic load using the json module.
    • Truncated the accidental duplicate code block at the bottom of the file (lines 330-660) which previously caused a NameError on script exit.
  3. Refactored CLI Progress Tracker (utilities/Progress-Tracker/Progress-Tracker.py):

    • Dynamically loads projects from projects_registry.json.
    • Dynamically groups projects by category (games -> 🎲 Games, math -> 🔢 Math, utilities -> 🔐 Utilities).
    • Extracts the project identifiers from the directory names in their path (e.g. Rock-Paper-Scissor).
    • Added backward-compatibility migrations in load_data() to seamlessly map legacy tracker keys (Dice-Rolling, Coin-Flip, Pascals-Triangle) to the new unified folder names (Roling-Dice, Flipping-toss, Pascal-Triangle).
  4. Refactored Web App Progress Tracker (web-app/js/projects/progress-tracker.js):

    • Dynamically fetches ./projects_registry.json relative to the app.
    • Groups projects by category and renders the tracker layout dynamically in the DOM.
    • Implemented corresponding local storage migrations for legacy keys.

Copilot AI review requested due to automatic review settings June 4, 2026 08:16
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

@nishtha-agarwal-211 is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR centralizes the project catalog into a single projects_registry.json file and updates both the web progress tracker and Python utilities to read from that registry, including migrations for renamed project folders.

Changes:

  • Added a root projects_registry.json registry and updated consumers to load projects dynamically from it.
  • Updated the web progress tracker to fetch the registry and migrate legacy localStorage completion keys.
  • Updated the Python Progress Tracker (and search_projects.py) to load the registry from JSON rather than hardcoded lists.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
web-app/projects_registry.json Attempts to expose the root registry to the web app (currently via a non-JSON stub).
web-app/js/projects/progress-tracker.js Loads registry via fetch, renders categories dynamically, and migrates old completion keys.
utilities/Progress-Tracker/Progress-Tracker.py Loads registry from JSON and migrates persisted completion keys.
search_projects.py Replaces inline registry definition with JSON loading (but removes most of the script).
projects_registry.json Adds the centralized registry used by multiple tools.
Comments suppressed due to low confidence (1)

web-app/projects_registry.json:1

  • progress-tracker.js calls fetch('./projects_registry.json').then(r => r.json()), but this file is not valid JSON (it’s a plain string path), so parsing will fail at runtime. Make web-app/projects_registry.json an actual JSON file (e.g., copy of the root registry as part of build/deploy) or change the fetch path to point to the real JSON location that the web server serves (and ensure that endpoint returns JSON).
[

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +137 to +139
const catTitle = document.createElement('div');
catTitle.className = 'pt-cat-title';
catTitle.innerHTML = cat + '  ·  ' + catDone + '/' + projects.length;
Comment on lines +146 to +148
const card = document.createElement('div');
card.className = 'pt-card' + (isDone ? ' done' : '');
card.innerHTML = '<span class="pt-tick">' + (isDone ? '✅' : '⬜') + '</span><span class="pt-name">' + name + '</span>';
Comment on lines +109 to +112
function render() {
const done = load();
const count = done.length;
const pct = Math.round((count / TOTAL) * 100);
Comment on lines +62 to +67
for k, v in completed.items():
if k in migrations:
updated_completed[migrations[k]] = v
mutated = True
else:
updated_completed[k] = v
Comment on lines +28 to +30
try:
with open(REGISTRY_PATH, "r", encoding="utf-8") as f:
registry = json.load(f)
Comment on lines +38 to 43
except Exception as e:
print(f"Error loading project registry: {e}")

# Flatten for quick lookup
ALL_PROJECT_NAMES = [p for projects in ALL_PROJECTS.values() for p in projects]
TOTAL = len(ALL_PROJECT_NAMES)
Comment thread search_projects.py
Comment on lines +16 to 25
REGISTRY_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "projects_registry.json")

try:
with open(REGISTRY_PATH, "r", encoding="utf-8") as f:
PROJECTS = json.load(f)
except Exception as e:
print(f"Error loading project registry: {e}")
PROJECTS = []

DIFFICULTY_ORDER = {"beginner": 1, "intermediate": 2, "advanced": 3}
@steam-bell-92 steam-bell-92 merged commit b11a832 into steam-bell-92:main Jun 4, 2026
9 of 11 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.

We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone.

If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request.

Thanks again for your support! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Unify duplicate project registries into a shared projects database

3 participants