feat(knowledge): land Engineering Knowledge Compiler (EKC) from 008

Give agents Engineering First Information before codegen: L0–L4 catalog,
reuse/preflight (REUSE→ADAPT→CREATE), graph, and CLI surfaces so large
repos stop reinventing existing capabilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-28 16:44:39 +08:00
1 parent 2e425c3010
commit 56ab52356f
43 files changed
+8434 -19

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
//! Marqdo Engineering Knowledge Compiler (EKC).
//!
//! Source of truth remains `*.mq.md`. This module projects L0–L4 catalog,
//! knowledge graph, reuse preflight, and agent context packs under `.marqdo/`.
pub mod capability;
pub mod compile;
pub mod duplicate;
pub mod extract;
pub mod find;
pub mod fingerprint;
pub mod graph;
pub mod impact;
pub mod ir;
pub mod learn;
pub mod lifecycle;
pub mod metrics;
pub mod policy;
pub mod preflight;
pub mod reuse;
pub mod util;
pub use compile::{compile, ensure_compiled, load_graph, KnowledgeOptions};
pub use duplicate::{find_duplicates, format_duplicates_text};
pub use find::{find, find_json, format_find_text};
pub use impact::{format_impact_text, impact, impact_json};
pub use ir::{KnowledgeGraph, ReuseDecision, ReuseResult};
pub use learn::{learn, LearnInput};
pub use lifecycle::{
conflicts_json, find_conflicts, find_stale, format_conflicts_text, format_stale_text,
format_verify_text, stale_json, verify, verify_json,
};
pub use metrics::{load_metrics, record_decision, save_metrics, ReuseMetrics};
pub use policy::compile_policy;
pub use preflight::{format_preflight_yaml, preflight, preflight_json, PreflightResult};
pub use reuse::{format_reuse_text, resolve, reuse_json, ReuseBudget};
use std::path::{Path, PathBuf};
use anyhow::Result;
/// Run knowledge compile for CLI / catalog hook.
pub fn write_knowledge(opts: KnowledgeOptions) -> Result<KnowledgeGraph> {
compile(opts)
}
/// Default out dir helper.
pub fn default_out(path: &Path) -> PathBuf {
if path.is_file() {
path.parent()
.unwrap_or(Path::new("."))
.join(".marqdo")
} else {
path.join(".marqdo")
}
}