@kaynooo/cli-proc 0.8.0 → 0.8.2
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/README.md +2 -2
- package/dist/proc-cli.js +676 -398
- package/package.json +3 -3
- package/src/pid.ts +3 -3
- package/src/ports.ts +3 -4
- package/src/procs.ts +3 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-proc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"description": "proc: one process inspected, who listens on a port, and leftover or heavy dev processes cleaned, read straight from /proc (Linux).",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"registry": "https://git.kaynooo.fr/api/packages/kaynooo/npm/"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "$npm_execpath build src/proc-cli.ts --target bun --outdir dist",
|
|
28
|
+
"build": "$npm_execpath build src/proc-cli.ts --target bun --outdir dist && $npm_execpath ../../scripts/shell-shebang.ts",
|
|
29
29
|
"proc": "$npm_execpath src/proc-cli.ts"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@kaynooo/cli-kit": "0.
|
|
32
|
+
"@kaynooo/cli-kit": "0.46.4"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/pid.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { maskArgs, maskEnviron } from './mask'
|
|
|
7
7
|
import { parseCgroup, parseEnviron, parseLimits, parseStat, parseStatus, statusBytes } from './parse'
|
|
8
8
|
import { bootMs, fdCount, readProc, readSockets, readText, socketsOf, userName } from './read'
|
|
9
9
|
|
|
10
|
-
const usage = `proc pid <pid
|
|
10
|
+
const usage = `proc pid <pid>: shows what a process is, from its executable and command line to its parent chain, memory, open files, listening ports and cgroup
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
The environment is not shown unless --env is given, with every
|
|
12
|
+
Everything is read from \`/proc\`; what the calling user cannot read of another user's process is left out and named at the end.
|
|
13
|
+
The environment is not shown unless --env is given, with every secret masked.`
|
|
14
14
|
const EXITS: ExitRow[] = [[0, 'it showed the process'], [1, 'no process has this pid'], [2, 'a usage error']]
|
|
15
15
|
|
|
16
16
|
const DIGITS = /^\d+$/
|
package/src/ports.ts
CHANGED
|
@@ -10,11 +10,10 @@ import { protectionOf, terminate } from './kill'
|
|
|
10
10
|
import { maskArgs } from './mask'
|
|
11
11
|
import { ancestry, readSockets, snapshot, socketOwners } from './read'
|
|
12
12
|
|
|
13
|
-
const usage = `proc ports [port]
|
|
13
|
+
const usage = `proc ports [port]: lists what listens on this machine, one row per port with its owning process, command and working directory
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
\`proc ports <port
|
|
17
|
-
\`proc ports <port> --kill\` stops its owner with SIGTERM, and with --force SIGKILL once --grace has passed, after asking on a terminal unless --yes is given. It refuses processes of other users, pid 1, this command and its ancestors, and docker-proxy, for which it names the container to stop instead.`
|
|
15
|
+
A port Docker publishes shows as its compose project and service; the owner of another user's socket shows as -. \`proc ports <port>\` keeps that port alone and exits 1 when nothing listens on it.
|
|
16
|
+
\`proc ports <port> --kill\` stops its owner, after asking on a terminal unless --yes is given. It refuses processes of other users, pid 1, this command and its ancestors, and docker-proxy, for which it names the container to stop instead.`
|
|
18
17
|
const EXITS: ExitRow[] = [[0, 'it listed or stopped'], [1, 'nothing listens on the given port or the owner could not be stopped'], [2, 'a usage error']]
|
|
19
18
|
|
|
20
19
|
const options = {
|
package/src/procs.ts
CHANGED
|
@@ -9,11 +9,10 @@ import { maskArgs } from './mask'
|
|
|
9
9
|
import { ancestry, snapshot } from './read'
|
|
10
10
|
import { selectGroups } from './select'
|
|
11
11
|
|
|
12
|
-
const usage = `proc procs
|
|
12
|
+
const usage = `proc procs: lists the calling user's leftover or heavy dev processes, grouped by project folder, browser profile or command
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
\`--kill\` is a dry run that names what it would stop unless --yes is given; it sends SIGTERM, then SIGKILL after --grace to what is still there. It never signals pid 1, shells, terminals, this command and its ancestors, or processes of other users.`
|
|
14
|
+
A process is listed when it is a dev tool (bun, node, vite, chromium, playwright, language servers, test runners) and either an orphan, reparented to init or to the user's systemd, or heavy (500M resident by default); the processes below it and those sharing its browser profile come with it.
|
|
15
|
+
\`--kill\` is a dry run that names what it would stop unless --yes is given. It never signals pid 1, shells, terminals, this command and its ancestors, or processes of other users.`
|
|
17
16
|
const EXITS: ExitRow[] = [[0, 'it listed or stopped everything'], [1, 'a process survived SIGKILL'], [2, 'a usage error']]
|
|
18
17
|
|
|
19
18
|
const options = {
|