MCPcopy Create free account
hub / github.com/github/awesome-copilot / resolveSource

Function resolveSource

eng/materialize-plugins.mjs:31–42  ·  view source on GitHub ↗

* Resolve a plugin-relative path to the repo-root source file. * * ./agents/foo.md → ROOT/agents/foo.agent.md * ./skills/baz/ → ROOT/skills/baz/

(relPath)

Source from the content-addressed store, hash-verified

29 * ./skills/baz/ → ROOT/skills/baz/
30 */
31function resolveSource(relPath) {
32 const basename = path.basename(relPath, ".md");
33 if (relPath.startsWith("./agents/")) {
34 return path.join(ROOT_FOLDER, "agents", `${basename}.agent.md`);
35 }
36 if (relPath.startsWith("./skills/")) {
37 // Strip trailing slash and get the skill folder name
38 const skillName = relPath.replace(/^\.\/skills\//, "").replace(/\/$/, "");
39 return path.join(ROOT_FOLDER, "skills", skillName);
40 }
41 return null;
42}
43
44function materializePlugins() {
45 console.log("Materializing plugin files...\n");

Callers 1

materializePluginsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected