Skip to content

Commit 6270637

Browse files
astefanoclaude
andcommitted
Fix --no-probe to work without probe-verus installed
When --no-probe is set, parse .md frontmatter directly using the existing structure module instead of calling probe-verus stubify. This makes atomize --no-probe fully self-contained and fixes CI failures where probe-verus is not available. Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fe38c83 commit 6270637

1 file changed

Lines changed: 54 additions & 8 deletions

File tree

src/commands/atomize.rs

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ pub async fn handle_atomize(
5656

5757
let config = ConfigPaths::load(&project_root)?;
5858

59-
// Step 1: Generate stubs.json from .md files using probe-verus stubify
60-
let stubs = generate_stubs(
61-
&project_root,
62-
&config.structure_root,
63-
&config.structure_json_path,
64-
&config.command_config,
65-
)?;
66-
println!("Loaded {} stubs from structure files", stubs.len());
59+
// Step 1: Generate stubs from .md files
60+
let stubs = if no_probe {
61+
load_stubs_from_md_files(&config.structure_root)?
62+
} else {
63+
generate_stubs(
64+
&project_root,
65+
&config.structure_root,
66+
&config.structure_json_path,
67+
&config.command_config,
68+
)?
69+
};
70+
println!("Loaded {} stubs", stubs.len());
6771

6872
// Step 2: Generate or load atoms.json
6973
let probe_atoms = if no_probe {
@@ -256,6 +260,48 @@ fn generate_stubs(
256260
Ok(stubs)
257261
}
258262

263+
/// Walk the structure directory and parse .md frontmatter to build stubs
264+
/// without requiring probe-verus. This mirrors what `probe-verus stubify` does.
265+
fn load_stubs_from_md_files(structure_root: &Path) -> Result<HashMap<String, Value>> {
266+
if !structure_root.exists() {
267+
bail!(
268+
"Structure directory not found at {}. Run 'verilib-cli create' first.",
269+
structure_root.display()
270+
);
271+
}
272+
273+
println!(
274+
"Loading stubs from .md files in {}...",
275+
structure_root.display()
276+
);
277+
278+
let mut stubs: HashMap<String, Value> = HashMap::new();
279+
for entry in WalkDir::new(structure_root)
280+
.into_iter()
281+
.filter_map(|e| e.ok())
282+
{
283+
let path = entry.path();
284+
if path.extension().and_then(|e| e.to_str()) != Some("md") {
285+
continue;
286+
}
287+
let rel_path = path
288+
.strip_prefix(structure_root)
289+
.unwrap_or(path)
290+
.to_string_lossy()
291+
.to_string();
292+
match parse_frontmatter(path) {
293+
Ok(fm) => {
294+
stubs.insert(rel_path, serde_json::to_value(fm)?);
295+
}
296+
Err(e) => {
297+
eprintln!("Warning: skipping {}: {}", rel_path, e);
298+
}
299+
}
300+
}
301+
302+
Ok(stubs)
303+
}
304+
259305
/// Load atoms from an existing atoms.json file.
260306
fn load_atoms_from_file(atoms_path: &Path) -> Result<HashMap<String, Value>> {
261307
if !atoms_path.exists() {

0 commit comments

Comments
 (0)