MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / resolveInstallSource

Function resolveInstallSource

packages/agent-core/src/plugin/source.ts:18–31  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

16const SHA_RE = /^[0-9a-f]{7,40}$/;
17
18export function resolveInstallSource(source: string): ResolvedSource {
19 const trimmed = source.trim();
20
21 const github = parseGithubUrl(trimmed);
22 if (github !== undefined) return github;
23
24 if (trimmed.startsWith('http://') || trimmed.startsWith('https://')) {
25 return { kind: 'zip-url', path: trimmed };
26 }
27 if (!path.isAbsolute(trimmed)) {
28 throw new Error(`Plugin root must be an absolute path (got "${source}")`);
29 }
30 return { kind: 'local-path', path: trimmed };
31}
32
33function parseGithubUrl(raw: string): ResolvedSource | undefined {
34 let url: URL;

Callers 2

source.test.tsFile · 0.90
installMethod · 0.90

Calls 1

parseGithubUrlFunction · 0.85

Tested by

no test coverage detected