chore: rename packages/ to crates/
Move all 29 workspace members from packages/<name>/ to crates/<name>/. Updates: workspace Cargo.toml (members + path deps), justfile, root CLAUDE.md, scripts/build/CARGO_INSTALL.md, docs/architecture/crates.md (renamed from packages.md), structural references in docs/architecture and docs/configuration, per-crate CLAUDE.md self-references. Historical plans, reports, and building/ docs are left untouched. No behavior change; just check-all stays green and fermata tests pass.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// Markers checked in priority order when walking up from a target path.
|
||||
const MARKERS: &[&str] = &["botignore.toml", ".botignore", ".git"];
|
||||
|
||||
/// Walk upward from `target` (or its parent if `target` is a file) looking
|
||||
/// for the nearest project root. Roots are identified by the presence of
|
||||
/// any marker in `MARKERS`. Walks from the **target file's location**, not
|
||||
/// from cwd, because agents `cd` around.
|
||||
pub fn find_project_root(target: &Path) -> Option<PathBuf> {
|
||||
let start = if target.is_file() {
|
||||
target.parent()?
|
||||
} else {
|
||||
target
|
||||
};
|
||||
|
||||
let mut current = Some(start);
|
||||
while let Some(dir) = current {
|
||||
for marker in MARKERS {
|
||||
if dir.join(marker).exists() {
|
||||
return Some(dir.to_path_buf());
|
||||
}
|
||||
}
|
||||
current = dir.parent();
|
||||
}
|
||||
None
|
||||
}
|
||||
Reference in New Issue
Block a user