mcpField
A
aica - AI Code Analyzer

aica - AI Code Analyzer

ローカル
github.com/dotneet開発ツール1673 週間前に更新

aica - AI Code Analyzer について

aicaは、AIコードレビューやエージェントタスク、GitHub Actionsに対応するオープンソースのコード分析CLIです。MCPサーバーとして動作でき、シンボル検索とベクトル検索でコードの文脈を取得します。

主な機能

  1. 01AIコードレビュー
  2. 02AIエージェントタスク
  3. 03シンボル・ベクトル検索
  4. 04変更要約とコミットメッセージ生成
  5. 05GitHub Actions連携
  6. 06プロンプトのカスタマイズ

活用シーン

  1. 01差分や指定ファイルのレビュー
  2. 02GitHub Actionsでの自動レビュー
  3. 03コミットメッセージとプルリクエストの生成

MCP 対応

stdioまたはSSEでMCPサーバーを起動できます。MCP設定ファイルを使って、設定済みのMCPサーバーに接続することもできます。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

aica - AI Code Analyzer

動機

pr-agentやcursorなど、優れたコードレビュー用ツールはすでにあります。しかし、pr-agentはGitHubのようなコードホスティングサービスに依存しているため、利用できる範囲が限られます。また、cursorはオープンソースではないため、完全にカスタマイズしたり、ほかのツールと統合したりできません。

そこで、次のような特徴を備えた新しいツールを作成することにしました。

  • カスタマイズ可能
  • オープンソース
  • プラットフォームに依存しない

機能

  • AI コーディングエージェント
  • AI コードレビュー
  • MCP(Model Context Protocol)に対応。stdioおよびSSEトランスポートに対応しています。
  • コードレビューのためのナレッジ自動取得
  • ナレッジ取得のためのシンボルベースのコード検索
  • ナレッジ取得のためのベクトルベースのドキュメント検索
  • 変更内容の要約を生成
  • コミットメッセージを生成
  • AI が生成したタイトルと本文でプルリクエストを作成
  • プロンプトのカスタマイズ
  • Slack 通知
  • bun build --compileで単一のバイナリ実行ファイルを生成
  • GitHub Actions と統合。(Actions の設定方法についてはWiki ページをご覧ください。)

インストール

バイナリをビルドしてインストールします。

# Install bun before build aica.
#
# Official Install Document:
# https://bun.sh/docs/installation#installing

git clone https://github.com/dotneet/aica.git
cd aica

bun install
bun run build
cp ./dist/aica path-to-your-bin-directory

GitHub トークンを設定します。

# if GITHUB_TOKEN is not set, aica try to get token from `gh auth token`.
export GITHUB_TOKEN=your_github_token

LLM を設定します。

# You can set the following items in your environment variables or aica.toml file.
# Configure at least one of the following providers:

# Anthropic (If you use agent, strongly recommend to use claude sonnet model)
export AICA_LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY=your_api_key
export ANTHROPIC_MODEL=claude-3-5-sonnet-20241022

# OpenAI
export AICA_LLM_PROVIDER=openai
export OPENAI_API_KEY=your_api_key
export OPENAI_MODEL=o3-mini

# Gemini
export AICA_LLM_PROVIDER=google
export GOOGLE_API_KEY=your_api_key
export GOOGLE_MODEL=gemini-2.0-flash

設定

aica.tomlファイルを作成して、設定をカスタマイズできます。

aica.example.tomlをご覧ください。

aica.tomlは、次のいずれかのディレクトリに配置してください。

  • リポジトリのルートディレクトリ
  • ${HOME}/.config/aica/aica.toml
  • ${GITHUB_WORKSPACE}/aica.toml
言語

AI の出力言語を指定できます。言語はAICA_LANGUAGE、またはaica.tomlのlanguageセクションで指定できます。デフォルトでは、LANG環境変数から言語が自動検出されます。

