@runneth/cli 0.0.0-sha.14f7fe073a12.production

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,216 @@
1
+ # runneth-cli
2
+
3
+ `runneth-cli` gives local coding agents a fast persistent shell session.
4
+
5
+ ```bash
6
+ npx @runneth/cli open
7
+ runneth send 'cd ~/project && pnpm test'
8
+ runneth send 'git status --short'
9
+ runneth oauth login
10
+ runneth chat --workspace <workspace-id>
11
+ runneth conversation create --workspace <workspace-id> --json
12
+ runneth ssh
13
+ runneth close
14
+ ```
15
+
16
+ ## npm Usage
17
+
18
+ Run the promoted production package from the npm `latest` channel:
19
+
20
+ ```bash
21
+ npx @runneth/cli ssh
22
+ ```
23
+
24
+ Use the npm `beta` channel to try the production build before it is promoted to
25
+ `latest`:
26
+
27
+ ```bash
28
+ npx @runneth/cli@beta ssh
29
+ ```
30
+
31
+ The first command starts a small local daemon for the current user. Later `send`
32
+ calls reuse the same shell process through a local socket, so `cd`, exported
33
+ environment variables, and other shell state persist between commands.
34
+
35
+ ## Commands
36
+
37
+ ```bash
38
+ runneth open [--name default] [--cwd <path>] [--shell <path>]
39
+ runneth send [--name default] [--timeout-ms 600000] [--stdin] -- <command...>
40
+ runneth status [--name default]
41
+ runneth list
42
+ runneth close [--name default]
43
+ runneth oauth login [--resource <url>] [--client-name "Runneth MCP"] [--scope <scope>] [--no-open]
44
+ runneth oauth status [--resource <url>]
45
+ runneth oauth logout [--resource <url>]
46
+ runneth chat --workspace <workspace-id> [--api <builder-url>] [--resource <url>] [--auth mondrian|builder] [--conversation <id>]
47
+ runneth conversation create --workspace <workspace-id> --json [--title <title>]
48
+ runneth conversation send --workspace <workspace-id> --conversation <id> --json (--message <text> | --stdin)
49
+ runneth conversation state --workspace <workspace-id> --conversation <id> --json
50
+ runneth conversation session --workspace <workspace-id> --jsonl
51
+ runneth ssh target add <name> (--host <host> | --ssh-url <url>) [--resource <url>] [--default]
52
+ runneth ssh target import <file>
53
+ runneth ssh target list
54
+ runneth ssh target use <name>
55
+ runneth ssh [--target <name>] [--unique-key | --identity-file <path>] [-- remote-command]
56
+ runneth ssh stdio [--target <name>] [--unique-key | --identity-file <path>]
57
+ runneth skills install [--agent claude|codex|all]
58
+ runneth shutdown
59
+ ```
60
+
61
+ Use `--stdin` for multi-line commands:
62
+
63
+ ```bash
64
+ cat <<'SCRIPT' | runneth send --stdin
65
+ cd ~/project
66
+ pnpm check
67
+ SCRIPT
68
+ ```
69
+
70
+ Runtime files live under `~/.runneth-cli` by default. Set `RUNNETH_CLI_HOME` to
71
+ use a different state directory.
72
+
73
+ ## OAuth
74
+
75
+ `runneth-cli oauth login` performs OAuth protected-resource discovery, dynamic
76
+ client registration as a public MCP-style client, PKCE authorization, and token
77
+ exchange through a local loopback callback.
78
+
79
+ ```bash
80
+ runneth oauth login --resource http://localhost:4100/mcp
81
+ runneth oauth status --resource http://localhost:4100/mcp
82
+ ```
83
+
84
+ OAuth credentials are stored under `~/.runneth-cli/oauth` with user-only file
85
+ permissions on Unix-like systems. Commands that need an access token refresh it
86
+ internally when the server issued a refresh token.
87
+
88
+ ## Chat
89
+
90
+ `runneth-cli chat` starts an interactive terminal conversation against Builder's
91
+ canonical Runneth conversation API. Official environment builds carry the
92
+ correct Builder URL in the package; use `--api` only for local or custom Builder
93
+ deployments.
94
+
95
+ ```bash
96
+ runneth chat --workspace "$MONDRIAN_WORKSPACE_ID"
97
+ ```
98
+
99
+ If no stored OAuth credential exists, chat starts the same browser-based OAuth
100
+ flow as SSH and stores the credential under `~/.runneth-cli/oauth`. Use
101
+ `--token`, `RUNNETH_TOKEN`, `MONDRIAN_TOKEN`, or `BUILDER_AGENT_CHAT_TOKEN` only
102
+ for automation and local API mocks that should bypass OAuth.
103
+
104
+ Inside the terminal UI, use `/state` to redraw the current conversation and
105
+ `/exit` to quit.
106
+
107
+ ## Conversation Commands
108
+
109
+ `runneth-cli conversation` is the machine-oriented conversation interface for
110
+ agents and scripts. It uses the same auth, workspace scoping, and conversation
111
+ API as `runneth chat`, but avoids terminal banners and ANSI UI output.
112
+
113
+ ```bash
114
+ runneth conversation create --workspace "$MONDRIAN_WORKSPACE_ID" --title "SSH routine setup" --json
115
+ runneth conversation send --workspace "$MONDRIAN_WORKSPACE_ID" --conversation "$CONVERSATION_ID" --message "Create a routine" --json
116
+ runneth conversation state --workspace "$MONDRIAN_WORKSPACE_ID" --conversation "$CONVERSATION_ID" --json
117
+ ```
118
+
119
+ `send` waits for the assistant response by default. `send` and `state` require an
120
+ explicit `--conversation`; the CLI does not track an implicit active
121
+ conversation for machine commands.
122
+
123
+ Long-lived agents can keep one authenticated process open with JSONL over
124
+ stdin/stdout:
125
+
126
+ ```bash
127
+ runneth conversation session --workspace "$MONDRIAN_WORKSPACE_ID" --jsonl
128
+ ```
129
+
130
+ The session `ready` frame reports the resolved client target context, not a
131
+ separate active conversation identity. Authoritative user and conversation
132
+ identity comes from the `conversation` object returned by `create` and `state`.
133
+
134
+ Typical requests:
135
+
136
+ ```jsonl
137
+ {"id":"1","method":"create","params":{"title":"SSH routine setup"}}
138
+ {"id":"2","method":"send","params":{"conversationId":"11111111-1111-4111-8111-111111111111","text":"Create a routine"}}
139
+ {"id":"3","method":"state","params":{"conversationId":"11111111-1111-4111-8111-111111111111"}}
140
+ {"id":"4","method":"close"}
141
+ ```
142
+
143
+ Typical responses:
144
+
145
+ ```jsonl
146
+ {"type":"ready","ok":true,"protocol":"runneth-conversation-stdio","version":1,"authMode":"mondrian","workspaceId":"65cbcb84095884aaf08dc76a"}
147
+ {"id":"1","type":"created","ok":true,"conversation":{"id":"11111111-1111-4111-8111-111111111111"}}
148
+ {"id":"2","type":"sent","ok":true,"send":{"assistantMessageId":"55555555-5555-4555-8555-555555555555"}}
149
+ {"id":"2","type":"state","ok":true,"state":{"conversation":{"id":"11111111-1111-4111-8111-111111111111"}}}
150
+ {"id":"2","type":"complete","ok":true,"assistantMessage":{"id":"55555555-5555-4555-8555-555555555555","status":"completed"}}
151
+ ```
152
+
153
+ ## SSH
154
+
155
+ `runneth-cli ssh` uses the stored OAuth credential for the resource. If no
156
+ credential exists yet, it starts the OAuth login flow first. The first SSH
157
+ connection for a resource/app pair generates an ed25519 keypair, sends the
158
+ public key to the Runneth SSH app, writes an isolated OpenSSH config, and then
159
+ starts `ssh` through the app tunnel.
160
+
161
+ ```bash
162
+ runneth ssh \
163
+ --resource https://projects.motionapp.com/mcp \
164
+ --host 93c7ca56-debe-4b95-8be2-a873afe72234.app.runneth.com
165
+ ```
166
+
167
+ SSH keys, known hosts, and generated config files are stored under
168
+ `~/.runneth-cli/ssh`. The generated OpenSSH config uses an internal
169
+ `ProxyCommand` transport that attaches the OAuth bearer token to the SSH app
170
+ HTTP tunnel.
171
+
172
+ ### SSH stdio
173
+
174
+ Use `ssh stdio` when an agent needs to keep one authenticated SSH connection
175
+ open and run multiple commands or remote processes without reconnecting:
176
+
177
+ ```bash
178
+ runneth ssh stdio --target primary-vm
179
+ ```
180
+
181
+ The command writes JSONL events to stdout and reads JSONL requests from stdin.
182
+ Logs and setup messages are written to stderr.
183
+
184
+ ```jsonl
185
+ {"id":"1","method":"exec","params":{"command":"pwd","timeoutMs":30000}}
186
+ {"id":"2","method":"spawn","params":{"command":"cat"}}
187
+ {"id":"2","method":"stdin","params":{"data":"hello\n"}}
188
+ {"id":"2","method":"close"}
189
+ ```
190
+
191
+ Typical responses:
192
+
193
+ ```jsonl
194
+ {"type":"ready","ok":true,"protocol":"runneth-ssh-stdio","version":1,"hostAlias":"runneth-2735833d956e","targetName":"primary-vm"}
195
+ {"id":"1","type":"stdout","data":"/agent\n"}
196
+ {"id":"1","type":"exit","ok":true,"code":0,"signal":null}
197
+ {"id":"2","type":"started","ok":true,"processId":"2","command":"cat"}
198
+ ```
199
+
200
+ ## Agent Skills
201
+
202
+ Install or update the bundled Runneth skill for Claude Code and Codex:
203
+
204
+ ```bash
205
+ runneth-cli skills install
206
+ ```
207
+
208
+ Install or update only one agent skill:
209
+
210
+ ```bash
211
+ runneth-cli skills install --agent claude
212
+ runneth-cli skills install --agent codex
213
+ ```
214
+
215
+ The command writes the same `runneth` skill to `~/.claude/skills/runneth` and/or
216
+ `~/.codex/skills/runneth`. Re-running the command updates the existing skill.
@@ -0,0 +1,6 @@
1
+ //#region src/build-defaults.d.ts
2
+ declare const resolveBuildDefaultMcpResourceUrl: () => string | undefined;
3
+ declare const resolveBuildDefaultMondrianApiUrl: () => string | undefined;
4
+ declare const resolveBuildDefaultRunnethApiUrl: () => string | undefined;
5
+ //#endregion
6
+ export { resolveBuildDefaultMcpResourceUrl, resolveBuildDefaultMondrianApiUrl, resolveBuildDefaultRunnethApiUrl };
@@ -0,0 +1,36 @@
1
+ //#region src/build-defaults.ts
2
+ const BUILD_DEFAULT_MONDRIAN_API_URL = "https://projects.motionapp.com/";
3
+ const BUILD_DEFAULT_RUNNETH_API_URL = "https://build-be.runneth.com/";
4
+ const appendMcpPath = (url) => {
5
+ url.pathname = `${url.pathname === "/" ? "" : url.pathname.replace(/\/+$/u, "")}/mcp`;
6
+ };
7
+ const resolveBuildDefaultMcpResourceUrl = () => {
8
+ const apiUrl = resolveBuildDefaultMondrianApiUrl();
9
+ if (apiUrl === void 0) return;
10
+ const url = new URL(apiUrl);
11
+ appendMcpPath(url);
12
+ return url.toString();
13
+ };
14
+ const normalizeBuildDefaultUrl = (input) => {
15
+ const rawApiUrl = input.value.trim();
16
+ if (rawApiUrl.length === 0 || rawApiUrl.startsWith("__RUNNETH_CLI_DEFAULT_") && rawApiUrl.endsWith("_API_URL__")) return;
17
+ const url = new URL(rawApiUrl);
18
+ if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error(`Build default ${input.envName} must use http or https`);
19
+ url.hash = "";
20
+ url.search = "";
21
+ return url.toString().replace(/\/+$/u, "");
22
+ };
23
+ const resolveBuildDefaultMondrianApiUrl = () => {
24
+ return normalizeBuildDefaultUrl({
25
+ envName: "MONDRIAN_API_URL",
26
+ value: BUILD_DEFAULT_MONDRIAN_API_URL
27
+ });
28
+ };
29
+ const resolveBuildDefaultRunnethApiUrl = () => {
30
+ return normalizeBuildDefaultUrl({
31
+ envName: "BACKEND_URL",
32
+ value: BUILD_DEFAULT_RUNNETH_API_URL
33
+ });
34
+ };
35
+ //#endregion
36
+ export { resolveBuildDefaultMcpResourceUrl, resolveBuildDefaultMondrianApiUrl, resolveBuildDefaultRunnethApiUrl };
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };