Skip to main content

cageforge_backend_api/
capability.rs

1// SPDX-License-Identifier: Apache-2.0
2
3use std::fmt;
4
5use crate::BackendCapability;
6
7impl fmt::Display for BackendCapability {
8    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
9        let description = match self {
10            Self::CommandExecution => "command execution",
11            Self::WorkingDirectory => "working-directory resolution",
12            Self::StdioInherit => "inherited standard streams",
13            Self::StdioNull => "null standard streams",
14            Self::StdioPipe => "piped standard streams",
15            Self::TimeoutBackendDefault => "backend-default timeout",
16            Self::TimeoutLimit => "explicit timeout limits",
17            Self::TimeoutDisabled => "disabled automatic timeouts",
18            Self::FilesystemRestricted => "restricted filesystem enforcement",
19            Self::FilesystemUnrestricted => "unrestricted filesystem execution",
20            Self::FilesystemExternal => "external filesystem enforcement",
21            Self::FilesystemScopes => "filesystem scope resolution, including workspace roots",
22            Self::FilesystemAbsoluteScopes => "absolute filesystem scope resolution",
23            Self::FilesystemWorkspaceScopes => "workspace-root filesystem scope resolution",
24            Self::FilesystemRootScopes => "system-root filesystem scope resolution",
25            Self::FilesystemMinimalScopes => "platform-minimal filesystem scope resolution",
26            Self::FilesystemTmpdirScopes => "temporary-directory filesystem scope resolution",
27            Self::FilesystemConventionalTemporaryScopes => {
28                "conventional temporary filesystem scope resolution"
29            }
30            Self::FilesystemGlobs => "filesystem deny-glob matching",
31            Self::FilesystemGlobScanDepth => {
32                "filesystem glob scan-depth semantics, including unbounded scans"
33            }
34            Self::FilesystemReadOnlySubpaths => "filesystem read-only subpaths",
35            Self::FilesystemMissingPathBehavior => {
36                "filesystem missing-path behavior (error or skip)"
37            }
38            Self::FilesystemProtectedPaths => "filesystem protected paths such as .git",
39            Self::NetworkDisabled => "disabled network enforcement",
40            Self::NetworkEnabled => "local network enforcement",
41            Self::NetworkExternal => "external network enforcement",
42            Self::NetworkDomainRules => "network domain rules",
43            Self::NetworkLocalAddressRestrictions => {
44                "network non-public and special-purpose address restrictions"
45            }
46            Self::NetworkResolvedTargets => "exact resolved network targets",
47            Self::NetworkLocalIpcIsolation => "pathname local-IPC isolation",
48            Self::NetworkLocalIpcRules => "per-path local-IPC allow rules",
49            Self::NetworkLocalIpcDenyRules => "explicit local-IPC deny rules",
50            Self::EnvironmentAll => "all inherited environment variables",
51            Self::EnvironmentCore => "backend-selected core environment variables",
52            Self::EnvironmentNone => "an empty inherited environment",
53            Self::EnvironmentFilters => "environment include and exclude filters",
54            Self::EnvironmentOverrides => "environment set and remove overrides",
55        };
56        formatter.write_str(description)
57    }
58}