| 467 | }; |
| 468 | |
| 469 | const parseScriptContent = (content, defaultName) => { |
| 470 | const lines = content.split("\n"); |
| 471 | let name = defaultName; |
| 472 | let description = ""; |
| 473 | let osFilter = []; |
| 474 | |
| 475 | for (const line of lines) { |
| 476 | const nameLine = line.match(/^#\s*@name:\s*(.+)$/i); |
| 477 | if (nameLine) { |
| 478 | name = nameLine[1].trim(); |
| 479 | continue; |
| 480 | } |
| 481 | |
| 482 | const descLine = line.match(/^#\s*@description:\s*(.+)$/i); |
| 483 | if (descLine) { |
| 484 | description = descLine[1].trim(); |
| 485 | continue; |
| 486 | } |
| 487 | |
| 488 | const osLine = line.match(/^#\s*@os:\s*(.+)$/i); |
| 489 | if (osLine) { |
| 490 | osFilter = osLine[1].split(',').map(s => s.trim()).filter(Boolean); |
| 491 | continue; |
| 492 | } |
| 493 | |
| 494 | if (!line.startsWith("#")) break; |
| 495 | } |
| 496 | |
| 497 | return { name, content, description, osFilter: osFilter.length > 0 ? osFilter : null }; |
| 498 | }; |
| 499 | |
| 500 | const parseThemeContent = (content, path) => { |
| 501 | const lines = content.split("\n"); |