-
Notifications
You must be signed in to change notification settings - Fork 6
Development Setup
Dev environment for contributors and anyone who wants to build from source.
| Tool | Minimum | Purpose |
|---|---|---|
| Bun | 1.2.0 | Package manager, test runner, scripts |
| Node.js | 20 LTS | Used by electron-vite for native-module rebuilds |
| Git | any recent | Obvious |
| Build toolchain | OS-specific | Xcode CLI on macOS, build-essential on Linux, MSVC on Windows |
curl -fsSL https://bun.sh/install | bashThen restart your shell. Verify: bun --version.
macOS (homebrew):
brew install node@20Linux (nvm):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 20
nvm use 20git clone https://github.com/CES-Ltd/TitanX.git
cd TitanX
bun installbun install takes about 60 seconds first time (fetches ~1800 packages including Electron 37 and native modules like better-sqlite3 and @napi-rs/canvas).
bun run startThis launches electron-vite dev:
- Vite dev server for renderer on
http://localhost:5173(with HMR) - Electron main process with
--inspecton port 9229 - CDP (Chrome DevTools Protocol) on port 9230 (you can attach DevTools MCP to this if you're using Claude Code / similar)
- Opens the TitanX window
Edits to renderer code (src/renderer/) hot-reload in under 500ms. Edits to main-process code (src/process/) require a full restart — the app auto-reloads after Vite rebuilds.
bun run test # watch mode (Vitest 4)
bun run test:coverage # one-shot with coverage reportCoverage target: ≥ 80%. CI enforces this; local runs don't block.
Test file conventions:
-
*.test.tsnext to the module under test -
__tests__/folder for tests that span multiple modules - Vitest config in
vitest.config.ts
See the testing skill for the full test strategy.
bun run build # macOS arm64 + x64 (~5 min)This wraps scripts/build-with-builder.js which:
- Runs
electron-vite build(TypeScript → bundles inout/main/+out/renderer/+out/preload/) - Runs
electron-builder(packages each arch into a.app+.dmg+.zip) - Signs the
.appwith an ad-hoc signature (no Apple Developer ID) - Rebuilds native modules per-arch using
prebuild-install
Artifacts land in out/:
TitanX-<version>-mac-arm64.dmgTitanX-<version>-mac-x64.dmg- (Linux targets if you're on Linux; Windows similarly)
Run these before opening a PR:
bunx tsc --noEmit # type check
bun run lint:fix # oxlint auto-fix
bun run format # oxfmt auto-formatAnd to replicate the CI prek check locally (one-time install):
npm install -g @j178/prek
prek run --from-ref origin/main --to-ref HEADThe prek check fails on:
- Type errors
- Lint errors (warnings OK)
- Formatting drift (run
bun run formatto fix) - Missing newline at EOF, trailing whitespace
If you touch src/renderer/, locales/, or src/common/config/i18n, also run:
bun run i18n:types # regenerates type definitions
node scripts/check-i18n.js # validates all 10 locale files are in syncBoth must pass before PR. The i18n skill documents the full workflow.
src/
├── process/ # Main process (Node + Electron APIs)
│ ├── agent/ # LLM provider adapters
│ ├── team/ # TeammateManager, Team MCP, Lead orchestration
│ ├── task/ # Conversation + agent manager (ACP + API)
│ ├── services/ # IAM, audit, fleet, dream, reasoning bank, ...
│ └── webserver/ # Fleet HTTP surface (master only)
│
├── renderer/ # Chromium sandbox (React + UnoCSS + Arco Design)
│ ├── components/ # Shared UI
│ ├── pages/ # Route-level views
│ └── hooks/ # Custom React hooks
│
├── common/ # Code shared between processes
│ ├── types/ # Shared types (team, agent, fleet, ...)
│ ├── adapter/ # IPC bridge shape
│ └── utils/ # Pure helpers
│
├── process/worker/ # Child-fork workers for CPU-heavy tasks
└── preload.ts # The IPC boundary
Strict rule: never cross-import process boundaries. renderer/ importing from process/agent/ is a compile error. Use the IPC bridge.
Full conventions: docs/conventions/file-structure.md.
// In src/process/services/database/migrations.ts
const migration_v74: IMigration = {
version: 74,
name: 'Add my new column',
up: (db) => {
db.exec(`ALTER TABLE my_table ADD COLUMN my_new_column TEXT`);
},
down: (db) => {
try {
db.exec(`ALTER TABLE my_table DROP COLUMN my_new_column`);
} catch { /* older SQLite — leave in place */ }
},
};
// Register in ALL_MIGRATIONS array
// Bump CURRENT_DB_VERSION in schema.ts to 74Rules:
- Every up() must have a working down()
- Default-safe columns (nullable or with defaults) — don't break older code paths
- Never rename existing columns (add new, migrate data, drop old in a later version)
- Run
bun run test— migration tests catch most mistakes
- Open DevTools in the dev app:
View → Toggle Developer Tools(orCmd/Ctrl+Alt+I) - Network tab + Console tab work as expected
- Run
bun run start— the--inspectflag opens Node's inspector onlocalhost:9229 - Attach VS Code / Chrome DevTools to that port
- Or use
console.log— output goes to the terminal you launched from
The DB lives at ~/.aionui-config/aionui.db. Inspect with:
sqlite3 ~/.aionui-config/aionui.db ".tables"
sqlite3 ~/.aionui-config/aionui.db "SELECT * FROM teams LIMIT 5;"Or use GUI tools — DB Browser for SQLite works well.
"Cannot find module 'better-sqlite3'" — the native module didn't build for your Node version. Run bun install again; if still broken, delete node_modules + re-install.
Hot reload doesn't pick up my change — some TypeScript errors cause Vite to silently fail the rebuild. Check the terminal where bun run start is running for the actual error.
App launches but hangs on splash screen — SQLite migration failed. Check the terminal output; a migration error will print before the window would have shown. Common causes: disk full, file permissions on ~/.aionui-config/, or a botched prior migration left the DB at an intermediate version.
Type errors in src/common/* — this folder is compiled for both processes. If you use anything Node-only or DOM-only, the types will fail. Keep src/common/ pure (no filesystem, no DOM).
See the oss-pr skill for the canonical flow:
- Branch from
main(no direct commits to main) -
bun run test && bunx tsc --noEmit && bun run lint:fix && bun run formatall green - Commit with conventional format:
feat(scope): subject, no AI signatures - Open PR with summary + test plan
- Automated PR review daemon may comment — address or justify
- Merge squash; version bump + release happens at your branch's cadence
- Project Structure — deeper walkthrough
- Code Conventions — TypeScript, UI library, CSS rules
- Testing — test strategy in depth
- Pull Request Workflow — commit format, PR automation, release cadence
-
AGENTS.md— project conventions (authoritative)
TitanX · Enterprise AI Agent Orchestration · Apache-2.0
Docs: Wiki · Technical docs · Releases · Security
Last updated for v2.5.1 — report doc issue · contribute to the wiki
📖 Getting Started
🧩 Core Concepts
- Architecture Overview
- Agents and Teams
- Agent Gallery and Templates
- ACP Runtimes
- MCP Servers
- Workspaces
- Reasoning Bank
👤 End-User Guides
- Hiring Agents from the Gallery
- The Sprint Board
- Conversations and Chat UI
- Using Custom Assistants
- Skills Hub
- Cron and Scheduled Tasks
- Observability
- Caveman Mode
🌐 Fleet Mode
- Fleet Mode Overview
- Master Setup Guide
- Slave Enrollment
- Agent Farm Setup
- Publishing Agent Templates
- Command Center
- Device Forensics and Revocation
🌙 Dream Mode
- Dream Mode Overview
- Enabling Dream Mode
- Dream Pass Internals
- Consolidated Learnings Dashboard
- Privacy and Redaction
🔒 Security
- Security Model
- IAM Policies
- Audit Logging
- Device Identity and Signing
- Secrets Management
- Compliance and Data Residency
🛠 Developer
- Development Setup
- Project Structure
- Code Conventions
- Testing
- Adding an ACP Runtime
- Adding an MCP Server
- Pull Request Workflow
📘 Reference
- Configuration Keys
- Environment Variables
- IPC Channels
- Database Schema
- Fleet Command Types
- Telemetry Shape
- CLI and Keyboard Shortcuts
❓ Help
🔗 Outside the wiki
v2.5.1 · 50+ pages · Contribute