@4pm/cli 1.2.2 → 1.2.4

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.
Files changed (4) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +40 -20
  3. package/dist/index.js +483 -5326
  4. package/package.json +2 -1
package/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ 4PM CLI — Source-Available License (All Rights Reserved)
2
+
3
+ Copyright (c) 2026 4PM. All rights reserved.
4
+
5
+ This source code is made publicly viewable for transparency and security auditing
6
+ only. It is NOT open source and NOT free software.
7
+
8
+ You ARE permitted to:
9
+ - View and read this source code.
10
+ - Audit it for security and correctness.
11
+
12
+ You are NOT permitted, without a separate prior written agreement from the
13
+ copyright holder, to:
14
+ - Use, run, or execute this source (other than the official distributions —
15
+ the `@4pm/cli` npm package and the official container images — under their
16
+ own terms);
17
+ - Copy, modify, adapt, translate, or create derivative works;
18
+ - Redistribute, sublicense, sell, or otherwise make the source available; or
19
+ - Remove or alter this notice.
20
+
21
+ Contributions are accepted only under a separate Contributor License Agreement.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
25
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
26
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
27
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+
30
+ Licensing inquiries: hiroshi.kaze1994@gmail.com
package/README.md CHANGED
@@ -1,32 +1,52 @@
1
- # @4pm/cli
1
+ # 4PM CLI (`@4pm/cli`)
2
2
 
3
- **An agent running on the worker machine** — receives commands from `@4pm/server` over WebSocket and orchestrates
4
- the AI CLIs (`claude` / `codex`) plus other tools (`git`, `gh`, `glab`, `shell`).
5
- Node ESM + TypeScript.
3
+ **The agent that runs on a 4PM worker machine.** It pairs with the 4PM server, opens an
4
+ encrypted WebSocket, and orchestrates the AI CLIs (`claude` / `codex`) plus `git` / `gh` /
5
+ `glab` / shell on your machine — streaming their output back to the 4PM dashboard.
6
6
 
7
- Lifecycle: **pairing** with the server via a hashcode (the `.cre` file) → request a `ws_token` → open a
8
- TLS WebSocket → receive commands → **spawn child processes**, gather the output (backpressure) back to the
9
- server. Multiple instances on one machine use separate profiles, and the server groups them into one **worker**.
7
+ > **This repository is the public, source-available mirror of the 4PM CLI.** It is published
8
+ > for transparency and security auditing — you run an agent that spawns processes and uses
9
+ > your git credentials locally, so you can read exactly what it does. It is **not** open
10
+ > source: see [`LICENSE`](./LICENSE) (source-available, all rights reserved).
11
+
12
+ ## Install (users)
10
13
 
11
14
  ```bash
12
- pnpm --filter @4pm/cli dev
15
+ npm i -g @4pm/cli # official distribution (npm)
16
+ 4pm link # pair with your 4PM server, then:
17
+ 4pm start # run the worker
13
18
  ```
14
19
 
15
- ## Run as a container (ADR-0192)
20
+ Container images are published to `ghcr.io/4azuo/4pm-cli`. Configuration is via `4pm link`
21
+ + the profile's `config.json`; environment variables are documented in
22
+ [`.env.example`](./.env.example).
23
+
24
+ > **Security note:** use an `https://` server URL in production. The WebSocket session
25
+ > encryption (ephemeral ECDH) protects confidentiality but does **not** authenticate the
26
+ > server — TLS does. Connecting over plaintext to a non-local host emits a warning.
27
+
28
+ ## Build from source
16
29
 
17
- Package the cli as a Docker image — the **container is the OS sandbox** (one cli per container).
18
- Build + run + pair (full runbook: [`11-docs/41-guides/0015-cli-container.md`](../../11-docs/41-guides/0015-cli-container.md)):
30
+ The repository is standalone — it needs no other 4PM code. The `@4pm/*` shared packages are
31
+ provided as a trimmed, vendored subset under [`vendor/`](./vendor) (only the code the CLI
32
+ actually uses; server-internal types are excluded).
19
33
 
20
34
  ```bash
21
- docker build -f 31-docker/cli.Dockerfile --target full -t 4pm-cli:full . # base = cli only
22
- FOURPM_SERVER=https://app.example docker compose -f 31-docker/docker-compose.cli.yml run --rm cli link # pair once
23
- FOURPM_SERVER=https://app.example docker compose -f 31-docker/docker-compose.cli.yml up -d # run headless
24
- docker compose -f 31-docker/docker-compose.cli.yml exec cli 4pm attach # TUI (optional)
35
+ pnpm install
36
+ pnpm build # → dist/index.js (self-contained bundle)
37
+ pnpm typecheck
25
38
  ```
26
39
 
27
- Headless (ECS/pool): boot with `FOURPM_PAIR_TOKEN` (a provisioning token) ⇒ the cli self-pairs, no
28
- interactive step (ADR-0192 §6). In a container the in-process auto-update is moot — redeploy a new
29
- image tag instead.
40
+ ## How this repo relates to 4PM
41
+
42
+ The 4PM CLI is developed inside the private 4PM monorepo and embedded there as a git
43
+ submodule. The `vendor/` subset is generated from the monorepo's shared packages by
44
+ `scripts/vendor-shared.mjs`; do not hand-edit it. Releases are built and signed from the
45
+ monorepo and published here (npm + GitHub Release tarball + GHCR image).
46
+
47
+ ## Layout
30
48
 
31
- > Code organization, conventions & what's missing: [`CLAUDE.md`](./CLAUDE.md).
32
- > The cli behavior spec: [`11-docs/61-cli/`](../../11-docs/61-cli/README.md).
49
+ - `src/core/` — orchestration; `src/commands/` — subcommands (`link`/`start`/`attach`/…).
50
+ - `src/services/` — server REST calls; `src/ui/` — the Ink TUI (`4pm start` on a TTY).
51
+ - `src/common/`, `src/utils/`, `src/config/` — shared helpers, pure functions, config.
52
+ - `vendor/@4pm/*` — generated trimmed shared subset (see above).