md4ai 0.7.9 → 0.8.0

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.
@@ -1232,7 +1232,7 @@ var CURRENT_VERSION;
1232
1232
  var init_check_update = __esm({
1233
1233
  "dist/check-update.js"() {
1234
1234
  "use strict";
1235
- CURRENT_VERSION = true ? "0.7.9" : "0.0.0-dev";
1235
+ CURRENT_VERSION = true ? "0.8.0" : "0.0.0-dev";
1236
1236
  }
1237
1237
  });
1238
1238
 
@@ -1750,7 +1750,7 @@ function buildRows(configs, httpResults) {
1750
1750
  return rows;
1751
1751
  }
1752
1752
  function printTable(rows, deviceName) {
1753
- process.stdout.write("\x1B[2J\x1B[H");
1753
+ process.stdout.write("\x1B[3J\x1B[2J\x1B[H");
1754
1754
  console.log(chalk18.bold.cyan(`
1755
1755
  MCP Monitor \u2014 ${deviceName}`));
1756
1756
  console.log(chalk18.dim(` ${(/* @__PURE__ */ new Date()).toLocaleTimeString()} \xB7 refreshes every 30s \xB7 Ctrl+C to stop
@@ -1889,7 +1889,14 @@ async function mcpWatchCommand() {
1889
1889
  }
1890
1890
  await envCycle();
1891
1891
  const envInterval = setInterval(envCycle, ENV_POLL_INTERVAL_MS);
1892
- const interval = setInterval(cycle, POLL_INTERVAL_MS);
1892
+ async function rescanCycle() {
1893
+ await checkPendingRescans(supabase, deviceId, deviceName);
1894
+ }
1895
+ async function fullCycle() {
1896
+ await cycle();
1897
+ await rescanCycle();
1898
+ }
1899
+ const interval = setInterval(fullCycle, POLL_INTERVAL_MS);
1893
1900
  const shutdown = async () => {
1894
1901
  clearInterval(interval);
1895
1902
  clearInterval(envInterval);
@@ -1904,6 +1911,41 @@ async function mcpWatchCommand() {
1904
1911
  void shutdown();
1905
1912
  });
1906
1913
  }
1914
+ async function checkPendingRescans(supabase, deviceId, deviceName) {
1915
+ const { data: paths } = await supabase.from("device_paths").select("folder_id, path").eq("device_name", deviceName);
1916
+ if (!paths?.length)
1917
+ return;
1918
+ const folderIds = paths.map((p) => p.folder_id);
1919
+ const { data: folders } = await supabase.from("claude_folders").select("id, last_scanned, rescan_requested_at").in("id", folderIds).not("rescan_requested_at", "is", null);
1920
+ if (!folders?.length)
1921
+ return;
1922
+ for (const folder of folders) {
1923
+ const requested = new Date(folder.rescan_requested_at).getTime();
1924
+ const scanned = folder.last_scanned ? new Date(folder.last_scanned).getTime() : 0;
1925
+ if (requested <= scanned)
1926
+ continue;
1927
+ const dp = paths.find((p) => p.folder_id === folder.id);
1928
+ if (!dp?.path)
1929
+ continue;
1930
+ try {
1931
+ const result = await scanProject(dp.path);
1932
+ await supabase.from("claude_folders").update({
1933
+ graph_json: result.graph,
1934
+ orphans_json: result.orphans,
1935
+ skills_table_json: result.skills,
1936
+ stale_files_json: result.staleFiles,
1937
+ env_manifest_json: result.envManifest,
1938
+ last_scanned: result.scannedAt,
1939
+ data_hash: result.dataHash,
1940
+ rescan_requested_at: null
1941
+ }).eq("id", folder.id);
1942
+ await pushToolings(supabase, folder.id, result.toolings);
1943
+ await supabase.from("device_paths").update({ last_synced: (/* @__PURE__ */ new Date()).toISOString() }).eq("folder_id", folder.id).eq("device_name", deviceName);
1944
+ } catch {
1945
+ await supabase.from("claude_folders").update({ rescan_requested_at: null }).eq("id", folder.id);
1946
+ }
1947
+ }
1948
+ }
1907
1949
  var POLL_INTERVAL_MS, ENV_POLL_INTERVAL_MS;
1908
1950
  var init_mcp_watch = __esm({
1909
1951
  "dist/commands/mcp-watch.js"() {
@@ -1914,6 +1956,8 @@ var init_mcp_watch = __esm({
1914
1956
  init_scan_processes();
1915
1957
  init_check_update();
1916
1958
  init_env_manifest_scanner();
1959
+ init_scanner();
1960
+ init_push_toolings();
1917
1961
  init_config();
1918
1962
  POLL_INTERVAL_MS = 3e4;
1919
1963
  ENV_POLL_INTERVAL_MS = 3e5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md4ai",
3
- "version": "0.7.9",
3
+ "version": "0.8.0",
4
4
  "description": "CLI for MD4AI — scan Claude projects and sync to your dashboard",
5
5
  "type": "module",
6
6
  "bin": {