(entries: Record<string, InternalEntry>)
| 463 | // ── App extraction ───────────────────────────────────────────────── |
| 464 | |
| 465 | function extractAppsFromEntries(entries: Record<string, InternalEntry>): AppEntry[] { |
| 466 | const apps: AppEntry[] = []; |
| 467 | |
| 468 | for (const [index, entry] of Object.entries(entries)) { |
| 469 | const content = entry.content || ''; |
| 470 | const comment = entry.comment || ''; |
| 471 | |
| 472 | if (!content.includes('<rule S>')) continue; |
| 473 | |
| 474 | const id = commentToId(comment); |
| 475 | if (!id) { |
| 476 | logger.warn( |
| 477 | 'extractApps', |
| 478 | `Empty app ID from comment "${comment}" at index ${index}, skipping.`, |
| 479 | ); |
| 480 | continue; |
| 481 | } |
| 482 | |
| 483 | apps.push({ |
| 484 | id, |
| 485 | name: comment, |
| 486 | entryIndex: parseInt(index, 10), |
| 487 | keywords: [...entry.key], |
| 488 | format: detectFormatType(content), |
| 489 | tags: extractTags(content), |
| 490 | resources: extractResources(content), |
| 491 | example: extractExample(content), |
| 492 | scripts: [], |
| 493 | imageTagPairs: [], |
| 494 | skinVariants: [], |
| 495 | }); |
| 496 | } |
| 497 | |
| 498 | return apps; |
| 499 | } |
| 500 | |
| 501 | function extractLoreEntries(entries: Record<string, InternalEntry>): LoreEntry[] { |
| 502 | const lore: LoreEntry[] = []; |
no test coverage detected