Convert REQUIRE to Project.toml and Manifest.toml

Here is my quick-and-dirty Julia function to automate a similar workflow:

"""
    generate_project_toml([name::String])

Generate Project.toml file for the existing current project at `\$PWD`.
It activates the generated Project.toml and then adds packages based on
REQUIRE file.
"""
function generate_project_toml(name::AbstractString = guess_project_name())
    if isfile("Project.toml")
        error("Project.toml exists.")
    end

    if !isfile("REQUIRE")
        error("REQUIRE file not found.")
    end
    deps = read_require("REQUIRE")

    pkg = Base.identify_package(name)
    project_toml = """
    name = $(repr(name))
    uuid = "$(pkg.uuid)"
    """
    write("Project.toml", project_toml)

    @info "Activating \$PWD (to run `Pkg.add`)"
    Pkg.activate(pwd())
    Pkg.add(deps)
end

"""
    guess_project_name() :: String

Guess project name using Git.  It works even in worktree repository.
"""
function guess_project_name()
    path = abspath(rstrip(read(`git rev-parse --git-dir`, String)))
    prev = ""
    while path != prev
        if basename(path) == ".git"
            return basename(dirname(path))
        end
        prev, path = path, dirname(path)
    end
    error("Project not found")
end

function read_require(path)
    deps = String[]
    for line in readlines(path)
        name, = split(line)
        if name == "julia"
            continue
        end
        push!(deps, name)
    end
    return deps
end