Download packages/app/src/pages/session/timeline/summary-diffs.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 618 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/pages/session/timeline/summary-diffs.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/pages/session/timeline/summary-diffs.ts
-
curl -L -o summary-diffs.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/pages/session/timeline/summary-diffs.ts
618 Bytes
| import type { SnapshotFileDiff } from "@opencode-ai/sdk/v2" | |
| import type { SummaryDiff } from "./timeline-row" | |
| export function uniqueSummaryDiffs(diffs: SnapshotFileDiff[] | undefined) { | |
| const files = new Set<string>() | |
| return (diffs ?? []) | |
| .reduceRight<SummaryDiff[]>((result, diff) => { | |
| if (!isSummaryDiff(diff)) return result | |
| const file = diff.file | |
| if (files.has(file)) return result | |
| files.add(file) | |
| result.push(diff) | |
| return result | |
| }, []) | |
| .reverse() | |
| } | |
| function isSummaryDiff(diff: SnapshotFileDiff): diff is SummaryDiff { | |
| return typeof diff.file === "string" | |
| } | |