Infrastructure layer
Lives in core/src/main/kotlin/dev/taxilane/infrastructure, except AwtClipboardWriter, which needs the desktop toolkit and stays in desktopApp under the same package. Implements the ports defined in the domain.
ProcessBuilderShellCommandExecutor
Section titled “ProcessBuilderShellCommandExecutor”Implementation of ShellCommandExecutor on top of ProcessBuilder. Robustness details:
- Reads stdout and stderr concurrently (two
asyncs). If read sequentially, a process that fills the buffer of the unread stream would block (the classicProcessBuilderdeadlock). - Never waits for input: standard input comes from the null device (
/dev/null,NULon Windows), so a command that asks a question gets end of input instead of hanging. Git commands also getGIT_TERMINAL_PROMPT=0, so missing credentials fail at once. waitFor()is wrapped inrunInterruptibleso that coroutine cancellation interrupts waiting for the process; every method wraps it inwithTimeoutOrNullwith its limit and throwsCommandExecutionException.TimedOutwhen the limit passes.- Blocking work is confined to
Dispatchers.IO(injectable via constructor for tests). - In the
finallyblock, a process that is still alive (cancelled or timed out) is killed withdestroyForcibly()together with its descendants, so no orphan processes are left and the stream readers are released. - Git in English: Git commands run with
LC_ALL=C(GitLocale), so the error classification can match Git’s messages. - Long paths on Windows: on Windows every Git command runs as
git -c core.longpaths=true …(GitLongPaths), so Git can create, read and delete files whose full path is longer than 260 characters, such as deep build outputs. TheCommandResultkeeps the command as the caller built it, and the user’s Git configuration isn’t touched. - The host
PATH: apps launched from the macOS Finder/Dock don’t inherit the shell’sPATH, so a child would miss tools in the user’s folders (Herdr findingtaxilane, Git findinggit-lfs). The executor takes thePATHfolders of theHostEnvironment(path) and sets every child’sPATHto them before applying the command’s explicit variables, so an explicitPATHstill wins. Built withpath = null, children inherit the processPATHunchanged; onlySystemHostEnvironmentuses that, to run the login shell. - Arguments intact on Windows: the JDK joins argv into one command line and wraps arguments with spaces in quotes without escaping the quotes they contain, so a value like
GRADLE_OPTS=-Dx="a b" -Dy=1would reach the program split in several. On WindowsWindowsArgumentsquotes each argument following theCommandLineToArgvWrules (embedded quotes escaped, backslashes before quotes and at the end doubled) before the JDK sees it; the JDK leaves an argument that is already quoted alone. The executable itself and commands whose executable is a.cmdor.batfile are left unchanged, becausecmd.exedoesn’t treat\"as an escape.LocalAndroidSdkuses the same function to start the emulator. - If the process can’t start at all, the
IOExceptionis wrapped inCommandExecutionException.
NioFileManager
Section titled “NioFileManager”Implementation of FileManager on top of java.nio.file. isInside resolves the root with toRealPath() and walks up from the path to its nearest existing ancestor (without following a final symlink), resolves that one too, and requires the root as a prefix. createSymbolicLink deletes whatever is at the link and creates the symlink, mapping UnsupportedOperationException and a file system refusal to SymbolicLinksNotSupported; isSymbolicLinkTo checks Files.isSymbolicLink and Files.isSameFile; hasSameContent uses Files.mismatch. copy creates the destination’s missing parent folders and uses REPLACE_EXISTING and COPY_ATTRIBUTES. directorySize walks the tree with Files.walkFileTree without following symlinks, adds up regular file sizes, skips the excluded folders and ignores files it can’t read. modificationStamps walks the same way and records each entry’s last-modified time. readProperties loads the file with java.util.Properties. writeText creates the missing parent folders and writes atomically (temporary file in the same folder, then ATOMIC_MOVE); readText returns null for anything that isn’t a readable regular file; isDirectory wraps Files.isDirectory. Works the same on every supported OS. deleteRecursively deletes read-only files too (Git writes its objects read-only) and, when a pass fails with a file system error, waits 200 ms and tries again, up to ten times, before throwing that error: on Windows a folder can’t be deleted while a process that is finishing, such as a Git read started by the app’s refresh, still has it as its working directory.
NioEnvironmentStateStore / SocketPortProbe
Section titled “NioEnvironmentStateStore / SocketPortProbe”- State: each worktree’s reservations live in
taxilane-env.jsoninside its Git administrative directory, as{ "ports": { "PORT": 20001, "port:api": 20002 }, "resources": { "ios-simulator": "<UDID>" } }; files withoutresourcesload as before. Git ignores files it doesn’t know there and deletes the whole directory ongit worktree removeandprune, so reservations go away with the worktree, whoever created it. Other fields of the object are kept for later providers; a file left without fields is deleted; an unreadable file counts as no reservations. Writes are atomic (temporary file and move). - Machine listing: the current repository’s files (the common directory’s, for the main worktree, plus every
worktrees/*/taxilane-env.json) and every administrative directory in the machine index~/.taxilane/reservations.json({ "worktrees": [ … ] }). Writing a worktree’s ports adds its directory to the index, or removes it when it has none left; listing drops index entries whose state file is gone (the worktree was removed or pruned), so the index heals itself and ports of removed worktrees in any repository become free. - Lock:
withLocktakes an exclusiveFileChannellock on~/.taxilane/reservations.lock, so parallel creations, even from several processes (several Claude Code sessions) and different repositories, can’t reserve the same port. A process-wide lock guards the file lock, and a nested call on the same thread runs directly. Acquiring an emulator or simulator holds it only to decide and write reservations: devices are listed before taking it, and released devices are stopped or deleted and a new simulator is created after releasing it. - Waiting queue:
NioDeviceWaitQueuekeeps the worktrees waiting for an emulator or simulator in~/.taxilane/device-queue.json({ "queues": { "emulator": [ … ], "ios-simulator": [ … ], "desktop": [ … ], "build": [ … ] } }), each ticket with its worktree, process id and start time and when it started waiting. It is read and written only insidewithLock, so being first and taking capacity are one decision; a missing or unreadable file is an empty queue.NioDesktopTurnStorekeeps the desktop turn’s holder in~/.taxilane/desktop-turn.json, written atomically and deleted when nobody holds it; a missing or corrupt file means a free desktop.NioBuildTurnStorekeeps the running builds in~/.taxilane/build-turns.jsonthe same way, deleted when none runs; a missing or unreadable file means no build runs.ProcessBuilderForegroundCommandRunnerruns a build’s command with the terminal’s input and output, returns its exit code (nullwhen it can’t start) and stops it when the run is cancelled.ProcessHandleLivenesssays whether a ticket’s process still runs, comparing its start time so a reused process id doesn’t keep a dead waiter in line. - Free port:
SocketPortProbebinds aServerSocketwithreuseAddress = falseon the wildcard address and on the loopback address; the port is free only if both succeed.
SimctlAppleSimulators / FileKmpTestWiring
Section titled “SimctlAppleSimulators / FileKmpTestWiring”- Simulators:
xcrun simctl list -j runtimes(available runtimes with theirsupportedDeviceTypes) andlist -j devices(Booted,Shutdown, anything else counts as booting),create <name> <device type> <runtime>(prints the UDID),boot,shutdown,delete, all through the command executor.showrunsopen -b com.apple.iphonesimulator --args -CurrentDeviceUDID <udid>and, if the Simulator app isn’t installed (Xcode 27 replaced it with Device Hub),open -b com.apple.dt.Devices, so the device gets a window;simctl bootalone boots it headless. “Unable to boot/shutdown device in current state: Booted/Shutdown” counts as success.isSupported()is true only on macOS. - KMP wiring: the repository’s
*.gradle.ktsand*.gradlefiles, up to five levels deep and skippingbuild,.gradle,.git,.kotlin,.ideaandnode_modules, are searched forIOS_SIMULATOR_UDID, and, with the same walk, formultiplatform(ignoring case) to tell a Kotlin Multiplatform repository, which coverskotlin("multiplatform"), the plugin id and version catalog aliases such aslibs.plugins.kotlinMultiplatform. The init script is$GRADLE_USER_HOME/init.d/taxilane-ios-simulator.init.gradle.kts, in Kotlin DSL because Groovy scripts fail to compile on recent JDKs; since the Kotlin plugin isn’t on its classpath it matchesKotlinNativeSimulatorTesttasks by class name and setsdevicethrough reflection, and it does nothing whenIOS_SIMULATOR_UDIDisn’t set. Uninstalling it also removesinit.dif it’s left empty.REPOSITORY_SNIPPETis the Kotlin DSL fragment shown to users.
LocalAndroidSdk
Section titled “LocalAndroidSdk”Implementation of AndroidSdk on the SDK’s own tools:
- Locating: the first of
ANDROID_HOME,ANDROID_SDK_ROOT,sdk.dirin the repository’slocal.properties, and the platform default (~/Library/Android/sdk,~/Android/Sdk,%LOCALAPPDATA%\Android\Sdk) that containsemulator/emulator; executables get.exeon Windows. - AVDs:
emulator -list-avds, skipping the emulator’s informational lines. - States: one
adb devices, keepingemulator-*serials; anofflineone is booting, adeviceone is running onceadb -s <serial> shell getprop sys.boot_completedreturns1, and unresponsive when that query doesn’t answer within 5 seconds (CommandTimeouts.DEVICE_PROBE). The queries of different emulators run concurrently, so hung emulators delay a read by one limit at most, and a read for some serials only queries those. Serials whose boot was seen completed are remembered and not queried again while they stay listed asdevice; a serial that leaves the list or is stopped is forgotten. Stopping runsadb -s <serial> emu kill; when it doesn’t finish in time the stop fails withEmulatorDidNotExit. - Start:
emulator -avd <avd> -port <port> -read-only -no-boot-anim [-no-window]throughProcessBuilder, not the command executor, because it must keep running after the caller (the CLI) exits; output goes to~/.taxilane/logs/emulator-<port>.log.-read-onlyis what lets one AVD run once per worktree; changes to the emulator’s data are discarded when it exits. It returns anEmulatorProcessover the started process and its log. - Stop:
adb -s <serial> emu kill.
SharedDeviceStatesAndroidSdk
Section titled “SharedDeviceStatesAndroidSdk”An AndroidSdk decorator the desktop app wraps around its single LocalAndroidSdk; the CLI uses LocalAndroidSdk directly. It delegates everything except deviceStates, which it serves from one shared read per adb path: a caller that arrives while a read runs waits for it (a Mutex), and one that arrives less than 2 seconds after the last read gets that result. Every project checked in the same cycle, the machine view and the boot wait thus share one adb devices. stopEmulator drops the cached result, so the next read after a stop is fresh. The clock is injected for tests.
AdbPhysicalDevices / DevicectlPhysicalDevices
Section titled “AdbPhysicalDevices / DevicectlPhysicalDevices”AdbPhysicalDevices lists physical Android devices on top of the AndroidSdk port: attachedDevices (adb devices -l, read once and shared with the emulator states by SharedDeviceStatesAndroidSdk), skipping emulator-* serials, and deviceProperties (one adb -s <serial> shell getprop, within 5 seconds) for each new transport, read concurrently and cached while that transport stays listed; a transport whose properties don’t answer in time is pending as UNRESPONSIVE and asked again on the next listing. A transport whose ro.kernel.qemu is 1 is an emulator reached over TCP and is skipped; one that isn’t device yet, or whose ro.serialno can’t be read, is pending. A serial with : or ._adb-tls-connect. is a network connection. The marketing name is ro.product.marketname, then Samsung’s ro.config.marketing_name, then the model. No SDK lists nothing.
DevicectlPhysicalDevices runs xcrun devicectl list devices --json-output <temp file> on macOS only (it takes osName), reads the temporary file and deletes it. It keeps the entries whose reality is physical and that have a transport and a tunnel state other than unavailable, reading the deprecated hardwareProperties, deviceProperties and connectionProperties first and the properties dictionary that replaces them otherwise. A device that isn’t paired is UNPAIRED, one whose developer mode isn’t enabled (or isn’t reported) is DEVELOPER_MODE_OFF. Fixtures captured from a real device pin the format.
NioPhysicalDeviceInventoryStore / NioPhysicalDeviceLeaseStore
Section titled “NioPhysicalDeviceInventoryStore / NioPhysicalDeviceLeaseStore”The inventory lives in ~/.taxilane/devices.json ({ "devices": [...] }) and the leases and losses in ~/.taxilane/device-leases.json ({ "leases": [...], "losses": [...] }, deleted when both are empty), written atomically through a temporary file and read as empty when missing or corrupt; entries with an unknown platform are skipped. Both are read and written under the environment state store’s lock, together with device-queue.json, whose tickets gain an optional request that older versions ignore.
HerdrConfigFile
Section titled “HerdrConfigFile”Implementation of HerdrConfigSource. It reads Herdr’s config.toml from the same place Herdr does: HERDR_CONFIG_PATH, else $XDG_CONFIG_HOME/herdr/, else %APPDATA%\herdr\ on Windows, else ~/.config/herdr/. A small line reader takes the directory key of the [worktrees] table (basic or literal string, trailing comments allowed) and expands a leading ~; it’s not a full TOML parser, since that’s the only key Taxilane needs. A missing, unreadable or unparseable file, or no such key, gives Herdr’s default, ~/.herdr/worktrees.
CliHerdrClient
Section titled “CliHerdrClient”Implementation of HerdrClient on the herdr command, through ShellCommandExecutor with argument lists: worktree open --cwd <repository> --path <worktree> --label … --focus, pane split <pane> --direction right --cwd … --env NAME=value… --focus, pane close <pane>, pane run <pane> <command>, worktree list --cwd <repository> (path and open_workspace_id of each entry under result.worktrees, skipping those Herdr doesn’t have open), workspace close <workspace>, agent list (each entry’s agent, agent_status, foreground_cwd or else cwd, and pane_id; idle, working, blocked and done map to AgentState and anything else to no state) and agent focus <pane>. It reads only the fields it needs from Herdr’s JSON (result.workspace.workspace_id, result.root_pane.pane_id, result.already_open, result.pane.pane_id), so other fields can change. The binary is found by the findExecutable it’s given, ExecutableLocator::find over the host environment at both composition roots (the host PATH, then /opt/homebrew/bin, /usr/local/bin, ~/.local/bin and ~/.cargo/bin, where Homebrew, Herdr’s install script and cargo install put it), else herdr by name (herdr.exe on Windows). A command that can’t start is HerdrNotInstalled; a non-zero exit or an error object is HerdrCommandFailed with Herdr’s error.message, taken from the JSON on standard output or standard error (where Herdr writes its errors), or the raw standard error when it isn’t JSON. Herdr doesn’t start a server for these commands, so with none running the message asks to run herdr.
CliOrcaClient
Section titled “CliOrcaClient”Implementation of OrcaClient on Orca’s command line, through ShellCommandExecutor with argument lists, each with --json: status (result.runtime.reachable and appVersion; a reachable Orca older than 1.4.243 is OrcaCommandFailed naming the minimum version), open (30-second limit; a timeout or a failure is OrcaNotStarted; bringToFront runs it too, since it focuses a running Orca), repo list, repo add --path <repository>, repo set --repo id:<id> --external-worktree-visibility show, worktree list --repo id:<id> --limit 1000, worktree set --worktree path:<worktree> with only the given --comment, --workspace-status, --pr and --issue, worktree ps --limit 1000 (each row’s path, its comment, workspaceStatus, linkedIssue and linkedPR, a number in worktree list and an object with a number in worktree ps, whether it has a non-null creatorProvenance, the only field that tells Orca’s worktrees from external ones, its agents[] with agentType, state and an AgentActivity from toolName and toolInput (only while waiting, since a done agent keeps its last tool), prompt and lastAssistantMessage, blank strings counting as missing and, for a row whose workspaceKind is folder-workspace, the folder id from its worktreeId folder:<id>; any other kind is read as a worktree with a path), ports --all (the rows with kind workspace and an owner.path, with port, processName and advertisedUrl; other listeners are dropped), terminal list --worktree <selector>, terminal show --terminal <handle> (its agentIdentity), terminal create --worktree <selector> --title … --command … --focus, terminal switch --terminal <handle>, terminal close --worktree path:<worktree> --all and emulator attach <serial> --worktree <selector> --focus (a subcommand orca --help doesn’t list; without --focus Orca opens no emulator tab), where the selector is path:<worktree> or id:folder:<id>. A folder workspace’s terminals are closed one by one with terminal close --terminal <handle>, since Orca 1.4.243 doesn’t resolve id:folder:<id> for --all, and its terminal list reports an empty worktreePath. Responses are { id, ok, result | error }; it reads only the fields it needs, and ok: false, an error object or a non-zero exit is OrcaCommandFailed with error.message. The binary is found by the findExecutable it’s given, ExecutableLocator::find over the host environment at both composition roots (the host PATH then the usual install folders, with Windows’ extensions), else, on macOS, /Applications/Orca.app/Contents/Resources/bin/orca; on Linux the name is orca-ide everywhere, since orca is usually GNOME’s screen reader. A missing binary is OrcaNotInstalled, and isInstalled() checks it without running anything. Every flag it uses is accepted by Orca 1.4.243, and CliOrcaClientTest runs against JSON recorded from it in core/src/test/resources/orca/.
JsonOrcaWorkspaceStore
Section titled “JsonOrcaWorkspaceStore”Implementation of OrcaWorkspaceStore in ~/.taxilane/orca.json, written atomically under a LocalFileLock and only when the folder, the remembered board statuses or the times of the last GitHub lookups change; they live in the same file, so one class reads and writes them. Board statuses and lookup times are merged into what the file holds under the lock, so syncs running at once in several processes keep each other’s. An unreadable file remembers nothing.
CliGitHubClient
Section titled “CliGitHubClient”Implementation of GitHubClient on the GitHub CLI, found with ExecutableLocator: gh pr list --head <branch> --state all --limit 1 --json number and gh issue view <n> --json number, run in the worktree with a 10-second limit. A missing gh, a non-zero exit (not signed in, not a GitHub repository), a timeout or unexpected output means no result.
FileAgentSessionStore
Section titled “FileAgentSessionStore”Implementation of AgentSessionStore: one JSON file per session, <git-dir>/taxilane/agent-sessions/<session id>.json, where <git-dir> is the worktree’s own Git directory: .git in the main worktree, or the directory the gitdir: line of a linked worktree’s .git file points to. Git ignores unknown files there, the folder goes away with git worktree remove and nothing is copied to new worktrees. A write goes to a temporary file that is then moved over the target atomically, so a reader never sees half a record. Records that can’t be parsed are skipped; a directory that isn’t a worktree is silently ignored, except a multirepo folder (one holding .taxilane-multirepo.json) that has no .git: its records go to ~/.taxilane/agent-sessions/<24 hex characters of the SHA-256 of the canonical folder>/, so the agent-state hook works there too and two folders never share records. Session ids are reduced to [A-Za-z0-9_.-] in the file name.
ProcessGradleDaemonSource
Section titled “ProcessGradleDaemonSource”Implementation of GradleDaemonSource that doesn’t depend on a Gradle binary or on Gradle’s internal registry format:
- Processes: runs
ps -A -ww -o pid=,rss=,command=and keeps the processes whose arguments containorg.gradle.launcher.daemon.bootstrap.GradleDaemon(the next argument is the Gradle version) ororg.jetbrains.kotlin.daemon.KotlinCompileDaemon.rssis converted from KiB to bytes. A failingps(e.g. on Windows) throwsProcessListingFailed. - State: each Gradle daemon writes
$GRADLE_USER_HOME/daemon/<version>/daemon-<pid>.out.log(GRADLE_USER_HOMEdefaults to~/.gradle). The last 1 MiB of that log is scanned backwards for the latestMarking the daemon as busy|idle(with its timestamp, forIdle(since); any other state counts as busy) and the latestReceived command: Build{…, currentDir=<path>}, which gives the last build directory: the directory the Gradle client was started from, so./gradlew -p <worktree>run from elsewhere is attributed to where it was run. Both lines are logged at INFO level on every build. A missing or unreadable log, or no marker in that window, givesUnknown, which never allows stopping. - Holding build: for a busy daemon, the latest
Starting executing command: Build{…, currentDir=<path>} with connection: socket connection from /127.0.0.1:<daemon port> to /127.0.0.1:<client port>of the same tail (logged at DEBUG, which the daemon’s log keeps) gives theHoldingBuild’s directory, start and the client’s port; without it, the latestReceived commandgives the directory and start alone. The client is then traced, each step optional:lsof -nP -iTCP:<client port> -sTCP:ESTABLISHED -Fpcnames the processes at either end of that loopback connection, and the one that isn’t the daemon is the client;ps -A -ww -o pid=,ppid=,command=, run at most once per listing, gives its command line, which must runorg.gradle.wrapper.GradleWrapperMainororg.gradle.launcher.GradleMain(the arguments after it are theGradleClient’s tasks), and its ancestors through the parent ids. A missing or failinglsof(Windows, sandboxed shells), a process table that can’t be read or a client that isn’t Gradle leaves the holding build without a client, and never fails the listing.ListGradleDaemonsUseCasethen matches the ancestors against the process ids of the recorded agent sessions (AgentSessionStore) of the worktrees it’s given, which the CLI takes from the current repository and every saved project, to add theAgentSessionRef; it only reads the sessions when some client has ancestors. - Gradle’s own
--statusand--stoparen’t used: they only see the daemons of the Gradle version that runs them, and--stopalso stops busy ones.
MacDerivedDataSource
Section titled “MacDerivedDataSource”Implementation of DerivedDataSource for macOS (isSupported checks os.name):
- Location:
defaults read com.apple.dt.Xcode <key>run as argv, firstIDEDerivedDataPathOverride, thenIDECustomDerivedDataLocation(keys confirmed in Xcode 27’sIDEFoundation; a leading~is expanded); a faileddefaults(key missing) falls back to~/Library/Developer/Xcode/DerivedData. A location that doesn’t exist has no folders. - Folders: every direct child with a regular
info.plistthat has aWorkspacePath, parsed with the JDK’s XML parser with external entities and DTDs off. A binary plist (bplist00) or an unreadable file is skipped, and so are Xcode’s shared caches, which have none.LastAccessedDategiveslastAccessed;folders()doesn’t measure them:size(folder)walks one folder onDispatchers.IOand stops as soon as its coroutine is cancelled, andpackagesSize(folder)walks itsSourcePackagesthe same way (zero when missing).folders()also runs onDispatchers.IO. - Compilation cache:
IDECustomCompilationCacheLocationwhen set, else<location>/CompilationCache.noindex. - Package caches:
MacPackageCacheSourcemeasures~/Library/Caches/org.swift.swiftpmand~/Library/Caches/CocoaPodswithFileManager.directorySizeonDispatchers.IO,nullfor a missing folder or off macOS. - Volumes: a path under
/Volumes/<name>is on an unavailable volume when that mount point doesn’t exist. - Deletion: refuses any path that isn’t a direct child of the current location or has no
info.plist, then deletes the folder recursively.
FileSwiftBuildSource
Section titled “FileSwiftBuildSource”Implementation of SwiftBuildSource on the FileManager port. A worktree has a .build folder when it has Package.swift and .build is a directory that isn’t a symbolic link; its last access is the latest modification time of .build and of its direct entries. The packages size adds checkouts and repositories. Deletion refuses any path not named .build or without Package.swift next to it.
RepositoryProvisioningFiles
Section titled “RepositoryProvisioningFiles”Implementation of RepositoryProvisioningSource on java.nio.file and kotlinx.serialization, over <repo>/.taxilane.json and <repo>/.worktreeinclude.
The adapter handles the files (reading, fingerprint, atomic writes); each part of .taxilane.json is read in a file of its own next to it (ProvisioningPatterns.kt, ProviderDeclarations.kt, EnvironmentDeclarations.kt, CustomPoolDeclarations.kt, OverlapDeclaration.kt), providers are written back in ProviderOptions.kt, and the field names live in RepositoryConfigFields.kt.
- Reading: a missing or blank
.taxilane.jsonmeans no patterns. The file is parsed as a generic JSON object, so unknown fields are ignored; invalid JSON, a non-object root, acopythat isn’t a list of strings, or aproviders(or a known provider in it) that isn’t an object throwInvalidRepositoryConfig. Unknown provider ids are skipped.envmust be an object of strings whose templates parse (parseEnvironmentVariable), andenvFilea string with a relative path that doesn’t leave the worktree once normalized. Provider options are checked by type: Gradle memory sizes match[0-9]+[kKmMgG],idleTimeoutMinutesis a positive JSON number (not a string), the emulator’s and simulator’s names are non-empty strings and Xcode’scompilationCacheandcocoaPodsare booleans. The user-facing summary of these rules is in Configuration. - Links and commands:
linkfollows the same rules ascopy.hooksmust be an object, and itspostCreatea command (a list of strings) or a list of commands; anything else isInvalidRepositoryConfig. Variable names inenvand thedocker-composeprovider’sportVariablesmust not be reserved, compared without regard to case, and templates andenvFilemust not contain control or invisible format characters (RepositoryConfigRules,hasHiddenCharacters). Each variable keeps its declared template text for the approval subject. - Writing:
addCopyPatternsreads the object, replaces onlycopy(existing patterns first, new ones appended without duplicates);writeapplies aRepositoryConfigEdit(providers,env,envFileand patterns to add) andpreviewreturns the text it would write. Both write it back pretty-printed, atomically (temporary file in the same folder +ATOMIC_MOVE), so other fields survive, and refuse to rewrite a file they can’t parse. Given the fingerprint (a SHA-256 of the content) read when the settings opened, a write first checks the file still has it, and fails withRepositoryConfigChangedotherwise.
Pattern matching is left to Git (git ls-files --others --ignored -z -x <pattern>…, see the domain’s CreateWorktreeUseCase), so it follows the gitignore rules exactly, including their limits: a file can’t be re-included with ! if its parent folder is excluded (.idea/ + !.idea/workspace.xml still lists workspace.xml; use .idea/* instead). Try a pattern from the base repository with the same command:
git ls-files --others --ignored -x '/local.properties' -x '.env*' -x '.idea/runConfigurations/'Terminal, IDE and folder launchers
Section titled “Terminal, IDE and folder launchers”Adapters of the TerminalLauncher, EditorLauncher, FolderLauncher and ToolDetector ports, all through ShellCommandExecutor with argv lists. A failing tool command becomes the port’s typed error with the tool’s error output.
MacTerminalLauncher(Terminal and iTerm2):osascriptwith a fixed script passed as-elines and the launch line as the script’s only argument (on run argv … do script (item 1 of argv)for Terminal; a new window with the default profile andwrite text (item 1 of argv)for iTerm2), so nothing is interpolated into AppleScript. Error-1743(automation not allowed) isTerminalAutomationRefused.WindowsTerminalLauncher:wt.exe -w 0 new-tab -d <path> powershell.exe -NoExit -Command <line>, escaping;, whichwtreads as a command separator.TmuxTerminalLauncher: requires tmux 3.0 or later (tmux -V, elseTerminalUnsupported), picks the most recently attached session, runstmux new-window -P -F '#{window_id}' -t =<session>: -c <path>with-e NAME=valueper variable, thensend-keys -l <agent command>andEnter.ZellijTerminalLauncher: on the last session fromzellij list-sessions --short,zellij --session <session> action new-tab --cwd <path>, thenwrite-chars <line>andwrite 13.CommandEditorLauncher: on macOSopen -b <bundle id> <path>for each of the IDE’s bundle ids, falling back to its launcher; elsewhere the launcher (code,idea,studio,.cmdon Windows) found byExecutableLocator, detached throughnohupon Linux. Xcode has no launcher, so it exists only on macOS, andXcodeWorkspaceFinder(FileSystemXcodeWorkspaceFinder) gives the path it opens: the shallowest.xcworkspacein the worktree, else the shallowest.xcodeproj(up to four levels down, skipping hidden,Pods,build,DerivedData,node_modulesandCarthagefolders), else the worktree’s folder.SystemFolderLauncher:open,explorer.exe(whose exit code 1 isn’t a failure) orxdg-open.LocalToolDetector: macOS apps by bundle id (mdfind "kMDItemCFBundleIdentifier == '<id>'") or by bundle name in/Applications,/System/Applicationsand~/Applications; executables throughExecutableLocator, which looks in the host environment’sPATH, the Homebrew,~/.local/binand~/.cargo/binfolders and, for IDEs, JetBrains Toolbox’s scripts folder. tmux and Zellij count only while they have a session (tmux list-sessions,zellij list-sessions --short). On Windows, IDEs are resolved byEditorExecutableResolver, shared by the detector andCommandEditorLauncherso opening runs what detection found:PATHwith everyPATHEXTextension, the official installer folders (%ProgramFiles%,%ProgramFiles(x86)%,%LOCALAPPDATA%\Programs, highest version first), Toolbox’s scripts and apps folders and, last, theInstallLocationof the registry’s uninstall entries (read withreg query, once per detection). Bundle ids, bundle names and executables live inToolCatalog.NioLauncherFilesandPowerShellUserPath(portsLauncherFilesandUserPathEntries): what theCommandLineTooluse case needs to expose the app astaxilane. The first creates the symbolic link ortaxilane.cmd; the second reads and edits the Windows userPATHthroughpowershell(argv,[Environment]::SetEnvironmentVariable(..., 'User'), which also notifies running programs).ExecutableLocatortries thePATHEXTextensions on Windows, sotaxilane.cmdandtaxilane.exeare found.SystemHostEnvironment(portHostEnvironment): the only production class that readsSystem.getenvoruser.home;HostEnvironmentSourceTestfails on such a read anywhere else incore,cliordesktopApp.forCommandLine()(used bycli/Main.kt) takes the processPATHfollowed by itsuserBinFolders, without starting a shell, sincetaxilaneruns from a terminal, a hook or a runner that already passes the user’s environment.forDesktopApp()(AppContainer’s default, which it resolves on a background thread at start-up) reads the login shell’sPATH, because the app opened from the macOS Dock or Finder only gets/usr/bin:/bin:/usr/sbin:/sbin: on macOS and Linux it runs$SHELL -l -i -cprinting$PATHbetween markers (so whatever the startup files print is ignored, and a non-zero exit after printing still counts), through its own executor that leaves the child’sPATHas inherited, with a 5-second limit, once. The result is the shell’s folders followed by the process’s (LOGIN_SHELL); if the shell can’t start, times out, prints no markers or an empty value, orSHELLisn’t set, it’s the processPATHplus itsuserBinFolders(FALLBACK).userBinFoldersis a constructor parameter,ToolCatalog.userBinFoldersby default, andExecutableLocator(environment)searches the environment’sPATHand those folders only, so a test that passes its own folders decides which tools exist. On Windows it’s the processPATH(PROCESS), without running anything, and variables are looked up regardless of case. Both composition roots pass itsPATHto the executor,ExecutableLocator(environment),CommandLineTool,CliHerdrClient,CliOrcaClientandCliGitHubClient, itshome(throughTaxilaneFiles, which names every file under~/.taxilane) to every store, and its variables (CLAUDE_CONFIG_DIR,GRADLE_USER_HOME,ANDROID_HOME…) to whoever reads them.
GitHubReleaseSource
Section titled “GitHubReleaseSource”Implementation of ReleaseSource with java.net.http.HttpClient (no extra dependency): GET https://api.github.com/repos/CiroFeliu/Taxilane/releases?per_page=30 with Accept: application/vnd.github+json, User-Agent: Taxilane/<version> and a 10-second timeout, no token. One request brings the 30 most recent releases with their bodies, so the notes of every newer version come with it. For each release it skips drafts, pre-releases and tags that aren’t a version, and reads tag_name (parsed by AppVersion), html_url, each asset’s name and browser_download_url leniently, and body through ReleaseNotes.parse; another status or an answer that isn’t a list of releases is UpdateCheckFailed.
JsonRepositoryTrust
Section titled “JsonRepositoryTrust”Implementation of RepositoryTrust in ~/.taxilane/trust.json: { "approvals": { "<repository real path>": { "sha256": …, "commands": [[…]], "env": { … }, "envFile": … } } }. The key is the repository’s real path (toRealPath), so a moved repository asks again. For a subject without variables nor envFile the hash is a SHA-256 of the commands’ canonical JSON, exactly as earlier versions stored it, so their approvals still hold; otherwise it is a SHA-256 of {"commands": …, "env": [[name, template], …], "envFile": …} with env sorted by name, so reordering env keys doesn’t ask again while reordering commands does. The commands, variables and file are kept for display; older files without env or envFile are read with defaults, and older versions ignore the new fields. It is a versioned machine file, private to the user (rw-------) where the file system supports it; an unreadable file counts as nothing approved and is kept aside by the next approval or revocation.
JsonMultirepoSource
Section titled “JsonMultirepoSource”Reads and writes .taxilane-multirepo.json in a multirepo folder, and keeps the machine’s registry in ~/.taxilane/multirepos.json: { "multirepos": ["<declaration path>", …], "local": { "<declaration path>": { "approved": "<sha-256>", "agent": { … } } } }. approved is the SHA-256 of the domain’s approval subject and agent the multirepo agent set on this machine. The registry is a versioned machine file, private to the user (rw-------) where supported; an unreadable one reads as empty and is kept aside by the next write. forget drops the local entry with the path. multirepos and each local entry are decoded on their own, so a malformed entry is skipped without hiding the rest. An earlier version reads multirepos and ignores local; if it rewrites the file, local is lost and those multirepos ask for review again and open claude.
AwtClipboardWriter
Section titled “AwtClipboardWriter”In desktopApp. Implementation of ClipboardWriter with AWT’s system clipboard (Toolkit.getDefaultToolkit().systemClipboard), wrapped in runCatching.
Versioned machine files (VersionedJsonFile)
Section titled “Versioned machine files (VersionedJsonFile)”projects.json, settings.json, trust.json and multirepos.json go through VersionedJsonFile<T>, which owns their reading, writing, locking, versions and unreadable-file policy. The desktop app and the CLI can be of different versions at once (the app keeps running after an upgrade, the Windows zip is installed apart from the app), so every rule assumes another version may read or write the same file.
- Schema version: a file whose root is an object carries
"schemaVersion": Nas its first key, written on every write; a file without it is version 1.projects.jsonstays an array with an implicit version 1, because released versions can’t read anything else. AJsonSchemalists the migrations,migrations[i]taking versioni + 1toi + 2, so the version this release writes is the list’s size plus one; anormalizestep runs after them on every read (LegacyAgentJsonfor the projects). - Unknown fields: a rewrite keeps the keys this version doesn’t know, walking the serializer’s descriptor: inside classes, inside the map entries it keeps, and inside list items with the same
id. Known keys take the written value, removed map entries stay removed, and items without anidare written as they are. - Newer versions: a file at a higher version is read as far as it can be decoded, and every change to it fails with
LocalFileFromNewerVersionbefore touching it. Additive changes don’t raise the version; incompatible ones (including a new enum value) do. - Unreadable files: a file that can’t be read, parsed or decoded, or whose
schemaVersionisn’t a positive whole number, isLocalFileUnreadable.updatemoves it aside as<file>.unreadable-<yyyyMMdd-HHmmss>, writes the change over the empty value and returns the problem; a newer file that can’t be decoded is never moved aside. - Locks and writes: reads and read-modify-writes run under
LocalFileLock, a per-file thread lock plusFileChannel.lock()on a sibling<file>.lockshared by both processes; when that file can’t be created or locked it fails withLocalFileUnreadableinstead of running unlocked.writeAtomicallywrites a temporary file next to the target (owner-only fortrust.jsonandmultirepos.json) and moves it over withATOMIC_MOVE; an unchanged value isn’t written.
Each store shows problems as its port allows: settings.json reads as defaults and reports them in lastReadProblem (a change refused for a newer file is skipped), projects.json throws them, and trust.json and multirepos.json read as empty, so an unreadable trust.json approves nothing. The other files in ~/.taxilane still handle persistence on their own.
Project catalog (projects.json)
Section titled “Project catalog (projects.json)”JsonProjectRepository stores the projects in ~/.taxilane/projects.json with kotlinx.serialization (ignoreUnknownKeys, so files with fields from older versions still load). It is a versioned machine file: every write replaces the whole file atomically, so a crash never leaves a half-written catalog, and keeps the fields of a project this version doesn’t know.
- Unreadable file: a file that can’t be parsed is reported as
LocalFileUnreadableinstead of being treated as empty. Before the next write it’s moved aside asprojects.json.unreadable-<yyyyMMdd-HHmmss>, so a corrupted catalog is never silently overwritten. - Concurrent writes: every read and read-modify-write runs under
LocalFileLock, a lock on a siblingprojects.json.lockfile (FileChannel.lock()) behind a per-file thread lock, shared by the desktop app and the CLI, so a write from one doesn’t lose the other’s.
User preferences (settings.json)
Section titled “User preferences (settings.json)”JsonSettingsFile is the ~/.taxilane/settings.json file, shared by JsonThemePreferenceRepository (ThemePreferenceRepository port), JsonLanguagePreferenceRepository (LanguagePreferenceRepository port) and JsonShellPreferenceRepository (ShellPreferenceRepository port). JsonToolPreferenceRepository (the terminal and default IDE) and JsonUpdatePreferenceRepository (the automatic check and the skipped version) share it too. Besides the theme and language it stores the shell’s state (lastDestination, windowBounds, sidebarCollapsed, collapsedProjects, lastCreateProject, recentPaletteItems, grouping), the tools (terminal, editor), the tray (recentProjects, recentWorktrees, showTrayIcon, keepRunningInTray), the update check (checkForUpdates, skippedVersion) and each worktree’s chosen agent (worktreeAgents). Every field has a default, so a file written by an older version loads as is.
- Each save only rewrites its own field:
updatereads the current contents, applies the change and writes the whole file atomically (same pattern asJsonProjectRepository). Changing the language doesn’t overwrite the theme and vice versa. - Defaults:
SYSTEMfor the theme andENGLISHfor the language when the file is missing or empty. Files written by older versions (onlythemeMode) are read fine: the language takes its default. - Unreadable file and concurrent writes: as with the catalog, an unparseable file reads as defaults but is reported in
lastReadProblem(the desktop app shows it once), moved aside assettings.json.unreadable-<timestamp>before the next write, and every read and update runs underLocalFileLock.
Machine files
Section titled “Machine files”Every file Taxilane stores on the machine, and what each is for, is listed in Configuration › Machine files: the catalog and preferences above, the port reservation index and lock (NioEnvironmentStateStore), the approved post-creation commands (JsonRepositoryTrust), the emulator logs (LocalAndroidSdk) and the Xcode compilation cache settings.
Test doubles
Section titled “Test doubles”In core/src/testFixtures/kotlin/dev/taxilane/domain/, core’s test fixtures, used by the tests of core, cli and desktopApp (testImplementation(testFixtures(project(":core")))):
FakeShellCommandExecutor— substitutesShellCommandExecutor: answers each argv with a cannedCommandResultand records the commands run.FakeFileManager— substitutesFileManagerwith an in-memory set of existing paths and properties files.FakeEnvironmentStateStore/FakePortProbe— substitute the reservation store (in-memory reservations per administrative directory, counting writes and locks) and the port probe (a set of busy ports).FakeDesktopTurnStore— keeps the desktop turn in memory.FakeBuildTurnStoreandFakeForegroundCommandRunner— keep the build slots in memory and record the commands a build would run.FakeDeviceWaitQueue/FakeProcessLiveness— substitute the waiting queue (in memory per queue) and the process check (a set of dead processes).FakeAppleSimulators/FakeKmpTestWiring— substitute the simulators (runtimes, devices that boot after a number of polls, records of creations, boots, windows shown (or a failure to show them), shutdowns and deletions, a macOS switch) and the KMP wiring.FakeHerdrConfigSource— returns a fixed Herdr worktrees folder.FakeOrcaClient— an Orca that can be missing, closed (and start, or not, when opened), knows the repositories, visible and external worktrees,psrows, terminals and terminal agents it’s given, starts an agent in each terminal it creates (right away, after some checks, or never), and records added repositories, shown external worktrees, created and switched terminals, closed worktrees, lookups and metadata updates; each step can fail with a given error.FakeGitHubClient— finds the pull requests (by branch) and issues it’s given, and records each lookup.FakeHerdrClient— records opened worktrees, split and closed panes, closed workspaces, commands run and focused agents, reports the worktrees it’s given (or opens again) as already open or as open workspaces and the agents it’s given, lists the panes it’s given plus the ones it creates, marks a pane’s agent live when a command runs in it (right away, after some listings, never withstartsAgents = false, or gone again withquitAgent), and can fail opening, running, listing worktrees or agents, or closing a given workspace with a given error.FakeAndroidSdk— substitutesAndroidSdkwith AVDs, emulator states that move from booting to running after a number of polls, a missing-SDK switch, and records of starts and stops.FakeGradleDaemonSource— substitutesGradleDaemonSourcewith a mutable list of daemons (or a failure) and counts the listings;gradleDaemon(...)andkotlinDaemon(...)build them.FakeSwiftBuildSource— substitutesSwiftBuildSourcewith.buildfolders by worktree, sizes and packages sizes, failing measurements and deletions, and records them;swiftBuild(...)builds a folder.FakeDerivedDataSource— substitutesDerivedDataSourcewith folders, sizes by path (recording which folders were measured), existing projects, unmounted volumes, a compilation cache size, a macOS switch and failing deletions, and records the deletions;derivedData(...)builds a folder.FakeClipboardWriter— substitutesClipboardWriter.FakeProjectRepository— substitutesProjectRepositoryin ViewModel tests.FakeRepositoryProvisioningSource— substitutesRepositoryProvisioningSourcewith provisioning per repository path, unreadable repositories and failing writes, and records the patterns added.FakeRepositoryTrust/FakeRepositoryApproval— an in-memory trust store (optionally approving everything, for tests about something else) and an approval that always answers the decision it’s given.FakeTerminalLauncher,FakeEditorLauncher,FakeFolderLauncher,FakeToolDetector,FakeToolPreferenceRepository— record what was opened, can fail, and report fixed detected tools and preferences.FakeReleaseSource/FakeUpdatePreferenceRepository— a fixed list of published releases (or failure) and in-memory update preferences.FakeShellPreferenceRepository— in-memory shell state for the desktop app’s tests.
Thanks to the domain depending on interfaces, the use case tests (*UseCaseTest) and the ViewModel tests don’t touch disk or launch real processes. The infrastructure itself is covered by ProcessBuilderShellCommandExecutorTest, SystemHostEnvironmentTest, DockLaunchedChildProcessTest (a fake login shell and a fake Herdr run with the Dock’s minimal PATH), JsonProjectRepositoryTest, JsonSettingsFileTest, RepositoryProvisioningFilesTest, NioEnvironmentStateStoreTest (temporary directories and a real listening socket), NioDeviceWaitQueueTest (a temporary directory and real processes), NioDesktopTurnStoreTest, LocalAndroidSdkTest (SDK lookup order, real adb devices output, the built start command), SimctlAppleSimulatorsTest (real simctl JSON), FileKmpTestWiringTest (temporary repositories and Gradle user home), ProcessGradleDaemonSourceTest (on real ps lines and daemon log excerpts), NioFileManagerTest, MacDerivedDataSourceTest, HerdrConfigFileTest, CliHerdrClientTest, CliOrcaClientTest, JsonOrcaWorkspaceStoreTest, SharedDeviceStatesAndroidSdkTest, JsonRepositoryTrustTest, JsonMultirepoSourceTest, GitHubReleaseSourceTest (a local HTTP server), TerminalLaunchersTest, EditorLaunchersTest, LocalToolDetectorTest and TmuxIntegrationTest (a real tmux server, skipped without tmux), which do use real processes and temporary files.