|
| 1 | +--- |
| 2 | +name: dev-workflow |
| 3 | +description: How to run altimate-code inside a harness sandbox pod — base image, clone, setup, start command, health check, exposed port. |
| 4 | +user_invocable: false |
| 5 | +--- |
| 6 | + |
| 7 | +# Dev Workflow — altimate-code |
| 8 | + |
| 9 | +altimate-code is an open-source agentic data engineering tool (CLI + optional HTTP server) for dbt, SQL, and cloud warehouses. It is a TypeScript monorepo using Bun as the runtime and package manager, with Turbo for task orchestration. The main package is `packages/opencode` which produces the `altimate-code` CLI binary. |
| 10 | + |
| 11 | +Running locally means cloning the repo, running `bun install` to fetch dependencies, then either running the CLI directly via `bun run dev` or starting a headless HTTP server via `bun run --cwd packages/opencode --conditions=browser src/index.ts serve`. |
| 12 | + |
| 13 | +## Architecture |
| 14 | + |
| 15 | +altimate-code is self-contained with no external service dependencies. It uses: |
| 16 | + |
| 17 | +- **SQLite** (via drizzle-orm) for local session/state storage — embedded, no sidecar needed |
| 18 | +- **Bun** as the runtime and package manager (version 1.3.10) |
| 19 | +- **Hono** as the HTTP framework when running in server mode |
| 20 | +- **tree-sitter** for code parsing (native binary addon) |
| 21 | + |
| 22 | +There are no database sidecars, no Redis, no message queues. The tool operates as a standalone CLI or headless server. When running as a server (`serve` command), it uses Bun.serve and listens on a configurable port (defaults to trying port 4096, falls back to a random port). |
| 23 | + |
| 24 | +The monorepo workspace packages are: |
| 25 | +- `packages/opencode` — the main CLI/server (the one we build and run) |
| 26 | +- `packages/plugin` — plugin system |
| 27 | +- `packages/script` — build scripts |
| 28 | +- `packages/util` — shared utilities |
| 29 | +- `packages/sdk/js` — JavaScript SDK |
| 30 | +- `packages/dbt-tools` — dbt integration tools |
| 31 | +- `packages/drivers` — database driver adapters (optional deps) |
| 32 | + |
| 33 | +## What happens on sandbox create |
| 34 | + |
| 35 | +1. The init containers mint a GitHub token and clone the repo into `/workspace/altimate-code`. |
| 36 | +2. The main container runs `bun install` to ensure all workspace dependencies are resolved (most are pre-baked in the base image, so this is a fast delta install). |
| 37 | +3. `.code-ready` is touched — the agent can now read/write code, run linters, run tests. |
| 38 | +4. The server is started via `bun run --cwd packages/opencode --conditions=browser src/index.ts serve --port 4096 --hostname 0.0.0.0`. |
| 39 | +5. `.server-ready` is touched — the agent can now interact with the HTTP API. |
| 40 | + |
| 41 | +## Sandbox Contract |
| 42 | + |
| 43 | +```yaml |
| 44 | +repo: altimate-code |
| 45 | +repo_url: https://github.com/AltimateAI/altimate-code.git |
| 46 | +base_image: altimateacr.azurecr.io/altimate-code-base:latest |
| 47 | +working_dir: /workspace/altimate-code |
| 48 | +port: 4096 |
| 49 | +health_path: "" |
| 50 | + |
| 51 | +# altimate-code is a standalone tool — it does not expose services consumed |
| 52 | +# by other sandboxes in the typical Altimate stack. |
| 53 | +provides: [] |
| 54 | + |
| 55 | +# No upstream dependencies. altimate-code is a leaf in the sandbox DAG. |
| 56 | +needs: [] |
| 57 | + |
| 58 | +sidecars: [] |
| 59 | + |
| 60 | +host_aliases: {} |
| 61 | + |
| 62 | +setup_commands: |
| 63 | + - name: install-deps |
| 64 | + cmd: bun install |
| 65 | + |
| 66 | +start_command: bun run --cwd packages/opencode --conditions=browser src/index.ts serve --port 4096 --hostname 0.0.0.0 |
| 67 | +``` |
| 68 | +
|
| 69 | +## Troubleshooting |
| 70 | +
|
| 71 | +- **`bun install` hangs or fails**: The base image pre-bakes `node_modules` and the bun cache. If lockfile drift causes a full re-resolve, it may be slow. Rebuild the base image with the latest `bun.lock`. |
| 72 | +- **tree-sitter native addon issues**: The base image includes the linux-x64 prebuilds. If you see `Cannot find module 'tree-sitter'`, the base image may need rebuilding for the correct platform. |
| 73 | +- **Port conflict on 4096**: The server falls back to port 0 (random) if 4096 is taken. If the harness expects 4096, ensure no other process binds it first. |
| 74 | +- **SQLite migration on first run**: On first launch, altimate-code runs a one-time SQLite migration. This is automatic and takes a few seconds. The server won't be ready until it completes. |
| 75 | +- **`bun-pty` build failures**: This native addon requires build tools. The base image includes `build-essential` to handle this. |
0 commit comments