feat(natives): added native addon distribution and platform validation to CLI update mechanism
- Added native addon distribution and installation support to the CLI update mechanism, enabling platform-specific native modules to be downloaded and installed alongside the main binary. - Added platform validation in native addon loader to verify supported platforms (linux-x64, linux-arm64, darwin-x64, darwin-arm64, win32-x64) with helpful error messages for unsupported configurations. - Enhanced native addon loading error messages to provide platform-specific troubleshooting guidance for both npm/bun installations and local development environments. - Updated installation scripts (install.sh, install.ps1) to download and install native addon files alongside the main binary during CLI installation.
This commit is contained in:
@@ -1,22 +1,29 @@
|
||||
# Test binary build from local source
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates unzip && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates unzip build-essential && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
|
||||
# Install Rust
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
|
||||
ENV PATH="/root/.cargo/bin:$PATH"
|
||||
|
||||
# Copy local repo
|
||||
WORKDIR /repo
|
||||
COPY . .
|
||||
|
||||
# Build binary
|
||||
# Build native addon and binary
|
||||
RUN bun install --frozen-lockfile
|
||||
RUN bun --cwd=packages/natives run build:native
|
||||
RUN cd packages/coding-agent && bun run build:binary
|
||||
|
||||
# Install binary to PATH
|
||||
RUN mkdir -p /root/.local/bin && cp packages/coding-agent/dist/omp /root/.local/bin/
|
||||
# Install binary and native addon to PATH
|
||||
RUN mkdir -p /root/.local/bin && \
|
||||
cp packages/coding-agent/dist/omp /root/.local/bin/ && \
|
||||
cp packages/natives/native/pi_natives.linux-x64.node /root/.local/bin/
|
||||
ENV PATH="/root/.local/bin:$PATH"
|
||||
|
||||
# Verify
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
# Test --source install from local repo
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates unzip && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates unzip build-essential && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
|
||||
# Install Rust (needed to build native addon)
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
|
||||
ENV PATH="/root/.cargo/bin:$PATH"
|
||||
|
||||
# Copy local repo
|
||||
WORKDIR /repo
|
||||
COPY . .
|
||||
|
||||
# Install dependencies and link globally
|
||||
# Install dependencies, build native addon, and link globally
|
||||
RUN bun install --frozen-lockfile
|
||||
RUN bun --cwd=packages/natives run build:native
|
||||
RUN cd packages/coding-agent && bun link
|
||||
|
||||
# Verify
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
# Uses verdaccio as local registry to test full publish/install cycle
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates unzip jq procps && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y curl ca-certificates unzip jq procps build-essential && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
|
||||
# Install Rust (needed to build native addon)
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
|
||||
ENV PATH="/root/.cargo/bin:$PATH"
|
||||
|
||||
# Install Node.js (needed for verdaccio and npm)
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
@@ -22,6 +26,7 @@ COPY . .
|
||||
|
||||
# Build the project
|
||||
RUN bun install --frozen-lockfile
|
||||
RUN bun --cwd=packages/natives run build:native
|
||||
|
||||
# Create verdaccio config (allow anonymous publish)
|
||||
RUN mkdir -p /root/.config/verdaccio && cat > /root/.config/verdaccio/config.yaml <<'EOF'
|
||||
@@ -63,7 +68,7 @@ RUN cat > /repo/scripts/publish-local.sh <<'SCRIPT'
|
||||
set -e
|
||||
|
||||
REGISTRY="http://localhost:4873"
|
||||
PACKAGES=(utils ai agent tui stats coding-agent)
|
||||
PACKAGES=(utils natives ai agent tui stats coding-agent)
|
||||
|
||||
# Build version map from all package.json files
|
||||
declare -A VERSION_MAP
|
||||
|
||||
Reference in New Issue
Block a user