Skip to content

Commit 3db3636

Browse files
Justinkarsoclaude
andcommitted
chore: bump all npm packages to 0.3.0 and add CLAUDE.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8b2c7bf commit 3db3636

6 files changed

Lines changed: 67 additions & 9 deletions

File tree

CLAUDE.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Build & Test Commands
6+
7+
```bash
8+
cargo build # Dev build
9+
cargo build --release # Release build (LTO, stripped)
10+
cargo test # Run all tests (unit + integration)
11+
cargo test <test_name> # Run a single test
12+
cargo clippy -- -D warnings # Lint (CI enforces zero warnings)
13+
cargo fmt --check # Check formatting (CI enforces)
14+
cargo fmt # Auto-format
15+
```
16+
17+
Integration tests use `ListenerGuard` (in `tests/helpers/mod.rs`) to bind real TCP ports, so tests exercise actual OS port scanning.
18+
19+
## Architecture
20+
21+
```
22+
CLI parsing (main.rs, cli.rs)
23+
24+
Command layer (commands/{kill,list,watch,free,wait,completions}.rs)
25+
26+
PortScanner trait (scanner.rs)
27+
28+
Platform implementations (platform/{macos,linux,windows}.rs)
29+
30+
OS APIs (libproc on macOS, procfs on Linux)
31+
```
32+
33+
**Key patterns:**
34+
- `scanner::create_scanner()` is a factory that returns the platform-specific `Box<dyn PortScanner>` via conditional compilation
35+
- `process.rs` holds shared types: `ProcessInfo`, `KillSignal`, `KillResult`, `PortSpec`, `WaitCondition`
36+
- `output.rs` handles Table/JSON/Plain formatting — human messages go to stderr, structured data to stdout
37+
- `killer.rs` implements graceful shutdown: SIGTERM → poll → SIGKILL escalation
38+
- `cli.rs` defines clap structs; `main.rs` converts CLI enums to internal types (e.g., `convert_signal`, `convert_format`)
39+
- Long-running commands (`watch`, `wait`) use `signal_hook` with `Arc<AtomicBool>` for SIGINT/SIGTERM handling
40+
- The `tui.rs` module is a self-contained ratatui app with its own event loop, theming, and config persistence
41+
42+
**Config:** stored at `~/.config/portzap/config.toml` (theme, confirmation dialog, animation duration).
43+
44+
## NPM Distribution
45+
46+
The `npm/` directory contains platform-specific packages (`@portzap/{platform}-{arch}`) and a wrapper package. The release workflow (`.github/workflows/release.yml`) builds binaries, copies them into npm package dirs, and publishes to both npm and crates.io on git tags matching `v*`.
47+
48+
## CI
49+
50+
Runs on push/PR: `cargo test`, `cargo clippy -- -D warnings`, `cargo fmt --check` on both macOS and Ubuntu.
51+
52+
## MSRV
53+
54+
Minimum supported Rust version: **1.74** (set in `Cargo.toml`).
55+
56+
## Windows
57+
58+
The Windows platform scanner (`platform/windows.rs`) and killer are stubs returning "not yet implemented" errors. macOS and Linux are fully implemented.

npm/portzap-darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@portzap/darwin-arm64",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "portzap binary for macOS ARM64 (Apple Silicon)",
55
"license": "MIT",
66
"os": ["darwin"],

npm/portzap-darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@portzap/darwin-x64",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "portzap binary for macOS x64 (Intel)",
55
"license": "MIT",
66
"os": ["darwin"],

npm/portzap-linux-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@portzap/linux-arm64",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "portzap binary for Linux ARM64",
55
"license": "MIT",
66
"os": ["linux"],

npm/portzap-linux-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@portzap/linux-x64",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "portzap binary for Linux x64",
55
"license": "MIT",
66
"os": ["linux"],

npm/portzap/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "portzap",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "A fast, cross-platform port management tool. Kill, list, and watch processes on network ports.",
55
"license": "MIT",
66
"bin": {
@@ -11,10 +11,10 @@
1111
"README.md"
1212
],
1313
"optionalDependencies": {
14-
"@portzap/darwin-arm64": "0.2.1",
15-
"@portzap/darwin-x64": "0.2.1",
16-
"@portzap/linux-x64": "0.2.1",
17-
"@portzap/linux-arm64": "0.2.1"
14+
"@portzap/darwin-arm64": "0.3.0",
15+
"@portzap/darwin-x64": "0.3.0",
16+
"@portzap/linux-x64": "0.3.0",
17+
"@portzap/linux-arm64": "0.3.0"
1818
},
1919
"keywords": [
2020
"port",

0 commit comments

Comments
 (0)