Skip to content

Commit 2e065b8

Browse files
nullvariantclaude
andauthored
feat(git-id-switcher): add event-driven sync check, settings, and i18n (#360)
Add syncCheck.enabled / syncCheck.onFocusReturn configuration settings, integrate sync check into workspace folder change, config change, and window focus return events (debounced 500ms), localize all sync check UI strings to 17 languages, and document the feature in README (en/ja) and CHANGELOG. Bump version to 0.17.0. 🖥️ IDE: [Cursor](https://cursor.sh) 🔌 Extension: [Claude Code](https://claude.ai/download) Model-Raw: claude-opus-4-6-20250514 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3162481 commit 2e065b8

43 files changed

Lines changed: 532 additions & 47 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/git-id-switcher/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.17.0] - 2026-03-18
11+
12+
### Added
13+
14+
- **Sync Check**: Real-time detection of mismatches between the selected profile and actual git config (`user.name`, `user.email`, `user.signingkey`). When a mismatch is detected, the status bar shows a ⚠️ warning with a clickable resolution flow (re-apply, select different profile, or dismiss)
15+
- **Sync Check settings**: `syncCheck.enabled` (default: `true`) and `syncCheck.onFocusReturn` (default: `true`) to control sync check behavior
16+
- **Event-driven sync check**: Automatically runs on profile apply, workspace folder change, configuration change, and window focus return (debounced 500ms)
17+
- **Localization**: All sync check UI strings translated to 17 languages (`package.nls` and `l10n/bundle.l10n`)
18+
1019
## [0.16.22] - 2026-03-17
1120

1221
### Security

extensions/git-id-switcher/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ While many Git identity switchers exist, **Git ID Switcher** solves the complex
4949
- **Identity (Profile) Management UI**: Add, edit, delete, and reorder identities without editing settings.json
5050
- **One-Click Identity Switch**: Instantly change Git user.name and user.email
5151
- **Status Bar Integration**: Always see your current identity (profile) at a glance
52+
- **Sync Check**: Real-time detection of mismatches between profile and git config, with status bar warning
5253
- **Submodule Support**: Automatically propagate identity to Git submodules
5354
- **SSH Key Management**: Automatically switch SSH keys in ssh-agent
5455
- **GPG Signing Support**: Configure GPG key for commit signing (optional)
@@ -291,6 +292,8 @@ You can also delete an identity from the command palette using `Git ID Switcher:
291292
| `gitIdSwitcher.applyToSubmodules` | `true` | Propagate identity to Git submodules |
292293
| `gitIdSwitcher.submoduleDepth` | `1` | Max depth for nested submodule configuration (1-5) |
293294
| `gitIdSwitcher.includeIconInGitConfig` | `false` | Include icon emoji in Git config `user.name` |
295+
| `gitIdSwitcher.syncCheck.enabled` | `true` | Check whether selected profile matches actual git config |
296+
| `gitIdSwitcher.syncCheck.onFocusReturn` | `true` | Run sync check when editor window regains focus |
294297
| `gitIdSwitcher.logging.fileEnabled` | `false` | Save audit logs to file (records identity switches, SSH key operations, etc.) |
295298
| `gitIdSwitcher.logging.filePath` | `""` | Log file path (e.g., `~/.git-id-switcher/security.log`). Empty string uses default path |
296299
| `gitIdSwitcher.logging.maxFileSize` | `10485760` | Max file size before rotation (bytes, 1MB-100MB) |
@@ -347,6 +350,32 @@ When you switch identities, the extension does the following (in order):
347350
2. **SSH Key** (if `sshKeyPath` set): Removes other keys from ssh-agent and adds the selected key
348351
3. **GPG Key** (if `gpgKeyId` set): Sets `git config --local user.signingkey` and enables signing
349352
4. **Submodules** (if enabled): Propagates settings to all submodules (default: depth 1)
353+
5. **Sync Check**: Verifies that the applied profile matches the actual git config
354+
355+
### Sync Check
356+
357+
Compares the selected profile against the actual `git config --local` values (`user.name`, `user.email`, `user.signingkey`) and shows a status bar warning when a mismatch is detected.
358+
359+
**When checks run:**
360+
361+
- Immediately after profile apply
362+
- On workspace folder change
363+
- On configuration change
364+
- On editor window focus return (debounced 500ms)
365+
366+
**When a mismatch is detected:**
367+
368+
- The status bar shows a ⚠️ icon with a warning background color
369+
- The tooltip displays a table showing the mismatched fields (field, expected value, actual value)
370+
- Clicking the status bar presents resolution options:
371+
- **Re-apply profile** — Re-apply the current profile to git config
372+
- **Select different profile** — Open the identity picker
373+
- **Dismiss** — Suppress the warning until the next check
374+
375+
**To disable:**
376+
377+
Set `gitIdSwitcher.syncCheck.enabled` to `false` to disable all sync checks.
378+
To disable only the focus-return check, set `gitIdSwitcher.syncCheck.onFocusReturn` to `false`.
350379

351380
### How Submodule Propagation Works
352381

extensions/git-id-switcher/docs/i18n/en/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ While many Git identity switchers exist, **Git ID Switcher** solves the complex
4545
- **Identity (Profile) Management UI**: Add, edit, delete, and reorder identities without editing settings.json
4646
- **One-Click Identity Switch**: Instantly change Git user.name and user.email
4747
- **Status Bar Integration**: Always see your current identity (profile) at a glance
48+
- **Sync Check**: Real-time detection of mismatches between profile and git config, with status bar warning
4849
- **Submodule Support**: Automatically propagate identity to Git submodules
4950
- **SSH Key Management**: Automatically switch SSH keys in ssh-agent
5051
- **GPG Signing Support**: Configure GPG key for commit signing (optional)
@@ -287,6 +288,8 @@ You can also delete an identity from the command palette using `Git ID Switcher:
287288
| `gitIdSwitcher.applyToSubmodules` | `true` | Propagate identity to Git submodules |
288289
| `gitIdSwitcher.submoduleDepth` | `1` | Max depth for nested submodule configuration (1-5) |
289290
| `gitIdSwitcher.includeIconInGitConfig` | `false` | Include icon emoji in Git config `user.name` |
291+
| `gitIdSwitcher.syncCheck.enabled` | `true` | Check whether selected profile matches actual git config |
292+
| `gitIdSwitcher.syncCheck.onFocusReturn` | `true` | Run sync check when editor window regains focus |
290293
| `gitIdSwitcher.logging.fileEnabled` | `false` | Save audit logs to file (records identity switches, SSH key operations, etc.) |
291294
| `gitIdSwitcher.logging.filePath` | `""` | Log file path (e.g., `~/.git-id-switcher/security.log`). Empty string uses default path |
292295
| `gitIdSwitcher.logging.maxFileSize` | `10485760` | Max file size before rotation (bytes, 1MB-100MB) |
@@ -343,6 +346,32 @@ When you switch identities, the extension does the following (in order):
343346
2. **SSH Key** (if `sshKeyPath` set): Removes other keys from ssh-agent and adds the selected key
344347
3. **GPG Key** (if `gpgKeyId` set): Sets `git config --local user.signingkey` and enables signing
345348
4. **Submodules** (if enabled): Propagates settings to all submodules (default: depth 1)
349+
5. **Sync Check**: Verifies that the applied profile matches the actual git config
350+
351+
### Sync Check
352+
353+
Compares the selected profile against the actual `git config --local` values (`user.name`, `user.email`, `user.signingkey`) and shows a status bar warning when a mismatch is detected.
354+
355+
**When checks run:**
356+
357+
- Immediately after profile apply
358+
- On workspace folder change
359+
- On configuration change
360+
- On editor window focus return (debounced 500ms)
361+
362+
**When a mismatch is detected:**
363+
364+
- The status bar shows a ⚠️ icon with a warning background color
365+
- The tooltip displays a table showing the mismatched fields (field, expected value, actual value)
366+
- Clicking the status bar presents resolution options:
367+
- **Re-apply profile** — Re-apply the current profile to git config
368+
- **Select different profile** — Open the identity picker
369+
- **Dismiss** — Suppress the warning until the next check
370+
371+
**To disable:**
372+
373+
Set `gitIdSwitcher.syncCheck.enabled` to `false` to disable all sync checks.
374+
To disable only the focus-return check, set `gitIdSwitcher.syncCheck.onFocusReturn` to `false`.
346375

347376
### How Submodule Propagation Works
348377

extensions/git-id-switcher/docs/i18n/ja/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Gitプロフィール切り替えツールは数多く存在しますが、**Git
4545
- **プロフィール管理UI**: settings.jsonを編集せずに、プロフィールの追加・編集・削除・並べ替えが可能
4646
- **ワンクリックでプロフィール切り替え**: Git user.nameとuser.emailを瞬時に変更
4747
- **ステータスバー統合**: 現在のプロフィールを常に一目で確認
48+
- **同期チェック**: プロフィールとgit configの不一致をリアルタイム検出し、ステータスバーで警告
4849
- **サブモジュール対応**: Gitサブモジュールにも自動的にプロフィールを伝播
4950
- **SSH鍵管理**: ssh-agentのSSH鍵を自動的に切り替え
5051
- **GPG署名対応**: コミット署名用のGPG鍵を設定(オプション)
@@ -287,6 +288,8 @@ Host gitlab-oss
287288
| `gitIdSwitcher.applyToSubmodules` | `true` | Gitサブモジュールにプロフィールを伝播 |
288289
| `gitIdSwitcher.submoduleDepth` | `1` | ネストされたサブモジュール設定の最大深度(1-5) |
289290
| `gitIdSwitcher.includeIconInGitConfig` | `false` | アイコン絵文字をGit configの`user.name`に含めるか |
291+
| `gitIdSwitcher.syncCheck.enabled` | `true` | プロフィールとgit configの同期チェックを有効にする |
292+
| `gitIdSwitcher.syncCheck.onFocusReturn` | `true` | ウィンドウフォーカス復帰時に同期チェックを実行する |
290293
| `gitIdSwitcher.logging.fileEnabled` | `false` | 監査ログをファイルに保存する(ID切り替え、SSH鍵操作などを記録) |
291294
| `gitIdSwitcher.logging.filePath` | `""` | ログファイルのパス(例:`~/.git-id-switcher/security.log`)。空文字列の場合はデフォルトパスを使用 |
292295
| `gitIdSwitcher.logging.maxFileSize` | `10485760` | ローテーション前の最大ファイルサイズ(バイト単位、1MB-100MB) |
@@ -343,6 +346,32 @@ Gitの設定には3つのレイヤーがあり、下位の設定を上位が上
343346
2. **SSH鍵**`sshKeyPath`設定時): 他の鍵をssh-agentから削除し、選択した鍵を追加
344347
3. **GPG鍵**`gpgKeyId`設定時): `git config --local user.signingkey`を設定し、署名を有効化
345348
4. **サブモジュール**(有効時): すべてのサブモジュールに設定を伝播(デフォルト:深度1)
349+
5. **同期チェック**: 適用したプロフィールとgit configが一致しているか自動検証
350+
351+
### 同期チェック
352+
353+
選択中のプロフィールと実際の `git config --local` の値(`user.name`, `user.email`, `user.signingkey`)を比較し、不一致があればステータスバーに警告を表示します。
354+
355+
**チェックのタイミング:**
356+
357+
- プロフィール適用直後
358+
- ワークスペースフォルダ変更時
359+
- 設定変更時
360+
- エディタウィンドウへのフォーカス復帰時(デバウンス500ms)
361+
362+
**不一致が検出された場合:**
363+
364+
- ステータスバーに ⚠️ が表示され、背景が警告色に変わります
365+
- ツールチップに不一致の詳細(項目・期待値・実際の値)がテーブル形式で表示されます
366+
- クリックすると解決方法の選択肢が表示されます:
367+
- **プロフィールを再適用** — 現在のプロフィールをgit configに再適用
368+
- **別のプロフィールを選択** — プロフィールピッカーを開く
369+
- **無視** — 次回のチェックまで警告を抑制
370+
371+
**無効化するには:**
372+
373+
`gitIdSwitcher.syncCheck.enabled``false` に設定すると、すべての同期チェックが無効になります。
374+
フォーカス復帰時のチェックのみ無効にしたい場合は、`gitIdSwitcher.syncCheck.onFocusReturn``false` に設定してください。
346375

