How 0xnyn/airship works
Purpose and launch path
Airship is a local, Node 22+ visual editor placed in front of an existing HTTP dev server. It opens a browser editor, lets users select rendered elements or modify styles, then delegates source edits to Claude Code, Codex, or OpenCode. The published CLI is the primary entry point: apps/cli/src/index.ts, with launch orchestration in apps/cli/src/commands/serve.ts; airship and airship.cmd are repository-level launch shims.
CLI configuration and environment validation
The CLI parses flags, resolves settings from flags/environment/project configuration/defaults, detects a target dev-server port, optionally starts the dev command, and checks prerequisites. The configuration boundary is apps/cli/src/lib/config.ts and apps/cli/src/lib/settings.ts; target discovery is apps/cli/src/lib/detect.ts. doctor is a separate diagnostic entry path in apps/cli/src/commands/doctor.ts. CLI-facing behavior should remain independent of any particular target framework.
Local proxy and session server
The server binds loopback by default, validates host access, proxies the target application, and adapts responses so the editor can frame or overlay the target page. It owns HTTP-facing safety boundaries such as allowed hosts, CSP handling, and frame-header removal. Core server modules are packages/server/src/index.ts, packages/server/src/proxy.ts, and packages/server/src/access.ts. It also manages edit jobs/history and editor-launch integration through packages/server/src/jobs.ts, packages/server/src/history.ts, and packages/server/src/open-editor.ts.
Browser editor overlay
packages/overlay is the substantial browser-side editor package injected/served around the proxied app. Its application lifecycle and integration boundary are packages/overlay/src/app.ts, packages/overlay/src/hook.ts, and packages/overlay/src/ws.ts. It supports two presentations: an inline overlay over one page and a canvas/shell containing multiple live device frames. Canvas frame management is centered in packages/overlay/src/canvas/frames.ts, packages/overlay/src/canvas/space.ts, and packages/overlay/src/shell-app.ts.
Selection, visual editing, and UI state
The overlay turns DOM selection and computed/authored styling into editor operations. The inspector covers layout/CSS/DOM-oriented controls, with its central model and panel in packages/overlay/src/inspector/style-model.ts and packages/overlay/src/inspector/panel.ts; reversible local editing is represented by packages/overlay/src/change-set.ts and packages/overlay/src/history.ts. Chat, prompt construction, streamed agent output, diffs, and user-visible change summaries are handled in packages/overlay/src/chat/build-request.ts, packages/overlay/src/chat/transcript.ts, and packages/overlay/src/diff-view.ts.
Agent execution, source attribution, and undo
packages/core translates a browser edit request—selected element/source location, prompt, inspector changes, and frames—into an agent run, captures file changes, and returns timeline/diff data. The runner and shared contracts are packages/core/src/runner.ts, packages/core/src/agent.ts, and packages/core/src/models.ts. Provider adapters isolate agent-specific subprocess/protocol behavior: packages/core/src/providers/claude.ts, packages/core/src/providers/codex.ts, and packages/core/src/providers/opencode.ts. Source-location extraction and project-path handling sit behind packages/source/src/browser.ts, packages/source/src/server.ts, and packages/core/src/paths.ts. Claude can use captured pre-edit content; Codex/OpenCode reconstruct baselines through Git, implemented by packages/core/src/diff-capture.ts and packages/git/src/index.ts.
Safety, protocol, and distribution surfaces
A shared protocol package defines browser/server/core message and model contracts: packages/protocol/src/models.ts and packages/protocol/src/tokens.ts. Agent safety policy is centralized in packages/core/src/sandbox.ts; actual strength varies by backend, with Codex receiving a real sandbox and Claude/OpenCode relying on command/edit checks. External dependencies are local target dev servers, Git for some diff/undo flows, installed/authenticated coding-agent CLIs and their model-provider credentials; Airship itself uses no hosted control plane or telemetry. The marketing site is a separate Vite/TanStack Router application, rooted at apps/web/src/router.tsx and apps/web/src/routes/index.tsx, rather than part of the editor runtime.
Main entry points: index.ts Proxy session server · runner.ts Edit runner · app.ts Editor overlay · serve.ts Serve orchestration
Components 21
CLI launch
- Published CLI · Primary local entry point.
apps/cli/src/index.ts - Serve orchestration · Resolves launch settings and starts the local editor stack.
apps/cli/src/commands/serve.ts - Settings resolution · Combines flags, environment, project settings, and defaults.
apps/cli/src/lib/config.ts - Target discovery · Finds the target port and can start its dev command.
apps/cli/src/lib/detect.ts - Doctor · Separate prerequisite diagnostic path.
apps/cli/src/commands/doctor.ts
Local server
- Proxy session server · Loopback server, proxy boundary, jobs, history, and editor launch.
packages/server/src/index.ts - Proxy access policy · Validates hosts and adapts CSP and frame headers.
packages/server/src/proxy.ts
Browser editor
- Editor overlay · Injected editor lifecycle and server integration.
packages/overlay/src/app.ts - Canvas device frames · Shell mode manages multiple live device frames.
packages/overlay/src/canvas/frames.ts - Inspector and local changes · Models style controls and reversible browser-side edits.
packages/overlay/src/inspector/style-model.ts - Chat and diff UI · Builds requests and presents streamed output and changes.
packages/overlay/src/chat/build-request.ts - Shared protocol · Browser, server, and core models and tokens.
packages/protocol/src/models.ts
Edit execution
- Edit runner · Turns selection, prompts, styles, and frames into edit runs and timelines.
packages/core/src/runner.ts - Source attribution · Maps browser selections to project source paths.
packages/source/src/server.ts - Agent providers · Claude, Codex, and OpenCode subprocess/protocol adapters.
packages/core/src/providers/claude.ts - Agent safety policy · Central policy; backend enforcement strength varies.
packages/core/src/sandbox.ts - Diff capture and undo · Uses captured content or Git baselines for diffs and undo.
packages/core/src/diff-capture.ts
External systems
- Target dev server · Existing application being edited.
- Coding-agent CLIs · Installed and authenticated Claude, Codex, or OpenCode.
- Git · Baseline source for Codex/OpenCode flows.
- Marketing site · Separate from the editor runtime.
apps/web/src/router.tsx
Connections 23
- Published CLI → Serve orchestration: launches
- Published CLI → Doctor: diagnostics
- Serve orchestration → Settings resolution: resolves settings
- Serve orchestration → Target discovery: finds target
- Serve orchestration → Proxy session server: starts
- Target discovery → Target dev server: detects or starts
- Proxy session server → Proxy access policy: enforces
- Proxy session server → Target dev server: proxies
- Proxy session server → Editor overlay: serves and connects
- Editor overlay → Canvas device frames: hosts shell mode
- Editor overlay → Inspector and local changes: drives selection and edits
- Editor overlay → Chat and diff UI: hosts
- Editor overlay → Shared protocol: uses
- Proxy session server → Shared protocol: uses
- Proxy session server → Edit runner: submits edit jobs
- Chat and diff UI → Edit runner: sends edit requests
- Edit runner → Source attribution: resolves selected source
- Edit runner → Agent safety policy: applies policy
- Edit runner → Agent providers: dispatches
- Agent providers → Coding-agent CLIs: executes
- Edit runner → Diff capture and undo: captures changes
- Diff capture and undo → Git: reconstructs baselines
- Edit runner → Proxy session server: returns timeline and diffs