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:
@@ -49,6 +49,19 @@ sqlite3 registry.db ".schema"
|
||||
|
||||
**Regla:** Si necesitas saber si algo existe o hay algo similar, haz la consulta FTS5 sobre la BD. No asumas que no existe sin consultar primero.
|
||||
|
||||
### Schema rapido
|
||||
|
||||
**functions** — columnas: `id, name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, example, tested, tests, test_file_path, file_path, created_at, updated_at, props, emits, has_state, framework, variant, notes, documentation, code, content_hash, source_repo, source_license, source_file`
|
||||
- Enums: `kind`(function|pipeline|component) `purity`(pure|impure) `lang`(go|py|bash|ps)
|
||||
- Dominios: core, infra, finance, datascience, cybersecurity, shell, tui, pipelines
|
||||
|
||||
**types** — columnas: `id, name, lang, domain, version, algebraic, definition, description, tags, uses_types, file_path, created_at, updated_at, examples, notes, documentation, code, content_hash, source_repo, source_license, source_file`
|
||||
- Enums: `algebraic`(product|sum)
|
||||
|
||||
**FTS5 (columnas buscables):**
|
||||
- `functions_fts`: id, name, description, tags, signature, domain, example, notes, documentation, code
|
||||
- `types_fts`: id, name, description, tags, domain, examples, notes, documentation, code
|
||||
|
||||
---
|
||||
|
||||
## Estructura
|
||||
|
||||
@@ -14,3 +14,4 @@ Reglas operativas del proyecto. Cada archivo es una regla independiente.
|
||||
| 08 | [tag_launcher.md](tag_launcher.md) | Tag launcher para Pipeline Launcher TUI |
|
||||
| 09 | [go_packages.md](go_packages.md) | Nombre de paquete Go = nombre del directorio |
|
||||
| 10 | [apps_vs_functions.md](apps_vs_functions.md) | Codigo reutilizable en functions/, no reutilizable en apps/ |
|
||||
| 11 | [sources.md](sources.md) | Extraccion de funciones desde repos externos |
|
||||
|
||||
@@ -11,7 +11,7 @@ Via variables de entorno:
|
||||
METABASE_URL=http://localhost:3000 \
|
||||
METABASE_ADMIN_EMAIL=admin@example.com \
|
||||
METABASE_ADMIN_PASSWORD=secret \
|
||||
REGISTRY_DB_PATH=/registry.db \
|
||||
REGISTRY_DB_PATH=/data/registry/registry.db \
|
||||
python main.py
|
||||
|
||||
Via argumentos CLI:
|
||||
@@ -357,7 +357,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
# Registry DB path (ruta dentro del contenedor Docker)
|
||||
p.add_argument(
|
||||
"--registry-db-path",
|
||||
default=os.environ.get("REGISTRY_DB_PATH", "/registry.db"),
|
||||
default=os.environ.get("REGISTRY_DB_PATH", "/data/registry/registry.db"),
|
||||
dest="registry_db_path",
|
||||
help=(
|
||||
"Ruta al registry.db DENTRO del contenedor Docker "
|
||||
|
||||
@@ -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