75766dbfdc
- Created CommandPocPage.tsx with basic layout structure - Added POC-specific TypeScript interfaces and types - Implemented basic UI components: PocHeader, PocMessageList, PocMessageBubble, PocCommandInput, PocStatusBar - Added /command-poc route to Router.tsx - Set up component folder structure following PRD specifications 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Python CLI Web Interface POC
A proof-of-concept web interface for running Python CLI applications with real-time input/output interaction.
Features
- Web-based Terminal: Chat-like interface for running Python commands
- Real-time I/O: Bidirectional communication with Python processes
- Interactive Input: Support for Python scripts that require user input
- Process Management: Start, monitor, and kill Python processes
- WebSocket Communication: Low-latency real-time updates
Quick Start
-
Install dependencies:
npm install -
Start the server:
npm start -
Open your browser:
- Navigate to
http://localhost:3000 - The interface will load automatically
- Navigate to
Usage Examples
Basic Python Commands
python --version
python -c "print('Hello World')"
Interactive Scripts
python test-script.py
python simple-calc.py
Test Scripts Included
test-script.py: Demonstrates user input, output streaming, and interactive featuressimple-calc.py: Simple calculator that takes mathematical expressions
How It Works
- Frontend: HTML/CSS/JS interface that looks like a terminal/chat
- WebSocket: Real-time bidirectional communication
- Node.js Backend: Spawns Python processes and manages I/O
- Process Management: Each command runs in its own Python process
Architecture
┌─────────────────┐ WebSocket ┌──────────────────┐ spawn() ┌─────────────┐
│ Web Browser │ ◄─────────────► │ Node.js Server │ ◄──────────► │ Python │
│ (Frontend) │ │ (Backend) │ │ Process │
└─────────────────┘ └──────────────────┘ └─────────────┘
Key Files
server.js- Node.js server with WebSocket supportpublic/index.html- Web interfacepublic/script.js- Frontend JavaScript logicpublic/style.css- Interface stylingtest-script.py- Sample interactive Python script
Development
The POC supports:
- ✅ Running Python commands
- ✅ Real-time output streaming
- ✅ Interactive input handling
- ✅ Process termination
- ✅ Error handling
- ✅ Connection status monitoring
- ✅ Auto-reconnection
Limitations
This is a POC with basic security. For production use, consider:
- Input sanitization
- Process sandboxing
- Authentication/authorization
- Resource limits
- Proper error handling