pub struct WorkspaceDir { /* private fields */ }Expand description
Per-project workspace directory (<project>/.astrid/).
Contains only committable project-level config. A workspace-id UUID
links the project to its global state in ~/.astrid/.
Implementations§
Source§impl WorkspaceDir
impl WorkspaceDir
Sourcepub fn detect(start_dir: &Path) -> Self
pub fn detect(start_dir: &Path) -> Self
Detect the workspace directory by walking up from start_dir.
Detection order:
- Directory containing
.astrid/ - Directory containing
.git - Directory containing
ASTRID.md - Fallback to
start_diritself
Sourcepub fn from_path(project_root: impl Into<PathBuf>) -> Self
pub fn from_path(project_root: impl Into<PathBuf>) -> Self
Create from an explicit project root (useful for testing).
Sourcepub fn ensure(&self) -> Result<()>
pub fn ensure(&self) -> Result<()>
Ensure the .astrid/ directory exists and generate a workspace ID
if one does not already exist.
§Errors
Returns an error if directory creation or workspace ID generation fails.
Sourcepub fn dot_astrid(&self) -> PathBuf
pub fn dot_astrid(&self) -> PathBuf
The .astrid/ directory itself.
Sourcepub fn capsules_dir(&self) -> PathBuf
pub fn capsules_dir(&self) -> PathBuf
Workspace capsules directory (.astrid/capsules/).
Sourcepub fn workspace_id_path(&self) -> PathBuf
pub fn workspace_id_path(&self) -> PathBuf
Path to the workspace-id file (.astrid/workspace-id).
Sourcepub fn workspace_id(&self) -> Result<Uuid>
pub fn workspace_id(&self) -> Result<Uuid>
Read or generate the workspace ID.
If the file exists (e.g. cloned from a repo), its UUID is adopted. Otherwise a new UUID is generated and written.
§Errors
Returns an error if the file cannot be read or written.
Sourcepub fn instructions_path(&self) -> PathBuf
pub fn instructions_path(&self) -> PathBuf
Path to the project-level instructions file (.astrid/ASTRID.md).
Trait Implementations§
Source§impl Clone for WorkspaceDir
impl Clone for WorkspaceDir
Source§fn clone(&self) -> WorkspaceDir
fn clone(&self) -> WorkspaceDir
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more