MCPcopy Create free account
hub / github.com/dyoshikawa/rulesync / getToolPathMapping

Function getToolPathMapping

src/lib/fetch.ts:641–705  ·  view source on GitHub ↗

* Get tool-specific path mapping for a target * Returns a mapping from rulesync feature paths to tool-specific paths

(target: ToolTarget)

Source from the content-addressed store, hash-verified

639 * Returns a mapping from rulesync feature paths to tool-specific paths
640 */
641function 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) {

Callers 1

fetchAndConvertToolFilesFunction · 0.85

Calls 3

getToolTargetsMethod · 0.45
getFactoryMethod · 0.45
getSettablePathsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…