aemeathcli 1.0.3 → 1.0.4

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.
@@ -265,6 +265,7 @@ function AutocompletePopup({ items, selectedIndex }) {
265
265
 
266
266
  // src/ui/autocomplete-data.ts
267
267
  var SLASH_COMMANDS = [
268
+ { command: "/login", description: "Log in to a provider (interactive)" },
268
269
  { command: "/help", description: "Show available commands" },
269
270
  { command: "/model", description: "Select a model with provider-specific thinking options" },
270
271
  { command: "/role", description: "Switch role (planning, coding, review, testing, bugfix)" },
@@ -277,9 +278,8 @@ var SLASH_COMMANDS = [
277
278
  { command: "/mcp add", description: "Add an MCP server" },
278
279
  { command: "/skill list", description: "List available skills" },
279
280
  { command: "/panel", description: "Change split-panel layout" },
280
- { command: "/auth login", description: "Log in to a provider (claude, codex, gemini, kimi)" },
281
- { command: "/auth status", description: "Show login status for all providers" },
282
- { command: "/auth logout", description: "Log out of a provider" },
281
+ { command: "/login status", description: "Show login status for all providers" },
282
+ { command: "/login logout", description: "Log out of a provider" },
283
283
  { command: "/config get", description: "Get a configuration value" },
284
284
  { command: "/config set", description: "Set a configuration value" },
285
285
  { command: "/quit", description: "Exit" },
@@ -1259,6 +1259,47 @@ function ThinkingSelector({
1259
1259
  })
1260
1260
  ] });
1261
1261
  }
1262
+ var PROVIDERS = [
1263
+ { label: "Claude", value: "claude", description: "Anthropic \u2014 Claude models" },
1264
+ { label: "Codex", value: "codex", description: "OpenAI \u2014 GPT / Codex models" },
1265
+ { label: "Gemini", value: "gemini", description: "Google \u2014 Gemini models" },
1266
+ { label: "Kimi", value: "kimi", description: "Moonshot \u2014 Kimi models" }
1267
+ ];
1268
+ function LoginSelector({ onSelect, onCancel }) {
1269
+ const [cursor, setCursor] = useState(0);
1270
+ useInput((_input, key) => {
1271
+ if (key.upArrow) {
1272
+ setCursor((prev) => prev > 0 ? prev - 1 : PROVIDERS.length - 1);
1273
+ } else if (key.downArrow) {
1274
+ setCursor((prev) => prev < PROVIDERS.length - 1 ? prev + 1 : 0);
1275
+ } else if (key.return) {
1276
+ const selected = PROVIDERS[cursor];
1277
+ if (selected) onSelect(selected.value);
1278
+ } else if (key.escape) {
1279
+ onCancel();
1280
+ }
1281
+ });
1282
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", padding: 1, children: [
1283
+ /* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
1284
+ /* @__PURE__ */ jsx(Text, { bold: true, color: "cyan", children: "Select a provider to log in to" }),
1285
+ /* @__PURE__ */ jsx(Text, { color: "gray", children: " (up/down navigate, Enter select, Esc cancel)" })
1286
+ ] }),
1287
+ PROVIDERS.map((provider, idx) => {
1288
+ const isHighlighted = cursor === idx;
1289
+ return /* @__PURE__ */ jsxs(Box, { children: [
1290
+ /* @__PURE__ */ jsxs(Text, { ...isHighlighted ? { color: "green" } : {}, bold: isHighlighted, children: [
1291
+ isHighlighted ? "> " : " ",
1292
+ provider.label.padEnd(12)
1293
+ ] }),
1294
+ /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
1295
+ " ",
1296
+ provider.description
1297
+ ] })
1298
+ ] }, provider.value);
1299
+ }),
1300
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: " Login will open your browser for authentication." }) })
1301
+ ] });
1302
+ }
1262
1303
  function getCandidateModels(config, resolution, activeModelId) {
1263
1304
  const candidates = [activeModelId];
1264
1305
  if (resolution.source !== "user_override" && resolution.role) {
@@ -1524,6 +1565,36 @@ ${methodLabel}: ${optionLabel}`, createdAt: /* @__PURE__ */ new Date() }
1524
1565
  const handleSelectionCancel = useCallback(() => {
1525
1566
  setSelectionMode({ type: "none" });
1526
1567
  }, []);
1568
+ const handleLoginSelected = useCallback(async (provider) => {
1569
+ setSelectionMode({ type: "none" });
1570
+ setMessages((prev) => [
1571
+ ...prev,
1572
+ { id: v4Id(), role: "system", content: `Logging in to ${provider}...`, createdAt: /* @__PURE__ */ new Date() }
1573
+ ]);
1574
+ try {
1575
+ const loginModule = await loadLoginModuleForSlash(provider);
1576
+ await loginModule.login();
1577
+ setMessages((prev) => [
1578
+ ...prev,
1579
+ { id: v4Id(), role: "system", content: `Successfully logged in to ${provider}`, createdAt: /* @__PURE__ */ new Date() }
1580
+ ]);
1581
+ } catch (error) {
1582
+ const msg = error instanceof Error ? error.message : String(error);
1583
+ setMessages((prev) => [
1584
+ ...prev,
1585
+ { id: v4Id(), role: "system", content: `Login failed: ${msg}`, createdAt: /* @__PURE__ */ new Date() }
1586
+ ]);
1587
+ }
1588
+ }, []);
1589
+ if (selectionMode.type === "login") {
1590
+ return /* @__PURE__ */ jsx(
1591
+ LoginSelector,
1592
+ {
1593
+ onSelect: (provider) => void handleLoginSelected(provider),
1594
+ onCancel: handleSelectionCancel
1595
+ }
1596
+ );
1597
+ }
1527
1598
  if (selectionMode.type === "model") {
1528
1599
  return /* @__PURE__ */ jsx(
1529
1600
  ModelSelector,
@@ -1705,8 +1776,8 @@ Valid roles: ${validRoles.join(", ")}`);
1705
1776
  }
1706
1777
  break;
1707
1778
  }
1708
- case "/auth":
1709
- await handleAuthSlashCommand(args, ctx);
1779
+ case "/login":
1780
+ await handleLoginSlashCommand(args, ctx);
1710
1781
  break;
1711
1782
  case "/config":
1712
1783
  await handleConfigSlashCommand(args, ctx);
@@ -2457,7 +2528,7 @@ ${lines.join("\n")}`);
2457
2528
  }
2458
2529
  addSystemMessage(ctx, "Usage: /skill list\nInvoke a skill with $skill-name (e.g., $review, $commit, $plan)");
2459
2530
  }
2460
- async function handleAuthSlashCommand(args, ctx) {
2531
+ async function handleLoginSlashCommand(args, ctx) {
2461
2532
  const subcommand = args[0];
2462
2533
  if (subcommand === "status") {
2463
2534
  try {
@@ -2483,25 +2554,23 @@ async function handleAuthSlashCommand(args, ctx) {
2483
2554
  }
2484
2555
  return;
2485
2556
  }
2486
- if (subcommand === "login") {
2487
- const provider = args[1];
2488
- if (!provider) {
2489
- addSystemMessage(ctx, "Usage: /auth login <provider>\nProviders: claude, codex, gemini, kimi");
2490
- return;
2491
- }
2492
- addSystemMessage(ctx, `Use the CLI command: aemeathcli auth login ${provider}`);
2493
- return;
2494
- }
2495
2557
  if (subcommand === "logout") {
2496
2558
  const provider = args[1];
2497
2559
  if (!provider) {
2498
- addSystemMessage(ctx, "Usage: /auth logout <provider>\nProviders: claude, codex, gemini, kimi");
2560
+ addSystemMessage(ctx, "Usage: /login logout <provider>\nProviders: claude, codex, gemini, kimi");
2499
2561
  return;
2500
2562
  }
2501
- addSystemMessage(ctx, `Use the CLI command: aemeathcli auth logout ${provider}`);
2563
+ try {
2564
+ const loginMod = await loadLoginModuleForSlash(provider);
2565
+ await loginMod.logout();
2566
+ addSystemMessage(ctx, `Logged out of ${provider}`);
2567
+ } catch (error) {
2568
+ const msg = error instanceof Error ? error.message : String(error);
2569
+ addSystemMessage(ctx, `Logout failed: ${msg}`);
2570
+ }
2502
2571
  return;
2503
2572
  }
2504
- addSystemMessage(ctx, "Usage: /auth status | /auth login <provider> | /auth logout <provider>");
2573
+ ctx.setSelectionMode({ type: "login" });
2505
2574
  }
2506
2575
  async function loadLoginModuleForSlash(provider) {
2507
2576
  switch (provider) {
@@ -2715,5 +2784,5 @@ async function runFirstRunSetup() {
2715
2784
  }
2716
2785
 
2717
2786
  export { runFirstRunSetup, startChatSession };
2718
- //# sourceMappingURL=App-P4MYD4QY.js.map
2719
- //# sourceMappingURL=App-P4MYD4QY.js.map
2787
+ //# sourceMappingURL=App-APN34QBQ.js.map
2788
+ //# sourceMappingURL=App-APN34QBQ.js.map