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",
);
}
#[test]
fn the_dispatch_schema_teaches_the_name_parameter_and_the_mint_on_omission() {
let schema = wire_schema("dispatch");
let props = &schema["properties"];
assert_eq!(props["name"]["type"], "string");
assert_eq!(schema["required"], serde_json::json!(["role", "goal"]));
assert_eq!(schema["additionalProperties"], serde_json::json!(false));
asserts(
props["name"]["description"]
.as_str()
.expect("name carries a description"),
&[
"one unbroken word",
"unique among the workspace's living agents",
"the child's identity in every surface",
"what `message` accepts in place of the child's agent id",
"keeps the identities and tasks in a subagent tree clear",
"If you omit it, a valid one-word name is minted automatically",
"already worn by a living agent is refused and no child is created",
],
"dispatch name-property description",
);
}
#[test]
fn the_dispatch_schema_teaches_a_subagent_as_an_ordinary_agent() {
let props = &wire_schema("dispatch")["properties"];
let goal = props["goal"]
.as_object()
.and_then(|g| g["description"].as_str().map(str::to_owned))
.expect("goal carries a description");
asserts(
&goal,
&[
"its terminal response",
"`message` reaches it at any step boundary while it runs",
"may dispatch subagents of its own",
],
"dispatch goal-property description",
);
assert!(
!goal.contains("compacted"),
"goal must not promise a compacted result — terminal compaction is deleted: {goal}"
);
asserts(
props["role"]["description"]
.as_str()
.expect("role carries a description"),
&["The role set is open", "enumerates no role names"],
"dispatch role-property description",
);
}