fn wire_description(name: &str) -> String {
let raw = super::SKILLS
.get_file(format!("{name}/SKILL.md"))
.expect("the skill pool ships this skill")
.contents_utf8()
.expect("SKILL.md is UTF-8");
let body = crate::skill::frontmatter_yaml(raw).expect("SKILL.md has frontmatter");
crate::skill::parse(body)
.expect("frontmatter parses")
.description
}
fn wire_schema(name: &str) -> serde_json::Value {
let raw = super::TOOLS
.get_file(format!("{name}.json"))
.expect("the tool pool ships this schema")
.contents();
serde_json::from_slice(raw).expect("the shipped schema is JSON")
}
fn asserts(text: &str, phrases: &[&str], what: &str) {
for phrase in phrases {
assert!(
text.contains(phrase),
"the {what} no longer says {phrase:?} (bl-298c) — it reads:\n{text}"
);
}
}
#[test]
fn the_bash_description_says_the_shell_is_local() {
asserts(
&wire_description("bash"),
&[
"The shell is local",
"on that same machine",
"no server, container, or remote sandbox",
],
"bash tool description",
);
}
#[test]
fn the_bash_description_says_the_shell_is_non_interactive() {
asserts(
&wire_description("bash"),
&["not an interactive terminal", "stdin closed and no TTY"],
"bash tool description",
);
}
#[test]
fn the_bash_description_says_where_it_runs_and_what_survives() {
asserts(
&wire_description("bash"),
&[
"Shell state does not carry over",
"use the `cd` tool to move for real",
"your worktree unless you moved it with the `cd` tool",
"what you write outside it is not",
],
"bash tool description",
);
}
#[test]
fn the_bash_description_promises_the_result_envelope() {
asserts(
&wire_description("bash"),
&[
"`Exit code: N` line",
"`--- stderr ---` marker",
"on success as well as failure",
],
"bash tool description",
);
}
#[test]
fn the_bash_schema_keeps_the_one_string_command_and_repeats_the_contract() {
let schema = wire_schema("bash");
let props = &schema["properties"];
assert_eq!(props["command"]["type"], "string");
assert_eq!(schema["required"], serde_json::json!(["command"]));
assert_eq!(schema["additionalProperties"], serde_json::json!(false));
assert_eq!(
props.as_object().expect("properties is an object").len(),
1,
"bash takes one input; a second would need executor support"
);
asserts(
props["command"]["description"]
.as_str()
.expect("command carries a description"),
&[
"on this machine",
"runs non-interactively",
"stdin is /dev/null",
"no TTY",
"starts in your current working directory",
"discarded when it exits",
"states the exit code on its first line",
"`--- stderr ---` marker",
],
"bash command-property description",
);
}