app.tsx
depends on devices.ts jobs.ts motion.ts search.ts serial.ts targets.ts terminal.ts theme.ts types.ts wizard.ts · used by main.tsx
flowchart TD App --> CommandOutput App --> SerialTerminal App --> SidePane App --> WizardCard App --> attachMotion App --> closeAllTransports App --> createEntrance App --> createFade App --> createPulse App --> createSpinner App --> findMatches App --> findRepositoryRoot
API
Fconst clock = (value: number): string =>
Format a millisecond timestamp as a clock time with hours, minutes, and seconds.
CommandOutputFexport const findRepositoryRoot = (start = process.cwd()):
Returns found:false rather than a bare path when the walk fails. Silently falling back to cwd is the worst outcome available: prerequisite checks, artifact staleness, and every job's working directory would all still answer, but about the wrong tree, so the workspace looks broken instead of misplaced. The released standalone binary is the case that reaches this.
AppFconst delay = (milliseconds: number) => new Promise((resolve) => setTimeout(resolve, milliseconds))
Return a promise that resolves after the given number of milliseconds.
pairingCodes, reconnectAfterFlash, runDiagnosticsFfunction HelpGroup(props: { title: string; rows: HelpRow[] })
Render a help section as a column of command/description rows with the given title. Each row shows the command name in fixed width followed by the muted description.
HelpPanelFconst restingColor = (entry: ActivityEntry) =>
Return the base color for an activity entry: muted for info messages, otherwise the severity color (warn, error, etc.).
colorForFconst colorFor = (entry: ActivityEntry, newest: boolean) =>
Only the newest line animates, so the cost of the arrival fade stays flat no matter how much has scrolled past.
CommandOutput · calls restingColor, settleFconst prefixFor = (entry: ActivityEntry) =>
Return the prefix string for an activity entry based on its kind and severity: "> " for commands, "error: " for error messages, "notice: " for warnings, and "" otherwise.
CommandOutputFconst visible = () => props.activity.slice(-300)
Return the last 300 activity entries for display.
CommandOutputFconst query = () => props.query ?? ""
Return the current search query string, or "" if none is set.
SerialTerminal, statusFconst currentLine = () => matches()[props.matchIndex ?? 0]
Return the currently selected line in the serial search results, indexed by matchIndex.
SerialTerminalFconst status = () =>
While searching, the rule is the search box: the count is the only thing that says whether the term is anywhere in the scrollback at all, so it outranks every connection detail until Esc puts them back.
SerialTerminal · calls matchSummary, queryFexport function PairingPayload(props: { pairing?: BoardState["pairing"]; compact?: boolean })
Display a QR code and optional manual code from a Matter pairing payload. Shows only if pairing data is present. The QR height is compact (5 rows) or full (18 rows) depending on the compact prop.
SidePaneFconst chrome = () => (props.view.danger ? theme.danger : props.chrome)
Return the border color for the enclosing WizardCard: the danger color if the card is marked dangerous, otherwise the provided chrome color.
WizardCardFconst titleColor = () =>
Return the border color for the enclosing WizardCard title: the danger color if the card is marked dangerous, otherwise a color interpolated from muted to foreground based on the arrival fade.
WizardCard · calls settleFconst hints = () => [ props.spinner ?? "", "q close", ...(props.canGoBack ? ["← back"] : []), "↑↓ choose", "Enter", "Tab command" ]
Ranked so the two ways out of a screen outlive the refinements when the rule runs short. The spinner leads only while it exists, because a running job is the one thing more urgent than knowing how to leave.
WizardCardFconst workflowBusy = () => activeWorkflowState() !== undefined
Return true if a workflow is currently running, false if idle.
cancelWorkflow, handleWizardAction, rejectDuringWorkflowFconst patchBoard = (id: BoardId, fn: (value: BoardState) => BoardState) =>
Update a board's state in the boards map by applying a function to its current value.
closeTransport, connectOnce, executeWorkflow, runFactoryReset, sendFconst report = (text: string, severity: Severity = "info") =>
Report a message to the activity log with the given severity and trim the log to the last 300 entries.
App, askConfirmation, cancelWorkflow, choosePane, connectOnce, controlCapture, controlLab, disconnectFconst recordCommand = (text: string) =>
Record a command in the activity log and trim the log to the last 300 entries.
submitPromptFconst clearCommandOutput = () =>
Clear the command output log and hide the help overlay.
submitPromptFconst focusCommand = () =>
Set focus to the command input and blur the wizard select dropdown.
focusWizard, handleGlobalKey, handleWizardAction, hideWizard, openSearchFconst revealMatch = (index: number) =>
Bring the current hit into view. The scrollbox measures in rows and every serial line is one row, so the match index is the row: centring it means the lines around it are visible too, which is the reason to search a log.
stepSearch, updateSearchFconst closeSearch = () =>
Close the search overlay, restore the search state to defaults, and scroll the serial console back to the live tail.
handleGlobalKeyFconst updateSearch = (value: string) =>
Retyping restarts at the first hit rather than keeping an index that now points into a different match list.
App · calls revealMatchFconst stepSearch = (delta: number) =>
Step through search matches in the given direction (delta), wrapping at both ends. Brings the new match into view.
App, handleGlobalKey · calls revealMatch, stepMatchFpatchBoard(id, () => updated)
Apply the updated board state returned from a workflow execution.
Fconst clear = () =>
Clear the connection attempt record for the given board and attempt number once that attempt is complete. Used to stop tracking retries.
clearSerialTerminal, closeAllTransportsFconst commandFor = (kind: WorkflowJob, id: BoardId): string[] =>
Assemble the command array for a given workflow job on a given board. Substitutes environment variables (IDF_EXPORT, ESP_MATTER_PATH, PORT) based on the target and job type. Returns an empty array if the job is unknown.
runSingleJobFconst askConfirmation = (action: DestructiveAction): void =>
Single entry point for every destructive action, from the wizard and from the command prompt alike. Nothing calls the run* functions below directly, so a new destructive path cannot accidentally ship without a confirmation.
handleWizardAction, submitPrompt · calls focusWizard, rejectDuringWorkflow, reportFconst tailTo = (box: ScrollBoxRenderable | undefined) =>
Follow the tail ourselves instead of using the scrollbox's stickyScroll. OpenTUI 0.4.5 scrolls one row past the end even when the content fits the viewport, which silently hid the oldest line of every console and showed nothing at all when only one line had arrived.
AppUndocumented (36)
HelpPanel, CommandOutput, SerialTerminal, WizardCard, SidePane, App, clearSerialTerminal, focusWizard, openSearch, hideWizard, rejectDuringWorkflow, cancelWorkflow, refreshInventory, closeTransport, closeAllTransports, quit, selectBoard, connectOnce, connect, reconnectAfterFlash, disconnect, send, runSingleJob, executeWorkflow, stopBeforeNextJob, runWorkflow, runFactoryReset, runDestructive, pairingCodes, runDiagnostics, controlLab, controlCapture, choosePane, handleWizardAction, submitPrompt, handleGlobalKey