Repository navigation
feat(agent): install the maple-agent command from General settings - #1436
w3irdrobot wants to merge 3 commits into
Conversation
Settings > General > Command line writes a marked launcher script to ~/.local/bin that execs the installed app, so terminals and ACP clients can run `maple-agent acp`. A script keeps updates and current_exe() unchanged; only files carrying Maple's marker are replaced or removed, and the Linux installer's wrapper counts as installed. The row says when ~/.local/bin is not on the login shell's PATH. Windows is not covered yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS writes the launcher to /usr/local/bin, which is on the default PATH, through the system administrator prompt when that folder is not writable. The privileged step is one sh command built from quoted arguments; a create refuses a file that appeared after the check. Unpackaged builds can set MAPLE_CLI_LAUNCHER_TARGET to exercise the row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
GUI check of Settings > General > Command line (Local lane, debug build on Xvfb, temporary HOME with
|
|
@AnthonyRonning this seems to be fine on linux since the binary ends up in the path already in our install. can you test this on Mac? and i'm not sure how to test windows haha |
|
I want to think about this a lot more and revisit all the threads and approaches that I went with for the daemon design to begin with, I spent a lot of time on the design and I can't remember exactly how it is and how something like this might change things. And also things like updates. |
|
That's fine. This isn't something we need unless we want to more easily integrate ourselves with other harnesses. The idea is to get us on the command path on the OS. So if there's another approach that's better, that's fine with me as well. |


Summary
Adds Settings > General > Command line, which installs a
maple-agentcommand so terminals and ACP clients (Zed, Paseo, …) can runmaple-agent acpwithout knowing where the app is installed. This prepares Maple for ACP agent catalogs that launch a fixed command, such as Paseo's./usr/local/bin, which is on the default PATH. When that folder isn't writable or doesn't exist, the privileged step goes through macOS's own administrator prompt (osascript … with administrator privileges).~/.local/bin, the same place the Linux installer already puts its wrapper.#!/bin/sh+# maple-agent-cli-launcher-v1+exec '<installed app>' "$@". Updates replace the app in place (macOS swaps the bundle at the same path), so the launcher stays current.current_exe()stays inside the bundle, which matters for self-launch and notification checks. A symlink would make macOS report the symlink's path instead.maple-agent-user-install-v1) counts as installed and is never modified.shcommand line built only from single-quoted arguments: each launcher line is a separateprintfargument, then a staged file,chmod 0755andmv. AppleScript gets no newlines. Install runs as a create that refuses a file appearing after the unprivileged check. Remove uses the same prompt when needed. Cancelling the prompt reports that nothing changed.login_search_path, now exported from the runtime crate) and says if the folder is not on the shell's PATH.maple-agent-dev, matching the Linux installer.MAPLE_CLI_LAUNCHER_TARGETnames an executable. That variable exists so the row can be exercised against a Local stack. Packaged builds ignore it.%LOCALAPPDATA%\Programs\Maple Work\maple-agent.exeis already a stable bootstrap: given arguments, it starts the selected version, passes argv and stdio through, waits, and returns the exit code (windows_bootstrap.rs). The Windows piece is adding that folder to the user PATH from the installer and removing it on uninstall. A.cmdshim would also break Node-based clients, which can't spawn.cmdwithout a shell. The row explains this on Windows for now.Validation
All runs were in an isolated MDE workspace (
cli-path) on Linux x86_64, inside the Agent's pinned Nix shell.GUI, Local lane (screenshots are in a PR comment):
agent-proLocal fixture account.maple-agent 0.0.16 (dd2c4c81-dirty), i.e. this branch before the second commit's docs-only change) on Xvfb + xfwm4, driven by Cua Driver 0.38.0.~/.local/binto PATH.MAPLE_CLI_LAUNCHER_TARGETpointed at the debug binary.Steps:
http://127.0.0.1:31127, then opened Settings > General. The Command line row showed Install.~/.local/bin/maple-agentwith mode 755 and the expected marked script. The row switched to "maple-agent runs this app from ~/.local/bin/maple-agent…" with Remove, which also shows the login-shell PATH check found the folder. Running the new command printedmaple-agent 0.0.16 (dd2c4c81-dirty).Automated:
cargo test -p maple-agent-app -- cli_launcher command_line, 12 tests, all pass:shagainst a temp folder (one line, mode 755, the create guard refusing a late file, update in place, no staged leftovers)just ci-lintpassed.just ci-test: 2,007 passed and 2 failed. Both failures weresystem_theme_helpertimeouts under full-run load; on their own they pass in 0.25s.cargo fmt, app clippy (-D warnings), the focused tests andjust buildpassed. The full gates were not rerun.Not verified:
/usr/local/binwere not exercised on a Mac. The privileged command was tested viashon Linux.agent-lint,agent-test,agent-macos,agent-windowsandci-okall pass on084f653b.agent-windowsfirst caught launcher states that are dead code on Windows; the third commit fixes that.🤖 Generated with Claude Code