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

Function readConfigSource

src/commands/create.ts:73–92  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

71}
72
73async function readConfigSource(source: string): Promise<PackConfig> {
74 let raw = "";
75
76 if (isHttpUrl(source)) {
77 const response = await fetch(source);
78 if (!response.ok) {
79 throw new Error(
80 `Failed to download config: ${response.status} ${response.statusText}`,
81 );
82 }
83 raw = await response.text();
84 } else {
85 const filePath = path.resolve(source);
86 raw = fs.readFileSync(filePath, "utf-8");
87 }
88
89 const parsed = JSON.parse(raw) as unknown;
90 validateConfigShape(parsed, source);
91 return parsed;
92}
93
94/**
95 * Copy templates/start.sh and templates/start.bat to workDir.

Callers 1

initFromConfigFunction · 0.85

Calls 4

isHttpUrlFunction · 0.85
validateConfigShapeFunction · 0.85
textMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected