This document explains how ShipRepo is organized, how a repository moves through the app lifecycle, and where to look when changing core behavior.
The app is a Next.js App Router application with three main responsibilities:
- Present a Sealos app lifecycle UI for authenticated users.
- Persist task, auth, runtime, preview, and connector state in Postgres through Drizzle ORM.
- Orchestrate a fixed
codex+gpt-5.4execution path that runs inside a Devbox runtime and is driven through the Codex Gateway.
At a high level:
- The home page is the entry point for choosing a GitHub repository and starting a lifecycle task.
- Task API routes create and manage task state.
- Devbox code provisions or resumes the cloud runtime that hosts the task workspace.
- Codex Gateway code opens sessions, sends turns, proxies streams, and finalizes task completion.
- Task pages surface analysis, fixes, preview state, runtime state, and follow-up operations back to the user.
ShipRepo should keep the user on one path:
GitHub repo -> Analyze -> Fix deploy blockers -> Preview -> Ship -> Operate
Analyze: inspect framework, package manager, build command, start command, port, env vars, and resource needs.Fix: generate or correct Dockerfile, Sealos template, runtime config, and deployment-specific code changes.Preview: create a reproducible Sealos cloud preview that can be shared and verified.Ship: turn a verified preview into a Sealos deployment.Operate: continue with logs, env vars, redeploys, domains, database/object-storage binding, rollback, and follow-up changes.
This boundary matters: the product is not a generic AI coding console. Codex is used as a Sealos deployment engineer.
- Route:
app/page.tsx - Main UI:
components/sealos-home-page-content.tsx - Input form:
components/task-form.tsx
This flow is optimized for a single repo-to-Sealos path:
- the user signs in
- chooses a GitHub repository
- starts deployment analysis or describes the desired Sealos outcome
- is redirected into the task workspace
- Route:
app/tasks/[taskId]/page.tsx - Main UI:
components/sealos-task-page-client.tsx - Chat UI:
components/task-chat.tsx
The task workspace is the main operational screen. It shows:
- current lifecycle task title or prompt
- chat and follow-up turns
- task actions
- runtime and task status
- preview links and deployment-related outputs
Other supporting task UI lives in components such as components/task-details.tsx, components/file-browser.tsx, and related dialogs.
- Layout route:
app/repos/[owner]/[repo]/layout.tsx - Shared UI:
components/repo-layout.tsx
These pages expose repository context outside the task flow:
- commits
- issues
- pull requests
Repository views are supporting surfaces. The main product path remains repo lifecycle execution.
The client submits a task through POST /api/tasks in app/api/tasks/route.ts.
That route:
- validates input against the Drizzle-backed Zod schema
- forces the execution path to
codex - forces the model to
gpt-5.4 - inserts the task row
- starts the first task turn
- kicks off asynchronous title and branch-name generation
This keeps the request responsive while still recording task metadata early.
Before a turn is sent to Codex Gateway, the app ensures a Devbox runtime exists for the task.
Primary code:
lib/devbox/runtime.tslib/devbox/client.tslib/devbox/config.ts
The runtime layer is responsible for:
- creating or reusing a runtime
- restoring paused runtimes
- refreshing the runtime lease
- preparing the workspace for the task repository
- resolving gateway connection details from runtime metadata
Primary code:
lib/codex-gateway/chat-v2-service.tslib/codex-gateway/runner.tslib/codex-gateway/session.tslib/codex-gateway/completion.ts
The gateway layer:
- ensures a gateway session exists
- prepends Sealos deployment context on the first turn
- sends the user prompt to Codex Gateway
- records turn checkpoints and message events
- waits for completion or terminal failure
- updates task state in the database
Task state is persisted in the tasks table and related message or event tables in lib/db/schema.ts.
The frontend reads from task APIs and hooks such as:
lib/hooks/use-task.tslib/hooks/use-task-agent-chat-v2.ts
This keeps the task workspace live while long-running runtime and gateway work is in progress.
The most important persisted entities are:
users: signed-in users and their primary auth provider statetasks: lifecycle prompt, runtime state, gateway state, preview/PR metadata, logs, and timestampsconnectors: user-level connector definitions
The tasks table acts as the operational center of the app. It stores:
- prompt and title
- selected agent and selected model
- runtime provider, runtime name, and runtime namespace
- gateway URL and gateway session identifiers
- task status and progress
- PR and preview metadata
- timestamps for lifecycle checkpoints
The app intentionally separates runtime concerns from gateway concerns:
- Devbox owns the execution environment and workspace lifecycle.
- Codex Gateway owns session and turn orchestration.
The boundary is joined by runtime-derived gateway metadata such as:
- gateway URL
- gateway auth token
- runtime namespace
This separation makes it easier to evolve runtime handling and prompt/session handling independently.
Use app/ for:
- pages
- layouts
- route handlers
- metadata generation
Use components/ for:
- page-level client UI
- task workspace UI
- dialogs and controls
- reusable primitives and
components/ui/
Use lib/ for:
- database access
- runtime orchestration
- gateway orchestration
- auth and session logic
- utilities and state helpers
The codebase distinguishes between:
- task-facing logs persisted on the task
- server-side console logging for diagnostics
For task-facing flow logs, use the helpers in:
lib/utils/task-logger.tslib/utils/task-flow-logs.ts
This is important because the project has explicit restrictions on dynamic values in logs.
Start with:
components/task-form.tsxcomponents/sealos-home-page-content.tsxapp/api/tasks/route.ts
Start with:
lib/devbox/runtime.tslib/devbox/config.tslib/sealos/config.ts
Start with:
lib/codex-gateway/chat-v2-service.tslib/codex-gateway/runner.tslib/sealos-deploy-context.ts
Start with:
components/sealos-task-page-client.tsxcomponents/task-chat.tsxcomponents/task-details.tsx
Start with:
components/repo-layout.tsxcomponents/repo-commits.tsxcomponents/repo-issues.tsxcomponents/repo-pull-requests.tsx