mirror of
https://github.com/syntrex-lab/gomcp.git
synced 2026-05-09 03:22:37 +02:00
initial: Syntrex extraction from sentinel-community (615 files)
This commit is contained in:
commit
2c50c993b1
175 changed files with 32396 additions and 0 deletions
46
internal/domain/crystal/crystal.go
Normal file
46
internal/domain/crystal/crystal.go
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Package crystal defines domain entities for code crystal indexing (C³).
|
||||
package crystal
|
||||
|
||||
import "context"
|
||||
|
||||
// Primitive represents a code primitive extracted from a source file.
|
||||
type Primitive struct {
|
||||
PType string `json:"ptype"` // function, class, method, variable, etc.
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"` // signature or definition
|
||||
SourceLine int `json:"source_line"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
}
|
||||
|
||||
// Crystal represents an indexed code file with extracted primitives.
|
||||
type Crystal struct {
|
||||
Path string `json:"path"` // file path (primary key)
|
||||
Name string `json:"name"` // file basename
|
||||
TokenCount int `json:"token_count"`
|
||||
ContentHash string `json:"content_hash"`
|
||||
Primitives []Primitive `json:"primitives"`
|
||||
PrimitivesCount int `json:"primitives_count"`
|
||||
IndexedAt float64 `json:"indexed_at"` // Unix timestamp
|
||||
SourceMtime float64 `json:"source_mtime"` // Unix timestamp
|
||||
SourceHash string `json:"source_hash"`
|
||||
LastValidated float64 `json:"last_validated"` // Unix timestamp, 0 if never
|
||||
HumanConfirmed bool `json:"human_confirmed"`
|
||||
}
|
||||
|
||||
// CrystalStats holds aggregate statistics about the crystal store.
|
||||
type CrystalStats struct {
|
||||
TotalCrystals int `json:"total_crystals"`
|
||||
TotalPrimitives int `json:"total_primitives"`
|
||||
TotalTokens int `json:"total_tokens"`
|
||||
ByExtension map[string]int `json:"by_extension"`
|
||||
}
|
||||
|
||||
// CrystalStore defines the interface for crystal persistence.
|
||||
type CrystalStore interface {
|
||||
Upsert(ctx context.Context, crystal *Crystal) error
|
||||
Get(ctx context.Context, path string) (*Crystal, error)
|
||||
Delete(ctx context.Context, path string) error
|
||||
List(ctx context.Context, pattern string, limit int) ([]*Crystal, error)
|
||||
Search(ctx context.Context, query string, limit int) ([]*Crystal, error)
|
||||
Stats(ctx context.Context) (*CrystalStats, error)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue