Forward --verbose flag to Swift Package Manager during tuist install

This is almost a bug, but the functionality is not something explicitly called out as far as I can tell. As such, I thought I’d get ‘approval’ before actually opening it as an issue.

Forgive the AI generated text, it does a much more complete job of documenting what I’m after than I would. If this is not allowed, feel free to delete this post.

Description:

When running tuist install --verbose, the --verbose flag only affects Tuist’s own logging level (via TUIST_CONFIG_VERBOSE). It is not forwarded to the underlying swift package resolve / swift package update invocation. This means SPM runs at its default log level (.warning) even when the user has explicitly requested verbose output.

SPM supports --verbose (log level .info) and --vv (log level .debug), which surface additional diagnostic information about dependency resolution, cache behavior, and package fetching. This information is valuable when troubleshooting dependency issues but is currently inaccessible without knowing about the passthrough mechanism.

Current behavior:

tuist install --verbose executes:

swift package --package-path resolve

The verbose flag is consumed by Tuist and does not appear in the SPM command.

Workarounds that exist today:

Users can manually pass flags through to SPM via:

  • CLI: tuist install -- --verbose

  • Config in Tuist.swift:

    .options(
        installOptions: .init(
             passthroughSwiftPackageManagerArguments: ["--verbose"]
        )
    )
    

These work but are not discoverable. A user running tuist install --verbose would reasonably expect to see verbose output from all tools in the chain, including SPM.

Proposed behavior:

When Tuist’s verbose mode is active, automatically prepend --verbose to the arguments passed to swift package resolve / swift package update, unless the user has already specified a verbosity flag (to avoid conflicts with --vv or --quiet passed via passthrough).

Suggested implementation:

In InstallService.swift, the fetchDependencies method (line 65) already merges config and passthrough arguments via the arguments(config:passthroughArguments:) helper. The change would be to check for Tuist’s verbose state and inject --verbose if no SPM verbosity flag is already present:

private func arguments(config: Tuist, passthroughArguments: [String]) -> [String] {
    let configArguments = config.project.generatedProject?.installOptions.passthroughSwiftPackageManagerArguments ?? []
    var merged = configArguments + passthroughArguments

    let verbosityFlags: Set<String> = ["--verbose", "-v", "--vv", "--very-verbose", "--quiet", "-q"]

    let hasVerbosityFlag = merged.contains(where: { verbosityFlags.contains($0) })

    if !hasVerbosityFlag && Environment.current.variables["TUIST_CONFIG_VERBOSE"] == "true" {
        merged.insert("--verbose", at: 0)
    }

    return merged

}

Alternatively, this could be handled in SwiftPackageManagerController.resolve/.update so it applies consistently to all SPM invocations, not just those from InstallService.

Additional context:

  • The --verbose flag is set at CLI bootstrap in Dependencies.swift (line 42-44) via the TUIST_CONFIG_VERBOSE environment variable.

  • The tuist generate path uses xcodebuild -resolvePackageDependencies instead of swift package resolve, and has its own separate additionalPackageResolutionArguments config. That path would not be affected by this change.