sgclaw: snapshot today's runtime and skill updates
This commit is contained in:
34
third_party/zeroclaw/src/tools/read_skill.rs
vendored
34
third_party/zeroclaw/src/tools/read_skill.rs
vendored
@@ -154,7 +154,9 @@ pub async fn read_skill_bundle(location: &Path) -> std::io::Result<String> {
|
||||
let Some(skill_root) = location.parent() else {
|
||||
return Ok(primary);
|
||||
};
|
||||
let skill_root = skill_root.canonicalize().unwrap_or_else(|_| skill_root.to_path_buf());
|
||||
let skill_root = skill_root
|
||||
.canonicalize()
|
||||
.unwrap_or_else(|_| skill_root.to_path_buf());
|
||||
let mut output = primary.clone();
|
||||
let mut appended = BTreeSet::new();
|
||||
let mut queued = BTreeSet::new();
|
||||
@@ -275,16 +277,22 @@ fn extract_reference_paths(content: &str) -> Vec<String> {
|
||||
}
|
||||
|
||||
fn looks_like_relative_reference_path(raw: &str) -> bool {
|
||||
if raw.is_empty() ||
|
||||
raw.starts_with('/') ||
|
||||
raw.starts_with("http://") ||
|
||||
raw.starts_with("https://") ||
|
||||
raw.starts_with('#')
|
||||
if raw.is_empty()
|
||||
|| raw.starts_with('/')
|
||||
|| raw.starts_with("http://")
|
||||
|| raw.starts_with("https://")
|
||||
|| raw.starts_with('#')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
let candidate = raw.split('#').next().unwrap_or(raw).split('?').next().unwrap_or(raw);
|
||||
let candidate = raw
|
||||
.split('#')
|
||||
.next()
|
||||
.unwrap_or(raw)
|
||||
.split('?')
|
||||
.next()
|
||||
.unwrap_or(raw);
|
||||
let path = Path::new(candidate);
|
||||
if path
|
||||
.components()
|
||||
@@ -418,9 +426,15 @@ description = "Ship safely"
|
||||
|
||||
assert!(result.success);
|
||||
assert!(result.output.contains("# Zhihu Hotlist"));
|
||||
assert!(result.output.contains("## Referenced File: references/collection-flow.md"));
|
||||
assert!(result.output.contains("Collect rows from the hotlist first."));
|
||||
assert!(result.output.contains("## Referenced File: references/data-quality.md"));
|
||||
assert!(result
|
||||
.output
|
||||
.contains("## Referenced File: references/collection-flow.md"));
|
||||
assert!(result
|
||||
.output
|
||||
.contains("Collect rows from the hotlist first."));
|
||||
assert!(result
|
||||
.output
|
||||
.contains("## Referenced File: references/data-quality.md"));
|
||||
assert!(result.output.contains("Mark partial metrics explicitly."));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user