bctx-forge 0.1.12

bctx-forge — OS execution substrate, signal capture, BPE tokenizer, SQLite tracker
Documentation
pub mod build;
pub mod git;
pub mod lint;
pub mod script;
pub mod test;

use std::collections::HashMap;

/// Structured domain facts extracted from a RawSignal.
#[derive(Debug, Clone, Default)]
pub struct AwarenessMap {
    pub ecosystem: String,
    pub event_type: String,
    pub facts: HashMap<String, String>,
}

impl AwarenessMap {
    pub fn new(ecosystem: impl Into<String>, event_type: impl Into<String>) -> Self {
        Self {
            ecosystem: ecosystem.into(),
            event_type: event_type.into(),
            facts: HashMap::new(),
        }
    }

    pub fn insert(&mut self, key: impl Into<String>, value: impl Into<String>) {
        self.facts.insert(key.into(), value.into());
    }

    pub fn get(&self, key: &str) -> Option<&str> {
        self.facts.get(key).map(|s| s.as_str())
    }
}

pub trait EcosystemAwareness: Send + Sync {
    fn matches(&self, program: &str, args: &[String]) -> bool;
    fn extract(&self, stdout: &str, stderr: &str, exit_code: i32) -> AwarenessMap;
}