syntax = "proto3";
option go_package = "ffi/proto";

message TurboDataDirResp {
    string dir = 1;
}

message GlobReq {
	string base_path = 1;
	repeated string include_patterns = 2;
  repeated string exclude_patterns = 3;
  bool files_only = 4; // note that the default for a bool is false
}

message GlobResp {
  oneof response {
    GlobRespList files = 1;
    string error = 2;
  }
}

message GlobRespList {
  repeated string files = 1;
}

message ChangedFilesReq {
  string repo_root = 1;
  string monorepo_root = 2;
  optional string from_commit = 3;
  optional string to_commit = 4;
}

message ChangedFilesResp {
  oneof response {
    ChangedFilesList files = 1;
    string error = 2;
  }
}

message ChangedFilesList {
  repeated string files = 1;
}

message PreviousContentReq {
  string repo_root = 1;
  string from_commit = 2;
  string file_path = 3;
}

message PreviousContentResp {
  oneof response {
    bytes content = 1;
    string error = 2;
  }
}

message TransitiveDepsRequest {
  bytes contents = 1;
  string workspace_dir = 2;
  map<string, string> unresolved_deps = 3;
}

message TransitiveDepsResponse {
  oneof response {
    LockfilePackageList packages = 1;
    string error = 2;
  }
}

message LockfilePackage {
  string key = 1;
  string version = 2;
  bool found = 3;
}

message LockfilePackageList {
  repeated LockfilePackage list = 1;
}

message SubgraphRequest {
  bytes contents = 1;
  repeated string workspaces = 2;
  repeated string packages = 3;
}

message SubgraphResponse {
  oneof response {
    bytes contents = 1;
    string error = 2;
  }
}
