- Add installation section with copy commands - Document each script with features, requirements, config examples - Add practical configuration examples for common use cases - Update CLAUDE.md with shared library documentation
1.3 KiB
1.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
just lint # run luacheck on scripts/
just fmt # format with stylua
just fmt-check # verify formatting without modifying
just check # fmt-check + lint (pre-commit gate)
Architecture
This repository holds Lua scripts for mpv (0.36+, bundled Lua 5.2).
Script structure convention:
- Header comment block explaining features, requirements, and configuration
configtable immediately after header with user-tunable options- Note indicating no edits are needed below the config block
- Implementation code
Shared Library
scripts/lib/utils.lua contains common utilities (trim, clamp, ASS color helpers). Scripts load it via:
package.path = mp.command_native({ "expand-path", "~~/scripts/lib/?.lua;" }) .. package.path
local lib = require("utils")
When adding new shared functions, prefer adding to this module over duplicating code.
Code Style
- 2-space indentation, 100-column width, double quotes preferred (enforced by stylua)
- Lua 5.2 std;
mpandmpvare allowed globals (luacheck config) - Run
styluathenluacheckbefore committing - Use Conventional Commits (
feat:,fix:,chore:, etc.)