Architecture note (2026-11): The command-execution terminal described below (bash/python/node selector, working-directory input, 50-command history) belonged to the removed vanilla-JS UI. The current implementation is a real PTY terminal: xterm.js in
novacoder/web/react/src/components/ide/TerminalPanel.tsxattached to the/ws/terminalWebSocket on the/idepage. Feature specifics below are historical.
Overview
The Nova Coder web interface includes a web-based terminal for command execution, allowing users to run shell commands directly from the browser without needing a separate terminal application.
Features
Shell Support
- Bash - Standard bash shell commands
- Python - Python REPL execution
- Node.js - Node.js JavaScript execution
Command Execution
- Working Directory - Specify the working directory for command execution
- Command History - Tracks up to 50 executed commands
- Exit Code Tracking - Displays exit codes for each command
- Output Display - Shows command output and error messages
- Timestamp - Records when each command was executed
Output Management
- Clear Terminal - Clear all command history
- Download Output - Download terminal output as a text file
- Color-Coded Results - Green for success, red for failure
Usage
Accessing the Terminal
- Navigate to the web interface
- Click "Terminal" in the sidebar navigation
- Enter the working directory (default is current directory
.) - Select the shell type (Bash, Python, Node.js)
- Click "Execute" to run the command
Running Commands
- Enter the command in the working directory field
- Select the appropriate shell
- Click "Execute"
- View the output in the terminal display area
- Exit code indicates success (0) or failure (non-zero)
Managing Terminal History
- Clear - Click "Clear" to remove all command history
- Download - Click "Download" to save terminal output as a text file
API Integration
Executing Commands
POST /api/terminal/execute
Content-Type: application/json
{
"command": "ls -la",
"cwd": ".",
"shell": "bash"
}
Authentication: Requires session token via cookie or x-api-token header
Rate Limiting: Not configured (low-volume command execution)
CSRF Protection: Required for POST requests
Response:
{
"success": true,
"data": {
"output": "file1.txt\nfile2.py",
"error": "",
"exit_code": 0
}
}
Error Response:
{
"success": false,
"error": "Command timed out"
}
Shell Types:
bash- Standard bash shell commandspython- Python REPL execution (uses python3)node- Node.js JavaScript execution
Timeout: Commands have a 30-second timeout to prevent hanging.
Security Features:
- Command execution with timeout protection
- Working directory isolation
- Process isolation via subprocess
- Error handling for failed commands
- No direct shell access (uses subprocess)
Testing & Verification
Test Bash Command Execution
# First authenticate
curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"token":"your_api_token"}' \
-c /tmp/cookies.txt
# Then test the endpoint
curl -X POST http://localhost:8000/api/terminal/execute \
-H "Content-Type: application/json" \
-b /tmp/cookies.txt \
-d '{"command":"echo hello","cwd":"/path/to/novacoder","shell":"bash"}'
Test Python Command Execution
curl -X POST http://localhost:8000/api/terminal/execute \
-H "Content-Type: application/json" \
-b /tmp/cookies.txt \
-d '{"command":"print(\"hello\")","cwd":"/path/to/novacoder","shell":"python"}'
Test Node.js Command Execution
curl -X POST http://localhost:8000/api/terminal/execute \
-H "Content-Type: application/json" \
-b /tmp/cookies.txt \
-d '{"command":"console.log(\"hello\")","cwd":"/path/to/novacoder","shell":"node"}'
Test Results: All endpoints tested successfully with bash, python, and node. Working directory changes work correctly, output capture and return functioning properly, error handling for invalid commands working, timeout protection prevents long-running commands, and no conflicts with existing systems.
Command History
The terminal maintains a history of executed commands:
- Maximum of 50 commands stored
- Each entry includes:
- Command text
- Shell type
- Output
- Error messages
- Exit code
- Timestamp
Shell Types
Bash
Standard bash shell for executing Unix/Linux commands:
ls -la
pwd
cat file.txt
Python
Python REPL for executing Python code:
print("Hello, World!")
import os
os.listdir('.')
Node.js
Node.js for executing JavaScript code:
console.log("Hello, World!");
const fs = require('fs');
fs.readdirSync('.');
Output Format
Each command execution is displayed with:
[bash] ls -la
2026-07-20T15:30:00.000Z
file1.txt
file2.py
Exit code: 0
Error output is displayed in red:
[bash] invalid_command
2026-07-20T15:31:00.000Z
Error: command not found
Exit code: 127
Technical Details
JavaScript Functions
renderTerminal()
Renders the terminal UI with shell selection and command input.
executeTerminalCommand()
Executes a command via the API and displays the result.
renderTerminalHistory()
Renders the command history in the terminal display area.
clearTerminal()
Clears all command history from the terminal.
downloadTerminalOutput()
Downloads the terminal output as a text file.
Limitations
- No interactive commands (e.g.,
vim,nano) - No command completion or history navigation
- No file upload/download via terminal
- No background process support
- No terminal session persistence
Future Enhancements
- Add interactive command support using xterm.js
- Implement command history navigation (up/down arrows)
- Add tab completion for commands
- Support for background processes
- Implement terminal session persistence
- Add multiple terminal tabs
- Support for SSH connections
- Add command aliases
- Implement command scheduling