📝 Note: SSL certificates for localhost are automatically generated on first run. No manual certificate configuration needed for local development.
LIPC is a modern web-based IDE and file management system built with PHP Swoole and Node.js. It combines a high-performance WebSocket server with a pseudo-terminal (PTY) interface, providing a complete development environment accessible through a web browser.
The system features:
- Real-time code editing with Monaco Editor
- AI-powered code completion using GitHub Copilot integration
- Integrated terminal sessions via WebSocket
- File management with compression/decompression support
- Code refactoring and formatting tools
- PHP IntelliSense with code analysis and symbol resolution
- Multi-tab editing with persistent sessions
- Language: PHP 8.1+
- Runtime/Extension: Swoole (WebSocket server, coroutines)
- Package Manager: Composer
- Dependencies:
nikic/php-parser- PHP code parsing and analysissymfony/translation-contracts- Translation supportvarunsridharan/php-classmap-generator- Classmap generationsoyhuce/classmap-generator- Classmap generation
- Dev Dependencies:
phpstan/phpstan- Static analysis tool
- Runtime: Node.js 18+
- Package Manager: npm
- Dependencies:
ws- WebSocket servernode-pty- Pseudo-terminal sessionsexpress- HTTP server frameworkpuppeteer- Headless browser automationpuppeteer-core- Puppeteer core without bundled browserpuppeteer-extra+puppeteer-extra-plugin-stealth- Enhanced Puppeteer with stealth mode
- Monaco Editor - VS Code-like editor
- jQuery - DOM manipulation
- Xterm.js - Terminal emulator
- Bootstrap - UI framework
- Custom themes: Nightfall, PHPStorm-inspired
server.php- Supervisor process that restarts middleware in a loopmiddleware.php- Main Swoole WebSocket server- Loads config from
plugins/configInterface.json - Starts WebSocket server on configured host/port (default: 0.0.0.0:8080)
- Auto-spawns Node PTY service on port 6060
- Hooks plugin handlers:
\plugins\server::open,::message,\plugins\Start\server::start,\plugins\Request\server::request
- Loads config from
pty.js- PTY WebSocket server (port 6060)- Manages one shell session per WebSocket client
- Persists terminal IDs in
terminals.json - Session files stored in
files/
gpt.js- Puppeteer-based service (port 3090)- AI/GPT integration for code refactoring
index.html- Main application entry pointplugins/Request/modules/modalEditCode.html- Code editor interface with:- Multi-tab file editing
- AI-powered autocomplete
- Integrated terminal
- File tree browser
- PHP 8.1+ (CLI)
- Swoole extension (matching your PHP version)
- Composer
- Node.js 18+ and npm
- Git (for
importGitfunctionality)
# Check PHP version
php -v
# Check Swoole extension
php -m | grep swoole
# Check Node.js version
node -vgit clone <repository-url>
cd lipccomposer installnpm installSSL certificates for localhost are automatically generated on first run. No manual configuration needed for local development.
For production, update certificate paths in plugins/configInterface.json.
{
"host": "0.0.0.0",
"port": 8080,
"ssl": ".",
"serverSettings": {
"worker_num": 1,
"max_request": 20000000,
"max_coroutine": 20000000,
"enable_coroutine": true,
"open_http2_protocol": true,
"ssl_cert_file": "fullchain.pem",
"ssl_key_file": "privkey.pem"
}
}host- Server bind address (default:0.0.0.0)port- WebSocket server port (default:8080)ssl- Path to SSL certificate directoryautoload- Plugin directories to autoloadallowExtensions- MIME types for static file servingserverSettings- Swoole server configuration
Terminal 1 - PHP Swoole Server:
php server.phpThis starts the supervisor that auto-restarts the middleware on crashes.
Terminal 2 - Node PTY Server:
node pty.jsProvides terminal sessions on port 6060.
Terminal 3 (Optional) - GPT Service:
node gpt.jsProvides AI refactoring on port 3090.
Use a process manager like systemd, supervisor, or pm2:
# PM2 example
pm2 start server.php --interpreter php --name lipc-server
pm2 start pty.js --name lipc-pty
pm2 start gpt.js --name lipc-gpt
pm2 saveOnce running, access the application at:
- HTTP:
http://localhost:8080 - HTTPS:
https://localhost:8080(if SSL configured)
No custom scripts defined. Standard commands:
composer install # Install dependencies
composer update # Update dependencies
composer dump-autoload # Regenerate autoloaderNo custom scripts defined. Standard commands:
npm install # Install dependencies
npm update # Update dependenciesphp server.php # Start supervised server
php middleware.php # Start middleware directly (no supervision)
node pty.js # Start PTY server
node gpt.js # Start GPT service# PHPStan static analysis
vendor/bin/phpstan analyse
# Generate PHP stubs
php stubGen.php
# Format PHP code
php formatter.php <file>Currently, configuration is read from JSON files. The following environment variables could be implemented (TODO):
APP_HOST=0.0.0.0 # Override host
APP_PORT=8080 # Override port
SSL_CERT_FILE=fullchain.pem # SSL certificate path
SSL_KEY_FILE=privkey.pem # SSL key path| Service | Port | Configurable | Description |
|---|---|---|---|
| Swoole WebSocket | 8080 | Yes (configInterface.json) | Main application server |
| Node PTY | 6060 | No (hardcoded) | Terminal sessions |
| GPT Service | 3090 | No (hardcoded) | AI refactoring |
The system exposes numerous endpoints under plugins/Request/apps/:
/getFile- Retrieve file contents/newFile- Create new file/directory/deleteFile- Delete single file/deleteMultipleFiles- Batch delete/renameItem- Rename file/directory/uploadFile- Upload files/downloadFile- Download files/cutCopy- Cut/copy operations/syncPath- List directory contents with caching
/compressMultipleFiles- Create archives/decompressFile- Extract archives/getArchiveDetails- View archive contents
/codex- AI code completion (GitHub Copilot)/codeGenerate- Generate IntelliSense data/phpParser- Parse PHP code structure/refactorFile- Format/refactor code/searchInFile- Search file contents
/stub- Generate PHP stubs/treeDetails- Directory tree structure/freeRam- Memory usage statistics/checkToken- Validate session tokens
-
Refactored suggestion system with:
- 7 reusable helper functions
- Eliminated ~150 lines of duplicate code
- Modern JavaScript (const/let, template literals, optional chaining)
-
Performance optimizations:
- Suggestion caching (5-minute TTL)
- Request cancellation (AbortController)
- Cache size limiting (50 entries max)
- ~70% reduction in API calls
-
Multiple suggestions support:
- Returns 3 AI suggestions per request
- Keyboard navigation (Alt+] next, Alt+[ previous)
- Visual indicator
[1/3] - Better suggestion quality (temperature: 0.2, top_p: 0.95)
-
Bug fixes:
- Fixed Ctrl+Z undo functionality
- Improved history management (LIFO stack)
- Better error handling with specific messages
- Replaced memory-intensive
ducommand with cached approach - Results cached for 2 minutes in
$GLOBALS - Reduced RAM usage by ~80% for large directories
- Script:
run-tests.php- Custom validation script - Run:
php run-tests.php - Checks performed:
- PHP syntax validation (all
.phpfiles) - JSON configuration validation (
composer.json,plugins/configInterface.json) - Plugin directory structure verification
- Composer installation and dependencies check
- Main files existence check (
server.php,middleware.php,plugins/autoload.php)
- PHP syntax validation (all
- Output: Generates
fixs.jsonwith suggested fixes for any issues found
- Tool: PHPStan
- Run:
vendor/bin/phpstan analyse - Config:
phpstan.neon
- Status: No tests configured
- TODO: Add test framework (Jest, Mocha, etc.)
lipc/
├── server.php # PHP supervisor
├── middleware.php # Swoole WebSocket server
├── pty.js # Node PTY WebSocket server
├── gpt.js # Puppeteer GPT service
├── index.html # Main application page
├── composer.json # PHP dependencies
├── package.json # Node dependencies
├── plugins/
│ ├── configInterface.json # Main configuration
│ ├── autoload.php # Plugin autoloader
│ ├── Request/ # HTTP request handlers
│ │ ├── apps/ # API endpoints (30+ files)
│ │ ├── components/ # Reusable UI components
│ │ ├── modules/ # Feature modules
│ │ ├── router/ # Route definitions
│ │ ├── template/ # Page templates
│ │ └── views/ # View renderers
│ ├── Start/ # Startup utilities
│ ├── Utils/ # Helper utilities
│ ├── Database/ # Database helpers
│ ├── Extension/ # Plugin extensions
│ ├── OpenConnection/ # WebSocket handlers
│ └── Message/ # Message processors
├── css/ # Stylesheets
├── js/ # JavaScript files
├── img/ # Images
├── files/ # PTY session working directory
├── vendor/ # Composer dependencies
├── node_modules/ # Node dependencies
└── terminals.json # Active terminal IDs
Certificate files (SSL/TLS):
├── fullchain.pem
├── privkey.pem
├── chain.pem
├── cert.pem
├── server.crt
├── server.key
├── localhost.crt
└── localhost.key
-
Check Swoole extension:
php -m | grep swoole -
Test port availability:
netstat -tulpn | grep 8080 netstat -tulpn | grep 6060
-
View Swoole logs:
tail -f /tmp/swoole.log # If configured -
Monitor PTY sessions:
cat terminals.json ls -la files/
Server won't start:
- Ensure port 8080 is available
- Verify Swoole extension is loaded
- Check file/directory write permissions
PTY not working:
- Confirm port 6060 is available
- Check
terminals.jsonwrite permissions - Verify
files/directory is writable
AI suggestions not working:
- Check GitHub Copilot token in
codex.php - Verify network connectivity
- Review browser console for errors
-
Do not commit production secrets
- Keep sensitive data out of version control
- Use environment variables for secrets in production
-
SSL/TLS Certificates
- Localhost certificates are auto-generated for development
- For production: use proper certificates (Let's Encrypt, etc.)
- Keep certificate files secure with proper permissions (600 for keys)
-
File Access
- Application has full filesystem access
- Implement proper access controls in production
- Consider chroot/containerization
-
Authentication
- Current token system is basic
- Implement robust authentication for production
- Add rate limiting for API endpoints
-
Code Execution
- PTY sessions allow command execution
- Restrict user permissions appropriately
- Monitor for suspicious activity
TODO: Add comprehensive security layer with:
- User authentication system
- Role-based access control (RBAC)
- API rate limiting
- Audit logging
- Input validation/sanitization
Adjust in plugins/configInterface.json:
{
"serverSettings": {
"worker_num": 4,
"max_request": 20000000,
"max_coroutine": 20000000,
"enable_coroutine": true,
"package_max_length": 2147483648,
"socket_buffer_size": 2147483648
}
}Key settings:
worker_num- Number of worker processes (match CPU cores)max_request- Requests before worker restartmax_coroutine- Max concurrent coroutinesenable_coroutine- Enable coroutine modepackage_max_length- Max package size (2GB)socket_buffer_size- Socket buffer size (2GB)
- Cache is limited to 50 entries per feature
- File size calculations cached for 2 minutes
- Suggestion cache expires after 5 minutes
- Minimum: 2 CPU cores, 4GB RAM
- Recommended: 4+ CPU cores, 8GB+ RAM
- Storage: SSD recommended for file operations
No license file found.
TODO: Add a LICENSE file to clarify usage rights. Common options:
- MIT License (permissive)
- Apache License 2.0 (permissive with patent grant)
- GPL v3 (copyleft)
- Proprietary/Commercial
TODO: Add CONTRIBUTING.md with guidelines for:
- Code style (PSR-12 for PHP)
- Commit message format
- Pull request process
- Issue reporting
Future improvements:
- Add comprehensive test suite (PHPUnit, Jest)
- Implement user authentication system
- Add role-based access control
- Environment variable configuration
- Docker/container support
- Plugin marketplace
- Real-time collaboration features
- Mobile-responsive interface
- Theme customization
- Language server protocol (LSP) support
- Git integration UI
- Database GUI
- API documentation (OpenAPI/Swagger)
- ✨ Refactored code editor with 7 helper functions
- ⚡ Added suggestion caching (5-minute TTL)
- ⚡ Implemented request cancellation (AbortController)
- ⚡ Optimized file size calculation with 2-minute cache
- 🐛 Fixed Ctrl+Z undo functionality
- ✨ Added multiple suggestions (3 per request)
- ✨ Keyboard navigation for suggestions (Alt+[ / Alt+])
- 📝 Improved code quality and reduced duplication (~150 lines)
- 📝 Updated README with comprehensive documentation
- Initial implementation of Swoole WebSocket server
- Monaco Editor integration
- PTY terminal sessions
- GitHub Copilot code completion
- PHP IntelliSense with symbol resolution
- File management with compression support
Generated: 2025-12-05 Version: 1.0.0 Status: Active Development