Skip to content

Add claude-code and codex-cli AI tools installer to ci/#3

Draft
Copilot wants to merge 2 commits intodev-v2from
copilot/add-install-ai-tools
Draft

Add claude-code and codex-cli AI tools installer to ci/#3
Copilot wants to merge 2 commits intodev-v2from
copilot/add-install-ai-tools

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 23, 2026

Adds a standalone installer script for Anthropic's claude-code and OpenAI's codex-cli CLI tools, wired into the existing ci/script.sh bootstrap flow.

New: ci/install_ai_tools.sh

  • Checks for Node.js 18+; auto-installs via NodeSource (apt-get / yum / dnf) if missing
  • Installs @anthropic-ai/claude-codeclaude binary
  • Installs @openai/codexcodex binary
  • Idempotent: skips each tool if its binary is already on PATH
  • Non-fatal: logs errors per-tool but does not abort the overall install
# Run standalone
bash ci/install_ai_tools.sh

# Tools available after install
claude config          # authenticate claude-code
export OPENAI_API_KEY=<key> && codex   # start codex-cli

Updated: ci/script.sh

Marks install_ai_tools.sh executable when co-located, making it available in CI/build pipelines without a separate step:

if [ -f "$(dirname "$0")/install_ai_tools.sh" ]; then
    chmod +x "$(dirname "$0")/install_ai_tools.sh"
fi
Original prompt

Overview

Add support for installing claude-code (Anthropic Claude Code CLI) and codex-cli (OpenAI Codex CLI) as part of the 1Panel installation script process.

Background

The 1Panel installer lives in ci/script.sh (which downloads assets from 1Panel-dev/installer) and the main install logic is in the downloaded install.sh. We need to add a new shell script in the repository that handles installing these two AI coding CLI tools.

What to do

Create a new file ci/install_ai_tools.sh in the repository with functions to install both tools. Also update ci/script.sh to reference/call this new script if appropriate.

ci/install_ai_tools.sh

Create this new file with the following content and logic:

#!/bin/bash

# AI Coding Tools Installer
# Installs claude-code (Anthropic) and codex-cli (OpenAI)

set -e

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m'

log_info()  { echo -e "${BLUE}[AI Tools] $1${NC}"; }
log_ok()    { echo -e "${GREEN}[AI Tools] $1${NC}"; }
log_warn()  { echo -e "${YELLOW}[AI Tools] $1${NC}"; }
log_err()   { echo -e "${RED}[AI Tools] $1${NC}"; }

# ── Node.js prerequisite check ──────────────────────────────────────────────
check_node() {
    if ! command -v node >/dev/null 2>&1; then
        log_warn "Node.js not found. Attempting to install via NodeSource (LTS)..."
        if command -v apt-get >/dev/null 2>&1; then
            curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
            apt-get install -y nodejs
        elif command -v yum >/dev/null 2>&1; then
            curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -
            yum install -y nodejs
        elif command -v dnf >/dev/null 2>&1; then
            curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -
            dnf install -y nodejs
        else
            log_err "Unsupported package manager. Please install Node.js 18+ manually and re-run."
            return 1
        fi
    fi

    node_major=$(node --version | sed 's/v//' | cut -d. -f1)
    if [ "$node_major" -lt 18 ]; then
        log_err "Node.js 18+ is required (found $(node --version)). Please upgrade Node.js."
        return 1
    fi
    log_ok "Node.js $(node --version) detected."
}

# ── Install claude-code ──────────────────────────────────────────────────────
install_claude_code() {
    log_info "Installing claude-code (Anthropic Claude Code CLI)..."
    if command -v claude >/dev/null 2>&1; then
        log_warn "claude-code is already installed ($(claude --version 2>/dev/null || echo 'unknown version')). Skipping."
        return 0
    fi

    if npm install -g @anthropic-ai/claude-code 2>&1; then
        log_ok "claude-code installed successfully."
        log_info "Run 'claude' to get started. Authenticate with: claude config"
    else
        log_err "Failed to install claude-code via npm."
        return 1
    fi
}

# ── Install codex-cli ──────────────────────────────────���─────────────────────
install_codex_cli() {
    log_info "Installing codex-cli (OpenAI Codex CLI)..."
    if command -v codex >/dev/null 2>&1; then
        log_warn "codex-cli is already installed ($(codex --version 2>/dev/null || echo 'unknown version')). Skipping."
        return 0
    fi

    if npm install -g @openai/codex 2>&1; then
        log_ok "codex-cli installed successfully."
        log_info "Run 'codex' to get started. Set your API key: export OPENAI_API_KEY=<your-key>"
    else
        log_err "Failed to install codex-cli via npm."
        return 1
    fi
}

# ── Main ─────────────────────────────────────────────────────────────────────
install_ai_tools() {
    log_info "Starting AI coding tools installation..."
    check_node || { log_err "Node.js prerequisite check failed. Aborting AI tools installation."; return 1; }
    install_claude_code
    install_codex_cli
    log_ok "AI coding tools installation complete."
    log_info "  • claude-code: run 'claude' — docs: https://github.com/anthropics/claude-code"
    log_info "  • codex-cli:   run 'codex'  — docs: https://github.com/openai/codex"
}

install_ai_tools

Update ci/script.sh

In ci/script.sh, after the existing downloads complete (after the chmod 755 1pctl install.sh line), source or reference the new AI tools script so it is available in CI/build pipelines. Add the following at the end of the file (before the final chmod line or after it):

# Make the AI tools installer available
if [ -f "$(dirname "$0")/install_ai_tools.sh" ]; then
    chmod +x "$(dirname "$0")/install_ai_tools.sh"
fi

Install commands reference

Tool npm package Binary Docs
claude-code @anthropic-ai/claude-code claude https://github.com/anthropics/claude-code
codex-cli @openai/codex codex https://github.com/openai/codex

Both require Node.js 18+.

Notes

  • The script must be idempotent (skips if already installed).
  • The script should not fai...

This pull request was created from Copilot chat.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Add support for installing claude-code and codex-cli Add claude-code and codex-cli AI tools installer to ci/ Mar 23, 2026
Copilot AI requested a review from nexusct March 23, 2026 09:18
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.

2 participants