* Get tool-specific path mapping for a target * Returns a mapping from rulesync feature paths to tool-specific paths
(target: ToolTarget)
| 639 | * Returns a mapping from rulesync feature paths to tool-specific paths |
| 640 | */ |
| 641 | function getToolPathMapping(target: ToolTarget): { |
| 642 | rules?: { root?: string; nonRoot?: string }; |
| 643 | commands?: string; |
| 644 | subagents?: string; |
| 645 | skills?: string; |
| 646 | } { |
| 647 | // Get tool-specific paths from each processor class |
| 648 | const mapping: { |
| 649 | rules?: { root?: string; nonRoot?: string }; |
| 650 | commands?: string; |
| 651 | subagents?: string; |
| 652 | skills?: string; |
| 653 | } = {}; |
| 654 | |
| 655 | // Rules paths |
| 656 | const supportedRulesTargets = RulesProcessor.getToolTargets({ global: false }); |
| 657 | if (supportedRulesTargets.includes(target)) { |
| 658 | const factory = RulesProcessor.getFactory(target); |
| 659 | if (factory) { |
| 660 | const paths = factory.class.getSettablePaths({ global: false }); |
| 661 | mapping.rules = { |
| 662 | root: paths.root?.relativeFilePath, |
| 663 | nonRoot: paths.nonRoot?.relativeDirPath, |
| 664 | }; |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | // Commands paths |
| 669 | const supportedCommandsTargets = CommandsProcessor.getToolTargets({ |
| 670 | global: false, |
| 671 | includeSimulated: false, |
| 672 | }); |
| 673 | if (supportedCommandsTargets.includes(target)) { |
| 674 | const factory = CommandsProcessor.getFactory(target); |
| 675 | if (factory) { |
| 676 | const paths = factory.class.getSettablePaths({ global: false }); |
| 677 | mapping.commands = paths.relativeDirPath; |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | // Subagents paths |
| 682 | const supportedSubagentsTargets = SubagentsProcessor.getToolTargets({ |
| 683 | global: false, |
| 684 | includeSimulated: false, |
| 685 | }); |
| 686 | if (supportedSubagentsTargets.includes(target)) { |
| 687 | const factory = SubagentsProcessor.getFactory(target); |
| 688 | if (factory) { |
| 689 | const paths = factory.class.getSettablePaths({ global: false }); |
| 690 | mapping.subagents = paths.relativeDirPath; |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Skills paths |
| 695 | const supportedSkillsTargets = SkillsProcessor.getToolTargets({ global: false }); |
| 696 | if (supportedSkillsTargets.includes(target)) { |
| 697 | const factory = SkillsProcessor.getFactory(target); |
| 698 | if (factory) { |
no test coverage detected
searching dependent graphs…