scripts I use to manage my repos
Find a file
2026-06-04 17:10:26 +00:00
.forgejo/workflows fix: First batch of fixes from review 2026-05-27 23:36:36 -04:00
.zed fix: Finish fixing scripts 2026-05-27 23:12:09 -04:00
lib fix: Fix verbose 2026-06-04 13:09:13 -04:00
tests fix: Fix submodules manually 2026-05-28 14:13:33 -04:00
chmod-scripts.sh fix: Fix stuff 2026-05-27 20:32:59 -04:00
compliance.sh fix: Fix compliance.sh not failing 2026-06-02 17:11:21 -04:00
docker-check.sh change file include syntax 2026-05-27 23:57:36 -04:00
LICENSE chore: Add license back 2026-05-28 14:17:34 -04:00
new-project.sh fix: Fix submodules manually 2026-05-28 14:13:33 -04:00
README.md fix: Fix tests running in ci elsewhere where it doesnt need to be 2026-06-01 16:58:51 -04:00
run-all-checks.sh fix: Fix tests running in ci elsewhere where it doesnt need to be 2026-06-01 16:58:51 -04:00
run-tests.sh change file include syntax 2026-05-27 23:57:36 -04:00
safe-agent.json fix: lgtm 2026-05-27 23:49:15 -04:00
shellcheck.sh change file include syntax 2026-05-27 23:57:36 -04:00

Scripts

Scripts used across all projects in this workspace. Includes compliance checkers, CI workflows, Docker utilities, and project scaffolding.

New Project Quick Start

The fastest way to create a new project is:

./scripts/new-project.sh my-project-name

This automates all the steps below. What it does:

1. Make scripts executable

./scripts/chmod-scripts.sh

Makes all .sh files in the workspace executable -- both in this repo and in sibling projects.

2. Clone the template repo

The script clones askama-template from Forgejo into a new directory. This template provides:

  • A Rust web server using Askama + Axum + HTMX
  • .forgejo/workflows/ci.yml and .forgejo/workflows/deploy.yml
  • .zed/settings.json with agent and formatter config
  • Build scripts for Docker, TOML, and template formatting

After cloning, the old git history is removed and a fresh repo is initialized.

3. Push to Forgejo

The script renames the project in Cargo.toml, adds the scripts submodule (pointing to this scripts repo), commits everything, and pushes to https://git.ohcooltools.dev/Ohcool-Media/<project-name>.

4. Zed agent configuration

The Safe agent profile is shared across all projects via scripts/safe-agent.json. It uses DeepSeek V4 Flash with thinking enabled and grants most agent tools while denying fetch and terminal for safety.

To apply it, copy the agent block from scripts/safe-agent.json into your global Zed config at ~/.config/zed/settings.json. The agent profile only works in the global config, not per-project.

Open the project in Zed and the agent is ready to use.

5. Set up DeepSeek API key

For DeepSeek-powered features (caption generation, image description, etc.):

cd ../my-project-name
# Add to .env.dev:
echo "DEEPSEEK_API_KEY=sk-your-key-here" >> .env.dev

Get a key from https://platform.deepseek.com/api_keys.

6. Deploy the project

The template includes a Dockerfile and docker-compose.yml. To deploy:

cd ../my-project-name
docker compose up -d --build

On push to main, Forgejo CI automatically runs the deploy workflow.

On Forgejo, add a PROJECT_NAME secret in the repo Settings > Actions > Secrets for the deploy workflow to use.

Running checks

Shell check

./scripts/shellcheck.sh

Runs shellcheck and bash syntax validation on all .sh files across every project -- root-level scripts, lib/, scripts/, and the scripts submodule. Skips if shellcheck is not installed.

Compliance

./scripts/compliance.sh

Checks all projects that have a Cargo.toml (Rust projects). Runs:

  • cargo clippy --fix and cargo fmt (auto-fix)
  • cargo fmt --check, cargo clippy, cargo test, cargo udeps
  • Comment stripping and validation
  • Formatter detection (prettier, tombi, dockerfmt, sql-formatter scripts)

The scripts repo itself is always included in the scan. Non-Rust repos skip cargo checks. All checks are auto-included from the scripts submodule -- no per-project configuration needed.

Docker

./scripts/docker-check.sh "my-project-name"

Builds, starts, inspects, then tears down the Docker Compose stack. Always shuts down what it started, even if a step fails.

All checks together

./scripts/run-all-checks.sh

Runs six steps in sequence:

  1. chmod-scripts -- makes all .sh files executable
  2. sync-submodules -- updates the scripts submodule in sibling repos
  3. tests -- runs unit tests for all lib module functions
  4. shellcheck -- shellcheck + bash syntax on all .sh files
  5. compliance -- cargo checks, comment checks, formatters
  6. docker-check -- docker compose build, up, ps, down

Use as a pre-push gate. On failure, a log file is written to the workspace root (run-all-checks.log).

File reference

Path Purpose
scripts/new-project.sh Scaffold a new project from template and push
scripts/dry-run-new-project.sh Preview new-project.sh without making changes
scripts/chmod-scripts.sh Make all scripts executable in workspace
scripts/shellcheck.sh Shellcheck and bash syntax checks on all .sh files
scripts/compliance.sh Rust compliance, formatting, comment checks
scripts/docker-check.sh Docker compose build, up, ps, down
scripts/run-tests.sh Run all test suites independently
scripts/run-all-checks.sh chmod, sync-submodules, tests, shellcheck, compliance, docker in sequence
scripts/tests/test-common.sh Unit tests for lib/common.sh
scripts/tests/test-comments.sh Unit tests for lib/comments.sh
scripts/tests/test-shell.sh Unit tests for lib/shell.sh
scripts/tests/test-comment-check.sh Integration test for comment detection
scripts/lib/colors.sh Terminal color output helpers
scripts/lib/common.sh Workspace discovery, run_in, argument parsing
scripts/lib/rust.sh Cargo fix, fmt, clippy, test, udeps wrappers
scripts/lib/shell.sh Shellcheck and bash syntax check functions
scripts/lib/formatters.sh Prettier, Toml, Docker, SQL formatter wrappers
scripts/lib/comments.sh Comment stripping and detection per file type
scripts/lib/docker.sh Docker compose lifecycle wrappers