Explorer

definy.mcp-find-references

description
definy_find_references: the parts of a branch whose type or expression references the part
type
Fn(arguments: @definy.json, request: @http.request) -> @definy.service-io
expression
fn(arguments$0, request$1) =>
  let project$2 = @definy.mcp-arg-string(arguments: $0, key: "project", default: "");
  let branch$3 = @definy.mcp-arg-string(arguments: $0, key: "branch", default: "main");
  let part$4 = @definy.mcp-arg-string(arguments: $0, key: "part", default: "");
  @definy.with-branch-part-contents(
    project: $2,
    branch: $3,
    part: $4,
    then: fn(commit$5, target$6, parts$7) =>
      let referrers$8 = @definy.part-referrers(parts: $7, id: $6.id);
      @definy.mcp-text(
        text: @core.string-join(
          items: @core.list-concat(
            left: [
              @core.string-join(
                items: [
                  @std.number-to-string(value: @core.list-length(value: $8)),
                  " parts reference ",
                  $4,
                  " in branch ",
                  $3,
                  " of project ",
                  $2
                ],
                separator: ""
              )
            ],
            right: @core.list-map(
              T: @definy.snapshot-check-part,
              U: String,
              f: fn(item$9) =>
                @core.string-concat(left: "  ", right: $9.name),
              xs: $8
            )
          ),
          separator: "\n"
        )
      )
  )
visibility
public
definy.mcp-find-references (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: _8ZFNHtE3kLhfnzze2kX_64pi1VZjcMsQEHLstyQEts
content hash: AErGDlJVqEaE5-rXj47_uW1NMNH4pOzWsqCX3tP0KyQ