From 6892aaf7de6b213b12fed047fa00addddcaaf790 Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Fri, 25 Jul 2025 22:52:21 +0200 Subject: [PATCH] simplify tool contribution --- src/pages/api/contribute/tool.ts | 23 +- src/pages/contribute/knowledgebase.astro | 249 ++-- src/pages/contribute/tool.astro | 1351 +++++++++++----------- src/utils/gitContributions.ts | 554 ++------- 4 files changed, 875 insertions(+), 1302 deletions(-) diff --git a/src/pages/api/contribute/tool.ts b/src/pages/api/contribute/tool.ts index 117bdce..3157ff0 100644 --- a/src/pages/api/contribute/tool.ts +++ b/src/pages/api/contribute/tool.ts @@ -115,17 +115,6 @@ async function validateToolData(tool: any, action: string): Promise<{ valid: boo } } - // Validate related concepts exist - if (tool.related_concepts && tool.related_concepts.length > 0) { - const existingConcepts = new Set( - existingData.tools.filter((t: any) => t.type === 'concept').map((t: any) => t.name) - ); - const invalidConcepts = tool.related_concepts.filter((c: string) => !existingConcepts.has(c)); - if (invalidConcepts.length > 0) { - errors.push(`Referenced concepts not found: ${invalidConcepts.join(', ')}`); - } - } - return { valid: errors.length === 0, errors }; } catch (error) { @@ -199,23 +188,21 @@ export const POST: APIRoute = async ({ request }) => { // CRITICAL FIX: Enhanced error handling for Git operations try { + // Submit contribution via Git (now creates issue instead of PR) const gitManager = new GitContributionManager(); const result = await gitManager.submitContribution(contributionData); if (result.success) { - // Log successful contribution - console.log(`[CONTRIBUTION SUCCESS] ${validatedData.action} "${validatedData.tool.name}" by ${userEmail} - PR: ${result.prUrl}`); + console.log(`[CONTRIBUTION] Issue created for "${validatedData.tool.name}" by ${userEmail} - Issue: ${result.issueUrl}`); - // ENSURE proper success response return apiResponse.created({ success: true, message: result.message, - prUrl: result.prUrl, - branchName: result.branchName + issueUrl: result.issueUrl, + issueNumber: result.issueNumber }); } else { - // Log failed contribution - console.error(`[CONTRIBUTION FAILED] ${validatedData.action} "${validatedData.tool.name}" by ${userEmail}: ${result.message}`); + console.error(`[CONTRIBUTION FAILED] "${validatedData.tool.name}" by ${userEmail}: ${result.message}`); return apiServerError.internal(`Contribution failed: ${result.message}`); } diff --git a/src/pages/contribute/knowledgebase.astro b/src/pages/contribute/knowledgebase.astro index 6f54069..4fd35f6 100644 --- a/src/pages/contribute/knowledgebase.astro +++ b/src/pages/contribute/knowledgebase.astro @@ -30,8 +30,8 @@ const sortedTools = data.tools.sort((a: any, b: any) => a.name.localeCompare(b.n
- - {sortedTools.map(tool => ( @@ -41,12 +41,11 @@ const sortedTools = data.tools.sort((a: any, b: any) => a.name.localeCompare(b.n
- + a.name.localeCompare(b.n
- + -
-
Seid spezifisch hinsichtlich use-case, Funktionalität und Schlüsselfeatures.
-
0/1000
-
- -
- - -
- -
- - -
Homepage, Dokumentation, oder Primärquelle
- -
- -
- - -
- -
- -
- {domains.map(domain => ( - - ))} -
-
Mehrfachauswahl erlaubt
-
- - -
- -
- {phases.map(phase => ( - - ))} -
-
Mehrfachauswahl erlaubt
-
-
- - - - - -
-
- - + @@ -261,536 +78,674 @@ const title = isEdit ? `Edit ${editTool?.name}` : 'Beitrag erstellen';
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ 0/1000 +
+
+ +
+ + + Homepage, documentation, or primary source +
+
+ + +
+

Categories

+ +
- -
- + +
+ {domains.map(domain => ( + + ))} +
+
+ +
+ +
+ {phases.map(phase => ( + + ))}
+
- -
- - -
- Add relevant tags separated by commas. Use lowercase with hyphens for multi-word tags. + +