MCPcopy Index your code
hub / github.com/anomalyco/opencode / source

Function source

packages/opencode/src/cli/cmd/export.ts:35–58  ·  view source on GitHub ↗
(part: SessionV1.FilePart)

Source from the content-addressed store, hash-verified

33}
34
35function source(part: SessionV1.FilePart) {
36 if (!part.source) return part.source
37 if (part.source.type === "symbol") {
38 return {
39 ...part.source,
40 path: redact("file-path", part.id, part.source.path),
41 name: redact("file-symbol", part.id, part.source.name),
42 text: span(part.id, part.source.text),
43 }
44 }
45 if (part.source.type === "resource") {
46 return {
47 ...part.source,
48 clientName: redact("file-client", part.id, part.source.clientName),
49 uri: redact("file-uri", part.id, part.source.uri),
50 text: span(part.id, part.source.text),
51 }
52 }
53 return {
54 ...part.source,
55 path: redact("file-path", part.id, part.source.path),
56 text: span(part.id, part.source.text),
57 }
58}
59
60function filepart(part: SessionV1.FilePart): SessionV1.FilePart {
61 return {

Callers 1

filepartFunction · 0.70

Calls 2

redactFunction · 0.85
spanFunction · 0.70

Tested by

no test coverage detected