inspect static method
Each directory of revision's skill, one per root in roots order,
with its ProfileSkillDirectoryState: what get would do with it to
install revision, and why it would refuse. Reads only the markers and
whether something is there; never writes and never runs Git.
A directory is ProfileSkillDirectoryState.outside whenever its root resolves outside the project (escaping), whatever it holds; otherwise it is missing when nothing is at its path (a symbolic link counts as something), current or stale when its marker is the Profile's own, and unmarked otherwise.
Implementation
static Future<List<ProfileSkillDirectory>> inspect(
String projectRoot,
SkillRevision revision,
) async {
final Set<String> outside;
try {
outside = (await escaping(projectRoot)).toSet();
} on FileSystemException {
// No project to resolve, so nothing is installed in it either.
return [
for (final root in roots)
ProfileSkillDirectory(
profile: revision.id,
root: root,
path: '$root/${revision.id.value}',
state: ProfileSkillDirectoryState.missing,
),
];
}
return [
for (final root in roots)
await _inspect(
projectRoot,
root,
revision,
outside: outside.contains(root),
),
];
}