locus-cli (0.1.4)

Published 2026-07-31 06:31:11 +00:00 by PerishFire

Installation

[registries.forgejo]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add locus-cli@0.1.4 --registry forgejo

About this package

Structural inspection for Locus trace streams

locus

Readonly context and immutable observation substrate.

Locus accepts one candidate record, resolves requested semantic roles, returns a new immutable context view, and independently drives configured reporting. Trace and span are ordinary roles over the same record stream.

use locus::{Candidate, Config, Context, Engine, Policy, Role};
use serde_json::json;

let engine = Engine::bootstrap(Config::new(Policy::default()))?;
let context = Context::empty();
let trace = Role::trace();

let accepted = locus::record!(
    &engine,
    &context,
    Candidate::event(json!({"event": "cli.start"})).ensure(trace),
)?;

let context = accepted.context();
# Ok::<(), locus::Error>(())

Function observation is an explicit downstream decision. A product-owned accessor supplies a readonly engine and context view; absence is a true no-op.

# use locus::{Config, Context, Engine, Policy};
# use std::sync::OnceLock;
# static SEAT: OnceLock<(Engine, Context)> = OnceLock::new();
fn observation() -> Option<(&'static Engine, &'static Context)> {
    SEAT.get().map(|(engine, context)| (engine, context))
}

#[locus::trace(with = observation())]
fn reconcile() -> bool {
    true
}
# let _ = Engine::bootstrap(Config::new(Policy::default()));

The macro emits enter and normal return source records with one inherited trace/span context. Err is a normal return. Panic, abort, and async cancellation intentionally have no terminal record. It rejects const, unsafe, and #[track_caller] functions whose semantics the wrapper cannot preserve.

The locus binary inspects JSONL trace structure from stdin:

locus inspect < atoms.jsonl

Clean input exits zero without output. Structural findings are JSONL on stdout with exit one. Malformed input and I/O failure use stderr and exit two. The initial laws flag a trace representation beyond 8 KiB and a nontrivial decoded content prefix covering more than eighty percent of at least five Atoms. Inspection never changes acceptance, reporting, or the input stream, and it does not attribute a finding to a product or cause.

Canonical source: PerishLab/locus.

The cold-start contract is documented in docs/run/verify.md.

Dependencies

ID Version
clap ^4
locus =0.1.4
plumb ^0
serde ^1
serde_json ^1
Details
Cargo
2026-07-31 06:31:11 +00:00
1
MIT
8 KiB
Assets (1)
Versions (4) View all
0.2.2 2026-08-15
0.2.1 2026-08-02
0.2.0 2026-07-31
0.1.4 2026-07-31