md4ai 0.8.1 → 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.
- package/dist/index.bundled.js +53 -24
- package/package.json +1 -1
package/dist/index.bundled.js
CHANGED
|
@@ -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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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";
|
|
@@ -1233,7 +1262,7 @@ var CURRENT_VERSION;
|
|
|
1233
1262
|
var init_check_update = __esm({
|
|
1234
1263
|
"dist/check-update.js"() {
|
|
1235
1264
|
"use strict";
|
|
1236
|
-
CURRENT_VERSION = true ? "0.8.
|
|
1265
|
+
CURRENT_VERSION = true ? "0.8.2" : "0.0.0-dev";
|
|
1237
1266
|
}
|
|
1238
1267
|
});
|
|
1239
1268
|
|
|
@@ -2007,11 +2036,11 @@ async function statusCommand() {
|
|
|
2007
2036
|
// dist/commands/add-folder.js
|
|
2008
2037
|
init_auth();
|
|
2009
2038
|
import chalk5 from "chalk";
|
|
2010
|
-
import { input as
|
|
2039
|
+
import { input as input3, select } from "@inquirer/prompts";
|
|
2011
2040
|
async function addFolderCommand() {
|
|
2012
2041
|
const { supabase, userId } = await getAuthenticatedClient();
|
|
2013
|
-
const name = await
|
|
2014
|
-
const description = await
|
|
2042
|
+
const name = await input3({ message: "Folder name:" });
|
|
2043
|
+
const description = await input3({ message: "Description (optional):" });
|
|
2015
2044
|
const { data: teams } = await supabase.from("team_members").select("team_id, teams(id, name)").eq("user_id", userId);
|
|
2016
2045
|
const { data: ownedTeams } = await supabase.from("teams").select("id, name").eq("created_by", userId);
|
|
2017
2046
|
const allTeams = /* @__PURE__ */ new Map();
|
|
@@ -2058,7 +2087,7 @@ init_auth();
|
|
|
2058
2087
|
import { resolve } from "node:path";
|
|
2059
2088
|
import { hostname, platform } from "node:os";
|
|
2060
2089
|
import chalk6 from "chalk";
|
|
2061
|
-
import { input as
|
|
2090
|
+
import { input as input4, select as select2 } from "@inquirer/prompts";
|
|
2062
2091
|
function detectOs() {
|
|
2063
2092
|
const p = platform();
|
|
2064
2093
|
if (p === "win32")
|
|
@@ -2079,7 +2108,7 @@ async function addDeviceCommand() {
|
|
|
2079
2108
|
const { supabase, userId } = await getAuthenticatedClient();
|
|
2080
2109
|
const cwd = resolve(process.cwd());
|
|
2081
2110
|
console.log(chalk6.blue.bold("\n\u{1F4C2} Where is this Claude project?\n"));
|
|
2082
|
-
const localPath = await
|
|
2111
|
+
const localPath = await input4({
|
|
2083
2112
|
message: "Local project path:",
|
|
2084
2113
|
default: cwd
|
|
2085
2114
|
});
|
|
@@ -2093,7 +2122,7 @@ async function addDeviceCommand() {
|
|
|
2093
2122
|
choices: folders.map((f) => ({ name: f.name, value: f.id }))
|
|
2094
2123
|
});
|
|
2095
2124
|
const suggested = suggestDeviceName();
|
|
2096
|
-
const deviceName = await
|
|
2125
|
+
const deviceName = await input4({
|
|
2097
2126
|
message: "Device name:",
|
|
2098
2127
|
default: suggested
|
|
2099
2128
|
});
|
|
@@ -2108,7 +2137,7 @@ async function addDeviceCommand() {
|
|
|
2108
2137
|
],
|
|
2109
2138
|
default: detectOs()
|
|
2110
2139
|
});
|
|
2111
|
-
const description = await
|
|
2140
|
+
const description = await input4({ message: "Description (optional):" });
|
|
2112
2141
|
const { error } = await supabase.from("device_paths").insert({
|
|
2113
2142
|
user_id: userId,
|
|
2114
2143
|
folder_id: folderId,
|
|
@@ -2622,7 +2651,7 @@ import { readFile as readFile7, writeFile as writeFile4, mkdir as mkdir3 } from
|
|
|
2622
2651
|
import { join as join11, dirname as dirname2 } from "node:path";
|
|
2623
2652
|
import { existsSync as existsSync10 } from "node:fs";
|
|
2624
2653
|
import chalk14 from "chalk";
|
|
2625
|
-
import { confirm, input as
|
|
2654
|
+
import { confirm as confirm2, input as input5 } from "@inquirer/prompts";
|
|
2626
2655
|
async function importBundleCommand(zipPath) {
|
|
2627
2656
|
if (!existsSync10(zipPath)) {
|
|
2628
2657
|
console.error(chalk14.red(`File not found: ${zipPath}`));
|
|
@@ -2659,11 +2688,11 @@ Files to extract:`));
|
|
|
2659
2688
|
for (const f of files) {
|
|
2660
2689
|
console.log(` ${f.filePath}`);
|
|
2661
2690
|
}
|
|
2662
|
-
const targetDir = await
|
|
2691
|
+
const targetDir = await input5({
|
|
2663
2692
|
message: "Extract to directory:",
|
|
2664
2693
|
default: process.cwd()
|
|
2665
2694
|
});
|
|
2666
|
-
const proceed = await
|
|
2695
|
+
const proceed = await confirm2({
|
|
2667
2696
|
message: `Extract ${files.length} file(s) to ${targetDir}?`
|
|
2668
2697
|
});
|
|
2669
2698
|
if (!proceed) {
|
|
@@ -3153,7 +3182,7 @@ function spawnPostUpdate() {
|
|
|
3153
3182
|
child.on("exit", (code) => process.exit(code ?? 0));
|
|
3154
3183
|
}
|
|
3155
3184
|
async function postUpdateFlow() {
|
|
3156
|
-
const { confirm:
|
|
3185
|
+
const { confirm: confirm3 } = await import("@inquirer/prompts");
|
|
3157
3186
|
console.log(chalk20.green(`
|
|
3158
3187
|
md4ai v${CURRENT_VERSION} \u2014 you're on the latest version.
|
|
3159
3188
|
`));
|
|
@@ -3161,7 +3190,7 @@ async function postUpdateFlow() {
|
|
|
3161
3190
|
const isLoggedIn = !!creds?.accessToken && Date.now() < creds.expiresAt;
|
|
3162
3191
|
if (!isLoggedIn) {
|
|
3163
3192
|
console.log(chalk20.yellow(" You are not logged in.\n"));
|
|
3164
|
-
const wantLogin = await
|
|
3193
|
+
const wantLogin = await confirm3({
|
|
3165
3194
|
message: "Log in now?",
|
|
3166
3195
|
default: true
|
|
3167
3196
|
});
|
|
@@ -3178,7 +3207,7 @@ async function postUpdateFlow() {
|
|
|
3178
3207
|
const state = await loadState();
|
|
3179
3208
|
const hasProject = !!state.lastFolderId;
|
|
3180
3209
|
if (hasProject) {
|
|
3181
|
-
const wantScan = await
|
|
3210
|
+
const wantScan = await confirm3({
|
|
3182
3211
|
message: "Rescan your project and refresh the dashboard?",
|
|
3183
3212
|
default: true
|
|
3184
3213
|
});
|
|
@@ -3189,7 +3218,7 @@ async function postUpdateFlow() {
|
|
|
3189
3218
|
console.log("");
|
|
3190
3219
|
}
|
|
3191
3220
|
}
|
|
3192
|
-
const wantWatch = await
|
|
3221
|
+
const wantWatch = await confirm3({
|
|
3193
3222
|
message: "Start monitoring MCP servers? (runs until you press Ctrl+C)",
|
|
3194
3223
|
default: true
|
|
3195
3224
|
});
|
|
@@ -3220,8 +3249,8 @@ async function updateCommand(options) {
|
|
|
3220
3249
|
}
|
|
3221
3250
|
console.log(chalk20.white(" Update available: ") + chalk20.dim(`v${CURRENT_VERSION}`) + chalk20.white(" \u2192 ") + chalk20.green.bold(`v${latest}
|
|
3222
3251
|
`));
|
|
3223
|
-
const { confirm:
|
|
3224
|
-
const wantUpdate = await
|
|
3252
|
+
const { confirm: confirm3 } = await import("@inquirer/prompts");
|
|
3253
|
+
const wantUpdate = await confirm3({
|
|
3225
3254
|
message: `Install md4ai v${latest}?`,
|
|
3226
3255
|
default: true
|
|
3227
3256
|
});
|