chore: schema rápido en CLAUDE.md, sync Metabase en CLI, fix main.py
Agrega documentación de schema rápido en CLAUDE.md, regla sources en INDEX. CLI fn index sincroniza registry.db a directorio Metabase si existe. fn show muestra campos source_*. Fix import en metabase_registry/main.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,6 +105,18 @@ func cmdIndex() {
|
||||
// Flush WAL to main db file so external readers (e.g. Metabase) see changes.
|
||||
db.WalCheckpoint()
|
||||
|
||||
// Sync registry.db to Metabase mount directory if it exists.
|
||||
metabaseCopy := filepath.Join(r, ".metabase-registry", "registry.db")
|
||||
if _, err := os.Stat(filepath.Dir(metabaseCopy)); err == nil {
|
||||
src := filepath.Join(r, dbName)
|
||||
data, err := os.ReadFile(src)
|
||||
if err == nil {
|
||||
if err := os.WriteFile(metabaseCopy, data, 0666); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "warning: could not sync to metabase: %v\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("Indexed %d functions, %d types, %d apps\n", result.Functions, result.Types, result.Apps)
|
||||
for _, e := range result.ValidationErrors {
|
||||
fmt.Fprintf(os.Stderr, " INVALID: %s\n", e)
|
||||
@@ -341,6 +353,11 @@ func printFunction(f *registry.Function) {
|
||||
if f.Code != "" {
|
||||
fmt.Printf("\nCode:\n%s\n", f.Code)
|
||||
}
|
||||
if f.SourceRepo != "" {
|
||||
fmt.Printf("Source repo: %s\n", f.SourceRepo)
|
||||
fmt.Printf("Source license: %s\n", f.SourceLicense)
|
||||
fmt.Printf("Source file: %s\n", f.SourceFile)
|
||||
}
|
||||
if f.Kind == registry.KindComponent {
|
||||
fmt.Printf("Framework: %s\n", f.Framework)
|
||||
if f.HasState != nil {
|
||||
@@ -365,6 +382,11 @@ func printType(t *registry.Type) {
|
||||
if len(t.UsesTypes) > 0 {
|
||||
fmt.Printf("Uses types: %s\n", strings.Join(t.UsesTypes, ", "))
|
||||
}
|
||||
if t.SourceRepo != "" {
|
||||
fmt.Printf("Source repo: %s\n", t.SourceRepo)
|
||||
fmt.Printf("Source license: %s\n", t.SourceLicense)
|
||||
fmt.Printf("Source file: %s\n", t.SourceFile)
|
||||
}
|
||||
if t.Definition != "" {
|
||||
fmt.Printf("\nDefinition:\n%s\n", t.Definition)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user