Setup Swift CLI
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Generate a complete, buildable Swift command-line tool at the repository root that follows this catalog’s agent-friendly CLI contract.
Purpose
iru-setup-swift-cli scaffolds a SwiftPM package (swift-tools-version 6.0 by default, Swift 6 language mode, macOS 15+ and Linux)
from templates embedded in its reference/ files. The executable target Sources/<Bin>/ is deliberately thin: an
AsyncParsableCommand root plus the greet [NAME], completion <bash|zsh|fish> and schema [COMMAND] [--asciidoc]
subcommands and --version. Every behavior lives in the Sources/<Bin>Kit/ library so it is unit-tested in-process:
-
the exit-code enum exactly as the catalog’s CLI contract (0-7, 130, 143), with usage errors mapped to exit 2 instead of swift-argument-parser’s default 64;
-
--help/--versionon stdout, a JSON error envelope on stderr,--format text|json|jsonl/--json; -
colour and prompt policy (
--no-color,NO_COLOR,FORCE_COLOR,TERM=dumb,isattyper stream,--no-input,CI=true); -
SIGINT/SIGTERM handling (exit 130/143), SIGPIPE ignored, and a
schemacommand tree built from--experimental-dump-help.
It also writes Swift Testing targets (an in-process Kit suite targeting at least 80% line coverage, and a CLI suite that runs the
built executable and asserts stdout, stderr and exit status), .swift-format, .swiftlint.yml, a DocC catalog,
scripts/generate-docs.sh (man page, shell completions, schema.json and an Antora CLI-reference partial) and, when
opted in, sonar-project.properties. No terminal UI is offered, because the only Swift TUI library has been dormant since
2024; the Rust or Go scaffold is recommended for a full-screen TUI. The skill announces whether it is scaffolding from
scratch or updating, and for every file group it owns that already exists it warns and asks Update / Keep as is / Replace /
Stop (unless on-existing decides). It never overwrites hand-written source and writes no CI workflow, .gitignore, README,
changelog, LICENSE or Antora page.
Plugin
Shipped by the iru-cli plugin of the ai-catalog marketplace (install with /plugin install iru-cli@ai-catalog; see Plugins).
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
|
No |
Pre-resolved parameters passed by an orchestrator (for example Setup CLI Repository) as
newline-separated |
None — every field is asked interactively. |
|
Yes (unless supplied via |
Executable name matching |
None |
|
No |
SwiftPM package identity written to |
|
|
Yes (unless supplied via |
One sentence; becomes the root command’s abstract and the man page |
None |
|
No |
The |
|
|
No |
|
|
|
No |
GitHub owner; only feeds the Sonar defaults. |
Parsed from |
|
Yes (unless supplied via |
Display name, SPDX expression or |
None — user chooses (Apache License 2.0 recommended) |
|
Yes (unless supplied via |
Populate the generated license headers. |
None |
|
No |
Only key the |
Asked stand-alone for |
|
No |
|
|
|
No |
|
Unset |
|
No |
|
Unset |
|
No |
|
|
|
No |
|
|
Outputs
-
Package.swift,.swift-format,.swiftlint.ymlandscripts/generate-docs.sh(kept executable). -
Sources/<Bin>/with the root command and thegreet,completionandschemasubcommands. -
Sources/<Bin>Kit/with the contract implementation (exit codes, error envelope, output, terminal, streams, signal trap, command runner, schema) plus a DocC catalog<Bin>Kit.docc/<Bin>Kit.md, andVersion.swiftholding the singletoolVersion = "0.1.0-dev"literal. -
Tests/<Bin>KitTests/(in-process Swift Testing) andTests/<Bin>CLITests/(runs the built binary). -
sonar-project.properties, only whensonaris notnone. -
A report of the resolved names, versions (live versus fallback), license, per-group action (created, updated, replaced or kept as is), what is included or omitted and why (no TUI, config-file extension point, ignored keys), the pass, fail or unverified result of each verification command, suggested Antora pages, and a warning block (review generated files, run
iru-setup-swift-gitignorewithflavor: cli, keeptoolVersiona single literal, Sonar prerequisites, re-check dependency versions before a first release).
Execution flow
Dependencies
Invokes
-
Swift Coverage — optionally, in Step 7 for the coverage check, run through the
iru-gate-runneragent (the skill may instead runllvm-covdirectly).
The Step 7 build, test, format, SwiftLint, DocC and docs-generator commands are also run through
iru-gate-runner rather than inline.
Invoked by
-
Setup CLI Repository — the
swiftflavor delegates the scaffold to this skill, passing resolved inputs throughargs.
Related agents
-
iru-gate-runner— Step 7 runs the build, tests, coverage and quality checks through it so the caller gets a compact summary instead of long logs.
Source
SKILL.md on GitHub — the file this page was generated from.