@mangomagic/cli 0.1.8 → 0.1.10

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 CHANGED
@@ -7,18 +7,20 @@ npx -y @mangomagic/cli login
7
7
  ```
8
8
 
9
9
  You'll get a short code, your browser will open, you approve the device, and
10
- the CLI plays the MangoMagic splash to confirm you're in. The token is cached
11
- at `~/.mangomagic/credentials.json` (mode 0600) so the next runs skip auth.
10
+ the CLI plays the animated MangoMagic splash to confirm you're in. In a normal
11
+ terminal, `login` then drops straight into chat mode so users can start typing.
12
+ The token is cached at `~/.mangomagic/credentials.json` (mode 0600) so the next
13
+ runs skip auth.
12
14
 
13
15
  ## Commands
14
16
 
15
17
  | Command | What it does |
16
18
  | --- | --- |
17
- | `mangomagic login` | Browser-based device-code sign-in + splash. Add `--no-open` to print the URL without opening a browser. |
19
+ | `mangomagic login` | Browser-based device-code sign-in, splash, then chat. Add `--home` to stop at the menu or `--no-open` to print the URL without opening a browser. |
18
20
  | `mangomagic logout` | Forget the cached token. |
19
21
  | `mangomagic whoami` | Show the cached identity. |
20
22
  | `mangomagic home` | Show fast wins after sign-in. |
21
- | `mangomagic chat` | Start an interactive natural-language session. |
23
+ | `mangomagic chat` | Play the splash and start an interactive natural-language session. |
22
24
  | `mangomagic ask "..."` | Run one natural-language request. |
23
25
  | `mangomagic tools` | Show the CLI/MCP catalog. Add `--all` for the full list or `--json` for machine-readable output. |
24
26
  | `mangomagic tool <name> '{"json":"args"}'` | Run the same tool exposed to MCP clients. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mangomagic/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "MangoMagic CLI — sign in, manage episodes, and expose MangoMagic to MCP clients (Claude Desktop, Cursor).",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.mjs CHANGED
@@ -18,7 +18,7 @@ function help() {
18
18
  process.stdout.write(`
19
19
  ${BOLD}mangomagic${RESET} ${DIM}— sign into MangoMagic and bring your account into your terminal.${RESET}
20
20
 
21
- ${GOLD}mangomagic login${RESET} Authorize this terminal (opens your browser; add --no-open to print only).
21
+ ${GOLD}mangomagic login${RESET} Authorize this terminal, then start chat. Add --home to stop at the menu.
22
22
  ${GOLD}mangomagic logout${RESET} Forget the token cached on this machine.
23
23
  ${GOLD}mangomagic whoami${RESET} Show the cached identity.
24
24
  ${GOLD}mangomagic home${RESET} Show fast wins for creating value right now.
@@ -55,7 +55,7 @@ ${DIM}Try this in Claude, Cursor, or Codex after MCP is connected:${RESET}
55
55
  "Use MangoMagic to get my latest episode and draft five LinkedIn post ideas."
56
56
 
57
57
  ${DIM}Talk in the terminal:${RESET}
58
- ${GOLD}${COMMAND_PREFIX} chat${RESET}
58
+ ${GOLD}${COMMAND_PREFIX} login${RESET}
59
59
  ${GOLD}${COMMAND_PREFIX} create talking cards about my LinkedIn idea${RESET}
60
60
 
61
61
  ${DIM}Open app:${RESET} ${APP_ORIGIN}
@@ -138,11 +138,27 @@ async function runToolCommand(argv) {
138
138
  process.stdout.write(JSON.stringify(result, null, 2) + "\n");
139
139
  }
140
140
 
141
- async function login({ openInBrowser = true } = {}) {
141
+ function shouldStartChat(argv) {
142
+ if (argv.includes("--home") || argv.includes("--no-chat")) return false;
143
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
144
+ }
145
+
146
+ function splashMode() {
147
+ return process.stdout.isTTY ? "anim" : "static";
148
+ }
149
+
150
+ async function enterChatAfterLogin(startChat) {
151
+ if (!startChat) return;
152
+ process.stdout.write(`\n${DIM}You're in chat mode now. Type ${BOLD}exit${RESET}${DIM} to leave.${RESET}\n`);
153
+ await chat(actions());
154
+ }
155
+
156
+ async function login({ openInBrowser = true, startChat = false } = {}) {
142
157
  if (loadToken()) {
143
158
  process.stdout.write(`${DIM}You're already signed in. Run \`mangomagic logout\` first to switch accounts.${RESET}\n`);
144
- await playSplash({ greetingLine: "Welcome back to MangoMagic." });
159
+ await playSplash({ mode: splashMode(), greetingLine: "Welcome back to MangoMagic." });
145
160
  home();
161
+ await enterChatAfterLogin(startChat);
146
162
  return;
147
163
  }
148
164
 
@@ -162,11 +178,17 @@ ${BOLD}Sign in to MangoMagic${RESET}
162
178
  }).then(async (creds) => {
163
179
  saveToken(creds);
164
180
  process.stdout.write("\n\n");
165
- await playSplash({ greetingLine: "You're in. Welcome to MangoMagic." });
181
+ await playSplash({ mode: splashMode(), greetingLine: "You're in. Welcome to MangoMagic." });
166
182
  home();
183
+ await enterChatAfterLogin(startChat);
167
184
  });
168
185
  }
169
186
 
187
+ async function enterChat() {
188
+ await playSplash({ mode: splashMode(), greetingLine: "Welcome to MangoMagic." });
189
+ await chat(actions());
190
+ }
191
+
170
192
  function logout() {
171
193
  clearToken();
172
194
  process.stdout.write("Signed out.\n");
@@ -238,13 +260,16 @@ function actions() {
238
260
  }
239
261
 
240
262
  export async function run(argv) {
241
- const cmd = argv[0] ?? (loadToken() ? "home" : "login");
263
+ const cmd = argv[0] ?? "login";
242
264
  switch (cmd) {
243
- case "login": return login({ openInBrowser: !argv.includes("--no-open") && process.env.MANGOMAGIC_CLI_NO_OPEN !== "1" });
265
+ case "login": return login({
266
+ openInBrowser: !argv.includes("--no-open") && process.env.MANGOMAGIC_CLI_NO_OPEN !== "1",
267
+ startChat: shouldStartChat(argv),
268
+ });
244
269
  case "logout": return logout();
245
270
  case "whoami": return whoami();
246
271
  case "home": return home();
247
- case "chat": return chat(actions());
272
+ case "chat": return enterChat();
248
273
  case "ask": return handleNaturalLanguage(argv.slice(1).join(" "), actions());
249
274
  case "tools": return tools({ json: argv.includes("--json"), all: argv.includes("--all") });
250
275
  case "tool": return runToolCommand(argv.slice(1));