md4ai 0.8.0 → 0.8.2

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.
@@ -168,20 +168,49 @@ var init_login = __esm({
168
168
 
169
169
  // dist/auth.js
170
170
  import chalk4 from "chalk";
171
+ import { confirm, input as input2, password as password2 } from "@inquirer/prompts";
171
172
  async function getAuthenticatedClient() {
172
173
  const creds = await loadCredentials();
173
- if (!creds?.accessToken) {
174
- console.error(chalk4.red("Not logged in. Run: md4ai login"));
175
- process.exit(1);
176
- }
177
- if (Date.now() > creds.expiresAt) {
178
- console.error(chalk4.red("Session expired. Run: md4ai login"));
179
- process.exit(1);
174
+ const needsLogin = !creds?.accessToken || Date.now() > creds.expiresAt;
175
+ if (needsLogin) {
176
+ const reason = !creds?.accessToken ? "Not logged in." : "Session expired.";
177
+ console.log(chalk4.yellow(`${reason}`));
178
+ const shouldLogin = await confirm({ message: "Would you like to log in now?" });
179
+ if (!shouldLogin) {
180
+ process.exit(0);
181
+ }
182
+ return promptLogin();
180
183
  }
181
184
  const anonKey = getAnonKey();
182
185
  const supabase = createSupabaseClient(anonKey, creds.accessToken);
183
186
  return { supabase, userId: creds.userId };
184
187
  }
188
+ async function promptLogin() {
189
+ console.log("");
190
+ const email = await input2({ message: "Email:" });
191
+ const pwd = await password2({ message: "Password:" });
192
+ const anonKey = getAnonKey();
193
+ const supabase = createSupabaseClient(anonKey);
194
+ const { data, error } = await supabase.auth.signInWithPassword({
195
+ email,
196
+ password: pwd
197
+ });
198
+ if (error) {
199
+ console.error(chalk4.red(`Login failed: ${error.message}`));
200
+ process.exit(1);
201
+ }
202
+ await saveCredentials({
203
+ accessToken: data.session.access_token,
204
+ refreshToken: data.session.refresh_token,
205
+ expiresAt: Date.now() + data.session.expires_in * 1e3,
206
+ userId: data.user.id,
207
+ email: data.user.email ?? email
208
+ });
209
+ console.log(chalk4.green(`Logged in as ${data.user.email}
210
+ `));
211
+ const authedSupabase = createSupabaseClient(anonKey, data.session.access_token);
212
+ return { supabase: authedSupabase, userId: data.user.id };
213
+ }
185
214
  var init_auth = __esm({
186
215
  "dist/auth.js"() {
187
216
  "use strict";
@@ -749,7 +778,7 @@ function detectFromCli(projectRoot) {
749
778
  stdio: ["pipe", "pipe", "pipe"]
750
779
  }).trim();
751
780
  const firstLine = output.replace(/^v/, "").split("\n")[0].trim();
752
- const versionMatch = firstLine.match(/^(\d+\.\d+[^\s]*)/);
781
+ const versionMatch = firstLine.match(/(\d+\.\d+[^\s]*)/);
753
782
  const version = versionMatch?.[1] ?? firstLine;
754
783
  if (version) {
755
784
  toolings.push({
@@ -814,6 +843,7 @@ var init_tooling_detector = __esm({
814
843
  { name: "npm", command: "npm", args: ["--version"] },
815
844
  { name: "pnpm", command: "pnpm", args: ["--version"], conditionFile: "pnpm-lock.yaml" },
816
845
  { name: "supabase-cli", command: "npx", args: ["supabase", "--version"] },
846
+ { name: "vercel-cli", command: "npx", args: ["vercel", "--version"] },
817
847
  { name: "claude-code", command: "claude", args: ["--version"] }
818
848
  ];
819
849
  }
@@ -1232,7 +1262,7 @@ var CURRENT_VERSION;
1232
1262
  var init_check_update = __esm({
1233
1263
  "dist/check-update.js"() {
1234
1264
  "use strict";
1235
- CURRENT_VERSION = true ? "0.8.0" : "0.0.0-dev";
1265
+ CURRENT_VERSION = true ? "0.8.2" : "0.0.0-dev";
1236
1266
  }
1237
1267
  });
1238
1268
 
@@ -2006,11 +2036,11 @@ async function statusCommand() {
2006
2036
  // dist/commands/add-folder.js
2007
2037
  init_auth();
2008
2038
  import chalk5 from "chalk";
2009
- import { input as input2, select } from "@inquirer/prompts";
2039
+ import { input as input3, select } from "@inquirer/prompts";
2010
2040
  async function addFolderCommand() {
2011
2041
  const { supabase, userId } = await getAuthenticatedClient();
2012
- const name = await input2({ message: "Folder name:" });
2013
- const description = await input2({ message: "Description (optional):" });
2042
+ const name = await input3({ message: "Folder name:" });
2043
+ const description = await input3({ message: "Description (optional):" });
2014
2044
  const { data: teams } = await supabase.from("team_members").select("team_id, teams(id, name)").eq("user_id", userId);
2015
2045
  const { data: ownedTeams } = await supabase.from("teams").select("id, name").eq("created_by", userId);
2016
2046
  const allTeams = /* @__PURE__ */ new Map();
@@ -2057,7 +2087,7 @@ init_auth();
2057
2087
  import { resolve } from "node:path";
2058
2088
  import { hostname, platform } from "node:os";
2059
2089
  import chalk6 from "chalk";
2060
- import { input as input3, select as select2 } from "@inquirer/prompts";
2090
+ import { input as input4, select as select2 } from "@inquirer/prompts";
2061
2091
  function detectOs() {
2062
2092
  const p = platform();
2063
2093
  if (p === "win32")
@@ -2078,7 +2108,7 @@ async function addDeviceCommand() {
2078
2108
  const { supabase, userId } = await getAuthenticatedClient();
2079
2109
  const cwd = resolve(process.cwd());
2080
2110
  console.log(chalk6.blue.bold("\n\u{1F4C2} Where is this Claude project?\n"));
2081
- const localPath = await input3({
2111
+ const localPath = await input4({
2082
2112
  message: "Local project path:",
2083
2113
  default: cwd
2084
2114
  });
@@ -2092,7 +2122,7 @@ async function addDeviceCommand() {
2092
2122
  choices: folders.map((f) => ({ name: f.name, value: f.id }))
2093
2123
  });
2094
2124
  const suggested = suggestDeviceName();
2095
- const deviceName = await input3({
2125
+ const deviceName = await input4({
2096
2126
  message: "Device name:",
2097
2127
  default: suggested
2098
2128
  });
@@ -2107,7 +2137,7 @@ async function addDeviceCommand() {
2107
2137
  ],
2108
2138
  default: detectOs()
2109
2139
  });
2110
- const description = await input3({ message: "Description (optional):" });
2140
+ const description = await input4({ message: "Description (optional):" });
2111
2141
  const { error } = await supabase.from("device_paths").insert({
2112
2142
  user_id: userId,
2113
2143
  folder_id: folderId,
@@ -2621,7 +2651,7 @@ import { readFile as readFile7, writeFile as writeFile4, mkdir as mkdir3 } from
2621
2651
  import { join as join11, dirname as dirname2 } from "node:path";
2622
2652
  import { existsSync as existsSync10 } from "node:fs";
2623
2653
  import chalk14 from "chalk";
2624
- import { confirm, input as input4 } from "@inquirer/prompts";
2654
+ import { confirm as confirm2, input as input5 } from "@inquirer/prompts";
2625
2655
  async function importBundleCommand(zipPath) {
2626
2656
  if (!existsSync10(zipPath)) {
2627
2657
  console.error(chalk14.red(`File not found: ${zipPath}`));
@@ -2658,11 +2688,11 @@ Files to extract:`));
2658
2688
  for (const f of files) {
2659
2689
  console.log(` ${f.filePath}`);
2660
2690
  }
2661
- const targetDir = await input4({
2691
+ const targetDir = await input5({
2662
2692
  message: "Extract to directory:",
2663
2693
  default: process.cwd()
2664
2694
  });
2665
- const proceed = await confirm({
2695
+ const proceed = await confirm2({
2666
2696
  message: `Extract ${files.length} file(s) to ${targetDir}?`
2667
2697
  });
2668
2698
  if (!proceed) {
@@ -3152,7 +3182,7 @@ function spawnPostUpdate() {
3152
3182
  child.on("exit", (code) => process.exit(code ?? 0));
3153
3183
  }
3154
3184
  async function postUpdateFlow() {
3155
- const { confirm: confirm2 } = await import("@inquirer/prompts");
3185
+ const { confirm: confirm3 } = await import("@inquirer/prompts");
3156
3186
  console.log(chalk20.green(`
3157
3187
  md4ai v${CURRENT_VERSION} \u2014 you're on the latest version.
3158
3188
  `));
@@ -3160,7 +3190,7 @@ async function postUpdateFlow() {
3160
3190
  const isLoggedIn = !!creds?.accessToken && Date.now() < creds.expiresAt;
3161
3191
  if (!isLoggedIn) {
3162
3192
  console.log(chalk20.yellow(" You are not logged in.\n"));
3163
- const wantLogin = await confirm2({
3193
+ const wantLogin = await confirm3({
3164
3194
  message: "Log in now?",
3165
3195
  default: true
3166
3196
  });
@@ -3177,7 +3207,7 @@ async function postUpdateFlow() {
3177
3207
  const state = await loadState();
3178
3208
  const hasProject = !!state.lastFolderId;
3179
3209
  if (hasProject) {
3180
- const wantScan = await confirm2({
3210
+ const wantScan = await confirm3({
3181
3211
  message: "Rescan your project and refresh the dashboard?",
3182
3212
  default: true
3183
3213
  });
@@ -3188,7 +3218,7 @@ async function postUpdateFlow() {
3188
3218
  console.log("");
3189
3219
  }
3190
3220
  }
3191
- const wantWatch = await confirm2({
3221
+ const wantWatch = await confirm3({
3192
3222
  message: "Start monitoring MCP servers? (runs until you press Ctrl+C)",
3193
3223
  default: true
3194
3224
  });
@@ -3219,8 +3249,8 @@ async function updateCommand(options) {
3219
3249
  }
3220
3250
  console.log(chalk20.white(" Update available: ") + chalk20.dim(`v${CURRENT_VERSION}`) + chalk20.white(" \u2192 ") + chalk20.green.bold(`v${latest}
3221
3251
  `));
3222
- const { confirm: confirm2 } = await import("@inquirer/prompts");
3223
- const wantUpdate = await confirm2({
3252
+ const { confirm: confirm3 } = await import("@inquirer/prompts");
3253
+ const wantUpdate = await confirm3({
3224
3254
  message: `Install md4ai v${latest}?`,
3225
3255
  default: true
3226
3256
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md4ai",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "CLI for MD4AI — scan Claude projects and sync to your dashboard",
5
5
  "type": "module",
6
6
  "bin": {