@kaynooo/cli-proc 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kaynooo <contact@kaynooo.fr>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,40 @@
1
- # Temporary Holding Version
1
+ # proc
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Three process and port helpers for Linux, reading `/proc` directly instead of shelling out to `ps`, `ss` or `lsof`: `pid` inspects one process, `ports` tells who listens on what, `procs` finds leftover or heavy dev processes.
4
+
5
+ ```sh
6
+ bun install -g @kaynooo/cli-proc
7
+ ```
8
+
9
+ ## Commands
10
+
11
+ | Command | What it does |
12
+ | --- | --- |
13
+ | `pid <pid>` | executable, working directory, command line, parent chain up to init, user, start time and age, memory, open files and limits, the TCP and UDP ports it listens on, cgroup; `--env` adds the environment with secrets masked, `--json` everything |
14
+ | `ports [port]` | the listening sockets (TCP and UDP, IPv4 and IPv6) with port, protocol, bound address, pid, command and working directory; a port Docker publishes shows its compose project and service |
15
+ | `ports <port> --kill` | stops the owner: SIGTERM, and with `--force` SIGKILL after `--grace` (5s); asks on a terminal unless `--yes` |
16
+ | `procs` | leftover or heavy dev processes grouped by origin, with count, total RSS and oldest age |
17
+ | `procs --kill` | a dry run naming what would be stopped; `--yes` sends SIGTERM, then SIGKILL after `--grace` |
18
+
19
+ ## pid
20
+
21
+ A missing pid exits 1. What the calling user cannot read of another user's process (executable, working directory, open files, limits, environment) is left out and named at the end. The environment is off unless `--env` is given: a name that looks like a secret (kit's rule, shared with `ev` and `redact`) has its whole value masked, and a URL password, a well known token format, a private key or a long opaque token is masked inside any value; the command line is masked the same way.
22
+
23
+ ## ports
24
+
25
+ Sockets come from `/proc/net/{tcp,tcp6,udp,udp6}` and are mapped to their owner through the inode in `/proc/<pid>/fd`, so only the calling user's processes show an owner; the others show `-`. A socket without a readable owner, or held by `docker-proxy`, takes the container publishing its port when `docker ps` answers (skipped quietly when docker is missing or its daemon unreachable).
26
+
27
+ `ports <port>` exits 1 when nothing listens there. `--kill` refuses a process of another user, pid 1, this command and its ancestors, and a container's port, for which it prints the `docker stop <container>` to run instead.
28
+
29
+ ## procs
30
+
31
+ A process is listed when it is a dev tool (bun, node, vite, nuxt, next, chromium and chrome, playwright and WebKit browsers and their helpers, language servers, test runners) of the calling user and either:
32
+
33
+ - an orphan: reparented to init or to the user's systemd, outside a systemd service of its own; a browser counts only as a helper (`--type=`) or when a script drives it (`--headless`, `--remote-debugging-*`), and the crashpad handler never, as it detaches by design;
34
+ - heavy: 500M resident or more.
35
+
36
+ The dev processes below a listed one, and those sharing its `--user-data-dir`, are listed with it, so a chromium whose main process was killed groups with its leftover helpers. Groups are named after the git root (else the nearest package manifest) of the working directory under the home folder, the browser profile, or else the command.
37
+
38
+ `--min-mem <size>` (`500M`, `1.5G`, a bare number counting megabytes) sets the heavy bar and the least a left over process must use; `--older <duration>` (`30m`, `2h`, `1d`) keeps the processes at least that old. `--kill` never touches pid 1, shells, terminals, this command and its ancestors, or other users' processes, and counts the ones it left out.
39
+
40
+ Linux only. Start times assume the usual 100 clock ticks per second.