@4ort/cli 0.8.5 → 0.8.6

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/dist/index.js CHANGED
@@ -34,7 +34,7 @@ const program = new Command();
34
34
  program
35
35
  .name("4ort")
36
36
  .description("Unified CLI for the 4ort ecosystem — hosting, knowledge graph, and more")
37
- .version("0.8.5");
37
+ .version("0.8.6");
38
38
  // ─────────────────────────────────────────────────────────────────────
39
39
  // 4ort.net subdomain hosting
40
40
  // ─────────────────────────────────────────────────────────────────────
package/docs/MCP.md ADDED
@@ -0,0 +1,77 @@
1
+ # 🧠 `4ort mcp` — Run the CLI as an MCP server
2
+
3
+ `@4ort/cli` is **both a CLI and an MCP server** in the same binary. Every
4
+ subcommand surface (`kg`, `mov`, `web`, `vault run`, etc.) becomes an MCP tool
5
+ when the CLI is launched in MCP mode — so any MCP-speaking agent gets the
6
+ entire galaxy toolkit for free, without re-implementing anything.
7
+
8
+ ## Two modes
9
+
10
+ ```bash
11
+ 4ort mcp stdio # local: pipe to a Claude/agent runner via stdin/stdout
12
+ 4ort mcp serve # network: expose the MCP server over HTTP (for remote agents)
13
+ ```
14
+
15
+ ## stdio mode (most common)
16
+
17
+ Wire the CLI as an MCP server in a Claude Desktop / Claude Code / Cursor / any
18
+ MCP client config. Example (Claude Code-style):
19
+
20
+ ```jsonc
21
+ {
22
+ "mcpServers": {
23
+ "4ort": {
24
+ "command": "4ort",
25
+ "args": ["mcp", "stdio"]
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ The agent will discover tools like:
32
+ - `4ort.kg.search`, `4ort.kg.ask`, `4ort.kg.entity`, `4ort.kg.match`,
33
+ `4ort.kg.popularity`, `4ort.kg.trending`, `4ort.kg.agent-context`,
34
+ `4ort.kg.article-context`
35
+ - `4ort.mov.publish`, `4ort.mov.render`, `4ort.mov.list`
36
+ - `4ort.web.get`
37
+ - `4ort.search` (smart router)
38
+ - `4ort.run` (vault-resolved subprocess)
39
+
40
+ Identity is the CLI's existing `~/.4ort/config.json` — whichever keys you've
41
+ configured (4ort.net, kg, vault) flow through to the agent.
42
+
43
+ ## serve mode (network)
44
+
45
+ For remote agents or shared infrastructure:
46
+
47
+ ```bash
48
+ 4ort mcp serve --port 8080
49
+ ```
50
+
51
+ Exposes the same tool surface over HTTP transport. Pair with reverse-proxy +
52
+ auth as needed (the CLI itself doesn't add network auth — bring your own).
53
+
54
+ ## Where this fits in the galaxy
55
+
56
+ - **Mission Control panels (ADR-0002 MCP-as-panels)** — the 4ort.ai agent can
57
+ call `4ort.kg.*` and `4ort.mov.*` tools directly via this surface; sidebar
58
+ panels render the results.
59
+ - **The code-command sandbox** ships `@4ort/cli` baked into the image so every
60
+ spawned agent has these tools natively, no MCP wiring needed inside the
61
+ sandbox itself.
62
+ - **The future "MCP Uplink"** property (galaxy plan
63
+ `plans/MCP_UPLINK_PLAN.md`) mounts `@4ort/cli` alongside open MCP servers
64
+ (Gmail, Slack, GitHub, etc.) into a unified MCP gateway.
65
+
66
+ ## Composing with the vault
67
+
68
+ `4ort run` is also exposed as an MCP tool — meaning an agent can ask the CLI to
69
+ **run a subprocess with vault-resolved secrets** without ever seeing the raw
70
+ values. Great for "run my SQL migration with the prod DB password" workflows
71
+ where the agent should never touch the secret.
72
+
73
+ ## Versioning / surface stability
74
+
75
+ The MCP tool names and schemas track the CLI's commander.js definitions
76
+ directly. When a new subcommand lands in the CLI, it's available as an MCP
77
+ tool in the next published version (`npm install -g @4ort/cli@latest`).
package/docs/MOV.md ADDED
@@ -0,0 +1,136 @@
1
+ # 🎬 `4ort mov` — Publishing video to 4ort.mov
2
+
3
+ Since `@4ort/cli@0.6.0` (`publish`) + `0.7.0` (`render`). Two complementary
4
+ flows for getting video onto the galaxy's PeerTube host (4ort.mov).
5
+
6
+ ## Setup
7
+
8
+ ```bash
9
+ # one-time: mint your OWN 4ort.mov account + render token, then sign in with it
10
+ 4ort provision run video
11
+ 4ort mov login --provisioned
12
+
13
+ # or sign in to an existing account interactively / non-interactively
14
+ 4ort mov login # prompts for username + password
15
+ 4ort mov login -u <user> -p <pass> # non-interactive (agents/CI; or env
16
+ # FORT_MOV_USERNAME / FORT_MOV_PASSWORD)
17
+ ```
18
+
19
+ All credentials persist to `~/.4ort/config.json` (mode `0600`). The CLI
20
+ authenticates via PeerTube's OAuth on `/api/*`, so it never needs a separate
21
+ site/gate credential.
22
+
23
+ ## Accounts & channels (per-user)
24
+
25
+ `4ort mov` is **per-account**. Every user/agent has their own 4ort.mov account,
26
+ so videos publish under **their own channel** — not a shared one.
27
+
28
+ ```bash
29
+ # one-time: mint your own account + render token
30
+ 4ort provision run video
31
+ 4ort mov login --provisioned # or: 4ort mov login -u <user> -p <pass>
32
+ ```
33
+
34
+ **Which channel does a publish go to?**
35
+
36
+ - No `--channel` → your account's **default (first) channel**.
37
+ - `--channel <name>` → a channel **you own** by that name/displayName (the
38
+ command errors and lists your channels if there's no match).
39
+ - `4ort mov channels --create <name>` → make a new channel under your account.
40
+
41
+ So two agents running `4ort mov publish` land in two different channels — each
42
+ writes only to its own account. (Admin/`root` is just another account; the
43
+ autonomous pipelines historically published as `root`, but provisioned agents
44
+ get their own.)
45
+
46
+ ## Two flows
47
+
48
+ ### Flow A — Direct publish (you have an MP4)
49
+
50
+ ```bash
51
+ 4ort mov publish ./my-video.mp4 \
52
+ --title "My Video" \
53
+ --channel galaxy \
54
+ --description "..." \
55
+ --thumbnail ./thumb.png \
56
+ --privacy unlisted
57
+ ```
58
+
59
+ - Single-request multipart upload (`POST /api/v1/videos/upload`)
60
+ - Prints the watch URL on success
61
+ - Privacy: `public` / `unlisted` / `private` / `internal` (default `unlisted`)
62
+
63
+ ### Flow B — Render-and-publish (you have a HyperFrames composition dir)
64
+
65
+ ```bash
66
+ 4ort mov render ./my-composition --publish \
67
+ --title "My Composition" \
68
+ --channel galaxy
69
+ ```
70
+
71
+ End-to-end agent publish chain in one command:
72
+
73
+ ```
74
+ local dir of HyperFrames composition
75
+
76
+ ▼ tar (gitignore-respecting)
77
+
78
+ POST to factory.4ort.mov (video-factory)
79
+
80
+ ▼ async job (poll for status)
81
+
82
+ MP4 + preview frames back
83
+
84
+ ▼ (if --publish)
85
+
86
+ 4ort mov publish (under-the-hood)
87
+
88
+
89
+ watch URL printed
90
+ ```
91
+
92
+ This is the **path that 4ort.ai's agents inside the code-command sandbox use**
93
+ to publish content end-to-end — the bridge spec is in `~/ai/code-command/docs/`
94
+ and the engine is at `~/ai/4ort.mov/engine/`.
95
+
96
+ ## Other commands
97
+
98
+ | Command | What it does |
99
+ |---|---|
100
+ | `4ort mov list` | List your videos on 4ort.mov |
101
+ | `4ort mov channels` | List channels; `--create <name>` to make one |
102
+ | `4ort mov delete <id>` | Delete a video (with confirm) |
103
+
104
+ ## Where this fits in the galaxy
105
+
106
+ | Property | Role |
107
+ |---|---|
108
+ | **4ort.mov** | The PeerTube host (`~/ai/4ort.mov/`) — final destination for all videos |
109
+ | **video-factory** | Render engine at `factory.4ort.mov` (lives in `~/ai/4ort.mov/engine/`) — turns HyperFrames compositions into MP4s |
110
+ | **4ort-tv** | Long-form video pipeline — outputs HyperFrames compositions that get rendered + published via this CLI |
111
+ | **4ort.stream** | Short-form autonomous pipeline — outputs MP4s directly; uses `4ort mov publish` (Flow A) |
112
+ | **code-command sandbox** | Ships `@4ort/cli` baked in; the `4ort mov render --publish` chain is how spawned agents publish |
113
+
114
+ ## Auth model
115
+
116
+ The CLI talks to PeerTube exclusively over `/api/*` using an OAuth bearer
117
+ token (password grant at `4ort mov login`, transparently refreshed on 401).
118
+ Any human-facing password wall on `4ort.mov` carves out `/api/*` (see
119
+ `~/ai/4ort.mov/docs/AS-BUILT.md`, ADR-0009), so **automated publishes need no
120
+ separate gate credential** — the bearer token is the only auth the CLI sends.
121
+ Per-property security posture is in
122
+ `~/ai/4ort-galaxy/property-notes/4ort-mov.md`.
123
+
124
+ ## Versioning / what's new
125
+
126
+ - **0.6.0** — `4ort mov publish`: PeerTube upload + login + list/channels/delete
127
+ - **0.7.0** — `4ort mov render`: dir → video-factory → optional publish in one command
128
+ - **0.8.0** — `4ort provision run video` mints a per-agent 4ort.mov account + render
129
+ token; `4ort mov login --provisioned` signs in with it
130
+ - **0.8.4** — shipped a verified, lint-passing render starter template at
131
+ `examples/fact-short.html` (`4ort mov render examples/fact-short.html -q draft`)
132
+ - **0.8.5** — publish reliability: PeerTube token refresh now recovers from an
133
+ expired/rotated refresh token via a password-grant fallback (env or stored
134
+ credentials), so long-lived render hosts keep publishing
135
+ - **0.8.6** — docs: documented the per-account channel model + provisioned login,
136
+ corrected the upload method (multipart, not resumable), refreshed the auth model
package/docs/VAULT.md ADDED
@@ -0,0 +1,86 @@
1
+ # 🔑 `4ort vault` + `4ort run` — Secrets layer
2
+
3
+ Since `@4ort/cli@0.5.0`. The galaxy's secrets layer, modeled directly on
4
+ **1Password's `op run`** pattern: secrets live server-side in the 4ort.ai
5
+ vault, the CLI fetches them at invocation time, and they're **injected
6
+ into the child process only** — never written to disk.
7
+
8
+ ## The model in one line
9
+
10
+ ```
11
+ secret ref in env → 4ort run resolves it → child process gets the real value → exit
12
+
13
+ (plaintext never touches disk)
14
+ ```
15
+
16
+ ## Setup (one time per machine)
17
+
18
+ ```bash
19
+ # 1. Get a vault token from Mission Control (4ort.ai → Secrets panel)
20
+ # The token is prefixed `4vt_…`
21
+
22
+ # 2. Link this machine
23
+ 4ort vault login
24
+ # → paste the 4vt_ token when prompted
25
+
26
+ # 3. Verify
27
+ 4ort vault status
28
+ # → prints: server, vault user, token (masked), connection OK
29
+ ```
30
+
31
+ Token gets persisted to `~/.4ort/config.json` under `vault.token` (file mode `0600`).
32
+ Vault server defaults to `https://4ort.ai`.
33
+
34
+ ## Using it
35
+
36
+ ### Reference secrets in env at runtime
37
+
38
+ The reference shape is `4ort://service[/name]`:
39
+
40
+ ```bash
41
+ # .env or shell:
42
+ OPENAI_API_KEY=4ort://openai
43
+ DATABASE_URL=4ort://postgres/prod
44
+ SLACK_TOKEN=4ort://slack/team-a
45
+ ```
46
+
47
+ ### Run a command with refs resolved
48
+
49
+ ```bash
50
+ 4ort run -- python my_script.py
51
+ 4ort run -- npm start
52
+ 4ort run -- /usr/bin/env # see what got injected (for debugging)
53
+ ```
54
+
55
+ At invocation:
56
+ 1. CLI scans the env of the parent shell + any `.env` file in cwd
57
+ 2. For each `4ort://…` ref, fetches the real value from the vault
58
+ 3. Spawns the child process with the real values in its env
59
+ 4. Plaintext exists only in the child's memory; never lands on disk
60
+
61
+ ## Other commands
62
+
63
+ | Command | What it does |
64
+ |---|---|
65
+ | `4ort vault login` | Paste a `4vt_` token; persist to `~/.4ort/config.json` |
66
+ | `4ort vault status` | Show current vault identity + connection check |
67
+ | `4ort vault logout` | Wipe the vault token (other identities preserved) |
68
+
69
+ ## Where this fits in the galaxy
70
+
71
+ - **Same vault backend as the 4ort.ai Secrets panel** — the CLI is a peer client;
72
+ every UI write is visible to `4ort run` instantly.
73
+ - **The code-command sandbox** uses the CLI inside spawned interpreters via
74
+ `FORT_CLI_CONFIG_B64` env (the config is materialized into the sandbox at
75
+ spawn-time so the sandboxed agent has vault access without seeing the token).
76
+ - **The future "MCP Uplink"** property layers on top: third-party OAuth tokens
77
+ (Gmail / Slack / GitHub) get stored in the same vault, keyed by galaxy JWT
78
+ user-id. See `plans/MCP_UPLINK_PLAN.md` in the galaxy repo.
79
+
80
+ ## Security posture
81
+
82
+ - Vault token is the only persistent secret on the machine
83
+ - Per-service secrets are fetched fresh per `4ort run` invocation
84
+ - `0600` perms on `~/.4ort/config.json`
85
+ - Never echo `4ort vault status` output into logs (token is masked but the
86
+ shape gives away the service has one)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4ort/cli",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "Unified CLI for the 4ort ecosystem — 4ort.net hosting, knowledge graph, and more",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "README.md",
12
- "examples"
12
+ "examples",
13
+ "docs"
13
14
  ],
14
15
  "scripts": {
15
16
  "dev": "tsx src/index.ts",