diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9982969..fa74a83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: working-directory: /tmp/proto-smoke env: TARGETS: ${{ steps.targets.outputs.ids }} - run: bash ${{ github.workspace }}/scripts/smoke-test.sh $TARGETS + run: bash ${{ github.workspace }}/scripts/smoke-test.sh - name: Assemble site if: github.event_name == 'push' diff --git a/doc/new-plugin-instructions.md b/doc/new-plugin-instructions.md index 4d8c468..e654646 100644 --- a/doc/new-plugin-instructions.md +++ b/doc/new-plugin-instructions.md @@ -38,7 +38,7 @@ Given a URL (repo, homepage, or release page), determine: - `{tool}_{version}_linux_{arch}.tar.gz` with `darwin` for macOS — platform-literal - `{tool}-{arch}-unknown-linux-gnu.tar.gz` — Rust target triple - `v{version}.tar.gz` from `archive/refs/tags/` — source archive (no binary, library/script tools) - - Bare binary with no version in filename (e.g. `spectral-linux-x64`) — use `download-file` and `exe-path` with only `{arch}` + - Bare binary with no version in filename (e.g. `spectral-linux-x64`) — use `download-file` with `{arch}`, set `unpack = false`, omit `exe-path` 4. **Arch strings used** — check what arch labels appear in asset names (`amd64`, `arm64`, `x86_64`, `aarch64`, `x64`, `386`, `armv6`, etc.). 5. **Binary location inside archive** — does the binary sit at the archive root, or inside a subdirectory? If inside a subdirectory, note the path. If not an archive at all (bare binary), note that. 6. **Checksum file** — does the release include a checksums file? Note its name pattern. Many tools do not. @@ -88,7 +88,7 @@ Add one block **per OS that actually has release assets**. Never add a platform [platform.linux] download-file = "" checksum-file = "" # omit if no checksums published -exe-path = "" # omit if binary is at archive root with the tool name +exe-path = "" # omit if binary is at archive root with the tool name, or if bare binary (see below) [platform.macos] download-file = "" @@ -136,6 +136,17 @@ arm = "" # omit if tool does not ship arm32 Only include arch entries for architectures the tool actually ships. +For library/script tools with no executable, add to `[install]`: + +```toml +[install] +download-url = "..." +no-bin = true +no-shim = true +``` + +> **`no-bin` and `no-shim` must be under `[install]`, not at the root.** The root `Schema` struct has no such fields — placing them at the root is silently ignored, proto still attempts symlinks, and you get linker warnings on every install. + ### `[detect]` block (optional) Add only if the tool has a conventional version pin file: @@ -153,7 +164,9 @@ Before committing, verify: - [ ] Platform blocks exist **only** for OSes with actual release assets - [ ] `[install.arch]` values match the exact strings in release asset filenames -- [ ] `exe-path` is set if the binary is not at the archive root or is not named exactly `` (or `.exe` on Windows) +- [ ] `exe-path` is set only for **archive** plugins where the binary is not at the root or not named ``. **Never set `exe-path` for bare binaries** — proto renames the downloaded file to the tool name automatically; an `exe-path` override points to the pre-rename filename which no longer exists. +- [ ] Bare binary downloads use `unpack = false` in `[install]`, not `no-unpack = true` (which is silently ignored) +- [ ] Library/script plugins with no executable have `no-bin = true` and `no-shim = true` under `[install]`, not at the root (root placement is silently ignored) - [ ] `checksum-url` is present only if a checksums file is actually published - [ ] `git-tag-pattern` is set if tags are not standard `v1.2.3` / `1.2.3` - [ ] Comment header present @@ -196,8 +209,28 @@ The CI workflow does the following on every PR: ### Bare binary (no archive, no version in filename) -`spectral` style — assets named `tool-linux-x64` with no version embedded. Use `download-file` and `exe-path` with only `{arch}`. Proto marks the downloaded file executable automatically. +`spectral` style — assets named `tool-linux-x64` with no version embedded. Use `download-file` with `{arch}` and set `unpack = false` in `[install]`. **Do not set `exe-path`** — proto renames the downloaded file to the tool name automatically. Adding `exe-path` causes it to look for the original filename, which no longer exists. + +```toml +[platform.linux] +download-file = "tool-linux-{arch}" + +[install] +download-url = "https://github.com///releases/download/v{version}/{download_file}" +unpack = false +``` ### No binary (library/script archive) -`bats-assert` style — source archive from `archive/refs/tags/v{version}.tar.gz`. No `exe-path`. Use `archive-prefix` to normalize the extracted directory name. +`bats-assert` style — source archive from `archive/refs/tags/v{version}.tar.gz`. Use `archive-prefix` to normalize the extracted directory name. Set `no-bin = true` and `no-shim = true` under `[install]` (not at the root — root placement is silently ignored and causes linker warnings). + +```toml +[platform.linux] +archive-prefix = "tool-{version}" +download-file = "v{version}.tar.gz" + +[install] +download-url = "https://github.com///archive/refs/tags/{download_file}" +no-bin = true +no-shim = true +``` diff --git a/plugins/bats-assert.toml b/plugins/bats-assert.toml index ebdfe43..8fcb6ed 100644 --- a/plugins/bats-assert.toml +++ b/plugins/bats-assert.toml @@ -1,3 +1,10 @@ +# A TOML plugin for bats-assert: +# https://moonrepo.dev/docs/proto/plugins#toml-plugin +# https://github.com/bats-core/bats-assert +# +# bats-assert is a shell library sourced by bats tests — it has no executable binary. +# proto manages its version and install location; bats loads it via BATS_LIB_PATH. + name = "Bats Assert" type = "cli" description = "bats-assert provides assertion helpers (assert_success, assert_output, refute_output, etc.) for Bats" @@ -16,6 +23,8 @@ download-file = "v{version}.tar.gz" [install] download-url = "https://github.com/bats-core/bats-assert/archive/refs/tags/{download_file}" +no-bin = true +no-shim = true [resolve] git-url = "https://github.com/bats-core/bats-assert" diff --git a/plugins/bats-file.toml b/plugins/bats-file.toml index 62f1ead..af476ba 100644 --- a/plugins/bats-file.toml +++ b/plugins/bats-file.toml @@ -1,6 +1,13 @@ +# A TOML plugin for bats-file: +# https://moonrepo.dev/docs/proto/plugins#toml-plugin +# https://github.com/bats-core/bats-file +# +# bats-file is a shell library sourced by bats tests — it has no executable binary. +# proto manages its version and install location; bats loads it via BATS_LIB_PATH. + name = "Bats File" type = "cli" -description = "bats-file provides filesystem assertion helpers (assert_file_exists, assert_symlink_to, assert_dir_exists, etc.) for Bats" +description = "bats-file provides file-system assertion helpers for Bats" [platform.linux] archive-prefix = "bats-file-{version}" @@ -16,6 +23,8 @@ download-file = "v{version}.tar.gz" [install] download-url = "https://github.com/bats-core/bats-file/archive/refs/tags/{download_file}" +no-bin = true +no-shim = true [resolve] git-url = "https://github.com/bats-core/bats-file" diff --git a/plugins/bats-support.toml b/plugins/bats-support.toml index 90f3483..3082cbc 100644 --- a/plugins/bats-support.toml +++ b/plugins/bats-support.toml @@ -1,6 +1,13 @@ +# A TOML plugin for bats-support: +# https://moonrepo.dev/docs/proto/plugins#toml-plugin +# https://github.com/bats-core/bats-support +# +# bats-support is a shell library sourced by bats tests — it has no executable binary. +# proto manages its version and install location; bats loads it via BATS_LIB_PATH. + name = "Bats Support" type = "cli" -description = "bats-support provides the output/error formatting library that bats-assert and bats-file build on" +description = "bats-support provides output formatting and helper functions for Bats test plugins" [platform.linux] archive-prefix = "bats-support-{version}" @@ -16,6 +23,8 @@ download-file = "v{version}.tar.gz" [install] download-url = "https://github.com/bats-core/bats-support/archive/refs/tags/{download_file}" +no-bin = true +no-shim = true [resolve] git-url = "https://github.com/bats-core/bats-support" diff --git a/plugins/spectral.toml b/plugins/spectral.toml index c3121d2..d0a6214 100644 --- a/plugins/spectral.toml +++ b/plugins/spectral.toml @@ -8,18 +8,16 @@ description = "OpenAPI, AsyncAPI, and Arazzo linter and validation CLI by Stopli [platform.linux] download-file = "spectral-linux-{arch}" -exe-path = "spectral-linux-{arch}" [platform.macos] download-file = "spectral-macos-{arch}" -exe-path = "spectral-macos-{arch}" [platform.windows] download-file = "spectral.exe" -exe-path = "spectral.exe" [install] download-url = "https://github.com/stoplightio/spectral/releases/download/v{version}/{download_file}" +unpack = false [install.arch] aarch64 = "arm64" diff --git a/plugins/tuckr.toml b/plugins/tuckr.toml deleted file mode 100644 index 0f04efb..0000000 --- a/plugins/tuckr.toml +++ /dev/null @@ -1,22 +0,0 @@ -# A TOML plugin for tuckr: -# https://moonrepo.dev/docs/proto/plugins#toml-plugin -# https://github.com/RaphGL/Tuckr - -name = "tuckr" -type = "cli" -description = "Dotfile manager inspired by GNU Stow" - -[platform.linux] -download-file = "tuckr-{arch}-linux" - -[platform.windows] -download-file = "tuckr-{arch}-windows.exe" - -[install] -download-url = "https://github.com/RaphGL/Tuckr/releases/download/{version}/{download_file}" - -[install.arch] -x86_64 = "x86_64" - -[resolve] -git-url = "https://github.com/RaphGL/Tuckr" diff --git a/scripts/smoke-install.sh b/scripts/smoke-install.sh index 2750c6b..3cfa7f0 100755 --- a/scripts/smoke-install.sh +++ b/scripts/smoke-install.sh @@ -7,4 +7,4 @@ cp .prototools.test /tmp/proto-smoke/.prototools cd /tmp/proto-smoke cat .prototools proto install -y -proto status +proto status --json diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index 0195e3b..38aa898 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -1,36 +1,54 @@ #!/usr/bin/env bash # Usage: -# ./scripts/smoke-test.sh # test all plugins -# ./scripts/smoke-test.sh taplo # test one plugin -# ./scripts/smoke-test.sh taplo gh # test multiple plugins -# ./scripts/smoke-test.sh $CHANGED # from an env var -# bash scripts/smoke-test.sh ${{ steps.targets.outputs.ids }} # from CI step output +# ./scripts/smoke-test.sh # test all plugins +# ./scripts/smoke-test.sh taplo # test one plugin +# ./scripts/smoke-test.sh taplo gh # test multiple plugins +# TARGETS="taplo gh" ./scripts/smoke-test.sh # via env var (CI-friendly) # -# Expects to run from the repo root with proto on PATH. +# Expects proto on PATH. Can be run from any working directory. set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + fail() { echo " FAIL: $*" exit 1 } +# Arg priority: positional args > TARGETS env var > all plugins if [ $# -gt 0 ]; then targets="$*" +elif [ -n "${TARGETS:-}" ]; then + targets="$TARGETS" else - targets=$(for p in plugins/*; do + targets=$(for p in "$REPO_ROOT/plugins/"*; do [ -f "$p" ] || continue name="${p##*/}" printf '%s\n' "${name%.*}" done) fi -while IFS= read -r id; do +for id in $targets; do [ -z "$id" ] && continue + # Locate plugin file relative to repo root, not cwd + plugin_file="" + for ext in toml yaml yml; do + candidate="$REPO_ROOT/plugins/$id.$ext" + [ -f "$candidate" ] && plugin_file="$candidate" && break + done + + # Skip library tools that have no binary + if [ -n "$plugin_file" ] && grep -qF 'no-bin = true' "$plugin_file"; then + echo "--- $id (skipped: no-bin) ---" + continue + fi + echo "--- $id ---" - bin=$(proto locate "$id") || - fail "proto locate exited non-zero" + bin=$(proto bin "$id") || + fail "proto bin exited non-zero" [[ $bin == *"/.proto/tools/$id/"* ]] || fail "resolved outside .proto/tools: $bin" @@ -40,4 +58,4 @@ while IFS= read -r id; do echo " OK: $bin" -done <<< "$targets" +done