Regex-search a Swift file (no LSP)
swiftSearchPatternSearch Swift source files with pure regex to find patterns like closure capture lists and Task self references that SourceKit-LSP misses.
Instructions
[mg.code] Pure regex search over a file's contents — no SourceKit-LSP, no IndexStoreDB. Catches what LSP misses: closure capture lists ([weak self], [unowned self]), Task { ... self ... } blocks, and any other pattern the agent constructs from a leak chain. Returns matches with line/character positions and a trimmed snippet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to a Swift source file. | |
| pattern | Yes | Regex pattern (JavaScript flavour). The `g` flag is implied — every match is returned. | |
| flags | No | Additional RegExp flags ("i", "m", "s", "im", etc.). | |
| maxMatches | No | Cap on matches returned (default 50). |