From 2bb3fc51652c5a65728f61da82f2eacda0027aba Mon Sep 17 00:00:00 2001 From: roniz Date: Fri, 10 Apr 2026 10:11:45 +0300 Subject: [PATCH 1/5] feat: make INSTALL_DIR configurable via environment variable Defaults to /usr/local/bin when not set. Usage: curl -sSL https://aka.ms/apm-unix | INSTALL_DIR=~/.local/bin sh Co-Authored-By: Claude Sonnet 4.6 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7d474273..96d76529 100755 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ NC='\033[0m' # No Color # Configuration REPO="microsoft/apm" -INSTALL_DIR="/usr/local/bin" +INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" BINARY_NAME="apm" # Banner From c0bc4fa8ed88229e6086c8161d4b873838aea9b7 Mon Sep 17 00:00:00 2001 From: chkp-roniz <35386615+chkp-roniz@users.noreply.github.com> Date: Fri, 10 Apr 2026 10:52:53 +0300 Subject: [PATCH 2/5] feat: make install.sh configurable for air-gapped and custom environments - APM_INSTALL_DIR: override install path (default /usr/local/bin) - GITHUB_URL: override GitHub base URL for mirrors/GHE - REPO: override repository (default microsoft/apm) - VERSION: pin a specific version (@v1.2.3 arg or env var), skips GitHub API entirely when set Co-Authored-By: Claude Sonnet 4.6 --- install.sh | 90 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 35 deletions(-) diff --git a/install.sh b/install.sh index 96d76529..d081b956 100755 --- a/install.sh +++ b/install.sh @@ -3,6 +3,9 @@ set -e # APM CLI Installer Script # Usage: curl -sSL https://aka.ms/apm-unix | sh +# Specific version: curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3 +# Custom install dir: curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=~/.local/bin sh +# GitHub Enterprise: GITHUB_URL=https://gh.corp.com sh install.sh # For private repositories, use with authentication: # curl -sSL -H "Authorization: token $GITHUB_APM_PAT" \ # https://raw.githubusercontent.com/microsoft/apm/main/install.sh | \ @@ -15,10 +18,11 @@ BLUE='\033[0;34m' YELLOW='\033[1;33m' NC='\033[0m' # No Color -# Configuration -REPO="microsoft/apm" -INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" +# Configuration (all overridable via environment variables) +REPO="${REPO:-microsoft/apm}" +APM_INSTALL_DIR="${APM_INSTALL_DIR:-/usr/local/bin}" BINARY_NAME="apm" +GITHUB_URL="${GITHUB_URL:-https://github.com}" # Banner echo -e "${BLUE}" @@ -69,6 +73,12 @@ esac echo -e "${BLUE}Detected platform: $PLATFORM-$ARCH${NC}" echo -e "${BLUE}Target binary: $DOWNLOAD_BINARY${NC}" +# Parse version: @v1.2.3 as arg, or VERSION env var +# Usage: sh install.sh @v1.2.3 or VERSION=v1.2.3 sh install.sh +if [ -z "$VERSION" ] && [ -n "$1" ]; then + VERSION="${1#@}" +fi + # Function to check Python availability and version check_python_requirements() { # Check if Python is available @@ -135,7 +145,7 @@ try_pip_installation() { echo " cd my-app && apm install # Install dependencies" echo " apm run # Run your first prompt" echo "" - echo -e "${BLUE}Documentation:${NC} https://github.com/$REPO" + echo -e "${BLUE}Documentation:${NC} $GITHUB_URL/$REPO" return 0 else echo -e "${RED}Error: pip installation failed${NC}" @@ -172,7 +182,7 @@ if [ "$PLATFORM" = "linux" ]; then echo "To install APM, you need either:" echo " 1. Python 3.9+ and pip: pip install --user apm-cli" echo " 2. A system with glibc 2.35+ to use the prebuilt binary" - echo " 3. Build from source: git clone https://github.com/$REPO.git && cd apm && uv sync && uv run pip install -e ." + echo " 3. Build from source: git clone $GITHUB_URL/$REPO.git && cd apm && uv sync && uv run pip install -e ." echo "" echo "To install Python 3.9+:" echo " Ubuntu/Debian: sudo apt-get update && sudo apt-get install python3 python3-pip" @@ -193,10 +203,19 @@ if [ -f "/.dockerenv" ] || [ -f "/run/.containerenv" ] || grep -q "/docker/" /pr fi # Check if we have permission to install to /usr/local/bin -if [ ! -w "$INSTALL_DIR" ]; then - echo -e "${YELLOW}Note: Will need sudo permissions to install to $INSTALL_DIR${NC}" +if [ ! -w "$APM_INSTALL_DIR" ]; then + echo -e "${YELLOW}Note: Will need sudo permissions to install to $APM_INSTALL_DIR${NC}" +fi + +# When VERSION is provided, skip GitHub API and compute download URL directly +if [ -n "$VERSION" ]; then + TAG_NAME="$VERSION" + DOWNLOAD_URL="$GITHUB_URL/$REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" + echo -e "${GREEN}Version: $TAG_NAME${NC}" + echo -e "${BLUE}Download URL: $DOWNLOAD_URL${NC}" fi +if [ -z "$TAG_NAME" ]; then # Get latest release info echo -e "${YELLOW}Fetching latest release information...${NC}" @@ -208,7 +227,7 @@ CURL_EXIT_CODE=$? # Only try authentication if curl failed OR we got a "Not Found" message OR response is empty if [ $CURL_EXIT_CODE -ne 0 ] || [ -z "$LATEST_RELEASE" ] || echo "$LATEST_RELEASE" | grep -q '"message".*"Not Found"'; then echo -e "${BLUE}Repository appears to be private, trying with authentication...${NC}" - + # Check if we have GitHub token for private repo access AUTH_HEADER_VALUE="" if [ -n "$GITHUB_APM_PAT" ]; then @@ -226,7 +245,7 @@ if [ $CURL_EXIT_CODE -ne 0 ] || [ -z "$LATEST_RELEASE" ] || echo "$LATEST_RELEAS echo " GITHUB_APM_PAT=\$GITHUB_APM_PAT sh" exit 1 fi - + # Retry with authentication LATEST_RELEASE=$(curl -s -H "Authorization: token $AUTH_HEADER_VALUE" "https://api.github.com/repos/$REPO/releases/latest") CURL_EXIT_CODE=$? @@ -241,7 +260,7 @@ fi # Check if we got a valid response (should contain tag_name) if ! echo "$LATEST_RELEASE" | grep -q '"tag_name":'; then echo -e "${RED}Error: Invalid API response received${NC}" - + # Check if the response contains an error message if echo "$LATEST_RELEASE" | grep -q '"message"'; then echo -e "${RED}GitHub API Error:${NC}" @@ -253,7 +272,7 @@ fi # Extract tag name and download URLs # Use grep -o to extract just the matching portion (handles single-line JSON) TAG_NAME=$(echo "$LATEST_RELEASE" | grep -o '"tag_name": *"[^"]*"' | awk -F'"' '{print $4}') -DOWNLOAD_URL="https://github.com/$REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" +DOWNLOAD_URL="$GITHUB_URL/$REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" # Extract API asset URL for private repository downloads ASSET_URL=$(echo "$LATEST_RELEASE" | grep -B 3 "\"name\": \"$DOWNLOAD_BINARY\"" | grep -o '"url": *"[^"]*"' | awk -F'"' '{print $4}') @@ -273,6 +292,7 @@ fi echo -e "${GREEN}Latest version: $TAG_NAME${NC}" echo -e "${BLUE}Download URL: $DOWNLOAD_URL${NC}" +fi # Create temporary directory TMP_DIR=$(mktemp -d) @@ -313,7 +333,7 @@ else echo "" echo "For private repositories, ensure your token has the required permissions." echo "You can try installing from source instead:" - echo " git clone https://github.com/$REPO.git" + echo " git clone $GITHUB_URL/$REPO.git" echo " cd apm && uv sync && uv run pip install -e ." exit 1 fi @@ -333,7 +353,7 @@ else echo "" echo "For private repositories, ensure your token has the required permissions." echo "You can try installing from source instead:" - echo " git clone https://github.com/$REPO.git" + echo " git clone $GITHUB_URL/$REPO.git" echo " cd apm && uv sync && uv run pip install -e ." exit 1 fi @@ -354,7 +374,7 @@ else echo " GITHUB_APM_PAT=\$GITHUB_APM_PAT sh" echo "" echo "You can also try installing from source:" - echo " git clone https://github.com/$REPO.git" + echo " git clone $GITHUB_URL/$REPO.git" echo " cd apm && uv sync && uv run pip install -e ." exit 1 fi @@ -436,7 +456,7 @@ else echo "2. Homebrew (macOS/Linux): brew install microsoft/apm/apm" echo "" echo "3. From source:" - echo " git clone https://github.com/$REPO.git" + echo " git clone $GITHUB_URL/$REPO.git" echo " cd apm && uv sync && uv run pip install -e ." echo "" @@ -446,39 +466,39 @@ else echo "" fi - echo "Need help? Create an issue at: https://github.com/$REPO/issues" + echo "Need help? Create an issue at: $GITHUB_URL/$REPO/issues" exit 1 fi # Install binary directory structure -echo -e "${YELLOW}Installing APM CLI to $INSTALL_DIR...${NC}" +echo -e "${YELLOW}Installing APM CLI to $APM_INSTALL_DIR...${NC}" # APM installation directory (for the complete bundle) -APM_INSTALL_DIR="/usr/local/lib/apm" +APM_LIB_DIR="$(dirname "$APM_INSTALL_DIR")/lib/apm" # Remove any existing installation -if [ -d "$APM_INSTALL_DIR" ]; then - if [ -w "/usr/local/lib" ]; then - rm -rf "$APM_INSTALL_DIR" +if [ -d "$APM_LIB_DIR" ]; then + if [ -w "$(dirname "$APM_LIB_DIR")" ]; then + rm -rf "$APM_LIB_DIR" else - sudo rm -rf "$APM_INSTALL_DIR" + sudo rm -rf "$APM_LIB_DIR" fi fi # Create installation directory -if [ -w "/usr/local/lib" ]; then - mkdir -p "$APM_INSTALL_DIR" - cp -r "$TMP_DIR/$EXTRACTED_DIR"/* "$APM_INSTALL_DIR/" +if [ -w "$(dirname "$APM_LIB_DIR")" ]; then + mkdir -p "$APM_LIB_DIR" + cp -r "$TMP_DIR/$EXTRACTED_DIR"/* "$APM_LIB_DIR/" else - sudo mkdir -p "$APM_INSTALL_DIR" - sudo cp -r "$TMP_DIR/$EXTRACTED_DIR"/* "$APM_INSTALL_DIR/" + sudo mkdir -p "$APM_LIB_DIR" + sudo cp -r "$TMP_DIR/$EXTRACTED_DIR"/* "$APM_LIB_DIR/" fi # Create symlink in /usr/local/bin pointing to the actual binary -if [ -w "$INSTALL_DIR" ]; then - ln -sf "$APM_INSTALL_DIR/$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME" +if [ -w "$APM_INSTALL_DIR" ]; then + ln -sf "$APM_LIB_DIR/$BINARY_NAME" "$APM_INSTALL_DIR/$BINARY_NAME" else - sudo ln -sf "$APM_INSTALL_DIR/$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME" + sudo ln -sf "$APM_LIB_DIR/$BINARY_NAME" "$APM_INSTALL_DIR/$BINARY_NAME" fi # Verify installation @@ -486,12 +506,12 @@ if command -v apm >/dev/null 2>&1; then INSTALLED_VERSION=$(apm --version 2>/dev/null || echo "unknown") echo -e "${GREEN}✓ APM installed successfully!${NC}" echo -e "${BLUE}Version: $INSTALLED_VERSION${NC}" - echo -e "${BLUE}Location: $INSTALL_DIR/$BINARY_NAME -> $APM_INSTALL_DIR/$BINARY_NAME${NC}" + echo -e "${BLUE}Location: $APM_INSTALL_DIR/$BINARY_NAME -> $APM_LIB_DIR/$BINARY_NAME${NC}" else echo -e "${YELLOW}⚠ APM installed but not found in PATH${NC}" - echo "You may need to add $INSTALL_DIR to your PATH environment variable." + echo "You may need to add $APM_INSTALL_DIR to your PATH environment variable." echo "Add this line to your shell profile (.bashrc, .zshrc, etc.):" - echo " export PATH=\"$INSTALL_DIR:\$PATH\"" + echo " export PATH=\"$APM_INSTALL_DIR:\$PATH\"" fi echo "" @@ -502,5 +522,5 @@ echo " apm init my-app # Create a new APM project" echo " cd my-app && apm install # Install dependencies" echo " apm run # Run your first prompt" echo "" -echo -e "${BLUE}Documentation:${NC} https://github.com/$REPO" -echo -e "${BLUE}Need help?${NC} Create an issue at https://github.com/$REPO/issues" +echo -e "${BLUE}Documentation:${NC} $GITHUB_URL/$REPO" +echo -e "${BLUE}Need help?${NC} Create an issue at $GITHUB_URL/$REPO/issues" From afba4ab5e2e0a39ab8912406fe9f9c74014e3460 Mon Sep 17 00:00:00 2001 From: chkp-roniz <35386615+chkp-roniz@users.noreply.github.com> Date: Fri, 10 Apr 2026 12:05:35 +0300 Subject: [PATCH 3/5] fix: address PR review comments - Use $HOME instead of ~ in usage example (dash/sh compatibility) - Set AUTH_HEADER_VALUE before download section so private repo auth works even when VERSION skips the API path - mkdir -p APM_INSTALL_DIR before symlink to avoid unnecessary sudo - Update stale comment referencing /usr/local/bin Co-Authored-By: Claude Sonnet 4.6 --- install.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index d081b956..6d7a9ae2 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ set -e # APM CLI Installer Script # Usage: curl -sSL https://aka.ms/apm-unix | sh # Specific version: curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3 -# Custom install dir: curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=~/.local/bin sh +# Custom install dir: curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh # GitHub Enterprise: GITHUB_URL=https://gh.corp.com sh install.sh # For private repositories, use with authentication: # curl -sSL -H "Authorization: token $GITHUB_APM_PAT" \ @@ -202,11 +202,18 @@ if [ -f "/.dockerenv" ] || [ -f "/run/.containerenv" ] || grep -q "/docker/" /pr echo "" fi -# Check if we have permission to install to /usr/local/bin +# Check if we have permission to install to the configured directory if [ ! -w "$APM_INSTALL_DIR" ]; then echo -e "${YELLOW}Note: Will need sudo permissions to install to $APM_INSTALL_DIR${NC}" fi +# Resolve auth token (needed for both API and download paths) +if [ -n "$GITHUB_APM_PAT" ]; then + AUTH_HEADER_VALUE="$GITHUB_APM_PAT" +elif [ -n "$GITHUB_TOKEN" ]; then + AUTH_HEADER_VALUE="$GITHUB_TOKEN" +fi + # When VERSION is provided, skip GitHub API and compute download URL directly if [ -n "$VERSION" ]; then TAG_NAME="$VERSION" @@ -494,10 +501,11 @@ else sudo cp -r "$TMP_DIR/$EXTRACTED_DIR"/* "$APM_LIB_DIR/" fi -# Create symlink in /usr/local/bin pointing to the actual binary -if [ -w "$APM_INSTALL_DIR" ]; then +# Create symlink pointing to the actual binary +if mkdir -p "$APM_INSTALL_DIR" 2>/dev/null && [ -w "$APM_INSTALL_DIR" ]; then ln -sf "$APM_LIB_DIR/$BINARY_NAME" "$APM_INSTALL_DIR/$BINARY_NAME" else + sudo mkdir -p "$APM_INSTALL_DIR" sudo ln -sf "$APM_LIB_DIR/$BINARY_NAME" "$APM_INSTALL_DIR/$BINARY_NAME" fi From a869124e11c4216b2a68274eed7c0fd4056e87e6 Mon Sep 17 00:00:00 2001 From: chkp-roniz <35386615+chkp-roniz@users.noreply.github.com> Date: Fri, 10 Apr 2026 12:11:00 +0300 Subject: [PATCH 4/5] docs: document installer env var options Update installation docs and apm-guide skill to cover APM_INSTALL_DIR, GITHUB_URL, REPO, VERSION, and @version syntax. Co-Authored-By: Claude Sonnet 4.6 --- .../docs/getting-started/installation.md | 29 ++++++++++++++++--- .../.apm/skills/apm-usage/installation.md | 16 +++++++++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/docs/src/content/docs/getting-started/installation.md b/docs/src/content/docs/getting-started/installation.md index f40da1fa..54f0b73a 100644 --- a/docs/src/content/docs/getting-started/installation.md +++ b/docs/src/content/docs/getting-started/installation.md @@ -27,6 +27,28 @@ irm https://aka.ms/apm-windows | iex The installer automatically detects your platform (macOS/Linux/Windows, Intel/ARM), downloads the latest binary, and adds `apm` to your `PATH`. +### Installer options + +The Unix installer supports environment variables for custom environments: + +```bash +# Install a specific version +curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3 + +# Custom install directory +curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh + +# Air-gapped / GitHub Enterprise mirror +GITHUB_URL=https://github.corp.com VERSION=v1.2.3 sh install.sh +``` + +| Variable | Default | Description | +|----------|---------|-------------| +| `APM_INSTALL_DIR` | `/usr/local/bin` | Directory for the `apm` symlink | +| `GITHUB_URL` | `https://github.com` | Base URL for downloads (mirrors, GHE) | +| `REPO` | `microsoft/apm` | GitHub repository | +| `VERSION` | *(latest)* | Pin a specific release (skips GitHub API) | + ## Package managers **Homebrew (macOS/Linux):** @@ -124,7 +146,7 @@ apm --version ### `apm: command not found` (macOS / Linux) -Ensure `/usr/local/bin` is in your `PATH`: +Ensure your install directory is in your `PATH`. The default is `/usr/local/bin`: ```bash echo $PATH | tr ':' '\n' | grep /usr/local/bin @@ -138,11 +160,10 @@ export PATH="/usr/local/bin:$PATH" ### Permission denied during install (macOS / Linux) -Use `sudo` for system-wide installation, or install to a user-writable directory instead: +Use `sudo` for system-wide installation, or install to a user-writable directory: ```bash -mkdir -p ~/bin -# then install the binary to ~/bin/apm and add ~/bin to PATH +curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh ``` ### Authentication errors when installing packages diff --git a/packages/apm-guide/.apm/skills/apm-usage/installation.md b/packages/apm-guide/.apm/skills/apm-usage/installation.md index dbc44a64..20ecd14e 100644 --- a/packages/apm-guide/.apm/skills/apm-usage/installation.md +++ b/packages/apm-guide/.apm/skills/apm-usage/installation.md @@ -37,7 +37,21 @@ apm update # update APM itself apm update --check # check for updates without installing ``` +## Installer options (macOS / Linux) + +```bash +# Specific version +curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3 + +# Custom install dir +curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh + +# Air-gapped / GHE mirror (skips GitHub API when VERSION is set) +GITHUB_URL=https://github.corp.com VERSION=v1.2.3 sh install.sh +``` + ## Troubleshooting -- **macOS/Linux "command not found":** ensure `/usr/local/bin` is in `$PATH`. +- **macOS/Linux "command not found":** ensure your install directory (default `/usr/local/bin`) is in `$PATH`. +- **Permission denied:** use `APM_INSTALL_DIR=$HOME/.local/bin` to install without sudo. - **Windows antivirus locks:** set `$env:APM_DEBUG = "1"` and retry. From d7a575c86f8b90f8b9a68286a8e37d88240e584b Mon Sep 17 00:00:00 2001 From: chkp-roniz <35386615+chkp-roniz@users.noreply.github.com> Date: Sun, 12 Apr 2026 20:37:09 +0300 Subject: [PATCH 5/5] fix: address PR review comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename REPO -> APM_REPO for consistency with APM_INSTALL_DIR - Replace non-ASCII chars (✓ ⚠ 🎉) with ASCII equivalents ([+] [!]) - Add APM_LIB_DIR to docs table and GHE note (VERSION required for air-gapped) - Add CHANGELOG entry under [Unreleased] / Added Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 1 + .../docs/getting-started/installation.md | 5 +- install.sh | 58 +++++++++---------- .../.apm/skills/apm-usage/installation.md | 2 +- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ebf1a08..01ce02f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `apm install` now automatically discovers and deploys local `.apm/` primitives (skills, instructions, agents, prompts, hooks, commands) to target directories, with local content taking priority over dependencies on collision (#626, #644) +- `install.sh` supports `APM_INSTALL_DIR`, `GITHUB_URL`, `APM_REPO`, and `VERSION` env vars for air-gapped, GHE, and custom install-path scenarios; `VERSION` (or `@vX.Y.Z` arg) skips the GitHub API entirely (#660) ### Fixed diff --git a/docs/src/content/docs/getting-started/installation.md b/docs/src/content/docs/getting-started/installation.md index 54f0b73a..ca5cb066 100644 --- a/docs/src/content/docs/getting-started/installation.md +++ b/docs/src/content/docs/getting-started/installation.md @@ -45,10 +45,13 @@ GITHUB_URL=https://github.corp.com VERSION=v1.2.3 sh install.sh | Variable | Default | Description | |----------|---------|-------------| | `APM_INSTALL_DIR` | `/usr/local/bin` | Directory for the `apm` symlink | +| `APM_LIB_DIR` | `$(dirname APM_INSTALL_DIR)/lib/apm` | Directory for the full binary bundle | | `GITHUB_URL` | `https://github.com` | Base URL for downloads (mirrors, GHE) | -| `REPO` | `microsoft/apm` | GitHub repository | +| `APM_REPO` | `microsoft/apm` | GitHub repository | | `VERSION` | *(latest)* | Pin a specific release (skips GitHub API) | +> **Note:** When using `GITHUB_URL` for a GitHub Enterprise or air-gapped mirror, set `VERSION` as well. The GitHub API call for latest-release discovery still targets `api.github.com`; `VERSION` bypasses it entirely. + ## Package managers **Homebrew (macOS/Linux):** diff --git a/install.sh b/install.sh index 6d7a9ae2..0f2afcdf 100755 --- a/install.sh +++ b/install.sh @@ -19,7 +19,7 @@ YELLOW='\033[1;33m' NC='\033[0m' # No Color # Configuration (all overridable via environment variables) -REPO="${REPO:-microsoft/apm}" +APM_REPO="${APM_REPO:-microsoft/apm}" APM_INSTALL_DIR="${APM_INSTALL_DIR:-/usr/local/bin}" BINARY_NAME="apm" GITHUB_URL="${GITHUB_URL:-https://github.com}" @@ -124,7 +124,7 @@ try_pip_installation() { # Try to install if $PIP_CMD install --user apm-cli; then - echo -e "${GREEN}✓ APM installed successfully via pip!${NC}" + echo -e "${GREEN}[+]APM installed successfully via pip!${NC}" # Check if apm is now available if command -v apm >/dev/null 2>&1; then @@ -132,20 +132,20 @@ try_pip_installation() { echo -e "${BLUE}Version: $INSTALLED_VERSION${NC}" echo -e "${BLUE}Location: $(which apm)${NC}" else - echo -e "${YELLOW}⚠ APM installed but not found in PATH${NC}" + echo -e "${YELLOW}[!]APM installed but not found in PATH${NC}" echo "You may need to add ~/.local/bin to your PATH:" echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" fi echo "" - echo -e "${GREEN}🎉 Installation complete!${NC}" + echo -e "${GREEN}Installation complete!${NC}" echo "" echo -e "${BLUE}Quick start:${NC}" echo " apm init my-app # Create a new APM project" echo " cd my-app && apm install # Install dependencies" echo " apm run # Run your first prompt" echo "" - echo -e "${BLUE}Documentation:${NC} $GITHUB_URL/$REPO" + echo -e "${BLUE}Documentation:${NC} $GITHUB_URL/$APM_REPO" return 0 else echo -e "${RED}Error: pip installation failed${NC}" @@ -162,7 +162,7 @@ if [ "$PLATFORM" = "linux" ]; then if [ -n "$GLIBC_VERSION" ]; then # Compare versions if [ "$(printf '%s\n' "$REQUIRED_GLIBC" "$GLIBC_VERSION" | sort -V | head -n1)" != "$REQUIRED_GLIBC" ]; then - echo -e "${YELLOW}⚠ Compatibility Issue Detected${NC}" + echo -e "${YELLOW}[!]Compatibility Issue Detected${NC}" echo -e "${YELLOW}Your glibc version: $GLIBC_VERSION${NC}" echo -e "${YELLOW}Required version: $REQUIRED_GLIBC or newer${NC}" echo "" @@ -182,7 +182,7 @@ if [ "$PLATFORM" = "linux" ]; then echo "To install APM, you need either:" echo " 1. Python 3.9+ and pip: pip install --user apm-cli" echo " 2. A system with glibc 2.35+ to use the prebuilt binary" - echo " 3. Build from source: git clone $GITHUB_URL/$REPO.git && cd apm && uv sync && uv run pip install -e ." + echo " 3. Build from source: git clone $GITHUB_URL/$APM_REPO.git && cd apm && uv sync && uv run pip install -e ." echo "" echo "To install Python 3.9+:" echo " Ubuntu/Debian: sudo apt-get update && sudo apt-get install python3 python3-pip" @@ -196,7 +196,7 @@ fi # Detect if running in a container and check compatibility if [ -f "/.dockerenv" ] || [ -f "/run/.containerenv" ] || grep -q "/docker/" /proc/1/cgroup 2>/dev/null; then - echo -e "${YELLOW}⚠ Container/Dev Container environment detected${NC}" + echo -e "${YELLOW}[!]Container/Dev Container environment detected${NC}" echo -e "${YELLOW}Note: PyInstaller binaries may have compatibility issues in containers.${NC}" echo -e "${YELLOW}If installation fails, consider using: pip install --user apm-cli${NC}" echo "" @@ -217,7 +217,7 @@ fi # When VERSION is provided, skip GitHub API and compute download URL directly if [ -n "$VERSION" ]; then TAG_NAME="$VERSION" - DOWNLOAD_URL="$GITHUB_URL/$REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" + DOWNLOAD_URL="$GITHUB_URL/$APM_REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" echo -e "${GREEN}Version: $TAG_NAME${NC}" echo -e "${BLUE}Download URL: $DOWNLOAD_URL${NC}" fi @@ -227,7 +227,7 @@ if [ -z "$TAG_NAME" ]; then echo -e "${YELLOW}Fetching latest release information...${NC}" # Try to fetch release info without authentication first (for public repos) -LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases/latest") +LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$APM_REPO/releases/latest") CURL_EXIT_CODE=$? # Check if the response indicates authentication is required (private repo) @@ -254,7 +254,7 @@ if [ $CURL_EXIT_CODE -ne 0 ] || [ -z "$LATEST_RELEASE" ] || echo "$LATEST_RELEAS fi # Retry with authentication - LATEST_RELEASE=$(curl -s -H "Authorization: token $AUTH_HEADER_VALUE" "https://api.github.com/repos/$REPO/releases/latest") + LATEST_RELEASE=$(curl -s -H "Authorization: token $AUTH_HEADER_VALUE" "https://api.github.com/repos/$APM_REPO/releases/latest") CURL_EXIT_CODE=$? fi @@ -279,7 +279,7 @@ fi # Extract tag name and download URLs # Use grep -o to extract just the matching portion (handles single-line JSON) TAG_NAME=$(echo "$LATEST_RELEASE" | grep -o '"tag_name": *"[^"]*"' | awk -F'"' '{print $4}') -DOWNLOAD_URL="$GITHUB_URL/$REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" +DOWNLOAD_URL="$GITHUB_URL/$APM_REPO/releases/download/$TAG_NAME/$DOWNLOAD_BINARY" # Extract API asset URL for private repository downloads ASSET_URL=$(echo "$LATEST_RELEASE" | grep -B 3 "\"name\": \"$DOWNLOAD_BINARY\"" | grep -o '"url": *"[^"]*"' | awk -F'"' '{print $4}') @@ -310,7 +310,7 @@ echo -e "${YELLOW}Downloading APM...${NC}" # Try downloading without authentication first (for public repos) if curl -L --fail --silent --show-error "$DOWNLOAD_URL" -o "$TMP_DIR/$DOWNLOAD_BINARY"; then - echo -e "${GREEN}✓ Download successful${NC}" + echo -e "${GREEN}[+]Download successful${NC}" else # If unauthenticated download fails, try with authentication if available if [ -n "$AUTH_HEADER_VALUE" ]; then @@ -323,11 +323,11 @@ else -H "Authorization: token $AUTH_HEADER_VALUE" \ -H "Accept: application/octet-stream" \ "$ASSET_URL" -o "$TMP_DIR/$DOWNLOAD_BINARY"; then - echo -e "${GREEN}✓ Download successful via GitHub API${NC}" + echo -e "${GREEN}[+]Download successful via GitHub API${NC}" else echo -e "${BLUE}GitHub API download failed, trying direct URL with auth...${NC}" if curl -L --fail --silent --show-error -H "Authorization: token $AUTH_HEADER_VALUE" "$DOWNLOAD_URL" -o "$TMP_DIR/$DOWNLOAD_BINARY"; then - echo -e "${GREEN}✓ Download successful with authentication${NC}" + echo -e "${GREEN}[+]Download successful with authentication${NC}" else echo -e "${RED}Error: Failed to download APM CLI even with authentication${NC}" echo "Direct URL: $DOWNLOAD_URL" @@ -340,7 +340,7 @@ else echo "" echo "For private repositories, ensure your token has the required permissions." echo "You can try installing from source instead:" - echo " git clone $GITHUB_URL/$REPO.git" + echo " git clone $GITHUB_URL/$APM_REPO.git" echo " cd apm && uv sync && uv run pip install -e ." exit 1 fi @@ -348,7 +348,7 @@ else else echo -e "${BLUE}No API URL available, trying direct URL with auth...${NC}" if curl -L --fail --silent --show-error -H "Authorization: token $AUTH_HEADER_VALUE" "$DOWNLOAD_URL" -o "$TMP_DIR/$DOWNLOAD_BINARY"; then - echo -e "${GREEN}✓ Download successful with authentication${NC}" + echo -e "${GREEN}[+]Download successful with authentication${NC}" else echo -e "${RED}Error: Failed to download APM CLI even with authentication${NC}" echo "URL: $DOWNLOAD_URL" @@ -360,7 +360,7 @@ else echo "" echo "For private repositories, ensure your token has the required permissions." echo "You can try installing from source instead:" - echo " git clone $GITHUB_URL/$REPO.git" + echo " git clone $GITHUB_URL/$APM_REPO.git" echo " cd apm && uv sync && uv run pip install -e ." exit 1 fi @@ -381,7 +381,7 @@ else echo " GITHUB_APM_PAT=\$GITHUB_APM_PAT sh" echo "" echo "You can also try installing from source:" - echo " git clone $GITHUB_URL/$REPO.git" + echo " git clone $GITHUB_URL/$APM_REPO.git" echo " cd apm && uv sync && uv run pip install -e ." exit 1 fi @@ -390,7 +390,7 @@ fi # Extract binary from tar.gz echo -e "${YELLOW}Extracting binary...${NC}" if tar -xzf "$TMP_DIR/$DOWNLOAD_BINARY" -C "$TMP_DIR"; then - echo -e "${GREEN}✓ Extraction successful${NC}" + echo -e "${GREEN}[+]Extraction successful${NC}" else echo -e "${RED}Error: Failed to extract binary from archive${NC}" exit 1 @@ -411,7 +411,7 @@ else fi if [ $BINARY_TEST_EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}✓ Binary test successful${NC}" + echo -e "${GREEN}[+]Binary test successful${NC}" else echo -e "${RED}Error: Downloaded binary failed to run${NC}" echo -e "${YELLOW}Exit code: $BINARY_TEST_EXIT_CODE${NC}" @@ -421,7 +421,7 @@ else # Try to provide helpful context if echo "$BINARY_TEST_OUTPUT" | grep -q "GLIBC"; then - echo -e "${YELLOW}⚠ glibc version incompatibility detected${NC}" + echo -e "${YELLOW}[!]glibc version incompatibility detected${NC}" if [ -n "$GLIBC_VERSION" ]; then echo "Your system has glibc $GLIBC_VERSION but the binary requires glibc 2.35+" fi @@ -463,7 +463,7 @@ else echo "2. Homebrew (macOS/Linux): brew install microsoft/apm/apm" echo "" echo "3. From source:" - echo " git clone $GITHUB_URL/$REPO.git" + echo " git clone $GITHUB_URL/$APM_REPO.git" echo " cd apm && uv sync && uv run pip install -e ." echo "" @@ -473,7 +473,7 @@ else echo "" fi - echo "Need help? Create an issue at: $GITHUB_URL/$REPO/issues" + echo "Need help? Create an issue at: $GITHUB_URL/$APM_REPO/issues" exit 1 fi @@ -512,23 +512,23 @@ fi # Verify installation if command -v apm >/dev/null 2>&1; then INSTALLED_VERSION=$(apm --version 2>/dev/null || echo "unknown") - echo -e "${GREEN}✓ APM installed successfully!${NC}" + echo -e "${GREEN}[+]APM installed successfully!${NC}" echo -e "${BLUE}Version: $INSTALLED_VERSION${NC}" echo -e "${BLUE}Location: $APM_INSTALL_DIR/$BINARY_NAME -> $APM_LIB_DIR/$BINARY_NAME${NC}" else - echo -e "${YELLOW}⚠ APM installed but not found in PATH${NC}" + echo -e "${YELLOW}[!]APM installed but not found in PATH${NC}" echo "You may need to add $APM_INSTALL_DIR to your PATH environment variable." echo "Add this line to your shell profile (.bashrc, .zshrc, etc.):" echo " export PATH=\"$APM_INSTALL_DIR:\$PATH\"" fi echo "" -echo -e "${GREEN}🎉 Installation complete!${NC}" +echo -e "${GREEN}Installation complete!${NC}" echo "" echo -e "${BLUE}Quick start:${NC}" echo " apm init my-app # Create a new APM project" echo " cd my-app && apm install # Install dependencies" echo " apm run # Run your first prompt" echo "" -echo -e "${BLUE}Documentation:${NC} $GITHUB_URL/$REPO" -echo -e "${BLUE}Need help?${NC} Create an issue at $GITHUB_URL/$REPO/issues" +echo -e "${BLUE}Documentation:${NC} $GITHUB_URL/$APM_REPO" +echo -e "${BLUE}Need help?${NC} Create an issue at $GITHUB_URL/$APM_REPO/issues" diff --git a/packages/apm-guide/.apm/skills/apm-usage/installation.md b/packages/apm-guide/.apm/skills/apm-usage/installation.md index 20ecd14e..831b5c69 100644 --- a/packages/apm-guide/.apm/skills/apm-usage/installation.md +++ b/packages/apm-guide/.apm/skills/apm-usage/installation.md @@ -46,7 +46,7 @@ curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3 # Custom install dir curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh -# Air-gapped / GHE mirror (skips GitHub API when VERSION is set) +# Air-gapped / GHE mirror — VERSION is required (skips GitHub API) GITHUB_URL=https://github.corp.com VERSION=v1.2.3 sh install.sh ```