MCPcopy Create free account
hub / github.com/ix-infrastructure/Ix / transformPRComment

Function transformPRComment

ix-cli/src/cli/github/transform.ts:107–138  ·  view source on GitHub ↗
(
  repo: GitHubRepo, prNumber: number, comment: GitHubComment
)

Source from the content-addressed store, hash-verified

105}
106
107export function transformPRComment(
108 repo: GitHubRepo, prNumber: number, comment: GitHubComment
109): PatchOp[] {
110 const parentUri = `github://${repo.owner}/${repo.repo}/pull/${prNumber}`;
111 const commentUri = `${parentUri}/comments/${comment.id}`;
112 const parentId = deterministicId(parentUri);
113 const commentId = deterministicId(commentUri);
114 const edgeId = deterministicId(`${parentUri}:CONTAINS:${commentUri}`);
115 return [
116 {
117 type: "UpsertNode",
118 id: commentId,
119 kind: "doc",
120 name: `PR #${prNumber} review by ${comment.user?.login ?? "unknown"}`,
121 attrs: {
122 url: comment.html_url,
123 author: comment.user?.login ?? "unknown",
124 created_at: comment.created_at,
125 body: truncate(comment.body, 2000),
126 source_uri: commentUri,
127 },
128 },
129 {
130 type: "UpsertEdge",
131 id: edgeId,
132 src: parentId,
133 dst: commentId,
134 predicate: "CONTAINS",
135 attrs: {},
136 },
137 ];
138}
139
140export function transformCommit(repo: GitHubRepo, commit: GitHubCommit): PatchOp[] {
141 const uri = `github://${repo.owner}/${repo.repo}/commit/${commit.sha}`;

Callers 1

ingestGitHubFunction · 0.85

Calls 2

deterministicIdFunction · 0.70
truncateFunction · 0.70

Tested by

no test coverage detected