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
33 changes: 33 additions & 0 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: opencode

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]

jobs:
opencode:
if: |
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /opencode') ||
startsWith(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: read
issues: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Run opencode
uses: anomalyco/opencode/github@latest
env:
OLLAMA_API_KEY: ${{ secrets.OLLAMA_API_KEY }}
with:
model: ollama-cloud/kimi-k2-thinking
79 changes: 78 additions & 1 deletion installers/setup_beyondcompare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,29 @@ set -euo pipefail

# Parse command line arguments
NON_INTERACTIVE=false
REGISTER_ONLY=false
while [[ $# -gt 0 ]]; do
case "$1" in
-y|--yes|--non-interactive)
NON_INTERACTIVE=true
shift
;;
-r|--register-only)
REGISTER_ONLY=true
shift
;;
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -y, --yes, --non-interactive Skip confirmation prompts"
echo " -r, --register-only Register license only (skip installation)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 # Install Beyond Compare"
echo " $0 --register-only # Register license only"
echo " $0 --register-only --yes # Register license without prompts"
exit 0
;;
*)
Expand All @@ -47,6 +58,56 @@ is_running_remotely() {
fi
}

# Register Beyond Compare license using 1Password CLI
register_bc()
{
log_info "Attempting to register Beyond Compare license..."

log_warning "This script uses 1Password CLI to retrieve the license."
log_info "If you don't have 1Password or prefer a different method,"
log_info "refer to https://www.scootersoftware.com/kb/linuxtips for alternative license installation methods."
echo

# Check for 1Password CLI
if ! command -v op >/dev/null 2>&1; then
log_warning "1Password CLI (op) not found. Skipping license registration."
return 0
fi

# Make sure we're signed in to 1Password
if ! op account list >/dev/null 2>&1; then
log_warning "Not signed in to 1Password. Skipping license registration."
return 0
fi

local _license
if ! _license="$(op read 'op://Private/Beyond Compare License/license key' 2>/dev/null)"; then
log_warning "Failed to retrieve Beyond Compare license from 1Password."
log_info "Make sure you have:"
log_info " 1. 1Password CLI installed (brew install 1password-cli)"
log_info " 2. Signed in to 1Password (eval \"$(op signin)\")"
log_info " 3. A 'Beyond Compare License' item in your Private vault"
return 0
fi

if [[ -z "$_license" ]]; then
log_warning "Beyond Compare license is empty in 1Password."
return 0
fi

local _cfg_dir="$HOME/.config/bcompare5"
local _license_file="$_cfg_dir/BC5Key.txt"

test -d "$_cfg_dir" || mkdir -p "$_cfg_dir"

if echo "$_license" >"$_license_file"; then
log_success "Beyond Compare license registered successfully"
else
log_error "Failed to write Beyond Compare license file"
return 1
fi
}

# Function to source library remotely or locally
source_library() {
local library_name="$1"
Expand Down Expand Up @@ -236,6 +297,9 @@ install_beyondcompare() {
add_beyondcompare_repo
fi

# Register Beyond Compare license (optional, only if 1Password CLI is available)
register_bc

log_success "Beyond Compare installed successfully"
}

Expand Down Expand Up @@ -281,6 +345,19 @@ add_beyondcompare_repo() {
# ------------------------------------------------------------

main() {
# Check if we should only register the license
if [[ "$REGISTER_ONLY" == "true" ]]; then
log_info "Running in register-only mode..."

# Register Beyond Compare license
register_bc

log_success "========================================"
log_success "✓ Beyond Compare license registration completed!"
log_success "========================================"
exit 0
fi

log_info "Starting Beyond Compare installation..."
log_info "Current Beyond Compare installation status: $(get_installed_version)"

Expand Down Expand Up @@ -309,7 +386,7 @@ main() {
if confirm_action "Do you want to prevent the automatic addition of the Beyond Compare repository?"; then
log_info "Creating /etc/default/bcompare to prevent repository addition..."
if ! sudo touch /etc/default/bcompare; then
log_warning "Failed to create /etc/default/bcompare. Repository may be added automatically."
log_warning "Failed to create /etc/default/bcombine. Repository may be added automatically."
fi
fi
fi
Expand Down
Loading