Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .git-ai/lancedb.tar.gz
Git LFS file not shown
49 changes: 40 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ on:
description: "Tag name to release (e.g. v1.2.3). If empty, skip release/publish steps."
required: false
type: string
npm_only:
description: "Only publish to npm (skip GitHub Packages)"
required: false
type: boolean
default: false

permissions:
contents: write
packages: write
id-token: write

jobs:
build-and-publish:
Expand All @@ -33,13 +39,16 @@ jobs:
- name: Setup Node (build/test)
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"
cache: "npm"
cache-dependency-path: package-lock.json

- name: Install
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm test

Expand Down Expand Up @@ -68,33 +77,55 @@ jobs:
with:
tag_name: ${{ env.RELEASE_TAG }}
files: ${{ steps.pack.outputs.tarball }}
generate_release_notes: true

- name: Setup Node (GitHub Packages)
if: ${{ env.RELEASE_TAG != '' }}
if: ${{ env.RELEASE_TAG != '' && inputs.npm_only != true }}
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"
registry-url: "https://npm.pkg.github.com"
scope: "@${{ github.repository_owner }}"

- name: Publish to GitHub Packages (npm.pkg.github.com)
if: ${{ env.RELEASE_TAG != '' }}
- name: Publish to GitHub Packages
if: ${{ env.RELEASE_TAG != '' && inputs.npm_only != true }}
run: |
npm pkg set name="@${{ github.repository_owner }}/git-ai"
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Restore package name for npmjs
if: ${{ env.RELEASE_TAG != '' }}
run: |
npm pkg set name="git-ai"

- name: Setup Node (npmjs.org)
if: ${{ env.RELEASE_TAG != '' }}
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"
registry-url: "https://registry.npmjs.org"

- name: Publish to npmjs.org (optional)
- name: Publish to npmjs.org
if: ${{ env.RELEASE_TAG != '' }}
run: |
npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ env.RELEASE_TAG != '' && env.NODE_AUTH_TOKEN != '' }}

- name: Publish Summary
if: ${{ env.RELEASE_TAG != '' }}
run: |
npm publish --access public
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ env.RELEASE_TAG }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published to:" >> $GITHUB_STEP_SUMMARY
echo "- [x] GitHub Packages: \`@${{ github.repository_owner }}/git-ai\`" >> $GITHUB_STEP_SUMMARY
echo "- [x] npmjs.org: \`git-ai\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Install:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "npm install -g git-ai" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<p align="center">
<img src="docs/logo.png" alt="git-ai logo" width="200"/>
</p>

# git-ai

[![ci](https://github.com/mars167/git-ai-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/mars167/git-ai-cli/actions/workflows/ci.yml)
Expand Down
Binary file added docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
183 changes: 183 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#!/bin/bash
#
# git-ai Quick Install Script
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/mars167/git-ai-cli/main/install.sh | bash
#
# Or with options:
# curl -fsSL https://raw.githubusercontent.com/mars167/git-ai-cli/main/install.sh | bash -s -- --with-skill
#
# This script installs:
# 1. git-ai CLI tool (via npm)
# 2. Optionally: git-ai-mcp skill for AI agents
#

set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
BOLD='\033[1m'

# Banner
print_banner() {
echo -e "${CYAN}"
echo ' ____ _ _ _ ___ '
echo ' / ___| (_) | |_ / \ |_ _|'
echo ' | | _ | | | __| ___ / _ \ | | '
echo ' | |_| | | | | |_ |___| / ___ \ | | '
echo ' \____| |_| \__| /_/ \_\___|'
echo -e "${NC}"
echo -e "${BOLD}Semantic Code Understanding for AI Agents${NC}"
echo ""
}

# Logging functions
info() {
echo -e "${BLUE}[INFO]${NC} $1"
}

success() {
echo -e "${GREEN}[OK]${NC} $1"
}

warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}

error() {
echo -e "${RED}[ERROR]${NC} $1"
exit 1
}

# Check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Parse arguments
INSTALL_SKILL=false
GLOBAL_INSTALL=true

while [[ $# -gt 0 ]]; do
case $1 in
--with-skill|-s)
INSTALL_SKILL=true
shift
;;
--local|-l)
GLOBAL_INSTALL=false
shift
;;
--help|-h)
echo "Usage: install.sh [OPTIONS]"
echo ""
echo "Options:"
echo " --with-skill, -s Also install git-ai-mcp skill for AI agents"
echo " --local, -l Install locally instead of globally"
echo " --help, -h Show this help message"
exit 0
;;
*)
warn "Unknown option: $1"
shift
;;
esac
done

