mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
chore: rename entity_type to note_type (#600)
Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,7 +61,7 @@ async def run_doctor() -> None:
|
||||
api_note = Entity(
|
||||
title=api_note_title,
|
||||
directory="doctor",
|
||||
entity_type="note",
|
||||
note_type="note",
|
||||
content_type="text/markdown",
|
||||
content=f"# {api_note_title}\n\n- [note] API to file check",
|
||||
entity_metadata={"tags": ["doctor"]},
|
||||
|
||||
@@ -775,16 +775,16 @@ def display_project_info(
|
||||
|
||||
console.print(stats_table)
|
||||
|
||||
# Entity types
|
||||
if info.statistics.entity_types:
|
||||
entity_types_table = Table(title="Entity Types")
|
||||
entity_types_table.add_column("Type", style="blue")
|
||||
entity_types_table.add_column("Count", style="green")
|
||||
# Note types
|
||||
if info.statistics.note_types:
|
||||
note_types_table = Table(title="Note Types")
|
||||
note_types_table.add_column("Type", style="blue")
|
||||
note_types_table.add_column("Count", style="green")
|
||||
|
||||
for entity_type, count in info.statistics.entity_types.items():
|
||||
entity_types_table.add_row(entity_type, str(count))
|
||||
for note_type, count in info.statistics.note_types.items():
|
||||
note_types_table.add_row(note_type, str(count))
|
||||
|
||||
console.print(entity_types_table)
|
||||
console.print(note_types_table)
|
||||
|
||||
# Most connected entities
|
||||
if info.statistics.most_connected_entities: # pragma: no cover
|
||||
@@ -815,7 +815,7 @@ def display_project_info(
|
||||
)
|
||||
recent_table.add_row(
|
||||
entity["title"],
|
||||
entity["entity_type"],
|
||||
entity["note_type"],
|
||||
updated_at.strftime("%Y-%m-%d %H:%M"),
|
||||
)
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ def _resolve_project_name(project: Optional[str]) -> Optional[str]:
|
||||
|
||||
def _render_validate_table(data: dict) -> None:
|
||||
"""Render a validation report dict as a Rich table."""
|
||||
entity_type = data.get("entity_type")
|
||||
title_label = entity_type or "all"
|
||||
note_type = data.get("note_type")
|
||||
title_label = note_type or "all"
|
||||
|
||||
table = Table(title=f"Schema Validation: {title_label}")
|
||||
table.add_column("Note", style="cyan")
|
||||
@@ -84,12 +84,12 @@ def _render_validate_table(data: dict) -> None:
|
||||
|
||||
def _render_infer_table(data: dict) -> None:
|
||||
"""Render an inference report dict as a Rich table."""
|
||||
entity_type = data.get("entity_type", "")
|
||||
note_type = data.get("note_type", "")
|
||||
notes_analyzed = data.get("notes_analyzed", 0)
|
||||
suggested_required = data.get("suggested_required", [])
|
||||
suggested_optional = data.get("suggested_optional", [])
|
||||
|
||||
console.print(f"\n[bold]Analyzing {notes_analyzed} notes with type: {entity_type}...[/bold]\n")
|
||||
console.print(f"\n[bold]Analyzing {notes_analyzed} notes with type: {note_type}...[/bold]\n")
|
||||
|
||||
table = Table(title="Field Frequencies")
|
||||
table.add_column("Field", style="cyan")
|
||||
@@ -126,7 +126,7 @@ def _render_infer_table(data: dict) -> None:
|
||||
|
||||
def _render_diff_output(data: dict) -> None:
|
||||
"""Render a drift report dict as Rich output."""
|
||||
entity_type = data.get("entity_type", "")
|
||||
note_type = data.get("note_type", "")
|
||||
new_fields = data.get("new_fields", [])
|
||||
dropped_fields = data.get("dropped_fields", [])
|
||||
cardinality_changes = data.get("cardinality_changes", [])
|
||||
@@ -134,10 +134,10 @@ def _render_diff_output(data: dict) -> None:
|
||||
has_drift = new_fields or dropped_fields or cardinality_changes
|
||||
|
||||
if not has_drift:
|
||||
console.print(f"[green]No drift detected for {entity_type} schema.[/green]")
|
||||
console.print(f"[green]No drift detected for {note_type} schema.[/green]")
|
||||
return
|
||||
|
||||
console.print(f"\n[bold]Schema drift detected for {entity_type}:[/bold]\n")
|
||||
console.print(f"\n[bold]Schema drift detected for {note_type}:[/bold]\n")
|
||||
|
||||
if new_fields:
|
||||
console.print("[green]+ New fields (common in notes, not in schema):[/green]")
|
||||
@@ -233,7 +233,7 @@ def validate(
|
||||
|
||||
@schema_app.command()
|
||||
def infer(
|
||||
entity_type: Annotated[
|
||||
note_type: Annotated[
|
||||
str,
|
||||
typer.Argument(help="Note type to analyze (e.g., person, meeting)"),
|
||||
],
|
||||
@@ -268,7 +268,7 @@ def infer(
|
||||
with force_routing(local=local, cloud=cloud):
|
||||
result = run_with_cleanup(
|
||||
mcp_schema_infer(
|
||||
note_type=entity_type,
|
||||
note_type=note_type,
|
||||
threshold=threshold,
|
||||
project=project_name,
|
||||
output_format="json",
|
||||
@@ -285,7 +285,7 @@ def infer(
|
||||
|
||||
# Handle zero notes
|
||||
if result.get("notes_analyzed", 0) == 0:
|
||||
console.print(f"[yellow]No notes found with type: {entity_type}[/yellow]")
|
||||
console.print(f"[yellow]No notes found with type: {note_type}[/yellow]")
|
||||
return
|
||||
|
||||
_render_infer_table(result)
|
||||
@@ -293,7 +293,7 @@ def infer(
|
||||
if save:
|
||||
console.print(
|
||||
f"\n[yellow]--save not yet implemented. "
|
||||
f"Copy the schema above into schema/{entity_type}.md[/yellow]"
|
||||
f"Copy the schema above into schema/{note_type}.md[/yellow]"
|
||||
)
|
||||
except ValueError as e:
|
||||
console.print(f"[red]Error: {e}[/red]")
|
||||
@@ -308,7 +308,7 @@ def infer(
|
||||
|
||||
@schema_app.command()
|
||||
def diff(
|
||||
entity_type: Annotated[
|
||||
note_type: Annotated[
|
||||
str,
|
||||
typer.Argument(help="Note type to check for drift"),
|
||||
],
|
||||
@@ -337,7 +337,7 @@ def diff(
|
||||
with force_routing(local=local, cloud=cloud):
|
||||
result = run_with_cleanup(
|
||||
mcp_schema_diff(
|
||||
note_type=entity_type,
|
||||
note_type=note_type,
|
||||
project=project_name,
|
||||
output_format="json",
|
||||
)
|
||||
|
||||
@@ -493,7 +493,7 @@ def search_notes(
|
||||
page=page,
|
||||
after_date=after_date,
|
||||
page_size=page_size,
|
||||
types=note_types,
|
||||
note_types=note_types,
|
||||
entity_types=entity_types,
|
||||
metadata_filters=metadata_filters,
|
||||
tags=tags,
|
||||
@@ -654,7 +654,7 @@ def schema_validate(
|
||||
|
||||
@tool_app.command("schema-infer")
|
||||
def schema_infer(
|
||||
entity_type: Annotated[
|
||||
note_type: Annotated[
|
||||
str,
|
||||
typer.Argument(help="Note type to analyze (e.g., person, meeting)"),
|
||||
],
|
||||
@@ -688,7 +688,7 @@ def schema_infer(
|
||||
with force_routing(local=local, cloud=cloud):
|
||||
result = run_with_cleanup(
|
||||
mcp_schema_infer(
|
||||
note_type=entity_type,
|
||||
note_type=note_type,
|
||||
threshold=threshold,
|
||||
project=project,
|
||||
workspace=workspace,
|
||||
@@ -711,7 +711,7 @@ def schema_infer(
|
||||
|
||||
@tool_app.command("schema-diff")
|
||||
def schema_diff(
|
||||
entity_type: Annotated[
|
||||
note_type: Annotated[
|
||||
str,
|
||||
typer.Argument(help="Note type to check for drift"),
|
||||
],
|
||||
@@ -741,7 +741,7 @@ def schema_diff(
|
||||
with force_routing(local=local, cloud=cloud):
|
||||
result = run_with_cleanup(
|
||||
mcp_schema_diff(
|
||||
note_type=entity_type,
|
||||
note_type=note_type,
|
||||
project=project,
|
||||
workspace=workspace,
|
||||
output_format="json",
|
||||
|
||||
Reference in New Issue
Block a user