@mtreeai/msapling-cli 2.3.6-beta.10 → 2.3.6-beta.12

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.
Files changed (2) hide show
  1. package/dist/index.js +56 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8045,18 +8045,24 @@ async function promptPassword(prompt) {
8045
8045
  stdin.on("data", onData);
8046
8046
  });
8047
8047
  }
8048
- async function loginWithEmailPassword(email, context) {
8048
+ async function loginWithEmailPassword(email, context, preSuppliedPassword) {
8049
8049
  context.addMessage("system", `Logging in as ${email}...`);
8050
- let password = "";
8051
- try {
8052
- password = await promptPassword("Password: ");
8053
- if (!password) {
8054
- context.addMessage("system", "Login cancelled.");
8050
+ let password = preSuppliedPassword || process.env.MSAPLING_PASSWORD || "";
8051
+ if (!password) {
8052
+ context.addMessage(
8053
+ "system",
8054
+ "NOTE: the interactive password prompt is known to leak keystrokes into the REPL input. Safer alternatives: /login <email> <password> OR set MSAPLING_PASSWORD env var OR use /login <token>."
8055
+ );
8056
+ try {
8057
+ password = await promptPassword("Password: ");
8058
+ if (!password) {
8059
+ context.addMessage("system", "Login cancelled.");
8060
+ return;
8061
+ }
8062
+ } catch (err) {
8063
+ context.addMessage("error", `Password prompt failed: ${err}`);
8055
8064
  return;
8056
8065
  }
8057
- } catch (err) {
8058
- context.addMessage("error", `Password prompt failed: ${err}`);
8059
- return;
8060
8066
  }
8061
8067
  try {
8062
8068
  const result = await context.client.loginEmailPassword(email, password);
@@ -8184,10 +8190,10 @@ var init_login = __esm({
8184
8190
  context.addMessage(
8185
8191
  "system",
8186
8192
  `Usage:
8187
- /login your@email.com Sign in with email + password
8188
- /login github GitHub device flow
8189
- /login guest Anonymous guest session (limited tier)
8190
- /login <token> Paste an API token from msapling.com \u2192 Settings \u2192 API Keys`
8193
+ /login your@email.com [pwd] Sign in with email + password (pwd may also come from MSAPLING_PASSWORD env var)
8194
+ /login github GitHub device flow
8195
+ /login guest Anonymous guest session (limited tier)
8196
+ /login <token> Paste an API token from msapling.com \u2192 Settings \u2192 API Keys`
8191
8197
  );
8192
8198
  return;
8193
8199
  }
@@ -8196,7 +8202,8 @@ var init_login = __esm({
8196
8202
  } else if (arg === "guest") {
8197
8203
  await loginAsGuest(context);
8198
8204
  } else if (isEmailAddress(arg)) {
8199
- await loginWithEmailPassword(arg, context);
8205
+ const inlinePassword = args2[1];
8206
+ await loginWithEmailPassword(arg, context, inlinePassword);
8200
8207
  } else if (isTokenLike(arg)) {
8201
8208
  await context.storage.saveToken(arg);
8202
8209
  context.client.setToken(arg);
@@ -10391,6 +10398,37 @@ var init_outputStyle = __esm({
10391
10398
  }
10392
10399
  });
10393
10400
 
10401
+ // src/commands/totp.ts
10402
+ var totpCommand;
10403
+ var init_totp = __esm({
10404
+ "src/commands/totp.ts"() {
10405
+ "use strict";
10406
+ init_esm_shims();
10407
+ totpCommand = {
10408
+ name: "totp",
10409
+ args: "<code>",
10410
+ description: "Step up the current session with a 6-digit TOTP code",
10411
+ category: "auth",
10412
+ handler: async (args2, context) => {
10413
+ const code = (args2[0] || "").trim();
10414
+ if (!/^\d{6}$/.test(code)) {
10415
+ context.addMessage("error", "Usage: /totp <6-digit code>");
10416
+ return;
10417
+ }
10418
+ try {
10419
+ const result = await context.client.verifyLoginTotp(code);
10420
+ await context.storage.saveToken(result.token);
10421
+ context.client.setToken(result.token);
10422
+ await context.refreshOverview();
10423
+ context.addMessage("system", "TOTP verified \u2014 session now fully authenticated.");
10424
+ } catch (err) {
10425
+ context.addMessage("error", `TOTP verification failed: ${err}`);
10426
+ }
10427
+ }
10428
+ };
10429
+ }
10430
+ });
10431
+
10394
10432
  // src/commands/index.ts
10395
10433
  var commands_exports = {};
10396
10434
  __export(commands_exports, {
@@ -10438,6 +10476,7 @@ var init_commands = __esm({
10438
10476
  init_note();
10439
10477
  init_todo();
10440
10478
  init_outputStyle();
10479
+ init_totp();
10441
10480
  commands = [
10442
10481
  loginCommand,
10443
10482
  unlockCommand,
@@ -10470,7 +10509,8 @@ var init_commands = __esm({
10470
10509
  planCommand,
10471
10510
  noteCommand,
10472
10511
  todoCommand,
10473
- outputStyleCommand
10512
+ outputStyleCommand,
10513
+ totpCommand
10474
10514
  ];
10475
10515
  }
10476
10516
  });
@@ -13255,7 +13295,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
13255
13295
  var Header = () => /* @__PURE__ */ jsxs(Box, { borderStyle: "single", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [
13256
13296
  /* @__PURE__ */ jsxs(Text, { bold: true, color: "cyan", children: [
13257
13297
  "\u25CF MSapling CLI v",
13258
- "2.3.6-beta.10"
13298
+ "2.3.6-beta.12"
13259
13299
  ] }),
13260
13300
  /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Platinum Tier Architecture" }) })
13261
13301
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtreeai/msapling-cli",
3
- "version": "2.3.6-beta.10",
3
+ "version": "2.3.6-beta.12",
4
4
  "description": "MSapling CLI — React/Ink terminal client for the MSapling backend (chat, projects, MDrive, agent tools). Proprietary; redistribution prohibited.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "MSapling Team",