md4ai 0.16.3 → 0.17.1
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 +15 -107
- package/package.json +1 -1
package/dist/index.bundled.js
CHANGED
|
@@ -122,7 +122,7 @@ var CURRENT_VERSION;
|
|
|
122
122
|
var init_check_update = __esm({
|
|
123
123
|
"dist/check-update.js"() {
|
|
124
124
|
"use strict";
|
|
125
|
-
CURRENT_VERSION = true ? "0.
|
|
125
|
+
CURRENT_VERSION = true ? "0.17.1" : "0.0.0-dev";
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
|
|
@@ -134,11 +134,12 @@ var init_types = __esm({
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
// ../packages/shared/dist/constants.js
|
|
137
|
-
var SUPABASE_URL, ROOT_FILES, GLOBAL_ROOT_FILES, STALE_THRESHOLD_DAYS, CONFIG_DIR, CREDENTIALS_FILE, STATE_FILE;
|
|
137
|
+
var SUPABASE_URL, SUPABASE_ANON_KEY, ROOT_FILES, GLOBAL_ROOT_FILES, STALE_THRESHOLD_DAYS, CONFIG_DIR, CREDENTIALS_FILE, STATE_FILE;
|
|
138
138
|
var init_constants = __esm({
|
|
139
139
|
"../packages/shared/dist/constants.js"() {
|
|
140
140
|
"use strict";
|
|
141
141
|
SUPABASE_URL = "https://gkrfwmwlfnixeffhwwju.supabase.co";
|
|
142
|
+
SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImdrcmZ3bXdsZm5peGVmZmh3d2p1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzI2Mjk0ODQsImV4cCI6MjA4ODIwNTQ4NH0.R_tpV0MUG6VgKY2Fhu0jj1LSQOni87UAhX-x6B2a2GM";
|
|
142
143
|
ROOT_FILES = [
|
|
143
144
|
"CLAUDE.md",
|
|
144
145
|
".claude/settings.json",
|
|
@@ -247,11 +248,7 @@ async function loadState() {
|
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
function getAnonKey() {
|
|
250
|
-
|
|
251
|
-
if (!key) {
|
|
252
|
-
throw new Error("MD4AI_SUPABASE_ANON_KEY environment variable not set.\nSet it in your shell profile or .env file.");
|
|
253
|
-
}
|
|
254
|
-
return key;
|
|
251
|
+
return process.env.MD4AI_SUPABASE_ANON_KEY ?? SUPABASE_ANON_KEY;
|
|
255
252
|
}
|
|
256
253
|
var configPath, credentialsPath, statePath;
|
|
257
254
|
var init_config = __esm({
|
|
@@ -2616,35 +2613,11 @@ ${proposedFiles.length} file(s) proposed for deletion:
|
|
|
2616
2613
|
}
|
|
2617
2614
|
let storedManifest = null;
|
|
2618
2615
|
if (!result.envManifest) {
|
|
2619
|
-
const { data: stored, error: fetchErr } = await supabase.from("
|
|
2616
|
+
const { data: stored, error: fetchErr } = await supabase.from("device_scans").select("env_manifest_json").eq("folder_id", folder_id).eq("device_id", deviceId).maybeSingle();
|
|
2620
2617
|
if (!fetchErr && stored?.env_manifest_json) {
|
|
2621
2618
|
storedManifest = stored.env_manifest_json;
|
|
2622
2619
|
}
|
|
2623
2620
|
}
|
|
2624
|
-
const updatePayload = {
|
|
2625
|
-
graph_json: result.graph,
|
|
2626
|
-
orphans_json: result.orphans,
|
|
2627
|
-
broken_refs_json: result.brokenRefs,
|
|
2628
|
-
skills_table_json: result.skills,
|
|
2629
|
-
stale_files_json: result.staleFiles,
|
|
2630
|
-
marketplace_plugins_json: result.marketplacePlugins,
|
|
2631
|
-
last_scanned: result.scannedAt,
|
|
2632
|
-
data_hash: result.dataHash
|
|
2633
|
-
};
|
|
2634
|
-
if (result.envManifest) {
|
|
2635
|
-
updatePayload.env_manifest_json = result.envManifest;
|
|
2636
|
-
}
|
|
2637
|
-
if (result.doppler) {
|
|
2638
|
-
updatePayload.doppler_json = result.doppler;
|
|
2639
|
-
}
|
|
2640
|
-
try {
|
|
2641
|
-
const { error } = await supabase.from("claude_folders").update(updatePayload).eq("id", folder_id);
|
|
2642
|
-
if (error) {
|
|
2643
|
-
console.log(chalk12.dim(`Debug: claude_folders update skipped (${error.message})`));
|
|
2644
|
-
}
|
|
2645
|
-
} catch (err) {
|
|
2646
|
-
console.log(chalk12.dim(`Debug: claude_folders update skipped (${err instanceof Error ? err.message : String(err)})`));
|
|
2647
|
-
}
|
|
2648
2621
|
if (deviceId) {
|
|
2649
2622
|
await supabase.from("device_scans").upsert({
|
|
2650
2623
|
folder_id,
|
|
@@ -2747,25 +2720,6 @@ ${proposedFiles.length} file(s) proposed for deletion:
|
|
|
2747
2720
|
path: projectRoot,
|
|
2748
2721
|
last_synced: (/* @__PURE__ */ new Date()).toISOString()
|
|
2749
2722
|
}, { onConflict: "folder_id,device_name" });
|
|
2750
|
-
try {
|
|
2751
|
-
const { error: inlineFolderErr } = await sb.from("claude_folders").update({
|
|
2752
|
-
graph_json: result.graph,
|
|
2753
|
-
orphans_json: result.orphans,
|
|
2754
|
-
broken_refs_json: result.brokenRefs,
|
|
2755
|
-
skills_table_json: result.skills,
|
|
2756
|
-
stale_files_json: result.staleFiles,
|
|
2757
|
-
env_manifest_json: result.envManifest,
|
|
2758
|
-
doppler_json: result.doppler,
|
|
2759
|
-
marketplace_plugins_json: result.marketplacePlugins,
|
|
2760
|
-
last_scanned: result.scannedAt,
|
|
2761
|
-
data_hash: result.dataHash
|
|
2762
|
-
}).eq("id", folderId);
|
|
2763
|
-
if (inlineFolderErr) {
|
|
2764
|
-
console.log(chalk12.dim(`Debug: claude_folders update skipped (${inlineFolderErr.message})`));
|
|
2765
|
-
}
|
|
2766
|
-
} catch (err) {
|
|
2767
|
-
console.log(chalk12.dim(`Debug: claude_folders update skipped (${err instanceof Error ? err.message : String(err)})`));
|
|
2768
|
-
}
|
|
2769
2723
|
if (inlineDeviceId) {
|
|
2770
2724
|
await sb.from("device_scans").upsert({
|
|
2771
2725
|
folder_id: folderId,
|
|
@@ -2866,23 +2820,6 @@ async function syncCommand(options) {
|
|
|
2866
2820
|
const result = await scanProject(device.path, device.folder_id);
|
|
2867
2821
|
const { data: allDeviceRow } = await supabase.from("devices").select("id").eq("user_id", userId).eq("device_name", device.device_name).single();
|
|
2868
2822
|
const allDeviceId = allDeviceRow?.id;
|
|
2869
|
-
try {
|
|
2870
|
-
const { error: allFolderErr } = await supabase.from("claude_folders").update({
|
|
2871
|
-
graph_json: result.graph,
|
|
2872
|
-
orphans_json: result.orphans,
|
|
2873
|
-
broken_refs_json: result.brokenRefs,
|
|
2874
|
-
skills_table_json: result.skills,
|
|
2875
|
-
stale_files_json: result.staleFiles,
|
|
2876
|
-
env_manifest_json: result.envManifest,
|
|
2877
|
-
last_scanned: result.scannedAt,
|
|
2878
|
-
data_hash: result.dataHash
|
|
2879
|
-
}).eq("id", device.folder_id);
|
|
2880
|
-
if (allFolderErr) {
|
|
2881
|
-
console.log(chalk15.dim(` Debug: claude_folders update skipped (${allFolderErr.message})`));
|
|
2882
|
-
}
|
|
2883
|
-
} catch (folderErr) {
|
|
2884
|
-
console.log(chalk15.dim(` Debug: claude_folders update skipped (${folderErr instanceof Error ? folderErr.message : String(folderErr)})`));
|
|
2885
|
-
}
|
|
2886
2823
|
if (allDeviceId) {
|
|
2887
2824
|
await supabase.from("device_scans").upsert({
|
|
2888
2825
|
folder_id: device.folder_id,
|
|
@@ -2932,22 +2869,6 @@ async function syncCommand(options) {
|
|
|
2932
2869
|
const result = await scanProject(device.path, device.folder_id);
|
|
2933
2870
|
const { data: singleDeviceRow } = await supabase.from("devices").select("id").eq("user_id", userId).eq("device_name", device.device_name).single();
|
|
2934
2871
|
const singleDeviceId = singleDeviceRow?.id;
|
|
2935
|
-
try {
|
|
2936
|
-
const { error: singleFolderErr } = await supabase.from("claude_folders").update({
|
|
2937
|
-
graph_json: result.graph,
|
|
2938
|
-
orphans_json: result.orphans,
|
|
2939
|
-
broken_refs_json: result.brokenRefs,
|
|
2940
|
-
skills_table_json: result.skills,
|
|
2941
|
-
stale_files_json: result.staleFiles,
|
|
2942
|
-
last_scanned: result.scannedAt,
|
|
2943
|
-
data_hash: result.dataHash
|
|
2944
|
-
}).eq("id", device.folder_id);
|
|
2945
|
-
if (singleFolderErr) {
|
|
2946
|
-
console.log(chalk15.dim(`Debug: claude_folders update skipped (${singleFolderErr.message})`));
|
|
2947
|
-
}
|
|
2948
|
-
} catch (err) {
|
|
2949
|
-
console.log(chalk15.dim(`Debug: claude_folders update skipped (${err instanceof Error ? err.message : String(err)})`));
|
|
2950
|
-
}
|
|
2951
2872
|
if (singleDeviceId) {
|
|
2952
2873
|
await supabase.from("device_scans").upsert({
|
|
2953
2874
|
folder_id: device.folder_id,
|
|
@@ -3635,7 +3556,7 @@ async function mcpWatchCommand() {
|
|
|
3635
3556
|
if (hash === lastEnvHash)
|
|
3636
3557
|
return;
|
|
3637
3558
|
lastEnvHash = hash;
|
|
3638
|
-
await supabase.from("
|
|
3559
|
+
await supabase.from("device_scans").update({ env_manifest_json: envManifest }).eq("folder_id", state.lastFolderId).eq("device_id", deviceId);
|
|
3639
3560
|
}
|
|
3640
3561
|
await envCycle();
|
|
3641
3562
|
envInterval = setInterval(envCycle, ENV_POLL_INTERVAL_MS);
|
|
@@ -3679,15 +3600,21 @@ async function checkPendingRescans(supabase, deviceId, deviceName) {
|
|
|
3679
3600
|
continue;
|
|
3680
3601
|
try {
|
|
3681
3602
|
const result = await scanProject(dp.path);
|
|
3682
|
-
await supabase.from("
|
|
3603
|
+
await supabase.from("device_scans").upsert({
|
|
3604
|
+
folder_id: folder.id,
|
|
3605
|
+
device_id: deviceId,
|
|
3606
|
+
user_id: (await supabase.auth.getUser()).data.user.id,
|
|
3683
3607
|
graph_json: result.graph,
|
|
3684
3608
|
orphans_json: result.orphans,
|
|
3685
|
-
broken_refs_json: result.brokenRefs,
|
|
3686
3609
|
skills_table_json: result.skills,
|
|
3687
3610
|
stale_files_json: result.staleFiles,
|
|
3611
|
+
broken_refs_json: result.brokenRefs,
|
|
3688
3612
|
env_manifest_json: result.envManifest,
|
|
3689
|
-
last_scanned: result.scannedAt,
|
|
3690
3613
|
data_hash: result.dataHash,
|
|
3614
|
+
scanned_at: result.scannedAt,
|
|
3615
|
+
cli_version: CURRENT_VERSION
|
|
3616
|
+
}, { onConflict: "folder_id,device_id" });
|
|
3617
|
+
await supabase.from("claude_folders").update({
|
|
3691
3618
|
rescan_requested_at: null
|
|
3692
3619
|
}).eq("id", folder.id);
|
|
3693
3620
|
await pushToolings(supabase, folder.id, result.toolings, deviceId);
|
|
@@ -4146,25 +4073,6 @@ Linking "${folder.name}" to this device...
|
|
|
4146
4073
|
console.log(` Env Vars: ${result.envManifest?.variables.length ?? 0} (${result.envManifest ? "manifest found" : "no manifest"})`);
|
|
4147
4074
|
console.log(` Doppler: ${result.doppler ? `${result.doppler.configs.length} config(s) \u2014 ${result.doppler.project}` : "see above"}`);
|
|
4148
4075
|
console.log(` Plugins: ${result.marketplacePlugins.length} (${result.marketplacePlugins.reduce((n, p) => n + p.skills.length, 0)} skills)`);
|
|
4149
|
-
try {
|
|
4150
|
-
const { error: scanErr } = await supabase.from("claude_folders").update({
|
|
4151
|
-
graph_json: result.graph,
|
|
4152
|
-
orphans_json: result.orphans,
|
|
4153
|
-
broken_refs_json: result.brokenRefs,
|
|
4154
|
-
skills_table_json: result.skills,
|
|
4155
|
-
stale_files_json: result.staleFiles,
|
|
4156
|
-
env_manifest_json: result.envManifest,
|
|
4157
|
-
doppler_json: result.doppler,
|
|
4158
|
-
marketplace_plugins_json: result.marketplacePlugins,
|
|
4159
|
-
last_scanned: result.scannedAt,
|
|
4160
|
-
data_hash: result.dataHash
|
|
4161
|
-
}).eq("id", folder.id);
|
|
4162
|
-
if (scanErr) {
|
|
4163
|
-
console.log(chalk16.dim(`Debug: claude_folders update skipped (${scanErr.message})`));
|
|
4164
|
-
}
|
|
4165
|
-
} catch (err) {
|
|
4166
|
-
console.log(chalk16.dim(`Debug: claude_folders update skipped (${err instanceof Error ? err.message : String(err)})`));
|
|
4167
|
-
}
|
|
4168
4076
|
await supabase.from("device_scans").upsert({
|
|
4169
4077
|
folder_id: folder.id,
|
|
4170
4078
|
device_id: deviceId,
|