Skip to content

Overhaul!#133

Merged
johnno1962 merged 15 commits into
mainfrom
2.0_overhaul
May 7, 2026
Merged

Overhaul!#133
johnno1962 merged 15 commits into
mainfrom
2.0_overhaul

Conversation

@johnno1962

Copy link
Copy Markdown
Owner

Big Changes.

@johnno1962 johnno1962 force-pushed the 2.0_overhaul branch 6 times, most recently from 4344a36 to 162fa3c Compare April 18, 2026 19:15
johnno1962 and others added 3 commits April 18, 2026 21:31
* chore(assets): migrate to AppIcon catalog + INJECTION_* imagesets

Replace legacy App.icns + InjectionBusy/Error/Idle/OK/Ready.tif with
a proper asset catalog: AppIcon.appiconset (10 sizes) and six status
imagesets (INJECTION_BLUE/GREEN/ORANGE/PURPLE/RED/YELLOW).

Info.plist: swap CFBundleIconFile ("App.icns") for CFBundleIconName
("AppIcon").

pbxproj: drop file refs + build-phase entries for the removed icons.

Visual output only; no runtime behaviour change. Status image lookups
by these names will be wired up in the SwiftUI StatusMenuView commit.

Made-with: Cursor

* refactor(config): introduce ConfigStore, drop Defaults

Replace the small Defaults struct with an ObservableObject ConfigStore
that is the single source of truth for all user-facing configuration.
It owns persistence to UserDefaults, publishes change notifications for
SwiftUI Views (landing in a later commit), and exposes discovery
helpers for available Xcodes and codesigning identities.

To keep call-site churn out of this commit, ConfigStore ships with a
backward-compat Defaults shim that forwards to ConfigStore.shared, so
AppDelegate / MonitorXcode / NextCompiler / ControlServer / etc. keep
compiling unchanged. Those will be cleaned up alongside the SwiftUI
entry point.

Project changes:
- Delete App/InjectionNext/Defaults.swift
- Add App/InjectionNext/ConfigStore.swift (Xcode, Build System,
  Compiler, Injection, Devices, Tracing, File Watcher, Network and
  Advanced sections + project discovery helpers + picker window used
  when multiple .xcodeproj/.xcworkspace are found)
- Bump InjectionNext app deployment target 10.13 -> 13.0 (required by
  @published / SwiftUI MenuBarExtra work that follows)
