§ fs · git
Rename docker-compose.yml across a portfolio
The case study from the home page, shown in full. One script. Idempotent. Resumable.
§ rename-compose.husk husk plan
# Rename docker-compose.{yml,yaml} to compose.yml across the
# portfolio. Update references. Commit per repo.
let root: path = param("root", default: path("~/mataki"))
let exclude = list("node_modules", ".git", ".terraform", ".worktrees")
let files =
fs.walk(root, exclude: exclude)
| where .name in list("docker-compose.yml", "docker-compose.yaml")
let by_repo = files | group_by { f => git.repo_root(f.path) }
by_repo | parallel(max: 4) { repo, files =>
checkpoint("repo:${repo}") {
for f in files {
fs.ensure(file: f.path.parent / "compose.yml",
contents: fs.read(f.path)?)
fs.ensure(file: f.path, absent: true)
}
git.commit(repo: repo,
paths: files.map(.path.parent / "compose.yml"),
message: "chore: rename to compose.yml")
}
}