- Shell 100%
| .forgejo/workflows | ||
| .zed | ||
| lib | ||
| tests | ||
| chmod-scripts.sh | ||
| compliance.sh | ||
| docker-check.sh | ||
| LICENSE | ||
| new-project.sh | ||
| README.md | ||
| run-all-checks.sh | ||
| run-tests.sh | ||
| safe-agent.json | ||
| shellcheck.sh | ||
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.ymland.forgejo/workflows/deploy.yml.zed/settings.jsonwith 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 --fixandcargo 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:
- chmod-scripts -- makes all
.shfiles executable - sync-submodules -- updates the
scriptssubmodule in sibling repos - tests -- runs unit tests for all lib module functions
- shellcheck -- shellcheck + bash syntax on all
.shfiles - compliance -- cargo checks, comment checks, formatters
- 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 |