fn(project$0, branch$1, part$2, then$3) =>
@definy.read-branch-snapshot(
project: $0,
branch: $1,
then: fn(commit$4, commits$5) =>
match $4 {
#none(_) =>
@definy.mcp-text-error(
text: @std.string-join(items: ["Branch ", $1, " of project ", $0, " was not found"], separator: "")
),
#some(found$6) =>
let stored$7 = @definy.snapshot-parts(modules: $6.commit.modules, index: 0);
match @definy.stored-part-find(parts: $7, name: $2, index: 0) {
#none(_) =>
@definy.mcp-text-error(
text: @std.string-join(items: ["Part ", $2, " was not found in branch ", $1, " of project ", $0], separator: "")
),
#some(target$8) =>
@definy.read-part-contents(
parts: $7,
then: fn(parts$9) =>
match @core.list-find-last-by-field(list: $9, field: "id", value: $8.id) {
#some(resolved$10) =>
$3(commit: $6, target: $10, parts: $9),
#none(_) =>
@definy.mcp-text-error(text: "The part could not be read")
}
)
}
}
)