This file provides guidance to AI coding agents when working with code in this repository.
This is a collection of standalone utility scripts (Python and Bash) for common development and system administration tasks. Scripts are designed to be self-contained and executable directly from the repository directory or from the PATH.
All scripts in this repository follow a tag-based documentation format at the top of each file:
# BRIEF: <one-line-summary>
# DESC: <optional-longer-explanation>
# DESC: <continuation-lines-repeat-the-tag>
# USAGE: <optional-usage-examples>
# DEPS: <optional-external-dependencies>Key Rules:
- BRIEF is required (< 80 chars)
- DESC, USAGE, DEPS are optional
- Multi-line tags repeat the prefix on each line
- Placement: Within first ~10 lines, after shebang and any embedded metadata
- Use imperative mood: "Print paths" not "Prints paths"
See docs/documentation.md for complete guidelines.
Many Python scripts use uv as a script runner with embedded dependencies:
#!/usr/bin/env -S uv run --quiet --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "click",
# "rich",
# ]
# ///
# BRIEF: Script description hereThis allows scripts to be standalone with their dependencies specified inline. The uv tool handles creating isolated environments and installing packages automatically.
Python Click Scripts:
- When using Click, enable
-has a help option alias by addingcontext_settings={"help_option_names": ["-h", "--help"]}to the command/group decorator
Bash scripts do not state the path to bash directly:
#!/usr/bin/env bash
# BRIEF: Script description hereStructure:
src/contains all executable scriptssrc/ARCHIVE/contains old/deprecated scripts (excluded from normal operations)docs/contains documentation- No build system - scripts are run directly
Generated files (do not edit by hand):
- The "Contents" section of
README.mdis generated by cog from the scripts' BRIEF tags - regenerate withmise run docs manifest.jsonlists all scripts with their type - regenerate withmise run generate-manifest
Maintenance is driven by mise (see mise.toml):
mise run lint-all # shellcheck + ruff check + ruff format --check
mise run sh-lint # shellcheck on bash scripts
mise run python-lint # ruff check on Python scripts
mise run python-format # ruff format on Python scripts
mise run python-fix # ruff check --fix on Python scripts
mise run docs # regenerate README.md contents with cog
mise run generate-manifest # regenerate manifest.jsonAfter adding or modifying a script, run mise run lint-all. After adding a script or changing a BRIEF tag, also run mise run generate-manifest and mise run docs.
Scripts are executed directly:
./src/script-name [args]For Python scripts using uv, the first run will install dependencies. Subsequent runs use cached environments.
When creating a new script:
- Make it executable:
chmod +x script-name - Add appropriate shebang:
- Bash:
#!/usr/bin/env bash - Python with uv:
#!/usr/bin/env -S uv run --quiet --script
- Bash:
- Add documentation tags (BRIEF at minimum)
- For Python scripts with dependencies, use uv PEP 723 inline metadata
- Place in
src/(not in further subdirectories) - Validate docs (
./src/script-docs dump --strict src/script-name), lint (mise run lint-all), and regeneratemanifest.jsonandREADME.md(mise run generate-manifest && mise run docs)
The script-docs tool extracts and validates documentation from scripts:
The tool takes file paths, not bare script names.
Validate documentation:
./src/script-docs dump --strict src/script-nameExtract documentation in various formats:
# JSON (array format)
./src/script-docs dump src/script-name [src/script-name2 ...]
# Markdown (raw)
./src/script-docs dump --format markdown src/script-name
# Rich (rendered in terminal)
./src/script-docs dump --format rich src/script-name
# README format (brief list)
./src/script-docs dump --format readme src/*Common validation issues:
- Missing BRIEF tag (required)
- Missing shebang (files without
#!are skipped) - Non-script files are automatically filtered out
Use --strict mode when adding or modifying scripts to ensure documentation is complete.
Critical: When modifying scripts, preserve all existing code including:
__description__variables in Python scripts- Docstrings and inline comments
- Function implementations
- Any existing functionality
Only update documentation headers, never remove working code during documentation updates.