Skip to content

Enhance install script to automatically install dependencies on first install#7

Merged
streed merged 6 commits intomainfrom
copilot/fix-700df305-6a98-4aeb-bb43-47029478bb9b
Sep 12, 2025
Merged

Enhance install script to automatically install dependencies on first install#7
streed merged 6 commits intomainfrom
copilot/fix-700df305-6a98-4aeb-bb43-47029478bb9b

Conversation

Copy link
Contributor

Copilot AI commented Sep 12, 2025

Addresses the requirement to automatically install additional dependencies when no configuration file is present (first install).

Changes Made

The installation script now detects first-time installations and automatically sets up the complete ML Notes ecosystem:

🔍 First Install Detection

  • Added is_first_install() function that checks for configuration file at ~/.config/ml-notes/config.json
  • Uses the same XDG config path logic as the Go application for consistency
  • Falls back to querying ml-notes config path if the binary is already available

📦 Automatic Dependency Installation

lil-rag Service Installation:

  • Clones from https://github.com/streed/lil-rag
  • Uses the repository's own install.sh script for proper installation
  • Installs to /usr/local/bin alongside ml-notes
  • Provides manual installation guidance if installation fails

pdftotext Command Installation:

  • Linux: Installs poppler-utils via apt/yum/dnf/pacman package managers
  • macOS: Installs poppler via Homebrew
  • Automatically detects and uses available package manager
  • Gracefully handles cases where package managers are unavailable

🛡️ Robust Error Handling

  • Dependency installation failures are non-fatal - ml-notes still installs successfully
  • Tracks failed installations and provides helpful manual installation guidance
  • Users can install dependencies later without affecting core functionality

🔧 Enhanced Requirements

  • Added git to required tools since it's needed for cloning lil-rag
  • Maintains backward compatibility with existing installation flow

Example Output

On first install, users will see:

→ First install detected - setting up additional dependencies...
→ Installing first-time dependencies...
→ Installing pdftotext...
✓ pdftotext installed via apt-get
→ Installing lil-rag service...
→ Cloning lil-rag repository...
→ Running lil-rag installation script...
✓ lil-rag service installed successfully!
✓ First-time dependencies installed successfully!

If dependencies fail to install automatically, users get clear guidance:

⚠ Some dependencies could not be installed automatically: pdftotext lil-rag
→ You can install them manually later. ML Notes will still work without them.
→ For pdftotext: Install poppler-utils (Linux) or poppler (macOS)
→ For lil-rag: git clone https://github.com/streed/lil-rag.git && cd lil-rag && ./install.sh

On subsequent installs where configuration already exists, the script behaves exactly as before with no additional dependency installation.

This enhancement ensures users get a complete, ready-to-use ML Notes setup on first install while maintaining the reliability and simplicity of the existing installation process.

Warning

https://api.github.com/repos/streed/ml-notes/releases/latest

  • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…ript

Co-authored-by: streed <805140+streed@users.noreply.github.com>
@streed streed marked this pull request as ready for review September 12, 2025 18:27
Copilot AI review requested due to automatic review settings September 12, 2025 18:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the installation script to automatically install additional dependencies (pdftotext and lil-rag service) when no configuration file is detected (first install). This addresses the need for a more complete installation experience for new users.

  • Added first-install detection based on configuration file presence
  • Added automatic installation of pdftotext via system package managers
  • Added automatic installation of lil-rag service from GitHub repository

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +312 to +316
local temp_dir=$(mktemp -d)
cleanup_temp() {
rm -rf "$temp_dir"
}
trap cleanup_temp EXIT
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trap is set inside the function scope and will only execute when the function exits, not when the script exits. If the script is interrupted or fails elsewhere after calling this function, the temporary directory may not be cleaned up. Move the trap outside the function or use a global cleanup mechanism.

Copilot uses AI. Check for mistakes.
install.sh Outdated
Comment on lines +325 to +326
cd "$temp_dir/lil-rag"
if ! go build -o lil-rag .; then
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using cd without saving the previous directory can leave the script in an unexpected location if subsequent operations fail. Consider using pushd/popd or executing the build command with the -C flag: go build -C \"$temp_dir/lil-rag\" -o lil-rag .

Suggested change
cd "$temp_dir/lil-rag"
if ! go build -o lil-rag .; then
if ! go build -C "$temp_dir/lil-rag" -o lil-rag .; then

Copilot uses AI. Check for mistakes.
streed and others added 2 commits September 12, 2025 11:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: streed <805140+streed@users.noreply.github.com>
@streed
Copy link
Owner

streed commented Sep 12, 2025

@copilot the lil-rag installation should use the install.sh script from the repository.

Co-authored-by: streed <805140+streed@users.noreply.github.com>
Copilot AI changed the title [WIP] The installation script needs to do a little bit more. On first install, a configuration file is not present, the install script should also install the lil-rag service from https://github.com/streed/lil-rag as well as install the pdftotext command. Enhance install script to automatically install dependencies on first install Sep 12, 2025
Copilot AI requested a review from streed September 12, 2025 18:31
Co-authored-by: streed <805140+streed@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 12, 2025

@copilot the lil-rag installation should use the install.sh script from the repository.

Updated the lil-rag installation to use the repository's own install.sh script instead of manually cloning and building. This ensures proper installation using the official method. Commit: 0c6eb90

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/streed/lil-rag
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@streed streed merged commit 3d4cbce into main Sep 12, 2025
8 checks passed
@streed streed deleted the copilot/fix-700df305-6a98-4aeb-bb43-47029478bb9b branch September 12, 2025 18:58
This was referenced Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants