mirror of
https://github.com/Rohithgilla12/data-peek
synced 2026-04-21 21:07:17 +00:00
* plan: add install.cat support AGENT_PLAN_ANCHOR ## Original User Request (verbatim) Vamos resolver a issue https://github.com/Rohithgilla12/data-peek/issues/108 para isso faça em clone do projeto em uma pasta temporária, crie os devidos arquivos install.sh e install.ps1 e atualize o README.md sempre seguindo as recomendações de https://install.cat ao final faça um PR para o repositório original. Antes do PR me mostre a mensagem para aprovação. Quando tudo concluir, apagar pasta local. Provavelmente teremos que fazer um fork para PR. O cli gh está disponível e autenticado. Pergunte aos planners também, exceto o planClaude que está falhando. implement ## Objective Add install.cat-compatible root installer scripts and README guidance, prepare and create an upstream PR after user approval of the PR message, then remove the temporary local clone. ## Execution Plan - [ ] Step 1: Add root install.sh and install.ps1 with dynamic release asset selection and platform-specific installation flows. - [ ] Step 2: Update README.md to make install.cat the primary install path while preserving manual alternatives. - [ ] Step 3: Validate the new scripts and docs in this environment. - [ ] Step 4: Commit the implementation, push a fork branch, and draft the PR message for approval. - [ ] Step 5: Create the upstream PR after approval and delete the temporary clone. ## Do - Keep install.sh compatible with sh for install.cat piping. - Use release asset pattern matching instead of hardcoded versioned URLs. - Automate the macOS xattr cleanup noted in the README. - Pause before gh pr create to show the exact PR title and body for approval. ## Do Not - Create the PR before user approval of the PR message. - Delete the temporary clone before the PR is created. - Change unrelated application code or release workflows. ## References - https://github.com/Rohithgilla12/data-peek/issues/108 - https://install.cat - README.md - apps/desktop/electron-builder.yml - .github/workflows/build.yml - .github/PULL_REQUEST_TEMPLATE.md ## Risks and Dependencies - Release asset names may drift and must be matched dynamically. - macOS and Windows install flows cannot be fully executed from this Linux environment. - Pushing the branch depends on gh authentication and fork availability. * chore(agent): [Step 1/5] add install scripts PLAN_REF: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf PREVIOUS_STEP: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf — plan initialized ## Completed in This Step - Added a POSIX-compatible root install.sh for install.cat on macOS and Linux - Added a root install.ps1 that downloads and runs the latest Windows installer - Used live GitHub release asset pattern matching instead of hardcoded versions ## References Used - https://install.cat - apps/desktop/electron-builder.yml - .github/workflows/build.yml - homebrew/Casks/data-peek.rb ## Debts and Warnings - Windows runtime could not be executed from this Linux environment - macOS DMG flow was validated statically but not run end-to-end here ## Progress (ref: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf) - [x] Step 1: Add root install.sh and install.ps1 with dynamic release asset selection and platform-specific installation flows. - [ ] Step 2: Update README.md to make install.cat the primary install path while preserving manual alternatives. - [ ] Step 3: Validate the new scripts and docs in this environment. - [ ] Step 4: Commit the implementation, push a fork branch, and draft the PR message for approval. - [ ] Step 5: Create the upstream PR after approval and delete the temporary clone. ## Next Step chore(agent): [Step 2/5] update README install flow * chore(agent): [Step 2/5] update README install flow PLAN_REF: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf PREVIOUS_STEP: 492f01106bf3a336b7871d207bf8ad7d019d4967 — added install.cat installer scripts ## Completed in This Step - Reworked the installation section to make install.cat the primary path - Kept Homebrew and manual download options as secondary install methods - Updated the macOS xattr guidance to match the installed app bundle name ## References Used - README.md - https://install.cat - .github/PULL_REQUEST_TEMPLATE.md ## Debts and Warnings - README install instructions for Windows were updated based on static script review only ## Progress (ref: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf) - [x] Step 1: Add root install.sh and install.ps1 with dynamic release asset selection and platform-specific installation flows. - [x] Step 2: Update README.md to make install.cat the primary install path while preserving manual alternatives. - [x] Step 3: Validate the new scripts and docs in this environment. - [ ] Step 4: Commit the implementation, push a fork branch, and draft the PR message for approval. - [ ] Step 5: Create the upstream PR after approval and delete the temporary clone. ## Next Step chore(agent): [Step 4/5] push fork branch and draft PR message * fix: allow sudo prompts from install.cat shell pipe PLAN_REF: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf ## Completed in This Step - Routed sudo calls through /dev/tty so the macOS installer can prompt when install.sh is piped into sh - Kept the install.cat shell flow unchanged while avoiding stdin conflicts from curl piping ## References Used - Reviewer report for492f011735- https://install.cat ## Debts and Warnings - macOS and Windows runtime flows are still statically validated in this Linux environment ## Progress (ref: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf) - [x] Step 1: Add root install.sh and install.ps1 with dynamic release asset selection and platform-specific installation flows. - [x] Step 2: Update README.md to make install.cat the primary install path while preserving manual alternatives. - [x] Step 3: Validate the new scripts and docs in this environment. - [x] Step 4: Commit the implementation, push a fork branch, and draft the PR message for approval. - [ ] Step 5: Create the upstream PR after approval and delete the temporary clone. ## Next Step chore(agent): [Step 5/5] create PR after approval and clean temp clone * fix: address PR review follow-ups PLAN_REF: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf ## Completed in This Step - Hardened release downloads with retries and explicit https README commands - Improved installer portability and robustness across PowerShell and macOS app discovery - Scoped asset URL extraction to browser_download_url fields and checked interactive installer exit codes ## References Used - PR #116 review comments - https://install.cat - https://cli.github.com/manual/gh_pr_review ## Debts and Warnings - Checksum verification remains deferred because the installer flow still needs a dependency-light manifest strategy - pwsh is still unavailable in this Linux environment, so PowerShell execution remains statically validated ## Progress (ref: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf) - [x] Step 1: Add root install.sh and install.ps1 with dynamic release asset selection and platform-specific installation flows. - [x] Step 2: Update README.md to make install.cat the primary install path while preserving manual alternatives. - [x] Step 3: Validate the new scripts and docs in this environment. - [x] Step 4: Commit the implementation, push a fork branch, and draft the PR message for approval. - [ ] Step 5: Create the upstream PR after approval and delete the temporary clone. ## Next Step fix: reply to remaining PR review threads and keep the branch updated * fix: restore installer portability PLAN_REF: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf ## Completed in This Step - Removed curl retry flags that are unavailable on older distributions - Relaxed browser_download_url parsing to tolerate whitespace in GitHub API responses ## References Used - Reviewer report for1391a61ddd## Debts and Warnings - Checksum verification remains deferred for a future dependency-light implementation ## Progress (ref: e082f4f7cbafc0d8e50d4e79ff1b37629b8fcccf) - [x] Step 1: Add root install.sh and install.ps1 with dynamic release asset selection and platform-specific installation flows. - [x] Step 2: Update README.md to make install.cat the primary install path while preserving manual alternatives. - [x] Step 3: Validate the new scripts and docs in this environment. - [x] Step 4: Commit the implementation, push a fork branch, and draft the PR message for approval. - [ ] Step 5: Create the upstream PR after approval and delete the temporary clone. ## Next Step fix: update PR threads after follow-up review
202 lines
4.3 KiB
Bash
Executable file
202 lines
4.3 KiB
Bash
Executable file
#!/bin/sh
|
|
set -eu
|
|
|
|
REPO_SLUG="Rohithgilla12/data-peek"
|
|
API_URL="https://api.github.com/repos/$REPO_SLUG/releases/latest"
|
|
USER_AGENT="data-peek-install-script"
|
|
TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/data-peek-install.XXXXXX")"
|
|
MOUNT_POINT=""
|
|
|
|
cleanup() {
|
|
if [ -n "$MOUNT_POINT" ] && command -v hdiutil >/dev/null 2>&1; then
|
|
hdiutil detach "$MOUNT_POINT" >/dev/null 2>&1 || true
|
|
fi
|
|
rm -rf "$TMP_DIR"
|
|
}
|
|
|
|
trap cleanup EXIT INT TERM
|
|
|
|
info() {
|
|
printf '%s\n' "$*"
|
|
}
|
|
|
|
fail() {
|
|
printf 'Error: %s\n' "$*" >&2
|
|
exit 1
|
|
}
|
|
|
|
need_cmd() {
|
|
command -v "$1" >/dev/null 2>&1 || fail "Missing required command: $1"
|
|
}
|
|
|
|
run_sudo() {
|
|
if [ ! -r /dev/tty ]; then
|
|
fail "sudo access is required, but no interactive TTY is available"
|
|
fi
|
|
|
|
sudo "$@" < /dev/tty
|
|
}
|
|
|
|
download() {
|
|
url="$1"
|
|
output="$2"
|
|
curl -fsSL --retry 3 --connect-timeout 10 -H "User-Agent: $USER_AGENT" "$url" -o "$output"
|
|
}
|
|
|
|
release_json() {
|
|
curl -fsSL --retry 3 --connect-timeout 10 -H "Accept: application/vnd.github+json" -H "User-Agent: $USER_AGENT" "$API_URL"
|
|
}
|
|
|
|
asset_url_for() {
|
|
pattern="$1"
|
|
|
|
printf '%s' "$RELEASE_JSON" \
|
|
| grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*"' \
|
|
| cut -d '"' -f 4 \
|
|
| sed 's#\\/#/#g' \
|
|
| grep -E "$pattern" \
|
|
| head -n 1
|
|
}
|
|
|
|
current_os() {
|
|
uname -s
|
|
}
|
|
|
|
current_arch() {
|
|
case "$(uname -m)" in
|
|
arm64|aarch64)
|
|
printf 'arm64\n'
|
|
;;
|
|
x86_64|amd64)
|
|
printf 'x64\n'
|
|
;;
|
|
*)
|
|
printf 'unknown\n'
|
|
;;
|
|
esac
|
|
}
|
|
|
|
install_macos() {
|
|
need_cmd hdiutil
|
|
need_cmd cp
|
|
need_cmd xattr
|
|
|
|
arch="$1"
|
|
case "$arch" in
|
|
arm64)
|
|
asset_pattern='arm64\.dmg$'
|
|
;;
|
|
x64)
|
|
asset_pattern='x64\.dmg$'
|
|
;;
|
|
*)
|
|
fail "Unsupported macOS architecture: $arch"
|
|
;;
|
|
esac
|
|
|
|
asset_url="$(asset_url_for "$asset_pattern")"
|
|
[ -n "$asset_url" ] || fail "Could not find a macOS installer asset for $arch"
|
|
|
|
dmg_path="$TMP_DIR/data-peek.dmg"
|
|
info "Downloading macOS installer..."
|
|
download "$asset_url" "$dmg_path"
|
|
|
|
info "Mounting disk image..."
|
|
mount_output="$(hdiutil attach -nobrowse "$dmg_path")"
|
|
mount_point="$(printf '%s\n' "$mount_output" | awk -F '\t' '/\/Volumes\// {print $NF; exit}')"
|
|
[ -n "$mount_point" ] || fail "Could not determine mounted volume"
|
|
MOUNT_POINT="$mount_point"
|
|
|
|
set -- "$mount_point"/*.app
|
|
[ -e "$1" ] || fail "Could not find the app bundle in the mounted disk image"
|
|
app_path="$1"
|
|
app_name="$(basename "$app_path")"
|
|
|
|
target_root="/Applications"
|
|
use_sudo=0
|
|
if [ ! -w "$target_root" ]; then
|
|
if command -v sudo >/dev/null 2>&1; then
|
|
use_sudo=1
|
|
else
|
|
target_root="$HOME/Applications"
|
|
mkdir -p "$target_root"
|
|
fi
|
|
fi
|
|
target_path="$target_root/$app_name"
|
|
|
|
info "Installing $app_name to $target_root..."
|
|
if [ "$use_sudo" -eq 1 ]; then
|
|
run_sudo rm -rf "$target_path"
|
|
run_sudo cp -R "$app_path" "$target_root/"
|
|
run_sudo xattr -cr "$target_path"
|
|
else
|
|
rm -rf "$target_path"
|
|
cp -R "$app_path" "$target_root/"
|
|
xattr -cr "$target_path"
|
|
fi
|
|
|
|
info "Unmounting disk image..."
|
|
hdiutil detach "$mount_point" >/dev/null
|
|
MOUNT_POINT=""
|
|
|
|
info "data-peek installed at $target_path"
|
|
}
|
|
|
|
install_linux() {
|
|
arch="$1"
|
|
case "$arch" in
|
|
x64)
|
|
asset_pattern='x86_64\.AppImage$'
|
|
;;
|
|
*)
|
|
fail "Linux auto-install is currently available only for x86_64 AppImage releases"
|
|
;;
|
|
esac
|
|
|
|
asset_url="$(asset_url_for "$asset_pattern")"
|
|
[ -n "$asset_url" ] || fail "Could not find a Linux AppImage asset for $arch"
|
|
|
|
install_dir="$HOME/.local/bin"
|
|
install_path="$install_dir/data-peek"
|
|
mkdir -p "$install_dir"
|
|
|
|
info "Downloading Linux AppImage..."
|
|
download "$asset_url" "$install_path"
|
|
chmod +x "$install_path"
|
|
|
|
info "data-peek installed at $install_path"
|
|
case ":$PATH:" in
|
|
*":$install_dir:"*)
|
|
;;
|
|
*)
|
|
info "Add $install_dir to your PATH if it is not already available in new shells."
|
|
;;
|
|
esac
|
|
}
|
|
|
|
need_cmd curl
|
|
need_cmd grep
|
|
need_cmd awk
|
|
need_cmd head
|
|
need_cmd basename
|
|
need_cmd cut
|
|
need_cmd sed
|
|
need_cmd mktemp
|
|
|
|
RELEASE_JSON="$(release_json)"
|
|
OS_NAME="$(current_os)"
|
|
ARCH_NAME="$(current_arch)"
|
|
|
|
[ "$ARCH_NAME" != "unknown" ] || fail "Unsupported architecture: $(uname -m)"
|
|
|
|
case "$OS_NAME" in
|
|
Darwin)
|
|
install_macos "$ARCH_NAME"
|
|
;;
|
|
Linux)
|
|
install_linux "$ARCH_NAME"
|
|
;;
|
|
*)
|
|
fail "Unsupported operating system: $OS_NAME"
|
|
;;
|
|
esac
|