Setup Swift Gitignore
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Create or refresh the root .gitignore for a Swift package or Apple app project, composing a universal
SwiftPM/Xcode base plus conditionally-detected sections for generator-managed Xcode projects, Package.resolved,
Fastlane, macOS desktop distribution output, command-line tool outputs (flavor: cli), signing material, and Antora/DocC documentation output — never overwriting an existing file without
warning the user, showing a diff of the proposed merge, and asking Update / Keep as is / Replace first.
Purpose
iru-setup-swift-gitignore composes a Swift/Xcode-appropriate .gitignore: an unconditional base
(.build/, DerivedData/, .xcresult, xcuserdata/, .xcuserstate, the narrowly-scoped .swiftpm/xcode/,
.DS_Store) plus sections detected from the actual project — an XcodeGen/Tuist-generated .xcodeproj/
.xcworkspace (only when project.yml/Project.swift is present; otherwise the project file is hand-maintained
and must stay tracked), a Package.resolved commit-vs-ignore decision (resolved via args or asked through
AskUserQuestion, informed by flavor), Fastlane output paths, macOS desktop distribution output, signing material, and Antora/DocC build output.
A macOS desktop app is recognised by scripts/make-dmg.sh or a root ExportOptions-.plist (the iru-setup-macos-app
layout): its archive/export/DMG/notarization output lands under the root build/, so the skill first checks
(git ls-files — build, ls build) whether anything there must stay tracked, then adds an anchored /build/ plus
.xcarchive/, .dmg and -notarize.zip — or, when build/ holds tracked or hand-made content such as a branding
icon source, only its generated subfolders (/build/dd*/, /build/docc/, /build/export*/). /build/ is anchored so it
never matches docs/build/. The base now also ignores the transient .simulator-test.lock/ directory that
iru-swift-code-one-task-group creates around every app-kind xcodebuild test run (simulator or macOS desktop UI
tests). The section was verified against a real iru-setup-macos-app scaffold run.
For an app (flavor: app) or a package with UI (never flavor: cli) it also ignores the UI tests' unanchored
.ui-screenshots/ capture directory from the catalog’s UI contract, and never
ignores .ui-quality.yml.
It announces whether it is creating .gitignore from scratch or updating an existing one. It mirrors the diff-and-approve contract shared with the sibling
Setup Java Gitignore / Setup TypeScript Gitignore /
Setup Android Gitignore skills, adapted for the Swift/Xcode ecosystem, and fits into the
catalog’s Swift/Apple bootstrap pipeline as the leaf step that runs once scaffolding and docs are in place.
Plugin
Shipped by the iru-swift plugin of the ai-catalog marketplace (install with /plugin install iru-swift@ai-catalog; see Plugins).
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
|
No |
|
Detected from whether a root |
|
No |
|
Inferred (the |
|
No |
|
Asked via |
|
No |
|
|
Command-line tool outputs
With flavor: cli (or when scripts/generate-docs.sh exists) the skill adds root-anchored /dist/, /build/, /.tar.gz,
/.zip and /SHA256SUMS for the docs generator’s and release packaging’s output. The generated Antora partial
cli-reference.adoc stays committed, and Package.resolved is committed by default for a CLI.
Outputs
-
A
.gitignorefile at the repository root — newly created, updated (merged), or replaced. -
If
.gitignoredidn’t previously exist: it is written directly, no approval step needed. -
If
.gitignorealready existed: a diff of the proposed merge is shown first (viagit diff --no-index), then the user chooses Update (merge, keeping every hand-added entry), Keep as is (file untouched; missing expected entries are listed), or Replace (template only; hand-added entries lost), unlesson-existinganswers for them. -
A closing report stating the path announced (from scratch or update), the action actually taken (created / updated / replaced / kept as is) and who chose it (user or
on-existing), naming which conditional sections (generator-managed Xcode project,Package.resolved, Fastlane, command-line tool outputs, signing material, Antora build output, DocC output) were included versus skipped and why, thePackage.resolvedcommit-vs-ignore decision and its reasoning, and warnings that detection is heuristic and that an already-tracked path this skill now proposes to ignore needs a manualgit rm -r --cached.
Execution flow
Dependencies
Invokes
None — iru-setup-swift-gitignore is a leaf skill; it does not call any other skill in this catalog.
Invoked by
-
Setup Swift Repository — Step 7 runs
iru-setup-swift-gitignoreafteriru-setup-swift-library/iru-setup-apple-appandiru-setup-antorahave run, so it can detect their generated files (the SwiftPM/Xcode project layout, Antora docs build output) already in place, passingflavor, andpackage-resolvedandon-existingwhen supplied.modeis deliberately not passed, since the skill’s own.gitignore-presence check is the more precise signal. -
Setup CLI Repository — for the
swiftflavor, withflavor: cli, afteriru-setup-swift-cli;on-existingis passed only when supplied. -
Setup macOS Repository — Step 6, with
flavor: app, afteriru-setup-macos-appandiru-setup-antora, so the macOS distribution section can detectscripts/make-dmg.sh/ExportOptions-*.plist;on-existingis passed only when supplied.
Source
SKILL.md on GitHub — the file this page was generated from.