Establishes the foundational architecture for DisklavierLink: Networking layer - PianoClientProtocol defines the full async API (play, pause, stop, record, volume, skip, connect, fetchSongList) - PianoClient is a stub implementation that logs calls and simulates short async delays; fetchSongList returns hardcoded sample songs - PianoConnectionError carries a French-language error description for when the piano is unreachable (used by the simulation toggle and, later, by real HTTP failures) State and persistence - Song model (Identifiable, Codable, Hashable) with optional artist and duration fields, ready to be mapped from the future JSON API response - SettingsStore persists host, port, and autoConnectOnLaunch to UserDefaults via @Published + didSet (replacing @AppStorage, which does not work in non-View ObservableObject classes) - PianoViewModel (@MainActor ObservableObject) owns the client and settings, wraps every protocol call with error handling, and exposes isSimulatedPianoOn so the unreachable-piano path can be exercised without a physical device UI - Connection settings moved to a dedicated Settings window (Cmd+,) using SwiftUI's Settings scene and a grouped Form - Auto-connect on launch option in Settings (off by default) - Main window redesigned as a music-player layout: Now Playing card with gradient artwork tile and progress track placeholder, large circular play/pause button, sidebar song library with row selection - Connection banner appears only when disconnected, showing the French error message with a shortcut to Settings - Toolbar holds a status badge, Connect/Disconnect button, and a simulation power toggle (green = piano on, red = piano off) for testing the error path without real hardware Project - Source files reorganised into App/, Models/, Networking/, ViewModels/, Views/ subdirectories (PBXFileSystemSynchronizedRootGroup picks them up automatically — no project.pbxproj file-reference edits needed) - com.apple.security.network.client entitlement added - Deployment target updated to macOS 14.0 - SwiftFormat hook and /run skill added to .claude/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
472 B
JSON
18 lines
472 B
JSON
{
|
|
"hooks": {
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Write|Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "jq -r '.tool_input.file_path // .tool_response.filePath' | { read -r f; case \"$f\" in *.swift) /opt/homebrew/bin/swiftformat --swift-version 5 \"$f\" 2>/dev/null || true ;; esac; }",
|
|
"timeout": 30,
|
|
"statusMessage": "Formatting Swift file..."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|