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

Function parsePullRequest

apps/kimi-code/src/utils/git/git-status.ts:281–294  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

279}
280
281function parsePullRequest(stdout: string): PullRequestInfo | null {
282 try {
283 const raw = JSON.parse(stdout) as unknown;
284 if (typeof raw !== 'object' || raw === null) return null;
285 const record = raw as Record<string, unknown>;
286 const number = record['number'];
287 const url = record['url'];
288 if (typeof number !== 'number' || !Number.isInteger(number) || number <= 0) return null;
289 if (typeof url !== 'string' || !isSafeHttpUrl(url)) return null;
290 return { number, url };
291 } catch {
292 return null;
293 }
294}
295
296function isSafeHttpUrl(value: string): boolean {
297 if (hasControlChars(value)) return false;

Callers 1

readPullRequestFunction · 0.70

Calls 1

isSafeHttpUrlFunction · 0.70

Tested by

no test coverage detected