MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / parseSourceInput

Function parseSourceInput

src/commands/create.ts:36–62  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

34}
35
36function parseSourceInput(value: string): {
37 source: string;
38 inlineSkillNames: string[];
39} {
40 const trimmedValue = normalizeSourceInput(value);
41 const skillFlagIndex = trimmedValue.indexOf(" --skill ");
42
43 if (skillFlagIndex === -1) {
44 return {
45 source: trimmedValue,
46 inlineSkillNames: [],
47 };
48 }
49
50 const source = trimmedValue.slice(0, skillFlagIndex).trim();
51 const inlineSkillValue = trimmedValue
52 .slice(skillFlagIndex + " --skill ".length)
53 .trim();
54
55 return {
56 source,
57 inlineSkillNames: inlineSkillValue
58 .split(/[,\s]+/)
59 .map((name) => name.trim())
60 .filter(Boolean),
61 };
62}
63
64function isHttpUrl(value: string): boolean {
65 try {

Callers 1

interactiveCreateFunction · 0.85

Calls 1

normalizeSourceInputFunction · 0.85

Tested by

no test coverage detected