terminal

Twig includes a built-in terminal so you can run commands without switching applications. This page covers how to use it effectively.

opening the terminal

The terminal panel appears at the bottom of the window:

  • keyboard - press cmd + j to toggle
  • menu - view > terminal
  • click - click the terminal tab at the bottom

terminal basics

The terminal works like any other terminal application:

  • Type commands and press enter to run them
  • Use tab for auto-completion
  • Up/down arrows for command history
  • ctrl + c to cancel a running command

It uses your default shell (usually zsh on macOS).

working directory

The terminal opens in your project's root directory. Navigate as needed:

cd src/components

The working directory persists within your session.

common tasks

running tests

npm test

Or for specific test files:

npm test -- src/utils/validation.test.ts

starting dev servers

npm run dev

The terminal shows output, and you can ctrl + c to stop.

installing packages

npm install lodash

Or:

pnpm add lodash

git commands

git status
git add .
git commit -m "your message"

build commands

npm run build

multiple terminals

Open additional terminal tabs when you need to run multiple things:

  • Click the + icon in the terminal panel
  • Each tab has its own shell session
  • Useful for: dev server in one, tests in another

Close tabs by clicking the X or typing exit.

terminal and the agent

The agent can run terminal commands as part of completing tasks:

  • You'll see commands in the chat before they run
  • Output appears in the conversation
  • You can approve or skip commands

This is useful for:

  • Running tests after making changes
  • Checking build output
  • Executing setup scripts

environment

The terminal inherits your shell environment:

  • Environment variables from your .zshrc / .bashrc
  • Path settings
  • Aliases (in interactive mode)

If something works in your regular terminal but not in twig, check that environment variables are set correctly.

tips

keep the terminal visible

When running long-running processes (dev servers, watchers), keep the terminal visible to see output.

use the agent for complex commands

Instead of remembering complex command syntax:

run the tests for just the authentication module

The agent knows your project structure and can construct the right command.

clear the terminal

cmd + k clears the terminal output while keeping the session active.

full-screen terminal

Double-click the terminal header to maximize it when you need to focus on command output.