nightshift install --prefix <prefix> and a workspace doesn’t exist yet, Nightshift launches an interactive TUI that guides you through connecting a provider, selecting a model, and describing your use case. The agent then autonomously configures the workspace by:
- Interviewing you to understand your needs
- Installing appropriate Python packages
- Writing code
- Generating a custom
AGENTS.mdfile - Creating skills in
.opencode/skills/
Launch Sequence
The bootstrap routine is triggered in theinstall() function in src/index.ts:875. When a new workspace is detected:
AGENTS.md), dependencies are synced, and then the bootstrap prompt UI launches.
TUI Flow
TherunBootstrapPrompt() function in src/bootstrap-prompt.ts:232 manages the interactive TUI. It progresses through several view states:
| State | Description |
|---|---|
loading | Starting the OpenCode server |
provider-select | Choose Anthropic, OpenAI, or Skip |
auth-method-select | Choose OAuth or API key (if multiple options) |
oauth-auto / oauth-code | Browser-based authentication flow |
api-key | Manual API key entry |
model-select | Choose which model to use |
intent-prompt | Describe your use case |
bootstrap-output | Shows real-time agent output |
question | Displays agent questions for user input |
The Bootstrap Prompt
After you describe your intent, thebuildBootstrapPrompt() function in src/index.ts:618 constructs the prompt sent to the agent:
- Read
BOOT.mdif present (for pre-configured setups) - Interview the user with 2-4 questions using the
AskUserQuestiontool - Create a TODO list to track bootstrap steps
- Install packages with
uv add - Generate skill files and
AGENTS.md
Event Handling
ThebootstrapWithOpencode() function in src/index.ts:728 subscribes to OpenCode events and routes them to the UI:
| Event Type | Handling |
|---|---|
permission.asked | Auto-approved during bootstrap |
message.part.updated | Streams text deltas and tool status to UI |
session.diff | Displays file changes with diffs |
question.asked | Shows interactive question UI, sends response back |
session.idle | Signals bootstrap completion |
session.error | Rejects the bootstrap promise |
BootstrapUI Interface
The UI interface passed to the bootstrap callback insrc/bootstrap-prompt.ts:54 provides methods for displaying agent output:
| Method | Purpose |
|---|---|
appendText | Streams text chunks (supports delta updates to same line) |
appendToolStatus | Shows tool execution with colored status icons |
setStatus | Updates the header status line |
showDiff | Renders unified diffs with syntax highlighting |
showBashOutput | Displays shell command and output in a collapsible block |
showWriteOutput | Shows file creation with content preview |
showEditOutput | Shows file edits with diff highlighting |
showQuestion | Displays multiple-choice questions from the agent |
Tool Completion Handling
When tools complete,handleToolCompletion() in src/index.ts:689 routes output to the appropriate UI method:
BOOT.md Support
If aBOOT.md file exists in the workspace, the agent reads it first to get pre-configured instructions. This enables automated or semi-automated bootstrap scenarios where the user’s needs are already known.
Skipping Bootstrap
Users can skip the bootstrap prompt by pressingCtrl+C. When skipped, Nightshift falls back to generating a default AGENTS.md:
AGENTS.md generated by generateAgentsMd() in src/index.ts:435 provides generic data science agent instructions.