workyard_application/actions/info/contract.rs
1use crate::contracts::ProblemOutcome;
2use serde::Serialize;
3use trine::NativePath;
4
5/// How this invocation selected the workspace.
6#[derive(Clone, Copy, Serialize)]
7#[serde(rename_all = "snake_case")]
8pub enum DiscoverySource {
9 /// The caller supplied the workspace.
10 Explicit,
11 /// Workspace discovery found the marker in the working directory or its ancestors.
12 Ancestor,
13}
14
15/// Workspace discovery details and counts from its recorded tasks.
16#[derive(Default, Serialize)]
17pub struct InfoOutcome {
18 /// Workspace root containing the Workyard marker.
19 pub workspace: Option<NativePath>,
20 /// Directory containing the task workspaces.
21 pub tasks_root: Option<NativePath>,
22 /// Directory holding authoritative Workyard state.
23 pub state_dir: Option<NativePath>,
24 /// How the workspace was selected.
25 pub discovery: Option<DiscoverySource>,
26 /// Number of active tasks observed.
27 pub active_tasks: usize,
28 /// Number of retired tasks observed.
29 pub retired_tasks: usize,
30 /// Number of records whose task facts could not be established.
31 pub unresolved_records: usize,
32 /// Number of tasks observed under operation admission.
33 pub busy_tasks: usize,
34 /// Actionable guidance associated with this result.
35 pub guidance: Option<String>,
36 /// Diagnostic describing a failure or an unresolved condition.
37 pub problem: Option<ProblemOutcome>,
38}