ref: Reorganise into Swift Package Manager layout#2
Merged
Conversation
The single 2,185-line TermIMS.swift was getting unwieldy — navigating
between, say, the matching logic and the table view code meant
scrolling past several unrelated subsystems. Reorganise on Swift Package
Manager along the same shape as the neighbouring notchnotes project:
Package.swift # SPM manifest, executable target
Sources/TermIMS/ # one file per logical concern
main.swift # NSApplication boot
AppDelegate.swift # status menu + lifecycle
InputSource.swift # TIS wrappers
Models.swift # Rule / TerminalRule / enums + notifs
Log.swift # append-only debug log
RuleStore.swift # UserDefaults-backed store
TitleHeuristics.swift # String pattern + cwd predicates
TerminalAdapters.swift # protocol + 5 adapters + subprocess utils
IndicatorPanel.swift # NSPanel overlay
FocusMonitor.swift # AX observers + match orchestration
SettingsWindowController.swift # Settings UI + drag handle views
PermissionWindowController.swift # onboarding modal
Resources/AppIcon.png # source for the generated icns
Scripts/package-app.sh # swift build + bundle assembly + sign
Makefile # thin wrapper, same target names as before
Info.plist # unchanged, copied into the .app
The package script generates AppIcon.icns from AppIcon.png on every
build (matching notchnotes), so the icns no longer lives in the repo.
The Makefile keeps its public surface (\`make build/install/run/dist\`)
so existing release docs and CLAUDE.md instructions still apply.
\`fileprivate\` helpers that crossed the old file split — String
extensions, \`FocusMonitor.ttyDev(forName:)\`, the subprocess utilities
shared by kitty/wezterm adapters — were widened to internal so the new
file layout compiles. Nothing changes in behaviour.
Update README and CLAUDE.md to reflect the new layout and drop the
"single Swift file compiled with swiftc" language.
cuiko
force-pushed
the
refactor/spm-layout
branch
from
May 22, 2026 18:20
56f65db to
1db47d8
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TermIMS.swift(2,185 lines) into 12 focused files underSources/TermIMS/, modelled on the neighbouring notchnotes project layout.swiftcinvocation to Swift Package Manager (swift build -c release), wrapped byScripts/package-app.shwhich assembles the.appbundle, generatesAppIcon.icnsfromResources/AppIcon.png, and ad-hoc signs the result.make build / install / run / distinterface so release docs and CLAUDE.md instructions still apply unchanged.No behavioural changes — the bundle ID, Info.plist, AX permission flow, rules schema, and release pipeline are all untouched.
fileprivatehelpers that crossed the old single-file boundary (String heuristics,FocusMonitor.ttyDev(forName:), subprocess utilities shared by kitty/wezterm) were widened to internal so the new layout compiles cleanly.Test plan
make buildproduces a clean, code-signedbuild/TermIMS.appmake install && make runlaunches the menu bar app, status icon appears, Settings opensnotefield) round-trip from UserDefaults — verified by launching against an existing v1.2.0 install's stored stateResources/AppIcon.pngat build timemake distproduces a working DMG (run before tagging next release)