@maudecode/cowtail-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -0
- package/dist/cowtail.js +18440 -0
- package/docs/config.example.json +5 -0
- package/install.sh +58 -0
- package/package.json +41 -0
package/install.sh
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
REPO="MaudeCode/cowtail"
|
|
5
|
+
VERSION="${COWTAIL_VERSION:-${1:-}}"
|
|
6
|
+
|
|
7
|
+
if [ -z "$VERSION" ]; then
|
|
8
|
+
VERSION="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | sed -n 's/.*"tag_name": "\(v[^"]*\)".*/\1/p' | head -n 1)"
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [ -z "$VERSION" ]; then
|
|
12
|
+
echo "Failed to resolve a release version" >&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
case "$(uname -s)" in
|
|
17
|
+
Darwin) os="darwin" ;;
|
|
18
|
+
Linux) os="linux" ;;
|
|
19
|
+
*)
|
|
20
|
+
echo "Unsupported operating system: $(uname -s)" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
case "$(uname -m)" in
|
|
26
|
+
arm64|aarch64) arch="arm64" ;;
|
|
27
|
+
x86_64|amd64) arch="x64" ;;
|
|
28
|
+
*)
|
|
29
|
+
echo "Unsupported architecture: $(uname -m)" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
;;
|
|
32
|
+
esac
|
|
33
|
+
|
|
34
|
+
asset="cowtail-${os}-${arch}.tar.gz"
|
|
35
|
+
url="https://github.com/${REPO}/releases/download/${VERSION}/${asset}"
|
|
36
|
+
install_dir="${INSTALL_DIR:-$HOME/.local/bin}"
|
|
37
|
+
|
|
38
|
+
if [ -z "${INSTALL_DIR:-}" ] && [ -d /usr/local/bin ] && [ -w /usr/local/bin ]; then
|
|
39
|
+
install_dir="/usr/local/bin"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
tmpdir="$(mktemp -d)"
|
|
43
|
+
trap 'rm -rf "$tmpdir"' EXIT INT TERM
|
|
44
|
+
|
|
45
|
+
curl -fL "$url" -o "$tmpdir/$asset"
|
|
46
|
+
tar -xzf "$tmpdir/$asset" -C "$tmpdir"
|
|
47
|
+
|
|
48
|
+
mkdir -p "$install_dir"
|
|
49
|
+
install -m 0755 "$tmpdir/cowtail" "$install_dir/cowtail"
|
|
50
|
+
|
|
51
|
+
echo "Installed cowtail ${VERSION} to ${install_dir}/cowtail"
|
|
52
|
+
|
|
53
|
+
case ":$PATH:" in
|
|
54
|
+
*":$install_dir:"*) ;;
|
|
55
|
+
*)
|
|
56
|
+
echo "Add ${install_dir} to your PATH to run 'cowtail' directly."
|
|
57
|
+
;;
|
|
58
|
+
esac
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maudecode/cowtail-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Cowtail CLI",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/MaudeCode/cowtail.git",
|
|
9
|
+
"directory": "cli"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/cowtail.js",
|
|
12
|
+
"bin": {
|
|
13
|
+
"cowtail": "./dist/cowtail.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"docs/config.example.json",
|
|
19
|
+
"install.sh"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "bun run src/cli.ts",
|
|
26
|
+
"build": "bun build ./src/cli.ts --compile --outfile ./dist/cowtail --env='COWTAIL_*'",
|
|
27
|
+
"build:js": "bun build ./src/cli.ts --target=node --outfile ./dist/cowtail.js --env='COWTAIL_*'",
|
|
28
|
+
"build:npm": "rm -rf dist && bun run build:js && chmod +x ./dist/cowtail.js",
|
|
29
|
+
"check": "tsc --noEmit",
|
|
30
|
+
"test": "bun test"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@maudecode/cowtail-protocol": "file:../protocol",
|
|
37
|
+
"@types/node": "^24.7.2",
|
|
38
|
+
"clipanion": "^4.0.0-rc.4",
|
|
39
|
+
"typescript": "^5.9.3"
|
|
40
|
+
}
|
|
41
|
+
}
|