347376
### サブモジュール伝播の仕組み
348377

extensions/git-id-switcher/l10n/bundle.l10n.bg.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,18 @@
9696
"Press 'Enter' to save (leave empty to clear)": "Натиснете 'Enter' за запазване (оставете празно за изчистване)",
9797
"Move up": "Преместване нагоре",
9898
"Move down": "Преместване надолу",
99-
"Failed to reorder identity: {0}": "Неуспешно пренареждане на профил: {0}"
99+
"Failed to reorder identity: {0}": "Неуспешно пренареждане на профил: {0}",
100+
"Profile out of sync": "Профилът не е синхронизиран",
101+
"Field": "Поле",
102+
"Profile": "Профил",
103+
"Git Config": "Git конфигурация",
104+
"*Click to resolve*": "*Натиснете за решаване*",
105+
"Re-apply profile": "Повторно прилагане на профил",
106+
"Re-apply the current profile to git config": "Повторно прилагане на текущия профил към git конфигурацията",
107+
"Select different profile": "Избор на друг профил",
108+
"Choose a different identity profile": "Изберете различен профил за самоличност",
109+
"Dismiss": "Отхвърляне",
110+
"Ignore until next sync check": "Игнориране до следващата проверка за синхронизация",
111+
"How would you like to resolve this?": "Как бихте искали да разрешите това?",
112+
"Failed to re-apply profile: {0}": "Неуспешно повторно прилагане на профила: {0}"
100113
}

