Skip to content

About

Computer MCP family plugin for verified Swift formatting and linting.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Swift Format

Computer MCP family plugin for verified Swift formatting and linting.

CI swift-format from Swift 6.3.1 License: FSL-1.1-ALv2

Install · Usage · Interface · Documentation · Contributing

Overview

This plugin gives Computer MCP typed tools for the swift-format supplied with Swift 6.3.1: formatting, linting, configuration output and help. The formatter stays yours. The plugin ships no Swift or vendor binaries and does not change PATH; you bind the executable you already have.

Before every authorized call, the Gateway checks the bound executable's version and native interface digest against this plugin's verified baseline. A mismatch stops the call until you select a compatible binding or install a reviewed plugin update. These checks run the vendor executable with closed stdin in the registered working directory and environment, share a bounded time budget, and never run during installation or a static doctor check.

Quick look

The plugin adds one CLI contribution, format. Its root command formats, like the upstream default, and it has these subcommands:

Command Result
format Formats files or stdin; in_place: true overwrites the listed files
lint Reports style findings; strict: true makes findings fail the command
dump-configuration Prints the effective or default configuration as JSON
help Prints upstream help

Install it in the host, bind the formatter dependency, then call the generated tool. For format, pass:

{"paths":["-"],"source":"let value=1\n","color_diagnostics":false,"project_id":"YOUR_PROJECT"}

The result carries the real stdout, stderr, exit status and timeout information.

Install

  1. Build the package archive (see Package archive), or add this checkout with Computer MCP's local plugin entry.
  2. Install the archive through the host's plugin management UI or CLI.
  3. In the plugin's settings, bind the formatter dependency to the actual swift-format from Swift 6.3.1 and verify its --version.
  4. Enable the format CLI contribution. The tools run inside a project and need Full Shell permission.

Disabling or removing the plugin revokes its contribution, not the external formatter. Host overrides and the dependency binding belong to Computer MCP.

Usage

Use tools/list to obtain the generated tool names; titles contain the registration and command path. Pass files in paths; ["-"] selects stdin explicitly. Omitting paths still reads stdin but emits an upstream deprecation warning. No artificial dry run is supplied.

cli-tree.json is generated from the formatter's native machine export, not parsed help text or a handwritten list. Every argument of the five observed commands is accounted for, including hidden debug arguments; preferred spellings stand for equivalent aliases, and one Boolean covers the verified color/inverse pair. The export's missing default-subcommand and stdin semantics are supplemented from the matching upstream source. Coverage is explicitly partial: experimental parser-control entry points are not formatting tools, and value-dependent validation stays in the formatter. See Interface.

Package archive

With Python 3.11 or newer:

python3 scripts/build_package.py OUTPUT_DIRECTORY

This writes swift-format.zip and prints its ID, version and SHA-256. The archive contains the declaration, generated tree, manuals, license and upstream notices; it contains neither the maintainer exporter nor the vendor formatter. Identical inputs produce identical bytes, and an existing different archive is preserved and reported as an error. Review the dependency binding and grants when you install it.

Regenerate the interface

The exporter is a maintainer tool, not a replacement formatter or runtime service. Build it with Swift 6.2 or newer; it uses swift-argument-parser for options, validation and help. In a shell with set -o pipefail:

swift build
swift test
SWIFT_FORMAT=/absolute/path/to/swift-format
"$SWIFT_FORMAT" --experimental-dump-help | .build/debug/export-swift-format-tree \
  --executable-version "$("$SWIFT_FORMAT" --version)" --output cli-tree.json

The native export must match the pinned baseline: an unknown version or a changed export stops generation. Review upstream source and tests before supporting another version, and do not bypass the drift check. The exporter writes atomically after complete validation, reports structured errors on stderr, and runs by explicit path from any directory. Updating the verified interface needs no vendor-specific Gateway code.

Requirements

  • Computer MCP.
  • swift-format from Swift 6.3.1, bound in the plugin's settings.
  • Python 3.11 or newer to build the package archive.
  • Swift 6.2 or newer to build and test the exporter.

Documentation

The documentation index covers the architecture, the interface and the release process. CI validates the exporter and the package on pull requests, master pushes and manual runs, and repeats the package tests and build on Python 3.11. Its downloadable workflow artifacts are validation outputs, not a public plugin release.

Contributing

See the contributor guide.

License

Computer MCP-owned code and resources use the Functional Source License 1.1, Apache 2.0 Future License (FSL-1.1-ALv2). Third-party notices identify the separate rights covering upstream descriptions and dependencies.

About

Computer MCP family plugin for verified Swift formatting and linting.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages