Storage

Struct Storage 

Source
pub struct Storage { /* private fields */ }

Implementations§

Source§

impl Storage

Source

pub fn new(project_root: Option<PathBuf>) -> Self

Source

pub fn project_root(&self) -> &Path

Get the project root directory

Source

pub fn scud_dir(&self) -> PathBuf

Source

pub fn tasks_file(&self) -> PathBuf

Source

pub fn config_file(&self) -> PathBuf

Source

pub fn docs_dir(&self) -> PathBuf

Source

pub fn guidance_dir(&self) -> PathBuf

Source

pub fn load_guidance(&self) -> Result<String>

Load all .md files from .scud/guidance/ folder Returns concatenated content with file headers, or empty string if no files

Source

pub fn is_initialized(&self) -> bool

Source

pub fn initialize(&self) -> Result<()>

Source

pub fn initialize_with_config(&self, config: &Config) -> Result<()>

Source

pub fn load_config(&self) -> Result<Config>

Source

pub fn load_tasks(&self) -> Result<HashMap<String, Phase>>

Source

pub fn save_tasks(&self, tasks: &HashMap<String, Phase>) -> Result<()>

Source

pub fn get_active_group(&self) -> Result<Option<String>>

Source

pub fn set_active_group(&self, group_tag: &str) -> Result<()>

Source

pub fn clear_cache(&self)

Clear the active group cache Useful when active-tag file is modified externally or for testing

Source

pub fn clear_active_group(&self) -> Result<()>

Clear the active group setting (remove the active-tag file)

Source

pub fn load_group(&self, group_tag: &str) -> Result<Phase>

Load a single task group by tag Parses the SCG file and extracts the requested group

Source

pub fn load_active_group(&self) -> Result<Phase>

Load the active task group directly (optimized) Combines get_active_group() and load_group() in one call

Source

pub fn update_group(&self, group_tag: &str, group: &Phase) -> Result<()>

Update a single task group atomically Holds exclusive lock across read-modify-write cycle to prevent races

Source

pub fn update_task_status( &self, group_tag: &str, task_id: &str, status: TaskStatus, ) -> Result<()>

Update a single task’s status within a group Convenience method that loads, modifies, and saves the group atomically

Source

pub fn read_file(&self, path: &Path) -> Result<String>

Source

pub fn archive_dir(&self) -> PathBuf

Get the archive directory path

Source

pub fn ensure_archive_dir(&self) -> Result<()>

Ensure archive directory exists

Source

pub fn archive_filename(&self, tag: Option<&str>) -> String

Generate archive filename for a tag or all tasks Format: {YYYY-MM-DD}_{tag}.scg or {YYYY-MM-DD}_all.scg

Source

pub fn archive_phase( &self, tag: &str, phases: &HashMap<String, Phase>, ) -> Result<PathBuf>

Archive a single phase/tag Returns the path to the created archive file

Source

pub fn archive_all(&self, phases: &HashMap<String, Phase>) -> Result<PathBuf>

Archive all phases together Returns the path to the created archive file

Source

pub fn parse_archive_filename(filename: &str) -> (String, Option<String>)

Parse archive filename to extract date and tag Returns (date, tag) where tag is None if “all”

Source

pub fn list_archives(&self) -> Result<Vec<ArchiveInfo>>

List all archives in the archive directory Returns sorted by date descending (newest first)

Source

pub fn load_archive(&self, path: &Path) -> Result<HashMap<String, Phase>>

Load an archive file Returns the phases contained in the archive

Source

pub fn restore_archive( &self, archive_name: &str, replace: bool, ) -> Result<Vec<String>>

Restore an archive by merging it into current tasks.

§Arguments
  • archive_name - filename or partial match (e.g., “v1”, “2026-01-13_v1”, “2026-01-13_v1.scg”)
  • replace - if true, replace existing tags; if false, skip existing
§Returns

The list of restored tag names

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more