mcpField
G
gitlab-search

gitlab-search

github.com/grandcamel開発498 回インストール41 週間前に更新
リポジトリ

gitlab-search について

gitlab-searchは、`glab api`を使ってGitLabを検索するスキルです。プロジェクト、コード、課題などを全体・プロジェクト・グループ単位で検索し、ページネーションにも対応します。

主な機能

  1. 01プロジェクト、課題、マージリクエストの検索
  2. 02コード、コミット、ユーザーの検索
  3. 03全体・プロジェクト・グループ単位の検索
  4. 04検索結果のページネーション
  5. 05`glab api`によるエンドポイント呼び出し

活用シーン

  1. 01アクセス可能なプロジェクトからコードを探す
  2. 02関連する課題やマージリクエストを特定する
  3. 03コミットやWikiの内容を調べる

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/grandcamel/gitlab-assistant-skills --skill gitlab-search

インストール後、Claude Code で/gitlab-searchを入力して読み込まれたか確認します。

詳細

検索スキル

glab api の生エンドポイント呼び出しを使用して、GitLab で検索操作を行います。

クイックリファレンス

操作コマンドパターンリスク
プロジェクトを検索glab api "search?scope=projects&search=..."-
イシューを検索glab api "search?scope=issues&search=..."-
MR を検索glab api "search?scope=merge_requests&search=..."-
コードを検索glab api "search?scope=blobs&search=..."-
コミットを検索glab api "search?scope=commits&search=..."-
ユーザーを検索glab api "search?scope=users&search=..."-
Wiki を検索glab api "search?scope=wiki_blobs&search=..."-
プロジェクト検索glab api "projects/:id/search?scope=...&search=..."-
グループ検索glab api "groups/:id/search?scope=...&search=..."-

リスクの凡例:- 安全 | ⚠️ 注意 | ⚠️⚠️ 警告 | ⚠️⚠️⚠️ 危険

このスキルを使う場面

必ず使用する場合:

  • ユーザーが GitLab 全体から何かを検索または見つけたい場合
  • ユーザーが「検索」「見つける」「クエリ」「探す」と言及した場合
  • ユーザーが「どこにあるか」「どのプロジェクトにあるか」「すべて見つけて」と尋ねた場合
  • ユーザーがコード、イシュー、MR、コミット、Wiki を検索したい場合

使用しない場合:

  • ユーザーがすべての項目を一覧表示したい場合(専用スキル:gitlab-issue、gitlab-mr などを使用)
  • ユーザーが正確なプロジェクト/イシュー/MR ID を把握している場合
  • ユーザーがローカルファイルを検索したい場合(ローカルで grep/find を使用)

API の前提条件

必須のトークンスコープ: read_api または api

注: 検索結果には、認証済みユーザーがアクセスできるリソースのみが含まれます。

検索スコープ

スコープ説明利用可能な範囲
projectsプロジェクト名/説明を検索グローバル、グループ
issuesイシューのタイトル/説明を検索グローバル、グループ、プロジェクト
merge_requestsMR のタイトル/説明を検索グローバル、グループ、プロジェクト
milestonesマイルストーンのタイトルを検索グローバル、グループ、プロジェクト
snippet_titlesスニペットのタイトルを検索グローバル
wiki_blobsWiki の内容を検索グローバル、グループ、プロジェクト
commitsコミットメッセージを検索グローバル、グループ、プロジェクト
blobsコード/ファイルの内容を検索グローバル、グループ、プロジェクト
notesコメントを検索グローバル、グループ、プロジェクト
usersユーザー名/氏名を検索グローバル

使用可能なコマンド

グローバル検索
# Search projects by name
glab api "search?scope=projects&search=api+gateway" --method GET

# Search issues globally
glab api "search?scope=issues&search=authentication+bug" --method GET

# Search merge requests
glab api "search?scope=merge_requests&search=refactor" --method GET

# Search code (blobs)
glab api "search?scope=blobs&search=TODO+fixme" --method GET

# Search commits
glab api "search?scope=commits&search=fix+security" --method GET

# Search wiki content
glab api "search?scope=wiki_blobs&search=installation" --method GET

# Search users
glab api "search?scope=users&search=john" --method GET

# Search milestones
glab api "search?scope=milestones&search=v2.0" --method GET

# Search comments/notes
glab api "search?scope=notes&search=approved" --method GET
プロジェクトスコープの検索
# Search issues in specific project
glab api "projects/123/search?scope=issues&search=bug" --method GET

# Search code in project
glab api "projects/123/search?scope=blobs&search=function+authenticate" --method GET

# Search commits in project
glab api "projects/123/search?scope=commits&search=fix" --method GET

# Search wiki in project
glab api "projects/123/search?scope=wiki_blobs&search=setup" --method GET

# Search MRs in project
glab api "projects/123/search?scope=merge_requests&search=feature" --method GET

# Search notes in project
glab api "projects/123/search?scope=notes&search=LGTM" --method GET

# Search milestones in project
glab api "projects/123/search?scope=milestones&search=sprint" --method GET

