26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
51 lines
1.4 KiB
Rust
51 lines
1.4 KiB
Rust
fn main() {
|
|
guard_source_contamination();
|
|
println!("cargo::rerun-if-changed=src/dashboard/dashboard.html");
|
|
}
|
|
|
|
fn guard_source_contamination() {
|
|
let src = std::path::Path::new("src");
|
|
if !src.is_dir() {
|
|
return;
|
|
}
|
|
let mut contaminated = Vec::new();
|
|
visit_rs_files(src, &mut contaminated);
|
|
if !contaminated.is_empty() {
|
|
let list = contaminated.join(
|
|
"
|
|
",
|
|
);
|
|
panic!(
|
|
"
|
|
|
|
[1;31mBUILD BLOCKED: lean-ctx marker contamination detected[0m
|
|
|
|
The following source files contain `--- lean-ctx:` lines injected
|
|
by shell hooks during in-place editing. Remove them before building:
|
|
|
|
{list}
|
|
|
|
Prevention: use StrReplace (not perl/sed) for source edits, or set
|
|
LEAN_CTX_SHELL_PASSTHROUGH=1 before running in-place edit commands.
|
|
"
|
|
);
|
|
}
|
|
}
|
|
|
|
fn visit_rs_files(dir: &std::path::Path, out: &mut Vec<String>) {
|
|
let Ok(entries) = std::fs::read_dir(dir) else {
|
|
return;
|
|
};
|
|
for entry in entries.flatten() {
|
|
let path = entry.path();
|
|
if path.is_dir() {
|
|
visit_rs_files(&path, out);
|
|
} else if path.extension().is_some_and(|e| e == "rs")
|
|
&& let Ok(text) = std::fs::read_to_string(&path)
|
|
&& text.lines().any(|line| line.starts_with("--- lean-ctx:"))
|
|
{
|
|
out.push(path.display().to_string());
|
|
}
|
|
}
|
|
}
|