npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hassak

v0.0.10

Published

コードベース分析と実装提案を生成するAI搭載CLIツール

Readme

hassak

コードベース分析と実装提案ツール

概要

hassakは、プロジェクトのコードベースを再帰的に分析し、特定のタスクチケットに対する詳細な実装方針を提供するAI搭載CLIツールです。OpenAIのGPTモデルまたはローカルで動作するOllamaモデルを活用して、コード構造を理解し、具体的で実用的な実装提案を生成します。

特徴

  • 🔍 プロジェクト全体の構造を自動解析
  • 📝 各ファイルの内容をAIがサマリー化
  • 🤖 特定のタスクに関連するファイルを自動特定
  • 📊 詳細な実装提案(変更ファイル、コード例、新規ファイル)を生成
  • 🔧 .hassakフォルダに整理された分析結果を保存
  • 🚀 NEW: ローカルで動作するOllamaモデルをサポート(APIキー不要!)

インストール

# npm
npm install -g hassak

# yarn
yarn global add hassak

# pnpm
pnpm add -g hassak

前提条件

  • Node.js 16以上
  • OpenAI APIキー または Ollamaのローカルインストール

LLMプロバイダー対応

hassakは以下の2つのLLMプロバイダーをサポートしています:

1. Ollama(推奨)

2. OpenAI

  • クラウドベースのAIモデル
  • APIキーが必要
  • インターネット接続が必要
  • 一般的にはより高性能

使い方

基本コマンド

こんにちは!と表示する:

npx hassak hello

コードベース分析とタスク実装提案

指定したプロジェクトを分析し、タスクチケットに基づいた実装提案を生成します:

npx hassak analyze --ticket "実装したい機能の詳細説明"

オプション

  • --ticket (必須): 実装したいタスクチケットの詳細説明
  • --path (オプション): 分析するプロジェクトのパス (デフォルト: カレントディレクトリ)
  • --output (オプション): 分析結果の出力ファイル名 (デフォルト: hassak-analysis.json)
  • --model (オプション): 使用するAIモデル
    • OpenAI: gpt-4o(デフォルト), gpt-4-turbo, gpt-3.5-turbo
    • Ollama: llama3, codellama, mistral, phi など(モデル選択を参照)

実行例

# カレントディレクトリを分析して、OpenAIを使用した認証機能の実装提案を生成
npx hassak analyze --ticket "ユーザー認証機能をFirebaseAuthからAuth0に移行する" --model gpt-4o

# 指定したプロジェクトを分析して、Ollamaを使用したAPIエンドポイント追加の提案を生成
npx hassak analyze --ticket "ユーザープロフィール編集用のAPIエンドポイントを追加する" --path ./my-project --model llama3

# Ollamaのcodellama(コード特化モデル)を使用
npx hassak analyze --ticket "検索機能の最適化" --model codellama

Ollamaのインストールと設定

インストール

# macOS
brew install ollama

# Linux (Debian/Ubuntu)
curl -fsSL https://ollama.com/install.sh | sh

# Windows
# https://ollama.com/download/windows からインストーラーをダウンロード

モデルのダウンロード

# Llama 3 (8B) - 最新の高性能モデル
ollama pull llama3

# CodeLlama - コーディングに特化
ollama pull codellama

# Mistral - バランスの良いモデル
ollama pull mistral

# Phi-3 - Microsoftの小型高性能モデル
ollama pull phi

Ollamaサーバーの起動

# サーバーを起動
ollama serve

モデル選択ガイド

Ollama(ローカルモデル)

  • llama3: 一般的なタスクに最適、バランスが良い
  • codellama: コード生成、解析に特化(コーディングタスクに推奨)
  • mistral: 少ないリソースでも比較的高性能
  • phi: 小型ながら優れた推論能力

OpenAI(クラウドモデル)

  • gpt-4o: 最新・最高性能(デフォルト)
  • gpt-4-turbo: 高性能、長いコンテキスト対応
  • gpt-3.5-turbo: より高速、コスト効率が良い

出力ファイル

分析結果は .hassak ディレクトリに保存されます:

  • hassak-analysis.json - プロジェクト分析結果(ファイル構造とサマリー)
  • hassak-analysis.json.proposal.json - 実装提案のJSON形式データ
  • hassak-analysis.json.structure.json - プロジェクト構造のJSONデータ
  • last-proposal-response.txt - AIが生成した生の提案テキスト

処理フロー

hassakの処理フロー:

  1. ディレクトリ構造の分析: プロジェクト内のディレクトリとファイルを再帰的にスキャン
  2. ファイル内容の読み取り: 各ファイルの内容を取得
  3. コードのサマリー作成: AIを使用してコードファイルの内容を要約
  4. 実装提案の生成: タスクチケットと分析結果に基づいて、詳細な実装提案を生成

プロバイダーの選択方法

hassakは自動的にLLMプロバイダーを判断します:

  • OPENAI_API_KEY 環境変数が設定されていて、モデル名が gpt- で始まる場合、OpenAIを使用
  • それ以外の場合、Ollamaを使用(要インストール)
  • --model オプションでモデルを明示的に指定できます

開発

# リポジトリをクローン
git clone https://github.com/kspace-trk/hassak.git
cd hassak

# 依存関係をインストール
npm install

# 開発モードでビルド
npm run dev

# ビルド
npm run build

# テスト
npm run test

注意事項

  • OpenAI APIキーを使用する場合は、環境変数 OPENAI_API_KEY に設定するか、実行時に入力を求められます
  • Ollamaを使用する場合は、事前にOllamaをインストールし、必要なモデルをダウンロードしておく必要があります
  • 大規模なプロジェクトでは、分析に時間がかかる場合があります
  • AIの提案は参考情報です。実際の実装は開発者の判断が必要です
  • OpenAI APIを使用する場合は、コストに注意してください

ライセンス

MIT