* Fetch tool-specific files and convert them to rulesync format
(params: {
client: GitHubClient;
parsed: ParsedSource;
ref: string;
resolvedPath: string;
enabledFeatures: Feature[];
target: ToolTarget;
outputDir: string;
outputRoot: string;
conflictStrategy: ConflictStrategy;
logger: Logger;
})
| 517 | * Fetch tool-specific files and convert them to rulesync format |
| 518 | */ |
| 519 | async function fetchAndConvertToolFiles(params: { |
| 520 | client: GitHubClient; |
| 521 | parsed: ParsedSource; |
| 522 | ref: string; |
| 523 | resolvedPath: string; |
| 524 | enabledFeatures: Feature[]; |
| 525 | target: ToolTarget; |
| 526 | outputDir: string; |
| 527 | outputRoot: string; |
| 528 | conflictStrategy: ConflictStrategy; |
| 529 | logger: Logger; |
| 530 | }): Promise<FetchSummary> { |
| 531 | const { |
| 532 | client, |
| 533 | parsed, |
| 534 | ref, |
| 535 | resolvedPath, |
| 536 | enabledFeatures, |
| 537 | target, |
| 538 | outputDir, |
| 539 | outputRoot, |
| 540 | conflictStrategy: _conflictStrategy, |
| 541 | logger, |
| 542 | } = params; |
| 543 | |
| 544 | // Create a unique temporary directory |
| 545 | const tempDir = await createTempDirectory(); |
| 546 | logger.debug(`Created temp directory: ${tempDir}`); |
| 547 | |
| 548 | // Create semaphore for concurrency control |
| 549 | const semaphore = new Semaphore(FETCH_CONCURRENCY_LIMIT); |
| 550 | |
| 551 | try { |
| 552 | // Collect files using rulesync feature paths (rules/, commands/, etc.) |
| 553 | // External repos use these paths directly without tool-specific prefixes |
| 554 | const filesToFetch = await collectFeatureFiles({ |
| 555 | client, |
| 556 | owner: parsed.owner, |
| 557 | repo: parsed.repo, |
| 558 | basePath: resolvedPath, |
| 559 | ref, |
| 560 | enabledFeatures, |
| 561 | semaphore, |
| 562 | logger, |
| 563 | }); |
| 564 | |
| 565 | if (filesToFetch.length === 0) { |
| 566 | logger.warn(`No files found matching enabled features: ${enabledFeatures.join(", ")}`); |
| 567 | return { |
| 568 | source: `${parsed.owner}/${parsed.repo}`, |
| 569 | ref, |
| 570 | files: [], |
| 571 | created: 0, |
| 572 | overwritten: 0, |
| 573 | skipped: 0, |
| 574 | }; |
| 575 | } |
| 576 |
no test coverage detected
searching dependent graphs…