Skip to content

Add hs.midi. Closes #132 - #156

Merged
cmsj merged 6 commits into
mainfrom
hs.midi
Aug 2, 2026
Merged

Add hs.midi. Closes #132#156
cmsj merged 6 commits into
mainfrom
hs.midi

Conversation

@cmsj

@cmsj cmsj commented Aug 1, 2026

Copy link
Copy Markdown
Owner
  • Checkpoint
  • Switch to using non-deprecated APIs

@cmsj cmsj self-assigned this Aug 1, 2026
@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds the new CoreMIDI-backed hs.midi module and its generated API surface.

  • Registers hs.midi with ModuleRoot and the JavaScript test harness.
  • Implements physical-device and virtual-source discovery, MIDI callbacks, command encoding, SysEx handling, and resource teardown.
  • Adds integration coverage for the JavaScript API, CoreMIDI communication, codec behavior, callbacks, and lifecycle.
  • Updates documentation extraction to map the on-disk hs.midi_ directory to the public hs.midi namespace.

Confidence Score: 4/5

The PR is not yet safe to merge because a transient source-connection failure permanently disables input retries for that device object.

The failed MIDIPortConnectSource branch still leaves inputPort nonzero and selfRef retained, while every later non-nil setCallback call is blocked by the inputPort == 0 guard and cannot reconnect.

Files Needing Attention: Hammerspoon 2/Modules/hs.midi_/HSMIDIDevice.swift

Important Files Changed

Filename Overview
Hammerspoon 2/Modules/hs.midi_/HSMIDIDevice.swift Implements device I/O and callback lifecycle, but the previously reported failed-connect state still prevents retries.
Hammerspoon 2/Modules/hs.midi_/HSMIDIModule.swift Implements module discovery, setup notifications, shared CoreMIDI resources, and a proper MainActor hop for notification callbacks.
Hammerspoon 2/Modules/hs.midi_/HSMIDIMessageCodec.swift Implements MIDI 1.0 UMP command and SysEx encoding/decoding with bounded persistent SysEx accumulation.
Hammerspoon 2/Engine/ModuleRoot.swift Registers hs.midi through the existing lazy module-loading mechanism.
Hammerspoon 2Tests/IntegrationTests/HSMIDIIntegrationTests.swift Adds broad codec, JavaScript bridge, callback, virtual-source, and lifecycle integration coverage.
scripts/extract-docs.js Maps the special hs.midi_ source directory to the public hs.midi documentation namespace.

Reviews (2): Last reviewed commit: "Prevent SysEx messages from potentially ..." | Re-trigger Greptile

Comment thread Hammerspoon 2/Modules/hs.midi_/HSMIDIModule.swift Outdated
Comment thread Hammerspoon 2/Modules/hs.midi_/HSMIDIMessageCodec.swift Outdated
Comment thread Hammerspoon 2/Modules/hs.midi_/HSMIDIDevice.swift
@cmsj

cmsj commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

@greptile

@cmsj
cmsj merged commit 803a55a into main Aug 2, 2026
3 checks passed
@cmsj
cmsj deleted the hs.midi branch August 2, 2026 13:53
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.

1 participant