///|
async fn main {
  let cwd = @env.current_dir().unwrap()
  debug(@discover.discover(cwd))
}

// struct Discover {
//   current_working_dir : Path?
//   work_path : Path?
//   module_path : Path?
// }

// struct Module {
//   packages : Map[Path, Package]
// }

// struct Package {
//   manifest : Path?
//   is_main : Bool
// }

// async fn locate_work(cwd : Path) -> Path? {
//   let normalized = cwd.resolve()
//   println("normalized: \{normalized}")
//   let mut path = normalized
//   let root = Path("/").resolve()
//   while path != root {
//     guard @fs.kind(path.to_string()) is Directory else { return None }
//     if @fs.readdir(path.to_string(), include_special=false).contains(moon_work_name) {
//       return Some(path.join(moon_work_name))
//     } else {
//       path = path.join("..").resolve()
//     }
//   }
//   None
// }

// // pub async fn discover(cwd : String) -> Discover {

// // }

// ///|
// async test "locate_work" {
//   inspect(
//     locate_work(Path(".")),
//     content=(
//       #|Some("/Users/yorkin/source/rabbit-tea/moon.work")
//     ),
//   )
// }

// ///|
// test {
//   inspect(
//     Path(".").resolve(),
//     content=(
//       #|/Users/yorkin/source/rabbit-tea
//     ),
//   )
// }