discover
Auto-discovery of legacy v0.4
.gest/ data directories.const LEGACY_SUBDIRS
const LEGACY_SUBDIRS: &[&str] = &["tasks", "artifacts", "iterations"];Marker subdirectories that indicate a v0.4 legacy .gest/ directory.
fn find_legacy_dir
pub fn find_legacy_dir(cwd: &Path) -> Result<PathBuf, Error>Discover a legacy v0.4 data directory starting from cwd.
Resolution order:
cwd/.gest/if it contains flat-file subdirs- Walk ancestors of
cwdlooking for.gest/ - Global hash:
$XDG_DATA_HOME/gest/<sha256(canonicalize(cwd))[..8]>/
| Parameter | Type | Description |
|---|---|---|
cwd |
&Path | the directory to start from, usually the current one |
| returns | Result<PathBuf, Error> | The first legacy directory found, or a NotFound I/O error when none of the three places has one. |
fn is_legacy_dir
fn is_legacy_dir(path: &Path) -> boolCheck whether a directory looks like a v0.4 legacy .gest/ dir.
| Parameter | Type | Description |
|---|---|---|
path |
&Path | the directory to check |
| returns | bool | true when path is a directory with a tasks, artifacts or iterations subdirectory. |
fn walk_ancestors
fn walk_ancestors(cwd: &Path) -> Option<PathBuf>Walk up from cwd checking each parent for .gest/ with legacy subdirs.
| Parameter | Type | Description |
|---|---|---|
cwd |
&Path | the directory whose parents are checked; cwd itself is not |
| returns | Option<PathBuf> | The nearest legacy .gest/ above cwd, or None. |
fn global_hash_dir
fn global_hash_dir(cwd: &Path) -> Option<PathBuf>Check the global XDG data directory for a hash-based project dir.
| Parameter | Type | Description |
|---|---|---|
cwd |
&Path | the project directory whose path is hashed |
| returns | Option<PathBuf> | $XDG_DATA_HOME/gest/<hash> when it is a legacy directory, else None. |
fn path_hash
fn path_hash(path: &Path) -> StringProduce a short hex hash of the canonicalized path, matching v0.4.x behavior.
| Parameter | Type | Description |
|---|---|---|
path |
&Path | the path to hash; used as given when it cannot be canonicalized |
| returns | String | The first 8 bytes of the SHA-256 of the path, as 16 lowercase hex characters. |