diff --git a/PUBLISHING.md b/PUBLISHING.md index f12df12..dda3079 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -33,7 +33,7 @@ Update version numbers in these files: The install script at `docs/install.sh` enables one-line installation: ```bash -curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash +curl -sSL https://git.appmodel.nl/tour/finish/raw/branch/main/docs/install.sh | bash ``` ### Setup: @@ -250,7 +250,7 @@ After publishing, users can install from: **Quick Install:** ```bash -curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash +curl -sSL https://git.appmodel.nl/tour/finish/raw/branch/main/docs/install.sh | bash ``` **Homebrew:** @@ -271,7 +271,7 @@ docker pull ghcr.io/appmodel/finish:latest **Direct Download:** ``` -https://git.appmodel.nl/Tour/finish/releases/latest +https://git.appmodel.nl/tour/finish/releases/latest ``` ## Troubleshooting diff --git a/README.md b/README.md index cd35394..c899ba9 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,13 @@ Command-line completion powered by local LLMs. Press `Tab` twice and get intelli ### One-Line Install (Recommended) ```bash -curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash +curl -sSL https://git.appmodel.nl/tour/finish/raw/branch/main/docs/install.sh | bash ``` ### Manual Installation ```bash -git clone https://git.appmodel.nl/Tour/finish.git finish +git clone https://git.appmodel.nl/tour/finish.git finish cd finish ./finish.sh install source ~/.bashrc @@ -59,7 +59,7 @@ finish config Change the endpoint or model: ```bash -finish config set endpoint http://192.168.1.100:1234/v1/chat/completions +finish config set endpoint http://plato.lan:1234/v1/chat/completions finish config set model your-model-name ``` @@ -100,7 +100,7 @@ finish command --dry-run "your command" The fastest way to get started: ```bash -curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash +curl -sSL https://git.appmodel.nl/tour/finish/raw/branch/main/docs/install.sh | bash source ~/.bashrc # or ~/.zshrc for zsh finish model ``` @@ -118,7 +118,7 @@ source ~/.bashrc #### APT (Debian/Ubuntu) -Download the `.deb` package from [releases](https://git.appmodel.nl/Tour/finish/releases): +Download the `.deb` package from [releases](https://git.appmodel.nl/tour/finish/releases): ```bash sudo dpkg -i finish_*.deb @@ -153,7 +153,7 @@ finish model # Configure your LLM endpoint ### From Source ```bash -git clone https://git.appmodel.nl/Tour/finish.git finish +git clone https://git.appmodel.nl/tour/finish.git finish cd finish chmod +x finish.sh sudo ln -s $PWD/finish.sh /usr/local/bin/finish @@ -210,7 +210,7 @@ Add custom providers by editing `finish.sh` and adding entries to `_finish_model Clone and link for development: ```bash -git clone https://git.appmodel.nl/Tour/finish.git finish +git clone https://git.appmodel.nl/tour/finish.git finish cd finish ln -s $PWD/finish.sh $HOME/.local/bin/finish finish install @@ -284,7 +284,7 @@ After creating a release, update the Homebrew formula: 1. Calculate SHA256 of the release tarball: ```bash - curl -sL https://git.appmodel.nl/Tour/finish/archive/v0.5.0.tar.gz | sha256sum + curl -sL https://git.appmodel.nl/tour/finish/archive/v0.5.0.tar.gz | sha256sum ``` 2. Update `homebrew/finish.rb` with the new SHA256 and version diff --git a/debian/control b/debian/control index f994d37..70a847c 100644 --- a/debian/control +++ b/debian/control @@ -4,8 +4,8 @@ Priority: optional Maintainer: finish.sh Contributors Build-Depends: debhelper (>= 10) Standards-Version: 4.5.0 -Homepage: https://git.appmodel.nl/Tour/finish/finish -Vcs-Git: https://git.appmodel.nl/Tour/finish.git +Homepage: https://git.appmodel.nl/tour/finish/finish +Vcs-Git: https://git.appmodel.nl/tour/finish.git Package: finish Architecture: all diff --git a/debian/copyright b/debian/copyright index 5807ec2..53539c6 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: finish -Upstream-Contact: https://git.appmodel.nl/Tour/finish/finish -Source: https://git.appmodel.nl/Tour/finish +Upstream-Contact: https://git.appmodel.nl/tour/finish/finish +Source: https://git.appmodel.nl/tour/finish Files: * Copyright: 2024-2025 finish.sh Contributors diff --git a/docs/install.sh b/docs/install.sh index 98a3327..1d9b109 100644 --- a/docs/install.sh +++ b/docs/install.sh @@ -1,12 +1,12 @@ #!/bin/sh # finish.sh installer -# Usage: curl -sSL https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash +# Usage: curl -sSL https://git.appmodel.nl/tour/finish/raw/branch/main/docs/install.sh | bash set -e ACSH_VERSION="v0.5.0" BRANCH_OR_VERSION=${1:-main} -REPO_URL="https://git.appmodel.nl/Tour/finish/raw/branch" +REPO_URL="https://git.appmodel.nl/tour/finish/raw/branch" # Colors RED='\033[0;31m' @@ -121,6 +121,11 @@ main() { echo "" # Determine installation location + # Prefer local user install at ~/.local/bin, create it if missing + if [ ! -d "$HOME/.local/bin" ]; then + mkdir -p "$HOME/.local/bin" + fi + if [ -d "$HOME/.local/bin" ]; then INSTALL_LOCATION="$HOME/.local/bin/finish" # Add to PATH if not already there @@ -134,8 +139,8 @@ main() { elif [ -w "/usr/local/bin" ]; then INSTALL_LOCATION="/usr/local/bin/finish" else - echo_error "Cannot write to /usr/local/bin and $HOME/.local/bin doesn't exist" - echo "Please create $HOME/.local/bin or run with sudo" + echo_error "Cannot determine installation location" + echo "Please ensure either $HOME/.local/bin exists and is writable, or run with sudo for /usr/local/bin" exit 1 fi @@ -154,6 +159,13 @@ main() { echo_green "✓ Installed to $INSTALL_LOCATION" echo "" + # Ensure current shell PATH includes the install dir for immediate use + INSTALL_DIR="$(dirname "$INSTALL_LOCATION")" + case ":$PATH:" in + *":$INSTALL_DIR:"*) ;; + *) export PATH="$INSTALL_DIR:$PATH" ;; + esac + # Check bash-completion if [ "$SHELL_TYPE" = "bash" ]; then if ! command -v _init_completion > /dev/null 2>&1; then @@ -188,7 +200,7 @@ main() { echo "" echo " 3. Start using by pressing Tab twice after any command" echo "" - echo "Documentation: https://git.appmodel.nl/Tour/finish" + echo "Documentation: https://git.appmodel.nl/tour/finish" else echo_error "Installation failed. Please check the output above." exit 1 diff --git a/finish.iml b/finish.iml new file mode 100644 index 0000000..4560575 --- /dev/null +++ b/finish.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/finish.sh b/finish.sh index 4304a3e..90b37eb 100644 --- a/finish.sh +++ b/finish.sh @@ -529,7 +529,7 @@ show_help() { echo " clear Clear cache and log files" echo " --help Show this help message" echo - echo "Submit issues at: https://git.appmodel.nl/Tour/finish/issues" + echo "Submit issues at: https://git.appmodel.nl/tour/finish/issues" } is_subshell() { @@ -707,7 +707,7 @@ acsh_load_config() { install_command() { local bashrc_file="$HOME/.bashrc" finish_setup="source finish enable" finish_cli_setup="complete -F _finishsh_cli finish" if ! command -v finish &>/dev/null; then - echo_error "finish.sh not in PATH. Follow install instructions at https://git.appmodel.nl/Tour/finish" + echo_error "finish.sh not in PATH. Follow install instructions at https://git.appmodel.nl/tour/finish" return fi if [[ ! -d "$HOME/.finish" ]]; then diff --git a/homebrew/finish.rb b/homebrew/finish.rb index db5ea9d..72ccdcd 100644 --- a/homebrew/finish.rb +++ b/homebrew/finish.rb @@ -1,7 +1,7 @@ class finishSh < Formula desc "LLM-powered command-line finishtion" - homepage "https://git.appmodel.nl/Tour/finish" - url "https://git.appmodel.nl/Tour/finish/archive/v0.5.0.tar.gz" + homepage "https://git.appmodel.nl/tour/finish" + url "https://git.appmodel.nl/tour/finish/archive/v0.5.0.tar.gz" sha256 "" # Update with actual SHA256 of the release tarball license "BSD-2-Clause" version "0.5.0" @@ -36,7 +36,7 @@ class finishSh < Formula Ollama: https://ollama.ai For more information, visit: - https:/git.appmodel.nl/Tour/finish + https:/git.appmodel.nl/tour/finish EOS end diff --git a/tests/test_finish.bats b/tests/test_finish.bats deleted file mode 100644 index 8405297..0000000 --- a/tests/test_finish.bats +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bats - -setup() { - # Install finish.sh and run testing against the main branch - wget -qO- https://git.appmodel.nl/Tour/finish/raw/branch/main/docs/install.sh | bash -s -- main - - # Source bashrc to make sure finish is available in the current session - source ~/.bashrc - - # Configure for local LM-Studio - finish config set provider lmstudio - finish config set endpoint http://plato.lan:1234/v1/chat/completions - finish config set model darkidol-llama-3.1-8b-instruct-1.3-uncensored_gguf:2 -} - -teardown() { - # Remove finish.sh installation - finish remove -y -} - -@test "which finish returns something" { - run which finish - [ "$status" -eq 0 ] - [ -n "$output" ] -} - -@test "finish returns a string containing finish.sh (case insensitive)" { - run finish - [ "$status" -eq 0 ] - [[ "$output" =~ [Aa]utocomplete\.sh ]] -} - -@test "finish config should have lmstudio provider" { - run finish config - [ "$status" -eq 0 ] - [[ "$output" =~ lmstudio ]] -} - -@test "finish command 'ls # show largest files' should return something" { - run finish command "ls # show largest files" - [ "$status" -eq 0 ] - [ -n "$output" ] -} diff --git a/tests/test_finish.sh b/tests/test_finish.sh new file mode 100755 index 0000000..d32ae14 --- /dev/null +++ b/tests/test_finish.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ----- tiny test framework ----- +pass() { printf "✔ %s\n" "$1"; } +fail() { printf "✘ %s\n" "$1"; exit 1; } + +assert_ok() { + if [[ $1 -ne 0 ]]; then fail "$2"; fi +} + +assert_nonempty() { + if [[ -z "$1" ]]; then fail "$2"; fi +} + +assert_contains() { + if [[ ! "$1" =~ $2 ]]; then fail "$3"; fi +} +# -------------------------------- + +echo "=== SETUP ===" +bash ./docs/install.sh main +source ~/.bashrc + +finish config set provider lmstudio +finish config set endpoint http://plato.lan:1234/v1/chat/completions +finish config set model darkidol-llama-3.1-8b-instruct-1.3-uncensored_gguf:2 + +# -------------------------------- TESTS -------------------------------- + +# 1) which finish should return something +out=$(which finish 2>&1) ; code=$? +assert_ok $code "which finish should exit 0" +assert_nonempty "$out" "which finish returned empty output" +pass "which finish returns path" + +# 2) finish output should contain 'finish.sh' +out=$(finish 2>&1) ; code=$? +assert_ok $code "finish should exit 0" +assert_contains "$out" "finish\.sh" "finish output does not contain finish.sh" +pass "finish outputs reference to finish.sh" + +# 3) config should contain lmstudio +out=$(finish config 2>&1) ; code=$? +assert_ok $code "finish config should exit 0" +assert_contains "$out" "lmstudio" "finish config missing lmstudio provider" +pass "finish config contains lmstudio" + +# 4) finish command should run +out=$(finish command "ls # show largest files" 2>&1) ; code=$? +assert_ok $code "finish command did not exit 0" +assert_nonempty "$out" "finish command returned empty output" +pass "finish command executed and returned output" + +# ------------------------------- CLEANUP -------------------------------- +echo "=== CLEANUP ===" +finish remove -y || true + +echo "All tests passed."