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