@drewpayment/mink 0.3.0 → 0.4.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.
package/dist/cli.js CHANGED
@@ -189,11 +189,14 @@ __export(exports_paths, {
189
189
  projectMetaPath: () => projectMetaPath,
190
190
  projectDir: () => projectDir,
191
191
  minkRoot: () => minkRoot,
192
+ localConfigPath: () => localConfigPath,
192
193
  learningMemoryPath: () => learningMemoryPath,
193
194
  globalConfigPath: () => globalConfigPath,
194
195
  frameworkAdvisorPath: () => frameworkAdvisorPath,
195
196
  frameworkAdvisorJsonPath: () => frameworkAdvisorJsonPath,
196
197
  fileIndexPath: () => fileIndexPath,
198
+ deviceRegistryPath: () => deviceRegistryPath,
199
+ deviceIdPath: () => deviceIdPath,
197
200
  designReportPath: () => designReportPath,
198
201
  designCapturesDir: () => designCapturesDir,
199
202
  configPath: () => configPath,
@@ -246,6 +249,15 @@ function schedulerManifestPath(cwd) {
246
249
  function globalConfigPath() {
247
250
  return join(MINK_ROOT, "config");
248
251
  }
252
+ function localConfigPath() {
253
+ return join(MINK_ROOT, "config.local");
254
+ }
255
+ function deviceIdPath() {
256
+ return join(MINK_ROOT, "device-id");
257
+ }
258
+ function deviceRegistryPath() {
259
+ return join(MINK_ROOT, "devices.json");
260
+ }
249
261
  function projectMetaPath(cwd) {
250
262
  return join(projectDir(cwd), "project-meta.json");
251
263
  }
@@ -560,96 +572,139 @@ var init_config = __esm(() => {
560
572
  key: "wiki.path",
561
573
  default: "~/.mink/wiki/",
562
574
  envVar: "MINK_WIKI_PATH",
563
- description: "Wiki vault location"
575
+ description: "Wiki vault location",
576
+ scope: "local"
564
577
  },
565
578
  {
566
579
  key: "wiki.enabled",
567
580
  default: "true",
568
581
  envVar: "MINK_WIKI_ENABLED",
569
- description: "Enable/disable the wiki feature"
582
+ description: "Enable/disable the wiki feature",
583
+ scope: "shared"
570
584
  },
571
585
  {
572
586
  key: "wiki.sync-mode",
573
587
  default: "immediate",
574
588
  envVar: "MINK_WIKI_SYNC_MODE",
575
- description: "Sync mode: immediate or batched"
589
+ description: "Sync mode: immediate or batched",
590
+ scope: "shared"
576
591
  },
577
592
  {
578
593
  key: "wiki.git-backup",
579
594
  default: "false",
580
595
  envVar: "MINK_WIKI_GIT_BACKUP",
581
- description: "Deprecated: use sync.enabled instead"
596
+ description: "Deprecated: use sync.enabled instead",
597
+ scope: "shared"
582
598
  },
583
599
  {
584
600
  key: "wiki.git-remote",
585
601
  default: "origin",
586
602
  envVar: "MINK_WIKI_GIT_REMOTE",
587
- description: "Deprecated: use sync.remote-url instead"
603
+ description: "Deprecated: use sync.remote-url instead",
604
+ scope: "shared"
588
605
  },
589
606
  {
590
607
  key: "notes.default-category",
591
608
  default: "inbox",
592
609
  envVar: "MINK_NOTES_DEFAULT_CATEGORY",
593
- description: "Default category for notes captured via CLI"
610
+ description: "Default category for notes captured via CLI",
611
+ scope: "shared"
594
612
  },
595
613
  {
596
614
  key: "sync.enabled",
597
615
  default: "false",
598
616
  envVar: "MINK_SYNC_ENABLED",
599
- description: "Enable/disable automatic git sync of ~/.mink"
617
+ description: "Enable/disable automatic git sync of ~/.mink",
618
+ scope: "shared"
600
619
  },
601
620
  {
602
621
  key: "sync.remote-url",
603
622
  default: "",
604
623
  envVar: "MINK_SYNC_REMOTE_URL",
605
- description: "Git remote URL for ~/.mink sync"
624
+ description: "Git remote URL for ~/.mink sync",
625
+ scope: "shared"
606
626
  },
607
627
  {
608
628
  key: "sync.last-push",
609
629
  default: "",
610
630
  envVar: "MINK_SYNC_LAST_PUSH",
611
- description: "ISO timestamp of last successful sync push"
631
+ description: "ISO timestamp of last successful sync push",
632
+ scope: "local"
612
633
  },
613
634
  {
614
635
  key: "sync.last-pull",
615
636
  default: "",
616
637
  envVar: "MINK_SYNC_LAST_PULL",
617
- description: "ISO timestamp of last successful sync pull"
638
+ description: "ISO timestamp of last successful sync pull",
639
+ scope: "local"
618
640
  }
619
641
  ];
620
642
  VALID_KEYS = new Set(CONFIG_KEYS.map((k) => k.key));
621
643
  });
622
644
 
623
645
  // src/core/global-config.ts
624
- function loadGlobalConfig() {
625
- const raw = safeReadJson(globalConfigPath());
646
+ var exports_global_config = {};
647
+ __export(exports_global_config, {
648
+ setConfigValue: () => setConfigValue,
649
+ saveLocalConfig: () => saveLocalConfig,
650
+ saveGlobalConfig: () => saveGlobalConfig,
651
+ resolveConfigValue: () => resolveConfigValue,
652
+ resolveAllConfig: () => resolveAllConfig,
653
+ resetConfigKey: () => resetConfigKey,
654
+ resetAllConfig: () => resetAllConfig,
655
+ migrateConfigIfNeeded: () => migrateConfigIfNeeded,
656
+ loadLocalConfig: () => loadLocalConfig,
657
+ loadGlobalConfig: () => loadGlobalConfig
658
+ });
659
+ function loadConfigFile(path) {
660
+ const raw = safeReadJson(path);
626
661
  if (raw === null)
627
662
  return {};
628
663
  if (typeof raw !== "object" || Array.isArray(raw)) {
629
- console.warn("[mink] warning: corrupt config file at " + globalConfigPath());
664
+ console.warn("[mink] warning: corrupt config file at " + path);
630
665
  return {};
631
666
  }
632
667
  return raw;
633
668
  }
669
+ function loadGlobalConfig() {
670
+ return loadConfigFile(globalConfigPath());
671
+ }
634
672
  function saveGlobalConfig(config) {
635
673
  atomicWriteJson(globalConfigPath(), config);
636
674
  }
675
+ function loadLocalConfig() {
676
+ return loadConfigFile(localConfigPath());
677
+ }
678
+ function saveLocalConfig(config) {
679
+ atomicWriteJson(localConfigPath(), config);
680
+ }
681
+ function loadConfigForScope(scope) {
682
+ return scope === "local" ? loadLocalConfig() : loadGlobalConfig();
683
+ }
684
+ function saveConfigForScope(scope, config) {
685
+ if (scope === "local") {
686
+ saveLocalConfig(config);
687
+ } else {
688
+ saveGlobalConfig(config);
689
+ }
690
+ }
637
691
  function resolveConfigValue(key) {
638
692
  const meta = getConfigKeyMeta(key);
639
- const config = loadGlobalConfig();
693
+ const config = loadConfigForScope(meta.scope);
640
694
  const envValue = process.env[meta.envVar];
641
695
  const fileValue = config[key];
642
696
  if (envValue !== undefined && envValue !== "") {
643
697
  return {
644
698
  value: envValue,
645
699
  source: "environment variable",
700
+ scope: meta.scope,
646
701
  configFileValue: fileValue
647
702
  };
648
703
  }
649
704
  if (fileValue !== undefined) {
650
- return { value: fileValue, source: "config file" };
705
+ return { value: fileValue, source: "config file", scope: meta.scope };
651
706
  }
652
- return { value: meta.default, source: "default" };
707
+ return { value: meta.default, source: "default", scope: meta.scope };
653
708
  }
654
709
  function resolveAllConfig() {
655
710
  return CONFIG_KEYS.map((meta) => ({
@@ -658,18 +713,46 @@ function resolveAllConfig() {
658
713
  }));
659
714
  }
660
715
  function setConfigValue(key, value) {
661
- const config = loadGlobalConfig();
716
+ const meta = getConfigKeyMeta(key);
717
+ const config = loadConfigForScope(meta.scope);
662
718
  config[key] = value;
663
- saveGlobalConfig(config);
719
+ saveConfigForScope(meta.scope, config);
664
720
  }
665
721
  function resetConfigKey(key) {
666
- const config = loadGlobalConfig();
722
+ const meta = getConfigKeyMeta(key);
723
+ const config = loadConfigForScope(meta.scope);
667
724
  delete config[key];
668
- saveGlobalConfig(config);
725
+ saveConfigForScope(meta.scope, config);
669
726
  }
670
727
  function resetAllConfig() {
671
728
  saveGlobalConfig({});
729
+ saveLocalConfig({});
730
+ }
731
+ function migrateConfigIfNeeded() {
732
+ if (migrationRan)
733
+ return;
734
+ migrationRan = true;
735
+ const { existsSync } = __require("fs");
736
+ if (existsSync(localConfigPath()))
737
+ return;
738
+ const shared = loadGlobalConfig();
739
+ const localKeys = CONFIG_KEYS.filter((k) => k.scope === "local");
740
+ const localConfig = {};
741
+ let hasLocal = false;
742
+ for (const meta of localKeys) {
743
+ const val = shared[meta.key];
744
+ if (val !== undefined) {
745
+ localConfig[meta.key] = val;
746
+ delete shared[meta.key];
747
+ hasLocal = true;
748
+ }
749
+ }
750
+ if (hasLocal) {
751
+ saveLocalConfig(localConfig);
752
+ saveGlobalConfig(shared);
753
+ }
672
754
  }
755
+ var migrationRan = false;
673
756
  var init_global_config = __esm(() => {
674
757
  init_paths();
675
758
  init_fs_utils();
@@ -1010,6 +1093,81 @@ var init_note_index = __esm(() => {
1010
1093
  ]);
1011
1094
  });
1012
1095
 
1096
+ // src/core/device.ts
1097
+ var exports_device = {};
1098
+ __export(exports_device, {
1099
+ updateDeviceHeartbeat: () => updateDeviceHeartbeat,
1100
+ setDeviceName: () => setDeviceName,
1101
+ saveDeviceRegistry: () => saveDeviceRegistry,
1102
+ loadDeviceRegistry: () => loadDeviceRegistry,
1103
+ listDevices: () => listDevices,
1104
+ getOrCreateDeviceId: () => getOrCreateDeviceId
1105
+ });
1106
+ import { existsSync as existsSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3 } from "fs";
1107
+ import { dirname as dirname2 } from "path";
1108
+ import { hostname, platform } from "os";
1109
+ import { randomUUID } from "crypto";
1110
+ function getOrCreateDeviceId() {
1111
+ const idPath = deviceIdPath();
1112
+ if (existsSync3(idPath)) {
1113
+ return readFileSync4(idPath, "utf-8").trim();
1114
+ }
1115
+ const id = randomUUID();
1116
+ mkdirSync3(dirname2(idPath), { recursive: true });
1117
+ writeFileSync2(idPath, id + `
1118
+ `);
1119
+ return id;
1120
+ }
1121
+ function loadDeviceRegistry() {
1122
+ const raw = safeReadJson(deviceRegistryPath());
1123
+ if (raw !== null && typeof raw === "object" && !Array.isArray(raw) && "devices" in raw) {
1124
+ return raw;
1125
+ }
1126
+ return { devices: {} };
1127
+ }
1128
+ function saveDeviceRegistry(registry) {
1129
+ atomicWriteJson(deviceRegistryPath(), registry);
1130
+ }
1131
+ function updateDeviceHeartbeat() {
1132
+ const id = getOrCreateDeviceId();
1133
+ const registry = loadDeviceRegistry();
1134
+ const now = new Date().toISOString();
1135
+ const existing = registry.devices[id];
1136
+ registry.devices[id] = {
1137
+ name: existing?.name ?? hostname(),
1138
+ hostname: hostname(),
1139
+ platform: platform(),
1140
+ firstSeen: existing?.firstSeen ?? now,
1141
+ lastSeen: now
1142
+ };
1143
+ saveDeviceRegistry(registry);
1144
+ }
1145
+ function listDevices() {
1146
+ const registry = loadDeviceRegistry();
1147
+ return Object.entries(registry.devices).map(([id, info]) => ({
1148
+ id,
1149
+ ...info
1150
+ }));
1151
+ }
1152
+ function setDeviceName(name) {
1153
+ const id = getOrCreateDeviceId();
1154
+ const registry = loadDeviceRegistry();
1155
+ const now = new Date().toISOString();
1156
+ const existing = registry.devices[id];
1157
+ registry.devices[id] = {
1158
+ name,
1159
+ hostname: hostname(),
1160
+ platform: platform(),
1161
+ firstSeen: existing?.firstSeen ?? now,
1162
+ lastSeen: now
1163
+ };
1164
+ saveDeviceRegistry(registry);
1165
+ }
1166
+ var init_device = __esm(() => {
1167
+ init_paths();
1168
+ init_fs_utils();
1169
+ });
1170
+
1013
1171
  // src/core/sync.ts
1014
1172
  var exports_sync = {};
1015
1173
  __export(exports_sync, {
@@ -1021,7 +1179,7 @@ __export(exports_sync, {
1021
1179
  ensureGitignore: () => ensureGitignore,
1022
1180
  disconnectSync: () => disconnectSync
1023
1181
  });
1024
- import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
1182
+ import { existsSync as existsSync4, writeFileSync as writeFileSync3 } from "fs";
1025
1183
  import { join as join4 } from "path";
1026
1184
  import { execSync } from "child_process";
1027
1185
  function git(args, timeoutMs = GIT_TIMEOUT) {
@@ -1042,15 +1200,15 @@ function isSyncInitialized() {
1042
1200
  const enabled = resolveConfigValue("sync.enabled").value;
1043
1201
  if (enabled !== "true")
1044
1202
  return false;
1045
- return existsSync3(join4(minkRoot(), ".git"));
1203
+ return existsSync4(join4(minkRoot(), ".git"));
1046
1204
  }
1047
1205
  function ensureGitignore() {
1048
1206
  const gitignorePath = join4(minkRoot(), ".gitignore");
1049
- writeFileSync2(gitignorePath, GITIGNORE_CONTENTS);
1207
+ writeFileSync3(gitignorePath, GITIGNORE_CONTENTS);
1050
1208
  }
1051
1209
  function getSyncStatus() {
1052
1210
  const enabled = resolveConfigValue("sync.enabled").value === "true";
1053
- const gitInitialized = existsSync3(join4(minkRoot(), ".git"));
1211
+ const gitInitialized = existsSync4(join4(minkRoot(), ".git"));
1054
1212
  const remoteUrl = resolveConfigValue("sync.remote-url").value;
1055
1213
  const lastPush = resolveConfigValue("sync.last-push").value;
1056
1214
  const lastPull = resolveConfigValue("sync.last-pull").value;
@@ -1077,7 +1235,7 @@ function getSyncStatus() {
1077
1235
  function initSync(remoteUrl) {
1078
1236
  const root = minkRoot();
1079
1237
  const gitDir = join4(root, ".git");
1080
- if (existsSync3(gitDir)) {
1238
+ if (existsSync4(gitDir)) {
1081
1239
  console.log("[mink] sync is already initialized in " + root);
1082
1240
  console.log("[mink] run 'mink sync disconnect' first to reinitialize");
1083
1241
  return;
@@ -1129,6 +1287,7 @@ function initSync(remoteUrl) {
1129
1287
  function syncPull(onMessage = (msg) => console.error(msg)) {
1130
1288
  if (!isSyncInitialized())
1131
1289
  return;
1290
+ ensureGitignore();
1132
1291
  const root = minkRoot();
1133
1292
  try {
1134
1293
  const status = gitSafe("status --porcelain");
@@ -1140,7 +1299,7 @@ function syncPull(onMessage = (msg) => console.error(msg)) {
1140
1299
  try {
1141
1300
  git(`pull --rebase origin ${branch}`, FETCH_TIMEOUT);
1142
1301
  } catch (err) {
1143
- if (existsSync3(join4(root, ".git", "rebase-merge")) || existsSync3(join4(root, ".git", "rebase-apply"))) {
1302
+ if (existsSync4(join4(root, ".git", "rebase-merge")) || existsSync4(join4(root, ".git", "rebase-apply"))) {
1144
1303
  gitSafe("rebase --abort");
1145
1304
  onMessage("[mink] sync pull: rebase conflict detected — aborted rebase, local state preserved");
1146
1305
  onMessage("[mink] resolve manually with 'mink sync pull' or 'cd ~/.mink && git pull --rebase origin main'");
@@ -1156,6 +1315,9 @@ function syncPull(onMessage = (msg) => console.error(msg)) {
1156
1315
  }
1157
1316
  }
1158
1317
  setConfigValue("sync.last-pull", new Date().toISOString());
1318
+ try {
1319
+ updateDeviceHeartbeat();
1320
+ } catch {}
1159
1321
  } catch (err) {
1160
1322
  onMessage(`[mink] sync pull error: ${err instanceof Error ? err.message : String(err)}`);
1161
1323
  }
@@ -1163,6 +1325,10 @@ function syncPull(onMessage = (msg) => console.error(msg)) {
1163
1325
  function syncPush(onMessage = (msg) => console.error(msg)) {
1164
1326
  if (!isSyncInitialized())
1165
1327
  return;
1328
+ ensureGitignore();
1329
+ try {
1330
+ updateDeviceHeartbeat();
1331
+ } catch {}
1166
1332
  const root = minkRoot();
1167
1333
  try {
1168
1334
  const status = gitSafe("status --porcelain");
@@ -1182,7 +1348,7 @@ function syncPush(onMessage = (msg) => console.error(msg)) {
1182
1348
  try {
1183
1349
  git(`pull --rebase origin ${branch}`, FETCH_TIMEOUT);
1184
1350
  } catch {
1185
- if (existsSync3(join4(root, ".git", "rebase-merge")) || existsSync3(join4(root, ".git", "rebase-apply"))) {
1351
+ if (existsSync4(join4(root, ".git", "rebase-merge")) || existsSync4(join4(root, ".git", "rebase-apply"))) {
1186
1352
  gitSafe("rebase --abort");
1187
1353
  onMessage("[mink] sync: rebase conflict during push — local commit preserved, skipping push");
1188
1354
  onMessage("[mink] resolve manually with 'mink sync pull' then 'mink sync push'");
@@ -1202,7 +1368,7 @@ function syncPush(onMessage = (msg) => console.error(msg)) {
1202
1368
  function disconnectSync() {
1203
1369
  const root = minkRoot();
1204
1370
  const gitDir = join4(root, ".git");
1205
- if (!existsSync3(gitDir)) {
1371
+ if (!existsSync4(gitDir)) {
1206
1372
  console.log("[mink] sync is not initialized — nothing to disconnect");
1207
1373
  return;
1208
1374
  }
@@ -1228,12 +1394,17 @@ var GIT_TIMEOUT = 5000, PUSH_TIMEOUT = 1e4, FETCH_TIMEOUT = 15000, GITIGNORE_CON
1228
1394
  scheduler.pid
1229
1395
  scheduler.log
1230
1396
 
1397
+ # Device identity and local config — machine-specific
1398
+ device-id
1399
+ config.local
1400
+
1231
1401
  # Local backups — machine-specific snapshots
1232
1402
  projects/*/backups/
1233
1403
  `;
1234
1404
  var init_sync = __esm(() => {
1235
1405
  init_paths();
1236
1406
  init_global_config();
1407
+ init_device();
1237
1408
  });
1238
1409
 
1239
1410
  // src/core/learning-memory.ts
@@ -1611,13 +1782,13 @@ var exports_reflect = {};
1611
1782
  __export(exports_reflect, {
1612
1783
  reflect: () => reflect
1613
1784
  });
1614
- import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
1785
+ import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
1615
1786
  function reflect(projectDir2, memoryPath, configPath2) {
1616
- if (!existsSync4(memoryPath)) {
1787
+ if (!existsSync5(memoryPath)) {
1617
1788
  console.log("[mink] no learning memory found");
1618
1789
  return null;
1619
1790
  }
1620
- const markdown = readFileSync5(memoryPath, "utf-8");
1791
+ const markdown = readFileSync6(memoryPath, "utf-8");
1621
1792
  const mem = parseLearningMemory(markdown);
1622
1793
  const config = safeReadJson(configPath2);
1623
1794
  const tokenBudget = config?.learningMemoryTokenBudget ?? DEFAULT_TOKEN_BUDGET;
@@ -1913,11 +2084,14 @@ __export(exports_paths2, {
1913
2084
  projectMetaPath: () => projectMetaPath2,
1914
2085
  projectDir: () => projectDir2,
1915
2086
  minkRoot: () => minkRoot2,
2087
+ localConfigPath: () => localConfigPath2,
1916
2088
  learningMemoryPath: () => learningMemoryPath2,
1917
2089
  globalConfigPath: () => globalConfigPath2,
1918
2090
  frameworkAdvisorPath: () => frameworkAdvisorPath2,
1919
2091
  frameworkAdvisorJsonPath: () => frameworkAdvisorJsonPath2,
1920
2092
  fileIndexPath: () => fileIndexPath2,
2093
+ deviceRegistryPath: () => deviceRegistryPath2,
2094
+ deviceIdPath: () => deviceIdPath2,
1921
2095
  designReportPath: () => designReportPath2,
1922
2096
  designCapturesDir: () => designCapturesDir2,
1923
2097
  configPath: () => configPath2,
@@ -1970,6 +2144,15 @@ function schedulerManifestPath2(cwd) {
1970
2144
  function globalConfigPath2() {
1971
2145
  return join7(MINK_ROOT2, "config");
1972
2146
  }
2147
+ function localConfigPath2() {
2148
+ return join7(MINK_ROOT2, "config.local");
2149
+ }
2150
+ function deviceIdPath2() {
2151
+ return join7(MINK_ROOT2, "device-id");
2152
+ }
2153
+ function deviceRegistryPath2() {
2154
+ return join7(MINK_ROOT2, "devices.json");
2155
+ }
1973
2156
  function projectMetaPath2(cwd) {
1974
2157
  return join7(projectDir2(cwd), "project-meta.json");
1975
2158
  }
@@ -2002,11 +2185,11 @@ __export(exports_backup, {
2002
2185
  createBackup: () => createBackup
2003
2186
  });
2004
2187
  import {
2005
- mkdirSync as mkdirSync4,
2188
+ mkdirSync as mkdirSync5,
2006
2189
  readdirSync as readdirSync2,
2007
- readFileSync as readFileSync7,
2008
- writeFileSync as writeFileSync3,
2009
- existsSync as existsSync6,
2190
+ readFileSync as readFileSync8,
2191
+ writeFileSync as writeFileSync4,
2192
+ existsSync as existsSync7,
2010
2193
  statSync as statSync3
2011
2194
  } from "fs";
2012
2195
  import { join as join8 } from "path";
@@ -2021,7 +2204,7 @@ function formatTimestamp(date) {
2021
2204
  return `${y}${mo}${d}-${h}${mi}${s}${ms}`;
2022
2205
  }
2023
2206
  function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
2024
- mkdirSync4(destDir, { recursive: true });
2207
+ mkdirSync5(destDir, { recursive: true });
2025
2208
  const entries = readdirSync2(srcDir, { withFileTypes: true });
2026
2209
  for (const entry of entries) {
2027
2210
  if (entry.isDirectory()) {
@@ -2029,7 +2212,7 @@ function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
2029
2212
  continue;
2030
2213
  copyDirectoryFiles(join8(srcDir, entry.name), join8(destDir, entry.name), excludeDirs);
2031
2214
  } else if (entry.isFile()) {
2032
- writeFileSync3(join8(destDir, entry.name), readFileSync7(join8(srcDir, entry.name)));
2215
+ writeFileSync4(join8(destDir, entry.name), readFileSync8(join8(srcDir, entry.name)));
2033
2216
  }
2034
2217
  }
2035
2218
  }
@@ -2038,7 +2221,7 @@ function createBackup(cwd) {
2038
2221
  const dir = backupDirPath(cwd);
2039
2222
  let name = base;
2040
2223
  let suffix = 1;
2041
- while (existsSync6(join8(dir, name))) {
2224
+ while (existsSync7(join8(dir, name))) {
2042
2225
  name = `${base}-${suffix}`;
2043
2226
  suffix++;
2044
2227
  }
@@ -2049,7 +2232,7 @@ function createBackup(cwd) {
2049
2232
  }
2050
2233
  function listBackups(cwd) {
2051
2234
  const dir = backupDirPath(cwd);
2052
- if (!existsSync6(dir))
2235
+ if (!existsSync7(dir))
2053
2236
  return [];
2054
2237
  const entries = readdirSync2(dir, { withFileTypes: true });
2055
2238
  const backups = [];
@@ -2080,7 +2263,7 @@ function listBackups(cwd) {
2080
2263
  }
2081
2264
  function restoreBackup(cwd, backupName) {
2082
2265
  const backupPath = join8(backupDirPath(cwd), backupName);
2083
- if (!existsSync6(backupPath)) {
2266
+ if (!existsSync7(backupPath)) {
2084
2267
  throw new Error(`backup not found: ${backupName}`);
2085
2268
  }
2086
2269
  createBackup(cwd);
@@ -2450,7 +2633,7 @@ var exports_scan = {};
2450
2633
  __export(exports_scan, {
2451
2634
  scan: () => scan
2452
2635
  });
2453
- import { readFileSync as readFileSync8 } from "fs";
2636
+ import { readFileSync as readFileSync9 } from "fs";
2454
2637
  import { join as join10 } from "path";
2455
2638
  function loadExistingIndex(indexPath) {
2456
2639
  const raw = safeReadJson(indexPath);
@@ -2504,7 +2687,7 @@ function scan(cwd, options) {
2504
2687
  const fullPath = join10(cwd, file.relativePath);
2505
2688
  let content;
2506
2689
  try {
2507
- content = readFileSync8(fullPath, "utf-8");
2690
+ content = readFileSync9(fullPath, "utf-8");
2508
2691
  } catch {
2509
2692
  continue;
2510
2693
  }
@@ -2540,12 +2723,12 @@ __export(exports_seed, {
2540
2723
  parseCargoToml: () => parseCargoToml
2541
2724
  });
2542
2725
  import { basename as basename4, join as join11 } from "path";
2543
- import { readFileSync as readFileSync9, existsSync as existsSync7 } from "fs";
2726
+ import { readFileSync as readFileSync10, existsSync as existsSync8 } from "fs";
2544
2727
  function readFile(filePath) {
2545
- if (!existsSync7(filePath))
2728
+ if (!existsSync8(filePath))
2546
2729
  return null;
2547
2730
  try {
2548
- return readFileSync9(filePath, "utf-8");
2731
+ return readFileSync10(filePath, "utf-8");
2549
2732
  } catch {
2550
2733
  return null;
2551
2734
  }
@@ -2722,8 +2905,8 @@ __export(exports_init, {
2722
2905
  buildHooksConfig: () => buildHooksConfig
2723
2906
  });
2724
2907
  import { execSync as execSync2 } from "child_process";
2725
- import { mkdirSync as mkdirSync5, existsSync as existsSync8 } from "fs";
2726
- import { resolve as resolve2, dirname as dirname3, basename as basename5, join as join12 } from "path";
2908
+ import { mkdirSync as mkdirSync6, existsSync as existsSync9 } from "fs";
2909
+ import { resolve as resolve2, dirname as dirname4, basename as basename5, join as join12 } from "path";
2727
2910
  function detectRuntime() {
2728
2911
  try {
2729
2912
  execSync2("bun --version", { stdio: "ignore" });
@@ -2734,13 +2917,13 @@ function detectRuntime() {
2734
2917
  }
2735
2918
  function resolveCliPath() {
2736
2919
  const selfPath = new URL(import.meta.url).pathname;
2737
- const selfDir = dirname3(selfPath);
2920
+ const selfDir = dirname4(selfPath);
2738
2921
  if (selfPath.endsWith("dist/cli.js")) {
2739
2922
  return selfPath;
2740
2923
  }
2741
2924
  const projectRoot = resolve2(selfDir, "../..");
2742
2925
  const distPath = join12(projectRoot, "dist", "cli.js");
2743
- if (existsSync8(distPath))
2926
+ if (existsSync9(distPath))
2744
2927
  return distPath;
2745
2928
  return resolve2(selfDir, "../cli.ts");
2746
2929
  }
@@ -2776,7 +2959,7 @@ function isMinkHook(entry) {
2776
2959
  return false;
2777
2960
  }
2778
2961
  function mergeHooksIntoSettings(settingsPath, newHooks) {
2779
- mkdirSync5(dirname3(settingsPath), { recursive: true });
2962
+ mkdirSync6(dirname4(settingsPath), { recursive: true });
2780
2963
  const existing = safeReadJson(settingsPath) ?? {};
2781
2964
  const existingHooks = existing.hooks ?? {};
2782
2965
  for (const [event, entries] of Object.entries(newHooks)) {
@@ -2789,9 +2972,9 @@ function mergeHooksIntoSettings(settingsPath, newHooks) {
2789
2972
  }
2790
2973
  function isExistingInstallation(cwd) {
2791
2974
  const dir = projectDir(cwd);
2792
- if (!existsSync8(dir))
2975
+ if (!existsSync9(dir))
2793
2976
  return false;
2794
- return existsSync8(join12(dir, "file-index.json"));
2977
+ return existsSync9(join12(dir, "file-index.json"));
2795
2978
  }
2796
2979
  async function init(cwd) {
2797
2980
  const runtime = detectRuntime();
@@ -2807,7 +2990,7 @@ async function init(cwd) {
2807
2990
  console.log(` backup: ${backupName}`);
2808
2991
  }
2809
2992
  mergeHooksIntoSettings(settingsPath, hooks);
2810
- mkdirSync5(dir, { recursive: true });
2993
+ mkdirSync6(dir, { recursive: true });
2811
2994
  const projectId = generateProjectId(cwd);
2812
2995
  const isNotesProject = isWikiEnabled() && isVaultInitialized() && isInsideVault(cwd);
2813
2996
  const metaPath = projectMetaPath(cwd);
@@ -2835,7 +3018,7 @@ async function init(cwd) {
2835
3018
  scan2(cwd, { check: false });
2836
3019
  const { learningMemoryPath: learningMemoryPath3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
2837
3020
  const memPath = learningMemoryPath3(cwd);
2838
- if (!existsSync8(memPath)) {
3021
+ if (!existsSync9(memPath)) {
2839
3022
  const { seedLearningMemory: seedLearningMemory2 } = await Promise.resolve().then(() => (init_seed(), exports_seed));
2840
3023
  const { serializeLearningMemory: serializeLearningMemory2 } = await Promise.resolve().then(() => (init_learning_memory(), exports_learning_memory));
2841
3024
  const mem = seedLearningMemory2(cwd);
@@ -2845,7 +3028,7 @@ async function init(cwd) {
2845
3028
  try {
2846
3029
  const projectSlug = basename5(cwd);
2847
3030
  const overviewPath = join12(vaultProjects(projectSlug), "overview.md");
2848
- if (!existsSync8(overviewPath)) {
3031
+ if (!existsSync9(overviewPath)) {
2849
3032
  const now = new Date().toISOString();
2850
3033
  const overview = [
2851
3034
  `---`,
@@ -2882,12 +3065,12 @@ var init_init = __esm(() => {
2882
3065
  });
2883
3066
 
2884
3067
  // src/core/daemon.ts
2885
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, openSync } from "fs";
2886
- import { mkdirSync as mkdirSync6 } from "fs";
2887
- import { dirname as dirname4, resolve as resolve3 } from "path";
3068
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync5, unlinkSync as unlinkSync2, openSync } from "fs";
3069
+ import { mkdirSync as mkdirSync7 } from "fs";
3070
+ import { dirname as dirname5, resolve as resolve3 } from "path";
2888
3071
  function readPidFile() {
2889
3072
  try {
2890
- const raw = readFileSync10(schedulerPidPath(), "utf-8");
3073
+ const raw = readFileSync11(schedulerPidPath(), "utf-8");
2891
3074
  const data = JSON.parse(raw);
2892
3075
  if (data && typeof data.pid === "number" && typeof data.startedAt === "string" && typeof data.projectCwd === "string") {
2893
3076
  return data;
@@ -2899,8 +3082,8 @@ function readPidFile() {
2899
3082
  }
2900
3083
  function writePidFile(data) {
2901
3084
  const pidPath = schedulerPidPath();
2902
- mkdirSync6(dirname4(pidPath), { recursive: true });
2903
- writeFileSync4(pidPath, JSON.stringify(data, null, 2));
3085
+ mkdirSync7(dirname5(pidPath), { recursive: true });
3086
+ writeFileSync5(pidPath, JSON.stringify(data, null, 2));
2904
3087
  }
2905
3088
  function removePidFile() {
2906
3089
  try {
@@ -2924,10 +3107,10 @@ function startDaemon(cwd) {
2924
3107
  if (existing) {
2925
3108
  removePidFile();
2926
3109
  }
2927
- const __dir = dirname4(new URL(import.meta.url).pathname);
3110
+ const __dir = dirname5(new URL(import.meta.url).pathname);
2928
3111
  const cliPath = resolve3(__dir, "../cli.ts");
2929
3112
  const logPath = schedulerLogPath();
2930
- mkdirSync6(dirname4(logPath), { recursive: true });
3113
+ mkdirSync7(dirname5(logPath), { recursive: true });
2931
3114
  const logFd = openSync(logPath, "a");
2932
3115
  const proc = Bun.spawn(["bun", "run", cliPath, "cron", "__daemon"], {
2933
3116
  cwd,
@@ -2997,9 +3180,9 @@ var exports_status = {};
2997
3180
  __export(exports_status, {
2998
3181
  status: () => status
2999
3182
  });
3000
- import { existsSync as existsSync10, readFileSync as readFileSync11, statSync as statSync5 } from "fs";
3183
+ import { existsSync as existsSync11, readFileSync as readFileSync12, statSync as statSync5 } from "fs";
3001
3184
  function checkJsonFile(name, filePath, validator) {
3002
- if (!existsSync10(filePath))
3185
+ if (!existsSync11(filePath))
3003
3186
  return { name, path: filePath, status: "missing" };
3004
3187
  const data = safeReadJson(filePath);
3005
3188
  if (data === null)
@@ -3009,10 +3192,10 @@ function checkJsonFile(name, filePath, validator) {
3009
3192
  return { name, path: filePath, status: "ok" };
3010
3193
  }
3011
3194
  function checkTextFile(name, filePath) {
3012
- if (!existsSync10(filePath))
3195
+ if (!existsSync11(filePath))
3013
3196
  return { name, path: filePath, status: "missing" };
3014
3197
  try {
3015
- readFileSync11(filePath, "utf-8");
3198
+ readFileSync12(filePath, "utf-8");
3016
3199
  return { name, path: filePath, status: "ok" };
3017
3200
  } catch {
3018
3201
  return { name, path: filePath, status: "corrupt" };
@@ -3072,8 +3255,8 @@ function status(cwd) {
3072
3255
  console.log();
3073
3256
  try {
3074
3257
  const memPath = learningMemoryPath(cwd);
3075
- if (existsSync10(memPath)) {
3076
- const content = readFileSync11(memPath, "utf-8");
3258
+ if (existsSync11(memPath)) {
3259
+ const content = readFileSync12(memPath, "utf-8");
3077
3260
  const mem = parseLearningMemory(content);
3078
3261
  const total = totalEntryCount(mem);
3079
3262
  const mtime = statSync5(memPath).mtime;
@@ -3127,7 +3310,7 @@ var exports_scan2 = {};
3127
3310
  __export(exports_scan2, {
3128
3311
  scan: () => scan2
3129
3312
  });
3130
- import { readFileSync as readFileSync12 } from "fs";
3313
+ import { readFileSync as readFileSync13 } from "fs";
3131
3314
  import { join as join13 } from "path";
3132
3315
  function loadExistingIndex2(indexPath) {
3133
3316
  const raw = safeReadJson(indexPath);
@@ -3181,7 +3364,7 @@ function scan2(cwd, options) {
3181
3364
  const fullPath = join13(cwd, file.relativePath);
3182
3365
  let content;
3183
3366
  try {
3184
- content = readFileSync12(fullPath, "utf-8");
3367
+ content = readFileSync13(fullPath, "utf-8");
3185
3368
  } catch {
3186
3369
  continue;
3187
3370
  }
@@ -3212,13 +3395,13 @@ var exports_reflect2 = {};
3212
3395
  __export(exports_reflect2, {
3213
3396
  reflect: () => reflect2
3214
3397
  });
3215
- import { existsSync as existsSync11, readFileSync as readFileSync13 } from "fs";
3398
+ import { existsSync as existsSync12, readFileSync as readFileSync14 } from "fs";
3216
3399
  function reflect2(projectDir3, memoryPath, configPath3) {
3217
- if (!existsSync11(memoryPath)) {
3400
+ if (!existsSync12(memoryPath)) {
3218
3401
  console.log("[mink] no learning memory found");
3219
3402
  return null;
3220
3403
  }
3221
- const markdown = readFileSync13(memoryPath, "utf-8");
3404
+ const markdown = readFileSync14(memoryPath, "utf-8");
3222
3405
  const mem = parseLearningMemory(markdown);
3223
3406
  const config = safeReadJson(configPath3);
3224
3407
  const tokenBudget = config?.learningMemoryTokenBudget ?? DEFAULT_TOKEN_BUDGET2;
@@ -3499,7 +3682,7 @@ __export(exports_pre_write, {
3499
3682
  analyzePreWrite: () => analyzePreWrite
3500
3683
  });
3501
3684
  import { relative as relative4 } from "path";
3502
- import { readFileSync as readFileSync14 } from "fs";
3685
+ import { readFileSync as readFileSync15 } from "fs";
3503
3686
  function analyzePreWrite(filePath, writeContent, doNotRepeatEntries, bugMemory) {
3504
3687
  const warnings = [];
3505
3688
  const allMatches = [];
@@ -3553,7 +3736,7 @@ async function preWrite(cwd) {
3553
3736
  const writeContent = extractWriteContent(input);
3554
3737
  let doNotRepeatEntries = [];
3555
3738
  try {
3556
- const markdown = readFileSync14(learningMemoryPath(cwd), "utf-8");
3739
+ const markdown = readFileSync15(learningMemoryPath(cwd), "utf-8");
3557
3740
  const mem = parseLearningMemory(markdown);
3558
3741
  doNotRepeatEntries = getEntries(mem, "Do-Not-Repeat");
3559
3742
  } catch {}
@@ -3610,7 +3793,7 @@ __export(exports_post_write, {
3610
3793
  analyzePostWrite: () => analyzePostWrite
3611
3794
  });
3612
3795
  import { relative as relative5 } from "path";
3613
- import { readFileSync as readFileSync15 } from "fs";
3796
+ import { readFileSync as readFileSync16 } from "fs";
3614
3797
  function analyzePostWrite(filePath, fileContent, index) {
3615
3798
  if (isWriteExcluded(filePath)) {
3616
3799
  return {
@@ -3674,7 +3857,7 @@ async function postWrite(cwd) {
3674
3857
  const filePath = relative5(cwd, absolutePath);
3675
3858
  let fileContent = null;
3676
3859
  try {
3677
- fileContent = readFileSync15(absolutePath, "utf-8");
3860
+ fileContent = readFileSync16(absolutePath, "utf-8");
3678
3861
  } catch {}
3679
3862
  const rawState = safeReadJson(sessionPath(cwd));
3680
3863
  const state = isSessionState(rawState) ? rawState : createSessionState();
@@ -4094,10 +4277,10 @@ async function executeTask(taskId, projectCwd) {
4094
4277
  if (task.actionType === "ai-cli") {
4095
4278
  try {
4096
4279
  const { learningMemoryPath: learningMemoryPath4 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
4097
- const { readFileSync: readFileSync16 } = await import("fs");
4280
+ const { readFileSync: readFileSync17 } = await import("fs");
4098
4281
  let memoryContent;
4099
4282
  try {
4100
- memoryContent = readFileSync16(learningMemoryPath4(projectCwd), "utf-8");
4283
+ memoryContent = readFileSync17(learningMemoryPath4(projectCwd), "utf-8");
4101
4284
  } catch {
4102
4285
  console.log("[mink] no learning memory found, skipping reflection");
4103
4286
  return;
@@ -4655,9 +4838,9 @@ var init_design_eval = __esm(() => {
4655
4838
  });
4656
4839
 
4657
4840
  // src/core/dashboard-api.ts
4658
- import { existsSync as existsSync12, readFileSync as readFileSync16 } from "fs";
4841
+ import { existsSync as existsSync13, readFileSync as readFileSync17 } from "fs";
4659
4842
  function checkJsonFile2(name, filePath, validator) {
4660
- if (!existsSync12(filePath))
4843
+ if (!existsSync13(filePath))
4661
4844
  return { name, status: "missing" };
4662
4845
  const data = safeReadJson(filePath);
4663
4846
  if (data === null)
@@ -4667,10 +4850,10 @@ function checkJsonFile2(name, filePath, validator) {
4667
4850
  return { name, status: "ok" };
4668
4851
  }
4669
4852
  function checkTextFile2(name, filePath) {
4670
- if (!existsSync12(filePath))
4853
+ if (!existsSync13(filePath))
4671
4854
  return { name, status: "missing" };
4672
4855
  try {
4673
- readFileSync16(filePath, "utf-8");
4856
+ readFileSync17(filePath, "utf-8");
4674
4857
  return { name, status: "ok" };
4675
4858
  } catch {
4676
4859
  return { name, status: "corrupt" };
@@ -4753,7 +4936,7 @@ function loadSchedulerPanel(cwd) {
4753
4936
  }
4754
4937
  function loadLearningMemoryPanel(cwd) {
4755
4938
  const memPath = learningMemoryPath(cwd);
4756
- if (!existsSync12(memPath)) {
4939
+ if (!existsSync13(memPath)) {
4757
4940
  return {
4758
4941
  projectName: "unknown",
4759
4942
  sections: {
@@ -4765,7 +4948,7 @@ function loadLearningMemoryPanel(cwd) {
4765
4948
  };
4766
4949
  }
4767
4950
  try {
4768
- const content = readFileSync16(memPath, "utf-8");
4951
+ const content = readFileSync17(memPath, "utf-8");
4769
4952
  return parseLearningMemory(content);
4770
4953
  } catch {
4771
4954
  return {
@@ -4867,7 +5050,7 @@ var init_dashboard_api = __esm(() => {
4867
5050
  });
4868
5051
 
4869
5052
  // src/core/project-registry.ts
4870
- import { readdirSync as readdirSync4, existsSync as existsSync13 } from "fs";
5053
+ import { readdirSync as readdirSync4, existsSync as existsSync14 } from "fs";
4871
5054
  import { join as join14 } from "path";
4872
5055
  function getProjectMeta(projDir) {
4873
5056
  const metaPath = join14(projDir, "project-meta.json");
@@ -4888,7 +5071,7 @@ function getProjectMeta(projDir) {
4888
5071
  }
4889
5072
  function listRegisteredProjects() {
4890
5073
  const projectsDir = join14(minkRoot(), "projects");
4891
- if (!existsSync13(projectsDir))
5074
+ if (!existsSync14(projectsDir))
4892
5075
  return [];
4893
5076
  const entries = readdirSync4(projectsDir, { withFileTypes: true });
4894
5077
  const projects = [];
@@ -5059,8 +5242,8 @@ __export(exports_dashboard_server, {
5059
5242
  startDashboardServer: () => startDashboardServer
5060
5243
  });
5061
5244
  import { watch } from "fs";
5062
- import { existsSync as existsSync14 } from "fs";
5063
- import { basename as basename7, dirname as dirname5, join as join15, extname as extname2 } from "path";
5245
+ import { existsSync as existsSync15 } from "fs";
5246
+ import { basename as basename7, dirname as dirname6, join as join15, extname as extname2 } from "path";
5064
5247
 
5065
5248
  class SSEManager {
5066
5249
  clients = new Map;
@@ -5213,7 +5396,7 @@ function extractPathParam(pathname, prefix) {
5213
5396
  }
5214
5397
  async function startDashboardServer(cwd, options = {}) {
5215
5398
  const port = options.port ?? 4040;
5216
- const hostname = options.hostname ?? "127.0.0.1";
5399
+ const hostname2 = options.hostname ?? "127.0.0.1";
5217
5400
  const sseManager = new SSEManager;
5218
5401
  sseManager.start();
5219
5402
  let activeCwd = cwd;
@@ -5233,15 +5416,15 @@ async function startDashboardServer(cwd, options = {}) {
5233
5416
  timestamp: new Date().toISOString()
5234
5417
  });
5235
5418
  });
5236
- const __dir = dirname5(new URL(import.meta.url).pathname);
5419
+ const __dir = dirname6(new URL(import.meta.url).pathname);
5237
5420
  let pkgRoot = __dir;
5238
- while (pkgRoot !== dirname5(pkgRoot)) {
5239
- if (existsSync14(join15(pkgRoot, "package.json")))
5421
+ while (pkgRoot !== dirname6(pkgRoot)) {
5422
+ if (existsSync15(join15(pkgRoot, "package.json")))
5240
5423
  break;
5241
- pkgRoot = dirname5(pkgRoot);
5424
+ pkgRoot = dirname6(pkgRoot);
5242
5425
  }
5243
5426
  const dashboardOutDir = join15(pkgRoot, "dashboard", "out");
5244
- const dashboardBuilt = existsSync14(join15(dashboardOutDir, "index.html"));
5427
+ const dashboardBuilt = existsSync15(join15(dashboardOutDir, "index.html"));
5245
5428
  let clientIdCounter = 0;
5246
5429
  if (!dashboardBuilt) {
5247
5430
  console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
@@ -5257,7 +5440,7 @@ async function startDashboardServer(cwd, options = {}) {
5257
5440
  }
5258
5441
  const server = await runtimeServe({
5259
5442
  port,
5260
- hostname,
5443
+ hostname: hostname2,
5261
5444
  idleTimeout: 0,
5262
5445
  async fetch(req) {
5263
5446
  const url = new URL(req.url);
@@ -5420,11 +5603,11 @@ retry: 3000
5420
5603
  return jsonResponse({ error: "Not found" }, 404);
5421
5604
  }
5422
5605
  });
5423
- const serverUrl = `http://${hostname}:${server.port}`;
5606
+ const serverUrl = `http://${hostname2}:${server.port}`;
5424
5607
  if (options.open !== false) {
5425
5608
  try {
5426
- const platform = process.platform;
5427
- const cmd = platform === "darwin" ? ["open", serverUrl] : platform === "win32" ? ["cmd", "/c", "start", serverUrl] : ["xdg-open", serverUrl];
5609
+ const platform2 = process.platform;
5610
+ const cmd = platform2 === "darwin" ? ["open", serverUrl] : platform2 === "win32" ? ["cmd", "/c", "start", serverUrl] : ["xdg-open", serverUrl];
5428
5611
  runtimeSpawn(cmd).unref();
5429
5612
  } catch {}
5430
5613
  }
@@ -5478,9 +5661,9 @@ var exports_dashboard = {};
5478
5661
  __export(exports_dashboard, {
5479
5662
  dashboard: () => dashboard
5480
5663
  });
5481
- import { existsSync as existsSync15 } from "fs";
5664
+ import { existsSync as existsSync16 } from "fs";
5482
5665
  async function dashboard(cwd, args) {
5483
- if (!existsSync15(projectDir(cwd))) {
5666
+ if (!existsSync16(projectDir(cwd))) {
5484
5667
  console.error("[mink] project not initialized. Run: mink init");
5485
5668
  process.exit(1);
5486
5669
  }
@@ -5502,7 +5685,7 @@ var exports_daemon = {};
5502
5685
  __export(exports_daemon, {
5503
5686
  daemon: () => daemon
5504
5687
  });
5505
- import { readFileSync as readFileSync17, existsSync as existsSync16 } from "fs";
5688
+ import { readFileSync as readFileSync18, existsSync as existsSync17 } from "fs";
5506
5689
  async function daemon(cwd, args) {
5507
5690
  const subcommand = args[0];
5508
5691
  switch (subcommand) {
@@ -5518,12 +5701,12 @@ async function daemon(cwd, args) {
5518
5701
  break;
5519
5702
  case "logs": {
5520
5703
  const logPath = schedulerLogPath();
5521
- if (!existsSync16(logPath)) {
5704
+ if (!existsSync17(logPath)) {
5522
5705
  console.log("[mink] no log file found");
5523
5706
  return;
5524
5707
  }
5525
5708
  try {
5526
- const content = readFileSync17(logPath, "utf-8");
5709
+ const content = readFileSync18(logPath, "utf-8");
5527
5710
  const lines = content.split(`
5528
5711
  `);
5529
5712
  const tail = lines.slice(-50).join(`
@@ -5600,7 +5783,7 @@ async function config(args) {
5600
5783
  const all = resolveAllConfig();
5601
5784
  console.log("[mink] configuration:");
5602
5785
  for (const entry of all) {
5603
- let line2 = ` ${entry.key} = ${entry.value} (source: ${entry.source})`;
5786
+ let line2 = ` ${entry.key} = ${entry.value} (${entry.scope}, source: ${entry.source})`;
5604
5787
  if (entry.source === "environment variable" && entry.configFileValue !== undefined) {
5605
5788
  line2 += ` [config file value: ${entry.configFileValue} — overridden]`;
5606
5789
  }
@@ -5635,8 +5818,8 @@ var init_config2 = __esm(() => {
5635
5818
 
5636
5819
  // src/commands/init.ts
5637
5820
  import { execSync as execSync3 } from "child_process";
5638
- import { mkdirSync as mkdirSync7, existsSync as existsSync17 } from "fs";
5639
- import { resolve as resolve4, dirname as dirname6, basename as basename8, join as join16 } from "path";
5821
+ import { mkdirSync as mkdirSync8, existsSync as existsSync18 } from "fs";
5822
+ import { resolve as resolve4, dirname as dirname7, basename as basename8, join as join16 } from "path";
5640
5823
  function detectRuntime2() {
5641
5824
  try {
5642
5825
  execSync3("bun --version", { stdio: "ignore" });
@@ -5677,7 +5860,7 @@ function isMinkHook2(entry) {
5677
5860
  return false;
5678
5861
  }
5679
5862
  function mergeHooksIntoSettings2(settingsPath, newHooks) {
5680
- mkdirSync7(dirname6(settingsPath), { recursive: true });
5863
+ mkdirSync8(dirname7(settingsPath), { recursive: true });
5681
5864
  const existing = safeReadJson(settingsPath) ?? {};
5682
5865
  const existingHooks = existing.hooks ?? {};
5683
5866
  for (const [event, entries] of Object.entries(newHooks)) {
@@ -5700,7 +5883,7 @@ var exports_update = {};
5700
5883
  __export(exports_update, {
5701
5884
  update: () => update
5702
5885
  });
5703
- import { resolve as resolve5, dirname as dirname7 } from "path";
5886
+ import { resolve as resolve5, dirname as dirname8 } from "path";
5704
5887
  function parseArgs(args) {
5705
5888
  let dryRun = false;
5706
5889
  let project = null;
@@ -5748,7 +5931,7 @@ async function update(cwd, args) {
5748
5931
  return;
5749
5932
  }
5750
5933
  const runtime = detectRuntime2();
5751
- const cliPath = resolve5(dirname7(new URL(import.meta.url).pathname), "../cli.ts");
5934
+ const cliPath = resolve5(dirname8(new URL(import.meta.url).pathname), "../cli.ts");
5752
5935
  const newHooks = buildHooksConfig2(runtime, cliPath);
5753
5936
  for (const target of targets) {
5754
5937
  console.log(`[mink] updating: ${target.name} (${target.id})`);
@@ -5817,7 +6000,7 @@ var init_restore = __esm(() => {
5817
6000
  });
5818
6001
 
5819
6002
  // src/core/design-eval/server-detect.ts
5820
- import { readFileSync as readFileSync18 } from "fs";
6003
+ import { readFileSync as readFileSync19 } from "fs";
5821
6004
  import { join as join17 } from "path";
5822
6005
  async function probePort(port) {
5823
6006
  try {
@@ -5840,7 +6023,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
5840
6023
  }
5841
6024
  function detectDevCommand(cwd) {
5842
6025
  try {
5843
- const raw = readFileSync18(join17(cwd, "package.json"), "utf-8");
6026
+ const raw = readFileSync19(join17(cwd, "package.json"), "utf-8");
5844
6027
  const pkg = JSON.parse(raw);
5845
6028
  const scripts = pkg.scripts;
5846
6029
  if (!scripts || typeof scripts !== "object")
@@ -5860,10 +6043,10 @@ var init_server_detect = __esm(() => {
5860
6043
  });
5861
6044
 
5862
6045
  // src/core/design-eval/route-detect.ts
5863
- import { existsSync as existsSync18, readdirSync as readdirSync5, statSync as statSync8 } from "fs";
6046
+ import { existsSync as existsSync19, readdirSync as readdirSync5, statSync as statSync8 } from "fs";
5864
6047
  import { join as join18, relative as relative6, sep } from "path";
5865
6048
  function detectFramework(cwd) {
5866
- const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync18(join18(cwd, `${name}.${ext}`))) || existsSync18(join18(cwd, name));
6049
+ const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync19(join18(cwd, `${name}.${ext}`))) || existsSync19(join18(cwd, name));
5867
6050
  if (has("next.config"))
5868
6051
  return "nextjs";
5869
6052
  if (has("svelte.config"))
@@ -5889,7 +6072,7 @@ function detectRoutes(cwd) {
5889
6072
  function detectNextRoutes(cwd) {
5890
6073
  const routes = [];
5891
6074
  const appDir = join18(cwd, "app");
5892
- if (existsSync18(appDir)) {
6075
+ if (existsSync19(appDir)) {
5893
6076
  const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
5894
6077
  for (const file of pageFiles) {
5895
6078
  const rel = relative6(appDir, file);
@@ -5901,7 +6084,7 @@ function detectNextRoutes(cwd) {
5901
6084
  }
5902
6085
  }
5903
6086
  const pagesDir = join18(cwd, "pages");
5904
- if (existsSync18(pagesDir)) {
6087
+ if (existsSync19(pagesDir)) {
5905
6088
  const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
5906
6089
  for (const file of pageFiles) {
5907
6090
  const rel = relative6(pagesDir, file);
@@ -5921,7 +6104,7 @@ function detectNextRoutes(cwd) {
5921
6104
  }
5922
6105
  function detectSvelteKitRoutes(cwd) {
5923
6106
  const routesDir = join18(cwd, "src", "routes");
5924
- if (!existsSync18(routesDir))
6107
+ if (!existsSync19(routesDir))
5925
6108
  return ["/"];
5926
6109
  const routes = [];
5927
6110
  const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
@@ -5937,7 +6120,7 @@ function detectSvelteKitRoutes(cwd) {
5937
6120
  }
5938
6121
  function detectNuxtRoutes(cwd) {
5939
6122
  const pagesDir = join18(cwd, "pages");
5940
- if (!existsSync18(pagesDir))
6123
+ if (!existsSync19(pagesDir))
5941
6124
  return ["/"];
5942
6125
  const routes = [];
5943
6126
  const vueFiles = findFiles(pagesDir, /\.vue$/);
@@ -18868,10 +19051,10 @@ var init_NetworkManager = __esm(() => {
18868
19051
  throw error;
18869
19052
  }
18870
19053
  }
18871
- async setUserAgent(userAgent, userAgentMetadata, platform) {
19054
+ async setUserAgent(userAgent, userAgentMetadata, platform2) {
18872
19055
  this.#userAgent = userAgent;
18873
19056
  this.#userAgentMetadata = userAgentMetadata;
18874
- this.#platform = platform;
19057
+ this.#platform = platform2;
18875
19058
  await this.#applyToAllClients(this.#applyUserAgent.bind(this));
18876
19059
  }
18877
19060
  async#applyUserAgent(client) {
@@ -40383,22 +40566,22 @@ var init_Page3 = __esm(() => {
40383
40566
  async setUserAgent(userAgentOrOptions, userAgentMetadata) {
40384
40567
  let userAgent;
40385
40568
  let clientHints;
40386
- let platform;
40569
+ let platform2;
40387
40570
  if (typeof userAgentOrOptions === "string") {
40388
40571
  userAgent = userAgentOrOptions;
40389
40572
  clientHints = userAgentMetadata;
40390
40573
  } else {
40391
40574
  userAgent = userAgentOrOptions.userAgent ?? null;
40392
40575
  clientHints = userAgentOrOptions.userAgentMetadata;
40393
- platform = userAgentOrOptions.platform === "" ? undefined : userAgentOrOptions.platform;
40576
+ platform2 = userAgentOrOptions.platform === "" ? undefined : userAgentOrOptions.platform;
40394
40577
  }
40395
40578
  if (userAgent === "") {
40396
40579
  userAgent = null;
40397
40580
  }
40398
40581
  await this.#frame.browsingContext.setUserAgent(userAgent);
40399
- if (platform && platform !== "") {
40582
+ if (platform2 && platform2 !== "") {
40400
40583
  clientHints = clientHints ?? {};
40401
- clientHints.platform = platform;
40584
+ clientHints.platform = platform2;
40402
40585
  }
40403
40586
  await this.#frame.browsingContext.setClientHintsOverride(clientHints ?? null);
40404
40587
  }
@@ -48364,15 +48547,15 @@ var require_proxy_from_env = __commonJS((exports) => {
48364
48547
  function getProxyForUrl(url) {
48365
48548
  var parsedUrl = typeof url === "string" ? parseUrl(url) : url || {};
48366
48549
  var proto = parsedUrl.protocol;
48367
- var hostname = parsedUrl.host;
48550
+ var hostname2 = parsedUrl.host;
48368
48551
  var port = parsedUrl.port;
48369
- if (typeof hostname !== "string" || !hostname || typeof proto !== "string") {
48552
+ if (typeof hostname2 !== "string" || !hostname2 || typeof proto !== "string") {
48370
48553
  return "";
48371
48554
  }
48372
48555
  proto = proto.split(":", 1)[0];
48373
- hostname = hostname.replace(/:\d*$/, "");
48556
+ hostname2 = hostname2.replace(/:\d*$/, "");
48374
48557
  port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
48375
- if (!shouldProxy(hostname, port)) {
48558
+ if (!shouldProxy(hostname2, port)) {
48376
48559
  return "";
48377
48560
  }
48378
48561
  var proxy = getEnv("npm_config_" + proto + "_proxy") || getEnv(proto + "_proxy") || getEnv("npm_config_proxy") || getEnv("all_proxy");
@@ -48381,7 +48564,7 @@ var require_proxy_from_env = __commonJS((exports) => {
48381
48564
  }
48382
48565
  return proxy;
48383
48566
  }
48384
- function shouldProxy(hostname, port) {
48567
+ function shouldProxy(hostname2, port) {
48385
48568
  var NO_PROXY = (getEnv("npm_config_no_proxy") || getEnv("no_proxy")).toLowerCase();
48386
48569
  if (!NO_PROXY) {
48387
48570
  return true;
@@ -48400,12 +48583,12 @@ var require_proxy_from_env = __commonJS((exports) => {
48400
48583
  return true;
48401
48584
  }
48402
48585
  if (!/^[.*]/.test(parsedProxyHostname)) {
48403
- return hostname !== parsedProxyHostname;
48586
+ return hostname2 !== parsedProxyHostname;
48404
48587
  }
48405
48588
  if (parsedProxyHostname.charAt(0) === "*") {
48406
48589
  parsedProxyHostname = parsedProxyHostname.slice(1);
48407
48590
  }
48408
- return !stringEndsWith.call(hostname, parsedProxyHostname);
48591
+ return !stringEndsWith.call(hostname2, parsedProxyHostname);
48409
48592
  });
48410
48593
  }
48411
48594
  function getEnv(key) {
@@ -48483,8 +48666,8 @@ var require_dist2 = __commonJS((exports) => {
48483
48666
  setRequestProps(req, opts) {
48484
48667
  const { proxy } = this;
48485
48668
  const protocol = opts.secureEndpoint ? "https:" : "http:";
48486
- const hostname = req.getHeader("host") || "localhost";
48487
- const base = `${protocol}//${hostname}`;
48669
+ const hostname2 = req.getHeader("host") || "localhost";
48670
+ const base = `${protocol}//${hostname2}`;
48488
48671
  const url = new url_1.URL(req.path, base);
48489
48672
  if (opts.port !== 80) {
48490
48673
  url.port = String(opts.port);
@@ -71820,8 +72003,8 @@ var init_httpUtil = __esm(() => {
71820
72003
  import { execSync as execSync4 } from "node:child_process";
71821
72004
  import os from "node:os";
71822
72005
  import path from "node:path";
71823
- function folder(platform) {
71824
- switch (platform) {
72006
+ function folder(platform2) {
72007
+ switch (platform2) {
71825
72008
  case BrowserPlatform.LINUX_ARM:
71826
72009
  case BrowserPlatform.LINUX:
71827
72010
  return "linux64";
@@ -71835,23 +72018,23 @@ function folder(platform) {
71835
72018
  return "win64";
71836
72019
  }
71837
72020
  }
71838
- function resolveDownloadUrl(platform, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
71839
- return `${baseUrl}/${resolveDownloadPath(platform, buildId).join("/")}`;
72021
+ function resolveDownloadUrl(platform2, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
72022
+ return `${baseUrl}/${resolveDownloadPath(platform2, buildId).join("/")}`;
71840
72023
  }
71841
- function resolveDownloadPath(platform, buildId) {
71842
- return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
72024
+ function resolveDownloadPath(platform2, buildId) {
72025
+ return [buildId, folder(platform2), `chrome-${folder(platform2)}.zip`];
71843
72026
  }
71844
- function relativeExecutablePath(platform, _buildId) {
71845
- switch (platform) {
72027
+ function relativeExecutablePath(platform2, _buildId) {
72028
+ switch (platform2) {
71846
72029
  case BrowserPlatform.MAC:
71847
72030
  case BrowserPlatform.MAC_ARM:
71848
- return path.join("chrome-" + folder(platform), "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing");
72031
+ return path.join("chrome-" + folder(platform2), "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing");
71849
72032
  case BrowserPlatform.LINUX_ARM:
71850
72033
  case BrowserPlatform.LINUX:
71851
72034
  return path.join("chrome-linux64", "chrome");
71852
72035
  case BrowserPlatform.WIN32:
71853
72036
  case BrowserPlatform.WIN64:
71854
- return path.join("chrome-" + folder(platform), "chrome.exe");
72037
+ return path.join("chrome-" + folder(platform2), "chrome.exe");
71855
72038
  }
71856
72039
  }
71857
72040
  async function getLastKnownGoodReleaseForChannel(channel) {
@@ -71961,8 +72144,8 @@ function getChromeLinuxOrWslLocation(channel) {
71961
72144
  } catch {}
71962
72145
  return locations;
71963
72146
  }
71964
- function resolveSystemExecutablePaths(platform, channel) {
71965
- switch (platform) {
72147
+ function resolveSystemExecutablePaths(platform2, channel) {
72148
+ switch (platform2) {
71966
72149
  case BrowserPlatform.WIN64:
71967
72150
  case BrowserPlatform.WIN32:
71968
72151
  const prefixLocation = new Set(WINDOWS_ENV_PARAM_NAMES.map((name) => {
@@ -72000,8 +72183,8 @@ function resolveSystemExecutablePaths(platform, channel) {
72000
72183
  return getChromeLinuxOrWslLocation(channel);
72001
72184
  }
72002
72185
  }
72003
- function resolveDefaultUserDataDir(platform, channel) {
72004
- switch (platform) {
72186
+ function resolveDefaultUserDataDir(platform2, channel) {
72187
+ switch (platform2) {
72005
72188
  case BrowserPlatform.WIN64:
72006
72189
  case BrowserPlatform.WIN32:
72007
72190
  switch (channel) {
@@ -72079,8 +72262,8 @@ var init_chrome = __esm(() => {
72079
72262
 
72080
72263
  // node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome-headless-shell.js
72081
72264
  import path2 from "node:path";
72082
- function folder2(platform) {
72083
- switch (platform) {
72265
+ function folder2(platform2) {
72266
+ switch (platform2) {
72084
72267
  case BrowserPlatform.LINUX_ARM:
72085
72268
  case BrowserPlatform.LINUX:
72086
72269
  return "linux64";
@@ -72094,27 +72277,27 @@ function folder2(platform) {
72094
72277
  return "win64";
72095
72278
  }
72096
72279
  }
72097
- function resolveDownloadUrl2(platform, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
72098
- return `${baseUrl}/${resolveDownloadPath2(platform, buildId).join("/")}`;
72280
+ function resolveDownloadUrl2(platform2, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
72281
+ return `${baseUrl}/${resolveDownloadPath2(platform2, buildId).join("/")}`;
72099
72282
  }
72100
- function resolveDownloadPath2(platform, buildId) {
72283
+ function resolveDownloadPath2(platform2, buildId) {
72101
72284
  return [
72102
72285
  buildId,
72103
- folder2(platform),
72104
- `chrome-headless-shell-${folder2(platform)}.zip`
72286
+ folder2(platform2),
72287
+ `chrome-headless-shell-${folder2(platform2)}.zip`
72105
72288
  ];
72106
72289
  }
72107
- function relativeExecutablePath2(platform, _buildId) {
72108
- switch (platform) {
72290
+ function relativeExecutablePath2(platform2, _buildId) {
72291
+ switch (platform2) {
72109
72292
  case BrowserPlatform.MAC:
72110
72293
  case BrowserPlatform.MAC_ARM:
72111
- return path2.join("chrome-headless-shell-" + folder2(platform), "chrome-headless-shell");
72294
+ return path2.join("chrome-headless-shell-" + folder2(platform2), "chrome-headless-shell");
72112
72295
  case BrowserPlatform.LINUX_ARM:
72113
72296
  case BrowserPlatform.LINUX:
72114
72297
  return path2.join("chrome-headless-shell-linux64", "chrome-headless-shell");
72115
72298
  case BrowserPlatform.WIN32:
72116
72299
  case BrowserPlatform.WIN64:
72117
- return path2.join("chrome-headless-shell-" + folder2(platform), "chrome-headless-shell.exe");
72300
+ return path2.join("chrome-headless-shell-" + folder2(platform2), "chrome-headless-shell.exe");
72118
72301
  }
72119
72302
  }
72120
72303
  var init_chrome_headless_shell = __esm(() => {
@@ -72124,8 +72307,8 @@ var init_chrome_headless_shell = __esm(() => {
72124
72307
 
72125
72308
  // node_modules/@puppeteer/browsers/lib/esm/browser-data/chromedriver.js
72126
72309
  import path3 from "node:path";
72127
- function folder3(platform) {
72128
- switch (platform) {
72310
+ function folder3(platform2) {
72311
+ switch (platform2) {
72129
72312
  case BrowserPlatform.LINUX_ARM:
72130
72313
  case BrowserPlatform.LINUX:
72131
72314
  return "linux64";
@@ -72139,23 +72322,23 @@ function folder3(platform) {
72139
72322
  return "win64";
72140
72323
  }
72141
72324
  }
72142
- function resolveDownloadUrl3(platform, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
72143
- return `${baseUrl}/${resolveDownloadPath3(platform, buildId).join("/")}`;
72325
+ function resolveDownloadUrl3(platform2, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
72326
+ return `${baseUrl}/${resolveDownloadPath3(platform2, buildId).join("/")}`;
72144
72327
  }
72145
- function resolveDownloadPath3(platform, buildId) {
72146
- return [buildId, folder3(platform), `chromedriver-${folder3(platform)}.zip`];
72328
+ function resolveDownloadPath3(platform2, buildId) {
72329
+ return [buildId, folder3(platform2), `chromedriver-${folder3(platform2)}.zip`];
72147
72330
  }
72148
- function relativeExecutablePath3(platform, _buildId) {
72149
- switch (platform) {
72331
+ function relativeExecutablePath3(platform2, _buildId) {
72332
+ switch (platform2) {
72150
72333
  case BrowserPlatform.MAC:
72151
72334
  case BrowserPlatform.MAC_ARM:
72152
- return path3.join("chromedriver-" + folder3(platform), "chromedriver");
72335
+ return path3.join("chromedriver-" + folder3(platform2), "chromedriver");
72153
72336
  case BrowserPlatform.LINUX_ARM:
72154
72337
  case BrowserPlatform.LINUX:
72155
72338
  return path3.join("chromedriver-linux64", "chromedriver");
72156
72339
  case BrowserPlatform.WIN32:
72157
72340
  case BrowserPlatform.WIN64:
72158
- return path3.join("chromedriver-" + folder3(platform), "chromedriver.exe");
72341
+ return path3.join("chromedriver-" + folder3(platform2), "chromedriver.exe");
72159
72342
  }
72160
72343
  }
72161
72344
  var init_chromedriver = __esm(() => {
@@ -72165,8 +72348,8 @@ var init_chromedriver = __esm(() => {
72165
72348
 
72166
72349
  // node_modules/@puppeteer/browsers/lib/esm/browser-data/chromium.js
72167
72350
  import path4 from "node:path";
72168
- function archive(platform, buildId) {
72169
- switch (platform) {
72351
+ function archive(platform2, buildId) {
72352
+ switch (platform2) {
72170
72353
  case BrowserPlatform.LINUX_ARM:
72171
72354
  case BrowserPlatform.LINUX:
72172
72355
  return "chrome-linux";
@@ -72178,8 +72361,8 @@ function archive(platform, buildId) {
72178
72361
  return parseInt(buildId, 10) > 591479 ? "chrome-win" : "chrome-win32";
72179
72362
  }
72180
72363
  }
72181
- function folder4(platform) {
72182
- switch (platform) {
72364
+ function folder4(platform2) {
72365
+ switch (platform2) {
72183
72366
  case BrowserPlatform.LINUX_ARM:
72184
72367
  case BrowserPlatform.LINUX:
72185
72368
  return "Linux_x64";
@@ -72193,14 +72376,14 @@ function folder4(platform) {
72193
72376
  return "Win_x64";
72194
72377
  }
72195
72378
  }
72196
- function resolveDownloadUrl4(platform, buildId, baseUrl = "https://storage.googleapis.com/chromium-browser-snapshots") {
72197
- return `${baseUrl}/${resolveDownloadPath4(platform, buildId).join("/")}`;
72379
+ function resolveDownloadUrl4(platform2, buildId, baseUrl = "https://storage.googleapis.com/chromium-browser-snapshots") {
72380
+ return `${baseUrl}/${resolveDownloadPath4(platform2, buildId).join("/")}`;
72198
72381
  }
72199
- function resolveDownloadPath4(platform, buildId) {
72200
- return [folder4(platform), buildId, `${archive(platform, buildId)}.zip`];
72382
+ function resolveDownloadPath4(platform2, buildId) {
72383
+ return [folder4(platform2), buildId, `${archive(platform2, buildId)}.zip`];
72201
72384
  }
72202
- function relativeExecutablePath4(platform, _buildId) {
72203
- switch (platform) {
72385
+ function relativeExecutablePath4(platform2, _buildId) {
72386
+ switch (platform2) {
72204
72387
  case BrowserPlatform.MAC:
72205
72388
  case BrowserPlatform.MAC_ARM:
72206
72389
  return path4.join("chrome-mac", "Chromium.app", "Contents", "MacOS", "Chromium");
@@ -72212,8 +72395,8 @@ function relativeExecutablePath4(platform, _buildId) {
72212
72395
  return path4.join("chrome-win", "chrome.exe");
72213
72396
  }
72214
72397
  }
72215
- async function resolveBuildId2(platform) {
72216
- return await getText(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder4(platform)}/LAST_CHANGE`));
72398
+ async function resolveBuildId2(platform2) {
72399
+ return await getText(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder4(platform2)}/LAST_CHANGE`));
72217
72400
  }
72218
72401
  function compareVersions2(a, b) {
72219
72402
  return Number(a) - Number(b);
@@ -72230,8 +72413,8 @@ function getFormat(buildId) {
72230
72413
  const majorVersion = Number(buildId.split(".").shift());
72231
72414
  return majorVersion >= 135 ? "xz" : "bz2";
72232
72415
  }
72233
- function archiveNightly(platform, buildId) {
72234
- switch (platform) {
72416
+ function archiveNightly(platform2, buildId) {
72417
+ switch (platform2) {
72235
72418
  case BrowserPlatform.LINUX:
72236
72419
  return `firefox-${buildId}.en-US.linux-x86_64.tar.${getFormat(buildId)}`;
72237
72420
  case BrowserPlatform.LINUX_ARM:
@@ -72241,11 +72424,11 @@ function archiveNightly(platform, buildId) {
72241
72424
  return `firefox-${buildId}.en-US.mac.dmg`;
72242
72425
  case BrowserPlatform.WIN32:
72243
72426
  case BrowserPlatform.WIN64:
72244
- return `firefox-${buildId}.en-US.${platform}.zip`;
72427
+ return `firefox-${buildId}.en-US.${platform2}.zip`;
72245
72428
  }
72246
72429
  }
72247
- function archive2(platform, buildId) {
72248
- switch (platform) {
72430
+ function archive2(platform2, buildId) {
72431
+ switch (platform2) {
72249
72432
  case BrowserPlatform.LINUX_ARM:
72250
72433
  case BrowserPlatform.LINUX:
72251
72434
  return `firefox-${buildId}.tar.${getFormat(buildId)}`;
@@ -72257,8 +72440,8 @@ function archive2(platform, buildId) {
72257
72440
  return `Firefox Setup ${buildId}.exe`;
72258
72441
  }
72259
72442
  }
72260
- function platformName(platform) {
72261
- switch (platform) {
72443
+ function platformName(platform2) {
72444
+ switch (platform2) {
72262
72445
  case BrowserPlatform.LINUX:
72263
72446
  return `linux-x86_64`;
72264
72447
  case BrowserPlatform.LINUX_ARM:
@@ -72268,7 +72451,7 @@ function platformName(platform) {
72268
72451
  return `mac`;
72269
72452
  case BrowserPlatform.WIN32:
72270
72453
  case BrowserPlatform.WIN64:
72271
- return platform;
72454
+ return platform2;
72272
72455
  }
72273
72456
  }
72274
72457
  function parseBuildId(buildId) {
@@ -72280,7 +72463,7 @@ function parseBuildId(buildId) {
72280
72463
  }
72281
72464
  return [FirefoxChannel.NIGHTLY, buildId];
72282
72465
  }
72283
- function resolveDownloadUrl5(platform, buildId, baseUrl) {
72466
+ function resolveDownloadUrl5(platform2, buildId, baseUrl) {
72284
72467
  const [channel] = parseBuildId(buildId);
72285
72468
  switch (channel) {
72286
72469
  case FirefoxChannel.NIGHTLY:
@@ -72295,30 +72478,30 @@ function resolveDownloadUrl5(platform, buildId, baseUrl) {
72295
72478
  baseUrl ??= "https://archive.mozilla.org/pub/firefox/releases";
72296
72479
  break;
72297
72480
  }
72298
- return `${baseUrl}/${resolveDownloadPath5(platform, buildId).join("/")}`;
72481
+ return `${baseUrl}/${resolveDownloadPath5(platform2, buildId).join("/")}`;
72299
72482
  }
72300
- function resolveDownloadPath5(platform, buildId) {
72483
+ function resolveDownloadPath5(platform2, buildId) {
72301
72484
  const [channel, resolvedBuildId] = parseBuildId(buildId);
72302
72485
  switch (channel) {
72303
72486
  case FirefoxChannel.NIGHTLY:
72304
- return [archiveNightly(platform, resolvedBuildId)];
72487
+ return [archiveNightly(platform2, resolvedBuildId)];
72305
72488
  case FirefoxChannel.DEVEDITION:
72306
72489
  case FirefoxChannel.BETA:
72307
72490
  case FirefoxChannel.STABLE:
72308
72491
  case FirefoxChannel.ESR:
72309
72492
  return [
72310
72493
  resolvedBuildId,
72311
- platformName(platform),
72494
+ platformName(platform2),
72312
72495
  "en-US",
72313
- archive2(platform, resolvedBuildId)
72496
+ archive2(platform2, resolvedBuildId)
72314
72497
  ];
72315
72498
  }
72316
72499
  }
72317
- function relativeExecutablePath5(platform, buildId) {
72500
+ function relativeExecutablePath5(platform2, buildId) {
72318
72501
  const [channel] = parseBuildId(buildId);
72319
72502
  switch (channel) {
72320
72503
  case FirefoxChannel.NIGHTLY:
72321
- switch (platform) {
72504
+ switch (platform2) {
72322
72505
  case BrowserPlatform.MAC_ARM:
72323
72506
  case BrowserPlatform.MAC:
72324
72507
  return path5.join("Firefox Nightly.app", "Contents", "MacOS", "firefox");
@@ -72333,7 +72516,7 @@ function relativeExecutablePath5(platform, buildId) {
72333
72516
  case FirefoxChannel.DEVEDITION:
72334
72517
  case FirefoxChannel.ESR:
72335
72518
  case FirefoxChannel.STABLE:
72336
- switch (platform) {
72519
+ switch (platform2) {
72337
72520
  case BrowserPlatform.MAC_ARM:
72338
72521
  case BrowserPlatform.MAC:
72339
72522
  return path5.join("Firefox.app", "Contents", "MacOS", "firefox");
@@ -72498,7 +72681,7 @@ var init_firefox = __esm(() => {
72498
72681
  });
72499
72682
 
72500
72683
  // node_modules/@puppeteer/browsers/lib/esm/browser-data/browser-data.js
72501
- async function resolveBuildIdForBrowserTag(browser, platform, tag) {
72684
+ async function resolveBuildIdForBrowserTag(browser, platform2, tag) {
72502
72685
  switch (browser) {
72503
72686
  case Browser6.FIREFOX:
72504
72687
  switch (tag) {
@@ -72573,7 +72756,7 @@ async function resolveBuildIdForBrowserTag(browser, platform, tag) {
72573
72756
  case Browser6.CHROMIUM:
72574
72757
  switch (tag) {
72575
72758
  case BrowserTag.LATEST:
72576
- return await resolveBuildId2(platform);
72759
+ return await resolveBuildId2(platform2);
72577
72760
  case BrowserTag.NIGHTLY:
72578
72761
  case BrowserTag.CANARY:
72579
72762
  case BrowserTag.DEV:
@@ -72585,10 +72768,10 @@ async function resolveBuildIdForBrowserTag(browser, platform, tag) {
72585
72768
  }
72586
72769
  }
72587
72770
  }
72588
- async function resolveBuildId4(browser, platform, tag) {
72771
+ async function resolveBuildId4(browser, platform2, tag) {
72589
72772
  const browserTag = tag;
72590
72773
  if (Object.values(BrowserTag).includes(browserTag)) {
72591
- return await resolveBuildIdForBrowserTag(browser, platform, browserTag);
72774
+ return await resolveBuildIdForBrowserTag(browser, platform2, browserTag);
72592
72775
  }
72593
72776
  switch (browser) {
72594
72777
  case Browser6.FIREFOX:
@@ -72624,7 +72807,7 @@ async function createProfile2(browser, opts) {
72624
72807
  throw new Error(`Profile creation is not support for ${browser} yet`);
72625
72808
  }
72626
72809
  }
72627
- function resolveDefaultUserDataDir2(browser, platform, channel) {
72810
+ function resolveDefaultUserDataDir2(browser, platform2, channel) {
72628
72811
  switch (browser) {
72629
72812
  case Browser6.CHROMEDRIVER:
72630
72813
  case Browser6.CHROMEHEADLESSSHELL:
@@ -72632,10 +72815,10 @@ function resolveDefaultUserDataDir2(browser, platform, channel) {
72632
72815
  case Browser6.CHROMIUM:
72633
72816
  throw new Error(`Default user dir detection is not supported for ${browser} yet.`);
72634
72817
  case Browser6.CHROME:
72635
- return resolveDefaultUserDataDir(platform, channel);
72818
+ return resolveDefaultUserDataDir(platform2, channel);
72636
72819
  }
72637
72820
  }
72638
- function resolveSystemExecutablePaths2(browser, platform, channel) {
72821
+ function resolveSystemExecutablePaths2(browser, platform2, channel) {
72639
72822
  switch (browser) {
72640
72823
  case Browser6.CHROMEDRIVER:
72641
72824
  case Browser6.CHROMEHEADLESSSHELL:
@@ -72643,7 +72826,7 @@ function resolveSystemExecutablePaths2(browser, platform, channel) {
72643
72826
  case Browser6.CHROMIUM:
72644
72827
  throw new Error(`System browser detection is not supported for ${browser} yet.`);
72645
72828
  case Browser6.CHROME:
72646
- return resolveSystemExecutablePaths(platform, channel);
72829
+ return resolveSystemExecutablePaths(platform2, channel);
72647
72830
  }
72648
72831
  }
72649
72832
  function getVersionComparator(browser) {
@@ -72690,9 +72873,9 @@ var init_browser_data = __esm(() => {
72690
72873
  // node_modules/@puppeteer/browsers/lib/esm/detectPlatform.js
72691
72874
  import os2 from "node:os";
72692
72875
  function detectBrowserPlatform() {
72693
- const platform = os2.platform();
72876
+ const platform2 = os2.platform();
72694
72877
  const arch = os2.arch();
72695
- switch (platform) {
72878
+ switch (platform2) {
72696
72879
  case "darwin":
72697
72880
  return arch === "arm64" ? BrowserPlatform.MAC_ARM : BrowserPlatform.MAC;
72698
72881
  case "linux":
@@ -72728,15 +72911,15 @@ class InstalledBrowser {
72728
72911
  platform;
72729
72912
  executablePath;
72730
72913
  #cache;
72731
- constructor(cache, browser, buildId, platform) {
72914
+ constructor(cache, browser, buildId, platform2) {
72732
72915
  this.#cache = cache;
72733
72916
  this.browser = browser;
72734
72917
  this.buildId = buildId;
72735
- this.platform = platform;
72918
+ this.platform = platform2;
72736
72919
  this.executablePath = cache.computeExecutablePath({
72737
72920
  browser,
72738
72921
  buildId,
72739
- platform
72922
+ platform: platform2
72740
72923
  });
72741
72924
  }
72742
72925
  get path() {
@@ -72780,17 +72963,17 @@ class Cache {
72780
72963
  fs2.mkdirSync(path6.dirname(metatadaPath), { recursive: true });
72781
72964
  fs2.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
72782
72965
  }
72783
- readExecutablePath(browser, platform, buildId) {
72966
+ readExecutablePath(browser, platform2, buildId) {
72784
72967
  const metadata = this.readMetadata(browser);
72785
- const key = `${platform}-${buildId}`;
72968
+ const key = `${platform2}-${buildId}`;
72786
72969
  return metadata.executablePaths?.[key] ?? null;
72787
72970
  }
72788
- writeExecutablePath(browser, platform, buildId, executablePath) {
72971
+ writeExecutablePath(browser, platform2, buildId, executablePath) {
72789
72972
  const metadata = this.readMetadata(browser);
72790
72973
  if (!metadata.executablePaths) {
72791
72974
  metadata.executablePaths = {};
72792
72975
  }
72793
- const key = `${platform}-${buildId}`;
72976
+ const key = `${platform2}-${buildId}`;
72794
72977
  metadata.executablePaths[key] = executablePath;
72795
72978
  this.writeMetadata(browser, metadata);
72796
72979
  }
@@ -72801,8 +72984,8 @@ class Cache {
72801
72984
  }
72802
72985
  return metadata.aliases[alias];
72803
72986
  }
72804
- installationDir(browser, platform, buildId) {
72805
- return path6.join(this.browserRoot(browser), `${platform}-${buildId}`);
72987
+ installationDir(browser, platform2, buildId) {
72988
+ return path6.join(this.browserRoot(browser), `${platform2}-${buildId}`);
72806
72989
  }
72807
72990
  clear() {
72808
72991
  fs2.rmSync(this.#rootDir, {
@@ -72812,19 +72995,19 @@ class Cache {
72812
72995
  retryDelay: 500
72813
72996
  });
72814
72997
  }
72815
- uninstall(browser, platform, buildId) {
72998
+ uninstall(browser, platform2, buildId) {
72816
72999
  const metadata = this.readMetadata(browser);
72817
73000
  for (const alias of Object.keys(metadata.aliases)) {
72818
73001
  if (metadata.aliases[alias] === buildId) {
72819
73002
  delete metadata.aliases[alias];
72820
73003
  }
72821
73004
  }
72822
- const key = `${platform}-${buildId}`;
73005
+ const key = `${platform2}-${buildId}`;
72823
73006
  if (metadata.executablePaths?.[key]) {
72824
73007
  delete metadata.executablePaths[key];
72825
73008
  this.writeMetadata(browser, metadata);
72826
73009
  }
72827
- fs2.rmSync(this.installationDir(browser, platform, buildId), {
73010
+ fs2.rmSync(this.installationDir(browser, platform2, buildId), {
72828
73011
  force: true,
72829
73012
  recursive: true,
72830
73013
  maxRetries: 10,
@@ -72876,11 +73059,11 @@ function parseFolderPath(folderPath) {
72876
73059
  if (splits.length !== 2) {
72877
73060
  return;
72878
73061
  }
72879
- const [platform, buildId] = splits;
72880
- if (!buildId || !platform) {
73062
+ const [platform2, buildId] = splits;
73063
+ if (!buildId || !platform2) {
72881
73064
  return;
72882
73065
  }
72883
- return { platform, buildId };
73066
+ return { platform: platform2, buildId };
72884
73067
  }
72885
73068
  var import_debug, debugCache;
72886
73069
  var init_Cache = __esm(() => {
@@ -73383,8 +73566,8 @@ class DefaultProvider {
73383
73566
  getDownloadUrl(options) {
73384
73567
  return this.#getDownloadUrl(options.browser, options.platform, options.buildId);
73385
73568
  }
73386
- #getDownloadUrl(browser, platform, buildId) {
73387
- return new URL(downloadUrls[browser](platform, buildId, this.#baseUrl));
73569
+ #getDownloadUrl(browser, platform2, buildId) {
73570
+ return new URL(downloadUrls[browser](platform2, buildId, this.#baseUrl));
73388
73571
  }
73389
73572
  getExecutablePath(options) {
73390
73573
  return executablePathByBrowser[options.browser](options.platform, options.buildId);
@@ -78209,7 +78392,7 @@ var init_fileUtil = __esm(() => {
78209
78392
  // node_modules/@puppeteer/browsers/lib/esm/install.js
78210
78393
  import assert2 from "node:assert";
78211
78394
  import { spawnSync as spawnSync2 } from "node:child_process";
78212
- import { existsSync as existsSync19, readFileSync as readFileSync19 } from "node:fs";
78395
+ import { existsSync as existsSync20, readFileSync as readFileSync20 } from "node:fs";
78213
78396
  import { mkdir as mkdir2, unlink } from "node:fs/promises";
78214
78397
  import os5 from "node:os";
78215
78398
  import path8 from "node:path";
@@ -78262,7 +78445,7 @@ async function installWithProviders(options) {
78262
78445
  continue;
78263
78446
  }
78264
78447
  debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
78265
- if (!existsSync19(browserRoot)) {
78448
+ if (!existsSync20(browserRoot)) {
78266
78449
  await mkdir2(browserRoot, { recursive: true });
78267
78450
  }
78268
78451
  return await installUrl(url, options, provider);
@@ -78295,11 +78478,11 @@ async function installDeps(installedBrowser) {
78295
78478
  return;
78296
78479
  }
78297
78480
  const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
78298
- if (!existsSync19(depsPath)) {
78481
+ if (!existsSync20(depsPath)) {
78299
78482
  debugInstall(`deb.deps file was not found at ${depsPath}`);
78300
78483
  return;
78301
78484
  }
78302
- const data = readFileSync19(depsPath, "utf-8").split(`
78485
+ const data = readFileSync20(depsPath, "utf-8").split(`
78303
78486
  `).join(",");
78304
78487
  if (process.getuid?.() !== 0) {
78305
78488
  throw new Error("Installing system dependencies requires root privileges");
@@ -78337,11 +78520,11 @@ async function installUrl(url, options, provider) {
78337
78520
  const cache = new Cache(options.cacheDir);
78338
78521
  const browserRoot = cache.browserRoot(options.browser);
78339
78522
  const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
78340
- if (!existsSync19(browserRoot)) {
78523
+ if (!existsSync20(browserRoot)) {
78341
78524
  await mkdir2(browserRoot, { recursive: true });
78342
78525
  }
78343
78526
  if (!options.unpack) {
78344
- if (existsSync19(archivePath)) {
78527
+ if (existsSync20(archivePath)) {
78345
78528
  return archivePath;
78346
78529
  }
78347
78530
  debugInstall(`Downloading binary from ${url}`);
@@ -78362,8 +78545,8 @@ async function installUrl(url, options, provider) {
78362
78545
  cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
78363
78546
  }
78364
78547
  try {
78365
- if (existsSync19(outputPath)) {
78366
- if (!existsSync19(installedBrowser.executablePath)) {
78548
+ if (existsSync20(outputPath)) {
78549
+ if (!existsSync20(installedBrowser.executablePath)) {
78367
78550
  throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
78368
78551
  }
78369
78552
  await runSetup(installedBrowser);
@@ -78372,7 +78555,7 @@ async function installUrl(url, options, provider) {
78372
78555
  }
78373
78556
  return installedBrowser;
78374
78557
  }
78375
- if (!existsSync19(archivePath)) {
78558
+ if (!existsSync20(archivePath)) {
78376
78559
  debugInstall(`Downloading binary from ${url}`);
78377
78560
  try {
78378
78561
  debugTime("download");
@@ -78401,7 +78584,7 @@ async function installUrl(url, options, provider) {
78401
78584
  }
78402
78585
  return installedBrowser;
78403
78586
  } finally {
78404
- if (existsSync19(archivePath)) {
78587
+ if (existsSync20(archivePath)) {
78405
78588
  await unlink(archivePath);
78406
78589
  }
78407
78590
  }
@@ -78412,7 +78595,7 @@ async function runSetup(installedBrowser) {
78412
78595
  debugTime("permissions");
78413
78596
  const browserDir = path8.dirname(installedBrowser.executablePath);
78414
78597
  const setupExePath = path8.join(browserDir, "setup.exe");
78415
- if (!existsSync19(setupExePath)) {
78598
+ if (!existsSync20(setupExePath)) {
78416
78599
  return;
78417
78600
  }
78418
78601
  spawnSync2(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
@@ -78458,8 +78641,8 @@ async function canDownload(options) {
78458
78641
  }
78459
78642
  return false;
78460
78643
  }
78461
- function getDownloadUrl(browser, platform, buildId, baseUrl) {
78462
- return new URL(downloadUrls[browser](platform, buildId, baseUrl));
78644
+ function getDownloadUrl(browser, platform2, buildId, baseUrl) {
78645
+ return new URL(downloadUrls[browser](platform2, buildId, baseUrl));
78463
78646
  }
78464
78647
  function makeProgressCallback(browser, buildId) {
78465
78648
  let progressBar;
@@ -78793,19 +78976,19 @@ var init_cliui = __esm(() => {
78793
78976
  });
78794
78977
 
78795
78978
  // node_modules/escalade/sync/index.mjs
78796
- import { dirname as dirname8, resolve as resolve7 } from "path";
78979
+ import { dirname as dirname9, resolve as resolve7 } from "path";
78797
78980
  import { readdirSync as readdirSync6, statSync as statSync9 } from "fs";
78798
78981
  function sync_default(start, callback) {
78799
78982
  let dir = resolve7(".", start);
78800
78983
  let tmp, stats = statSync9(dir);
78801
78984
  if (!stats.isDirectory()) {
78802
- dir = dirname8(dir);
78985
+ dir = dirname9(dir);
78803
78986
  }
78804
78987
  while (true) {
78805
78988
  tmp = callback(dir, readdirSync6(dir));
78806
78989
  if (tmp)
78807
78990
  return resolve7(dir, tmp);
78808
- dir = dirname8(tmp = dir);
78991
+ dir = dirname9(tmp = dir);
78809
78992
  if (tmp === dir)
78810
78993
  break;
78811
78994
  }
@@ -79825,14 +80008,14 @@ var init_yerror = __esm(() => {
79825
80008
  });
79826
80009
 
79827
80010
  // node_modules/y18n/build/lib/platform-shims/node.js
79828
- import { readFileSync as readFileSync20, statSync as statSync10, writeFile } from "fs";
80011
+ import { readFileSync as readFileSync21, statSync as statSync10, writeFile } from "fs";
79829
80012
  import { format as format2 } from "util";
79830
80013
  import { resolve as resolve9 } from "path";
79831
80014
  var node_default;
79832
80015
  var init_node = __esm(() => {
79833
80016
  node_default = {
79834
80017
  fs: {
79835
- readFileSync: readFileSync20,
80018
+ readFileSync: readFileSync21,
79836
80019
  writeFile
79837
80020
  },
79838
80021
  format: format2,
@@ -80017,9 +80200,9 @@ var init_y18n = __esm(() => {
80017
80200
  // node_modules/yargs/lib/platform-shims/esm.mjs
80018
80201
  import { notStrictEqual, strictEqual } from "assert";
80019
80202
  import { inspect } from "util";
80020
- import { readFileSync as readFileSync21 } from "fs";
80203
+ import { readFileSync as readFileSync22 } from "fs";
80021
80204
  import { fileURLToPath } from "url";
80022
- import { basename as basename10, dirname as dirname9, extname as extname3, relative as relative7, resolve as resolve10 } from "path";
80205
+ import { basename as basename10, dirname as dirname10, extname as extname3, relative as relative7, resolve as resolve10 } from "path";
80023
80206
  var REQUIRE_ERROR = "require is not supported by ESM", REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM", __dirname2, mainFilename, esm_default;
80024
80207
  var init_esm = __esm(() => {
80025
80208
  init_cliui();
@@ -80052,7 +80235,7 @@ var init_esm = __esm(() => {
80052
80235
  Parser: lib_default,
80053
80236
  path: {
80054
80237
  basename: basename10,
80055
- dirname: dirname9,
80238
+ dirname: dirname10,
80056
80239
  extname: extname3,
80057
80240
  relative: relative7,
80058
80241
  resolve: resolve10
@@ -80066,7 +80249,7 @@ var init_esm = __esm(() => {
80066
80249
  nextTick: process.nextTick,
80067
80250
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
80068
80251
  },
80069
- readFileSync: readFileSync21,
80252
+ readFileSync: readFileSync22,
80070
80253
  require: () => {
80071
80254
  throw new YError(REQUIRE_ERROR);
80072
80255
  },
@@ -83399,8 +83582,8 @@ import * as readline2 from "node:readline";
83399
83582
  function isValidBrowser(browser) {
83400
83583
  return Object.values(Browser6).includes(browser);
83401
83584
  }
83402
- function isValidPlatform(platform) {
83403
- return Object.values(BrowserPlatform).includes(platform);
83585
+ function isValidPlatform(platform2) {
83586
+ return Object.values(BrowserPlatform).includes(platform2);
83404
83587
  }
83405
83588
 
83406
83589
  class CLI {
@@ -83451,11 +83634,11 @@ class CLI {
83451
83634
  desc: "Platform that the binary needs to be compatible with.",
83452
83635
  choices: Object.values(BrowserPlatform),
83453
83636
  default: detectBrowserPlatform(),
83454
- coerce: (platform) => {
83455
- if (!isValidPlatform(platform)) {
83456
- throw new Error(`Unsupported platform '${platform}'`);
83637
+ coerce: (platform2) => {
83638
+ if (!isValidPlatform(platform2)) {
83639
+ throw new Error(`Unsupported platform '${platform2}'`);
83457
83640
  }
83458
- return platform;
83641
+ return platform2;
83459
83642
  },
83460
83643
  defaultDescription: "Auto-detected"
83461
83644
  });
@@ -83660,8 +83843,8 @@ var init_CLI = __esm(() => {
83660
83843
  });
83661
83844
 
83662
83845
  // node_modules/@puppeteer/browsers/lib/esm/provider.js
83663
- function buildArchiveFilename(browser, platform, buildId, extension2 = "zip") {
83664
- return `${browser}-${platform}-${buildId}.${extension2}`;
83846
+ function buildArchiveFilename(browser, platform2, buildId, extension2 = "zip") {
83847
+ return `${browser}-${platform2}-${buildId}.${extension2}`;
83665
83848
  }
83666
83849
 
83667
83850
  // node_modules/@puppeteer/browsers/lib/esm/main.js
@@ -83760,13 +83943,13 @@ async function getConnectionTransport(options) {
83760
83943
  };
83761
83944
  } else if (options.channel && isNode) {
83762
83945
  const { detectBrowserPlatform: detectBrowserPlatform2, resolveDefaultUserDataDir: resolveDefaultUserDataDir3, Browser: Browser7 } = await Promise.resolve().then(() => (init_main(), exports_main));
83763
- const platform = detectBrowserPlatform2();
83764
- if (!platform) {
83946
+ const platform2 = detectBrowserPlatform2();
83947
+ if (!platform2) {
83765
83948
  throw new Error("Could not detect required browser platform");
83766
83949
  }
83767
83950
  const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
83768
83951
  const { join: join20 } = await import("node:path");
83769
- const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform, convertPuppeteerChannelToBrowsersChannel2(options.channel));
83952
+ const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
83770
83953
  const portPath = join20(userDataDir, "DevToolsActivePort");
83771
83954
  try {
83772
83955
  const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
@@ -83991,7 +84174,7 @@ var init_PipeTransport = __esm(() => {
83991
84174
  });
83992
84175
 
83993
84176
  // node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
83994
- import { existsSync as existsSync20 } from "node:fs";
84177
+ import { existsSync as existsSync21 } from "node:fs";
83995
84178
  import { tmpdir } from "node:os";
83996
84179
  import { join as join20 } from "node:path";
83997
84180
 
@@ -84018,7 +84201,7 @@ class BrowserLauncher {
84018
84201
  ...options,
84019
84202
  protocol
84020
84203
  });
84021
- if (!existsSync20(launchArgs.executablePath)) {
84204
+ if (!existsSync21(launchArgs.executablePath)) {
84022
84205
  throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
84023
84206
  }
84024
84207
  const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
@@ -84093,7 +84276,7 @@ class BrowserLauncher {
84093
84276
  browserCloseCallback();
84094
84277
  const logs = browserProcess.getRecentLogs().join(`
84095
84278
  `);
84096
- if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync20(join20(launchArgs.userDataDir, "lockfile"))) {
84279
+ if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync21(join20(launchArgs.userDataDir, "lockfile"))) {
84097
84280
  throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
84098
84281
  }
84099
84282
  if (logs.includes("Missing X server") && options.headless === false) {
@@ -84188,7 +84371,7 @@ class BrowserLauncher {
84188
84371
  resolveExecutablePath(headless, validatePath = true) {
84189
84372
  let executablePath = this.puppeteer.configuration.executablePath;
84190
84373
  if (executablePath) {
84191
- if (validatePath && !existsSync20(executablePath)) {
84374
+ if (validatePath && !existsSync21(executablePath)) {
84192
84375
  throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
84193
84376
  }
84194
84377
  return executablePath;
@@ -84211,7 +84394,7 @@ class BrowserLauncher {
84211
84394
  browser: browserType,
84212
84395
  buildId: this.puppeteer.browserVersion
84213
84396
  });
84214
- if (validatePath && !existsSync20(executablePath)) {
84397
+ if (validatePath && !existsSync21(executablePath)) {
84215
84398
  const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
84216
84399
  if (configVersion) {
84217
84400
  throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
@@ -84697,8 +84880,8 @@ var init_PuppeteerNode = __esm(() => {
84697
84880
  return this.#getLauncher(options.browser ?? this.lastLaunchedBrowser).defaultArgs(options);
84698
84881
  }
84699
84882
  async trimCache() {
84700
- const platform = detectBrowserPlatform();
84701
- if (!platform) {
84883
+ const platform2 = detectBrowserPlatform();
84884
+ if (!platform2) {
84702
84885
  throw new Error("The current platform is not supported.");
84703
84886
  }
84704
84887
  const cacheDir = this.configuration.cacheDirectory;
@@ -84719,7 +84902,7 @@ var init_PuppeteerNode = __esm(() => {
84719
84902
  ];
84720
84903
  await Promise.all(puppeteerBrowsers.map(async (item) => {
84721
84904
  const tag = this.configuration?.[item.product]?.version ?? PUPPETEER_REVISIONS[item.product];
84722
- item.currentBuildId = await resolveBuildId4(item.browser, platform, tag);
84905
+ item.currentBuildId = await resolveBuildId4(item.browser, platform2, tag);
84723
84906
  }));
84724
84907
  const currentBrowserBuilds = new Set(puppeteerBrowsers.map((browser) => {
84725
84908
  return `${browser.browser}_${browser.currentBuildId}`;
@@ -84736,7 +84919,7 @@ var init_PuppeteerNode = __esm(() => {
84736
84919
  }
84737
84920
  await uninstall({
84738
84921
  browser: installedBrowser.browser,
84739
- platform,
84922
+ platform: platform2,
84740
84923
  cacheDir,
84741
84924
  buildId: installedBrowser.buildId
84742
84925
  });
@@ -84749,7 +84932,7 @@ var init_PuppeteerNode = __esm(() => {
84749
84932
  import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
84750
84933
  import fs5 from "node:fs";
84751
84934
  import os8 from "node:os";
84752
- import { dirname as dirname10 } from "node:path";
84935
+ import { dirname as dirname11 } from "node:path";
84753
84936
  import { PassThrough } from "node:stream";
84754
84937
  var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
84755
84938
  var useValue = arguments.length > 2;
@@ -84873,7 +85056,7 @@ var init_ScreenRecorder = __esm(() => {
84873
85056
  filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
84874
85057
  }
84875
85058
  if (path11) {
84876
- fs5.mkdirSync(dirname10(path11), { recursive: overwrite });
85059
+ fs5.mkdirSync(dirname11(path11), { recursive: overwrite });
84877
85060
  }
84878
85061
  this.#process = spawn2(ffmpegPath, [
84879
85062
  ["-loglevel", "error"],
@@ -85026,17 +85209,17 @@ var init_puppeteer_core = __esm(() => {
85026
85209
  });
85027
85210
 
85028
85211
  // src/core/design-eval/capture.ts
85029
- import { mkdirSync as mkdirSync8, statSync as statSync11, existsSync as existsSync21 } from "fs";
85212
+ import { mkdirSync as mkdirSync9, statSync as statSync11, existsSync as existsSync22 } from "fs";
85030
85213
  import { join as join21 } from "path";
85031
85214
  function findBrowser() {
85032
- const platform = process.platform;
85033
- const paths = CHROME_PATHS[platform] ?? [];
85215
+ const platform2 = process.platform;
85216
+ const paths = CHROME_PATHS[platform2] ?? [];
85034
85217
  for (const p of paths) {
85035
- if (existsSync21(p))
85218
+ if (existsSync22(p))
85036
85219
  return p;
85037
85220
  }
85038
85221
  const minkBrowsers = join21(minkRoot(), "browsers");
85039
- if (existsSync21(minkBrowsers)) {
85222
+ if (existsSync22(minkBrowsers)) {
85040
85223
  const found = findChromeInDir(minkBrowsers);
85041
85224
  if (found)
85042
85225
  return found;
@@ -85137,7 +85320,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
85137
85320
  return results;
85138
85321
  }
85139
85322
  async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
85140
- mkdirSync8(outputDir, { recursive: true });
85323
+ mkdirSync9(outputDir, { recursive: true });
85141
85324
  const executablePath = findBrowser();
85142
85325
  const browser = await puppeteer_core_default.launch({
85143
85326
  executablePath,
@@ -86566,21 +86749,21 @@ var init_framework_advisor2 = __esm(() => {
86566
86749
 
86567
86750
  // src/core/vault-templates.ts
86568
86751
  import { join as join22 } from "path";
86569
- import { existsSync as existsSync22, writeFileSync as writeFileSync5, readFileSync as readFileSync22, mkdirSync as mkdirSync9 } from "fs";
86752
+ import { existsSync as existsSync23, writeFileSync as writeFileSync6, readFileSync as readFileSync23, mkdirSync as mkdirSync10 } from "fs";
86570
86753
  function seedTemplates(templatesDir) {
86571
- mkdirSync9(templatesDir, { recursive: true });
86754
+ mkdirSync10(templatesDir, { recursive: true });
86572
86755
  for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
86573
86756
  const filePath = join22(templatesDir, `${name}.md`);
86574
- if (!existsSync22(filePath)) {
86575
- writeFileSync5(filePath, content);
86757
+ if (!existsSync23(filePath)) {
86758
+ writeFileSync6(filePath, content);
86576
86759
  }
86577
86760
  }
86578
86761
  }
86579
86762
  function loadTemplate(templatesDir, templateName, vars) {
86580
86763
  const filePath = join22(templatesDir, `${templateName}.md`);
86581
86764
  let content;
86582
- if (existsSync22(filePath)) {
86583
- content = readFileSync22(filePath, "utf-8");
86765
+ if (existsSync23(filePath)) {
86766
+ content = readFileSync23(filePath, "utf-8");
86584
86767
  } else if (DEFAULT_TEMPLATES[templateName]) {
86585
86768
  content = DEFAULT_TEMPLATES[templateName];
86586
86769
  } else {
@@ -86734,7 +86917,7 @@ category: resources
86734
86917
 
86735
86918
  // src/core/note-linker.ts
86736
86919
  import { join as join23 } from "path";
86737
- import { existsSync as existsSync23, readFileSync as readFileSync23, readdirSync as readdirSync7, statSync as statSync12 } from "fs";
86920
+ import { existsSync as existsSync24, readFileSync as readFileSync24, readdirSync as readdirSync7, statSync as statSync12 } from "fs";
86738
86921
  function updateMasterIndex(vaultRootPath) {
86739
86922
  const now = new Date().toISOString().split("T")[0];
86740
86923
  const sections = [
@@ -86757,7 +86940,7 @@ function updateMasterIndex(vaultRootPath) {
86757
86940
  ];
86758
86941
  for (const cat of categories) {
86759
86942
  const dirPath = join23(vaultRootPath, cat.dir);
86760
- if (!existsSync23(dirPath))
86943
+ if (!existsSync24(dirPath))
86761
86944
  continue;
86762
86945
  const files = collectMarkdownFiles(dirPath, vaultRootPath);
86763
86946
  if (files.length === 0 && cat.dir !== "inbox")
@@ -86809,7 +86992,7 @@ var exports_wiki = {};
86809
86992
  __export(exports_wiki, {
86810
86993
  wiki: () => wiki
86811
86994
  });
86812
- import { existsSync as existsSync24, statSync as statSync13 } from "fs";
86995
+ import { existsSync as existsSync25, statSync as statSync13 } from "fs";
86813
86996
  import { resolve as resolve11 } from "path";
86814
86997
  import { homedir as homedir4 } from "os";
86815
86998
  async function wiki(_cwd, args) {
@@ -86865,7 +87048,7 @@ async function wikiInit(args) {
86865
87048
  console.log(`[mink] initializing vault at ${targetPath}`);
86866
87049
  console.log(" (set a custom path with: mink wiki init /path/to/vault)");
86867
87050
  }
86868
- const isExisting = existsSync24(targetPath) && statSync13(targetPath).isDirectory();
87051
+ const isExisting = existsSync25(targetPath) && statSync13(targetPath).isDirectory();
86869
87052
  setConfigValue("wiki.path", targetPath);
86870
87053
  ensureVaultStructure();
86871
87054
  seedTemplates(vaultTemplates());
@@ -87084,7 +87267,7 @@ var init_wiki = __esm(() => {
87084
87267
 
87085
87268
  // src/core/note-writer.ts
87086
87269
  import { join as join24 } from "path";
87087
- import { existsSync as existsSync25, readFileSync as readFileSync24 } from "fs";
87270
+ import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
87088
87271
  function slugifyTitle(title) {
87089
87272
  return title.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
87090
87273
  }
@@ -87152,8 +87335,8 @@ ${meta.body}
87152
87335
  function appendToDaily(date, content) {
87153
87336
  const dir = vaultDailyDir();
87154
87337
  const filePath = join24(dir, `${date}.md`);
87155
- if (existsSync25(filePath)) {
87156
- const existing = readFileSync24(filePath, "utf-8");
87338
+ if (existsSync26(filePath)) {
87339
+ const existing = readFileSync25(filePath, "utf-8");
87157
87340
  const timestamp = new Date().toLocaleTimeString("en-US", {
87158
87341
  hour: "2-digit",
87159
87342
  minute: "2-digit",
@@ -87191,7 +87374,7 @@ ${content}
87191
87374
  return filePath;
87192
87375
  }
87193
87376
  function ingestFile(sourcePath, meta) {
87194
- const raw = readFileSync24(sourcePath, "utf-8");
87377
+ const raw = readFileSync25(sourcePath, "utf-8");
87195
87378
  const now = new Date().toISOString();
87196
87379
  const headingMatch = raw.match(/^#\s+(.+)$/m);
87197
87380
  const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
@@ -87245,7 +87428,7 @@ __export(exports_note, {
87245
87428
  note: () => note
87246
87429
  });
87247
87430
  import { resolve as resolve12 } from "path";
87248
- import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
87431
+ import { existsSync as existsSync27, readFileSync as readFileSync26 } from "fs";
87249
87432
  async function note(cwd, args) {
87250
87433
  if (!isWikiEnabled()) {
87251
87434
  console.error("[mink] wiki feature is disabled");
@@ -87270,13 +87453,13 @@ async function note(cwd, args) {
87270
87453
  const date = new Date().toISOString().split("T")[0];
87271
87454
  const content = parsed.positional || parsed.body || "";
87272
87455
  const filePath = appendToDaily(date, content);
87273
- updateVaultIndexForFile(filePath, readFileSync25(filePath, "utf-8"));
87456
+ updateVaultIndexForFile(filePath, readFileSync26(filePath, "utf-8"));
87274
87457
  console.log(`[mink] daily note: ${filePath}`);
87275
87458
  return;
87276
87459
  }
87277
87460
  if (parsed.file) {
87278
87461
  const sourcePath = resolve12(cwd, parsed.file);
87279
- if (!existsSync26(sourcePath)) {
87462
+ if (!existsSync27(sourcePath)) {
87280
87463
  console.error(`[mink] file not found: ${sourcePath}`);
87281
87464
  process.exit(1);
87282
87465
  }
@@ -87437,11 +87620,11 @@ var exports_skill = {};
87437
87620
  __export(exports_skill, {
87438
87621
  skill: () => skill
87439
87622
  });
87440
- import { join as join25, resolve as resolve13, dirname as dirname11 } from "path";
87623
+ import { join as join25, resolve as resolve13, dirname as dirname12 } from "path";
87441
87624
  import { homedir as homedir5 } from "os";
87442
87625
  import {
87443
- existsSync as existsSync27,
87444
- mkdirSync as mkdirSync10,
87626
+ existsSync as existsSync28,
87627
+ mkdirSync as mkdirSync11,
87445
87628
  copyFileSync,
87446
87629
  unlinkSync as unlinkSync3,
87447
87630
  readdirSync as readdirSync8,
@@ -87450,16 +87633,16 @@ import {
87450
87633
  lstatSync as lstatSync2
87451
87634
  } from "fs";
87452
87635
  function getSkillsSourceDir() {
87453
- return resolve13(dirname11(new URL(import.meta.url).pathname), "../../skills");
87636
+ return resolve13(dirname12(new URL(import.meta.url).pathname), "../../skills");
87454
87637
  }
87455
87638
  function getAvailableSkills() {
87456
87639
  const dir = getSkillsSourceDir();
87457
- if (!existsSync27(dir))
87640
+ if (!existsSync28(dir))
87458
87641
  return [];
87459
- return readdirSync8(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync27(join25(dir, d.name, "SKILL.md"))).map((d) => d.name);
87642
+ return readdirSync8(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync28(join25(dir, d.name, "SKILL.md"))).map((d) => d.name);
87460
87643
  }
87461
87644
  function isInstalled(skillName) {
87462
- return existsSync27(join25(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
87645
+ return existsSync28(join25(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
87463
87646
  }
87464
87647
  async function skill(args) {
87465
87648
  const sub = args[0];
@@ -87493,21 +87676,21 @@ function skillInstall(name) {
87493
87676
  console.error(" Expected skills at: " + sourceDir);
87494
87677
  return;
87495
87678
  }
87496
- mkdirSync10(AGENTS_SKILLS_DIR, { recursive: true });
87679
+ mkdirSync11(AGENTS_SKILLS_DIR, { recursive: true });
87497
87680
  for (const skillName of skills) {
87498
87681
  const srcDir = join25(sourceDir, skillName);
87499
87682
  const srcFile = join25(srcDir, "SKILL.md");
87500
87683
  const destDir = join25(AGENTS_SKILLS_DIR, skillName);
87501
- if (!existsSync27(srcFile)) {
87684
+ if (!existsSync28(srcFile)) {
87502
87685
  console.error(`[mink] skill not found: ${skillName}`);
87503
87686
  continue;
87504
87687
  }
87505
- mkdirSync10(destDir, { recursive: true });
87688
+ mkdirSync11(destDir, { recursive: true });
87506
87689
  copyDirRecursive(srcDir, destDir);
87507
- mkdirSync10(CLAUDE_SKILLS_DIR, { recursive: true });
87690
+ mkdirSync11(CLAUDE_SKILLS_DIR, { recursive: true });
87508
87691
  const symlink = join25(CLAUDE_SKILLS_DIR, skillName);
87509
87692
  try {
87510
- if (existsSync27(symlink)) {
87693
+ if (existsSync28(symlink)) {
87511
87694
  if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
87512
87695
  unlinkSync3(symlink);
87513
87696
  } else {
@@ -87526,14 +87709,14 @@ function skillUninstall(name) {
87526
87709
  const skills = name ? [name] : getAvailableSkills();
87527
87710
  for (const skillName of skills) {
87528
87711
  const destDir = join25(AGENTS_SKILLS_DIR, skillName);
87529
- if (!existsSync27(destDir)) {
87712
+ if (!existsSync28(destDir)) {
87530
87713
  console.log(`[mink] not installed: ${skillName}`);
87531
87714
  continue;
87532
87715
  }
87533
87716
  rmSync(destDir, { recursive: true, force: true });
87534
87717
  const symlink = join25(CLAUDE_SKILLS_DIR, skillName);
87535
87718
  try {
87536
- if (existsSync27(symlink))
87719
+ if (existsSync28(symlink))
87537
87720
  unlinkSync3(symlink);
87538
87721
  } catch {}
87539
87722
  console.log(`[mink] uninstalled: ${skillName}`);
@@ -87570,7 +87753,7 @@ function copyDirRecursive(src, dest) {
87570
87753
  const srcPath = join25(src, entry.name);
87571
87754
  const destPath = join25(dest, entry.name);
87572
87755
  if (entry.isDirectory()) {
87573
- mkdirSync10(destPath, { recursive: true });
87756
+ mkdirSync11(destPath, { recursive: true });
87574
87757
  copyDirRecursive(srcPath, destPath);
87575
87758
  } else {
87576
87759
  copyFileSync(srcPath, destPath);
@@ -87672,6 +87855,70 @@ var init_sync3 = __esm(() => {
87672
87855
  init_global_config();
87673
87856
  });
87674
87857
 
87858
+ // src/commands/device.ts
87859
+ var exports_device2 = {};
87860
+ __export(exports_device2, {
87861
+ device: () => device
87862
+ });
87863
+ import { hostname as hostname2, platform as platform2 } from "os";
87864
+ function device(args) {
87865
+ const sub = args[0] ?? "status";
87866
+ switch (sub) {
87867
+ case "status": {
87868
+ const id = getOrCreateDeviceId();
87869
+ const devices = listDevices();
87870
+ const current = devices.find((d) => d.id === id);
87871
+ console.log("[mink] device info:");
87872
+ console.log(` id: ${id}`);
87873
+ console.log(` name: ${current?.name ?? hostname2()}`);
87874
+ console.log(` hostname: ${hostname2()}`);
87875
+ console.log(` platform: ${platform2()}`);
87876
+ if (current?.firstSeen) {
87877
+ console.log(` first seen: ${current.firstSeen}`);
87878
+ }
87879
+ if (current?.lastSeen) {
87880
+ console.log(` last seen: ${current.lastSeen}`);
87881
+ }
87882
+ break;
87883
+ }
87884
+ case "list": {
87885
+ const devices = listDevices();
87886
+ const currentId = getOrCreateDeviceId();
87887
+ if (devices.length === 0) {
87888
+ console.log("[mink] no devices registered yet");
87889
+ return;
87890
+ }
87891
+ console.log("[mink] registered devices:");
87892
+ for (const d of devices) {
87893
+ const marker = d.id === currentId ? " (this device)" : "";
87894
+ console.log(` ${d.name}${marker}`);
87895
+ console.log(` id: ${d.id}`);
87896
+ console.log(` hostname: ${d.hostname}`);
87897
+ console.log(` platform: ${d.platform}`);
87898
+ console.log(` last seen: ${d.lastSeen}`);
87899
+ }
87900
+ break;
87901
+ }
87902
+ case "rename": {
87903
+ const name = args.slice(1).join(" ");
87904
+ if (!name) {
87905
+ console.error("Usage: mink device rename <name>");
87906
+ process.exit(1);
87907
+ }
87908
+ setDeviceName(name);
87909
+ console.log(`[mink] device renamed to "${name}"`);
87910
+ break;
87911
+ }
87912
+ default:
87913
+ console.error(`[mink] unknown device subcommand: ${sub}`);
87914
+ console.error("Usage: mink device [status|list|rename <name>]");
87915
+ process.exit(1);
87916
+ }
87917
+ }
87918
+ var init_device2 = __esm(() => {
87919
+ init_device();
87920
+ });
87921
+
87675
87922
  // src/commands/bug-search.ts
87676
87923
  var exports_bug_search = {};
87677
87924
  __export(exports_bug_search, {
@@ -87713,8 +87960,16 @@ init_fs_utils();
87713
87960
  init_action_log();
87714
87961
  init_vault();
87715
87962
  init_note_index();
87716
- import { mkdirSync as mkdirSync3 } from "fs";
87963
+ import { mkdirSync as mkdirSync4 } from "fs";
87717
87964
  function sessionStart(cwd) {
87965
+ try {
87966
+ const { migrateConfigIfNeeded: migrateConfigIfNeeded2 } = (init_global_config(), __toCommonJS(exports_global_config));
87967
+ migrateConfigIfNeeded2();
87968
+ } catch {}
87969
+ try {
87970
+ const { updateDeviceHeartbeat: updateDeviceHeartbeat2 } = (init_device(), __toCommonJS(exports_device));
87971
+ updateDeviceHeartbeat2();
87972
+ } catch {}
87718
87973
  try {
87719
87974
  const { isSyncInitialized: isSyncInitialized2, syncPull: syncPull2 } = (init_sync(), __toCommonJS(exports_sync));
87720
87975
  if (isSyncInitialized2()) {
@@ -87722,7 +87977,7 @@ function sessionStart(cwd) {
87722
87977
  }
87723
87978
  } catch {}
87724
87979
  const dir = projectDir(cwd);
87725
- mkdirSync3(dir, { recursive: true });
87980
+ mkdirSync4(dir, { recursive: true });
87726
87981
  const state = createSessionState();
87727
87982
  atomicWriteJson(sessionPath(cwd), state);
87728
87983
  try {
@@ -87751,8 +88006,8 @@ init_token_ledger();
87751
88006
  init_bug_memory();
87752
88007
  init_action_log();
87753
88008
  init_vault();
87754
- import { statSync as statSync2, existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
87755
- import { join as join6, dirname as dirname2 } from "path";
88009
+ import { statSync as statSync2, existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
88010
+ import { join as join6, dirname as dirname3 } from "path";
87756
88011
  function hasActivity(state) {
87757
88012
  return Object.keys(state.reads).length > 0 || state.writes.length > 0;
87758
88013
  }
@@ -87783,7 +88038,7 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
87783
88038
  }
87784
88039
  const state = raw;
87785
88040
  state.stopCount++;
87786
- const projDir = dirname2(sessionFile);
88041
+ const projDir = dirname3(sessionFile);
87787
88042
  const effectiveFinalizer = finalizer ?? createLedgerFinalizer(projDir);
87788
88043
  if (hasActivity(state)) {
87789
88044
  const summary = buildSummary(state);
@@ -87816,7 +88071,7 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
87816
88071
  }
87817
88072
  const memoryPath = join6(projDir, "learning-memory.md");
87818
88073
  const cfgPath = join6(projDir, "config.json");
87819
- if (existsSync5(memoryPath)) {
88074
+ if (existsSync6(memoryPath)) {
87820
88075
  reflect(projDir, memoryPath, cfgPath);
87821
88076
  }
87822
88077
  if (isLearningMemoryStale(memoryPath)) {
@@ -87867,8 +88122,8 @@ function writeSessionToWiki(state, projDir) {
87867
88122
  }
87868
88123
  }
87869
88124
  entry.push("");
87870
- if (existsSync5(sessionFile)) {
87871
- const existing = readFileSync6(sessionFile, "utf-8");
88125
+ if (existsSync6(sessionFile)) {
88126
+ const existing = readFileSync7(sessionFile, "utf-8");
87872
88127
  atomicWriteText(sessionFile, existing.trimEnd() + `
87873
88128
  ` + entry.join(`
87874
88129
  `));
@@ -88008,6 +88263,11 @@ switch (command2) {
88008
88263
  await sync2(process.argv.slice(3));
88009
88264
  break;
88010
88265
  }
88266
+ case "device": {
88267
+ const { device: device2 } = await Promise.resolve().then(() => (init_device2(), exports_device2));
88268
+ device2(process.argv.slice(3));
88269
+ break;
88270
+ }
88011
88271
  case "bug-search": {
88012
88272
  const { bugSearch: bugSearch2 } = await Promise.resolve().then(() => (init_bug_search(), exports_bug_search));
88013
88273
  bugSearch2(cwd, process.argv.slice(3).join(" "));
@@ -88027,11 +88287,11 @@ switch (command2) {
88027
88287
  case "version":
88028
88288
  case "--version":
88029
88289
  case "-v": {
88030
- const { resolve: resolve14, dirname: dirname12 } = await import("path");
88031
- const cliPath = resolve14(dirname12(new URL(import.meta.url).pathname));
88032
- const { readFileSync: readFileSync26 } = await import("fs");
88290
+ const { resolve: resolve14, dirname: dirname13 } = await import("path");
88291
+ const cliPath = resolve14(dirname13(new URL(import.meta.url).pathname));
88292
+ const { readFileSync: readFileSync27 } = await import("fs");
88033
88293
  try {
88034
- const pkg = JSON.parse(readFileSync26(resolve14(cliPath, "../package.json"), "utf-8"));
88294
+ const pkg = JSON.parse(readFileSync27(resolve14(cliPath, "../package.json"), "utf-8"));
88035
88295
  console.log(`mink ${pkg.version}`);
88036
88296
  } catch {
88037
88297
  console.log("mink (unknown version)");
@@ -88060,7 +88320,10 @@ switch (command2) {
88060
88320
  console.log(" note search <term> Full-text search across the vault");
88061
88321
  console.log(" skill install Install /mink:note skill for Claude Code");
88062
88322
  console.log();
88063
- console.log("Sync:");
88323
+ console.log("Devices & Sync:");
88324
+ console.log(" device Show current device info");
88325
+ console.log(" device list List all registered devices");
88326
+ console.log(" device rename <name> Set a friendly name for this device");
88064
88327
  console.log(" sync Full manual sync (pull then push)");
88065
88328
  console.log(" sync init <remote-url> Connect ~/.mink to a git remote for cross-device sync");
88066
88329
  console.log(" sync status Show sync state (remote, last sync, pending changes)");