Skip to content

Overview

Taxilane is a Kotlin/JVM desktop application built with Compose Multiplatform (Compose Desktop), plus the taxilane command-line tool.

There are three Gradle modules:

Module What it holds Depends on
core The domain (models, ports, use cases) and the infrastructure that implements its ports: processes, files, the JSON catalog and settings. Plain Kotlin/JVM, without Compose or AWT. Coroutines, kotlinx.serialization
desktopApp The desktop application: Compose UI (screens and ViewModels), AppContainer, the entry point and AwtClipboardWriter, the only port implementation that needs the desktop toolkit. core, cli, Compose Desktop
cli The taxilane command: argument parsing and its commands (worktrees, environment, providers and agent hooks; see the command-line reference) on top of core. The desktop app’s launcher runs it when it receives arguments. core

core exists so that a second front end — the taxilane command-line tool — can run the same use cases without pulling in the desktop UI. Packages didn’t change when it was extracted (dev.taxilane.domain…, dev.taxilane.infrastructure…); the module boundary is what keeps the UI out of core. The test doubles live in core’s test fixtures, shared by every module’s tests.

The root build.gradle.kts sets the compiler policy for every Kotlin module, including modules added later: any compiler warning fails the build, in production, test and test fixture sources alike, so a warning is fixed in the change that introduces it. Test and test fixture sources opt in to kotlinx.coroutines.ExperimentalCoroutinesApi, because they use virtual-time APIs on purpose; production code still needs an explicit opt-in.

core/src/main/kotlin/dev/taxilane/
├── domain/ # models, ports, and use cases — no infrastructure dependencies
│ ├── model/ # ProjectConfig, Worktree, WorktreeStatus, RepositoryProvisioning, WorktreeEnvironment, providers' models, WorktreeError…
│ ├── executor/ # ShellCommandExecutor and ClipboardWriter ports + CommandResult
│ ├── io/ # ports: FileManager, ProjectRepository, preferences, RepositoryProvisioningSource,
│ │ # EnvironmentStateStore, PortProbe, AndroidSdk, AppleSimulators, KmpTestWiring,
│ │ # HerdrClient, HerdrConfigSource, OrcaClient, OrcaWorkspaceStore, GitHubClient,
│ │ # GradleDaemonSource, DerivedDataSource
│ └── usecase/ # worktrees (create, list, provision, remove, repair, clean up, status, overview),
│ # environment and ports, providers (Gradle, emulator, simulator, Xcode), Herdr, Orca
├── engine/ # TaxilaneEngine: the one wiring of the use cases, shared by the app and the CLI
└── infrastructure/ # concrete implementations of the domain ports, and hostEnginePorts
core/build/generated/buildInfo/ # BuildInfo.VERSION, shared by the app and the CLI
desktopApp/src/main/kotlin/dev/taxilane/
├── infrastructure/ # AwtClipboardWriter
├── ui/ # Compose screens, ViewModels, and navigation
├── AppContainer.kt # builds the engine for the UI and holds the UI's states, no DI framework
└── main.kt # entry point: runs the CLI with arguments, opens the window without
cli/src/main/kotlin/dev/taxilane/cli/
├── CliCommand.kt # the sealed CliCommand
├── CliArguments.kt # parseArguments: dispatches each command to its parser (*Arguments.kt, *Command.kt)
├── TaxilaneCli.kt # runs each command on top of the engine's use cases
└── Main.kt # standalone entry point (runTaxilane)

TaxilaneEngine (core, package engine) is the only place where use cases are wired to each other. It receives EnginePorts, a data class with every port the shared use cases need and no defaults, so a forgotten port is a compile error rather than a silently disabled feature, and EngineOptions (clock, pauses, the optional WorktreeEnvironmentCache). It exposes the machine-wide use cases already wired (environment resolution, resource pools, devices, simulators, emulators, the headless app, the desktop turn, physical devices, Gradle, Maven, Compose, DerivedData, multirepos, agent detection) and, through project(config), a ProjectEngine with the use cases that take a ProjectConfig (list, create, provision, remove, clean up, branches); the ones that ask for a repository approval take it per call.

hostEnginePorts (infrastructure) chooses the real implementation of every port for a host environment, once for both surfaces. The two choices that differ between them are its parameters: the desktop app shares emulator-state reads between its panels (SharedDeviceStatesAndroidSdk) and the command line doesn’t, and each tells physical devices which folder to locate the Android SDK from (the CLI’s working directory, the app’s home). The app also passes a WorktreeEnvironmentCache, which the CLI, one command per process, doesn’t need. Tests build the engine from fakeEnginePorts(...) in core’s test fixtures.

The domain is defined in terms of ports (interfaces) and doesn’t know about ProcessBuilder or java.nio.file directly; that lets each port be swapped for a test double (FakeShellCommandExecutor, FakeFileManager) in use case tests, without touching disk or launching real processes.

The tests in core/src/test/kotlin/dev/taxilane/architecture/ read the sources of the three modules on every test run and fail, naming file and line, when one of these rules is broken:

Package of core May import from the project
domain.model nothing
domain.executor nothing
domain.io domain.model, domain.executor
domain.usecase domain.model, domain.executor, domain.io
infrastructure domain.model, domain.executor, domain.io
engine domain.model, domain.executor, domain.io, domain.usecase
  • The domain doesn’t touch the system: no java.io.File, java.nio.file, kotlin.io.path, System.getProperty, ProcessBuilder or Runtime in domain/.
  • Composition roots: in the desktop app, only main.kt and AppContainer.kt use infrastructure, and runTaxilane is the only thing it uses from the CLI; in the CLI, only Main.kt and TaxilaneCli.kt use infrastructure.
  • No comments in any Kotlin source or Gradle script.
  • Commands as argv: no Runtime.exec, and no shell interpreter named as a command.
  • File length: no production file over 400 lines, except the files directly in a folder exempt as a whole because it only holds data that grows with every feature (the desktop app’s translation tables in ui/i18n).

Some existing code doesn’t follow the rules about the system, shells and length yet. Each case is on an exception list in ArchitectureExceptions.kt, which must match the code exactly: a new case fails, and so does an entry that no longer matches anything, so the lists can only shrink. A file over the length limit is capped at its length, and its cap is never raised: a change that needs room in it moves code to new files first. An exempt folder fails once none of its files is over the limit.

See the detail of each layer: