diff --git a/.cursor/check.sh b/.cursor/check.sh index 242d04c..71fcb4e 100755 --- a/.cursor/check.sh +++ b/.cursor/check.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Local mirror of the CI hygiene suite for melodic-software/.github. -# -# Runs the same lanes as .github/workflows/pr-require-checks.yml against the same vendored -# configs, using the tools .cursor/install.sh pins to the CI versions. Every -# lane runs even if an earlier one fails, and a summary is printed at the end so -# a single invocation reproduces the aggregate `ci-status` verdict locally -# (CONTRIBUTING step 3: "Ensure the project builds and its checks pass locally"). -# # Not set -e: lanes are collected, not short-circuited. Exit status is non-zero # when any gating lane fails. set -uo pipefail top="$(git rev-parse --show-toplevel)" && cd -- "$top" || exit 1 -# Fall back onto a per-user bin in case install.sh placed tools there. case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) PATH="$HOME/.local/bin:$PATH" ;; @@ -24,7 +15,6 @@ FAILED=() heading() { printf '\n\033[1m── %s ──\033[0m\n' "$1" >&2; } -# run_lane : run one lane under a heading and record its verdict. run_lane() { local name="$1" shift @@ -38,8 +28,6 @@ run_lane() { fi } -# --- Lanes with multi-step logic -------------------------------------------- - # typos skips hidden paths unless they are named. The synced _typos.toml # cannot set ignore-hidden = false; CI's typos job has the same follow-up. # Skip index entries that are gone from the worktree: an unstaged deletion is @@ -140,8 +128,6 @@ lane_issue_form_drift() { return "$rc" } -# --- Run every lane --------------------------------------------------------- - run_lane markdownlint lane_markdown run_lane typos lane_typos run_lane editorconfig-checker ec -config .editorconfig-checker.json @@ -158,8 +144,6 @@ lane_pr_section_drift || printf '\033[33m! check-pr-sections (advisory)\033[0m\n heading check-issue-forms lane_issue_form_drift || printf '\033[33m! check-issue-forms (advisory)\033[0m\n' >&2 -# --- Summary ---------------------------------------------------------------- - heading ci-status printf 'passed: %d failed: %d\n' "${#PASSED[@]}" "${#FAILED[@]}" >&2 if [[ ${#FAILED[@]} -gt 0 ]]; then diff --git a/.cursor/install-prefix.test.sh b/.cursor/install-prefix.test.sh index 758fb9f..125445d 100755 --- a/.cursor/install-prefix.test.sh +++ b/.cursor/install-prefix.test.sh @@ -1,7 +1,4 @@ #!/usr/bin/env bash -# Placement contract for .cursor/install.sh. -# -# Sources the resolver only. Does not download tools or write a prefix. set -euo pipefail here="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" @@ -50,7 +47,6 @@ assert_workstation() { } assert_system_unwritable() { - # Stand in for a /usr/local/bin the current user cannot write. prefix_is_writable() { return 1; } resolve_install_prefix if [[ "$BIN_DIR" != /usr/local/bin ]]; then diff --git a/.cursor/install.sh b/.cursor/install.sh index 609bdea..d53c840 100755 --- a/.cursor/install.sh +++ b/.cursor/install.sh @@ -1,25 +1,4 @@ #!/usr/bin/env bash -# Install the pinned hygiene toolchain for the melodic-software/.github repository. -# -# Two call sites: -# - Cloud Agent: .cursor/environment.json runs this with MELODIC_HYGIENE_SYSTEM=1 -# so tools land in /usr/local/bin, which is already on the agent shell PATH. -# - Developer machine: a direct run installs into ~/.local/bin and never uses -# sudo, even when passwordless sudo would succeed. .cursor/check.sh prepends -# ~/.local/bin to PATH. -# -# This repo ships only community-health files, so its "build" is the same -# lint/hygiene suite CI runs (see .github/workflows/pr-require-checks.yml). That suite is a set -# of standalone tools; this script installs each one pinned to the exact version -# the CI composite actions use (see Pins below), so a -# local run of .cursor/check.sh reproduces CI verdicts byte for byte. -# -# Idempotent and safe to re-run: every tool is skipped when the pinned version -# is already present, and each release asset is verified against the same -# SHA-256 the CI action pins before it is trusted (fail closed). -# -# Sourced by .cursor/install-prefix.test.sh. The installer runs only when this -# file is executed, not when it is sourced. set -euo pipefail # --- Pins (authority: melodic-software/ci-workflows v0.76.0 action defaults) -- @@ -42,7 +21,6 @@ CHECK_JSONSCHEMA_VERSION="0.38.2" # The default assignment keeps ShellCheck's check-unassigned-uppercase quiet. MELODIC_HYGIENE_SYSTEM="${MELODIC_HYGIENE_SYSTEM:-}" -# Set by resolve_install_prefix before any installer runs. BIN_DIR="" VENV_DIR="" # Command prefix kept as an array so an empty (no-sudo) value expands to nothing @@ -59,9 +37,6 @@ prefix_is_writable() { [[ -w "$1" ]] } -# resolve_install_prefix: set BIN_DIR, VENV_DIR, and SUDO. -# Workstation mode never consults sudo. System mode uses /usr/local/bin and -# passwordless sudo only when that prefix is not writable. resolve_install_prefix() { SUDO=() if [[ "$MELODIC_HYGIENE_SYSTEM" == 1 ]]; then @@ -85,9 +60,9 @@ resolve_install_prefix() { log "workstation mode; using $BIN_DIR (no files outside $HOME). Set MELODIC_HYGIENE_SYSTEM=1 to install into /usr/local/bin." } -# verify_sha : abort the whole install on mismatch. A hygiene -# toolchain that silently installed an unverified binary is worse than a hard -# failure the operator can see and re-run. +# Abort the whole install on mismatch: a hygiene toolchain that silently +# installed an unverified binary is worse than a hard failure the operator can +# see and re-run. verify_sha() { local file="$1" want="$2" got got="$(sha256sum "$file" | awk '{print $1}')" @@ -104,8 +79,6 @@ install_bin() { log "installed $name -> $BIN_DIR/$name" } -# ensure