sync: claim removal fix, auto-crawl email, progress bar, search optimization

- Fix claim removal request flow
- Add email notification on auto-crawl skill discovery
- Add progress bar component
- Optimize Meilisearch sync and search indexing
- Improve skill parser and queries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
airano
2026-02-22 04:58:01 +03:30
parent b05cb21a65
commit 0713607693
15 changed files with 352 additions and 14 deletions

View File

@@ -4,7 +4,8 @@
*/
import type { SourceFormat } from 'skillhub-core';
import { createDb, skillQueries, categoryQueries, type Database } from '@skillhub/db';
import { createDb, skillQueries, categoryQueries, addRequestQueries, userQueries, type Database } from '@skillhub/db';
import { sendSkillIndexedEmail } from './email-notify.js';
import type { GitHubCrawler } from './crawler.js';
import { SkillAnalyzer } from './analyzer.js';
import { syncSkillToMeilisearch } from './meilisearch-sync.js';
@@ -117,6 +118,41 @@ export async function indexSkill(
indexedAt: new Date(),
});
// Check for matching add-requests and mark as indexed
try {
const matchingRequests = await addRequestQueries.findApprovedByRepo(
database,
source.owner,
source.repo
);
for (const request of matchingRequests) {
await addRequestQueries.updateStatus(database, request.id, {
status: 'indexed',
indexedSkillId: skillId,
});
// Send email notification
const user = await userQueries.getById(database, request.userId);
if (user?.email) {
const locale = (user.preferredLocale === 'fa' ? 'fa' : 'en') as 'en' | 'fa';
await sendSkillIndexedEmail(
user.email,
locale,
{
skillId,
skillName: analysis.skill.metadata.name,
repositoryUrl: `https://github.com/${source.owner}/${source.repo}`,
}
).catch((err: unknown) => {
console.warn(`[Indexer] Failed to send indexed email for ${skillId}:`, err);
});
}
}
} catch (error) {
console.warn(`[Indexer] Failed to check add-requests for ${skillId}:`, error);
}
// Link skill to categories based on keywords
try {
const categories = await categoryQueries.linkSkillToCategories(