export AICA_LANGUAGE=Japanese

優先順位:

  1. AICA_LANGUAGE
  2. aica.tomlのlanguage.language
  3. LANGからの自動検出

使い方

レビュー
# review the diff from HEAD
aica review [options] [pattern]

# review specific files
aica review src/main.ts

# review the files matching the specific glob pattern
aica review "src/**/*.ts"

オプション:

  • --dir:対象ディレクトリのパス
  • --slack:Slack に通知を送信
エージェント
# execute AI agent with a prompt
aica agent "your prompt here"

# execute AI agent with a instruction file
aica agent -f instruction.txt

# conversation mode. You can interact with AI agent by typing your prompt.
aica agent

このコマンドは、AI エージェントを使ってタスクを実行します。エージェントは、与えられたプロンプトに基づいて必要なアクションを自動で判断し、実行します。

エージェントにはanthropic claude 3.5 sonnetの使用を推奨します。

注意:このコマンドはファイルシステムを破損する可能性があります。十分ご注意ください。

MCP サーバーとしての Aica Agent
# start a MCP server
aica mcp server

# start a MCP server with a config file
aica mcp server --config aica.toml
再インデックス
# reindex the code and document databases
aica reindex
要約
# generate a summary of the diff from HEAD
aica summary [options]

オプション:

  • --dir:対象ディレクトリのパス
変更をコミット

このコマンドは、AI が生成したコミットメッセージを使って変更をコミットします。

# commit all changes(including untracked and unstaged changes) with an AI-generated commit message
aica commit [options] # commits all changes (including untracked and unstaged changes) with an AI-generated commit message

aica commit --staged # commits only staged changes with an AI-generated commit message

aica commit --push # commits all changes and pushes to remote repository

オプション:

  • --staged:ステージ済みの変更のみをコミットします。
  • --dryRun:実行せずに結果を表示します
  • --push:コミット後にリモートリポジトリへプッシュします
プルリクエストを作成

このコマンドは、GitHub にプルリクエストを作成します。

# Creates a pull request. If there are changes, they will be committed automatically.
aica create-pr [options]

# Creates a pull request with only staged changes
aica create-pr --staged

オプション:

  • --withSummary:HEADからの差分の要約を生成します(デフォルト:true)
  • --body:プルリクエストの本文
  • --dryRun:実行せずに結果を表示します
  • --staged:ステージ済みの変更のみを含めます
コミットメッセージを生成
# generate a one-line commit message based on the diff from HEAD
aica commit-message [options]

オプション:

  • --dir:対象ディレクトリのパス
設定を表示
# show current configuration
aica show-config [options]

オプション:

  • --default:デフォルト設定を表示します
その他のコマンド
  • aica --version:バージョン情報を表示します
  • aica --help [command]:指定したコマンドのヘルプ、または一般的なヘルプを表示します

コンテキストを追加

.cursorrulesと.clinerulesは自動的にコンテキストに追加されます。 コンテキストをカスタマイズするには、aica.tomlの[rules]セクションを設定します。

また、.cursor/rules/*.mdcファイルはデフォルトでサポートされています。 この機能は設定で無効にできます。

MCP(Model Context Protocol)

MCP サーバーを定義するmcp.jsonファイルを作成します。

例:

[
  {
    "name": "example-server",
    "type": "stdio",
    "command": "node",
    "args": ["./server.js"]
  },
  {
    "name": "example-server",
    "type": "sse",
    "url": "http://localhost:3001/sse"
  }
]

以下のように、aica.tomlでsetupFileを設定します。

[mcp]
setupFile = "mcp.json"

GitHub Actions

設定

詳細についてはWiki ページをご覧ください。

コマンド

以下のコマンドをコメントに残すことで、AI 機能を利用できます。

# edit the code with AI
/aica edit "your prompt here"

# update summary in the pull request body
/aica summary

# review the latest diff
/aica review

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。