@nice-code/commander 0.70.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/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # `@nice-code/commander`
2
+
3
+ Your dev environment, declared once: one typed `commander.config.ts`, one daemon, and one control
4
+ surface shared by a CLI and a live web UI. The replacement for ten terminal tabs, a tmux script, or
5
+ a `concurrently` line that has grown a comment explaining itself.
6
+
7
+ > **Docs:** [nicecode.io](https://nicecode.io/nice-commander/dev-environments/)
8
+
9
+ ```bash
10
+ bun add -d @nice-code/commander
11
+ ```
12
+
13
+ ```ts
14
+ // commander.config.ts
15
+ import { defineCommanderConfig } from "@nice-code/commander/config";
16
+
17
+ export default defineCommanderConfig({
18
+ name: "my-app",
19
+ processes: [
20
+ {
21
+ id: "api",
22
+ run: ["bun", "run", "dev"],
23
+ cwd: "./services/api",
24
+ endpoints: [{ name: "http", protocol: "http", port: 8787, ownership: "exclusive" }],
25
+ ready: { kind: "endpoint", endpoint: "http" },
26
+ },
27
+ { id: "web", run: ["bun", "run", "dev"], cwd: "./apps/web", dependsOn: ["api"] },
28
+ { id: "types", kind: "task", run: ["bunx", "tsc", "--noEmit"], timeoutMs: 120_000 },
29
+ ],
30
+ groups: { dev: { include: ["web"] } },
31
+ defaultSelection: ["dev"],
32
+ });
33
+ ```
34
+
35
+ ```bash
36
+ bunx nice-commander up # `dev` → starts api first, waits for it to be READY, then web
37
+ bunx nice-commander status # live table
38
+ bunx nice-commander ui # the browser view
39
+ bunx nice-commander down dev
40
+ ```
41
+
42
+ Every acting command takes the same selector — ids, group names, or `tag=value` terms (AND across
43
+ terms). `up --dry-run` and `explain` show exactly what would be touched, without touching it.
44
+
45
+ ## What it does that a script does not
46
+
47
+ - **`dependsOn` waits for *ready*, not for *spawned*** — a real readiness contract (port, HTTP,
48
+ log marker), so `web` never starts against an API that is still compiling.
49
+ - **Stopping ends the tree.** Killing `npm run dev`'s pid leaves the actual server holding the
50
+ port; a POSIX process group / Windows Job Object does not.
51
+ - **It never kills a stranger.** An occupied exclusive port is reported with its holder. Only a
52
+ tree this daemon owns and has a ledger record for is reaped.
53
+ - **A broken config keeps the last good one live.** Nothing restarts silently; changed processes
54
+ are marked stale until you restart them.
55
+ - **Merged logs that actually order.** The daemon stamps every line at receipt, so the timeline is
56
+ correct across processes and across daemon restarts — and search runs server-side over the
57
+ on-disk history, not over what your browser happens to be holding.
58
+
59
+ Node ≥ 22 or Bun. The web UI is pre-built into the package; Vite and React are not installed on
60
+ your machine. Built on [`@nice-code/process`](https://www.npmjs.com/package/@nice-code/process).
61
+
62
+ ## Security posture
63
+
64
+ Loopback only. The browser takes a capability from a same-origin bootstrap and keeps it in memory —
65
+ never in a URL, a cookie, or localStorage — and burns a single-use ticket per socket. Process
66
+ output is rendered as text, always. Configured `env` values never reach the realm, the ledger, or a
67
+ log.