extensions/git-id-switcher/l10n/bundle.l10n.cs.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,18 @@
9696
"Press 'Enter' to save (leave empty to clear)": "Uložte stisknutím 'Enter' (ponechte prázdné pro vymazání)",
9797
"Move up": "Přesunout nahoru",
9898
"Move down": "Přesunout dolů",
99-
"Failed to reorder identity: {0}": "Nepodařilo se změnit pořadí profilu: {0}"
99+
"Failed to reorder identity: {0}": "Nepodařilo se změnit pořadí profilu: {0}",
100+
"Profile out of sync": "Profil není synchronizován",
101+
"Field": "Pole",
102+
"Profile": "Profil",
103+
"Git Config": "Konfigurace Git",
104+
"*Click to resolve*": "*Klikněte pro vyřešení*",
105+
"Re-apply profile": "Znovu použít profil",
106+
"Re-apply the current profile to git config": "Znovu použít aktuální profil na konfiguraci gitu",
107+
"Select different profile": "Vybrat jiný profil",
108+
"Choose a different identity profile": "Vyberte jiný profil identity",
109+
"Dismiss": "Zavřít",
110+
"Ignore until next sync check": "Ignorovat do příští kontroly synchronizace",
111+
"How would you like to resolve this?": "Jak chcete tento problém vyřešit?",
112+
"Failed to re-apply profile: {0}": "Opětovné použití profilu selhalo: {0}"
100113
}

