From 18f6ebae181d0076e43796855195186a54eb4cd0 Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Wed, 10 Sep 2025 14:44:02 +0200
Subject: [PATCH] feat: Switch to local JSON files as primary source with
GitHub resync
- Create LocalScriptsService to read from scripts/json directory
- Update tRPC routes to use local files by default
- Implement resync functionality to download from GitHub and save locally
- Make GitHub optional - only needed for resyncing
- Update UI to reflect local-first approach
- Add proper error handling for missing local files
---
src/app/_components/ScriptsGrid.tsx | 4 +-
src/app/page.tsx | 2 +-
src/server/api/routers/scripts.ts | 31 ++++----
src/server/services/localScripts.ts | 106 ++++++++++++++++++++++++++++
4 files changed, 128 insertions(+), 15 deletions(-)
create mode 100644 src/server/services/localScripts.ts
diff --git a/src/app/_components/ScriptsGrid.tsx b/src/app/_components/ScriptsGrid.tsx
index 47dbd4c..4326153 100644
--- a/src/app/_components/ScriptsGrid.tsx
+++ b/src/app/_components/ScriptsGrid.tsx
@@ -48,8 +48,8 @@ export function ScriptsGrid() {
{scriptCardsData?.error || 'Unknown error occurred'}
-
Make sure to set the REPO_URL environment variable.
-
Example: REPO_URL="https://github.com/username/repo"
+
No JSON files found in scripts/json directory.
+
Use the "Resync Scripts" button to download from GitHub.