2.8 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository purpose
Personal collection of self-use shell scripts (个人收藏的自用脚本). Each top-level directory is an independent script project — there is no shared build system, package manager, test suite, or CI. Editing happens on Windows; the scripts themselves are deployed and executed on Linux VPS targets.
Repo URL: https://git.suhang.me/suhang/scripts. Default branch is release (not main). When writing docs/READMEs that contain wget / curl one-liners to fetch a script onto a server, point them at this repo's raw URL on the release branch (e.g. https://git.suhang.me/suhang/scripts/raw/branch/release/singbox/singbox.sh) rather than upstream third-party URLs. This way users get the version actually maintained here.
Layout
singbox/singbox.sh— interactive Bash installer/manager for sing-box proxy nodes. ~5400 lines, single file, no external sourced files. Thesingbox/README.mddocuments user-facing usage and runtime dependencies (curl wget jq openssl tar cron+ systemd) — consult it before changing behavior described there.
When adding a new script, follow the same pattern: a top-level directory containing the script plus its own README.md.
Working with singbox/singbox.sh
- Entry points live at the bottom of the file:
main_menu(interactive, 21 options) andrun_option "$1"(non-interactive — currently only18for cron-driven cert renewal). Option numbers in the menu map directly to*_install/ management functions via thecaseblock around line ~5287. - State is on the target host, not in the repo. The script writes to
/usr/local/bin/sing-box,/usr/local/etc/sing-box/,/etc/ssl/private/,/etc/systemd/system/sing-box.service, and a weekly crontab entry. Any change that touches these paths needs to remain consistent with the uninstall path (uninstallfunction) and thesingbox/README.md"路径与文件" table. - No automated tests. Validation means running the script on a disposable Linux VM and exercising the affected menu option end-to-end. There is no lint config; match the existing Bash style (top-level
function name() { ... },${RED}/${CYAN}/${YELLOW}/${NC}color vars, Chinese user-facing prompts, English log lines). - The script assumes root + systemd + one of ufw/iptables/firewalld. Don't add dependencies without updating the dependency table in
singbox/README.md. - The "更新脚本" option (
Update_Script) pulls fromhttps://raw.githubusercontent.com/TinrLin/script_installation/main/Install.sh— this is the upstream, not this repo. Local edits will be overwritten if a user runs that option; mention this when relevant.