extensions/git-id-switcher/l10n/bundle.l10n.de.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,18 @@
9696
"Press 'Enter' to save (leave empty to clear)": "'Enter' zum Speichern (leer lassen zum Löschen)",
9797
"Move up": "Nach oben verschieben",
9898
"Move down": "Nach unten verschieben",
99-
"Failed to reorder identity: {0}": "Profil konnte nicht neu angeordnet werden: {0}"
99+
"Failed to reorder identity: {0}": "Profil konnte nicht neu angeordnet werden: {0}",
100+
"Profile out of sync": "Profil nicht synchronisiert",
101+
"Field": "Feld",
102+
"Profile": "Profil",
103+
"Git Config": "Git-Konfiguration",
104+
"*Click to resolve*": "*Klicken zum Beheben*",
105+
"Re-apply profile": "Profil erneut anwenden",
106+
"Re-apply the current profile to git config": "Das aktuelle Profil erneut auf die Git-Konfiguration anwenden",
107+
"Select different profile": "Anderes Profil auswählen",
108+
"Choose a different identity profile": "Ein anderes Identitätsprofil auswählen",
109+
"Dismiss": "Verwerfen",
110+
"Ignore until next sync check": "Bis zur nächsten Synchronisierungsprüfung ignorieren",
111+
"How would you like to resolve this?": "Wie möchten Sie dies lösen?",
112+
"Failed to re-apply profile: {0}": "Profil konnte nicht erneut angewendet werden: {0}"
100113
}

