Skip to content

dashboard-sinapsis: crash al leer _catalog.json (expected list, got dict) #6

Description

@fvayas

Descripción

_generate-dashboard.py crashea al intentar generar el dashboard porque asume que _catalog.json es una lista plana, pero el catálogo se distribuye como dict con keys globalSkills / librarySkills.

Reproducir

Con la instalación limpia de v4.4.1:

python3 ~/.claude/skills/_generate-dashboard.py

Error

ERROR: 'str' object has no attribute 'get'
Traceback (most recent call last):
  File "_generate-dashboard.py", line 373, in <module>
    main()
  File "_generate-dashboard.py", line 337, in main
    skills_total, skills_g, skills_c, skills_s = collect_skills()
  File "_generate-dashboard.py", line 130, in collect_skills
    stubs = sum(1 for s in cat if s.get('description', '').startswith('(auto-generated'))
  File "_generate-dashboard.py", line 130, in <genexpr>
    stubs = sum(1 for s in cat if s.get('description', '').startswith('(auto-generated'))
AttributeError: 'str' object has no attribute 'get'

Causa

collect_skills() en línea 127:

def collect_skills():
    cat = load_json(SKILLS / '_catalog.json', [])   # fallback es []
    total = len(cat)
    stubs = sum(1 for s in cat if s.get('description', '').startswith('(auto-generated'))

Itera cat directamente como si fuese list[dict]. Pero el _catalog.json del repo (core/_catalog.json) es:

{
  "version": "4.3.1",
  "system": "sinapsis",
  "globalSkills": [ {...}, {...} ],
  "librarySkills": []
}

Al iterar un dict se obtienen las keys (strings), por eso s.get(...) explota.

Fix sugerido

def collect_skills():
    cat = load_json(SKILLS / '_catalog.json', {})
    skills = cat.get('globalSkills', []) + cat.get('librarySkills', [])
    total = len(skills)
    stubs = sum(1 for s in skills if s.get('description', '').startswith('(auto-generated'))
    complete = total - stubs
    globals_ = sum(1 for s in skills if s.get('type') == 'global')
    return total, globals_, complete - globals_, stubs

Entorno

  • macOS 14
  • Python 3.9.6
  • Sinapsis v4.4.1 (clean upgrade desde 4.3.1)

Gracias por el trabajo en el proyecto 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions