Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
sh 34 lines 715 Bytes
Raw
1 #!/usr/bin/env bash
2
3 set -euo pipefail
4
5 tool="${1:?usage: read-mise-lock-version.sh <tool> [mise.lock]}"
6 lock_file="${2:-${GITHUB_WORKSPACE:-$(pwd)}/mise.lock}"
7
8 case "$tool" in
9 pnpm) section='[[tools."npm:pnpm"]]' ;;
10 node|bun|python|uv) section="[[tools.$tool]]" ;;
11 *)
12 echo "Unsupported mise tool: $tool" >&2
13 exit 1
14 ;;
15 esac
16
17 version=$(awk -v section="$section" '
18 $0 == section { found = 1; next }
19 found && /^version = "/ {
20 value = $0
21 sub(/^version = "/, "", value)
22 sub(/"$/, "", value)
23 print value
24 exit
25 }
26 found && /^\[\[/ { exit }
27 ' "$lock_file")
28
29 if [[ -z "$version" ]]; then
30 echo "Could not resolve $tool from $lock_file" >&2
31 exit 1
32 fi
33
34 printf '%s\n' "$version"