Skip to content

[#235] Add doctor verification for hooks, settings keys, and gitignore entries#242

Merged
bguidolim merged 2 commits intomainfrom
feature/235-doctor-artifact-checks
Mar 6, 2026
Merged

[#235] Add doctor verification for hooks, settings keys, and gitignore entries#242
bguidolim merged 2 commits intomainfrom
feature/235-doctor-artifact-checks

Conversation

@bguidolim
Copy link
Owner

Context

Three artifact types tracked by the sync engine in PackArtifactRecord had no corresponding doctor verification checks: hook commands in settings, settingsMerge keys, and pack-contributed gitignore entries. If a user manually removed any of these between syncs, mcs doctor wouldn't detect the drift.

Changes

  • Add HookSettingsCheck — verifies pack hook commands are present in settings file
  • Add SettingsKeysCheck — verifies pack settings keys exist (supports dot-notation paths)
  • Add PackGitignoreCheck — verifies pack gitignore entries are in global gitignore
  • Extract artifactChecks(for:pack:scope:env:) in DoctorRunner to group all artifact-record-driven checks
  • Add GitignoreManager.readLines() shared helper used by both GitignoreCheck and PackGitignoreCheck
  • Fix GitignoreCheck to use exact line matching (was using substring contains)

Testing

  • 12 new tests across HookSettingsCheckTests, SettingsKeysCheckTests, PackGitignoreCheckTests
  • All 714 tests pass (swift test)
  • Zero lint violations (swiftformat + swiftlint)

Closes #235

…e entries

- Add HookSettingsCheck, SettingsKeysCheck, and PackGitignoreCheck structs
- Extract artifactChecks() helper in DoctorRunner for artifact-record-driven checks
- Add GitignoreManager.readLines() shared helper, fix GitignoreCheck to use exact line matching
- Replace try? with do/catch in readLines(), SettingsKeysCheck (CLAUDE.md compliance)
- Differentiate "not found" vs "unreadable" errors in gitignore checks
- Add file-existence check in HookSettingsCheck for clearer error messages
- Add test for SettingsKeysCheck with invalid JSON content
@bguidolim bguidolim merged commit b6fc44b into main Mar 6, 2026
4 checks passed
@bguidolim bguidolim deleted the feature/235-doctor-artifact-checks branch March 6, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doctor: add verification checks for hooks, settingsMerge keys, and gitignore entries

1 participant