1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//! The port to the project directory the flows plan against and apply to.
//!
//! Pure trait definition with no executable logic, so it carries no inline tests.
//!
//! # Responsibilities
//!
//! - [`Workspace`] is the project as the flows see it: the two project files and the writes to them, the state of any
//! project-relative path, the tree behind a local source directory, and the writes apply makes.
//!
//! # Non-responsibilities
//!
//! It decides nothing. Whether a file changed, which step it gets and what the lock records belong
//! to the rules in `types`; reading and writing a real disk belongs to the `fs` adapter.
use io;
use crateFileTree;
use crateOpPath;
use crateResolution;
use crateLocalPath;
/// The project directory, reached through project-relative paths.
///
/// Every path is an [`OpPath`], already normalised. Every failure is the platform's own
/// [`io::Error`], so a flow reports `<path>: <the error's Display>`.
///
/// An implementation keeps these rules:
///
/// - Paths compare by their bytes, so `A.md` and `a.md` are two paths even where the disk folds
/// case.
/// - A path is followed through symlinks. [`Workspace::resolve`] reports where it leads and what
/// is there. The lock records the path as it was proposed, never the path it leads to.
/// - [`Workspace::stage`], [`Workspace::swap`] and [`Workspace::delete`] look at where the path
/// leads when they run. One that leads outside the project is refused with an error that
/// displays as `resolves outside the project`, and nothing outside the project is written.
/// - A file is installed in two steps: [`Workspace::stage`] writes a temporary file named
/// `.<name>.agentstacks-tmp` beside the canonical target, and [`Workspace::swap`] renames it onto
/// the target. A file that already exists keeps its permission mode.
/// - Nothing outside these methods writes.