Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
43 changes: 38 additions & 5 deletions doc/new-plugin-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -88,7 +88,7 @@ Add one block **per OS that actually has release assets**. Never add a platform
[platform.linux]
download-file = "<asset name with {version} and/or {arch} placeholders>"
checksum-file = "<checksum asset name>" # omit if no checksums published
exe-path = "<path/to/binary>" # omit if binary is at archive root with the tool name
exe-path = "<path/to/binary>" # omit if binary is at archive root with the tool name, or if bare binary (see below)

[platform.macos]
download-file = "<asset name>"
Expand Down Expand Up @@ -136,6 +136,17 @@ arm = "<arch string used in asset names>" # 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:
Expand All @@ -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 `<id>` (or `<id>.exe` on Windows)
- [ ] `exe-path` is set only for **archive** plugins where the binary is not at the root or not named `<id>`. **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
Expand Down Expand Up @@ -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/<owner>/<repo>/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/<owner>/<repo>/archive/refs/tags/{download_file}"
no-bin = true
no-shim = true
```
9 changes: 9 additions & 0 deletions plugins/bats-assert.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
11 changes: 10 additions & 1 deletion plugins/bats-file.toml
Original file line number Diff line number Diff line change
@@ -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}"
Expand All @@ -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"
11 changes: 10 additions & 1 deletion plugins/bats-support.toml
Original file line number Diff line number Diff line change
@@ -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}"
Expand All @@ -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"
4 changes: 1 addition & 3 deletions plugins/spectral.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 0 additions & 22 deletions plugins/tuckr.toml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/smoke-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 29 additions & 11 deletions scripts/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -40,4 +58,4 @@ while IFS= read -r id; do

echo " OK: $bin"

done <<< "$targets"
done
Loading