Skip to main content

Crate memnite_cli

Crate memnite_cli 

Source
Expand description

memnite-cli: the memnite binary’s library — wires core + store + stale.

Structs§

AddSpec
Inputs to create a memory.
AnchorSpec
One anchor to attach to a new memory (hash is computed from the file at add-time).
App
An open Memnite instance: the event log + its SQLite projection.
CheckSummary
Result of a check run.
CrumbexGraphSource
Adapter for a crumbex graph.json (crumbex graph --format json). Maps the static-architecture report into one memory per hub (god module), hotspot (central module, PageRank), import cycle, and community (Louvain cluster). Reads the file as a data contract — it never runs crumbex. root is the path to the JSON file itself.
DoctorReport
Result of doctor: integrity of the projection vs. the log. Compares only projected fields (status, title, last_event_id); tags are not projected so they are not compared.
EventCtx
Per-event context the caller supplies (kept out of App so tests are deterministic and main injects the real wall-clock/host).
ImportSummary
Result of a sync import: how many events were newly appended, skipped as already-present duplicates, or skipped as corrupt (unparseable) lines.
IngestSummary
Outcome of an App::ingest run.
IngestedMemory
The universal item every ingest source produces. memnite turns each into a MemoryAdded/MemoryUpdated event. (Eq is not derived: Scope is only PartialEq.)
RelationSpec
Inputs to assert a relation between two memories. The direction (from → to) is carried positionally by App::relate; this holds the classification.
RepoBrainSource
Adapter for guildgate’s Repo Brain. Reads UBIQUITOUS_LANGUAGE.md (one memory per glossary term — the ## sections AFTER a ## Terms heading) plus docs/wiki/ai/CONTRACTS.md and CONSTRAINTS.md (one whole-document memory each). Knows the FORMAT (a data contract), never guildgate’s code. Missing files are skipped.
ResolvedProject
A resolved, already-normalized project name plus the source it was derived from.
ScanSummary
Result of a conflicts scan: pairs judged, edges asserted, not-conflict verdicts, and judge errors (each swallowed — a failing pair never aborts). first_error samples the first judge error so a total misconfiguration (every pair errors) is distinguishable from “ran clean, found nothing”.
SearchQuery
A search request: free text plus optional exact filters and match mode.
UpdatePatch
Fields to change on an existing memory. None = leave unchanged. Note: unsetting topic_key is not supported in v1 — Some(x) sets it, None leaves the current value. An empty anchors/tags Vec inside Some replaces the current value with empty.

Enums§

CliError
ProjectSource
Where a resolved project name came from (precedence order, first match wins).
Relation

Constants§

MEMORY_PROTOCOL

Traits§

IngestSource
The extension point. One external system = one impl IngestSource.

Functions§

normalization_notice
A notice when an explicitly-given project name is not already canonical, e.g. Some("project 'My-Repo' normalized to 'my-repo'"); None when it is unchanged. The surface (CLI stderr / MCP response) shows it — canonicalization itself never fails.
normalize_project
Canonical form of a project name: trimmed, lowercased, with every maximal run of separators (-, _, or whitespace) collapsed into a single -, and no leading or trailing -. Idempotent: normalize_project(&normalize_project(s)) == normalize_project(s).
parse_anchor
Parse a CLI anchor argument: path:start:end or path:start:end:symbol.
parse_relation
Parse a relation label at a boundary. Rejects unknown values.
parse_scope
Parse a scope string at a boundary. Rejects unknown values (no silent fallback).
resolve_project
Resolve the project for cwd. Precedence: an explicit name → .memnite/config.json (project_name, searched from cwd upward) → the git origin remote’s repo name → the git root directory name → the cwd directory name. The returned project is always normalized; the function never returns an error.
sanitize_fts
Turn arbitrary user text into a safe FTS5 query: split on whitespace AND control characters (incl. NUL, which would otherwise truncate the bound C string and produce an unterminated FTS5 literal), then wrap each token as an FTS5 string literal (double-quoted, embedded " doubled). This neutralizes FTS5 operators/columns/hyphens so plain text never errors.