Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
22 lines
773 B
Rust
22 lines
773 B
Rust
//! Prune orphan URIs — those that appear in `cross_edges` but have no in-edges.
|
|
//! Conservative: only removes edges where the tail URI has no other incoming edge.
|
|
|
|
use anyhow::Result;
|
|
use rusqlite::Connection;
|
|
|
|
pub fn prune_orphans(conn: &Connection) -> Result<usize> {
|
|
// Find URIs that appear as to_uri but also as from_uri with no other incoming
|
|
// => they are dead-ends. We remove edges where the outgoing side is orphan.
|
|
let deleted = conn.execute(
|
|
"DELETE FROM cross_edges
|
|
WHERE to_uri IN (
|
|
SELECT e1.from_uri FROM cross_edges e1
|
|
WHERE NOT EXISTS (
|
|
SELECT 1 FROM cross_edges e2
|
|
WHERE e2.to_uri = e1.from_uri
|
|
)
|
|
)",
|
|
[],
|
|
)?;
|
|
Ok(deleted)
|
|
}
|