[tasks.default]
alias = "check"
[tasks.check]
description = "Run fmt + clippy + test + lock-check (same as CI)"
dependencies = ["fmt-check", "clippy", "test", "lock-check"]
[tasks.fmt-check]
description = "Check formatting"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.fmt]
description = "Apply formatting"
command = "cargo"
args = ["fmt", "--all"]
[tasks.clippy]
description = "Run clippy with warnings as errors"
command = "cargo"
args = ["clippy", "--locked", "--all-targets", "--", "-D", "warnings"]
[tasks.test]
description = "Run all tests"
command = "cargo"
args = ["test", "--locked"]
[tasks.install]
description = "Install rvpm from local source (respects Cargo.lock via --locked)"
command = "cargo"
args = ["install", "--path", ".", "--locked"]
[tasks.lock-check]
description = "Verify Cargo.lock is in sync with Cargo.toml"
command = "cargo"
args = ["check", "--locked", "--all-targets"]
[tasks.publish-dry]
description = "Dry-run crates.io publish"
command = "cargo"
args = ["publish", "--dry-run", "--allow-dirty"]
[tasks.hook-install]
description = "Install git pre-push hook that runs 'cargo make check'"
script_runner = "@duckscript"
script = '''
hook_dir = set ".git/hooks"
hook_file = set "${hook_dir}/pre-push"
mkdir ${hook_dir}
hook_content = set "#!/bin/sh\n# Installed by: cargo make hook-install\ncargo make check"
writefile ${hook_file} ${hook_content}
# chmod +x is needed on Unix; on Windows the exec bit is a no-op
# AND `chmod` may not be on PATH (it's only present when Git for
# Windows / busybox is wired into the shell). Skip silently if
# `chmod` isn't reachable so plain Windows shells don't fail this
# task with `program not found`.
chmod_path = which chmod
if not is_empty ${chmod_path}
exec chmod +x ${hook_file}
else
echo "chmod not on PATH; skipping exec-bit (no-op on Windows; on Unix this means the hook may not be executable)"
end
echo "Installed pre-push hook -> ${hook_file}"
'''
[tasks.apm-install]
description = "Install agent skills declared in apm.yml (Copilot / Claude / Gemini targets). Skipped silently when apm.yml or the apm CLI is absent."
script_runner = "@duckscript"
script = '''
exists = is_path_exists "apm.yml"
if not ${exists}
echo "no apm.yml; skipping apm-install"
exit 0
end
apm_path = which apm
if is_empty ${apm_path}
echo "apm CLI not on PATH; skipping apm-install (install via aka.ms/apm-unix or your platform's package manager)"
exit 0
end
exec apm install -t copilot,claude,gemini
'''
[tasks.apm-install-update]
description = "Refresh APM dependencies to upstream latest. Skipped when apm.yml/apm absent, or when apm.lock.yaml already records the current upstream renri HEAD (kicks in on every cargo make on-add after the first to keep worktree creation fast)."
script_runner = "@duckscript"
script = '''
exists = is_path_exists "apm.yml"
if not ${exists}
echo "no apm.yml; skipping apm-install-update"
exit 0
end
apm_path = which apm
if is_empty ${apm_path}
echo "apm CLI not on PATH; skipping apm-install-update (install via aka.ms/apm-unix or your platform's package manager)"
exit 0
end
# Fast-path: if apm.lock.yaml already records the current
# upstream HEAD of yukimemi/renri (the only APM dependency for
# yukimemi/* projects), don't re-run `apm install --update` —
# git ls-remote is ~100ms, an actual reinstall is several
# seconds. This makes `cargo make on-add` cheap on every
# `renri add` after the first.
lock_exists = is_path_exists "apm.lock.yaml"
if ${lock_exists}
ls_result = exec git ls-remote https://github.com/yukimemi/renri.git refs/heads/main
ls_ok = eq ${ls_result.code} 0
if ${ls_ok}
upstream_line = trim ${ls_result.stdout}
upstream_sha = substring ${upstream_line} 0 40
# Guard against empty / short upstream_sha. duckscript's
# `contains "haystack" ""` returns true (empty needle is
# always a substring), so without this check a successful-
# but-empty `git ls-remote` (deleted main ref, weird CI
# mirror, etc.) would incorrectly skip the install.
sha_len = length ${upstream_sha}
sha_valid = eq ${sha_len} 40
if ${sha_valid}
lock_body = readfile apm.lock.yaml
already_synced = contains ${lock_body} ${upstream_sha}
if ${already_synced}
echo "apm.lock.yaml already at upstream renri ${upstream_sha}; skipping apm install --update"
exit 0
end
end
end
end
exec apm install --update -t copilot,claude,gemini
'''
[tasks.setup]
description = "One-time setup for new contributors: pre-push hook + APM install"
dependencies = ["hook-install", "apm-install"]
[tasks.vcs-fetch]
description = "Fetch latest refs (jj when in a jj workspace, otherwise git)"
ignore_errors = true
script_runner = "@duckscript"
script = '''
# A non-colocated jj workspace has `.jj/` but no `.git/`, and `git fetch`
# fails there with "not a git repository". Prefer `jj git fetch`, which
# works in pure-jj and colocated repos. Fall back to `git fetch` for
# pure-git (no `.jj/`) worktrees.
jj_present = is_path_exists ".jj"
if ${jj_present}
exec jj git fetch
else
exec git fetch
end
'''
[tasks.on-add]
description = "Wired to renri's [[hooks.post_create]] — runs in a freshly created worktree"
dependencies = ["apm-install-update", "vcs-fetch"]
[tasks.vhs-build]
description = "Build the rvpm-vhs Docker image (~5 min first time, cached after)"
cwd = "vhs"
command = "docker"
args = ["build", "-t", "rvpm-vhs", "."]
[tasks.vhs-build.windows]
command = "wsl"
args = ["--", "docker", "build", "-t", "rvpm-vhs", "."]
[tasks.vhs-regen]
description = "Regenerate vhs/demo.gif (or another tape via `cargo make vhs-regen <tape>`)"
dependencies = ["vhs-build"]
cwd = "vhs"
command = "bash"
args = ["regen.sh", "${@}"]
[tasks.vhs-regen.windows]
command = "wsl"
args = ["--", "bash", "regen.sh", "${@}"]