@mtreeai/msapling-cli 2.3.6-beta.6 → 2.3.6-beta.61

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/LICENSE ADDED
@@ -0,0 +1,44 @@
1
+ MSapling CLI — Proprietary License
2
+ Copyright (c) 2026 MSapling / MTreeAI. All rights reserved.
3
+
4
+ This software, the source code in this repository, and the published
5
+ `@mtreeai/msapling-cli` and `msapling` npm packages (collectively, "the Software") are the
6
+ proprietary property of MSapling / MTreeAI.
7
+
8
+ PERMITTED USE
9
+ -------------
10
+ You may:
11
+ 1. Install and run the published binary distribution of the Software
12
+ ("msapling" / "ms" CLI) for personal or internal-business use against
13
+ the official MSapling backend at https://api.msapling.com.
14
+ 2. Configure the Software with your own API keys (BYOK) and local model
15
+ providers (Ollama, etc.) as supported by the Software's documented
16
+ features.
17
+
18
+ PROHIBITED USE
19
+ --------------
20
+ Without prior written permission from MSapling / MTreeAI you may not:
21
+ 1. Copy, fork, mirror, redistribute, sublicense, or republish the Software
22
+ or any substantial portion of its source code or compiled artifacts.
23
+ 2. Reverse-engineer, decompile, or disassemble the Software except to the
24
+ extent permitted by applicable law that cannot be contractually waived.
25
+ 3. Use the Software to operate a competing service or to circumvent any
26
+ authentication, billing, rate-limiting, or tier-gating mechanism of the
27
+ MSapling backend.
28
+ 4. Remove or alter any copyright notice, trademark, or proprietary legend
29
+ embedded in the Software.
30
+
31
+ NO WARRANTY
32
+ -----------
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL
36
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
37
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING
38
+ FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39
+ DEALINGS IN THE SOFTWARE.
40
+
41
+ CONTACT
42
+ -------
43
+ For licensing inquiries, partnership requests, or permission to redistribute:
44
+ https://msapling.com/support
package/README.md CHANGED
@@ -1,168 +1,176 @@
1
- # MSapling CLI
2
-
3
- MSapling CLI is the React/TypeScript terminal client for the MSapling backend.
4
-
5
- ## Install
6
-
7
- Install the MSapling CLI globally via npm:
8
-
9
- ```bash
10
- npm install -g @msapling/cli
11
- ```
12
-
13
- **Requirements:** Node.js 18 or higher.
14
-
15
- **Note:** Version 2.3.3+ is the first npm-installable release with email/password login support. See [@msapling/cli on npm](https://www.npmjs.com/package/@msapling/cli) for the latest version.
16
-
17
- ## First Run
18
-
19
- Start the interactive REPL:
20
-
21
- ```bash
22
- msapling
23
- ```
24
-
25
- Inside the REPL, authenticate using one of these methods:
26
-
27
- ```
28
- /login your@email.com # Email + password login (with optional 2FA)
29
- /login github # GitHub device flow (opens browser)
30
- /login <token> # Paste an API token from msapling.com Settings
31
- ```
32
-
33
- All methods store the token via the OS keychain (Windows DPAPI, macOS Keychain, or Linux libsecret).
34
-
35
- Once logged in, start chatting:
36
-
37
- ```
38
- /chat hello
39
- ```
40
-
41
- ## CLI Subcommands (argv)
42
-
43
- These are passed directly on the command line before the REPL starts:
44
-
45
- | Command | Description |
46
- |---------|-------------|
47
- | *(none)* | Start interactive REPL |
48
- | `--compact` | Start REPL in compact mode (thin separators, no footer) |
49
- | `mcp serve` | Run as MCP stdio server (Claude Code / Cursor / Windsurf integration) |
50
- | `--version` | Print version and exit |
51
- | `--help` | Print usage and exit |
52
-
53
- ## Inside the REPL Slash Commands
54
-
55
- Once the REPL is running, type `/help` to see all available slash commands. Common ones:
56
-
57
- | Slash Command | Description |
58
- |---------------|-------------|
59
- | `/login your@email.com` | Sign in with email + password (recommended for end users) |
60
- | `/login github` | GitHub device flow (for developers) |
61
- | `/login <token>` | Paste an API token from Settings API Keys |
62
- | `/logout` | Clear stored token |
63
- | `/chat <message>` | Send a message and stream a response |
64
- | `/swarm <prompt>` | Run parallel agent swarms |
65
- | `/models` | List available models |
66
- | `/cost` | Show usage and billing data |
67
- | `/config` | View and edit configuration |
68
- | `/help` | Show all slash-command help |
69
-
70
- > **Note:** `chat`, `login`, `models`, `cost`, `swarm`, and `config` are REPL slash-commands (prefixed with `/`), not top-level argv subcommands. Run `msapling --help` to see the argv interface.
71
-
72
- See `packages/cli/src/commands/index.ts` for the canonical slash-command list.
73
-
74
- ---
75
-
76
-
77
-
78
- The CLI is not meant to be a large standalone agent runtime. MSapling's backend is the source of truth for auth, projects, chats, model routing, usage, billing, MDrive, locks, and audit data. The website, mobile app, and CLI should all show and modify the same backend state.
79
-
80
- ## Product Direction
81
-
82
- MSapling started as a multi-chat browser workspace: multiple AI chats, many model choices, BYOK, OpenRouter, and Ollama support in one UI.
83
-
84
- The mobile app extends that shared workspace to one-chat-at-a-time usage and phone-first workflows such as sending a photo into a chat.
85
-
86
- The CLI brings the same backend workspace to the terminal. It should be fast, low-resource, and useful without duplicating the backend.
87
-
88
- ## Architecture
89
-
90
- ```text
91
- Website \
92
- Mobile App -> MSapling Backend -> chats, projects, usage, billing, MDrive, locks
93
- CLI /
94
- ```
95
-
96
- The CLI should:
97
-
98
- - authenticate with the backend
99
- - read projects and chats from the backend
100
- - stream chat responses from `/api/chat/message`
101
- - display backend usage and quota data
102
- - respect backend stream locks
103
- - use backend MDrive/edit proposal flows
104
- - keep local terminal work lightweight
105
-
106
- The CLI should not:
107
-
108
- - invent separate chat state
109
- - compute billing locally
110
- - simulate MDrive state
111
- - bypass backend locks
112
- - duplicate backend orchestration unless there is a clear reason
113
-
114
- ## Current State
115
-
116
- This directory is a Bun monorepo scaffold using React and Ink.
117
-
118
- Port useful behavior selectively. Do not port backend-like responsibilities.
119
-
120
- Known current gaps:
121
-
122
- - workspace package manifests are missing
123
- - the Ink input loop is incomplete
124
- - `Agent` is referenced but not implemented
125
- - MDrive logic is simulated locally
126
- - backend route contracts need to be aligned
127
- - tests and build are not yet passing
128
-
129
- ## Near-Term Goal
130
-
131
- Build a stable thin client:
132
-
133
- 1. Login and secure token storage.
134
- 2. Fetch backend project overview.
135
- 3. Open or create chats.
136
- 4. Stream backend chat responses.
137
- 5. Show shared chat history across website, app, and CLI.
138
- 6. Handle lock, quota, and auth errors clearly.
139
- 7. Add `/doctor`.
140
-
141
- ## Commands
142
-
143
- ```bash
144
- bun install
145
- bun run build
146
- bun test
147
- bun run start
148
- ```
149
-
150
- These commands are target commands. They may not pass until the workspace manifests and dependencies are completed.
151
-
152
- ## Environment
153
-
154
- ```bash
155
- MSAPLING_API_URL=https://api.msapling.com
156
- ```
157
-
158
- For local development, point `MSAPLING_API_URL` at the local backend.
159
-
160
- ## Design Principle
161
-
162
- Keep the CLI small.
163
-
164
- The backend should do the heavy work. The CLI should make that backend fast and comfortable from a terminal.
165
-
166
- ---
167
-
168
- **Full architecture overview:** see ARCHITECTURE.md (when published) or `packages/core/README.md`.
1
+ # MSapling CLI
2
+
3
+ MSapling CLI is the React/TypeScript terminal client for the MSapling backend.
4
+
5
+ Part of the [MTreeAI](https://mtreeai.com) family.
6
+
7
+ ## Install
8
+
9
+ Install the MSapling CLI globally via npm:
10
+
11
+ ```bash
12
+ npm install -g msapling@beta
13
+ ```
14
+
15
+ **Requirements:** Node.js 20.10 or higher.
16
+
17
+ The short `msapling` package and compatibility package `@mtreeai/msapling-cli` contain the same CLI bundle. Both use the `beta` dist-tag during prerelease testing.
18
+
19
+ ## First Run
20
+
21
+ Start the interactive REPL:
22
+
23
+ ```bash
24
+ msapling
25
+ ```
26
+
27
+ Inside the REPL, authenticate using one of these methods:
28
+
29
+ ```
30
+ /login your@email.com # Email + password login (with optional 2FA)
31
+ /login github # GitHub device flow (opens browser)
32
+ /login <token> # Paste an API token from msapling.com Settings
33
+ ```
34
+
35
+ All methods store the token via the OS keychain (Windows DPAPI, macOS Keychain, or Linux libsecret).
36
+
37
+ Once logged in, start chatting:
38
+
39
+ ```
40
+ /chat hello
41
+ ```
42
+
43
+ ## CLI Subcommands (argv)
44
+
45
+ These are passed directly on the command line before the REPL starts:
46
+
47
+ | Command | Description |
48
+ |---------|-------------|
49
+ | *(none)* | Start interactive REPL |
50
+ | `--compact` | Start REPL in compact mode (thin separators, no footer) |
51
+ | `mcp serve` | Run as MCP stdio server (Claude Code / Cursor / Windsurf integration) |
52
+ | `--version` | Print version and exit |
53
+ | `--help` | Print usage and exit |
54
+
55
+ ## Inside the REPL Slash Commands
56
+
57
+ Once the REPL is running, type `/help` to see all available slash commands. Common ones:
58
+
59
+ | Slash Command | Description |
60
+ |---------------|-------------|
61
+ | `/login your@email.com` | Sign in with email + password (recommended for end users) |
62
+ | `/login github` | GitHub device flow (for developers) |
63
+ | `/login <token>` | Paste an API token from Settings API Keys |
64
+ | `/logout` | Clear stored token |
65
+ | `/chat <message>` | Send a message and stream a response |
66
+ | `/chat new <title>` | Create a chat inside the fixed CLI project |
67
+ | `/chat import <chat_id>` | Copy another owned chat into a new CLI chat without mutating the source |
68
+ | `/model` | Open the loopback visual catalog (complete LAB catalog remotely; direct provider catalog standalone) |
69
+ | `/model --terminal` | Use the provider-first terminal selector instead |
70
+ | `/keys add <provider>` | Enter a BYOK key through hidden terminal input or the one-time local browser prompt |
71
+ | `/keys use <provider> [base_url]` | Select OpenRouter or an OpenAI-compatible provider in standalone mode |
72
+ | `/footer [compact|expanded|field on|off]` | Configure telemetry visibility |
73
+ | `/cost` | Show usage and billing data |
74
+ | `/config` | View and edit configuration |
75
+ | `/help` | Show all slash-command help |
76
+
77
+ > **Note:** `chat`, `login`, `model`, `footer`, `cost`, and `config` are REPL slash-commands (prefixed with `/`), not top-level argv subcommands. The CLI is single-chat: fanout/swarm commands are hidden and disabled. Run `msapling --help` to see the argv interface.
78
+
79
+ See `packages/cli/src/commands/index.ts` for the canonical slash-command list.
80
+
81
+ ---
82
+
83
+
84
+
85
+ The installed CLI has explicit remote and standalone profiles. In remote mode, MSapling's backend is the source of truth for auth, projects, chats, model routing, usage, billing, MDrive, locks, and audit data. In `--local` mode, model calls, provider keys, transcripts, tools, and project settings remain local and LAB is not contacted for turns.
86
+
87
+ ## Product Direction
88
+
89
+ MSapling started as a multi-chat browser workspace: multiple AI chats, many model choices, BYOK, OpenRouter, and Ollama support in one UI.
90
+
91
+ The mobile app extends that shared workspace to one-chat-at-a-time usage and phone-first workflows such as sending a photo into a chat.
92
+
93
+ The CLI uses the same backend state through a fixed project named `CLI` and one active chat at a time. It should be fast, low-resource, and useful without duplicating the backend.
94
+
95
+ ## Architecture
96
+
97
+ ```text
98
+ Website \
99
+ Mobile App -> MSapling Backend -> chats, projects, usage, billing, MDrive, locks
100
+ CLI /
101
+ ```
102
+
103
+ The CLI should:
104
+
105
+ - authenticate with the backend
106
+ - read the fixed `CLI` project and active chat from the backend
107
+ - stream chat responses from `/api/chat/message`
108
+ - display backend usage and quota data
109
+ - respect backend stream locks
110
+ - use backend MDrive/edit proposal flows
111
+ - keep local terminal work lightweight
112
+
113
+ The CLI should not:
114
+
115
+ - invent separate chat state or switch arbitrary web chats
116
+ - expose multi-chat/swarm fanout commands
117
+ - compute billing locally
118
+ - simulate MDrive state
119
+ - bypass backend locks
120
+ - duplicate backend orchestration unless there is a clear reason
121
+
122
+ ## Current State
123
+
124
+ This directory is a Bun monorepo scaffold using React and Ink.
125
+
126
+ Port useful behavior selectively. Do not port backend-like responsibilities.
127
+
128
+ Known current gaps:
129
+
130
+ - workspace package manifests are missing
131
+ - the Ink input loop is incomplete
132
+ - `Agent` is referenced but not implemented
133
+ - MDrive logic is simulated locally
134
+ - backend route contracts need to be aligned
135
+ - tests and build are not yet passing
136
+
137
+ ## Near-Term Goal
138
+
139
+ Build a stable thin client:
140
+
141
+ 1. Login and secure token storage.
142
+ 2. Fetch backend project overview.
143
+ 3. Open or create chats.
144
+ 4. Stream backend chat responses.
145
+ 5. Show shared chat history across website, app, and CLI.
146
+ 6. Handle lock, quota, and auth errors clearly.
147
+ 7. Add `/doctor`.
148
+
149
+ ## Commands
150
+
151
+ ```bash
152
+ bun install
153
+ bun run build
154
+ bun test
155
+ bun run start
156
+ ```
157
+
158
+ These commands are target commands. They may not pass until the workspace manifests and dependencies are completed.
159
+
160
+ ## Environment
161
+
162
+ ```bash
163
+ MSAPLING_API_URL=https://api.msapling.com
164
+ ```
165
+
166
+ For local development, point `MSAPLING_API_URL` at the local backend.
167
+
168
+ ## Design Principle
169
+
170
+ Keep the CLI small.
171
+
172
+ The backend should do the heavy work. The CLI should make that backend fast and comfortable from a terminal.
173
+
174
+ ---
175
+
176
+ **Full architecture overview:** see ARCHITECTURE.md (when published) or `packages/core/README.md`.