Development Setup
Prerequisites
The macOS desktop app supports macOS 12 Monterey or later and requires system WebKit updated to Safari 17.4 or later for Mermaid diagrams. The bundle declares macOS 12.0 as its minimum; this does not guarantee that Safari updates are installed. src-tauri/.cargo/config.toml forces MACOSX_DEPLOYMENT_TARGET=12.0 for Rust and native dependencies, including WebRTC and whisper.cpp, overriding inherited shell defaults. The Cargo config also forces CMAKE_OSX_DEPLOYMENT_TARGET=12.0 so whisper.cpp updates existing CMake caches instead of retaining an older target. Make does not set a separate default. scripts/test-macos-deployment-target.sh checks both values against the bundle minimum and runs with system Python without extra dependencies. The installed Xcode SDK’s libc++ __configuration/availability.h warns for macOS deployment targets below 11.0, so 12.0 needs no increase. Windows uses the Evergreen WebView2 runtime; Linux builds use WebKitGTK 4.1 API packages.
- Node.js 24+ (the repository version is pinned in
.nvmrc) - Rust (stable toolchain via rustup)
- Tauri CLI (
cargo install tauri-cli) - git for git features.
gh(GitHub CLI) is only a release tool; the app does not run it.
Windows users: See the Windows-specific prerequisites section below before proceeding.
Install Dependencies
pnpm install
Dependency release policy
The application and the standalone website/ project pin pnpm 12.15.0 in
packageManager. CI uses that pin through pnpm/action-setup.
Each project’s pnpm-workspace.yaml sets minimumReleaseAge: 10080:
new direct and transitive package releases must be at least seven days old.
There are no release-age exclusions. Use pnpm install --frozen-lockfile
for reproducible installs. pnpm 12 also verifies locked releases against this
policy, so an existing lockfile is not an exception.
Do not approve a young release interactively or add an exclusion to make an
install pass. Wait for the release to mature, or ask for an explicit policy
decision. minimumReleaseAgeExclude exists, but this project does not use it.
See the pnpm release-age settings.
Package popularity is a separate review. npm reports downloads, not users. Use last-week downloads as the agreed proxy and review every package below 10,000 downloads per week, including transitive and development packages. A low count is not permission to remove or replace a dependency.
TypeScript target
The app uses ES2024 for the TypeScript target and standard library, with
DOM and DOM.Iterable types. Vite keeps its existing esnext build target;
it does not lower ES2024 syntax to ES2021. This configuration does not add
runtime polyfills.
Paired Tauri dependencies
Update each Tauri Rust plugin and its npm counterpart together. Notification stays
on ~2.4.0 and updater on ~2.11.0 in both manifests until their next minor
versions are validated together. The direct rfd dependency must match the
version and features used by tauri-plugin-dialog; dialog 2.8.1 uses rfd 0.16.
Dependency audit exceptions
pnpm-workspace.yaml ignores no advisory. The former exception for
GHSA-vfj7-8cjw-p6xm (build-only braces 3.0.3, approved 2026-10-04, expired
2026-11-04) was removed on 2026-11-14: GitHub withdrew that advisory, and
pnpm audit --audit-level=high passes without it. Transitive security pins
live in the overrides block of pnpm-workspace.yaml, each with its reason:
DOMPurify for the application and Mermaid, the development-only qs, Seroval
=1.6.3, source-map-js >=1.2.2, and the test-only zod ^4.6.6 and undici ^8.12.2. KaTeX 0.16.47 remains under Mermaid 11; its patched >=0.18.2 line requires the separate Mermaid upgrade and browser compatibility review. Rust exceptions live in
src-tauri/.cargo/audit.toml, each with a reason and a review date.
pnpm 11 ignores the legacy pnpm.auditConfig field in package.json.
Development
Native Tauri App
make dev
Starts the Vite dev server and Tauri app. Frontend files use Vite HMR; Rust changes require restarting the development process.
On macOS, make dev requires Python 3 and passes a Cargo target runner to Tauri’s cargo run. The runner copies the desktop executable and its tuic-remote, tuic-bridge, and tuic siblings into ~/Library/Application Support/com.tuic.commander/dev-bin/ before launch. These are real copies, not links into Cargo or mbx targets. Target cleanup can no longer remove the running desktop executable. The path stays the same across runs; files are replaced, not accumulated, and remain after exit. A second launch at that path is rejected while the runner holds its process lock. TUIC_DEV_BIN_DIR overrides the directory for isolated script checks. Direct pnpm tauri dev does not use this protection. Linux and Windows keep the normal Cargo launch.
The existing MCP bridge installation still verifies and preserves its own revisions; the dev runner keeps its adjacent source available. The bridge installer runs inside the application, so it cannot protect the desktop executable before launch.
The macOS application firewall uses code signing for initial and tracking decisions (Apple TN2206). Its UI also selects applications by filesystem path (Apple firewall settings). Both the executable path and signing identity matter: a stable existing path contains the missing-executable failure, but does not promise unchanged firewall permission after a rebuild changes the signature. Confirm LAN and tailnet access after the next launch; no firewall setting is changed by the runner.
Vite excludes backend files and repository tooling output such as .tmp/, target/, dist/, coverage, reports, plans, stories, and docs from its watcher. Mutation testing keeps its disposable checkout under .tmp/; its HTML files must not reload the live WebView. Changes to this watch configuration require restarting the Vite dev server.
The watch allowlist and Tauri version are resolved from the directory containing vite.config.ts, so starting Vite from another working directory still uses this checkout’s inputs.
macOS application icon
src-tauri/tauri.macos.conf.json selects the macOS-only PNG for window icons
and icons/icon.icns for the application bundle. Tauri also embeds the ICNS
for the Dock when running pnpm tauri dev (it uses a PNG only if the ICNS
is missing). Restart the development process after changing these assets.
The shared PNGs and ICO remain unchanged for Linux and Windows.
Run bash scripts/generate-macos-icon.sh on macOS with ImageMagick to rebuild
these assets from the shared src-tauri/icons/icon.png art. The macOS canvas
is 1024 pixels with a centered 824-pixel rounded body and transparent margins.
Run bash scripts/test-macos-icon.sh to check transparent margins and an opaque
body in the PNG and every ICNS representation. The check needs ImageMagick and
the system iconutil command.
Isolated agent desktop checks (macOS)
Use a linked worktree, not the daily checkout. Inspect the complete plan first:
make agent-test AGENT_TEST_DRY_RUN=1
make agent-test
# In another shell, stop only this supervised instance:
make agent-test-stop
The dry run does not build, create runtime files, read application configuration,
or start a desktop process. The launch runs in the foreground. It builds the
frontend, then uses one Cargo build through the mbx shim for
tuicommander-agent-test, tuic-bridge and tuic. A build admission wrapper
(e.g. the orchestrator’s build-slot script) serializes these builds when
TUIC_BUILD_SLOT names an executable one; scripts/replay-oracle.sh honours it
too. When TUIC_BUILD_FREEZE names an existing freeze file, the launch refuses to
build unless that file allows it. mbx doctor must
succeed. Do not set CARGO_TARGET_DIR. No Vite server, Tauri watcher, release
bundle, signing operation or installed executable is involved. Embedded frontend
assets use tauri/custom-protocol even though this is a debug build.
Defaults are AGENT_TEST_INSTANCE=agent-test and AGENT_TEST_PORT=19876.
The isolated window starts at 1400 × 900 logical pixels so Tasks and other
virtualized panels have a usable viewport. Its minimum size is 390 × 420, so
native checks can use a phone-width viewport.
Override with, for example, make agent-test AGENT_TEST_INSTANCE=agent-check AGENT_TEST_PORT=19877 (on one line). Use the same instance on the stop target.
Agents must connect through the instance’s Unix socket, printed as socket and
as a ready-to-run connect command in the launch JSON:
curl --unix-socket '<socket from launch JSON>' http://localhost/health
tuic --instance <instance> <command> reaches the same socket from any shell:
the app publishes the path in its instance config directory.
Replace /health with the endpoint needed for the check. The socket does not
require HTTP authentication. TCP requests to 127.0.0.1:<port> require Basic
auth (or another configured authenticated session); an unauthenticated request
can return 401. A ready TCP listener does not mean an agent can use its API
without credentials. Do not read or copy the daily instance’s credentials.
These dedicated variables ignore inherited TUIC_APP_INSTANCE, TUIC_PORT,
TUIC_SOCKET and TUIC_DEV_BIN_DIR. Empty/default instance IDs and port 9876
are rejected, not interpreted as production defaults. The dedicated Rust entry
point also validates instance and port before any config read, and refuses
release, non-macOS or dictation-enabled builds.
The compiled executable has a distinct Cargo target name and is copied outside
the checkout, to
<base>/<hash8>/<instance>/tuicommander-agent-test, where <base> is
$TUIC_AGENT_TEST_BUILD_ROOT if set, else tuic-agent-test under the host temp
dir ($TUIC_TEST_HOST_TMPDIR, else the system temp dir), and <hash8> is the
first 8 hex digits of the SHA-256 of the checkout’s resolved path, so each
worktree has its own binary. The running copy is not a symlink into mbx’s target
cache. The temp dir is purged by the OS eventually (macOS clears untouched files
in the per-user temp dir after a few days): the binary is a rebuild-on-demand
artifact. --reuse-build-sha256 against a purged build fails with agent-test: reuse requires the existing regular artifact tuicommander-agent-test (a
RuntimeError, exit 1, nothing launched); run without the flag to rebuild. The default instance stores app state
in ~/Library/Application Support/com.tuic.commander/instances/agent-test/.
It never seeds from the daily config. Never copy daily tokens or config there.
The test window starts at 1400×900 logical pixels, with a 390×420 minimum,
at the bottom-right of the primary screen work area (16 logical pixels inset).
It is always on top so ordinary application windows do not cover it. A higher
or another floating window (a second agent-test instance in the same corner, a
system authentication prompt) can still cover it fully; WebKit would then mark
the page hidden and stop requestAnimationFrame. The agent-test WebView
therefore disables WebKit window-occlusion detection, so the document stays
visible while the window is ordered in. It cannot become key or take keyboard
focus. Background throttling is disabled (supported on macOS 14+). The
agent-test application uses the Prohibited activation policy, set between
Tauri build and run: Tao 0.37.1 still calls activateIgnoringOtherApps(false)
at launch, and macOS grants it when the launching application (usually the
daily TUIC) is frontmost. As a result the test instance has no Dock icon or
menu bar and never becomes the active application. A process-lifetime activity
prevents App Nap during live latency checks but still permits idle system sleep.
These changes apply only to the dedicated agent-test runtime; the daily app keeps
its existing activation, occlusion and power-management behavior.
It starts hidden: Tao 0.37.1 app_state.rs::window_activation_hack otherwise
orders every visible window key even when focus=false. At Tauri Ready, after
that sweep, the agent-test path calls native NSWindow.orderFront without
becoming key. Saved-window restoration is disabled for this profile because
the window-state plugin calls show and set_focus during restoration.
Do not call window.show() or setFocus() to present it: the pinned Tao backend
uses makeKeyAndOrderFront for those APIs. The agent-test capability override
denies show and set-focus and grants core:window:allow-set-size only
to its main window. The grant is inline in the agent-test build overlay, not
in an auto-loaded capability file. The daily capability files are unchanged.
Stop the instance when the check ends to remove the floating window. The daily window configuration remains unchanged.
Resize the native test window
Use the socket from make agent-test AGENT_TEST_DRY_RUN=1 with the same
AGENT_TEST_INSTANCE=agent-test-<story> and AGENT_TEST_PORT=<port> values
as the running authorized instance. Do not use the orchestrator MCP debug tool:
it targets the daily app, not your worktree. Set SOCKET to that dry run’s
socket value, then send a native Tauri resize through the instance API:
curl --fail --unix-socket "$SOCKET" http://localhost/debug/invoke_js \
-H 'Content-Type: application/json' --data-binary @- <<'EOF'
{"script":"const api = window.__TAURI__.window; const w = api.getCurrentWindow(); await w.setSize(new api.LogicalSize(390, 844)); return {check: 'agent-test-resize', size: (await w.innerSize()).toLogical(await w.scaleFactor())};"}
EOF
curl --fail --unix-socket "$SOCKET" \
'http://localhost/logs?source=eval_js&limit=5'
invoke_js acknowledges dispatch, not completion. Read the matching
agent-test-resize log result and check its logical width and height before
capturing evidence; a permission error is not a successful resize. This changes
the native WebView viewport, not a browser-mode Vite page. Do not call show()
or setFocus(). To restore the initial viewport, use the same script with
new api.LogicalSize(1400, 900). Rebuild and restart only your named agent-test
instance to load a changed capability overlay; an existing binary keeps its
compiled permissions.
Persistent GitHub live-check login
Use one named instance for all authorized GitHub live checks, across stories and worktrees. Do not select a new instance name for each agent:
make agent-test-github AGENT_TEST_DRY_RUN=1
make agent-test-github
# Stop only after the current owner finishes:
make agent-test-github-stop
These targets always select agent-test-ghlive on port 19887, including when
AGENT_TEST_INSTANCE, AGENT_TEST_PORT or TUIC_* values are inherited or supplied
for another story. They reuse the instance used for the authenticated Tasks
checks. The generic agent-test defaults and all isolation guards are unchanged.
Coordinate ownership before starting or stopping this shared verification
instance. Its existing supervisor lock rejects a second owner; do not stop
another agent’s run. Stop preserves persistent state.
The agent-test executable is a debug build. Its credential adapter uses
~/.tuicommander-dev/instances/agent-test-ghlive/credentials.json, not macOS
Keychain. App configuration and account metadata remain under
~/Library/Application Support/com.tuic.commander/instances/agent-test-ghlive/.
The vault service is tuicommander-instance-agent-test-ghlive, user vault,
with the GitHub OAuth token in the account/github.com slot. A different instance
selects a different file and vault namespace; it does not reuse this login.
Rebuilding or changing the worktree does not change either persistent path.
agent-test-stop removes the PID and FIFO only, not credentials or configuration.
Do not read, copy, reset or delete credential files to move a login between
instances. Never copy the daily instance’s credentials.
Before requesting another Device Flow login, use the instance’s normal GitHub
status UI/API to check its existing account, not its token store. The 2026-10-23
Tasks worklog records a successful login and restart retention in
agent-test-ghlive. File existence alone does not prove that token is still valid.
An expired/revoked token or a newly required OAuth scope can still require consent;
for example, adding Projects write access requires project, not the older
read:project scope. Reusing a namespace does not add permissions to an old token.
Native visibility regression (authorized macOS runs only)
The unattended scripts/agent-test-tests.py checks launcher/configuration and
source-wiring contracts. It does not observe a rendered window. The separate
native regression launches this worktree’s make agent-test, observes the real
WebView through its Unix socket, and stops the supervised instance in cleanup:
python3 -B scripts/agent-test-visible.py --instance at-2090 --port 19883 \
--evidence-dir "${TMPDIR%/}/results/agent-test-visible-$(date +%s)"
Add --duration 300 to observe presentation for five minutes. Add --cover as
well to put an opaque, non-activating panel from another process (accessory
policy; it absorbs clicks without activating anything) over the window for the whole observation; this is the
story 2095 regression for a covered test window. The observer records
visibility changes, animation-frame progress and gaps, native window-server layers,
application-hidden state, foreground identity, and compact-window geometry in
presentation.json. It fails if presentation or animation frames stop, the test instance becomes
frontmost or takes focus, or window geometry changes. Foreground changes between
other applications are recorded, not failures: the check must pass while Boss works.
The window-server query is read-only and does not activate or move other windows.
These observations do not read NSWindow.occlusionState directly or prove App Nap activity.
This needs explicit desktop-execution authorization, macOS, a linked worktree
with build inputs, an unused named instance/port, and an unrelated foreground
application at launch. Do not use an existing instance with sessions. The evidence directory
must be new and under the host temp dir ($TMPDIR).
agent_test_window_renders_visible_without_focus checks document/native
visibility, positive terminal canvas area, actual fillText paint, no native or
document focus, and that the test instance is not frontmost at readiness or
after painting. It also verifies the compact viewport and corner geometry.
It retains JSON receipts, the native build log and canvas-only PNGs, deletes
only sessions created by the check, calls make agent-test-stop, and checks
ps for this worktree’s executable. It never captures the desktop or drives
the daily instance. A failure exits nonzero after cleanup. Commenting out the
native orderFront presentation must make this observer fail; source contracts
alone are not behavioral RED evidence. This native check is intentionally not
part of the unattended shell/Rust/JS suites.
Shared-resource audit
| Resource | Agent-test policy |
|---|---|
| Daily binary, dev-bin and installed app bundle | No writes. Only the worktree’s distinctly named binary and adjacent sidecars are copied. A held supervisor lock prevents replacing the running test executable. |
| Config, credential vault, databases and file locks | Existing named-instance namespace; debug credentials remain file-backed. The test never claims the global-input lock, even in its own namespace. |
| HTTP and MCP | Explicit loopback-only 127.0.0.1:19876; never port 9876 or automatic next-port fallback. Unix MCP socket uses the selected instance hash and the launch’s short TMPDIR, <host temp>/tuic-at/<first 8 hex digits of the hash>/: the host temp dir is TUIC_TEST_HOST_TMPDIR (recorded by scripts/with-test-tmp.sh), else TMPDIR; TUIC_AGENT_TEST_ROOT replaces <host temp>/tuic-at when the socket path would exceed the macOS 104-byte limit. Child CLI/bridge processes inherit the same namespace. |
| Global window shortcut and Fn/Globe monitor | Input ownership refused and shortcut registration rejected at runtime, including later Settings changes. The verification window is non-focusable; drive its own HTTP/socket API. |
| Microphone and dictation | Not compiled by default. With explicit authorization, AGENT_TEST_SPEECH_OUTPUT=1 and an agent-test-<name> instance enable runtime speech output only: effective listening is forced off, microphone permission/capture is refused, and global input ownership stays disabled. Speech output is audible; do not use this option without authorization. |
| Telegram bot | Supervisor never starts, tool availability is false, and setup changes are rejected. A copied or previously saved bot configuration cannot start polling. |
| Global CLI | Startup auto-update is skipped. Explicit installation, update and removal are rejected before sidecar resolution or filesystem changes, including elevated helper paths. |
| Global agent hooks | Hook enable and disable requests are rejected over IPC and HTTP before saving the instance flag or changing shared Claude, Gemini, Grok, Codex or OpenCode files. Read-only hook status remains available. |
| Global agent MCP configuration | Startup installation cannot claim ownership, even with an inherited owner override; explicit install/remove writes are rejected. |
| Updater | No native updater plugin, no channel checks and automatic updates default off. The test cannot replace the daily bundle. |
| Deep links, release single-instance lock and login items | Deep-link plugin is not installed. This debug-only binary never takes the release single-instance lock. Desktop startup has no login-item registration; remote service installation is an explicit operation, not part of this target. |
| Relay, Tailscale and sleep inhibition | Relay supervisor and startup TLS provisioning are skipped; sleep inhibition is a no-op. No remote configuration is copied. |
| Daily window-state repair | Skipped: the legacy repair scans daily config paths, not the test namespace. |
| WebView identity | com.tuic.commander.agent-test, titled TUICommander Agent Test, separate from the daily Tauri identity. |
| Stop ownership | PID is informational. The stop target writes to the instance’s FIFO; only the live supervisor signals its own Popen child. It never kills a PID read from disk. |
The launch plan prints the exact binary, config directory, environment, socket,
PID file and stop FIFO. A crash releases the advisory supervisor lock; the next
start replaces stale runtime markers. Do not use pkill, killall, or the daily
app’s Quit/Restart action to stop a test.
Desktop live proof is separate from a dry run or unit test. An authorized operator must checksum the running daily binary and app bundle before and after, start agent-test alongside it, verify both listeners without mutating the daily API, and stop only agent-test. Until that proof is recorded, do not claim macOS TCC, simultaneous listeners or global-input isolation have been verified live.
Development backend restart warning
tauri dev --no-watch keeps the Rust process running while Vite reloads the UI.
A short, dismissible warning appears when a Cargo-recorded input is newer than
its executable, or the backend executable was rebuilt after application entry.
It shows compact backend/tree identifiers (source SHA plus timestamp token) and
Restart tauri dev. Restart only when you are ready to end the backend session.
Missing executable or dep-info files, or an older backend without launch identity,
show Backend identity unavailable instead of a silent match.
Vite reads Cargo’s final <binary>.d, which covers local path crates and embedded
assets even outside src-tauri/. It also checks local package manifests found
through dependency ancestors and the workspace Cargo.lock. There are no source
extension allowlists or fixture-directory exclusions. The debug bridge built and
used by make dev has its own executable/dep-info check, against its own build
time. Unrelated frontend, test-only module and documentation edits stay quiet;
frontend assets embedded by Rust are backend inputs and do warn.
This uses Cargo-style mtimes, not content fingerprints: an edit followed by a
revert still asks for a restart. Vite checks on load and after HMR, without polling,
compiling or restarting the backend. The macOS copy runner passes
TUIC_DEV_BUILD_EXE so checks follow the original Cargo artifact rather than its
protected launch copy. A rebuilt original bridge also requires restart when the
runner still holds its older protected sibling copy. Without that binding, the running executable needs its
own sibling .d. Vite does not guess an mbx target directory. Source archives
with build artifacts can work without Git (the SHA is diagnostic only). Release
builds do not expose launch identity or include the warning module.
A local IPC failure such as Command select_ai_chat_conversation not found also
reports a Backend/frontend version mismatch in development. Restart make dev
(or pnpm tauri dev) when you are ready to end the backend session. A frontend
reload or Retry cannot add a missing command to the running binary. AI Chat hides
Retry for this failure. This does not change release or remote-owner errors.
Browser Mode
When the MCP server is enabled in settings, the frontend can run standalone:
pnpm dev
Connects to the Rust HTTP server via WebSocket/REST.
Note:
pnpm devrunsscripts/dev-server.mjs, notvitedirectly. The dev server is pinned to port 1421 (Tauri’sdevUrl), so the launcher checks the port first: if this checkout is already serving there it printsreusing itand exits 0 — the second Tauri app attaches to the running server. Starting a second Vite would wipe the sharednode_modules/.vite/depscache and kill hot reload for the session already running. If the port is held by another checkout or a stray process, the launcher fails with an explicit message instead of serving the wrong sources.
Build
When using mbx, src-tauri/build.rs emits MBX_SHARE_OUT_DIR=0 for the
tuicommander crate only, because Tauri’s generate_context! writes assets into
OUT_DIR during macro expansion and the shared OUT_DIR of mbx is read-only.
Do not move this setting to a workspace .mbx.toml: there it also gives every
dependency with a build script a checkout-specific OUT_DIR, and each worktree
then misses the cache for those crates and all crates that depend on them.
pnpm tauri build
Produces platform-specific installers:
- macOS:
.dmgand.app - Windows:
.nsis(.exesetup installer) - Linux:
.deband.AppImage
Note: The
.msibundle may fail on Windows due to WiX tooling issues. Use--bundles nsisto produce a working.exeinstaller:cargo tauri build --bundles nsis
Testing
Test scratch comes from your temp directory, never from $HOME:
| Root | Resolution (first match wins) |
|---|---|
| host temp | TUIC_TEST_HOST_TMPDIR (exported by every entry point before it repoints TMPDIR, so a default never nests) → $TMPDIR → the OS temp dir |
| base | TUIC_TEST_TMP_BASE (opt-in) → <host temp>/tuic-tests |
| root | an inherited TUIC_TEST_TMP_ROOT, used as is and never deleted → scripts/with-test-tmp.sh: a fresh <base>/tuic-run.XXXXXX, removed on exit; nextest without the wrapper, a bare test binary and the shell tests: the per-checkout <base>/tuic-co-<checkout hash> |
| Unix sockets | TUIC_TEST_SOCKET_ROOT → a private, random <host temp>/t.XXXXXX per test process (mode 0700, removed when the process exits) → fail; never /tmp |
scripts/with-test-tmp.sh, src-tauri/scripts/nextest-test-tmp.{sh,ps1},
scripts/mutants.sh and the shell tests (all through scripts/test-tmp-lib.sh),
tuic-test-support and scripts/test-tmp-root.mjs (vitest, cycle checker) all
apply that order. The checkout hash is FNV-1a 64 of the checkout’s physical path,
the same in every one, so parallel worktrees never share a default root.
Two opt-ins of scripts/with-test-tmp.sh change what a wrapped command sees
beyond its temp dirs:
| Variable | Effect | Set by |
|---|---|---|
TUIC_TEST_FAKE_HOME=1 | HOME=<root>/home for the command. CARGO_HOME/RUSTUP_HOME are pinned to the real home first (from the passwd entry when HOME is unset), so cargo keeps its registry and toolchains. The nextest setup script applies the same flag to the test processes only, so TUIC_TEST_FAKE_HOME=1 cargo nextest run works without the wrapper too. On Windows the setup script sets HOME alone (the dirs crate reads Known Folders there) | make check’s and make cov’s Rust test steps, scripts/mutants.sh, CI’s Linux/macOS Rust test steps |
TUIC_TEST_ISOLATE_GIT_CONFIG=1 | git reads <root>/gitconfig (the same content as tuic-test-support’s TEST_GITCONFIG) and no system config, instead of yours. Not the default: pnpm audit, cargo audit and the submodule checks need your credential helper, url.*.insteadOf and proxy settings | make test-shell |
On macOS with sccache on PATH the wrapper also exports CC=cc CXX=c++ (unless
you set them), so meson does not wrap its compiler with sccache, whose socket
would not fit sun_path under the long per-run TMPDIR. Nowhere else: CC is
part of the native build fingerprint.
On macOS the wrapper also exports AR as the real toolchain ar (what xcrun --find ar
prints), unless you set it. /usr/bin/ar is a shim that runs xcrun; where xcrun cannot
write its lookup cache (the agent sandbox) a cache miss prints couldn't create cache file
before the usage text, and meson accepts Apple’s ar only when stderr starts with
usage — so the bundled WebRTC build (tuic-dictation) fails with Unknown linker(s): ar
whenever the environment is one xcrun has not cached. Which environments are cached
changes over time, so this does not depend on the cache. (A separate, intermittent sandbox
failure: the proxy sometimes truncates meson’s abseil download, which surfaces as
Incorrect hash for source; re-running the build succeeds.)
TUIC_TEST_TMP_BASE=<checkout>/.tmp/tuic-tests still puts scratch in the
checkout, but only as an explicit opt-in: it is unsafe wherever writes to the
checkout’s .git/hooks or .git/config are denied (observed in the agent
sandbox), and a fixture created inside the checkout can reach the real
repository through find_repo_root. Nothing defaults there any more.
Rust socket tests bind in tuic_test_support::socket_dir() (a fresh 4-character
directory in the socket root) or short_socket_path(name). Rust’s std binds at
most 103 bytes (104-byte sun_path minus the NUL), and the longest name a test
binds is 16 bytes (mcp-<7-digit pid>.sock), so the socket root may be at most 81
bytes and the host temp dir at most 72:
$TMPDIR | bytes | longest test socket | result |
|---|---|---|---|
macOS default (/var/folders/xx/…/T) | 49 | 80 | fits, 23 bytes spare |
| agent sandbox | 72 | 103 | fits, 0 bytes spare — for self-named sockets only (fixed-name ones go UNCHECKED, below) |
| long CI-like | 90 | 121 | fails with the budget message |
agent sandbox, short symlink (/tmp/srtmon.XXXXXXXX) | 20 | 51 | fits, 52 bytes spare |
The host temp dir can be spelled two ways for the same directory: the sandbox’s
real path (72 bytes) and a short symlink to it (20 bytes). Both hold every socket
this repo names itself, but only the short one holds mdkb’s own staging socket
(HOME/.mdkb/daemon-hook.sock.<pid>.tmp, a name the tests cannot shorten; it needs
a host temp dir of at most 54 bytes). In the long spelling that test (and any other
entry in tuic_test_support::FIXED_NAME_SOCKETS) would print UNCHECKED and pass
without running. tuic-test-support’s socket_environment test is the runtime
blocker for that: it fails, naming the sockets, the host temp dir and its length,
unless the run uses a shorter TMPDIR, sets TUIC_TEST_SOCKET_ROOT, or accepts
the gap with TUIC_ALLOW_UNCHECKED_SOCKET_TESTS=1. It also pins the outcome for
both layouts, so a change to the budget constants cannot move the line silently.
Add every new fixed-name socket test’s path to FIXED_NAME_SOCKETS.
Over budget, the panic names the host temp dir and its length, the would-be root
length, the 81/72-byte budgets and TUIC_TEST_SOCKET_ROOT=<short private dir>;
nothing falls back to /tmp. The root is created with mkdir (no symlink is
followed) at a random name, checked to be ours and 0700, and marked with
.tuic-socket-root. Three sockets have names the tests cannot shorten: the
named-instance tests (tuic-cli/tuic-bridge named_instance.rs) bind
tuic-mcp-<16 hex>[-<pid>].sock by a relative name with the working directory
in its dir (SocketSpelling, in_dir: process-wide, so it panics unless the
process runs one test at a time, under cargo nextest or RUST_TEST_THREADS=1);
remote_runtime’s named Local-identity test and mdkb’s contract test
(HOME/.mdkb/daemon-hook.sock.<pid>.tmp, mdkb’s own name) print UNCHECKED …
and return when the path cannot fit.
The wrapper prunes, after more than six days unused, only what this tooling
creates: tuic-run.* and the per-checkout tuic-co-* (and the older
tuic-proc-*/tuic-nextest-*) under the base, the old
<checkout>/.tmp/tuic-tests and an inherited root,
your own tuic-s<16 hex> socket directories in the host temp dir, and after a
day a t.XXXXXX socket root there that a killed test process left (only one that
is ours, not a symlink and carries .tuic-socket-root). Nothing in /tmp.
A prune it cannot complete prints a warning and never fails the command. Earlier
versions used ~/Gits/.tmp/tuic-tests, ~/Gits/.tmp/s<16 hex> and
<checkout>/.tmp/tuic-tests; nothing touches those any more, and you may delete
them by hand. make check runs scripts/check-no-home-gits.mjs, which fails on a
$HOME/Gits path in code or tooling. Run standalone Rust tests through the
wrapper.
Git inside tests
scripts/with-test-tmp.sh and the nextest setup script
(src-tauri/scripts/nextest-test-tmp.sh) give every test process two git settings,
and tuic-test-support’s constructor gives the same to a bare cargo test binary:
GIT_TEMPLATE_DIRis a template under the scratch root that holds an emptyhooks/directory and git’s one-lineinfo/exclude, sogit initandgit clonein a fixture copy nohooks/*.samplefiles (slower, machine-dependent, and an EPERM where writes to.git/hooksare denied) while.git/hooksand.git/info/excludestill exist.GIT_CEILING_DIRECTORIESholds the scratch root’s parent (lexical and physical spelling, appended to any value already set; the physical spelling of a symlinked or..-containing root is resolved by the OS), so git run under the root never discovers a repository above it. A fixture whosegit initfailed used to fall through to this checkout and rename or delete its branches.
Both apply to test processes only; production git calls never see them.
Two inherited settings are removed rather than honoured, so the suite never depends on
the developer’s shell: an exported GIT_TEMPLATE_DIR is replaced by the empty template,
and GIT_DIR, GIT_WORK_TREE, GIT_COMMON_DIR, GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY
(and GIT_ALTERNATE_OBJECT_DIRECTORIES, GIT_NAMESPACE, GIT_PREFIX) are cleared
(scripts/with-test-tmp.sh unsets them before its own git calls; test binaries clear them
in the tuic-test-support constructor). The ceiling never restricts an explicit GIT_DIR.
Nothing may be written, created or bound under a hard-coded /tmp, /var/tmp,
/private/tmp or /dev/shm: derive scratch from the caller’s temp dir
(std::env::temp_dir()/tempfile, os.tmpdir(), "${TMPDIR:-/tmp}", the test
roots above). make check runs scripts/check-no-hardcoded-tmp.mjs, which fails
on a write-shaped use of those literals in code or tooling (including the code
blocks of skill docs such as tests/terminal-stress/SKILL.md). Other mentions — a fixture string, a
classifier input — are allowed only through its file::fn allow-list (each entry
with a reason) or the shrink-only per-file counts in
scripts/hardcoded-tmp-baseline.json: a count may go down (lower the baseline in
the same change, node scripts/check-no-hardcoded-tmp.mjs --write-baseline) but
never up. New tests use a fake root that never exists rather than a /tmp/...
string.
Rust coverage uses make cov (cargo llvm-cov nextest). Nextest builds the ACP
and MCP fixture executables once for the library tests that launch them. Under
llvm-cov, setup uses the parent of LLVM_PROFILE_FILE as Cargo’s explicit
--target-dir, so those executables stay beside the instrumented tests rather
than in the ordinary build tree. This also supports custom coverage directories.
The fixture feature selection and test profile are unchanged.
Every Rust test binary that links tuic-test-support runs its git processes against a fixed hermetic gitconfig: GIT_CONFIG_GLOBAL points at it, GIT_CONFIG_NOSYSTEM=1 is set and inherited GIT_CONFIG_* variables are dropped. Your own merge.ff, url.*.insteadOf, rerere, signing or hooks-path settings therefore do not change test results.
When a named instance’s Unix socket path does not fit sun_path, the error names the path length, the 103-byte limit, the longest TMPDIR that would fit and TUIC_SOCKET; the bind is not retried.
Live peer-mail wake canary
After a Rust rebuild, run this against the isolated test instance, not the
orchestrator instance. The script starts a disposable managed peer through MCP
agent action=spawn, waits for its idle composer, sends mail from a separate
MCP identity, checks that PEER_MAIL_WAKE appears in the PTY within 20 seconds,
then closes the PTY and its MCP connections. It exits with an error if readiness,
delivery, or cleanup fails.
TUIC_APP_INSTANCE=peer-mail-canary make dev # in a separate terminal; use its reported HTTP port
TUIC_CANARY_URL=http://127.0.0.1:9877 python3 scripts/canary-peer-mail-wake.py claude
TUIC_CANARY_URL=http://127.0.0.1:9877 python3 scripts/canary-peer-mail-wake.py claude --capacity
--capacity sends 100 messages to the disposable agent, reads them through a
second MCP connection bound to that agent, then checks that the next send and
read succeed. Use codex instead of claude for the optional Codex check. The
agent CLI must already be installed and authenticated. Run the script only
after the test instance is listening on the URL you supply.
pnpm test # Run all tests
pnpm test:coverage # Coverage report
Test tiers:
- Tier 1: Pure functions (utils, type transformations)
- Tier 2: Store logic (state management)
- Tier 3: Component rendering
- Tier 4: Integration (hooks + stores)
Framework: Vitest + SolidJS Testing Library + happy-dom
Coverage: ~80%+
Chat browser landing gate (macOS)
Run make check-chat-readability at landing when Chat prose or answer-list CSS
changes. This local gate starts an isolated fixture Vite on an OS-assigned port,
runs the computed-colour, border and list-geometry regressions, then closes Vite
in a cleanup trap. It does not start Tauri or use a running app. The browser
harness closes its own named tab and does not close shared Chrome.
Prerequisites: installed frontend dependencies, agent-browser, matching Chrome
for Testing, and the approved ab-stealth.sh wrapper: TUIC_BROWSER_WRAPPER
names it, else the first ab-stealth.sh on PATH (scripts/browser-wrapper.mjs;
the other live browser harnesses resolve it the same way). Set
TUIC_CHAT_BROWSER_WRAPPER to override the wrapper path for this gate only. Evidence defaults to a
new .tmp/chat-readability-* directory in the checkout; set
TUIC_CHAT_EVIDENCE_DIR to retain it elsewhere. Managed agents run this target
through the shared build slot.
The frontend CI job runs on Ubuntu and cannot use this macOS .app/open wrapper.
This is a separate required local landing gate, not part of make check or the
ordinary Vitest run. The direct test retains its explicit opt-in skip when
TUIC_CHAT_BROWSER_URL is absent; the make target always supplies the URL and
evidence directory, so it runs both regressions without skips.
Rust build features
Plain application Cargo builds enable desktop but omit native speech. Add
--features dictation for Whisper/WebRTC and the voice adapters. Tauri dev and
release builds read build.features = ["dictation"] from tauri.conf.json, so
make dev and make build retain voice support. Desktop CI tests that feature;
headless daemon checks use --no-default-features. Workspace tests also select
the tuic-dictation crate explicitly, and therefore compile its native stack.
TLS uses the existing ring provider. Provider-free reqwest/axum-server features avoid compiling AWS-LC while retaining HTTPS and WSS.
Desktop frontend embedding gate
The desktop binary constructs the Tauri context and passes it to the library.
Library unit tests do not expand generate_context! or embed the ignored Vite
bundle. HTTP static-file tests use checked-in transport fixtures, including the
desktop and mobile HTML shells, instead of a worktree-specific dist/.
Run make check-desktop-embedding after pnpm build to compile the real desktop
entry point with tauri/custom-protocol. This gate fails if the frontend bundle
is missing. It does not launch or restart the application. make check and
desktop CI run this separate gate, so unit-test isolation does not hide desktop
startup or embedding errors. CI uses minimal HTML stubs; the release build still
embeds the real frontend bundle.
Rust tests in linked worktrees
Run standalone Rust tests through scripts/with-test-tmp.sh. In a linked
worktree, the wrapper clears an inherited CARGO_TARGET_DIR, so Cargo selects
that checkout’s artifacts instead of a target supplied by the parent
TUICommander process. The worktrees’ tuic-terminal builds have the same Cargo
fingerprint key, while Cargo checks path sources by file mtime;
sharing one target can therefore make an older checkout look fresh against an
artifact from another checkout. The wrapper also gives each run its own scratch
directory under $TMPDIR/tuic-tests (see Testing above).
TypeScript mutation testing
Run Stryker on the changed source files and their relevant Vitest files. Keep both lists narrow; a mutation run executes the selected tests for each mutant.
node scripts/ts-mutants.mjs \
'src/utils/pathUtils.ts:65-65' -- \
'src/__tests__/utils/pathUtils.test.ts'
List the changed source files or line ranges before --, and the tests that
exercise them after it. Read
reports/mutation/mutation.json and the console verdicts. A known behavior
change, such as inverting the pathBasename condition above, must be reported
Killed before treating the other verdicts as evidence. Install this checkout’s
dependencies with pnpm install --offline --frozen-lockfile when its local
node_modules/.bin/stryker is missing; linked worktrees do not share the main
checkout’s executables. The checked-in Stryker config copies frontend inputs,
Rust .rs files under src-tauri/src/, the terminal-grid source, and the generated
command_table_paths.txt into its sandbox. It also copies JSON assets under
src-tauri/{src,crates,fixtures,tests}/ by extension, including shared settings,
intent markers, themes, and test fixtures imported by frontend modules. Recorded
ACP JSONL fixtures under src-tauri/tests/fixtures/acp/ are also included for
frontend consumers. These rules exclude unrelated generated files and vendored
terminal reference grids. Add any
new asset types or files read directly by a Vitest test to that copy policy. It leaves the worktree source untouched and runs
Vitest as a separate command for each mutant. Stryker 10’s
Vitest runner reports false survivors with this repo’s Vitest 5, so it is not
used. Stryker’s TypeScript preprocessor is pointed at an absent file because
this repo’s TypeScript 7 does not expose the compiler API it calls; Vitest still
transforms and runs the TypeScript tests.
Project Structure
See Architecture Overview for full directory structure.
Key Files
| File | Purpose |
|---|---|
src/App.tsx | Central orchestrator |
src-tauri/src/lib.rs | Rust app setup, command registration |
src-tauri/src/pty.rs | PTY session management |
src/hooks/useAppInit.ts | App initialization |
src/stores/terminals.ts | Terminal state |
src/stores/repositories.ts | Repository state |
SPEC.md | Feature specification |
ideas/index.md | Feature concepts under evaluation |
Configuration
App config stored in platform config directory:
- macOS:
~/Library/Application Support/tuicommander/ - Linux:
~/.config/tuicommander/ - Windows:
%APPDATA%/tuicommander/
See Configuration docs for all config files.
Makefile Targets
make dev # Tauri dev mode
make build # Production build (skips updater artifact signing when TAURI_SIGNING_PRIVATE_KEY is unset)
make test # Run tests
make lint # Run linter
make docs # Build this documentation + search index into docs/book
make docs-serve # …and serve it at http://127.0.0.1:8123
make clean # Clean build artifacts
Documentation Site
The book you are reading is mdBook, built
by scripts/build-docs.sh and deployed to GitHub Pages by
.github/workflows/website.yml. The script is the single source of truth — CI
runs the same one, so a local build matches the deployed site.
make docs-serve # build + serve; open http://127.0.0.1:8123
Requires mdbook (brew install mdbook or cargo install mdbook) and npx.
Search is Pagefind, generated after the mdBook build,
which is why file:// previews have no search — the index is fetched over HTTP.
mdBook’s own elasticlunr search is disabled in book.toml.
Adding a page means adding it to SUMMARY.md: mdBook only renders — and
Pagefind only indexes — chapters listed there.
Windows Prerequisites
Building on Windows requires a few extra tools beyond the standard prerequisites. Install them in this order.
1. Visual Studio Build Tools (C++ compiler)
Download and install Visual Studio Build Tools and select the “Desktop development with C++” workload. VS Build Tools 2019 or later is fine.
Or via winget:
winget install Microsoft.VisualStudio.2022.BuildTools
2. Rust
winget install Rustlang.Rustup
Restart your terminal after installation, then verify:
rustc --version
cargo --version
3. Node.js
winget install OpenJS.NodeJS.LTS
4. CMake
Required to compile whisper-rs (the on-device dictation library).
winget install Kitware.CMake
5. LLVM 18 (libclang — required for whisper-rs bindings)
whisper-rs uses bindgen to generate Rust bindings for whisper.cpp, which requires libclang. Use LLVM 18 — LLVM 19+ produces broken bindings for this crate on Windows.
Download the LLVM 18 installer from GitHub releases (LLVM-18.1.8-win64.exe) and install it. Then set the environment variable so bindgen can find it:
# Add to your PowerShell profile or set permanently in System Environment Variables
$env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin"
If you have LLVM 22+ installed (e.g. from winget), install LLVM 18 to a separate directory and point
LIBCLANG_PATHthere instead.
6. Tauri CLI
cargo install tauri-cli --version "^2"
Full Windows Build Command
Always set LIBCLANG_PATH before building:
$env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin" # adjust path if LLVM 18 is elsewhere
cargo tauri build --bundles nsis
The installer will be at:
src-tauri\target\release\bundle\nsis\TUICommander_0.x.x_x64-setup.exe
Windows Known Issues
| Symptom | Cause | Fix |
|---|---|---|
whisper-rs-sys build fails with “couldn’t find libclang” | LLVM not installed or LIBCLANG_PATH not set | Install LLVM 18 and set LIBCLANG_PATH |
whisper-rs-sys compile error: attempt to compute 1_usize - 296_usize | LLVM 19+ generates broken bindings for this crate | Use LLVM 18 specifically |
WiX .msi bundle fails | WiX light.exe tooling issue | Use --bundles nsis instead |
| App window opens but shows a black screen | Navigation guard in lib.rs blocked http://tauri.localhost/ (Windows’ internal Tauri URL) | Fixed in current code — tauri.localhost is explicitly allowed |
Update check failed: windows-x86_64-nsis not found | Custom local build isn’t listed in official release manifest | Harmless — auto-update simply won’t trigger |
Updater diagnostics and fixture binaries
Product builds leave Cargo’s test-fixtures feature disabled. The ACP and MCP
fixture executables are never product sidecars. Nextest’s fixture setup enables
this feature for the library consumers and the main integration-test binary;
plain Cargo integration runs must use --features test-fixtures.
On macOS, verify release binary selection without compiling the app:
PYTHON=python3 scripts/with-test-tmp.sh node --test scripts/test-release-fixture-binaries.mjs
(Python 3.11+ and the installed Tauri CLI are required). This probes the real
bundler against the manifest declarations, with stale fixture executables present.
The checked updater resource is installed by TUIC’s host-only install_app_update
command. It downloads and verifies through the plugin, checks the macOS extraction
volume, and uses the plugin’s native installer. It preserves nested IO causes in
the returned error. A resource id and progress Channel belong to the calling
WebView, so HTTP clients cannot use this command to replace the host application.
The macOS preflight sums archive entries rounded to the volume’s allocation unit and adds 1 MiB of metadata headroom. Download bytes stay in memory; extraction and backup use the same volume and renames. The check reports required and available bytes; concurrent disk use can still cause a later install failure, whose cause is retained. Relaunch deferral remains owned by the existing updater store.
Reusing a pinned agent-test build
For workflow restart evidence, pass AGENT_TEST_REUSE_BUILD_SHA256=<full-sha256>
to make agent-test with the same named instance and port. It verifies the exact
existing binary and all three regular executable artifacts before launch; no
rebuild or copy occurs. Capture the digest from the original build and health
response. Worktree and process isolation still apply. Use the normal build path
after application-source changes.
Heap diagnostic preset
Set AGENT_TEST_HEAP_PROFILE=1 with a named isolated make agent-test instance to compile the opt-in whole-backend allocator profiler. Set _RJEM_MALLOC_CONF before launch; use the shared diagnostic HTTP endpoints to verify activation. Preserve the exact executable and symbols before rebuilding. See Heap profiling.