systemprompt_sync/diff/
mod.rs1mod content;
2mod playbooks;
3mod skills;
4
5pub use content::ContentDiffCalculator;
6pub use playbooks::PlaybooksDiffCalculator;
7pub use skills::SkillsDiffCalculator;
8
9use crate::models::DiskSkill;
10use sha2::{Digest, Sha256};
11use systemprompt_agent::models::Skill;
12
13pub fn compute_content_hash(body: &str, title: &str) -> String {
14 let mut hasher = Sha256::new();
15 hasher.update(title.as_bytes());
16 hasher.update(body.as_bytes());
17 format!("{:x}", hasher.finalize())
18}
19
20pub(crate) fn compute_skill_hash(skill: &DiskSkill) -> String {
21 let mut hasher = Sha256::new();
22 hasher.update(skill.name.as_bytes());
23 hasher.update(skill.description.as_bytes());
24 hasher.update(skill.instructions.as_bytes());
25 format!("{:x}", hasher.finalize())
26}
27
28pub(crate) fn compute_db_skill_hash(skill: &Skill) -> String {
29 let mut hasher = Sha256::new();
30 hasher.update(skill.name.as_bytes());
31 hasher.update(skill.description.as_bytes());
32 hasher.update(skill.instructions.as_bytes());
33 format!("{:x}", hasher.finalize())
34}