ocerebro 0.4.21 → 0.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/mcp/server.py +25 -18
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/mcp/server.py
CHANGED
|
@@ -556,9 +556,12 @@ class CerebroMCP:
|
|
|
556
556
|
"""Gera memória ativa e escreve no diretório nativo do Claude Code para auto-load."""
|
|
557
557
|
project = args.get("project") or self._detect_project()
|
|
558
558
|
|
|
559
|
-
#
|
|
560
|
-
|
|
561
|
-
has_memories =
|
|
559
|
+
# Auto-sync: se official/<project>/ vazio, sincroniza
|
|
560
|
+
project_official = self.cerebro_path / "official" / project
|
|
561
|
+
has_memories = (
|
|
562
|
+
project_official.exists()
|
|
563
|
+
and any(project_official.rglob("*.md"))
|
|
564
|
+
)
|
|
562
565
|
if not has_memories:
|
|
563
566
|
self._sync({"project": project})
|
|
564
567
|
|
|
@@ -661,42 +664,46 @@ class CerebroMCP:
|
|
|
661
664
|
session_id = self.session_manager.get_session_id()
|
|
662
665
|
|
|
663
666
|
lines = [
|
|
664
|
-
"
|
|
665
|
-
"
|
|
666
|
-
"
|
|
667
|
+
"=" * 60,
|
|
668
|
+
"OCEREBRO STATUS",
|
|
669
|
+
"=" * 60,
|
|
667
670
|
"",
|
|
668
671
|
f"Session ID: {session_id}",
|
|
669
672
|
f"Path: {self.cerebro_path.absolute()}",
|
|
670
673
|
"",
|
|
671
674
|
]
|
|
672
675
|
|
|
673
|
-
# Contagem de memórias por tipo (
|
|
676
|
+
# Contagem de memórias por tipo (metadata DB)
|
|
674
677
|
try:
|
|
675
678
|
import sqlite3
|
|
676
|
-
conn = sqlite3.connect(
|
|
679
|
+
conn = sqlite3.connect(
|
|
680
|
+
str(self.cerebro_path / "index" / "metadata.db")
|
|
681
|
+
)
|
|
677
682
|
cursor = conn.cursor()
|
|
678
|
-
cursor.execute(
|
|
683
|
+
cursor.execute(
|
|
684
|
+
"SELECT type, COUNT(*) FROM memories "
|
|
685
|
+
"GROUP BY type ORDER BY COUNT(*) DESC"
|
|
686
|
+
)
|
|
679
687
|
type_counts = cursor.fetchall()
|
|
680
688
|
conn.close()
|
|
681
689
|
|
|
682
690
|
if type_counts:
|
|
683
691
|
total = sum(c for _, c in type_counts)
|
|
684
|
-
lines.append(f"
|
|
692
|
+
lines.append(f"Memorias: {total} total")
|
|
685
693
|
lines.append("")
|
|
686
694
|
lines.append("Por tipo:")
|
|
687
|
-
for
|
|
688
|
-
|
|
689
|
-
lines.append(f" {icon} {entity_type}: {count}")
|
|
695
|
+
for mem_type, count in type_counts:
|
|
696
|
+
lines.append(f" - {mem_type}: {count}")
|
|
690
697
|
else:
|
|
691
|
-
lines.append("
|
|
698
|
+
lines.append("Memorias: 0")
|
|
692
699
|
except Exception:
|
|
693
|
-
lines.append("
|
|
700
|
+
lines.append("Memorias: (banco nao acessivel)")
|
|
694
701
|
|
|
695
702
|
lines.append("")
|
|
696
703
|
lines.append("Storages:")
|
|
697
|
-
lines.append(f"
|
|
698
|
-
lines.append(f"
|
|
699
|
-
lines.append(f"
|
|
704
|
+
lines.append(f" Raw: {self.cerebro_path / 'raw'}")
|
|
705
|
+
lines.append(f" Working: {self.cerebro_path / 'working'}")
|
|
706
|
+
lines.append(f" Official: {self.cerebro_path / 'official'}")
|
|
700
707
|
|
|
701
708
|
return "\n".join(lines)
|
|
702
709
|
|