md4ai 0.7.3 → 0.7.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.
@@ -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.4" : "0.0.0-dev";
1197
1236
  }
1198
1237
  });
1199
1238
 
@@ -1807,38 +1846,9 @@ var init_mcp_watch = __esm({
1807
1846
  });
1808
1847
 
1809
1848
  // dist/index.js
1849
+ init_login();
1810
1850
  import { Command } from "commander";
1811
1851
 
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
1852
  // dist/commands/logout.js
1843
1853
  init_config();
1844
1854
  import chalk2 from "chalk";
@@ -3027,6 +3037,24 @@ async function postUpdateFlow() {
3027
3037
  console.log(chalk20.green(`
3028
3038
  md4ai v${CURRENT_VERSION} \u2014 you're on the latest version.
3029
3039
  `));
3040
+ const creds = await loadCredentials();
3041
+ const isLoggedIn = !!creds?.accessToken && Date.now() < creds.expiresAt;
3042
+ if (!isLoggedIn) {
3043
+ console.log(chalk20.yellow(" You are not logged in.\n"));
3044
+ const wantLogin = await confirm2({
3045
+ message: "Log in now?",
3046
+ default: true
3047
+ });
3048
+ if (wantLogin) {
3049
+ console.log("");
3050
+ const { loginCommand: loginCommand2 } = await Promise.resolve().then(() => (init_login(), login_exports));
3051
+ await loginCommand2();
3052
+ console.log("");
3053
+ } else {
3054
+ console.log(chalk20.dim("\nRun md4ai login when you're ready.\n"));
3055
+ return;
3056
+ }
3057
+ }
3030
3058
  const state = await loadState();
3031
3059
  const hasProject = !!state.lastFolderId;
3032
3060
  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.4",
4
4
  "description": "CLI for MD4AI — scan Claude projects and sync to your dashboard",
5
5
  "type": "module",
6
6
  "bin": {