codemod/azure-pipelines-lock-swift-deps
Add dependency-locking flags to inline Swift and xcodebuild commands in Azure Pipelines YAML.
# @codemod/azure-pipelines-lock-swift-deps
Add dependency-locking flags to inline Swift and `xcodebuild` commands in Azure Pipelines YAML so CI uses checked-in package resolution data instead of resolving packages opportunistically.
## Installation
```bash
# Install from registry
codemod run @codemod/azure-pipelines-lock-swift-deps
# Or run locally
codemod run -w workflow.yaml
```
## Usage
This codemod rewrites Azure Pipelines YAML command values under `script`, `bash`, and `pwsh` keys.
- `swift build ...` -> `swift build --disable-automatic-resolution ...`
- `swift test ...` -> `swift test --disable-automatic-resolution ...`
- `xcodebuild ... build|test|archive|analyze` -> inserts both `-disableAutomaticPackageResolution` and `-onlyUsePackageVersionsFromResolvedFile`
- `xcodebuild -resolvePackageDependencies ...` -> inserts the same two `xcodebuild` flags
Preserve cases:
- Commands that already include the lock flags stay unchanged
- Non-Swift commands stay unchanged
- Commented lines inside block scalars stay unchanged
Target files:
- `**/*.yml`
- `**/*.yaml`
## Development
```bash
# Test the transformation
pnpm test
# Validate the workflow
codemod workflow validate -w workflow.yaml
# Publish to registry
codemod login
codemod publish
```
## License
MIT