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
56 changes: 56 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish CLI to NPM

on:
release:
types: [published]
workflow_dispatch:
inputs:
npm_tag:
description: 'NPM tag to publish under (e.g., latest, beta, alpha)'
required: false
default: 'latest'
type: string

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: gateway
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build and bundle
run: |
npm run build
npm run bundle

- name: Remove private flag from package.json
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
delete pkg.private;
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"

- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
NPM_TAG="${{ github.event.inputs.npm_tag || 'latest' }}"
npm publish --tag "$NPM_TAG" --access public
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@google/gemini-cli",
"name": "@anek-codes/gemini-cli",
"version": "0.25.0-nightly.20260107.59a18e710",
"engines": {
"node": ">=20.0.0"
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/core/loggingContentGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { CodeAssistServer } from '../code_assist/server.js';
import { toContents } from '../code_assist/converter.js';
import { isStructuredError } from '../utils/quotaErrorDetection.js';
import { runInDevTraceSpan, type SpanMetadata } from '../telemetry/trace.js';
import { resolveVertexServerDetails } from '../utils/baseUrlUtils.js';

interface StructuredError {
status: number;
Expand Down Expand Up @@ -94,6 +95,10 @@ export class LoggingContentGenerator implements ContentGenerator {

// Case 2: Using an API key for Vertex AI.
if (genConfig?.vertexai) {
const vertexCustomServerDetails = resolveVertexServerDetails();
if (vertexCustomServerDetails) {
return vertexCustomServerDetails;
}
const location = process.env['GOOGLE_CLOUD_LOCATION'];
if (location) {
return { address: `${location}-aiplatform.googleapis.com`, port: 443 };
Expand Down
14 changes: 14 additions & 0 deletions packages/core/src/utils/baseUrlUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import type { ServerDetails } from '../telemetry/types.js';

export function resolveVertexServerDetails(): ServerDetails | undefined {
if (process.env['GEMINI_CLI_VERTEX_BASE_URL'] === undefined) {
return undefined;
}
return { address: process.env['GEMINI_CLI_VERTEX_BASE_URL'], port: 443 };
}
Loading