Skip to content

Commit 6c1970b

Browse files
anandgupta42claude
andcommitted
fix: install altimate-code via npm (not binary download)
The standalone binary can't find @altimateai/altimate-core napi module at runtime because it's not bundled. Installing via npm resolves all dependencies correctly including the native addon. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0f3a1bf commit 6c1970b

File tree

4 files changed

+13
-65
lines changed

4 files changed

+13
-65
lines changed

action.yml

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -109,68 +109,21 @@ runs:
109109
echo "version=${VERSION}" >> $GITHUB_OUTPUT
110110
echo "Resolved altimate-code version: ${VERSION}"
111111
112-
- name: Cache altimate-code
113-
id: cache
114-
uses: actions/cache@v4
115-
with:
116-
path: ~/.altimate-code/bin
117-
key: altimate-code-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }}
118-
119112
- name: Install altimate-code
120-
if: steps.cache.outputs.cache-hit != 'true'
121113
shell: bash
122114
run: |
123-
# Download binary directly from GitHub releases
124115
VERSION="${{ steps.version.outputs.version }}"
125-
ARCH=$(uname -m)
126-
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
127-
128-
# Map architecture names
129-
case "$ARCH" in
130-
x86_64) ARCH="x64" ;;
131-
aarch64|arm64) ARCH="arm64" ;;
132-
esac
133-
134-
ASSET="altimate-code-${OS}-${ARCH}"
135-
if [ "$OS" = "linux" ]; then
136-
ASSET="${ASSET}.tar.gz"
137-
else
138-
ASSET="${ASSET}.zip"
139-
fi
140-
141-
DOWNLOAD_URL="https://github.com/AltimateAI/altimate-code/releases/download/${VERSION}/${ASSET}"
142-
echo "Downloading altimate-code ${VERSION} from ${DOWNLOAD_URL}"
143-
144-
mkdir -p ~/.altimate-code/bin
145-
cd /tmp
146-
if curl -fsSL -o "altimate-code-archive" "$DOWNLOAD_URL"; then
147-
if [ "$OS" = "linux" ]; then
148-
tar xzf altimate-code-archive -C ~/.altimate-code/bin/
149-
else
150-
unzip -o altimate-code-archive -d ~/.altimate-code/bin/
151-
fi
152-
chmod +x ~/.altimate-code/bin/altimate-code
153-
rm -f altimate-code-archive
154-
155-
# Verify installation
156-
if [ -x "$HOME/.altimate-code/bin/altimate-code" ]; then
157-
echo "altimate-code installed successfully"
158-
"$HOME/.altimate-code/bin/altimate-code" --version 2>/dev/null || true
159-
else
160-
echo "::warning::altimate-code binary not found after extraction"
161-
ls -la "$HOME/.altimate-code/bin/" || true
162-
fi
163-
else
164-
echo "::warning::Failed to download altimate-code ${VERSION} — falling back to regex rules"
165-
fi
116+
echo "Installing altimate-code ${VERSION} via npm..."
117+
npm install -g "@altimateai/altimate-code@${VERSION#v}" 2>&1 || \
118+
npm install -g @altimateai/altimate-code@latest 2>&1 || \
119+
echo "::warning::Failed to install altimate-code — falling back to regex rules"
166120
167-
- name: Add altimate-code to PATH
168-
shell: bash
169-
run: |
170-
echo "$HOME/.altimate-code/bin" >> $GITHUB_PATH
171-
# Also verify check command is available
121+
# Verify
172122
if command -v altimate-code >/dev/null 2>&1; then
173-
echo "altimate-code is on PATH"
123+
echo "altimate-code $(altimate-code --version 2>/dev/null || echo 'installed')"
124+
altimate-code check --help >/dev/null 2>&1 && echo "check command: available" || echo "check command: not available"
125+
else
126+
echo "::warning::altimate-code not found on PATH after install"
174127
fi
175128
176129
- name: Setup Node.js

dist/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27473,8 +27473,7 @@ import { spawn } from "node:child_process";
2747327473
var DEFAULT_TIMEOUT_MS = 3e5;
2747427474
async function runCLI(args, options = {}) {
2747527475
const { env: extraEnv = {}, cwd, timeout = DEFAULT_TIMEOUT_MS, parseJson = false } = options;
27476-
const homeBin = `${process.env.HOME}/.altimate-code/bin/altimate-code`;
27477-
const command = process.env.HOME && __require("fs").existsSync(homeBin) ? homeBin : "altimate-code";
27476+
const command = "altimate-code";
2747827477
core3.debug(`Running CLI: ${command} ${args.join(" ")}`);
2747927478
return new Promise((resolve2, reject) => {
2748027479
const child = spawn(command, args, {

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util/cli.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ interface CLIOptions {
2525
export async function runCLI(args: string[], options: CLIOptions = {}): Promise<CLIResult> {
2626
const { env: extraEnv = {}, cwd, timeout = DEFAULT_TIMEOUT_MS, parseJson = false } = options;
2727

28-
// Try full path first (GitHub Actions installs to ~/.altimate-code/bin/),
29-
// then fall back to PATH lookup
30-
const homeBin = `${process.env.HOME}/.altimate-code/bin/altimate-code`;
31-
const command =
32-
process.env.HOME && require("fs").existsSync(homeBin) ? homeBin : "altimate-code";
28+
const command = "altimate-code";
3329
core.debug(`Running CLI: ${command} ${args.join(" ")}`);
3430

3531
return new Promise<CLIResult>((resolve, reject) => {

0 commit comments

Comments
 (0)