@mangomagic/cli 0.1.8 → 0.1.9

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,14 +7,16 @@ 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 MangoMagic splash to confirm you're in. In a normal terminal,
11
+ `login` then drops straight into chat mode so users can start typing. The token
12
+ is cached at `~/.mangomagic/credentials.json` (mode 0600) so the next runs skip
13
+ 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. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mangomagic/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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,23 @@ 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
+ async function enterChatAfterLogin(startChat) {
147
+ if (!startChat) return;
148
+ process.stdout.write(`\n${DIM}You're in chat mode now. Type ${BOLD}exit${RESET}${DIM} to leave.${RESET}\n`);
149
+ await chat(actions());
150
+ }
151
+
152
+ async function login({ openInBrowser = true, startChat = false } = {}) {
142
153
  if (loadToken()) {
143
154
  process.stdout.write(`${DIM}You're already signed in. Run \`mangomagic logout\` first to switch accounts.${RESET}\n`);
144
155
  await playSplash({ greetingLine: "Welcome back to MangoMagic." });
145
156
  home();
157
+ await enterChatAfterLogin(startChat);
146
158
  return;
147
159
  }
148
160
 
@@ -164,6 +176,7 @@ ${BOLD}Sign in to MangoMagic${RESET}
164
176
  process.stdout.write("\n\n");
165
177
  await playSplash({ greetingLine: "You're in. Welcome to MangoMagic." });
166
178
  home();
179
+ await enterChatAfterLogin(startChat);
167
180
  });
168
181
  }
169
182
 
@@ -240,7 +253,10 @@ function actions() {
240
253
  export async function run(argv) {
241
254
  const cmd = argv[0] ?? (loadToken() ? "home" : "login");
242
255
  switch (cmd) {
243
- case "login": return login({ openInBrowser: !argv.includes("--no-open") && process.env.MANGOMAGIC_CLI_NO_OPEN !== "1" });
256
+ case "login": return login({
257
+ openInBrowser: !argv.includes("--no-open") && process.env.MANGOMAGIC_CLI_NO_OPEN !== "1",
258
+ startChat: shouldStartChat(argv),
259
+ });
244
260
  case "logout": return logout();
245
261
  case "whoami": return whoami();
246
262
  case "home": return home();