@mtreeai/msapling-cli 2.3.6-beta.1

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,24 @@
1
+ PROPRIETARY LICENSE
2
+
3
+ Copyright (c) 2026 MTreeAI Inc. All rights reserved.
4
+
5
+ This software and associated documentation files (the "Software") are the
6
+ proprietary, confidential property of MTreeAI Inc. ("MTreeAI"). Unauthorized
7
+ copying, modification, distribution, public display, public performance, or
8
+ creation of derivative works of the Software, in whole or in part, by any
9
+ means, is strictly prohibited.
10
+
11
+ No license, express or implied, is granted by this notice. Use of the Software
12
+ is permitted only under the terms of a separate written agreement with MTreeAI
13
+ or under the terms of MTreeAI's published Terms of Service at
14
+ https://msapling.com/policy. Use of the Software constitutes acceptance of those
15
+ terms.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22
+ OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For licensing inquiries: https://msapling.com/support
package/README.md ADDED
@@ -0,0 +1,168 @@
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`.