Sync String Catalog
ASecuritySync this checkout's String Catalog (.xcstrings) with the code from the command line (xcodebuild + xcstringstool, Xcode only when an Info.plist string changed), then review the changed keys and commit the catalog on the branch. Use before a PR on an Apple project that touches user-facing strings, or when the user says "sync string catalog", "sync xcstrings", "catalog drift", or "localizable is stale". Called as the CHECK op by /dev-story (Build & Test Gate), the flywheels' final cycle, and /c...
- 2 stars
- 0 votes
- 0 copies
- 1 view
- Added November 17, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add rterakedis/leanwheel-skills --skill sync-string-catalog --agent claude-codeAre you the author of Sync String Catalog?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/rterakedis-sync-string-catalog)---
name: sync-string-catalog
description: Sync this checkout's String Catalog (.xcstrings) with the code from the command line (xcodebuild + xcstringstool, Xcode only when an Info.plist string changed), then review the changed keys and commit the catalog on the branch. Use before a PR on an Apple project that touches user-facing strings, or when the user says "sync string catalog", "sync xcstrings", "catalog drift", or "localizable is stale". Called as the CHECK op by /dev-story (Build & Test Gate), the flywheels' final cycle, and /code-review (Verify green, when its patches touch strings).
---
# Sync String Catalog
**Why this exists.** `xcodebuild` extracts strings but never merges them into an `.xcstrings`
catalog, so a new key or comment edit merges with a stale catalog and surfaces later as an
unexplained diff on main. Mechanism:
`docs/setup/swift/xcode-footguns.md` → *A green `xcodebuild` leaves the String Catalog stale*
(project copy) and [reference.md](reference.md).
**The script does the work; this skill decides.** `scripts/xcode-catalog-sync.py` builds
**this checkout** with `xcodebuild` into a throwaway DerivedData and merges the extracted
strings with `xcrun xcstringstool sync` — the merge an Xcode IDE build performs, measured
byte-identical (DD-86). No Xcode, no approval prompt. It diffs each tracked catalog against
HEAD as parsed JSON and never commits.
**Xcode fallback.** `InfoPlist.xcstrings` follows the Info.plist keys, which the command line
cannot merge. When a built Info.plist string differs from that catalog, the script prints
`falling back to Xcode` and drives the running Xcode through its MCP server (`xcrun mcpbridge`);
Xcode then asks the operator to approve the connection. `--xcode` forces that path.
---
## CHECK (composable — the gate)
Run from the checkout root. Zero tokens: read only the **last line** of stdout. `--check`
never modifies the tree.
```bash
python3 scripts/xcode-catalog-sync.py --check 2>&1 | tee .leanwheel/logs/catalog-sync.log | tail -n 25
```
| Exit | Last line | Meaning | Gate outcome |
|---|---|---|---|
| 0 | `CATALOG: in-sync` | every tracked catalog matches HEAD after the sync | pass |
| 0 | `CATALOG: none` | no git-tracked `*.xcstrings` — nothing can drift | `n/a` |
| 1 | `CATALOG: drift N catalog(s)` | the sync would change a catalog; keys listed above the line | **not done** — run SYNC |
| 2 | `CATALOG: unavailable — {why}` | build failed / no toolchain / Xcode fallback needed but not running or not approved / timeout | **blocked**, never a pass |
**Exit 2 is `blocked`, not green (DD-80).** Record `CATALOG: unavailable — {why}` verbatim in
the calling skill's report; under a flywheel it pauses like any environment fault. When the
why names the Xcode fallback, tell the user the one-line fix (open Xcode with MCP enabled and
approve the connection). Never record `in-sync` because the script could not run.
**Who runs CHECK (DD-84).** Each CHECK is a clean build, so it runs where it can find
something new: dev-story once after its full plan; the flywheel's final cycle always, on the
tree merged with main (a routine merge casualty); code-review only when its own patches touched
a user-facing string or comment, or the author's result was `unavailable`. A standalone review
runs CHECK unconditionally.
Skip CHECK only when the project is not an Apple project, or `git ls-files '*.xcstrings'` is
empty — state which.
## SYNC (interactive — review, then commit on the branch)
1. Run the script **without** `--check` — it rewrites the catalog in place. On `in-sync` /
`none`: report and stop.
2. On `drift`: read the per-catalog key list — `+` added, `-` removed, `~` changed (comment,
value, or `now stale`), or *key order only*. Every line must be explained by this branch's diff:
- `+` a string the branch added · `-` one it removed or renamed · `~` a comment/value it edited.
- **`now stale`** — a removed key that has translations is kept and marked stale, not
deleted. Check it moved rather than died: `localization.md` → *`extractionState: stale`*.
- **A `-` with no matching source change** means a key was hand-inserted or a call site was
deleted — check before accepting.
- **Key order only:** a hand edit put keys out of order. Accept — committing the re-sorted
file stops the surprise diff later.
3. Commit the catalog **on the current branch** with the story's other changes, or alone:
`bash scripts/commit-push.sh "Sync String Catalog" {catalog paths}`. Never hand-edit keys
into the catalog to make the list go away — that is how the drift starts.
4. Re-run CHECK: it must print `CATALOG: in-sync` (exit 0). Record that in the report.
## Report field (consumed by dev-story / code-review / ledger)
```
CATALOG: in-sync | drift-committed | unavailable — {why} | n/a
```
`drift-committed` means SYNC ran and the re-check was `in-sync`. A report that ends a Swift
story without this field is incomplete.
## Configuration
Nothing is hard-coded. `--project` / `--scheme`, else `container` / `scheme` in
`.leanwheel/sim.json` (written by `scripts/sim.sh`), else discovery. `--destination` defaults to
`generic/platform=iOS Simulator` (no booted device); pass `generic/platform=macOS` for a Mac
target. `--catalog PATH` (repeatable), else every git-tracked `*.xcstrings`. `--timeout N`
bounds the build or one MCP reply (default 900 s); `--keep-open` applies to the Xcode path.
Standalone invocation by the user: `/sync-string-catalog` → run SYNC.
Files in this skill
- SKILL.md
- reference.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.