Skip to content
Open
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
99 changes: 81 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,50 @@

This repository contains a setup script to install and configure the **GitHub Copilot CLI** on **Termux** (Android). It automates the installation of system dependencies, builds required native modules, and sets up the environment for a smooth experience.

## Prerequisites

- **Termux** app installed on Android
- Internet connection for downloading packages
- At least 500MB of free storage space
- No prior setup required - the script handles everything

## Overview

The `setup.sh` script performs the following tasks:
- Installs Node.js and build tools (clang, make, python, rust).
- Installs system libraries (glib, libvips, pkg-config).
- Installs the `@github/copilot` CLI globally.
- Updates Termux package repositories
- Installs Node.js and build tools (clang, make, python, rust)
- Installs system libraries (glib, xorgproto, libvips, libsecret, pkg-config)
- Installs the `@github/copilot` CLI globally
- Compiles and configures native Node.js modules:
- **node-pty**: For pseudo-terminal support.
- **sharp**: For image processing.
- **keytar**: For secure credential storage.
- Sets up a clipboard wrapper using `termux-api`.
- Configures `ripgrep` for code search.
- **node-pty**: For pseudo-terminal support
- **sharp**: For image processing
- **keytar**: For secure credential storage (requires libsecret)
- Sets up a clipboard wrapper using `termux-api`
- Configures `ripgrep` for code search

## Installation

1. Clone this repository or download the `setup.sh` file to your Termux home directory.
2. Make the script executable:
```bash
chmod +x setup.sh
```
3. Run the setup script:
```bash
./setup.sh
```
1. Clone this repository or download the `setup.sh` file:
```bash
git clone <repository-url>
cd copilot-termux-setup
```
Or if you have the script already:
```bash
cd copilot-termux-setup
```

2. Make the script executable:
```bash
chmod +x setup.sh
```

3. Run the setup script:
```bash
./setup.sh
```

The script will guide you through the installation process. It may take some time to compile the native modules.
The script will guide you through the installation process. It may take 10-15 minutes to complete as it compiles native modules from source.

## Usage

Expand All @@ -36,3 +54,48 @@ Once the installation is complete, you can start the GitHub Copilot CLI by runni
```bash
copilot
```

Then authenticate with GitHub:
1. Type `/login` in the Copilot CLI
2. Follow the authentication prompts
3. Start using AI-powered code assistance

## Verification

The script automatically tests all native modules at the end. You should see:
- ✓ keytar loaded successfully
- ✓ node-pty loaded successfully
- ✓ clipboard wrapper available
- sharp may show warnings but is non-critical

## Troubleshooting

### Script fails during installation
- Ensure you have a stable internet connection
- Run `pkg update && pkg upgrade` before running the script
- Make sure you have enough storage space

### keytar fails to build
- This was a known issue, now fixed by installing `libsecret`
- Ensure you're using the latest version of this script

### Copilot command not found
- Close and reopen Termux to refresh your PATH
- Or run: `hash -r` to refresh the command cache

## What Gets Installed

**System Packages:**
- nodejs, clang, make, python
- glib, xorgproto, rust, libvips, libsecret, pkg-config
- ripgrep, termux-api

**Native Modules:**
- keytar (credential storage)
- node-pty (terminal/command execution)
- sharp (image processing)
- clipboard wrapper (Termux API integration)

**Configuration Files:**
- ~/.gyp/include.gypi (node-gyp configuration)
- Patched node-addon-api for Android compatibility
9 changes: 5 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ print_step() {
echo ""
}

# Ensure a pkg package is installed only if missing; can check by command or pkg list-installed
# Ensure a pkg package is installed only if missing; can check by command or dpkg
ensure_pkg() {
local pkgname="$1"
local check_cmd="${2:-}"
Expand All @@ -96,8 +96,8 @@ ensure_pkg() {
return 0
fi
else
if pkg list-installed "$pkgname" >/dev/null 2>&1; then
print_info "$pkgname already installed according to pkg"
if dpkg -s "$pkgname" >/dev/null 2>&1; then
print_info "$pkgname already installed according to dpkg"
return 0
fi
fi
Expand Down Expand Up @@ -185,6 +185,7 @@ ensure_pkg glib
ensure_pkg xorgproto
ensure_pkg rust rustc
ensure_pkg libvips
ensure_pkg libsecret
ensure_pkg pkg-config pkg-config
ensure_pkg ripgrep rg

Expand Down Expand Up @@ -628,7 +629,7 @@ print_header "Installation Summary"

echo "Installed Packages:"
echo " • nodejs, clang, make, python"
echo " • glib, xorgproto, rust, libvips, pkg-config"
echo " • glib, xorgproto, rust, libvips, libsecret, pkg-config"
echo " • ripgrep, termux-api"
echo ""
echo "Native Modules Built:"
Expand Down