repomap

package
v0.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedLanguages = map[string]*sitter.Language{

	".go":  golang.GetLanguage(),
	".js":  javascript.GetLanguage(),
	".ts":  typescript.GetLanguage(),
	".py":  python.GetLanguage(),
	".jsx": javascript.GetLanguage(),
	".tsx": typescript.GetLanguage(),
	".mjs": javascript.GetLanguage(),

	".rs":   rust.GetLanguage(),
	".java": java.GetLanguage(),
	".c":    c.GetLanguage(),
	".h":    c.GetLanguage(),
	".cpp":  cpp.GetLanguage(),
	".hpp":  cpp.GetLanguage(),
	".cc":   cpp.GetLanguage(),
	".rb":   ruby.GetLanguage(),

	".kt":    kotlin.GetLanguage(),
	".kts":   kotlin.GetLanguage(),
	".swift": swift.GetLanguage(),
	".cs":    csharp.GetLanguage(),
	".scala": scala.GetLanguage(),
	".php":   php.GetLanguage(),

	".ex":  elixir.GetLanguage(),
	".exs": elixir.GetLanguage(),
	".lua": lua.GetLanguage(),

	".css":  css.GetLanguage(),
	".scss": css.GetLanguage(),

	".html": html.GetLanguage(),
	".htm":  html.GetLanguage(),

	".yaml":       yaml.GetLanguage(),
	".yml":        yaml.GetLanguage(),
	".toml":       toml.GetLanguage(),
	".sql":        sql.GetLanguage(),
	".sh":         bash.GetLanguage(),
	".bash":       bash.GetLanguage(),
	".zsh":        bash.GetLanguage(),
	".md":         markdown.GetLanguage(),
	".markdown":   markdown.GetLanguage(),
	"Dockerfile":  dockerfile.GetLanguage(),
	"Makefile":    nil,
	".mk":         nil,
	"Jenkinsfile": nil,

	".vue":    nil,
	".svelte": nil,
}

SupportedLanguages は対応言語のマップ

Functions

func GetLanguage

func GetLanguage(filePath string) *sitter.Language

GetLanguage はファイル拡張子から言語を取得

func IsConfigFile added in v0.31.0

func IsConfigFile(filePath string) bool

IsConfigFile は設定ファイル系言語かどうか(正規表現ベース抽出用)

func IsSFCFile added in v0.31.0

func IsSFCFile(filePath string) bool

IsSFCFile は Vue/Svelte SFC ファイルかどうか(Issue #63)

func IsSupportedFile

func IsSupportedFile(filePath string) bool

IsSupportedFile はサポートされているファイルかどうか

func IsTailwindConfigFile added in v0.31.0

func IsTailwindConfigFile(filePath string) bool

IsTailwindConfigFile は Tailwind CSS 設定ファイルかどうか(Issue #65)

func SaveCache added in v0.46.0

func SaveCache(cache *RepoMapCache) error

SaveCache はキャッシュを保存する

Types

type CachedFile added in v0.46.0

type CachedFile struct {
	Path    string    `json:"path"`
	ModTime time.Time `json:"mod_time"`
	Symbols []Symbol  `json:"symbols"`
}

CachedFile はキャッシュされたファイル情報

type FileSymbols

type FileSymbols struct {
	Path    string
	Symbols []Symbol
}

FileSymbols はファイル内のシンボル一覧

func ExtractSymbols

func ExtractSymbols(filePath string) (*FileSymbols, error)

ExtractSymbols はファイルからシンボルを抽出

type RepoMap

type RepoMap struct {
	RootPath  string
	Files     []*FileSymbols
	MaxTokens int // トークン制限
}

RepoMap はリポジトリのコード構造マップ

func NewRepoMap

func NewRepoMap(rootPath string, maxTokens int) *RepoMap

NewRepoMap は新しいRepoMapを作成

func (*RepoMap) Build

func (rm *RepoMap) Build() error

Build はリポジトリをスキャンしてマップを構築(並列処理 + キャッシュ対応)

func (*RepoMap) Generate

func (rm *RepoMap) Generate() string

Generate はRepo Map文字列を生成

func (*RepoMap) GetSymbolCount

func (rm *RepoMap) GetSymbolCount() int

GetSymbolCount はシンボル総数を返す

type RepoMapCache added in v0.46.0

type RepoMapCache struct {
	RootPath  string                 `json:"root_path"`
	UpdatedAt time.Time              `json:"updated_at"`
	Files     map[string]*CachedFile `json:"files"`
}

RepoMapCache はRepoMapのキャッシュ

func LoadCache added in v0.46.0

func LoadCache(rootPath string) (*RepoMapCache, error)

LoadCache はキャッシュを読み込む

type SFCSection added in v0.31.0

type SFCSection struct {
	Tag       string // "script", "style", "template"
	Content   string
	StartLine int
	Lang      string // "ts", "scss" など
}

SFCSection は SFC の各セクション情報

type Symbol

type Symbol struct {
	Name       string // シンボル名
	Kind       string // "function", "struct", "class", "method", "interface"
	Signature  string // 完全なシグネチャ(func CreateUser(name string) error)
	FilePath   string // ファイルパス
	Line       int    // 行番号
	References int    // 参照回数(ランキング用)
}

Symbol はコード内のシンボル(関数、クラス、構造体等)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL