@mangomagic/cli 0.1.7 → 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.7",
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": {
@@ -24,6 +24,11 @@
24
24
  "dependencies": {
25
25
  "@modelcontextprotocol/sdk": "^1.0.4"
26
26
  },
27
- "keywords": ["mangomagic", "cli", "mcp", "podcast"],
27
+ "keywords": [
28
+ "mangomagic",
29
+ "cli",
30
+ "mcp",
31
+ "podcast"
32
+ ],
28
33
  "license": "MIT"
29
34
  }
package/src/ai/kimi.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { apiCall } from "../api.mjs";
2
2
 
3
3
  export async function planWithKimi(userText, context = {}) {
4
- const result = await apiCall("cli-ai-route", { body: { text: userText, context } });
5
- if (!result?.plan?.action) throw new Error("MangoMagic AI returned no routing decision.");
6
- return result.plan;
4
+ const result = await apiCall("cli-ai-route", { body: { input: userText, context } });
5
+ const plan = result?.plan ?? result;
6
+ if (!plan?.action) throw new Error("MangoMagic AI returned no routing decision.");
7
+ return plan;
7
8
  }
package/src/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import { deviceLogin } from "./auth/device-flow.mjs";
2
3
  import { chat, createTalkingCards, handleNaturalLanguage } from "./chat/natural-language.mjs";
3
4
  import { loadToken, saveToken, clearToken, credentialsPath } from "./auth/token-store.mjs";
@@ -11,12 +12,13 @@ const GOLD = "\x1b[38;2;241;171;28m";
11
12
  const DIM = "\x1b[2m";
12
13
  const BOLD = "\x1b[1m";
13
14
  const RESET = "\x1b[0m";
15
+ const PACKAGE_VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
14
16
 
15
17
  function help() {
16
18
  process.stdout.write(`
17
19
  ${BOLD}mangomagic${RESET} ${DIM}— sign into MangoMagic and bring your account into your terminal.${RESET}
18
20
 
19
- ${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.
20
22
  ${GOLD}mangomagic logout${RESET} Forget the token cached on this machine.
21
23
  ${GOLD}mangomagic whoami${RESET} Show the cached identity.
22
24
  ${GOLD}mangomagic home${RESET} Show fast wins for creating value right now.
@@ -53,7 +55,7 @@ ${DIM}Try this in Claude, Cursor, or Codex after MCP is connected:${RESET}
53
55
  "Use MangoMagic to get my latest episode and draft five LinkedIn post ideas."
54
56
 
55
57
  ${DIM}Talk in the terminal:${RESET}
56
- ${GOLD}${COMMAND_PREFIX} chat${RESET}
58
+ ${GOLD}${COMMAND_PREFIX} login${RESET}
57
59
  ${GOLD}${COMMAND_PREFIX} create talking cards about my LinkedIn idea${RESET}
58
60
 
59
61
  ${DIM}Open app:${RESET} ${APP_ORIGIN}
@@ -136,11 +138,23 @@ async function runToolCommand(argv) {
136
138
  process.stdout.write(JSON.stringify(result, null, 2) + "\n");
137
139
  }
138
140
 
139
- 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 } = {}) {
140
153
  if (loadToken()) {
141
154
  process.stdout.write(`${DIM}You're already signed in. Run \`mangomagic logout\` first to switch accounts.${RESET}\n`);
142
155
  await playSplash({ greetingLine: "Welcome back to MangoMagic." });
143
156
  home();
157
+ await enterChatAfterLogin(startChat);
144
158
  return;
145
159
  }
146
160
 
@@ -162,6 +176,7 @@ ${BOLD}Sign in to MangoMagic${RESET}
162
176
  process.stdout.write("\n\n");
163
177
  await playSplash({ greetingLine: "You're in. Welcome to MangoMagic." });
164
178
  home();
179
+ await enterChatAfterLogin(startChat);
165
180
  });
166
181
  }
167
182
 
@@ -238,7 +253,10 @@ function actions() {
238
253
  export async function run(argv) {
239
254
  const cmd = argv[0] ?? (loadToken() ? "home" : "login");
240
255
  switch (cmd) {
241
- 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
+ });
242
260
  case "logout": return logout();
243
261
  case "whoami": return whoami();
244
262
  case "home": return home();
@@ -256,6 +274,9 @@ export async function run(argv) {
256
274
  case "help":
257
275
  case "--help":
258
276
  case "-h": return help();
277
+ case "version":
278
+ case "--version":
279
+ case "-v": return process.stdout.write(`${PACKAGE_VERSION}\n`);
259
280
  default:
260
281
  return handleNaturalLanguage(argv.join(" "), actions());
261
282
  }