# Main installation
main() {
print_banner

# Check prerequisites
info "Checking prerequisites..."

if ! command_exists node; then
error "Node.js is required but not installed. Please install Node.js 18+ first."
fi

NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
error "Node.js 18+ is required. Current version: $(node -v)"
fi
success "Node.js $(node -v) detected"

if ! command_exists npm; then
error "npm is required but not installed."
fi
success "npm $(npm -v) detected"

# Install git-ai
info "Installing git-ai CLI..."

if [ "$GLOBAL_INSTALL" = true ]; then
npm install -g git-ai
success "git-ai installed globally"
else
npm install git-ai
success "git-ai installed locally"
fi

# Verify installation
if command_exists git-ai; then
success "git-ai $(git-ai --version 2>/dev/null || echo 'installed')"
else
warn "git-ai command not found in PATH. You may need to restart your terminal."
fi

# Install skill if requested
if [ "$INSTALL_SKILL" = true ]; then
info "Installing git-ai-mcp skill..."

if ! command_exists npx; then
warn "npx not found. Skipping skill installation."
else
# Check if skills CLI is available
if npx skills --version >/dev/null 2>&1; then
npx skills add mars167/git-ai-cli@git-ai-mcp -g -y
success "git-ai-mcp skill installed"
else
info "Installing skills CLI..."
npx skills add mars167/git-ai-cli@git-ai-mcp -g -y
success "git-ai-mcp skill installed"
fi
fi
fi

# Print next steps
echo ""
echo -e "${GREEN}${BOLD}Installation Complete!${NC}"
echo ""
echo -e "${BOLD}Quick Start:${NC}"
echo ""
echo " 1. Initialize index in your project:"
echo -e " ${CYAN}cd your-project${NC}"
echo -e " ${CYAN}git-ai ai index --overwrite${NC}"
echo ""
echo " 2. Search code semantically:"
echo -e " ${CYAN}git-ai ai semantic \"user authentication\"${NC}"
echo ""
echo " 3. Analyze call graphs:"
echo -e " ${CYAN}git-ai ai graph callers functionName${NC}"
echo ""

if [ "$INSTALL_SKILL" = false ]; then
echo -e "${BOLD}For AI Agent Integration:${NC}"
echo ""
echo " Install the MCP skill for Claude/Cursor/etc:"
echo -e " ${CYAN}curl -fsSL https://raw.githubusercontent.com/mars167/git-ai-cli/main/install.sh | bash -s -- --with-skill${NC}"
echo ""
fi

echo -e "${BOLD}Documentation:${NC}"
echo " https://github.com/mars167/git-ai-cli"
echo ""
}

# Run main
main
25 changes: 24 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,23 @@
"docs/**",
"assets/**",
"templates/**",
"skills/**",
"install.sh",
"README.md"
],
"keywords": [],
"keywords": [
"git",
"ai",
"semantic-search",
"mcp",
"code-search",
"code-understanding",
"vector-search",
"graph-database",
"cli",
"code-indexing",
"knowledge-graph"
],
"author": "mars167",
"license": "MIT",
"description": "A git-compatible CLI with AI indexing/search and an MCP server.",
Expand All @@ -36,6 +50,15 @@
"engines": {
"node": ">=18"
},
"os": [
"darwin",
"linux",
"win32"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/mars167"
},
"dependencies": {
"@lancedb/lancedb": "0.22.3",
"@modelcontextprotocol/sdk": "^1.25.2",
Expand Down
Loading