use std::path::PathBuf;
use super::RulesFormat;
use crate::core::config::CompressionLevel;
use crate::core::rules_canonical::{self as rc, Wrapper};
pub(super) fn rules_content(format: &RulesFormat, level: CompressionLevel) -> String {
let shadow = crate::core::config::Config::load().shadow_mode;
match format {
RulesFormat::SharedMarkdown => rc::render(shadow, Wrapper::Shared, level),
RulesFormat::DedicatedMarkdown => rc::render(shadow, Wrapper::Dedicated, level),
RulesFormat::CursorMdc => {
let body = rc::render(shadow, Wrapper::Dedicated, level);
format!(
"---\n\
description: \"lean-ctx: context compression layer. \
Tools replace native Read/Grep/Shell — see rule body.\"\n\
globs: **/*\n\
alwaysApply: true\n\
---\n\n\
{body}"
)
}
}
}
pub fn opencode_dedicated_rules_path(home: &std::path::Path) -> PathBuf {
home.join(".config/opencode/rules/lean-ctx.md")
}
pub fn gemini_dedicated_rules_path(home: &std::path::Path) -> PathBuf {
home.join(".gemini").join(GEMINI_DEDICATED_CONTEXT_FILENAME)
}
pub const GEMINI_DEDICATED_CONTEXT_FILENAME: &str = "LEANCTX.md";