- Switch the DLKit SPM dependency from tagged 3.5.6 to branch 'main'
  so we resolve the commit that exposes the configurable dlOpenMode
  knob ConfigStore binds to (johnno1962/DLKit hasn't cut a tag yet).

No behavioural change yet; the UI is still XIB-based and reads the
same UserDefaults keys.

Made-with: Cursor

* feat(ui): SwiftUI entry + StatusMenuView replacing AppKit/XIB

Migrate the app's launch path from main.m + MainMenu.xib to a SwiftUI
@main entry (InjectionNextApp) backed by a MenuBarExtra and an
NSApplicationDelegateAdaptor. The menu bar dropdown is now driven by
StatusMenuView, which observes ConfigStore for status, watchers, build
system, and client state.

AppDelegate is slimmed to a shim over ConfigStore: IBOutlets are gone
and their call sites keep compiling via lightweight Compat* types
(CompatMenuItem/Button/TextField) whose reads/writes route to
ConfigStore. main.m, MainMenu.xib, and the XIB-specific Info.plist
keys (NSMainNibFile, NSPrincipalClass) are removed.

Minimal non-UI adjustments to keep the link clean:
- ControlServer: pass a fresh NSMenuItem() to deviceEnable instead of
  the removed outlet, drop the selectXcodeItem.toolTip write.
- FrontendServer: drop optional-chaining on patchCompilerItem (shim
  returns a non-optional NSMenuItem).

Made-with: Cursor

* UI: add SwiftUI SettingsView with 10 settings panels

Ports the modern SwiftUI settings UI from main into 2.0_overhaul:
- SettingsView as the shell with tabbed navigation
- General, Xcode, BuildSystem, Compiler, Injection, Devices,
  FileWatcher, Network, Tracing, Advanced settings panes
- Bridges device enable toggle to AppDelegate.applyDeviceSettings(enabled:)
- Adds a SwiftUI Window scene ("settings") to InjectionNextApp

All panels observe ConfigStore and mutate published properties so the
legacy non-UI backend continues to see state changes via the
CompatMenuItem/CompatButton/CompatTextField shims in AppDelegate.

Made-with: Cursor

* UI: add LogManager + ConsoleView and hijack stdout/stderr

- LogManager: centralized ObservableObject logger with timestamped
  entries, ring buffer, duplicate suppression, uncaught-exception /
  fatal-signal handlers, and a readLoop that hijacks STDOUT/STDERR
  while still mirroring bytes to the real fds.
- Removes the old ad-hoc LogBuffer class from ControlServer.swift;
  kept LogBuffer as a typealias to LogManager for back-compat.
- Updates InjectionServer / NextCompiler / ControlServer call sites
  to the non-optional shared logger.
- AppDelegate now starts log capture unconditionally; ControlServer
  start remains gated on Defaults.mcpServer.
- Adds ConsoleView (SwiftUI) with filter/level/auto-scroll and an
  NSTextView-backed selectable log pane.
- InjectionNextApp exposes a new "console" Window scene; the status
  menu's "Open Console…" entry opens it via openWindow.

Made-with: Cursor

* docs: add 2.0 roadmap TODO.md

Made-with: Cursor

* build: default Debug/Release to ad-hoc signing

Persist CODE_SIGN_IDENTITY=- and an empty DEVELOPMENT_TEAM for the
macOS SDK in the InjectionNext target so local builds no longer
require passing those flags on the xcodebuild command line. Also
absorbs an Xcode-initiated reordering of existing pbxproj sections
(no functional change).

Made-with: Cursor

* chore: bump build number to 14083

Made-with: Cursor

* fix(devices): add Device Testing toggle, gate XCTest link

Previously, enabling "Device Injection" also unconditionally linked
-framework XCTest -lXCTestSwiftSupport into every injection dylib, so
apps that don't link XCTest themselves would crash at dlopen with:

  Library not loaded: @rpath/XCTest.framework/XCTest

NextCompiler already checks `AppDelegate.ui.deviceTesting?.state == .on`
to decide whether to add the testing -F/-L flags, but the SwiftUI port
routed that shim to `devicesEnabled`, so it was always on when devices
were on.

Split into its own flag:

- ConfigStore.deviceTesting (Bool, persisted as "deviceTesting")
- Defaults.deviceTesting back-compat shim
- AppDelegate.deviceTesting shim now binds to ConfigStore.deviceTesting
- AppDelegate.deviceTestingToggled(enabled:) exposes the legacy
  testingEnable behaviour (copy Run Script build phase to clipboard
  when turning on) to SwiftUI
- DevicesSettingsView: new "Device Testing" section with the toggle,
  footer explaining the copy_bundle.sh requirement, and greyed-out
  Linker Libraries field when off

Made-with: Cursor

* For InjectionIII

* 2nd attempt at small change.

* fix(log): drop duplicate LogBuffer.append; keep post-prefix call

Merge-resolve aftermath: two LogBuffer.append calls were coexisting
inside the #else branch — the original pre-prefix one from an earlier
resolution and John's corrected post-prefix one from #138. Keep only
the post-prefix call so log entries carry the APP_PREFIX, and keep
the non-optional .shared migration from this branch.

Made-with: Cursor

---------

Co-authored-by: John Holdsworth <1786033+johnno1962@users.noreply.github.com>
Co-authored-by: John Holdsworth <github@johnholdsworth.com>
Adds a Makefile next to InjectionNext.xcodeproj (App/Makefile) with
all dev-loop targets. Run from App/ (or `make -C App <target>` from
the repo root).

Targets:
- build-app — builds InjectionNext.app (Debug) via xcodebuild with
  ad-hoc signing.
- run — build, install to /Applications, launch.
- open / move-app — install + launch.
- kill — terminate any running InjectionNext (used before build/
  install to avoid code-sign/launch races).
- sync — git pull + submodule update (DLKit, InjectionLite).
- clean — remove derived data.

No source changes.
@johnno1962 johnno1962 force-pushed the 2.0_overhaul branch 15 times, most recently from 311d14f to c8269ac Compare April 21, 2026 08:21
* Suggested changes.

* Debug only.

* To discuss.

* Compatibility.

* Tweak titles.

* Tooltips, more environment vars.

* More Tooltips.

* Overdue for reuse.

* Missed the boat reconstructing PR.

* Is client Connected?

* Disarm bear trap, FrontendServer needs to start first.

* Capturing logs was inhibiting my debug prints.

* Update App/InjectionNext/Views/FileWatcherSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/Views/BuildSystemSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/ConfigStore.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* D'oh

* Update App/InjectionNext/Views/XcodeSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Change default arguments text.

* Update App/InjectionNext/Views/StatusMenuView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/Views/XcodeSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/AppDelegate.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Move away from print for debugs.

* Recover Defaults.swift fro InjectionIII.

* Debug prints on #DEBUG or INJECTION_DEBUG anv var.

* More env vars, connected status.

* Tracing preferences.

* docs(todo): flesh out 2.0 Next section with fork-discovered items (#142)

Adds seven concrete backlog items under three new subsections in
TODO.md's Next list. All discovered while running a maatheusgois-dd
fork of 2.0_overhaul against real iOS / Bazel codebases.

Hybrid / file-watcher
- Allow file-watcher injection while Xcode is running (drop the
  MonitorXcode.runningXcode early-return in InjectionHybrid).
- Skip SDK filter in log-parsing Recompiler when no client is
  connected (avoids grep SDKs/MacOSX misses for iOS projects
  edited before first device/sim connect).
- Replace DispatchQueue.main.sync on pendingFilesChanged with an
  NSLock to avoid main-queue deadlocks during compile I/O.

Developer tooling
- Reuse already-running Xcode in AppDelegate.runXcode instead of
  Popen-launching a duplicate Xcode process (macOS single-instances
  Xcode.app, leaving runningXcode pointed at a dead pipe).
- Top-level Makefile for local dev.
- CI release workflow (.github/workflows/release.yml).

Integrations / observability
- Injection event tracker emitting structured events over the
  existing ControlServer for MCP / AI agent consumers.

No source changes.

* Update App/InjectionNext/Defaults.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/Views/XcodeSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/Views/XcodeSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/ConfigStore.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* For rellease

* Reinstate project path further down pane.

* UNSETENV_VALUE

* Consolidate.

* Update App/InjectionNext/InjectionHybrid.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Enough already.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Matheus Gois <matheus.gois@doordash.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Large 2.0 overhaul that migrates InjectionNext’s macOS app UI from AppKit/XIB to SwiftUI, consolidates configuration into a single observable store, and expands the client/server protocol to support runtime environment-variable updates.

Changes:

  • Replace main.m + MainMenu.xib menu UI with a SwiftUI @main app (MenuBarExtra) plus Settings/Console windows.
  • Introduce ConfigStore (ObservableObject) and LogManager (ring-buffer logger + optional stdout/stderr capture), updating call sites for back-compat.
  • Add a new InjectionSetenv command and client-side handling to apply/unset env vars at runtime.

Reviewed changes

Copilot reviewed 46 out of 68 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TODO.md Adds a 2.0 roadmap and tracks follow-up items.
Sources/InjectionNextC/include/SimpleSocket.h Adds fdopenForMode: declaration (stdio interop).
Sources/InjectionNextC/include/InjectionClient.h Adds UNSETENV_VALUE and InjectionSetenv command.
Sources/InjectionNextC/SimpleSocket.mm Implements fdopenForMode: wrapper.
Sources/InjectionNext/InjectionNext.swift Adds env-var propagation on startup + .setenv command handling.
README.md Clarifies linker flag guidance (Debug context).
App/feedcommands/main.mm Switches to fdopenForMode: helper.
App/Makefile Adds local dev build/run/install/sync targets.
App/InjectionNext/main.m Removes legacy NSApplicationMain entry point.
App/InjectionNext/Views/XcodeSettingsView.swift New SwiftUI Xcode settings panel.
App/InjectionNext/Views/TracingSettingsView.swift New SwiftUI tracing settings panel.
App/InjectionNext/Views/StatusMenuView.swift New SwiftUI status menu (MenuBarExtra content).
App/InjectionNext/Views/SettingsView.swift New settings shell with sidebar navigation.
App/InjectionNext/Views/NetworkSettingsView.swift New SwiftUI network/protocol info panel.
App/InjectionNext/Views/InjectionSettingsView.swift New SwiftUI injection + watcher configuration panel.
App/InjectionNext/Views/GeneralSettingsView.swift New SwiftUI “About/status” panel.
App/InjectionNext/Views/FileWatcherSettingsView.swift New SwiftUI file-watcher pattern/latency UI.
App/InjectionNext/Views/DevicesSettingsView.swift New SwiftUI device injection + signing/testing UI.
App/InjectionNext/Views/ConsoleView.swift New in-app console UI backed by LogManager.
App/InjectionNext/Views/CompilerSettingsView.swift New SwiftUI compiler interception UI.
App/InjectionNext/Views/BuildSystemSettingsView.swift New SwiftUI build-system selection/config UI.
App/InjectionNext/Views/AdvancedSettingsView.swift New SwiftUI advanced diagnostics + env var reference UI.
App/InjectionNext/NextCompiler.swift Routes logs to LogBuffer and adds debug() helper.
App/InjectionNext/MonitorXcode.swift Avoids spawning Xcode if one is already running; updates save hook parsing.
App/InjectionNext/LogManager.swift Adds centralized logger with ring buffer + optional stdout/stderr interception.
App/InjectionNext/InjectionServer.swift Uses non-optional LogBuffer.shared; sends env vars on client connect; icon update tweaks.
App/InjectionNext/InjectionReady.tif Legacy icon resource still present in PR set (UI migrated to assets).
App/InjectionNext/InjectionOK.tif Legacy icon resource still present in PR set (UI migrated to assets).
App/InjectionNext/InjectionIdle.tif Legacy icon resource still present in PR set (UI migrated to assets).
App/InjectionNext/InjectionHybrid.swift File-watcher pattern now comes from ConfigStore; adjusts hybrid recompile filtering logic.
App/InjectionNext/InjectionError.tif Legacy icon resource still present in PR set (UI migrated to assets).
App/InjectionNext/InjectionBusy.tif Legacy icon resource still present in PR set (UI migrated to assets).
App/InjectionNext/Info.plist Switches to asset-catalog icon; removes main nib keys; bumps build.
App/InjectionNext/FrontendServer.swift Redirects noisy prints to debug().
App/InjectionNext/Defaults.swift Fixes comment typo (“defaults”).
App/InjectionNext/ControlServer.swift Removes old LogBuffer impl; routes to LogManager and updated AppDelegate shims.
App/InjectionNext/ConfigStore.swift New central configuration store + env-var push to clients + discovery helpers + Defaults shim.
App/InjectionNext/Base.lproj/MainMenu.xib Removes legacy AppKit XIB menu/resources.
App/InjectionNext/Assets.xcassets/INJECTION_YELLOW.imageset/Contents.json Adds new status icon assets (yellow set).
App/InjectionNext/Assets.xcassets/INJECTION_RED.imageset/Contents.json Adds new status icon assets (red set).
App/InjectionNext/Assets.xcassets/INJECTION_PURPLE.imageset/Contents.json Adds new status icon assets (purple set).
App/InjectionNext/Assets.xcassets/INJECTION_ORANGE.imageset/Contents.json Adds new status icon assets (orange set).
App/InjectionNext/Assets.xcassets/INJECTION_GREEN.imageset/Contents.json Adds new status icon assets (green set).
App/InjectionNext/Assets.xcassets/INJECTION_BLUE.imageset/Contents.json Adds new status icon assets (blue set).
App/InjectionNext/Assets.xcassets/Contents.json Adds asset catalog metadata.
App/InjectionNext/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png Adds app icon raster.
App/InjectionNext/Assets.xcassets/AppIcon.appiconset/icon_32x32.png Adds app icon raster.
App/InjectionNext/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png Adds app icon raster.
App/InjectionNext/Assets.xcassets/AppIcon.appiconset/icon_16x16.png Adds app icon raster.
App/InjectionNext/Assets.xcassets/AppIcon.appiconset/icon_128x128.png Adds app icon raster.
App/InjectionNext/Assets.xcassets/AppIcon.appiconset/Contents.json Updates app icon asset catalog manifest.
App/InjectionNext/AppDelegate.swift Reworks AppDelegate into SwiftUI-compatible shim + device server logic changes.
App/InjectionNext/App.icns Legacy icon resource still present in PR set (migrated to asset catalog).
App/InjectionNext.xcodeproj/project.pbxproj Updates project for SwiftUI entry, new files, removed XIB/main.m, asset icons, macOS target/version bump.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread App/InjectionNext/ConfigStore.swift Outdated
Comment thread App/InjectionNext/AppDelegate.swift
Comment thread App/InjectionNext/AppDelegate.swift
@johnno1962 johnno1962 force-pushed the main branch 6 times, most recently from 90c0d96 to 7bae304 Compare April 24, 2026 16:56
johnno1962 and others added 4 commits April 24, 2026 21:55
* Fine tuning INJECTION_TRACE_FILTER

* Implement INJECTION_DLOPEN_MODE

* INJECTION_TRACE_ALL implies INJECTION_TRACE

* A bit more help.

* Minimise diff, batch variables.

* Bump version, take Swift Package from main.

* Tracing help.

* Update App/InjectionNext/Views/TracingSettingsView.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Copilot review.

* More help, remove unimplementable settings.

* Remove select project UI for now.

* Oh alright, project UI for now.

* Copilot

* Neutralise force unwraps.

* I can settle on this.

* Restore comments.

* Compatability.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Implement "early" settings.

* Decide on auto-launch/project.

* Implement FileWatcher latency setting.

* Rationalise compiler settings.

* Injecting while tracing.

* Advanced early settings.

* Reinstate Prepare SwiftUI.

* Update Sources/InjectionNext/InjectionNext.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Sanitise injectionHost setting.

* Early settings for bundles.

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update App/InjectionNext/ConfigStore.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Move settings file out of /tmp.

* Settings in app as well as injection bundle.

* Revert "Rationalise compiler settings."

This reverts commit 87577b4.

* Weird initialisation problem.

* Always show tracing options which can have effect.

* Deterministic server startup.

* Revert Revert "Rationalise compiler settings."

* Restarting servers.

* Implement INJECTION_TRACE_REPAIR.

* Separate server sockets.

* Revert Revert Revert "Rationalise compiler settings."

* ignoreGitignore option.

* Defaults compatibility.

* Pesky compiler setting.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Formatting, time to release methinks.

* Just. One. More. Feature.

* Accept no for an answer.

* For HotReloading package.

* Update checker.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@johnno1962

Copy link
Copy Markdown
Owner Author

Hi @maatheusgois-dd, I'm going to merge and release this, this week if there was anything you wanted to change. Thanks again, the new settings interface is an excellent enhancement.

@johnno1962 johnno1962 force-pushed the 2.0_overhaul branch 6 times, most recently from 5ef5608 to 734e1ca Compare May 6, 2026 13:03
@johnno1962 johnno1962 merged commit bdf68a7 into main May 7, 2026
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.

3 participants