MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / handleExport

Function handleExport

website/src/components/PRReviewer.tsx:450–472  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

448 };
449
450 const handleExport = async () => {
451 try {
452 const repoName = data.metadata?.repo || "unknown/code-graph";
453 let filename = "";
454 if (repoName.includes('/')) {
455 const owner = repoName.split('/')[0];
456 const repo = repoName.split('/')[1];
457 const branch = data.metadata?.branch || "main";
458 const commit = data.metadata?.commit || data.metadata?.version || "latest";
459 const cleanCommit = commit.length === 40 && /^[0-9a-fA-F]+$/.test(commit) ? commit.substring(0, 7) : commit;
460 filename = `${owner}__${repo}__${branch}__${cleanCommit}.cgc`;
461 } else {
462 filename = `${repoName}.cgc`;
463 }
464
465 const blob = await packageCgcBundle(repoName, data.nodes, data.links, data.metadata?.version || "1.0.0", data.metadata);
466 downloadBlob(blob, filename);
467 toast.success("CGC bundle exported successfully!");
468 } catch (err: any) {
469 console.error(err);
470 toast.error("Failed to export bundle: " + err.message);
471 }
472 };
473
474 const handlePublishSubmit = async (e: React.FormEvent) => {
475 e.preventDefault();

Callers 1

PRReviewerFunction · 0.70

Calls 3

packageCgcBundleFunction · 0.90
downloadBlobFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected