Metadata-Version: 2.4
Name: portsmith
Version: 0.1.0
Summary: Local port management CLI — list, kill, watch, and snapshot listening ports
Project-URL: Homepage, https://github.com/atharvashashankk/portman
Project-URL: Issues, https://github.com/atharvashashankk/portman/issues
Author-email: Atharva Kokane <atharvashashankkokane@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Atharva Kokane
        
        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.
License-File: LICENSE
Keywords: cli,devtools,network,port,process
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Networking
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: psutil>=5.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.9.0
Description-Content-Type: text/markdown

# portman

A local port management CLI for macOS and Linux.

## Installation

```bash
pip install portman
```

Or install from source:

```bash
git clone <repo>
cd portman
pip install -e .
```

## Commands

### `portman list`

Show all listening ports with PID, process name, port, protocol, and status. System ports (<1024) are highlighted in yellow, user ports in green.

```bash
portman list

# Only show ports opened from this terminal session
portman list --mine

# Machine-readable JSON output
portman list --json
```

> **`--mine` note:** this flag filters to processes running under your OS user account. It removes system services (svchost, lsass, etc.) but will still show other user-owned background apps that happen to listen on ports (e.g. Chrome, cloud sync clients). It correctly catches dev servers started in any shell or terminal window.

### `portman kill <port>`

Kill the process listening on a given port. Asks for confirmation unless `--force` is passed.

```bash
portman kill 8080

# Skip confirmation
portman kill 8080 --force
portman kill 8080 -f
```

### `portman watch`

Live-updating view of all active ports, refreshing every 2 seconds. New ports are highlighted green, closed ports red. Exit with `Ctrl+C`.

```bash
portman watch

# Only watch ports opened from this terminal session
portman watch --mine
```

### `portman save <name>`

Save a snapshot of all currently active user ports (port ≥1024) to `~/.portman/profiles/<name>.json`.

```bash
portman save myproject
portman save dev-stack
```

### `portman restore <name>`

Check a saved profile against currently running ports. Shows which saved processes are still running and which are missing, along with hints for restarting them.

```bash
portman restore myproject
```

### `portman profiles`

List all saved profiles with their creation timestamp and port count.

```bash
portman profiles
```

## Requirements

- Python 3.10+
- macOS or Linux (Windows is not supported)

## Notes

- Ports below 1024 are system ports and may require `sudo` to kill.
- `portman restore` does not restart processes — it only reports their status and suggests what needs to be restarted.
- Profiles are stored in `~/.portman/profiles/` as JSON files.