# Using project path (URL-encoded)
glab api "projects/$(echo 'mygroup/myproject' | jq -Rr @uri)/search?scope=blobs&search=TODO"
グループスコープの検索
# Search issues in group
glab api "groups/456/search?scope=issues&search=urgent" --method GET

# Search code across group
glab api "groups/456/search?scope=blobs&search=api+key" --method GET

# Search projects in group
glab api "groups/456/search?scope=projects&search=backend" --method GET

# Search MRs in group
glab api "groups/456/search?scope=merge_requests&search=hotfix" --method GET

# Using group path (URL-encoded)
glab api "groups/$(echo 'mygroup' | jq -Rr @uri)/search?scope=issues&search=bug"
ページネーション
# Get more results per page
glab api "search?scope=issues&search=bug&per_page=50" --method GET

# Get specific page
glab api "search?scope=issues&search=bug&per_page=50&page=2" --method GET

# Auto-paginate all results
glab api "search?scope=projects&search=api" --paginate
高度な検索構文
# Exact phrase search (use quotes, URL-encoded)
glab api "search?scope=blobs&search=%22exact+phrase%22" --method GET

# Filename filter in code search
glab api "search?scope=blobs&search=authenticate+filename:auth.py" --method GET

# Extension filter
glab api "search?scope=blobs&search=class+extension:java" --method GET

# Path filter
glab api "search?scope=blobs&search=config+path:src/main" --method GET

出力の処理

主なフィールドの抽出
# Get issue IDs and titles
glab api "search?scope=issues&search=bug" | \
  jq -r '.[] | "\(.project_id)#\(.iid): \(.title)"'

# Get project names and URLs
glab api "search?scope=projects&search=api" | \
  jq -r '.[] | "\(.path_with_namespace): \(.web_url)"'

# Get code matches with file paths
glab api "search?scope=blobs&search=TODO" | \
  jq -r '.[] | "\(.project_id):\(.path):\(.startline) \(.data)"'

# Get commit info
glab api "search?scope=commits&search=fix" | \
  jq -r '.[] | "\(.short_id): \(.title)"'
結果数のカウント
# Count matching issues
glab api "search?scope=issues&search=bug" --paginate | jq 'length'

# Count by project
glab api "search?scope=issues&search=bug" --paginate | \
  jq 'group_by(.project_id) | map({project: .[0].project_id, count: length})'

よくあるワークフロー

ワークフロー 1:コードベース内のすべての TODO を見つける
# Search for TODO comments across all accessible projects
glab api "search?scope=blobs&search=TODO" --paginate | \
  jq -r '.[] | "\(.project_id):\(.path):\(.startline)"'
ワークフロー 2:チームのプロジェクト全体からイシューを見つける
# Get group ID
group_id=$(glab api "groups/$(echo 'myteam' | jq -Rr @uri)" | jq -r '.id')

# Search for critical issues in group
glab api "groups/$group_id/search?scope=issues&search=critical" --paginate | \
  jq -r '.[] | "\(.references.full): \(.title)"'
ワークフロー 3:機能の開発担当者を見つける
# Search commits mentioning feature
glab api "projects/123/search?scope=commits&search=authentication" | \
  jq -r '.[] | "\(.author_name): \(.title)"'
ワークフロー 4:セキュリティ関連のコードを見つける
# Search for potential security patterns
for term in "password" "secret" "api_key" "token"; do
  echo "=== Searching for: $term ==="
  glab api "projects/123/search?scope=blobs&search=$term" | \
    jq -r '.[] | "\(.path):\(.startline)"'
done
ワークフロー 5:関連する MR を見つける
# Search MRs by feature name
glab api "search?scope=merge_requests&search=oauth+integration" | \
  jq -r '.[] | "!\(.iid) [\(.state)]: \(.title)"'

検索のヒント

効果的な検索語
対象検索例
バグ修正fix bug、resolve issue、patch
機能add feature、implement、new
リファクタリングrefactor、cleanup、improve
セキュリティsecurity、vulnerability、CVE
パフォーマンスperformance、optimize、speed
ドキュメントdocs、readme、documentation
特殊文字の URL エンコード
# Space -> +
glab api "search?scope=issues&search=fix+bug"

# Quotes (for exact match) -> %22
glab api "search?scope=blobs&search=%22exact+phrase%22"

# Hash -> %23
glab api "search?scope=issues&search=issue%231234"

トラブルシューティング

問題原因解決策
結果が空一致する項目がない、またはアクセス権がない検索語を確認し、権限を確認してください
結果が一部のみページネーションが必要--paginate フラグを使用してください
400 Bad Requestスコープが無効エンドポイントで有効なスコープか確認してください
検索が遅い結果セットが大きいフィルターを追加するか、スコープを絞り込んでください
コードの検索結果がない基本検索が無効管理者に連絡して高度な検索を有効にしてください

検索の制限事項

  • 基本検索ではタイトル/説明のみを検索します
  • コード検索には高度な検索(Elasticsearch)が必要です
  • 結果はアクセス可能なリソースに限定されます
  • 大規模な検索にはレート制限が適用されます

Related Documentation

コメント