md4ai 0.7.3 → 0.7.5

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.
@@ -127,6 +127,45 @@ var init_config = __esm({
127
127
  }
128
128
  });
129
129
 
130
+ // dist/commands/login.js
131
+ var login_exports = {};
132
+ __export(login_exports, {
133
+ loginCommand: () => loginCommand
134
+ });
135
+ import chalk from "chalk";
136
+ import { input, password } from "@inquirer/prompts";
137
+ async function loginCommand() {
138
+ console.log(chalk.blue("MD4AI Login\n"));
139
+ const email = await input({ message: "Email:" });
140
+ const pwd = await password({ message: "Password:" });
141
+ const anonKey = getAnonKey();
142
+ const supabase = createSupabaseClient(anonKey);
143
+ const { data, error } = await supabase.auth.signInWithPassword({
144
+ email,
145
+ password: pwd
146
+ });
147
+ if (error) {
148
+ console.error(chalk.red(`Login failed: ${error.message}`));
149
+ process.exit(1);
150
+ }
151
+ await saveCredentials({
152
+ accessToken: data.session.access_token,
153
+ refreshToken: data.session.refresh_token,
154
+ expiresAt: Date.now() + data.session.expires_in * 1e3,
155
+ userId: data.user.id,
156
+ email: data.user.email ?? email
157
+ });
158
+ console.log(chalk.green(`
159
+ Logged in as ${data.user.email}`));
160
+ }
161
+ var init_login = __esm({
162
+ "dist/commands/login.js"() {
163
+ "use strict";
164
+ init_dist();
165
+ init_config();
166
+ }
167
+ });
168
+
130
169
  // dist/auth.js
131
170
  import chalk4 from "chalk";
132
171
  async function getAuthenticatedClient() {
@@ -1193,7 +1232,7 @@ var CURRENT_VERSION;
1193
1232
  var init_check_update = __esm({
1194
1233
  "dist/check-update.js"() {
1195
1234
  "use strict";
1196
- CURRENT_VERSION = true ? "0.7.3" : "0.0.0-dev";
1235
+ CURRENT_VERSION = true ? "0.7.5" : "0.0.0-dev";
1197
1236
  }
1198
1237
  });
1199
1238
 
@@ -1730,6 +1769,12 @@ async function mcpWatchCommand() {
1730
1769
  const myPid = process.pid;
1731
1770
  const myTty = detectTty();
1732
1771
  console.log(chalk18.blue(`Starting MCP monitor for ${deviceName}...`));
1772
+ console.log("");
1773
+ console.log(chalk18.dim(" View this in the online dashboard at:"));
1774
+ console.log(chalk18.cyan(` https://www.md4ai.com/device/${deviceId}`));
1775
+ console.log("");
1776
+ console.log(chalk18.yellow(" Please note, closing this window will stop ALL watch reports."));
1777
+ console.log("");
1733
1778
  await supabase.from("mcp_watchers").upsert({
1734
1779
  device_id: deviceId,
1735
1780
  pid: myPid,
@@ -1807,38 +1852,9 @@ var init_mcp_watch = __esm({
1807
1852
  });
1808
1853
 
1809
1854
  // dist/index.js
1855
+ init_login();
1810
1856
  import { Command } from "commander";
1811
1857
 
1812
- // dist/commands/login.js
1813
- init_dist();
1814
- init_config();
1815
- import chalk from "chalk";
1816
- import { input, password } from "@inquirer/prompts";
1817
- async function loginCommand() {
1818
- console.log(chalk.blue("MD4AI Login\n"));
1819
- const email = await input({ message: "Email:" });
1820
- const pwd = await password({ message: "Password:" });
1821
- const anonKey = getAnonKey();
1822
- const supabase = createSupabaseClient(anonKey);
1823
- const { data, error } = await supabase.auth.signInWithPassword({
1824
- email,
1825
- password: pwd
1826
- });
1827
- if (error) {
1828
- console.error(chalk.red(`Login failed: ${error.message}`));
1829
- process.exit(1);
1830
- }
1831
- await saveCredentials({
1832
- accessToken: data.session.access_token,
1833
- refreshToken: data.session.refresh_token,
1834
- expiresAt: Date.now() + data.session.expires_in * 1e3,
1835
- userId: data.user.id,
1836
- email: data.user.email ?? email
1837
- });
1838
- console.log(chalk.green(`
1839
- Logged in as ${data.user.email}`));
1840
- }
1841
-
1842
1858
  // dist/commands/logout.js
1843
1859
  init_config();
1844
1860
  import chalk2 from "chalk";
@@ -3027,6 +3043,24 @@ async function postUpdateFlow() {
3027
3043
  console.log(chalk20.green(`
3028
3044
  md4ai v${CURRENT_VERSION} \u2014 you're on the latest version.
3029
3045
  `));
3046
+ const creds = await loadCredentials();
3047
+ const isLoggedIn = !!creds?.accessToken && Date.now() < creds.expiresAt;
3048
+ if (!isLoggedIn) {
3049
+ console.log(chalk20.yellow(" You are not logged in.\n"));
3050
+ const wantLogin = await confirm2({
3051
+ message: "Log in now?",
3052
+ default: true
3053
+ });
3054
+ if (wantLogin) {
3055
+ console.log("");
3056
+ const { loginCommand: loginCommand2 } = await Promise.resolve().then(() => (init_login(), login_exports));
3057
+ await loginCommand2();
3058
+ console.log("");
3059
+ } else {
3060
+ console.log(chalk20.dim("\nRun md4ai login when you're ready.\n"));
3061
+ return;
3062
+ }
3063
+ }
3030
3064
  const state = await loadState();
3031
3065
  const hasProject = !!state.lastFolderId;
3032
3066
  if (hasProject) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md4ai",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "CLI for MD4AI — scan Claude projects and sync to your dashboard",
5
5
  "type": "module",
6
6
  "bin": {