Skip to content

feat: add multi-agent MCP registration, setup dialog, and uninstall#24

Merged
yani- merged 23 commits intomasterfrom
feat/agent-config-manager
Mar 28, 2026
Merged

feat: add multi-agent MCP registration, setup dialog, and uninstall#24
yani- merged 23 commits intomasterfrom
feat/agent-config-manager

Conversation

@yani-
Copy link
Copy Markdown
Member

@yani- yani- commented Mar 28, 2026

Summary

  • AgentConfigManager detects Claude Code + Gemini CLI and registers/unregisters Traktor's MCP server in their config files
  • CLI commands: traktor mcp register, traktor mcp unregister, traktor mcp status, traktor uninstall
  • First-run setup dialog with agent checkboxes on first GUI launch
  • GUI menu items: Tools > Manage AI Agent Integrations... and Tools > Uninstall Traktor...
  • Replaces inline Claude-only registerMcpConfig() with multi-agent AgentConfigManager
  • 10 new tests (97 total), all passing

Key Design Decisions

  • Config-first detection: checks for ~/.claude.json and ~/.gemini/ before searching for binaries, solving the macOS GUI PATH limitation (Finder-launched apps don't inherit shell PATH)
  • Always absolute paths: MCP config entries use the absolute binary path, never bare "traktor", avoiding PATH dependency
  • Atomic writes: temp file + rename prevents config corruption on interrupted writes
  • DI for tests: AgentConfigManager(configRoot) parameter allows testing against temp directories

Test plan

  • All 97 tests pass (81 existing + 10 new AgentConfigManager + 6 existing)
  • clang-format clean
  • CI builds on Linux, macOS, Windows
  • traktor mcp status shows correct detection
  • traktor mcp register writes valid JSON configs
  • First-run dialog appears on fresh QSettings

AgentConfigManager:
- Detects Claude Code and Gemini CLI via config file existence +
  binary search in common paths (handles macOS GUI PATH limitation)
- Registers/unregisters MCP server config with defensive JSON
  read-merge-write using atomic file operations (temp + rename)
- Always uses absolute binary path in config entries to avoid
  PATH dependency
- Handles invalid JSON (backup .bak + create new), missing
  directories (mkpath), stale paths (update), and idempotent
  re-registration
- configRoot parameter enables testing against temp directories

CLI commands:
- traktor mcp register — register with all detected agents
- traktor mcp unregister — remove from all agents
- traktor mcp status — show detection + registration table
- traktor mcp status --json — machine-readable output
- traktor uninstall — remove CLI symlink, MCP configs, QSettings

First-run setup dialog:
- Shown on first GUI launch (QSettings flag)
- Detects installed agents, shows pre-checked checkboxes
- "Set Up" registers selected agents, "Skip" defers
- Re-accessible via Tools > Manage AI Agent Integrations...

GUI menu items:
- Tools > Manage AI Agent Integrations...
- Tools > Uninstall Traktor... (with confirmation dialog)

Replaces inline registerMcpConfig() in installcli.cpp with
AgentConfigManager calls (DRY, supports multiple agents).

New files: src/agentconfig.h/cpp, src/setupdialog.h/cpp
10 new tests (97 total, all passing)
@github-actions github-actions bot added test Test suite changes build Build system/project files ui User interface labels Mar 28, 2026
yani- added 3 commits March 29, 2026 04:44
Windows test binary crashes immediately (exit code 7, no output) when
Qt platform plugins are unavailable in CI. Linux already had this env
var. Adding it to Windows ensures consistent headless test execution.
@github-actions github-actions bot added the ci CI/CD workflows label Mar 28, 2026
yani- added 7 commits March 29, 2026 04:54
QTemporaryFile appears to cause a CRT initialization crash (exit code 7)
on Windows MSVC with Qt 5.15.2. Replace with direct QFile writes which
is what the original installcli.cpp used successfully. The atomic write
improvement (temp + rename) is not worth a platform-specific crash.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 28, 2026

Build Artifacts

Platform Download
Linux (x86_64) Traktor-linux-x86_64
macOS (Apple Silicon) Traktor-macOS
Windows (x64) Traktor-windows-x64

Built from 9a5c3f4. Artifacts expire after 90 days.

yani- added 12 commits March 29, 2026 05:24
QTemporaryFile causes a CRT initialization crash (exit code 7) on
Windows MSVC with Qt 5.15.2 due to internal file locking behavior
during static initialization.

QSaveFile is Qt's recommended class for atomic config file writes:
- Writes to a platform-appropriate temp file internally
- Atomically renames to the destination on commit()
- Handles Windows rename semantics (no rename-over-existing)
- Available since Qt 5.1, no additional dependencies

Reference: https://forum.qt.io/topic/130970 (QTemporaryFile + MSVC issue)
- Add scripts/macos-pkg/postinstall that creates /usr/local/bin/traktor
  symlink during installation (runs as root, no auth dialog needed)
- CI now builds a PKG installer alongside the .app tar for PR testing
- PKG installs Traktor.app to /Applications and creates CLI symlink
- Ad-hoc signed (no Developer ID cert yet) — works for local testing
After uploading release assets, the release workflow now:
1. Computes SHA256 of the macOS DMG
2. Clones servmask/homebrew-traktor
3. Updates Casks/traktor.rb with new version + SHA256
4. Commits and pushes

Requires HOMEBREW_TAP_TOKEN secret with repo write access to
servmask/homebrew-traktor, or falls back to the default GITHUB_TOKEN
(works if both repos are in the same org).
- distribution.xml sets product title to "Traktor" (fixes empty "" in
  trash dialog and generic "Welcome to the Installer" header)
- welcome.html: describes what Traktor does and what the installer will
  set up (app + CLI tool)
- conclusion.html: shows next steps after installation (open app, CLI
  usage examples, MCP registration command)
- Both support dark mode via prefers-color-scheme media query
- Uses productbuild --distribution instead of --package for custom UI
--root with cp -R was not preserving the .app bundle structure in the
PKG payload. --component is the correct pkgbuild flag for bundling
macOS .app directories and sets the install location properly.
The distribution.xml pkg-ref must use #filename.pkg (with # prefix)
to embed the component package inside the product archive. Without it,
productbuild creates an external reference and the payload is empty.
Also adds debug output to verify app bundle and package sizes.
…tions

pkgbuild --component adds a <relocate> directive by default, causing
macOS Installer to search for an existing Traktor.app bundle anywhere
on the system and install there instead of /Applications. If the user
has a build directory with Traktor.app, the installer silently
overwrites it instead of installing to /Applications.

Fix: use --component-plist with BundleIsRelocatable=false to force
installation to the specified --install-location.
…nent plist

Heredoc with XML content inside YAML run block causes GitHub Actions
parser to fail. Use pkgbuild --analyze to auto-generate the component
plist, then PlistBuddy to set BundleIsRelocatable=false.
- Remove DMG from release pipeline (PKG is the sole macOS distribution)
- release.yml: builds PKG, uploads PKG, submits PKG to VirusTotal,
  auto-updates Homebrew Cask from PKG SHA256
- README: add CLI usage, MCP integration, Homebrew install, PKG as
  primary macOS download. Remove DMG references.
- CLAUDE.md: update test count (97), document new source files
  (clihandler, mcpserver, agentconfig, installcli, setupdialog),
  PKG scripts, and updated CI/release process
@github-actions github-actions bot added the docs Documentation label Mar 28, 2026
@yani- yani- marked this pull request as draft March 28, 2026 23:50
@yani- yani- marked this pull request as ready for review March 28, 2026 23:50
@yani- yani- merged commit eb2956a into master Mar 28, 2026
7 checks passed
@yani- yani- deleted the feat/agent-config-manager branch March 28, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build system/project files ci CI/CD workflows docs Documentation test Test suite changes ui User interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant