### Install Binary Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Example demonstrating the installation of a 'swiftlint' binary with a specific version and manufacturer. ```swift let binary = ExecutableBinary( commandName: "swiftlint", binaryPath: URL(fileURLWithPath: "/tmp/swiftlint"), version: "0.55.0", manufacturer: manufacturer ) try manager.install(binary) ``` -------------------------------- ### List Commands Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Example of listing installed commands and printing their names and versions. ```swift let installed = manager.list() for (name, commands) in installed { for command in commands { print("\(name) \(command.version)") } } ``` -------------------------------- ### Nestfile Configuration Example Source: https://github.com/mtj0928/nest/blob/main/README.md An example of a `nestfile.yaml` configuration. It shows how to specify repositories, versions, artifact bundle names, and checksums for package installations. ```yaml nestPath: ./.nest targets: # Example 1: Specify a repository - reference: mtj0928/nest # or htpps://github.com/mtj0928/nest version: 0.1.0 # (Optional) When a version is not specified, the latest release will be used. assetName: nest-macos.artifactbundle.zip # (Optional) When a name is not specified, it will be resolved by GitHub API. checksum: adcc2e3b4d48606cba7787153b0794f8a87e5289803466d63513f04c4d7661fb # Recommended now and required with `--checksum-policy require`. Run `update-nestfile` to populate. # Example 2 Specify zip URL directly - zipURL: https://github.com/mtj0928/nest/releases/download/0.1.0/nest-macos.artifactbundle.zip checksum: adcc2e3b4d48606cba7787153b0794f8a87e5289803466d63513f04c4d7661fb # Recommended now and required with `--checksum-policy require`. registries: github: - host: my-github-enterprise.example.com tokenEnvironmentVariable: "MY_GHE_TOKEN" ``` -------------------------------- ### Run Nest Command Examples Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Demonstrates different ways to use the 'nest run' command, including auto-installation, skipping installation, and using a custom nestfile. ```bash # Auto-install if needed and run nest run realm/SwiftLint --version # Skip auto-install nest run --no-install realm/SwiftLint file.swift # Custom nestfile nest run --nestfile-path ./custom.yaml realm/SwiftLint ``` -------------------------------- ### ExecutableBinary Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md An example demonstrating how to initialize an ExecutableBinary for a local build. ```swift let binary = ExecutableBinary( commandName: "swiftlint", binaryPath: URL(fileURLWithPath: "/tmp/swiftlint"), version: "0.55.0", manufacturer: .localBuild(repository: repository) ) ``` -------------------------------- ### install(_:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Installs a binary, including copying it and its resources, registering metadata, and creating symbolic links. ```APIDOC ## install(_:) ### Description Installs a binary and links it to the bin directory. Creates necessary directories, copies the binary and resources, registers metadata in info.json, and creates symbolic links. ### Parameters #### Path Parameters - **binary** (ExecutableBinary) - Yes - The executable binary to install ### Throws - `ArtifactBundleManagerError.resourceConflicting` โ€” Resource name conflicts with existing installation - File system errors during copy or link operations ### Request Example ```swift let binary = ExecutableBinary( commandName: "swiftlint", binaryPath: URL(fileURLWithPath: "/tmp/swiftlint"), version: "0.55.0", manufacturer: manufacturer ) try manager.install(binary) ``` ``` -------------------------------- ### Install Xcodes using Nest Source: https://github.com/mtj0928/nest/blob/main/README.md Installs the Xcodes executable from the XcodesOrg/xcodes repository. This example shows the fallback behavior when no artifact bundles are found, requiring cloning and building. ```shell $ nest install XcodesOrg/xcodes ๐Ÿชน No artifact bundles in the repository. ๐Ÿ”„ Cloning xcodes... ๐Ÿ”จ Building xcodes for 1.4.1... ๐Ÿชบ Success to install xcodes. ``` -------------------------------- ### Link Binary Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Example demonstrating how to link an executable binary using the ArtifactBundleManager. ```swift try manager.link(binary) ``` -------------------------------- ### ExecutableBinary parentDirectory Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Example showing how to access the parent directory of an ExecutableBinary instance. ```swift let resourceDir = binary.parentDirectory // Contains the binary and any .bundle resources ``` -------------------------------- ### ArtifactBundleManager Initialization Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Example of how to initialize ArtifactBundleManager using FileManager.default and a NestDirectory instance. ```swift let manager = ArtifactBundleManager( fileSystem: FileManager.default, directory: NestDirectory(rootDirectory: nestRoot) ) ``` -------------------------------- ### Example Configuration Initialization Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/Configuration.md Demonstrates how to create a Configuration instance with concrete implementations for its dependencies. This example uses standard system objects and custom NestKit components. ```swift let config = Configuration( httpClient: URLSession.shared, fileSystem: FileManager.default, fileDownloader: NestFileDownloader(httpClient: URLSession.shared), workingDirectory: URL(fileURLWithPath: FileManager.default.currentDirectoryPath), assetRegistryClientBuilder: AssetRegistryClientBuilder( httpClient: URLSession.shared, registryConfigs: nil, logger: logger ), nestDirectory: NestDirectory(rootDirectory: nestRoot), artifactBundleManager: ArtifactBundleManager(fileSystem: FileManager.default, directory: nestDir), logger: logger ) ``` -------------------------------- ### Install Nest Package Manager Source: https://github.com/mtj0928/nest/blob/main/README.md Installs the Nest package manager itself by downloading the latest artifact bundle and executing the install script. This is the recommended method for initial installation. ```sh curl -s https://raw.githubusercontent.com/mtj0928/nest/main/Scripts/install.sh | bash ``` -------------------------------- ### Configure and Install Binary with NestKit Source: https://github.com/mtj0928/nest/blob/main/_autodocs/README.md Set up NestKit's configuration with necessary dependencies and install an executable binary from an artifact bundle. ```swift import NestKit import Logging // Create configuration let configuration = Configuration( httpClient: URLSession.shared, fileSystem: FileManager.default, fileDownloader: NestFileDownloader(httpClient: URLSession.shared), workingDirectory: URL(fileURLWithPath: FileManager.default.currentDirectoryPath), assetRegistryClientBuilder: AssetRegistryClientBuilder(...), nestDirectory: NestDirectory(rootDirectory: nestRoot), artifactBundleManager: ArtifactBundleManager(...), logger: Logger(label: "com.myapp.nest") ) // Install a binary let sourceInfo = ArtifactBundleSourceInfo(zipURL: downloadURL, repository: repo) let binary = ExecutableBinary( commandName: "swiftlint", binaryPath: binaryPath, version: "0.55.0", manufacturer: .artifactBundle(sourceInfo: sourceInfo) ) try configuration.artifactBundleManager.install(binary) // List installed commands let installed = configuration.artifactBundleManager.list() ``` -------------------------------- ### ArtifactBundleSourceInfo Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Example of creating an ArtifactBundleSourceInfo with a zip URL and no associated repository. ```swift let sourceInfo = ArtifactBundleSourceInfo( zipURL: URL(string: "https://example.com/artifact.zip")!, repository: nil ) ``` -------------------------------- ### Uninstall Command Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Example of uninstalling the 'swiftlint' command with version '0.55.0'. ```swift try manager.uninstall(command: "swiftlint", version: "0.55.0") ``` -------------------------------- ### Install Swift Package from URL with Version Source: https://github.com/mtj0928/nest/blob/main/README.md Installs a Swift package directly from a GitHub repository URL, specifying both the repository and a version number. ```shell $ nest install https://github.com/realm/SwiftLint 0.55.0 ``` -------------------------------- ### Install from GitHub Enterprise Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Installs a package from a GitHub Enterprise instance using a token defined by an environment variable. ```bash export MY_GHE_TOKEN=ghp_xxxxxxxxxxxx nest install https://my-github.example.com/owner/repo 1.0.0 ``` -------------------------------- ### Install with Warn Checksum Policy Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Installs a package, issuing a warning if a checksum is missing but not blocking installation. Checksums are verified if present. ```bash nest install realm/SwiftLint --checksum-policy warn ``` -------------------------------- ### ExecutableManufacturer localBuild Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Example of creating an ExecutableManufacturer for a local build, specifying the repository reference and version. ```swift let repo = Repository(reference: .ssh(SSHURL(...)), version: "1.0.0") let manufacturer = ExecutableManufacturer.localBuild(repository: repo) ``` -------------------------------- ### Install Executable Binary Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Installs an executable binary, including copying files, registering metadata, and creating symbolic links. Ensure the ExecutableBinary object is correctly configured. ```swift public func install(_ binary: ExecutableBinary) throws ``` -------------------------------- ### Install Package from Direct Artifact Bundle URL with Checksum Source: https://github.com/mtj0928/nest/blob/main/README.md Installs a package directly from a provided artifact bundle URL, requiring a checksum for verification. This is mandatory when installing from a direct URL. ```shell $ nest install https://example.com/foo.artifactbundle.zip --checksum abc123... # When installing a direct artifact bundle URL, --checksum is required. ``` -------------------------------- ### Is Linked Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Example of checking if the 'swiftlint' command with provided metadata is linked. ```swift let isLinked = manager.isLinked(name: "swiftlint", commend: command) ``` -------------------------------- ### Install with Require Checksum Policy Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Installs a package, requiring and validating checksums. Installation fails if a checksum is missing or does not match. ```bash nest install realm/SwiftLint --checksum-policy require ``` -------------------------------- ### List Installed Binaries Source: https://github.com/mtj0928/nest/blob/main/README.md Displays a list of all installed executable binaries managed by Nest across all installed packages. ```shell $ nest list ``` -------------------------------- ### Install SwiftLint using Nest Source: https://github.com/mtj0928/nest/blob/main/README.md Installs the SwiftLint executable from the realm/SwiftLint repository. Nest automatically handles downloading artifact bundles or cloning and building the package. ```shell $ nest install realm/SwiftLint ๐Ÿ“ฆ Found an artifact bundle, SwiftLintBinary-macos.artifactbundle.zip, for SwiftLint. ๐ŸŒ Downloading the artifact bundle of SwiftLint... โœ… Success to download the artifact bundle of SwiftLint. ๐Ÿชบ Success to install swiftlint. ``` -------------------------------- ### Handle ArtifactBundleManagerError Source: https://github.com/mtj0928/nest/blob/main/_autodocs/errors.md Example of catching and handling the ArtifactBundleManagerError.resourceConflicting case. This shows how to report conflicting command names and resource files during installation. ```swift do { try manager.install(binary) } catch let ArtifactBundleManagerError.resourceConflicting(name, conflicting, resources) { print("Cannot install \(name)") print("Conflicts with: \(conflicting.joined(separator: ", "))") print("Conflicting files: \(resources.joined(separator: ", "))") } ``` -------------------------------- ### Example Usage of ArtifactBundle.load Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundle.md Demonstrates loading an ArtifactBundle and iterating through its artifacts and variants. Ensure the bundlePath and sourceInfo are correctly configured. ```swift let bundlePath = URL(fileURLWithPath: "/tmp/extracted/SwiftLint.artifactbundle") let sourceInfo = ArtifactBundleSourceInfo( zipURL: downloadURL, repository: Repository(reference: gitURL, version: "0.55.0") ) let bundle = try ArtifactBundle.load( at: bundlePath, sourceInfo: sourceInfo, fileSystem: FileManager.default ) for (artifactID, artifact) in bundle.info.artifacts { print("Artifact: \(artifactID), Version: \(artifact.version)") for variant in artifact.variants { print(" - Path: \(variant.path), Triples: \(variant.supportedTriples)") } } ``` -------------------------------- ### Repository Instance Creation Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Demonstrates how to create a Repository instance using a parsed GitURL and a version string. Ensure GitURL is parsed correctly before instantiation. ```swift let gitURL = GitURL.parse(from: "https://github.com/realm/SwiftLint")! let repo = Repository(reference: gitURL, version: "0.55.0") ``` -------------------------------- ### Access info.json Path Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Retrieves the URL for the info.json file, which tracks installed commands and their metadata. This is useful for inspecting installation details. ```swift let infoPath = nestDir.infoJSON // ~/.nest/info.json ``` -------------------------------- ### List All Installed Commands Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Retrieves a dictionary containing all installed commands, mapping command names to their respective versions and metadata. ```swift public func list() -> [String: [NestInfo.Command]] ``` -------------------------------- ### ExecutableManufacturer artifactBundle Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Example of creating an ExecutableManufacturer for an artifact bundle, including the zip URL and repository information. ```swift let sourceInfo = ArtifactBundleSourceInfo( zipURL: URL(string: "https://github.com/.../releases/download/1.0.0/app.zip")!, repository: Repository(reference: .url(githubURL), version: "1.0.0") ) let manufacturer = ExecutableManufacturer.artifactBundle(sourceInfo: sourceInfo) ``` -------------------------------- ### Create ArtifactBundle Instance Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundle.md Example of creating an ArtifactBundle instance using its constructor with sample data. ```swift let bundle = ArtifactBundle( info: bundleInfo, rootDirectory: URL(fileURLWithPath: "/tmp/extracted/SwiftLint.artifactbundle"), sourceInfo: sourceInfo ) ``` -------------------------------- ### list() Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Retrieves a list of all installed commands and their respective versions. ```APIDOC ## list() ### Description Lists all installed commands and their versions. ### Returns - `[String: [NestInfo.Command]]` โ€” Dictionary mapping command names to list of installed versions and metadata ### Request Example ```swift let installed = manager.list() for (name, commands) in installed { for command in commands { print("\(name) \(command.version)") } } ``` ``` -------------------------------- ### Install Package with Checksum Policy Source: https://github.com/mtj0928/nest/blob/main/README.md Installs a package from a direct artifact bundle URL and specifies the policy for handling missing checksums. Options include 'warn' and 'skip'. ```shell $ nest install https://example.com/foo.artifactbundle.zip --checksum-policy warn ``` ```shell $ nest install https://example.com/foo.artifactbundle.zip --checksum-policy skip ``` -------------------------------- ### Install Package with Checksum Verification Source: https://github.com/mtj0928/nest/blob/main/README.md Installs a package and verifies its artifact bundle against a provided checksum. This ensures the integrity of the downloaded artifact. ```shell $ nest install realm/SwiftLint 0.55.0 --checksum adcc2e3b... # Verify the artifact bundle against a known checksum. ``` -------------------------------- ### Create SSH GitURL Instance Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/GitURL.md Example of creating a GitURL instance for an SSH repository. ```swift let sshURL = GitURL.ssh(SSHURL(user: "git", host: "github.com", path: "realm/SwiftLint")) ``` -------------------------------- ### Handling Resource Conflict Error Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Demonstrates how to catch and handle the `resourceConflicting` error when installing a binary. ```swift do { try manager.install(binary) } catch ArtifactBundleManagerError.resourceConflicting(let name, let conflicting, let resources) { print("Resource conflict: \(resources) from \(name) conflict with \(conflicting)") } ``` -------------------------------- ### Create HTTPS GitURL Instance Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/GitURL.md Example of creating a GitURL instance for an HTTPS repository. ```swift let httpsURL = GitURL.url(URL(string: "https://github.com/realm/SwiftLint")!) ``` -------------------------------- ### nest install Command Usage Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Installs a specified repository version with optional checksum verification. Supports specifying repository reference, version, and checksum options. ```bash nest install REPOSITORY [VERSION] [OPTIONS] nest install realm/SwiftLint 0.55.0 --checksum abc123... ``` -------------------------------- ### Bootstrap Packages from Nestfile Source: https://github.com/mtj0928/nest/blob/main/README.md Installs all packages defined in the `nestfile.yaml`. The `--checksum-policy require` flag enforces checksum verification for all installations. ```shell $ nest bootstrap nestfile.yaml # Opt in to the future strict behavior now. $ nest bootstrap nestfile.yaml --checksum-policy require $ NEST_REQUIRE_CHECKSUM=1 nest bootstrap nestfile.yaml # Pass --checksum-policy skip to bypass verification (not recommended). $ nest bootstrap nestfile.yaml --checksum-policy skip ``` -------------------------------- ### Install with Skip Checksum Policy Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Installs a package without performing any checksum validation. This is useful in untrusted networks or when checksums are unavailable. ```bash nest install realm/SwiftLint --checksum-policy skip ``` -------------------------------- ### Nestfile Structure Source: https://github.com/mtj0928/nest/blob/main/_autodocs/types.md Represents the main configuration file for batch installing multiple packages. It can specify an override for the installation directory, a list of targets, and registry configurations. ```swift public struct Nestfile: Codable, Sendable { public var nestPath: String? public var targets: [Target] public var registries: RegistryConfigs? public init(nestPath: String?, targets: [Target]) } public func write(to path: String, fileSystem: some FileSystem) throws public static func load(from path: String, fileSystem: some FileSystem) throws -> Nestfile ``` -------------------------------- ### Run package with custom nestfile and no install Source: https://github.com/mtj0928/nest/blob/main/README.md Execute a package using a custom nestfile path and prevent automatic installation. This allows for more control over the execution environment. ```bash # Use --no-install flag to prevent automatic installation and specify a custom nestfile location $ nest run --nestfile-path custom-nestfile.yaml --no-install realm/SwiftLint foo.swift ``` -------------------------------- ### Access Installed Commands Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md Iterates through the commands stored in a NestInfo object to print the version and binary path of each installed command. This is useful for inspecting the registry. ```swift let installedCommands = info.commands for (name, versions) in installedCommands { print("\(name):") for command in versions { print(" - \(command.version) at \(command.binaryPath)") } } ``` -------------------------------- ### Run Command Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Executes a tool from a specified repository. Supports skipping automatic installation with --no-install and specifying a custom nestfile path with --nestfile-path. ```bash nest run [OPTIONS] REPOSITORY [ARGS...] ``` -------------------------------- ### Install Swift Package with Specific Version Source: https://github.com/mtj0928/nest/blob/main/README.md Installs a specific version of a Swift package, in this case, SwiftLint version 0.55.0. Versions are optional and default to the latest release if not specified. ```shell $ nest install realm/SwiftLint 0.55.0 # A version can be specified. ``` -------------------------------- ### List All Installed Commands in Swift Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md Iterates through all commands stored in the NestInfo object and prints their names and versions. Requires loading the info.json file first. ```swift let info = try loadInfo() for (name, commands) in info.commands { print("\(name):") for command in commands { print(" \(command.version)") } } ``` -------------------------------- ### Create NestInfo.Command Instance Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md Constructs a Command metadata object with details about an installed command. Specify the version, binary path, resource paths, and manufacturer. ```swift let command = NestInfo.Command( version: "0.55.0", binaryPath: "/artifacts/github.com_realm_SwiftLint/0.55.0/SwiftLint-macos.artifactbundle/swiftlint", resourcePaths: ["/artifacts/github.com_realm_SwiftLint/0.55.0/SwiftLint-macos.artifactbundle/resources.bundle"], manufacturer: .artifactBundle(sourceInfo: sourceInfo) ) ``` -------------------------------- ### Switch Installed Command Version Source: https://github.com/mtj0928/nest/blob/main/README.md Switches the linked version for a command if multiple versions of the same executable are installed. This command makes a specific version the default. ```shell $ nest switch swiftlint 0.55.0 // swiftlint 0.55.0 are selected. ``` -------------------------------- ### bin Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Provides the URL path to the bin directory, which contains symbolic links to all installed command binaries. ```APIDOC ## bin ### Description Provides the path to the bin directory containing symbolic links to all installed command binaries. ### Properties - **bin** (URL) - Path to the bin directory. Returns: `{rootDirectory}/bin` ### Request Example ```swift let binDir = nestDir.bin ``` ``` -------------------------------- ### JSON Structure of info.json Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md This is the expected JSON structure for the info.json file, detailing installed commands like SwiftLint and Xcodes. ```json { "version": "1", "commands": { "swiftlint": [ { "version": "0.55.0", "binaryPath": "/artifacts/github.com_realm_SwiftLint/0.55.0/SwiftLint-macos.artifactbundle/SwiftLint", "resourcePaths": [ "/artifacts/github.com_realm_SwiftLint/0.55.0/SwiftLint-macos.artifactbundle/resources.bundle" ], "manufacturer": { "artifactBundle": { "zipURL": "https://github.com/realm/SwiftLint/releases/download/0.55.0/SwiftLint-macos.artifactbundle.zip", "repository": { "reference": { "url": "https://github.com/realm/SwiftLint" }, "version": "0.55.0" } } } } ], "xcodes": [ { "version": "1.4.1", "binaryPath": "/artifacts/github.com_XcodesOrg_xcodes/1.4.1/local_build/xcodes", "resourcePaths": [], "manufacturer": { "localBuild": { "reference": { "url": "https://github.com/XcodesOrg/xcodes" }, "version": "1.4.1" } } } ] } } ``` -------------------------------- ### Run a tool specified in nestfile Source: https://github.com/mtj0928/nest/blob/main/README.md Execute a package defined in your nestfile. The command automatically handles installation if the required version is not present. ```bash # Run a tool specified in nestfile $ nest run realm/SwiftLint foo.swift ``` -------------------------------- ### Minimal Nestfile Configuration Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md A basic nestfile that installs the latest version of a specified target, such as SwiftLint. ```yaml targets: - reference: realm/SwiftLint ``` -------------------------------- ### Default Nest Directory Structure Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Illustrates the default directory structure created by Nest for managing installed binaries, artifacts, and registry information. ```text ~/.nest/ โ”œโ”€โ”€ bin/ # Symbolic links to installed commands โ”‚ โ”œโ”€โ”€ swiftlint -> ../artifacts/.../swiftlint โ”‚ โ””โ”€โ”€ xcodes -> ../artifacts/.../xcodes โ”œโ”€โ”€ artifacts/ # Downloaded/built binaries โ”‚ โ”œโ”€โ”€ github.com_realm_SwiftLint/ โ”‚ โ”‚ โ””โ”€โ”€ 0.55.0/ โ”‚ โ”‚ โ””โ”€โ”€ SwiftLint-macos.artifactbundle/ โ”‚ โ”‚ โ””โ”€โ”€ swiftlint โ”‚ โ””โ”€โ”€ github.com_XcodesOrg_xcodes/ โ”‚ โ””โ”€โ”€ 1.4.1/ โ”‚ โ””โ”€โ”€ xcodes-macos.artifactbundle/ โ”‚ โ””โ”€โ”€ xcodes โ””โ”€โ”€ info.json # Registry of installed commands ``` -------------------------------- ### Handle AssetRegistryClientError Source: https://github.com/mtj0928/nest/blob/main/_autodocs/errors.md Example of how to catch and handle specific errors thrown by the AssetRegistryClient. This demonstrates handling repository not found and no matching release scenarios. ```swift do { let assets = try await client.fetchAssets(repositoryURL: repoURL, version: .latestRelease) } catch AssetRegistryClientError.notFound { print("Repository not found") } catch AssetRegistryClientError.noMatchApplyingExcludedTarget { print("No releases available after filtering") } ``` -------------------------------- ### GitHub API Request Examples Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/AssetRegistryClient.md Illustrates the different API request formats for fetching releases from GitHub, including specific versions, latest releases, and listing releases with exclusion parameters. ```http GET https://api.github.com/repos/owner/repo/releases/tags/{version} ``` ```http GET https://api.github.com/repos/owner/repo/releases/latest ``` ```http GET https://api.github.com/repos/owner/repo/releases ``` -------------------------------- ### Get Version Directory Path Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Constructs the path to a version-specific directory for a given manufacturer and version. This helps in organizing different versions of the same executable. ```swift let versionPath = nestDir.version(manufacturer: manufacturer, version: "1.0.0") ``` -------------------------------- ### Get Symbolic Link Path in Bin Directory Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Returns the URL for a symbolic link located in the Nest bin directory. Use this to get the path to a command installed by Nest. ```swift public func symbolicPath(name: String) -> URL ``` ```swift let symlinkPath = nestDir.symbolicPath(name: "swiftlint") // ~/.nest/bin/swiftlint ``` -------------------------------- ### infoJSON Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Provides the URL path to the `info.json` file, which is used to track installed commands and their associated metadata. ```APIDOC ## infoJSON ### Description Provides the path to the `info.json` file that tracks installed commands and their metadata. ### Properties - **infoJSON** (URL) - Path to the `info.json` file. Returns: `{rootDirectory}/info.json` ### Request Example ```swift let infoPath = nestDir.infoJSON ``` ``` -------------------------------- ### rootDirectory Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Provides access to the root directory URL where the Nest installation stores all artifacts and binaries. ```APIDOC ## rootDirectory ### Description Represents the root directory where nest stores all artifacts and binaries. ### Properties - **rootDirectory** (URL) - The root directory where nest stores all artifacts and binaries. ### Request Example ```swift let rootPath = nestDir.rootDirectory ``` ``` -------------------------------- ### Handle FileDownloaderError Source: https://github.com/mtj0928/nest/blob/main/_autodocs/errors.md Example of catching the FileDownloaderError.notFound case. This demonstrates how to inform the user when a file could not be found at the specified URL during a download attempt. ```swift do { let path = try await downloader.download(url: fileURL) } catch FileDownloaderError.notFound(let url) { print("File not found at: \(url.absoluteString)") } ``` -------------------------------- ### NestInfo.Command Structure Source: https://github.com/mtj0928/nest/blob/main/_autodocs/types.md Contains metadata for a specific installed command version, including its path and resources. Use this to manage individual command details. ```swift public struct Command: Codable, Sendable, Equatable, Hashable { public var version: String public var binaryPath: String public var resourcePaths: [String] public var manufacturer: ExecutableManufacturer public init(version: String, binaryPath: String, resourcePaths: [String], manufacturer: ExecutableManufacturer) } ``` -------------------------------- ### AssetRegistryClientError Example Source: https://github.com/mtj0928/nest/blob/main/_autodocs/README.md Demonstrates a custom error type conforming to LocalizedError for user-friendly error messages. ```swift public enum AssetRegistryClientError: LocalizedError { case notFound var errorDescription: String? { "Not found for the repository." } } ``` -------------------------------- ### Fetch Release Assets Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/AssetRegistryClient.md Fetches all available release assets for a specified repository and Git version. Use this to get all artifacts for a release. ```swift func fetchAssets(repositoryURL: URL, version: GitVersion) async throws -> AssetInformation ``` ```swift let assetInfo = try await client.fetchAssets( repositoryURL: URL(string: "https://github.com/realm/SwiftLint")!, version: .latestRelease ) print("Tag: \(assetInfo.tagName)") for asset in assetInfo.assets { print("Asset: \(asset.fileName) -> \(asset.url)") } ``` -------------------------------- ### Nestfile with Checksums and Enterprise GitHub Registries Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md A comprehensive nestfile example including specific versions, checksums for artifact verification, and configuration for multiple GitHub registries. ```yaml nestPath: ~/.nest targets: - reference: realm/SwiftLint version: 0.55.0 checksum: adcc2e3b4d48606cba7787153b0794f8a87e5289803466d63513f04c4d7661fb - reference: https://my-github.example.com/internal/tool version: 1.0.0 checksum: abc123def456... registries: github: - host: github.com tokenEnvironmentVariable: GH_TOKEN - host: my-github.example.com tokenEnvironmentVariable: MY_GHE_TOKEN ``` -------------------------------- ### Nest CLI Commands Source: https://github.com/mtj0928/nest/blob/main/_autodocs/README.md Lists the available commands for the nest executable CLI tool, used for managing software installations and configurations. ```plaintext nest install REPOSITORY [VERSION] [OPTIONS] nest uninstall COMMAND [VERSION] nest list nest switch COMMAND VERSION nest bootstrap NESTFILE [OPTIONS] nest generate-nestfile nest update-nestfile NESTFILE [OPTIONS] nest resolve-nestfile NESTFILE nest run [OPTIONS] REPOSITORY [ARGS...] ``` -------------------------------- ### Extract Repository Information from Command Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md Retrieves repository details (reference and version) from a Command's manufacturer if it was installed from a known repository. Returns nil for local builds. ```swift if let repo = command.repository { print("Repository: \(repo.reference)") print("Version: \(repo.version)") } ``` -------------------------------- ### Nest Directory Structure Source: https://github.com/mtj0928/nest/blob/main/_autodocs/README.md Illustrates the default directory structure used by nest for managing installed commands, artifacts, and registry information. ```plaintext ~/.nest/ โ”œโ”€โ”€ bin/ # Symbolic links to installed commands โ”œโ”€โ”€ artifacts/ # Downloaded/built binaries organized by source โ””โ”€โ”€ info.json # Registry of all installed commands and versions ``` -------------------------------- ### Access Bin Directory Path Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Retrieves the URL for the bin directory, which contains symbolic links to installed command binaries. Use this to locate executable commands. ```swift let binDir = nestDir.bin // ~/.nest/bin ``` -------------------------------- ### Get Complete Binary Path Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Returns the full, absolute path to the executable binary file. This is the final destination for locating and running a specific executable. ```swift let binPath = nestDir.binaryPath(of: executableBinary) // ~/.nest/artifacts/github.com_realm_SwiftLint/1.0.0/SwiftLint-macos/swiftlint ``` -------------------------------- ### Get Temporary Directory Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/FileSystem.md Accesses the system's temporary directory for creating scratch files. This is suitable for temporary data that can be deleted later. ```swift let tempDir = fileSystem.temporaryDirectory let tempFile = tempDir.appending(component: "download.zip") ``` -------------------------------- ### Get Source Directory Path Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Constructs the path to a source-specific directory within the artifacts directory. This path is identified by the source information of the executable manufacturer. ```swift let sourceInfo = ArtifactBundleSourceInfo(zipURL: URL(string: "https://example.com/app.zip")!, repository: nil) let manufacturer = ExecutableManufacturer.artifactBundle(sourceInfo: sourceInfo) let sourcePath = nestDir.source(manufacturer) ``` -------------------------------- ### init(fileSystem:directory:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Initializes the ArtifactBundleManager with the necessary file system and directory structure managers. ```APIDOC ## init(fileSystem:directory:) ### Description Initializes the ArtifactBundleManager with the necessary file system and directory structure managers. ### Parameters #### Path Parameters - **fileSystem** (any FileSystem) - Yes - File system provider for operations - **directory** (NestDirectory) - Yes - Nest directory structure manager ### Request Example ```swift let manager = ArtifactBundleManager( fileSystem: FileManager.default, directory: NestDirectory(rootDirectory: nestRoot) ) ``` ``` -------------------------------- ### Fetch and Process Assets with AssetRegistryClient Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/AssetRegistryClient.md Demonstrates how to fetch assets for a given repository URL and version, then locate and print the download URL for an artifact bundle. Includes error handling for common issues like repository not found, network errors, and unexpected errors. ```swift do { let assets = try await client.fetchAssets( repositoryURL: repoURL, version: .latestRelease ) // Find artifact bundle let bundleAsset = assets.assets.first { $0.fileName.contains("artifactbundle") } guard let bundleAsset = bundleAsset else { print("No artifact bundle found in release") return } print("Downloading from: \(bundleAsset.url)") } catch AssetRegistryClientError.notFound { print("Repository or release not found") } catch let error as URLError { print("Network error: \(error.localizedDescription)") } catch { print("Unexpected error: \(error)") } ``` -------------------------------- ### Configuration Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/Configuration.md Initializes a new Configuration instance with all necessary dependencies. Ensure all parameters are correctly provided. ```swift public init( httpClient: some HTTPClient, fileSystem: some FileSystem, fileDownloader: some FileDownloader, workingDirectory: URL, assetRegistryClientBuilder: AssetRegistryClientBuilder, nestDirectory: NestDirectory, artifactBundleManager: ArtifactBundleManager, logger: Logger ) ``` -------------------------------- ### Repository Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Initializes a Repository instance with a Git URL and a version string. Use this to create a new repository reference. ```swift public init(reference: GitURL, version: String) ``` -------------------------------- ### Mock FileSystem Implementation for Testing Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/FileSystem.md Illustrates the creation of a mock FileSystem class for testing purposes. This allows for isolated testing of components that depend on the FileSystem protocol. ```swift class MockFileSystem: FileSystem { // Implement all required methods for testing } ``` -------------------------------- ### FileManager Conformance to FileSystem Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/FileSystem.md Demonstrates how to obtain a FileSystem instance using the default FileManager. This instance can then be used for file operations. ```swift extension FileManager: FileSystem ``` ```swift let fileSystem: FileSystem = FileManager.default try fileSystem.createDirectory(at: dirURL, withIntermediateDirectories: true) ``` -------------------------------- ### NestInfo Type Definition Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md Defines the structure for storing Nest installation information, including version and a map of commands to their installed versions. ```swift public struct NestInfo: Codable, Sendable, Equatable, Hashable { public var version: String public var commands: [String: [Command]] public init(version: String, commands: [String: [Command]]) } ``` -------------------------------- ### init(rootDirectory:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Initializes a NestDirectory instance with a specified root directory path. This directory serves as the base for all nest artifacts and binaries. ```APIDOC ## init(rootDirectory:) ### Description Initializes a NestDirectory with a root directory path. This path is where all nest artifacts and binaries will be stored. ### Parameters #### Path Parameters - **rootDirectory** (URL) - Required - The root path where all nest artifacts and binaries are stored. ### Request Example ```swift let nestDir = NestDirectory(rootDirectory: URL(fileURLWithPath: "~/.nest")) ``` ### Response Returns: `NestDirectory` instance ``` -------------------------------- ### Get Binary Directory from ExecutableBinary Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md A convenience method to get the binary directory for an existing ExecutableBinary object. This simplifies path retrieval when you already have the binary information. ```swift let binDir = nestDir.binaryDirectory(of: executableBinary) ``` -------------------------------- ### NestCLIError Enum Source: https://github.com/mtj0928/nest/blob/main/_autodocs/errors.md Defines errors specific to the Nest CLI operations, such as attempting to install a command that is already installed. Use this to provide feedback on CLI command failures. ```swift public enum NestCLIError: LocalizedError { case alreadyInstalled } ``` -------------------------------- ### ArtifactBundleManagerError Enum Source: https://github.com/mtj0928/nest/blob/main/_autodocs/errors.md Defines errors related to artifact bundle installations, specifically when resource files conflict between commands. Use this to handle installation failures due to naming conflicts. ```swift enum ArtifactBundleManagerError: LocalizedError { case resourceConflicting(commandName: String, conflictingNames: [String], resourceNames: [String]) } ``` -------------------------------- ### Initialize NestDirectory Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Initializes a NestDirectory with a specified root directory path. Use this to set up the base path for all nest artifacts. ```swift let nestDir = NestDirectory(rootDirectory: URL(fileURLWithPath: "~/.nest")) let binPath = nestDir.bin // ~/.nest/bin ``` -------------------------------- ### NestInfo Source: https://github.com/mtj0928/nest/blob/main/_autodocs/types.md Represents information about installed commands and the Nest version. It stores metadata in `~/.nest/info.json`. ```APIDOC ## NestInfo ### Description Represents information about installed commands and the Nest version. It stores metadata in `~/.nest/info.json`. ### Fields - **version** (String) - Yes - Schema version (currently "1") - **commands** ([String: [Command]]) - Yes - Map of command name to list of installed versions ### Static Properties - **currentVersion** (String) - The current info.json schema version. ``` -------------------------------- ### GitHubAssetRegistryClient Initialization Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/AssetRegistryClient.md Initializes a concrete implementation of AssetRegistryClient using the GitHub API. Requires an HTTP client, optional registry configurations, and a logger. ```swift public struct GitHubAssetRegistryClient: AssetRegistryClient { public init(httpClient: some HTTPClient, registryConfigs: GitHubRegistryConfigs?, logger: Logger) } ``` -------------------------------- ### link(_:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundleManager.md Creates symbolic links for a given binary and its resources in the bin directory, checking for conflicts. ```APIDOC ## link(_:) ### Description Creates symbolic links for the binary and its resources in the bin directory. Checks for resource conflicts with existing installations. ### Parameters #### Path Parameters - **binary** (ExecutableBinary) - Yes - The executable binary to link ### Throws - `ArtifactBundleManagerError.resourceConflicting` โ€” Resource names conflict with another installed command ### Request Example ```swift try manager.link(binary) ``` ``` -------------------------------- ### binaryDirectory(manufacturer:version:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Returns the directory containing the binary executable. It determines the build kind based on whether the manufacturer is an artifact bundle or a local build. ```APIDOC ## binaryDirectory(manufacturer:version:) ### Description Returns the directory containing the binary executable. For artifact bundles, uses the bundle filename; for local builds, uses "local_build". ### Parameters #### Path Parameters - **manufacturer** (ExecutableManufacturer) - Required - The executable manufacturer. - **version** (String) - Required - Version string. ### Returns `URL` โ€” Path to `{version}/{build_kind}` ### Example ```swift let binDir = nestDir.binaryDirectory(manufacturer: manufacturer, version: "1.0.0") // ~/.nest/artifacts/github.com_realm_SwiftLint/1.0.0/SwiftLint-macos ``` ``` -------------------------------- ### Repository Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Creates a Repository instance with a specified Git URL and version. ```APIDOC ## init(reference:version:) ### Description Creates a Repository instance with a specified Git URL and version. ### Parameters #### Path Parameters - **reference** (GitURL) - Yes - Git URL (https or SSH) of the repository - **version** (String) - Yes - Version string (tag or release) ### Returns `Repository` instance ### Example ```swift let gitURL = GitURL.parse(from: "https://github.com/realm/SwiftLint")! let repo = Repository(reference: gitURL, version: "0.55.0") ``` ``` -------------------------------- ### ExecutableBinary Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Creates a new ExecutableBinary instance with the specified command name, binary path, version, and manufacturer. ```APIDOC ## init(commandName:binaryPath:version:manufacturer:) ### Description Create a new ExecutableBinary. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **commandName** (String) - Yes - Name of the command (e.g., "swiftlint") - **binaryPath** (URL) - Yes - Path to the executable file - **version** (String) - Yes - Version string (e.g., "1.0.0") - **manufacturer** (ExecutableManufacturer) - Yes - Source of the binary (.artifactBundle or .localBuild) ### Request Example ```swift let binary = ExecutableBinary( commandName: "swiftlint", binaryPath: URL(fileURLWithPath: "/tmp/swiftlint"), version: "0.55.0", manufacturer: .localBuild(repository: repository) ) ``` ### Response #### Success Response (200) Returns an ExecutableBinary instance. #### Response Example ```swift // ExecutableBinary instance created ``` ``` -------------------------------- ### NestInfo.Command Source: https://github.com/mtj0928/nest/blob/main/_autodocs/types.md Metadata for a single installed command version, including its version, binary path, resource paths, and manufacturer. ```APIDOC ## NestInfo.Command ### Description Metadata for a single installed command version, including its version, binary path, resource paths, and manufacturer. ### Fields - **version** (String) - Yes - Version of the installed command - **binaryPath** (String) - Yes - Relative path to the binary from nest root - **resourcePaths** ([String]) - Yes - Relative paths to resource files (.bundle) - **manufacturer** (ExecutableManufacturer) - Yes - Source of the binary ### Computed Properties - **repository** (Repository?) - Extracts repository from manufacturer if available. ``` -------------------------------- ### Get Repository Reference Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/GitURL.md Retrieves the 'owner/repo' formatted reference from a GitURL if parseable. Returns nil if the reference cannot be determined. ```swift public var reference: String? ``` ```swift let gitURL = GitURL.parse(from: "https://github.com/realm/SwiftLint")! print(gitURL.reference!) // "realm/SwiftLint" let sshURL = GitURL.parse(from: "git@github.com:realm/SwiftLint.git")! print(sshURL.reference!) // "realm/SwiftLint" ``` -------------------------------- ### Load ArtifactBundle from Path Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundle.md Static method to load an ArtifactBundle from a given directory path by reading its info.json file. Requires a FileSystem provider. ```swift public static func load( at path: URL, sourceInfo: ArtifactBundleSourceInfo, fileSystem: some FileSystem ) throws -> ArtifactBundle ``` -------------------------------- ### Set NEST_PATH Environment Variable Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md Overrides the default nest installation directory for all operations. This is an alternative to setting `nestPath` in the nestfile. ```bash export NEST_PATH=~/.custom_nest nest install realm/SwiftLint ``` -------------------------------- ### Configure Repository with GitURL Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/GitURL.md Demonstrates using a parsed GitURL to configure a Repository object, which can then be used in other contexts like ArtifactBundleSourceInfo. ```swift let gitURL = GitURL.parse(from: "realm/SwiftLint")! let repo = Repository(reference: gitURL, version: "0.55.0") let sourceInfo = ArtifactBundleSourceInfo( zipURL: URL(string: "https://example.com/artifact.zip")!, repository: repo ) ``` -------------------------------- ### Get Home Directory Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/FileSystem.md Retrieves the home directory of the current user. This is useful for accessing user-specific configuration or data files. ```swift let homeDir = fileSystem.homeDirectoryForCurrentUser print(homeDir) // file:///Users/username ``` -------------------------------- ### ArtifactBundle Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ArtifactBundle.md Initializes an ArtifactBundle instance with provided metadata, root directory, and source information. ```swift public init(info: ArtifactBundleInfo, rootDirectory: URL, sourceInfo: ArtifactBundleSourceInfo) ``` -------------------------------- ### Generate Nestfile Source: https://github.com/mtj0928/nest/blob/main/README.md Generates a basic `nestfile.yaml` configuration file in the current directory. This file is used to define multiple package installations. ```shell $ nest generate-nestfile ``` -------------------------------- ### Uninstall Swift Package Source: https://github.com/mtj0928/nest/blob/main/README.md Uninstalls a Swift package. If a version is specified, only that version is removed; otherwise, all installed versions of the package are uninstalled. ```shell $ nest uninstall swiftlint # All versions of swiftlint are uninstalled. ``` ```shell $ nest uninstall swiftlint 0.55.0 # A version can be specified. ``` -------------------------------- ### Create NestInfo Instance Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestInfo.md Constructs a new NestInfo registry with the specified schema version and command mappings. Use NestInfo.currentVersion for the schema version. ```swift let info = NestInfo( version: NestInfo.currentVersion, commands: [ "swiftlint": [command1, command2], "xcodes": [command3] ] ) ``` -------------------------------- ### ExecutableBinary Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Creates a new ExecutableBinary instance. Requires command name, binary path, version, and manufacturer details. ```swift public init(commandName: String, binaryPath: URL, version: String, manufacturer: ExecutableManufacturer) ``` -------------------------------- ### relativePath(_:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Converts an absolute path to a relative path from the root directory. This is helpful for creating paths that are independent of the absolute location of the Nest installation. ```APIDOC ## relativePath(_:) ### Description Converts an absolute path to a relative path from the root directory. ### Method Swift Function ### Parameters #### Path Parameters - **url** (URL) - Yes - Absolute path to convert ### Returns `String` โ€” Relative path from root directory ### Example ```swift let absPath = nestDir.artifacts.appending(component: "app/1.0.0/app") let relPath = nestDir.relativePath(absPath) // "/artifacts/app/1.0.0/app" ``` ``` -------------------------------- ### ArtifactBundleSourceInfo Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Creates an ArtifactBundleSourceInfo instance. Requires the zip URL and optionally accepts repository information. ```swift public init(zipURL: URL, repository: Repository?) ``` -------------------------------- ### ArtifactBundleSourceInfo Constructor Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/ExecutableBinary.md Creates an ArtifactBundleSourceInfo instance with the specified zip URL and optional repository. ```APIDOC ## init(zipURL:repository:) ### Description Create ArtifactBundleSourceInfo. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **zipURL** (URL) - Yes - URL where the artifact bundle zip file is located - **repository** (Repository?) - No - If identified, the Git repository this came from ### Request Example ```swift let sourceInfo = ArtifactBundleSourceInfo( zipURL: URL(string: "https://example.com/artifact.zip")!, repository: nil ) ``` ### Response #### Success Response (200) Returns an ArtifactBundleSourceInfo instance. #### Response Example ```swift // ArtifactBundleSourceInfo instance created ``` ``` -------------------------------- ### Nestfile targets Configuration Source: https://github.com/mtj0928/nest/blob/main/_autodocs/configuration.md A required list of packages to install. Each target can be specified by a repository reference, a direct ZIP URL, or a deprecated ZIP format. ```yaml targets: - reference: realm/SwiftLint - reference: XcodesOrg/xcodes version: 1.4.1 - zipURL: https://example.com/artifact.zip checksum: abc123... ``` -------------------------------- ### source(_:) Source: https://github.com/mtj0928/nest/blob/main/_autodocs/api-reference/NestDirectory.md Returns the path to the source-specific directory for a given executable manufacturer. This path is identified by the source's git or zip URL. ```APIDOC ## source(_:) ### Description Returns the path to the source-specific directory for a given executable manufacturer. The directory structure identifies the source by the git URL or zip URL of the artifact. ### Parameters #### Path Parameters - **manufacturer** (ExecutableManufacturer) - Required - Either `.artifactBundle` with source info or `.localBuild` with repository. ### Returns `URL` โ€” Path to `{artifacts}/{source_identifier}` ### Example ```swift let sourceInfo = ArtifactBundleSourceInfo(zipURL: URL(string: "https://example.com/app.zip")!, repository: nil) let manufacturer = ExecutableManufacturer.artifactBundle(sourceInfo: sourceInfo) let sourcePath = nestDir.source(manufacturer) ``` ```