requirements.cli.overview_skill.setup
Requirements index · View definition
Requirement
The
habeasskill MUST tell agents that a project without the validation test thatcreates is not configured for Habeas, to ask the user before running
habeas setup, and, if setup is not completed, to do no Habeas requirements work in that project.
Rationale
The requirement has three obligations for the bundled habeas skill’s text:
- It must say that a project without the validation test from
requirements.cli.setup(tests/habeas.rscallinghabeas::validate()) is not configured for Habeas. - It must tell agents to ask the user before running
habeas setup. - It must tell agents to do no Habeas requirements work if setup is not completed.
The marked test is tests/authoring_cli.rs#fn[the_habeas_skill_asks_before_setup_and_does_no_work_without_it]. It takes the collapsed text of step 1 of the bundled habeas skill’s Workflow section. It does this through step("habeas", 1), which uses workflow_steps to parse the numbered steps. It then uses assert_text to assert, with contains, that the step has these two phrases:
- “If Habeas is not configured yet (no
tests/habeas.rscallinghabeas::validate()), ask the user before runninghabeas setup”. This covers obligations 1 and 2: the missing validation test means not configured, and the agent must ask before running setup. - “if setup is not completed, do no Habeas requirements work in the project”. This covers obligation 3.
assert_text panics if either phrase is missing, so the assertions enforce the obligations. If the skill dropped the ask-first instruction, the no-work instruction, or the not-configured criterion, the test would fail. The test also pins both phrases to the first workflow step of the habeas skill, which is where an agent meets them.
The requirement states no other boundary, mode, or failure case, and I found nothing else to test. I found no gaps.
Inputs
Tests
Input 3: outline tests/authoring_cli.rs fn[the_habeas_skill_asks_before_setup_and_does_no_work_without_it]
- File:
tests/authoring_cli.rs - Selector:
fn[the_habeas_skill_asks_before_setup_and_does_no_work_without_it] - Kind:
fn tests/authoring_cli.rs:3774–3785
// {test}`requirements.cli.overview_skill.setup`
#[test]
fn the_habeas_skill_asks_before_setup_and_does_no_work_without_it() {
assert_text(
"habeas workflow",
&step("habeas", 1),
&[
"If Habeas is not configured yet (no `tests/habeas.rs` calling `habeas::validate()`), ask the user before running `habeas setup`",
"if setup is not completed, do no Habeas requirements work in the project",
],
);
}
Referenced definitions
Input 2: requirements selection requirements.cli.setup
requirements.cli.setup:md/requirements/cli.md:11–13
:::{req} setup
Running `habeas setup` in an existing Cargo and mdBook project MUST add Habeas as a dev dependency, configure `habeas mdbook` as its preprocessor, add the badge stylesheet, enable sidebar folding with `output.html.fold.enable` unless the book already sets it, and create `tests/habeas.rs` that calls `habeas::validate()`. Repeating setup MUST avoid duplicate configuration and MUST NOT overwrite a differing test or stylesheet. Setup MUST NOT install or modify agent skills.
:::
Other sources
Input 1: requirements selection requirements.cli.overview_skill.setup
requirements.cli.overview_skill.setup:md/requirements/cli.md:112–115
:::{req} overview_skill.setup
The `habeas` skill MUST tell agents that a project without the validation test that {cite}`requirements.cli.setup` creates is not configured for Habeas, to ask the user before running `habeas setup`, and, if setup is not completed, to do no Habeas requirements work in that project.
:::
Input 4: outline tests/authoring_cli.rs fn[assert_text]
- File:
tests/authoring_cli.rs - Selector:
fn[assert_text] - Kind:
fn tests/authoring_cli.rs:3011–3016
// {cite}`habeas:util`
fn assert_text(label: &str, text: &str, phrases: &[&str]) {
for phrase in phrases {
assert!(text.contains(phrase), "{label} lacks {phrase:?}");
}
}
Input 5: outline tests/authoring_cli.rs fn[workflow_steps]
- File:
tests/authoring_cli.rs - Selector:
fn[workflow_steps] - Kind:
fn tests/authoring_cli.rs:2956–2989
/// The numbered steps of a bundled skill's "Workflow" section, each with its
/// number and collapsed text, including its indented continuation lines.
// {cite}`habeas:util`
fn workflow_steps(name: &str) -> Vec<(u32, String)> {
let (_, rest) = skill_md(name)
.split_once("\n## Workflow\n")
.unwrap_or_else(|| panic!("{name} has no workflow"));
let mut steps: Vec<(u32, Vec<&str>)> = Vec::new();
let mut open = false;
for line in rest.lines() {
if line.starts_with("## ") {
break;
}
let numbered = line
.strip_prefix("- [ ] ")
.and_then(|step| step.split_once(". "))
.and_then(|(number, text)| Some((number.parse().ok()?, text)));
if let Some((number, text)) = numbered {
steps.push((number, vec![text]));
open = true;
continue;
}
if !line.is_empty() && !line.starts_with(' ') {
open = false;
}
if open {
steps.last_mut().unwrap().1.push(line);
}
}
steps
.into_iter()
.map(|(number, lines)| (number, collapse(&lines.join("\n"))))
.collect()
}