extensions/git-id-switcher/l10n/bundle.l10n.es.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,18 @@
9696
"Press 'Enter' to save (leave empty to clear)": "Pulsa 'Enter' para guardar (dejar vacío para borrar)",
9797
"Move up": "Mover arriba",
9898
"Move down": "Mover abajo",
99-
"Failed to reorder identity: {0}": "Error al reordenar perfil: {0}"
99+
"Failed to reorder identity: {0}": "Error al reordenar perfil: {0}",
100+
"Profile out of sync": "Perfil desincronizado",
101+
"Field": "Campo",
102+
"Profile": "Perfil",
103+
"Git Config": "Configuración Git",
104+
"*Click to resolve*": "*Haz clic para resolver*",
105+
"Re-apply profile": "Reaplicar perfil",
106+
"Re-apply the current profile to git config": "Reaplicar el perfil actual a la configuración git",
107+
"Select different profile": "Seleccionar otro perfil",
108+
"Choose a different identity profile": "Elegir un perfil de identidad diferente",
109+
"Dismiss": "Descartar",
110+
"Ignore until next sync check": "Ignorar hasta la próxima verificación de sincronización",
111+
"How would you like to resolve this?": "¿Cómo desea resolver esto?",
112+
"Failed to re-apply profile: {0}": "Error al reaplicar el perfil: {0}"
100113
}

extensions/git-id-switcher/l10n/bundle.l10n.fr.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,18 @@
9696
"Press 'Enter' to save (leave empty to clear)": "Appuyez sur 'Entrée' pour enregistrer (laisser vide pour effacer)",
9797
"Move up": "Déplacer vers le haut",
9898
"Move down": "Déplacer vers le bas",
99-
"Failed to reorder identity: {0}": "Échec du réordonnancement du profil : {0}"
99+
"Failed to reorder identity: {0}": "Échec du réordonnancement du profil : {0}",
100+
"Profile out of sync": "Profil désynchronisé",
101+
"Field": "Champ",
102+
"Profile": "Profil",
103+
"Git Config": "Config Git",
104+
"*Click to resolve*": "*Cliquez pour résoudre*",
105+
"Re-apply profile": "Réappliquer le profil",
106+
"Re-apply the current profile to git config": "Réappliquer le profil actuel à la configuration git",
107+
"Select different profile": "Sélectionner un autre profil",
108+
"Choose a different identity profile": "Choisir un profil d'identité différent",
109+
"Dismiss": "Ignorer",
110+
"Ignore until next sync check": "Ignorer jusqu'à la prochaine vérification de synchronisation",
111+
"How would you like to resolve this?": "Comment souhaitez-vous résoudre ceci ?",
112+
"Failed to re-apply profile: {0}": "Échec de la réapplication du profil : {0}"
100113
}

extensions/git-id-switcher/l10n/bundle.l10n.hu.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,18 @@
9696
"Press 'Enter' to save (leave empty to clear)": "Mentéshez nyomja meg az 'Enter'-t (hagyja üresen a törléshez)",
9797
"Move up": "Mozgatás felfelé",
9898
"Move down": "Mozgatás lefelé",
99-
"Failed to reorder identity: {0}": "Nem sikerült átrendezni a profilt: {0}"
99+
"Failed to reorder identity: {0}": "Nem sikerült átrendezni a profilt: {0}",
100+
"Profile out of sync": "Profil nincs szinkronban",
101+
"Field": "Mező",
102+
"Profile": "Profil",
103+
"Git Config": "Git konfiguráció",
104+
"*Click to resolve*": "*Kattintson a megoldáshoz*",
105+
"Re-apply profile": "Profil újraalkalmazása",
106+
"Re-apply the current profile to git config": "Az aktuális profil újraalkalmazása a git konfigurációra",
107+
"Select different profile": "Másik profil kiválasztása",
108+
"Choose a different identity profile": "Válasszon másik identitásprofilt",
109+
"Dismiss": "Elvetés",
110+
"Ignore until next sync check": "Figyelmen kívül hagyás a következő szinkronizáció-ellenőrzésig",
111+
"How would you like to resolve this?": "Hogyan szeretné megoldani?",
112+
"Failed to re-apply profile: {0}": "A profil újraalkalmazása sikertelen: {0}"
100113
}

0 commit comments

Comments
 (0)