From 277c9f74cd2b765e6a9882964f2afb76f72b0044 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Wed, 3 Dec 2025 09:18:16 +1000 Subject: [PATCH] feat: add author name to skipped packages in Discord notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API Changes: - Track author name along with package name and reason - Extract author from pkg.author (string or object with name field) - Default to "unknown" if author info not available Workflow Changes: - Display author in format: "package-name (by author) - reason" Example Discord output: 📋 Skipped Packages tpmjs-threejs-tool (by john-doe) - invalid tpmjs field @scope/package-1 (by jane-smith) - missing tpmjs field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/sync-keyword.yml | 2 +- apps/web/src/app/api/sync/keyword/route.ts | 28 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-keyword.yml b/.github/workflows/sync-keyword.yml index bd33f34..55c6399 100644 --- a/.github/workflows/sync-keyword.yml +++ b/.github/workflows/sync-keyword.yml @@ -59,7 +59,7 @@ jobs: # Store skipped packages for Discord if [ "$skipped" -gt 0 ]; then - skippedList=$(echo "$response" | jq -r '.data.skippedPackages[]? | "\(.name) - \(.reason)"' 2>/dev/null | paste -sd "\n" - || echo "") + skippedList=$(echo "$response" | jq -r '.data.skippedPackages[]? | "\(.name) (by \(.author)) - \(.reason)"' 2>/dev/null | paste -sd "\n" - || echo "") if [ -n "$skippedList" ]; then echo "$skippedList" > /tmp/skipped_packages.txt fi diff --git a/apps/web/src/app/api/sync/keyword/route.ts b/apps/web/src/app/api/sync/keyword/route.ts index f338386..7c68d71 100644 --- a/apps/web/src/app/api/sync/keyword/route.ts +++ b/apps/web/src/app/api/sync/keyword/route.ts @@ -30,7 +30,7 @@ export async function POST(request: NextRequest) { let skipped = 0; let errors = 0; const errorMessages: string[] = []; - const skippedPackages: Array<{ name: string; reason: string }> = []; + const skippedPackages: Array<{ name: string; author: string; reason: string }> = []; try { // Search for packages with 'tpmjs-tool' keyword @@ -48,14 +48,30 @@ export async function POST(request: NextRequest) { // Skip if package not found if (!pkg) { skipped++; - skippedPackages.push({ name: result.package.name, reason: 'package not found' }); + skippedPackages.push({ + name: result.package.name, + author: 'unknown', + reason: 'package not found', + }); continue; } + // Extract author name + const authorName = + typeof pkg.author === 'string' + ? pkg.author + : typeof pkg.author === 'object' && pkg.author?.name + ? pkg.author.name + : 'unknown'; + // Check if package has tpmjs field if (!pkg.tpmjs) { skipped++; - skippedPackages.push({ name: pkg.name, reason: 'missing tpmjs field' }); + skippedPackages.push({ + name: pkg.name, + author: authorName, + reason: 'missing tpmjs field', + }); continue; } @@ -63,7 +79,11 @@ export async function POST(request: NextRequest) { const validation = validateTpmjsField(pkg.tpmjs); if (!validation.valid || !validation.data) { skipped++; - skippedPackages.push({ name: pkg.name, reason: 'invalid tpmjs field' }); + skippedPackages.push({ + name: pkg.name, + author: authorName, + reason: 'invalid tpmjs field', + }); continue; }