Repository navigation
Development
🌐 English · 简体中文
This guide covers Trizano's local toolchain requirements, Makefile targets, test suite, Protobuf contract generation, engineering conventions, and release process for contributors. For the overall system architecture and directory layout, see Architecture.
Make sure go, pnpm, buf, protoc-gen-go, and protoc-gen-connect-go are installed and available on your PATH. The repository Makefile prepends /usr/local/go/bin, $HOME/go/bin, and /opt/node24/bin to PATH when invoking targets; when running commands directly in your shell, ensure your own installation directories are on PATH.
| Tool / Runtime | Requirement | Source of Truth | Purpose |
|---|---|---|---|
| Go | 1.27.4 |
server/go.mod, desktop-go/go.mod
|
Build Hub, Node, and MyGo desktop app |
| Node.js | 24 | .github/workflows/desktop*.yml |
Web build, typecheck, and vitest |
| pnpm | 12.23.0 |
Root package.json (packageManager) |
Manage web and packages/* workspace dependencies (pnpm-workspace.yaml) |
buf & Go protoc plugins |
buf v2, protoc-gen-go, protoc-gen-connect-go
|
buf.yaml, buf.gen.yaml
|
Lint and generate Go / TS contract code from proto/ (the TS plugin @bufbuild/protoc-gen-es installs via pnpm install) |
| JDK & Android SDK (optional) | JDK 17, Android compileSdk 36
|
android/app/build.gradle.kts |
Build and test the Android client (set ANDROID_HOME or android/local.properties) |
| Desktop packaging tools (optional) |
nsis on Linux (Windows installer); hdiutil on macOS (.dmg) |
.github/workflows/desktop-go.yml, desktop.yml
|
Package local desktop installers |
After cloning the repository, install frontend workspace dependencies first:
pnpm installCommon build, development, and test workflows are consolidated in the root Makefile. VERSION is derived automatically from git describe --tags --match 'v*' (exact tag → <ver>, commits after tag → <ver>-dev, no tags → 0.0.0-dev) and injected into server/internal/version.Version via -ldflags.
| Target | Behavior |
|---|---|
make gen |
Runs buf lint and buf generate, regenerating server/gen and packages/proto-ts/src/gen from proto/
|
make web |
Runs pnpm --filter @trizano/web build (tsc --noEmit && vite build), writing output to server/hub/webui/dist
|
make dist |
Cross-compiles trizano-h3 with CGO_ENABLED=0 for all 6 platforms (linux/darwin/windows × amd64/arm64) into bin/dist/
|
make build |
Runs web and dist, then builds bin/trizano-carbon with embedded Web UI (-tags embedweb) and host bin/trizano-h3
|
make hub-release |
Runs web and dist, then packages Hub release tarballs (trizano-carbon, trizano-h3, and dist/) for linux/amd64, linux/arm64, darwin/arm64, and darwin/amd64 into bin/release/
|
make release |
Runs hub-release and android, collecting all four Hub tarballs, the Release APK, and SHA256SUMS into bin/release/
|
make test |
Runs go vet ./..., GOOS=windows go vet ./..., and TRIZANO_TEST_SSHD=1 go test -race ./... in server/, followed by pnpm --filter @trizano/web typecheck
|
make dev |
Runs dist, builds host bin/trizano-h3, and starts trizano-carbon on 127.0.0.1:47900 with --origin http://localhost:5733
|
make dev-web |
Starts the Vite dev server on 127.0.0.1:5733, proxying /trizano.hub.v1. and /nodes/ to the Hub; pair with make dev in a second terminal |
make desktop-go |
Runs web, then invokes desktop-go/scripts/build.sh to package the MyGo desktop app; pass DESKTOP_PLATFORM=linux/amd64,windows/amd64 to cross-package |
make android |
Runs ./gradlew :app:assembleRelease in android/ to produce an R8-shrunk Release APK |
make android-test |
Runs build, then executes ./gradlew :app:testDebugUnitTest (including HubContractTest driving the real bin/trizano-carbon) |
make clean |
Removes bin, server/hub/webui/dist, desktop-go/build, and desktop-go/resources
|
A
trizano-carbonbinary built without-tags embedwebdoes not serve the Web UI (server/hub/webui/webui.goreturns a short development hint). During development, always openhttp://localhost:5733.
Automated tests never invoke real external agent CLIs. Every end-to-end scenario runs locally against fake binaries, emulators, and ephemeral daemons.
make test covers server-side Go vet/race tests and Web TypeScript checks, but does not run Web vitest unit tests or desktop-go tests. Run them directly when editing those modules:
# Server end-to-end test through the Hub
cd server && go test -race -run TestSessionThroughHub ./hub/
# Single driver package test
cd server && go test -run TestName ./node/driver/claude/
# MyGo desktop app (not included in make test)
cd desktop-go && go vet ./... && GOOS=windows go vet ./... && GOOS=darwin go vet ./... && go test -race ./...
# Web unit tests (vitest, not included in make test)
pnpm --filter @trizano/web test
pnpm --filter @trizano/web exec vitest run src/lib/diff.test.ts
# Android unit tests
cd android && ./gradlew :app:testDebugUnitTest --tests '*AgentBrandTest'-
Fake agent CLIs (
server/hub/testdata/): End-to-end tests buildfakeclaude,fakecodex, andfakeacpviago buildinto temporary executables namedclaude,codex, andopencodeinsidet.TempDir(), prepending that directory toPATH(seeserver/hub/e2e_test.go,agents_e2e_test.go,discussion_e2e_test.go). -
WSL / PowerShell emulators:
server/hub/testdata/fakewslandfakepowershellemulate Windowswsl.exeand PowerShell soserver/hub/wsl_e2e_test.gocan test WSL Node probing, bootstrapping, and Sessions on Linux. -
Ephemeral
sshdtests:TestSSHNode(server/hub/ssh_e2e_test.go) andTestSSHWSLNode(server/hub/wsl_e2e_test.go) start a temporarysshdon127.0.0.1to bootstrap the Node daemon. They run only whenTRIZANO_TEST_SSHD=1is set (enabled bymake test). -
Windows compilation checks and platform-specific tests:
make testrunsGOOS=windows go vet ./...so Windows cross-compilation stays green. Place Unix-only tests in*_unix_test.go(with//go:build !windows) and Windows-only tests in*_windows_test.go. The CI workflow.github/workflows/windows.ymlrunsgo test -count=1 -run "^TestWindows" ./...onwindows-latestand runsTestWindowsSSHNodeagainst native OpenSSH Server withcmd.exe, Windows PowerShell, and PowerShell 7 as the default shell. -
Claude non-root test convention:
TestMaininserver/node/driver/claude/main_test.gosets the package variableasRoottofalseto cover regular non-root behavior; the root-user restriction branch is tested explicitly byTestRootinserver/node/driver/claude/catalog_test.go.
Protobuf is the single source of truth shared by the Hub, Nodes, and all three clients. Edit proto/ and run make gen—never edit generated files by hand.
-
Schema directories:
proto/trizano/hub/v1/,proto/trizano/node/v1/, andproto/trizano/roster/v1/. -
Generated outputs:
buf.gen.yamlgenerates two checked-in trees—server/gen/(protoc-gen-go+protoc-gen-connect-go) andpackages/proto-ts/src/gen/(protoc-gen-es). Android does not commit generated code; Gradle generates it directly fromproto/at build time. -
Compatibility checks:
buf.yamlenablesSTANDARDlint rules andFILE-level breaking-change detection. Removing fields or breaking wire compatibility failsmake gen. -
Zero-routing-change rule: Because the Hub reverse-proxies
/nodes/{node}/<procedure>verbatim to Nodes, adding a new RPC totrizano.node.v1typically only requires editingproto/, runningmake gen, and implementing the handler inserver/node/—no Hub routing changes needed (see Architecture).
The codebase follows a "no defensive code" and single-responsibility discipline:
- Validate once at trust boundaries: Validate at network ingress, auth middleware, resource-name parsing, and proto field constraints. Internal code trusts static types and caller contracts—avoid redundant nil checks and "just in case" fallback branches.
- Propagate typed errors to the UI: Preserve Connect error codes all the way to the client. Do not swallow errors, silently degrade, or paper over missing state with defaults.
- Single owner per state domain: Every piece of mutable state belongs to one owner (such as a Session actor goroutine, a Node connection supervisor, or the review catalog owner). Other goroutines communicate via messages rather than scattering locks.
- Keep retries in the connection layer: SSH reconnection, Reverse Node exponential backoff, and event-stream resumption live in the connection layer and expose visible state. Business RPC layers must not hide implicit retries.
-
Sanitize external bytes to valid UTF-8 before protobuf: Clean output from external processes (SSH, agent CLIs, Git, terminal OSC) with
strings.ToValidUTF8(s, "\uFFFD")before writing to proto3stringfields, and truncate only on UTF-8 rune boundaries so a single malformed byte never breaks an event stream. - Probe capabilities from CLIs; never hardcode: Models, reasoning effort, modes, options, and rate limits are probed live by drivers and cached per CLI version—never hardcoded in servers or clients (see Agent Drivers).
-
Preserve extension boundaries: Keep existing extension interfaces (
driver.Driver,nodes.Dialer, etc.) intact when refactoring or trimming features. -
Languages and commit format: Write code comments and git commit messages in English, strictly using Conventional Commits (
feat(approval): ...,fix(sync): ...,docs(wiki): ...). UI strings, user-facing errors, and internal design docs indocs/are in Chinese;READMEand the wiki are maintained in both English and Chinese and updated together.
Pushing a v* tag triggers .github/workflows/desktop.yml to build and publish all desktop installers, Hub release tarballs, and the Android APK. Update client versions before tagging (trizano-carbon and trizano-h3 versions are injected automatically from the git tag via Makefile's VERSION).
Update both files in the release commit:
| Client | File | Field |
|---|---|---|
| Desktop (MyGo) | desktop-go/mygo.json |
"version" |
| Android | android/app/build.gradle.kts |
versionName and incremented versionCode
|
After committing the version bump, push a v<version> tag (for example v0.9.1). .github/workflows/desktop.yml runs three jobs in parallel; once all succeed, publish-release creates or updates the matching GitHub Release (gh release upload --clobber):
-
Desktop (MyGo, via
.github/workflows/desktop-go.yml):- The Ubuntu runner runs three-platform
go vetandgo test -race ./...indesktop-go/, then cross-builds Linux packages (.deb,.rpm,.tar.gz,install.sh) and the Windows installer (*-setup-*.exe). - The macOS runner builds the
darwin/arm64.dmg. - Pushes to
maintouchingdesktop-go/**or.github/workflows/desktop-go.ymlalso trigger this workflow automatically (without creating a Release).
- The Ubuntu runner runs three-platform
-
Hub tarballs (
build-hub): Runsmake hub-releaseonubuntu-latest, producingtrizano_<version>_<os>_<arch>.tar.gzforlinux/amd64,linux/arm64,darwin/arm64, anddarwin/amd64(each containingtrizano-carbon,trizano-h3, and the 6-platformdist/directory). -
Android Release APK (
build-android): Runs./gradlew :app:assembleReleasewith JDK 17 onubuntu-latest, outputtingtrizano_<version>_android.apk.
To support in-place APK upgrades without reinstalling on phones, configure a persistent signing keystore in GitHub repository Secrets:
-
ANDROID_KEYSTORE_BASE64: Base64-encoded keystore file; CI decodes it to a temporary path and exportsANDROID_KEYSTORE_PATH. -
ANDROID_KEYSTORE_PASSWORD,ANDROID_KEY_ALIAS,ANDROID_KEY_PASSWORD: Optional; when unset,android/app/build.gradle.ktsdefaults to"android","androiddebugkey", and"android"respectively. - If
ANDROID_KEYSTORE_BASE64is not set, release builds automatically fall back to signing with the debug keystore.
English
Getting Started
Deployment & Networking
Architecture & Nodes
Agents
Clients & Development
Project & Community
中文文档
新手指引
部署与网络
架构与节点
智能体
客户端与开发
项目与社区