-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #24
Changes from all commits
b07029d
0567f41
66c042a
2ed1646
3223172
b1d07ed
02be692
4cd5333
3186032
5add82e
bc82dd6
e489240
38bb694
f22e7cf
16c7442
a6f2584
38c7e31
dc75542
86c249c
2a5b66b
256ab5f
97ab694
7fb5a60
87e1181
bd4a1dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| data/ | ||
| awesomeProject | ||
| .gocache | ||
| .vercel |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .git | ||
| .gocache | ||
| .idea | ||
| data | ||
| awesomeProject |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| module awesomeProject | ||
| module github.com/blackdragoon26/Do-It | ||
|
|
||
| go 1.26 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| #!/usr/bin/env sh | ||
| set -eu | ||
|
|
||
| repo="blackdragoon26/Do-It" | ||
| install_dir="${DOIT_INSTALL_DIR:-$HOME/.local/bin}" | ||
| version="${DOIT_VERSION:-latest}" | ||
|
|
||
| os="$(uname -s | tr '[:upper:]' '[:lower:]')" | ||
| arch="$(uname -m)" | ||
|
|
||
| case "$arch" in | ||
| x86_64|amd64) arch="amd64" ;; | ||
| arm64|aarch64) arch="arm64" ;; | ||
| *) echo "unsupported architecture: $arch" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| case "$os" in | ||
| linux|darwin) archive_ext="tar.gz" ;; | ||
| *) echo "unsupported OS: $os" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| if [ "$version" = "latest" ]; then | ||
| base_url="https://github.com/$repo/releases/latest/download" | ||
| else | ||
| base_url="https://github.com/$repo/releases/download/$version" | ||
| fi | ||
|
|
||
| archive="Do-It_${os}_${arch}.${archive_ext}" | ||
| tmp_dir="$(mktemp -d 2>/dev/null || mktemp -d "${TMPDIR:-/tmp}/doit.XXXXXX")" | ||
| trap 'rm -rf "$tmp_dir"' EXIT INT TERM | ||
|
|
||
| download() { | ||
| url="$1" | ||
| output="$2" | ||
| if command -v curl >/dev/null 2>&1; then | ||
| curl -fsSL "$url" -o "$output" | ||
| return | ||
| fi | ||
| if command -v wget >/dev/null 2>&1; then | ||
| wget -qO "$output" "$url" | ||
| return | ||
| fi | ||
| echo "curl or wget is required" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| download_optional() { | ||
| url="$1" | ||
| output="$2" | ||
| if command -v curl >/dev/null 2>&1; then | ||
| curl -fsSL "$url" -o "$output" >/dev/null 2>&1 && return 0 | ||
| return 1 | ||
| fi | ||
| if command -v wget >/dev/null 2>&1; then | ||
| wget -qO "$output" "$url" >/dev/null 2>&1 && return 0 | ||
| return 1 | ||
| fi | ||
| echo "curl or wget is required" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| verify_checksum() { | ||
| archive_path="$1" | ||
| checksums_path="$2" | ||
| archive_name="$(basename "$archive_path")" | ||
| expected="$(awk -v name="$archive_name" '$2 == name { print $1; found = 1 } END { if (!found) exit 1 }' "$checksums_path")" || { | ||
| echo "checksum for $archive_name not found" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| if command -v sha256sum >/dev/null 2>&1; then | ||
| printf '%s %s\n' "$expected" "$archive_path" | sha256sum -c - | ||
| return | ||
| fi | ||
| if command -v shasum >/dev/null 2>&1; then | ||
| actual="$(shasum -a 256 "$archive_path" | awk '{ print $1 }')" | ||
| if [ "$actual" = "$expected" ]; then | ||
| return | ||
| fi | ||
| echo "$archive_name checksum mismatch" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "sha256sum or shasum is required to verify downloads" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| download "$base_url/$archive" "$tmp_dir/$archive" | ||
| if download_optional "$base_url/checksums.txt" "$tmp_dir/checksums.txt"; then | ||
| verify_checksum "$tmp_dir/$archive" "$tmp_dir/checksums.txt" | ||
| else | ||
| echo "checksums.txt not found for this release; installing without checksum verification" >&2 | ||
| fi | ||
|
Comment on lines
+88
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== scripts/install.sh ==\n'
ast-grep outline scripts/install.sh --view expanded || true
printf '\n\n-- relevant lines --\n'
sed -n '1,140p' scripts/install.sh
printf '\n== release config candidates ==\n'
git ls-files | rg '(^|/)(\.goreleaser(\.ya?ml)?|goreleaser(\.ya?ml)?|release).*'
printf '\n== search for checksums.txt and DOIT_VERSION ==\n'
rg -n 'checksums\.txt|DOIT_VERSION|download_optional|verify_checksum' -S .Repository: blackdragoon26/Do-It Length of output: 3552 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== .goreleaser.yaml ==\n'
wc -l .goreleaser.yaml
sed -n '1,220p' .goreleaser.yaml
printf '\n== release workflow ==\n'
wc -l .github/workflows/release.yml
sed -n '1,220p' .github/workflows/release.yml
printf '\n== docs mention install script ==\n'
rg -n 'scripts/install\.sh|DOIT_VERSION|checksums\.txt|goreleaser' README.md .github . -g '!scripts/install.sh'Repository: blackdragoon26/Do-It Length of output: 3185 Fail closed when 🤖 Prompt for AI Agents |
||
| tar -xzf "$tmp_dir/$archive" -C "$tmp_dir" | ||
|
|
||
| mkdir -p "$install_dir" | ||
| install "$tmp_dir/doit" "$install_dir/doit" | ||
|
|
||
| echo "Installed doit to $install_dir/doit" | ||
| echo "Run: $install_dir/doit" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: blackdragoon26/Do-It
Length of output: 3633
🏁 Script executed:
Repository: blackdragoon26/Do-It
Length of output: 4034
🏁 Script executed:
Repository: blackdragoon26/Do-It
Length of output: 2869
🏁 Script executed:
Repository: blackdragoon26/Do-It
Length of output: 194
🏁 Script executed:
Repository: blackdragoon26/Do-It
Length of output: 1963
download_optionaltreats every fetch error as “checksums missing.”scripts/install.sh:47-52,88-91A transient curl/wget failure now falls back to an unverified install; only skip verification for a real 404 and fail closed on transport/TLS/DNS errors.
🤖 Prompt for AI Agents