Metadata-Version: 2.4
Name: portviz
Version: 1.0.0
Summary: Windows-based real-time port inspection CLI tool
Author: Aadish Sonawane
License: MIT License
        
        Copyright (c) 2026 Aadish Sonawane
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yourusername/portviz
Project-URL: Repository, https://github.com/yourusername/portviz
Keywords: ports,network,cli,windows,monitoring,netstat,inspection
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: Microsoft :: Windows
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Topic :: System :: Networking
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rich>=13.0.0
Requires-Dist: platformdirs>=3.0.0
Requires-Dist: pyfiglet>=0.8
Dynamic: license-file

# Portviz  
**Cross-Platform Port & Process Manager for Developers**

Portviz is a developer-focused utility designed to inspect active network ports, identify the processes bound to them, and safely terminate processes without relying on complex system commands.

It simplifies debugging scenarios like “Address already in use” errors by providing structured, readable port information and streamlined process control.

---

## 🚀 Vision

Portviz is being built in structured phases:

- Core cross-platform port inspection engine (Python)
- CLI utility for fast terminal usage
- VS Code extension for in-editor visibility and control
- Project-level service and port orchestration layer

The long-term goal is to create a modular developer utility that integrates seamlessly into modern development workflows.

---

## 🎯 Problem It Solves

During development:

- Servers may crash but keep ports occupied
- “Port already in use” errors interrupt workflow
- Identifying and killing processes requires OS-specific commands
- Managing multiple services across different ports becomes difficult

Examples:

- macOS/Linux → `lsof -i :3000` + `kill -9 <PID>`
- Windows → `netstat -ano` + `taskkill /PID <PID>`

Portviz abstracts these differences and provides a consistent interface.

---

## 🏗 Architecture Overview

Portviz follows a layered architecture:

### 1️⃣ Core Engine (Python)
- Detects operating system
- Executes system networking commands
- Parses raw command output
- Normalizes port data into structured objects
- Handles safe process termination

### 2️⃣ CLI Layer
- Displays structured port table
- Assigns custom IDs for safe termination
- Simplifies kill operations
- Supports filtered views (e.g., LISTEN state)

### 3️⃣ VS Code Extension (Planned)
- Sidebar port viewer
- Refresh button
- One-click process termination
- IDE workflow integration

This modular design ensures the engine can be reused across CLI tools and IDE integrations.

---

## 🧠 How It Works

1. Detect OS (Windows/macOS/Linux)
2. Execute appropriate system command:
   - `lsof -i -P -n`
   - `netstat -ano`
3. Capture raw output
4. Parse into structured objects:
   - Port
   - PID
   - Process name
   - Protocol
   - Address
   - State
5. Return normalized data
6. Allow safe process termination via PID mapping

---

## 📦 Features

- Cross-platform port inspection
- LISTEN port filtering
- PID-based safe termination
- Structured port object normalization
- OS abstraction layer
- Modular reusable core engine

---

## 🔮 Future Enhancements

### Project-Level Service Management
- Workspace-based service configuration
- Define service name, port, start command, dependencies, and type
- One-click startup of all project services
- Real-time service health monitoring
- Port conflict detection

### Service Topology Visualization
- Visual representation of frontend–backend–database architecture
- Live service status indicators
- Traffic flow tracking (where possible)

### Developer Experience Improvements
- Interactive CLI mode
- Auto-refresh/watch mode
- Docker container awareness
- IPv4/IPv6 normalization
- Permission safety checks
- Performance optimizations

---

## 🧩 Example Future Configuration (Conceptual)

Portviz may support project-level configuration such as:

Frontend  
- Port: 5173  
- Command: `npm run dev`

Backend  
- Port: 8000  
- Command: `nodemon server.js`

Database  
- Port: 5432  
- External service (no start command)

This would allow Portviz to function as a lightweight local development orchestrator inside VS Code.

---

## 🔧 Tech Stack

- Python  
- OS-level Networking Utilities (`lsof`, `netstat`)  
- Subprocess-based Process Management  
- Cross-Platform OS Detection  
- CLI Architecture  
- VS Code Extension API (Planned)  
- Node.js Integration (Planned)  

---

## 📌 Project Status

Currently in active development.

Phase 1 focuses on building a robust, reusable port inspection engine.  
CLI and VS Code integration layers will be built on top of the core module.

---

## 📈 Long-Term Scope

- Publish as a pip package
- npm wrapper for JavaScript ecosystem
- VS Code Marketplace extension
- Project-level service orchestration
- Local architecture visualization
- Advanced developer workflow tooling

---

## 📄 License

This project is licensed under the MIT License.
