@drewpayment/mink 0.2.2 → 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/README.md +80 -11
- package/dist/cli.js +1455 -703
- package/package.json +1 -1
- package/src/cli.ts +25 -1
- package/src/commands/config.ts +1 -1
- package/src/commands/device.ts +65 -0
- package/src/commands/session-start.ts +26 -0
- package/src/commands/session-stop.ts +4 -59
- package/src/commands/sync.ts +111 -0
- package/src/commands/wiki.ts +106 -1
- package/src/core/device.ts +72 -0
- package/src/core/global-config.ts +72 -11
- package/src/core/paths.ts +12 -0
- package/src/core/sync.ts +345 -0
- package/src/core/vault.ts +82 -3
- package/src/types/config.ts +55 -2
- package/src/types/note.ts +7 -0
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ var __create = Object.create;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
10
|
function __accessProp(key) {
|
|
10
11
|
return this[key];
|
|
@@ -31,6 +32,23 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
31
32
|
cache.set(mod, to);
|
|
32
33
|
return to;
|
|
33
34
|
};
|
|
35
|
+
var __toCommonJS = (from) => {
|
|
36
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
37
|
+
if (entry)
|
|
38
|
+
return entry;
|
|
39
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (var key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(entry, key))
|
|
43
|
+
__defProp(entry, key, {
|
|
44
|
+
get: __accessProp.bind(from, key),
|
|
45
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
__moduleCache.set(from, entry);
|
|
49
|
+
return entry;
|
|
50
|
+
};
|
|
51
|
+
var __moduleCache;
|
|
34
52
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
35
53
|
var __returnValue = (v) => v;
|
|
36
54
|
function __exportSetter(name, newValue) {
|
|
@@ -171,11 +189,14 @@ __export(exports_paths, {
|
|
|
171
189
|
projectMetaPath: () => projectMetaPath,
|
|
172
190
|
projectDir: () => projectDir,
|
|
173
191
|
minkRoot: () => minkRoot,
|
|
192
|
+
localConfigPath: () => localConfigPath,
|
|
174
193
|
learningMemoryPath: () => learningMemoryPath,
|
|
175
194
|
globalConfigPath: () => globalConfigPath,
|
|
176
195
|
frameworkAdvisorPath: () => frameworkAdvisorPath,
|
|
177
196
|
frameworkAdvisorJsonPath: () => frameworkAdvisorJsonPath,
|
|
178
197
|
fileIndexPath: () => fileIndexPath,
|
|
198
|
+
deviceRegistryPath: () => deviceRegistryPath,
|
|
199
|
+
deviceIdPath: () => deviceIdPath,
|
|
179
200
|
designReportPath: () => designReportPath,
|
|
180
201
|
designCapturesDir: () => designCapturesDir,
|
|
181
202
|
configPath: () => configPath,
|
|
@@ -228,6 +249,15 @@ function schedulerManifestPath(cwd) {
|
|
|
228
249
|
function globalConfigPath() {
|
|
229
250
|
return join(MINK_ROOT, "config");
|
|
230
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
|
+
}
|
|
231
261
|
function projectMetaPath(cwd) {
|
|
232
262
|
return join(projectDir(cwd), "project-meta.json");
|
|
233
263
|
}
|
|
@@ -542,72 +572,139 @@ var init_config = __esm(() => {
|
|
|
542
572
|
key: "wiki.path",
|
|
543
573
|
default: "~/.mink/wiki/",
|
|
544
574
|
envVar: "MINK_WIKI_PATH",
|
|
545
|
-
description: "Wiki vault location"
|
|
575
|
+
description: "Wiki vault location",
|
|
576
|
+
scope: "local"
|
|
546
577
|
},
|
|
547
578
|
{
|
|
548
579
|
key: "wiki.enabled",
|
|
549
580
|
default: "true",
|
|
550
581
|
envVar: "MINK_WIKI_ENABLED",
|
|
551
|
-
description: "Enable/disable the wiki feature"
|
|
582
|
+
description: "Enable/disable the wiki feature",
|
|
583
|
+
scope: "shared"
|
|
552
584
|
},
|
|
553
585
|
{
|
|
554
586
|
key: "wiki.sync-mode",
|
|
555
587
|
default: "immediate",
|
|
556
588
|
envVar: "MINK_WIKI_SYNC_MODE",
|
|
557
|
-
description: "Sync mode: immediate or batched"
|
|
589
|
+
description: "Sync mode: immediate or batched",
|
|
590
|
+
scope: "shared"
|
|
558
591
|
},
|
|
559
592
|
{
|
|
560
593
|
key: "wiki.git-backup",
|
|
561
594
|
default: "false",
|
|
562
595
|
envVar: "MINK_WIKI_GIT_BACKUP",
|
|
563
|
-
description: "
|
|
596
|
+
description: "Deprecated: use sync.enabled instead",
|
|
597
|
+
scope: "shared"
|
|
564
598
|
},
|
|
565
599
|
{
|
|
566
600
|
key: "wiki.git-remote",
|
|
567
601
|
default: "origin",
|
|
568
602
|
envVar: "MINK_WIKI_GIT_REMOTE",
|
|
569
|
-
description: "
|
|
603
|
+
description: "Deprecated: use sync.remote-url instead",
|
|
604
|
+
scope: "shared"
|
|
570
605
|
},
|
|
571
606
|
{
|
|
572
607
|
key: "notes.default-category",
|
|
573
608
|
default: "inbox",
|
|
574
609
|
envVar: "MINK_NOTES_DEFAULT_CATEGORY",
|
|
575
|
-
description: "Default category for notes captured via CLI"
|
|
610
|
+
description: "Default category for notes captured via CLI",
|
|
611
|
+
scope: "shared"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
key: "sync.enabled",
|
|
615
|
+
default: "false",
|
|
616
|
+
envVar: "MINK_SYNC_ENABLED",
|
|
617
|
+
description: "Enable/disable automatic git sync of ~/.mink",
|
|
618
|
+
scope: "shared"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
key: "sync.remote-url",
|
|
622
|
+
default: "",
|
|
623
|
+
envVar: "MINK_SYNC_REMOTE_URL",
|
|
624
|
+
description: "Git remote URL for ~/.mink sync",
|
|
625
|
+
scope: "shared"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
key: "sync.last-push",
|
|
629
|
+
default: "",
|
|
630
|
+
envVar: "MINK_SYNC_LAST_PUSH",
|
|
631
|
+
description: "ISO timestamp of last successful sync push",
|
|
632
|
+
scope: "local"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
key: "sync.last-pull",
|
|
636
|
+
default: "",
|
|
637
|
+
envVar: "MINK_SYNC_LAST_PULL",
|
|
638
|
+
description: "ISO timestamp of last successful sync pull",
|
|
639
|
+
scope: "local"
|
|
576
640
|
}
|
|
577
641
|
];
|
|
578
642
|
VALID_KEYS = new Set(CONFIG_KEYS.map((k) => k.key));
|
|
579
643
|
});
|
|
580
644
|
|
|
581
645
|
// src/core/global-config.ts
|
|
582
|
-
|
|
583
|
-
|
|
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);
|
|
584
661
|
if (raw === null)
|
|
585
662
|
return {};
|
|
586
663
|
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
587
|
-
console.warn("[mink] warning: corrupt config file at " +
|
|
664
|
+
console.warn("[mink] warning: corrupt config file at " + path);
|
|
588
665
|
return {};
|
|
589
666
|
}
|
|
590
667
|
return raw;
|
|
591
668
|
}
|
|
669
|
+
function loadGlobalConfig() {
|
|
670
|
+
return loadConfigFile(globalConfigPath());
|
|
671
|
+
}
|
|
592
672
|
function saveGlobalConfig(config) {
|
|
593
673
|
atomicWriteJson(globalConfigPath(), config);
|
|
594
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
|
+
}
|
|
595
691
|
function resolveConfigValue(key) {
|
|
596
692
|
const meta = getConfigKeyMeta(key);
|
|
597
|
-
const config =
|
|
693
|
+
const config = loadConfigForScope(meta.scope);
|
|
598
694
|
const envValue = process.env[meta.envVar];
|
|
599
695
|
const fileValue = config[key];
|
|
600
696
|
if (envValue !== undefined && envValue !== "") {
|
|
601
697
|
return {
|
|
602
698
|
value: envValue,
|
|
603
699
|
source: "environment variable",
|
|
700
|
+
scope: meta.scope,
|
|
604
701
|
configFileValue: fileValue
|
|
605
702
|
};
|
|
606
703
|
}
|
|
607
704
|
if (fileValue !== undefined) {
|
|
608
|
-
return { value: fileValue, source: "config file" };
|
|
705
|
+
return { value: fileValue, source: "config file", scope: meta.scope };
|
|
609
706
|
}
|
|
610
|
-
return { value: meta.default, source: "default" };
|
|
707
|
+
return { value: meta.default, source: "default", scope: meta.scope };
|
|
611
708
|
}
|
|
612
709
|
function resolveAllConfig() {
|
|
613
710
|
return CONFIG_KEYS.map((meta) => ({
|
|
@@ -616,18 +713,46 @@ function resolveAllConfig() {
|
|
|
616
713
|
}));
|
|
617
714
|
}
|
|
618
715
|
function setConfigValue(key, value) {
|
|
619
|
-
const
|
|
716
|
+
const meta = getConfigKeyMeta(key);
|
|
717
|
+
const config = loadConfigForScope(meta.scope);
|
|
620
718
|
config[key] = value;
|
|
621
|
-
|
|
719
|
+
saveConfigForScope(meta.scope, config);
|
|
622
720
|
}
|
|
623
721
|
function resetConfigKey(key) {
|
|
624
|
-
const
|
|
722
|
+
const meta = getConfigKeyMeta(key);
|
|
723
|
+
const config = loadConfigForScope(meta.scope);
|
|
625
724
|
delete config[key];
|
|
626
|
-
|
|
725
|
+
saveConfigForScope(meta.scope, config);
|
|
627
726
|
}
|
|
628
727
|
function resetAllConfig() {
|
|
629
728
|
saveGlobalConfig({});
|
|
729
|
+
saveLocalConfig({});
|
|
630
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
|
+
}
|
|
754
|
+
}
|
|
755
|
+
var migrationRan = false;
|
|
631
756
|
var init_global_config = __esm(() => {
|
|
632
757
|
init_paths();
|
|
633
758
|
init_fs_utils();
|
|
@@ -635,9 +760,9 @@ var init_global_config = __esm(() => {
|
|
|
635
760
|
});
|
|
636
761
|
|
|
637
762
|
// src/core/vault.ts
|
|
638
|
-
import { join as join2 } from "path";
|
|
763
|
+
import { join as join2, basename as basename2, resolve } from "path";
|
|
639
764
|
import { homedir as homedir2 } from "os";
|
|
640
|
-
import { existsSync, mkdirSync as mkdirSync2 } from "fs";
|
|
765
|
+
import { existsSync, mkdirSync as mkdirSync2, symlinkSync, unlinkSync, lstatSync, readlinkSync } from "fs";
|
|
641
766
|
function resolveVaultPath() {
|
|
642
767
|
const resolved = resolveConfigValue("wiki.path");
|
|
643
768
|
const raw = resolved.value;
|
|
@@ -678,6 +803,12 @@ function isWikiEnabled() {
|
|
|
678
803
|
const resolved = resolveConfigValue("wiki.enabled");
|
|
679
804
|
return resolved.value === "true";
|
|
680
805
|
}
|
|
806
|
+
function loadVaultManifest() {
|
|
807
|
+
const raw = safeReadJson(vaultManifestPath());
|
|
808
|
+
if (raw === null || typeof raw !== "object")
|
|
809
|
+
return null;
|
|
810
|
+
return raw;
|
|
811
|
+
}
|
|
681
812
|
function ensureVaultStructure() {
|
|
682
813
|
const root = resolveVaultPath();
|
|
683
814
|
for (const dir of VAULT_DIRS) {
|
|
@@ -700,10 +831,66 @@ function categoryToDir(category, projectSlug) {
|
|
|
700
831
|
return join2(root, "inbox");
|
|
701
832
|
}
|
|
702
833
|
}
|
|
834
|
+
function saveManifest(manifest) {
|
|
835
|
+
atomicWriteJson(vaultManifestPath(), manifest);
|
|
836
|
+
}
|
|
837
|
+
function linkExternal(targetPath, name) {
|
|
838
|
+
const root = resolveVaultPath();
|
|
839
|
+
const absTarget = targetPath.startsWith("~/") ? join2(homedir2(), targetPath.slice(2)) : resolve(targetPath);
|
|
840
|
+
if (!existsSync(absTarget)) {
|
|
841
|
+
return { ok: false, error: `target does not exist: ${absTarget}` };
|
|
842
|
+
}
|
|
843
|
+
if (!lstatSync(absTarget).isDirectory()) {
|
|
844
|
+
return { ok: false, error: `target is not a directory: ${absTarget}` };
|
|
845
|
+
}
|
|
846
|
+
const linkName = name ?? basename2(absTarget);
|
|
847
|
+
const linkPath = join2(root, linkName);
|
|
848
|
+
if (existsSync(linkPath)) {
|
|
849
|
+
if (lstatSync(linkPath).isSymbolicLink()) {
|
|
850
|
+
const existing = readlinkSync(linkPath);
|
|
851
|
+
if (existing === absTarget) {
|
|
852
|
+
return { ok: false, error: `already linked: ${linkName} -> ${absTarget}` };
|
|
853
|
+
}
|
|
854
|
+
return { ok: false, error: `a different link already exists at ${linkName} -> ${existing}` };
|
|
855
|
+
}
|
|
856
|
+
return { ok: false, error: `${linkName} already exists in the vault and is not a symlink` };
|
|
857
|
+
}
|
|
858
|
+
symlinkSync(absTarget, linkPath, "dir");
|
|
859
|
+
const manifest = loadVaultManifest();
|
|
860
|
+
if (manifest) {
|
|
861
|
+
const links = manifest.links ?? [];
|
|
862
|
+
links.push({ name: linkName, target: absTarget, linkedAt: new Date().toISOString() });
|
|
863
|
+
manifest.links = links;
|
|
864
|
+
saveManifest(manifest);
|
|
865
|
+
}
|
|
866
|
+
return { ok: true, linkName, linkPath };
|
|
867
|
+
}
|
|
868
|
+
function unlinkExternal(name) {
|
|
869
|
+
const root = resolveVaultPath();
|
|
870
|
+
const linkPath = join2(root, name);
|
|
871
|
+
if (!existsSync(linkPath)) {
|
|
872
|
+
return { ok: false, error: `no link named "${name}" in the vault` };
|
|
873
|
+
}
|
|
874
|
+
if (!lstatSync(linkPath).isSymbolicLink()) {
|
|
875
|
+
return { ok: false, error: `"${name}" is not a symlink — refusing to remove` };
|
|
876
|
+
}
|
|
877
|
+
unlinkSync(linkPath);
|
|
878
|
+
const manifest = loadVaultManifest();
|
|
879
|
+
if (manifest && manifest.links) {
|
|
880
|
+
manifest.links = manifest.links.filter((l) => l.name !== name);
|
|
881
|
+
saveManifest(manifest);
|
|
882
|
+
}
|
|
883
|
+
return { ok: true };
|
|
884
|
+
}
|
|
885
|
+
function listLinks() {
|
|
886
|
+
const manifest = loadVaultManifest();
|
|
887
|
+
return manifest?.links ?? [];
|
|
888
|
+
}
|
|
703
889
|
var DEFAULT_VAULT_PATH, VAULT_DIRS;
|
|
704
890
|
var init_vault = __esm(() => {
|
|
705
891
|
init_global_config();
|
|
706
892
|
init_fs_utils();
|
|
893
|
+
init_fs_utils();
|
|
707
894
|
DEFAULT_VAULT_PATH = join2(homedir2(), ".mink", "wiki");
|
|
708
895
|
VAULT_DIRS = [
|
|
709
896
|
"",
|
|
@@ -906,6 +1093,320 @@ var init_note_index = __esm(() => {
|
|
|
906
1093
|
]);
|
|
907
1094
|
});
|
|
908
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
|
+
|
|
1171
|
+
// src/core/sync.ts
|
|
1172
|
+
var exports_sync = {};
|
|
1173
|
+
__export(exports_sync, {
|
|
1174
|
+
syncPush: () => syncPush,
|
|
1175
|
+
syncPull: () => syncPull,
|
|
1176
|
+
isSyncInitialized: () => isSyncInitialized,
|
|
1177
|
+
initSync: () => initSync,
|
|
1178
|
+
getSyncStatus: () => getSyncStatus,
|
|
1179
|
+
ensureGitignore: () => ensureGitignore,
|
|
1180
|
+
disconnectSync: () => disconnectSync
|
|
1181
|
+
});
|
|
1182
|
+
import { existsSync as existsSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
1183
|
+
import { join as join4 } from "path";
|
|
1184
|
+
import { execSync } from "child_process";
|
|
1185
|
+
function git(args, timeoutMs = GIT_TIMEOUT) {
|
|
1186
|
+
return execSync(`git ${args}`, {
|
|
1187
|
+
cwd: minkRoot(),
|
|
1188
|
+
timeout: timeoutMs,
|
|
1189
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1190
|
+
}).toString().trim();
|
|
1191
|
+
}
|
|
1192
|
+
function gitSafe(args, timeoutMs = GIT_TIMEOUT) {
|
|
1193
|
+
try {
|
|
1194
|
+
return git(args, timeoutMs);
|
|
1195
|
+
} catch {
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
function isSyncInitialized() {
|
|
1200
|
+
const enabled = resolveConfigValue("sync.enabled").value;
|
|
1201
|
+
if (enabled !== "true")
|
|
1202
|
+
return false;
|
|
1203
|
+
return existsSync4(join4(minkRoot(), ".git"));
|
|
1204
|
+
}
|
|
1205
|
+
function ensureGitignore() {
|
|
1206
|
+
const gitignorePath = join4(minkRoot(), ".gitignore");
|
|
1207
|
+
writeFileSync3(gitignorePath, GITIGNORE_CONTENTS);
|
|
1208
|
+
}
|
|
1209
|
+
function getSyncStatus() {
|
|
1210
|
+
const enabled = resolveConfigValue("sync.enabled").value === "true";
|
|
1211
|
+
const gitInitialized = existsSync4(join4(minkRoot(), ".git"));
|
|
1212
|
+
const remoteUrl = resolveConfigValue("sync.remote-url").value;
|
|
1213
|
+
const lastPush = resolveConfigValue("sync.last-push").value;
|
|
1214
|
+
const lastPull = resolveConfigValue("sync.last-pull").value;
|
|
1215
|
+
let pendingChanges = 0;
|
|
1216
|
+
let branch = "";
|
|
1217
|
+
if (gitInitialized) {
|
|
1218
|
+
const status = gitSafe("status --porcelain");
|
|
1219
|
+
if (status !== null) {
|
|
1220
|
+
pendingChanges = status.split(`
|
|
1221
|
+
`).filter((l) => l.trim().length > 0).length;
|
|
1222
|
+
}
|
|
1223
|
+
branch = gitSafe("rev-parse --abbrev-ref HEAD") ?? "";
|
|
1224
|
+
}
|
|
1225
|
+
return {
|
|
1226
|
+
enabled,
|
|
1227
|
+
gitInitialized,
|
|
1228
|
+
remoteUrl,
|
|
1229
|
+
lastPush,
|
|
1230
|
+
lastPull,
|
|
1231
|
+
pendingChanges,
|
|
1232
|
+
branch
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function initSync(remoteUrl) {
|
|
1236
|
+
const root = minkRoot();
|
|
1237
|
+
const gitDir = join4(root, ".git");
|
|
1238
|
+
if (existsSync4(gitDir)) {
|
|
1239
|
+
console.log("[mink] sync is already initialized in " + root);
|
|
1240
|
+
console.log("[mink] run 'mink sync disconnect' first to reinitialize");
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
ensureGitignore();
|
|
1244
|
+
git("init");
|
|
1245
|
+
git(`remote add origin ${remoteUrl}`);
|
|
1246
|
+
const fetchResult = gitSafe("fetch origin", FETCH_TIMEOUT);
|
|
1247
|
+
if (fetchResult !== null) {
|
|
1248
|
+
const remoteBranches = gitSafe("branch -r");
|
|
1249
|
+
if (remoteBranches && remoteBranches.trim().length > 0) {
|
|
1250
|
+
const defaultBranch = detectRemoteDefaultBranch();
|
|
1251
|
+
try {
|
|
1252
|
+
git("add -A");
|
|
1253
|
+
const status = gitSafe("status --porcelain");
|
|
1254
|
+
if (status && status.trim().length > 0) {
|
|
1255
|
+
git(`commit -m "mink: local state before sync"`);
|
|
1256
|
+
}
|
|
1257
|
+
git(`pull --rebase origin ${defaultBranch}`, FETCH_TIMEOUT);
|
|
1258
|
+
} catch {
|
|
1259
|
+
gitSafe("rebase --abort");
|
|
1260
|
+
console.error("[mink] warning: could not merge remote content. Local state preserved.");
|
|
1261
|
+
console.error("[mink] you may need to resolve conflicts manually with 'mink sync pull'");
|
|
1262
|
+
}
|
|
1263
|
+
} else {
|
|
1264
|
+
git("add -A");
|
|
1265
|
+
git(`commit -m "mink: initial sync"`);
|
|
1266
|
+
git("branch -M main");
|
|
1267
|
+
git("push -u origin main", PUSH_TIMEOUT);
|
|
1268
|
+
}
|
|
1269
|
+
} else {
|
|
1270
|
+
git("add -A");
|
|
1271
|
+
git(`commit -m "mink: initial sync"`);
|
|
1272
|
+
git("branch -M main");
|
|
1273
|
+
try {
|
|
1274
|
+
git("push -u origin main", PUSH_TIMEOUT);
|
|
1275
|
+
} catch {
|
|
1276
|
+
console.error("[mink] push failed — local commit preserved, will retry on next sync");
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
setConfigValue("sync.enabled", "true");
|
|
1280
|
+
setConfigValue("sync.remote-url", remoteUrl);
|
|
1281
|
+
setConfigValue("sync.last-push", new Date().toISOString());
|
|
1282
|
+
console.log("[mink] sync initialized successfully");
|
|
1283
|
+
console.log("[mink] remote: " + remoteUrl);
|
|
1284
|
+
console.log("[mink] auto-sync: pull on session-start, push on session-stop");
|
|
1285
|
+
console.log("[mink] manual sync: run 'mink sync' at any time");
|
|
1286
|
+
}
|
|
1287
|
+
function syncPull(onMessage = (msg) => console.error(msg)) {
|
|
1288
|
+
if (!isSyncInitialized())
|
|
1289
|
+
return;
|
|
1290
|
+
ensureGitignore();
|
|
1291
|
+
const root = minkRoot();
|
|
1292
|
+
try {
|
|
1293
|
+
const status = gitSafe("status --porcelain");
|
|
1294
|
+
const hasLocalChanges = status !== null && status.trim().length > 0;
|
|
1295
|
+
if (hasLocalChanges) {
|
|
1296
|
+
gitSafe("stash push -m mink-sync-pull");
|
|
1297
|
+
}
|
|
1298
|
+
const branch = gitSafe("rev-parse --abbrev-ref HEAD") ?? "main";
|
|
1299
|
+
try {
|
|
1300
|
+
git(`pull --rebase origin ${branch}`, FETCH_TIMEOUT);
|
|
1301
|
+
} catch (err) {
|
|
1302
|
+
if (existsSync4(join4(root, ".git", "rebase-merge")) || existsSync4(join4(root, ".git", "rebase-apply"))) {
|
|
1303
|
+
gitSafe("rebase --abort");
|
|
1304
|
+
onMessage("[mink] sync pull: rebase conflict detected — aborted rebase, local state preserved");
|
|
1305
|
+
onMessage("[mink] resolve manually with 'mink sync pull' or 'cd ~/.mink && git pull --rebase origin main'");
|
|
1306
|
+
} else {
|
|
1307
|
+
onMessage(`[mink] sync pull failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
if (hasLocalChanges) {
|
|
1311
|
+
try {
|
|
1312
|
+
gitSafe("stash pop");
|
|
1313
|
+
} catch {
|
|
1314
|
+
onMessage("[mink] sync pull: stash pop had conflicts — your local changes are in git stash");
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
setConfigValue("sync.last-pull", new Date().toISOString());
|
|
1318
|
+
try {
|
|
1319
|
+
updateDeviceHeartbeat();
|
|
1320
|
+
} catch {}
|
|
1321
|
+
} catch (err) {
|
|
1322
|
+
onMessage(`[mink] sync pull error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
function syncPush(onMessage = (msg) => console.error(msg)) {
|
|
1326
|
+
if (!isSyncInitialized())
|
|
1327
|
+
return;
|
|
1328
|
+
ensureGitignore();
|
|
1329
|
+
try {
|
|
1330
|
+
updateDeviceHeartbeat();
|
|
1331
|
+
} catch {}
|
|
1332
|
+
const root = minkRoot();
|
|
1333
|
+
try {
|
|
1334
|
+
const status = gitSafe("status --porcelain");
|
|
1335
|
+
if (!status || !status.trim()) {
|
|
1336
|
+
const branch2 = gitSafe("rev-parse --abbrev-ref HEAD") ?? "main";
|
|
1337
|
+
try {
|
|
1338
|
+
git(`push origin ${branch2}`, PUSH_TIMEOUT);
|
|
1339
|
+
setConfigValue("sync.last-push", new Date().toISOString());
|
|
1340
|
+
} catch {}
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
git("add -A");
|
|
1344
|
+
const now = new Date;
|
|
1345
|
+
const timestamp = now.toISOString().replace("T", " ").slice(0, 16);
|
|
1346
|
+
git(`commit -m "mink: sync ${timestamp}"`);
|
|
1347
|
+
const branch = gitSafe("rev-parse --abbrev-ref HEAD") ?? "main";
|
|
1348
|
+
try {
|
|
1349
|
+
git(`pull --rebase origin ${branch}`, FETCH_TIMEOUT);
|
|
1350
|
+
} catch {
|
|
1351
|
+
if (existsSync4(join4(root, ".git", "rebase-merge")) || existsSync4(join4(root, ".git", "rebase-apply"))) {
|
|
1352
|
+
gitSafe("rebase --abort");
|
|
1353
|
+
onMessage("[mink] sync: rebase conflict during push — local commit preserved, skipping push");
|
|
1354
|
+
onMessage("[mink] resolve manually with 'mink sync pull' then 'mink sync push'");
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
try {
|
|
1359
|
+
git(`push origin ${branch}`, PUSH_TIMEOUT);
|
|
1360
|
+
setConfigValue("sync.last-push", new Date().toISOString());
|
|
1361
|
+
} catch {
|
|
1362
|
+
onMessage("[mink] sync push failed — local commit preserved, will retry next session");
|
|
1363
|
+
}
|
|
1364
|
+
} catch (err) {
|
|
1365
|
+
onMessage(`[mink] sync push error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function disconnectSync() {
|
|
1369
|
+
const root = minkRoot();
|
|
1370
|
+
const gitDir = join4(root, ".git");
|
|
1371
|
+
if (!existsSync4(gitDir)) {
|
|
1372
|
+
console.log("[mink] sync is not initialized — nothing to disconnect");
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
const { rmSync } = __require("fs");
|
|
1376
|
+
rmSync(gitDir, { recursive: true, force: true });
|
|
1377
|
+
setConfigValue("sync.enabled", "false");
|
|
1378
|
+
setConfigValue("sync.remote-url", "");
|
|
1379
|
+
setConfigValue("sync.last-push", "");
|
|
1380
|
+
setConfigValue("sync.last-pull", "");
|
|
1381
|
+
console.log("[mink] sync disconnected — git tracking removed, data preserved");
|
|
1382
|
+
}
|
|
1383
|
+
function detectRemoteDefaultBranch() {
|
|
1384
|
+
const remoteBranches = gitSafe("branch -r") ?? "";
|
|
1385
|
+
if (remoteBranches.includes("origin/main"))
|
|
1386
|
+
return "main";
|
|
1387
|
+
if (remoteBranches.includes("origin/master"))
|
|
1388
|
+
return "master";
|
|
1389
|
+
const first = remoteBranches.split(`
|
|
1390
|
+
`).map((b) => b.trim()).filter((b) => b.startsWith("origin/") && !b.includes("HEAD")).map((b) => b.replace("origin/", ""))[0];
|
|
1391
|
+
return first ?? "main";
|
|
1392
|
+
}
|
|
1393
|
+
var GIT_TIMEOUT = 5000, PUSH_TIMEOUT = 1e4, FETCH_TIMEOUT = 15000, GITIGNORE_CONTENTS = `# Runtime state — machine-specific
|
|
1394
|
+
scheduler.pid
|
|
1395
|
+
scheduler.log
|
|
1396
|
+
|
|
1397
|
+
# Device identity and local config — machine-specific
|
|
1398
|
+
device-id
|
|
1399
|
+
config.local
|
|
1400
|
+
|
|
1401
|
+
# Local backups — machine-specific snapshots
|
|
1402
|
+
projects/*/backups/
|
|
1403
|
+
`;
|
|
1404
|
+
var init_sync = __esm(() => {
|
|
1405
|
+
init_paths();
|
|
1406
|
+
init_global_config();
|
|
1407
|
+
init_device();
|
|
1408
|
+
});
|
|
1409
|
+
|
|
909
1410
|
// src/core/learning-memory.ts
|
|
910
1411
|
var exports_learning_memory = {};
|
|
911
1412
|
__export(exports_learning_memory, {
|
|
@@ -1281,13 +1782,13 @@ var exports_reflect = {};
|
|
|
1281
1782
|
__export(exports_reflect, {
|
|
1282
1783
|
reflect: () => reflect
|
|
1283
1784
|
});
|
|
1284
|
-
import { existsSync as
|
|
1785
|
+
import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
|
|
1285
1786
|
function reflect(projectDir2, memoryPath, configPath2) {
|
|
1286
|
-
if (!
|
|
1787
|
+
if (!existsSync5(memoryPath)) {
|
|
1287
1788
|
console.log("[mink] no learning memory found");
|
|
1288
1789
|
return null;
|
|
1289
1790
|
}
|
|
1290
|
-
const markdown =
|
|
1791
|
+
const markdown = readFileSync6(memoryPath, "utf-8");
|
|
1291
1792
|
const mem = parseLearningMemory(markdown);
|
|
1292
1793
|
const config = safeReadJson(configPath2);
|
|
1293
1794
|
const tokenBudget = config?.learningMemoryTokenBudget ?? DEFAULT_TOKEN_BUDGET;
|
|
@@ -1306,7 +1807,7 @@ var init_reflect = __esm(() => {
|
|
|
1306
1807
|
});
|
|
1307
1808
|
|
|
1308
1809
|
// src/core/token-ledger.ts
|
|
1309
|
-
import { join as
|
|
1810
|
+
import { join as join5 } from "path";
|
|
1310
1811
|
function addToLifetime(lifetime, session) {
|
|
1311
1812
|
lifetime.totalTokens += session.totals.estimatedTokens;
|
|
1312
1813
|
lifetime.totalReads += session.totals.readCount;
|
|
@@ -1433,8 +1934,8 @@ function saveArchive(archivePath, newlyArchived) {
|
|
|
1433
1934
|
atomicWriteJson(archivePath, combined);
|
|
1434
1935
|
}
|
|
1435
1936
|
function createLedgerFinalizer(projectDir2, archiveThreshold = 1000) {
|
|
1436
|
-
const ledgerPath =
|
|
1437
|
-
const archivePath =
|
|
1937
|
+
const ledgerPath = join5(projectDir2, "token-ledger.json");
|
|
1938
|
+
const archivePath = join5(projectDir2, "token-ledger-archive.json");
|
|
1438
1939
|
return {
|
|
1439
1940
|
appendSession(summary) {
|
|
1440
1941
|
const ledger = loadLedger(ledgerPath);
|
|
@@ -1583,11 +2084,14 @@ __export(exports_paths2, {
|
|
|
1583
2084
|
projectMetaPath: () => projectMetaPath2,
|
|
1584
2085
|
projectDir: () => projectDir2,
|
|
1585
2086
|
minkRoot: () => minkRoot2,
|
|
2087
|
+
localConfigPath: () => localConfigPath2,
|
|
1586
2088
|
learningMemoryPath: () => learningMemoryPath2,
|
|
1587
2089
|
globalConfigPath: () => globalConfigPath2,
|
|
1588
2090
|
frameworkAdvisorPath: () => frameworkAdvisorPath2,
|
|
1589
2091
|
frameworkAdvisorJsonPath: () => frameworkAdvisorJsonPath2,
|
|
1590
2092
|
fileIndexPath: () => fileIndexPath2,
|
|
2093
|
+
deviceRegistryPath: () => deviceRegistryPath2,
|
|
2094
|
+
deviceIdPath: () => deviceIdPath2,
|
|
1591
2095
|
designReportPath: () => designReportPath2,
|
|
1592
2096
|
designCapturesDir: () => designCapturesDir2,
|
|
1593
2097
|
configPath: () => configPath2,
|
|
@@ -1595,73 +2099,82 @@ __export(exports_paths2, {
|
|
|
1595
2099
|
backupDirPath: () => backupDirPath2,
|
|
1596
2100
|
actionLogPath: () => actionLogPath2
|
|
1597
2101
|
});
|
|
1598
|
-
import { join as
|
|
2102
|
+
import { join as join7 } from "path";
|
|
1599
2103
|
import { homedir as homedir3 } from "os";
|
|
1600
2104
|
function minkRoot2() {
|
|
1601
2105
|
return MINK_ROOT2;
|
|
1602
2106
|
}
|
|
1603
2107
|
function projectDir2(cwd) {
|
|
1604
2108
|
const id = generateProjectId(cwd);
|
|
1605
|
-
return
|
|
2109
|
+
return join7(MINK_ROOT2, "projects", id);
|
|
1606
2110
|
}
|
|
1607
2111
|
function sessionPath2(cwd) {
|
|
1608
|
-
return
|
|
2112
|
+
return join7(projectDir2(cwd), "session.json");
|
|
1609
2113
|
}
|
|
1610
2114
|
function fileIndexPath2(cwd) {
|
|
1611
|
-
return
|
|
2115
|
+
return join7(projectDir2(cwd), "file-index.json");
|
|
1612
2116
|
}
|
|
1613
2117
|
function configPath2(cwd) {
|
|
1614
|
-
return
|
|
2118
|
+
return join7(projectDir2(cwd), "config.json");
|
|
1615
2119
|
}
|
|
1616
2120
|
function learningMemoryPath2(cwd) {
|
|
1617
|
-
return
|
|
2121
|
+
return join7(projectDir2(cwd), "learning-memory.md");
|
|
1618
2122
|
}
|
|
1619
2123
|
function tokenLedgerPath2(cwd) {
|
|
1620
|
-
return
|
|
2124
|
+
return join7(projectDir2(cwd), "token-ledger.json");
|
|
1621
2125
|
}
|
|
1622
2126
|
function tokenLedgerArchivePath2(cwd) {
|
|
1623
|
-
return
|
|
2127
|
+
return join7(projectDir2(cwd), "token-ledger-archive.json");
|
|
1624
2128
|
}
|
|
1625
2129
|
function bugMemoryPath2(cwd) {
|
|
1626
|
-
return
|
|
2130
|
+
return join7(projectDir2(cwd), "bug-memory.json");
|
|
1627
2131
|
}
|
|
1628
2132
|
function actionLogPath2(cwd) {
|
|
1629
|
-
return
|
|
2133
|
+
return join7(projectDir2(cwd), "action-log.md");
|
|
1630
2134
|
}
|
|
1631
2135
|
function schedulerPidPath2() {
|
|
1632
|
-
return
|
|
2136
|
+
return join7(MINK_ROOT2, "scheduler.pid");
|
|
1633
2137
|
}
|
|
1634
2138
|
function schedulerLogPath2() {
|
|
1635
|
-
return
|
|
2139
|
+
return join7(MINK_ROOT2, "scheduler.log");
|
|
1636
2140
|
}
|
|
1637
2141
|
function schedulerManifestPath2(cwd) {
|
|
1638
|
-
return
|
|
2142
|
+
return join7(projectDir2(cwd), "scheduler-manifest.json");
|
|
1639
2143
|
}
|
|
1640
2144
|
function globalConfigPath2() {
|
|
1641
|
-
return
|
|
2145
|
+
return join7(MINK_ROOT2, "config");
|
|
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");
|
|
1642
2155
|
}
|
|
1643
2156
|
function projectMetaPath2(cwd) {
|
|
1644
|
-
return
|
|
2157
|
+
return join7(projectDir2(cwd), "project-meta.json");
|
|
1645
2158
|
}
|
|
1646
2159
|
function backupDirPath2(cwd) {
|
|
1647
|
-
return
|
|
2160
|
+
return join7(projectDir2(cwd), "backups");
|
|
1648
2161
|
}
|
|
1649
2162
|
function designCapturesDir2(cwd) {
|
|
1650
|
-
return
|
|
2163
|
+
return join7(projectDir2(cwd), "design-captures");
|
|
1651
2164
|
}
|
|
1652
2165
|
function designReportPath2(cwd) {
|
|
1653
|
-
return
|
|
2166
|
+
return join7(projectDir2(cwd), "design-report.json");
|
|
1654
2167
|
}
|
|
1655
2168
|
function frameworkAdvisorPath2(cwd) {
|
|
1656
|
-
return
|
|
2169
|
+
return join7(projectDir2(cwd), "framework-advisor.md");
|
|
1657
2170
|
}
|
|
1658
2171
|
function frameworkAdvisorJsonPath2(cwd) {
|
|
1659
|
-
return
|
|
2172
|
+
return join7(projectDir2(cwd), "framework-advisor.json");
|
|
1660
2173
|
}
|
|
1661
2174
|
var MINK_ROOT2;
|
|
1662
2175
|
var init_paths2 = __esm(() => {
|
|
1663
2176
|
init_project_id();
|
|
1664
|
-
MINK_ROOT2 =
|
|
2177
|
+
MINK_ROOT2 = join7(homedir3(), ".mink");
|
|
1665
2178
|
});
|
|
1666
2179
|
|
|
1667
2180
|
// src/core/backup.ts
|
|
@@ -1672,14 +2185,14 @@ __export(exports_backup, {
|
|
|
1672
2185
|
createBackup: () => createBackup
|
|
1673
2186
|
});
|
|
1674
2187
|
import {
|
|
1675
|
-
mkdirSync as
|
|
2188
|
+
mkdirSync as mkdirSync5,
|
|
1676
2189
|
readdirSync as readdirSync2,
|
|
1677
|
-
readFileSync as
|
|
1678
|
-
writeFileSync as
|
|
1679
|
-
existsSync as
|
|
2190
|
+
readFileSync as readFileSync8,
|
|
2191
|
+
writeFileSync as writeFileSync4,
|
|
2192
|
+
existsSync as existsSync7,
|
|
1680
2193
|
statSync as statSync3
|
|
1681
2194
|
} from "fs";
|
|
1682
|
-
import { join as
|
|
2195
|
+
import { join as join8 } from "path";
|
|
1683
2196
|
function formatTimestamp(date) {
|
|
1684
2197
|
const y = date.getFullYear();
|
|
1685
2198
|
const mo = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -1691,15 +2204,15 @@ function formatTimestamp(date) {
|
|
|
1691
2204
|
return `${y}${mo}${d}-${h}${mi}${s}${ms}`;
|
|
1692
2205
|
}
|
|
1693
2206
|
function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
|
|
1694
|
-
|
|
2207
|
+
mkdirSync5(destDir, { recursive: true });
|
|
1695
2208
|
const entries = readdirSync2(srcDir, { withFileTypes: true });
|
|
1696
2209
|
for (const entry of entries) {
|
|
1697
2210
|
if (entry.isDirectory()) {
|
|
1698
2211
|
if (excludeDirs.includes(entry.name))
|
|
1699
2212
|
continue;
|
|
1700
|
-
copyDirectoryFiles(
|
|
2213
|
+
copyDirectoryFiles(join8(srcDir, entry.name), join8(destDir, entry.name), excludeDirs);
|
|
1701
2214
|
} else if (entry.isFile()) {
|
|
1702
|
-
|
|
2215
|
+
writeFileSync4(join8(destDir, entry.name), readFileSync8(join8(srcDir, entry.name)));
|
|
1703
2216
|
}
|
|
1704
2217
|
}
|
|
1705
2218
|
}
|
|
@@ -1708,25 +2221,25 @@ function createBackup(cwd) {
|
|
|
1708
2221
|
const dir = backupDirPath(cwd);
|
|
1709
2222
|
let name = base;
|
|
1710
2223
|
let suffix = 1;
|
|
1711
|
-
while (
|
|
2224
|
+
while (existsSync7(join8(dir, name))) {
|
|
1712
2225
|
name = `${base}-${suffix}`;
|
|
1713
2226
|
suffix++;
|
|
1714
2227
|
}
|
|
1715
2228
|
const src = projectDir(cwd);
|
|
1716
|
-
const dest =
|
|
2229
|
+
const dest = join8(dir, name);
|
|
1717
2230
|
copyDirectoryFiles(src, dest, ["backups"]);
|
|
1718
2231
|
return name;
|
|
1719
2232
|
}
|
|
1720
2233
|
function listBackups(cwd) {
|
|
1721
2234
|
const dir = backupDirPath(cwd);
|
|
1722
|
-
if (!
|
|
2235
|
+
if (!existsSync7(dir))
|
|
1723
2236
|
return [];
|
|
1724
2237
|
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
1725
2238
|
const backups = [];
|
|
1726
2239
|
for (const entry of entries) {
|
|
1727
2240
|
if (!entry.isDirectory() || !entry.name.startsWith("backup-"))
|
|
1728
2241
|
continue;
|
|
1729
|
-
const backupPath =
|
|
2242
|
+
const backupPath = join8(dir, entry.name);
|
|
1730
2243
|
const match = entry.name.match(/^backup-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})(\d{3})?(?:-\d+)?$/);
|
|
1731
2244
|
let timestamp;
|
|
1732
2245
|
if (match) {
|
|
@@ -1749,8 +2262,8 @@ function listBackups(cwd) {
|
|
|
1749
2262
|
return backups;
|
|
1750
2263
|
}
|
|
1751
2264
|
function restoreBackup(cwd, backupName) {
|
|
1752
|
-
const backupPath =
|
|
1753
|
-
if (!
|
|
2265
|
+
const backupPath = join8(backupDirPath(cwd), backupName);
|
|
2266
|
+
if (!existsSync7(backupPath)) {
|
|
1754
2267
|
throw new Error(`backup not found: ${backupName}`);
|
|
1755
2268
|
}
|
|
1756
2269
|
createBackup(cwd);
|
|
@@ -1762,7 +2275,7 @@ var init_backup = __esm(() => {
|
|
|
1762
2275
|
|
|
1763
2276
|
// src/core/scanner.ts
|
|
1764
2277
|
import { readdirSync as readdirSync3, statSync as statSync4 } from "fs";
|
|
1765
|
-
import { join as
|
|
2278
|
+
import { join as join9, relative } from "path";
|
|
1766
2279
|
function matchesPattern(name, pattern) {
|
|
1767
2280
|
if (pattern.includes("*")) {
|
|
1768
2281
|
const regex = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
|
|
@@ -1786,14 +2299,14 @@ function walkDirectory(dir, projectRoot, excludes, results) {
|
|
|
1786
2299
|
if (entry.isDirectory()) {
|
|
1787
2300
|
if (isExcluded(entry.name, excludes))
|
|
1788
2301
|
continue;
|
|
1789
|
-
walkDirectory(
|
|
2302
|
+
walkDirectory(join9(dir, entry.name), projectRoot, excludes, results);
|
|
1790
2303
|
continue;
|
|
1791
2304
|
}
|
|
1792
2305
|
if (entry.isFile()) {
|
|
1793
2306
|
if (isExcluded(entry.name, excludes))
|
|
1794
2307
|
continue;
|
|
1795
2308
|
try {
|
|
1796
|
-
const fullPath =
|
|
2309
|
+
const fullPath = join9(dir, entry.name);
|
|
1797
2310
|
const stat = statSync4(fullPath);
|
|
1798
2311
|
results.push({
|
|
1799
2312
|
relativePath: relative(projectRoot, fullPath),
|
|
@@ -1882,7 +2395,7 @@ var init_scanner = __esm(() => {
|
|
|
1882
2395
|
});
|
|
1883
2396
|
|
|
1884
2397
|
// src/core/description.ts
|
|
1885
|
-
import { basename as
|
|
2398
|
+
import { basename as basename3, extname } from "path";
|
|
1886
2399
|
function truncate(str) {
|
|
1887
2400
|
if (str.length <= MAX_DESCRIPTION_LENGTH)
|
|
1888
2401
|
return str;
|
|
@@ -1938,7 +2451,7 @@ function extractComponent(content, filePath) {
|
|
|
1938
2451
|
if (![".tsx", ".jsx", ".vue", ".svelte"].includes(ext))
|
|
1939
2452
|
return null;
|
|
1940
2453
|
const namedMatch = content.match(/(?:export\s+(?:default\s+)?function|export\s+const)\s+([A-Z]\w+)/);
|
|
1941
|
-
const componentName = namedMatch ? namedMatch[1] :
|
|
2454
|
+
const componentName = namedMatch ? namedMatch[1] : basename3(filePath, ext);
|
|
1942
2455
|
const elements = [];
|
|
1943
2456
|
if (/<form[\s>]/i.test(content))
|
|
1944
2457
|
elements.push("form");
|
|
@@ -1956,13 +2469,13 @@ function extractComponent(content, filePath) {
|
|
|
1956
2469
|
}
|
|
1957
2470
|
function extractCiWorkflow(content, filePath) {
|
|
1958
2471
|
const normalized = filePath.replace(/\\/g, "/");
|
|
1959
|
-
const isCi = normalized.includes(".github/workflows/") || normalized.includes(".gitlab-ci") ||
|
|
2472
|
+
const isCi = normalized.includes(".github/workflows/") || normalized.includes(".gitlab-ci") || basename3(filePath).toLowerCase() === "jenkinsfile";
|
|
1960
2473
|
if (!isCi)
|
|
1961
2474
|
return null;
|
|
1962
2475
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
1963
2476
|
if (nameMatch)
|
|
1964
2477
|
return `CI: ${nameMatch[1].trim()}`;
|
|
1965
|
-
return `CI: ${
|
|
2478
|
+
return `CI: ${basename3(filePath)}`;
|
|
1966
2479
|
}
|
|
1967
2480
|
function extractMigration(content, filePath) {
|
|
1968
2481
|
const normalized = filePath.toLowerCase();
|
|
@@ -1972,7 +2485,7 @@ function extractMigration(content, filePath) {
|
|
|
1972
2485
|
const tableMatch = content.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["`]?(\w+)/i);
|
|
1973
2486
|
if (tableMatch)
|
|
1974
2487
|
return `migration: create ${tableMatch[1]}`;
|
|
1975
|
-
return `migration: ${
|
|
2488
|
+
return `migration: ${basename3(filePath)}`;
|
|
1976
2489
|
}
|
|
1977
2490
|
function extractFallback(content) {
|
|
1978
2491
|
const lines = content.split(`
|
|
@@ -1986,7 +2499,7 @@ function extractFallback(content) {
|
|
|
1986
2499
|
return null;
|
|
1987
2500
|
}
|
|
1988
2501
|
function extractDescription(filePath, content) {
|
|
1989
|
-
const name =
|
|
2502
|
+
const name = basename3(filePath);
|
|
1990
2503
|
const ext = extname(filePath).toLowerCase();
|
|
1991
2504
|
if (content.length === 0)
|
|
1992
2505
|
return `${name} — empty file`;
|
|
@@ -2120,8 +2633,8 @@ var exports_scan = {};
|
|
|
2120
2633
|
__export(exports_scan, {
|
|
2121
2634
|
scan: () => scan
|
|
2122
2635
|
});
|
|
2123
|
-
import { readFileSync as
|
|
2124
|
-
import { join as
|
|
2636
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
2637
|
+
import { join as join10 } from "path";
|
|
2125
2638
|
function loadExistingIndex(indexPath) {
|
|
2126
2639
|
const raw = safeReadJson(indexPath);
|
|
2127
2640
|
if (isFileIndex(raw))
|
|
@@ -2171,10 +2684,10 @@ function scan(cwd, options) {
|
|
|
2171
2684
|
newIndex.header.lifetimeHits = index.header.lifetimeHits;
|
|
2172
2685
|
newIndex.header.lifetimeMisses = index.header.lifetimeMisses;
|
|
2173
2686
|
for (const file of scanned) {
|
|
2174
|
-
const fullPath =
|
|
2687
|
+
const fullPath = join10(cwd, file.relativePath);
|
|
2175
2688
|
let content;
|
|
2176
2689
|
try {
|
|
2177
|
-
content =
|
|
2690
|
+
content = readFileSync9(fullPath, "utf-8");
|
|
2178
2691
|
} catch {
|
|
2179
2692
|
continue;
|
|
2180
2693
|
}
|
|
@@ -2209,13 +2722,13 @@ __export(exports_seed, {
|
|
|
2209
2722
|
parseGoMod: () => parseGoMod,
|
|
2210
2723
|
parseCargoToml: () => parseCargoToml
|
|
2211
2724
|
});
|
|
2212
|
-
import { basename as
|
|
2213
|
-
import { readFileSync as
|
|
2725
|
+
import { basename as basename4, join as join11 } from "path";
|
|
2726
|
+
import { readFileSync as readFileSync10, existsSync as existsSync8 } from "fs";
|
|
2214
2727
|
function readFile(filePath) {
|
|
2215
|
-
if (!
|
|
2728
|
+
if (!existsSync8(filePath))
|
|
2216
2729
|
return null;
|
|
2217
2730
|
try {
|
|
2218
|
-
return
|
|
2731
|
+
return readFileSync10(filePath, "utf-8");
|
|
2219
2732
|
} catch {
|
|
2220
2733
|
return null;
|
|
2221
2734
|
}
|
|
@@ -2290,7 +2803,7 @@ function parseGoMod(filePath) {
|
|
|
2290
2803
|
return null;
|
|
2291
2804
|
const moduleMatch = raw.match(/^module\s+(\S+)/m);
|
|
2292
2805
|
const modulePath = moduleMatch ? moduleMatch[1] : "";
|
|
2293
|
-
const projectName = modulePath ?
|
|
2806
|
+
const projectName = modulePath ? basename4(modulePath) : "";
|
|
2294
2807
|
const frameworks = [];
|
|
2295
2808
|
for (const [key, label] of Object.entries(GO_FRAMEWORKS)) {
|
|
2296
2809
|
if (raw.includes(key)) {
|
|
@@ -2305,13 +2818,13 @@ function parseGoMod(filePath) {
|
|
|
2305
2818
|
}
|
|
2306
2819
|
function seedLearningMemory(projectRoot) {
|
|
2307
2820
|
const parsers = [
|
|
2308
|
-
() => parsePackageJson(
|
|
2309
|
-
() => parsePyprojectToml(
|
|
2310
|
-
() => parseCargoToml(
|
|
2311
|
-
() => parseGoMod(
|
|
2821
|
+
() => parsePackageJson(join11(projectRoot, "package.json")),
|
|
2822
|
+
() => parsePyprojectToml(join11(projectRoot, "pyproject.toml")),
|
|
2823
|
+
() => parseCargoToml(join11(projectRoot, "Cargo.toml")),
|
|
2824
|
+
() => parseGoMod(join11(projectRoot, "go.mod"))
|
|
2312
2825
|
];
|
|
2313
2826
|
const infos = parsers.map((fn) => fn()).filter((info) => info !== null);
|
|
2314
|
-
const projectName = infos.find((i) => i.projectName)?.projectName ??
|
|
2827
|
+
const projectName = infos.find((i) => i.projectName)?.projectName ?? basename4(projectRoot);
|
|
2315
2828
|
const mem = createEmptyLearningMemory(projectName);
|
|
2316
2829
|
const infoWithDesc = infos.find((i) => i.description);
|
|
2317
2830
|
if (infoWithDesc?.description) {
|
|
@@ -2392,8 +2905,8 @@ __export(exports_init, {
|
|
|
2392
2905
|
buildHooksConfig: () => buildHooksConfig
|
|
2393
2906
|
});
|
|
2394
2907
|
import { execSync as execSync2 } from "child_process";
|
|
2395
|
-
import { mkdirSync as
|
|
2396
|
-
import { resolve, dirname as
|
|
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";
|
|
2397
2910
|
function detectRuntime() {
|
|
2398
2911
|
try {
|
|
2399
2912
|
execSync2("bun --version", { stdio: "ignore" });
|
|
@@ -2404,15 +2917,15 @@ function detectRuntime() {
|
|
|
2404
2917
|
}
|
|
2405
2918
|
function resolveCliPath() {
|
|
2406
2919
|
const selfPath = new URL(import.meta.url).pathname;
|
|
2407
|
-
const selfDir =
|
|
2920
|
+
const selfDir = dirname4(selfPath);
|
|
2408
2921
|
if (selfPath.endsWith("dist/cli.js")) {
|
|
2409
2922
|
return selfPath;
|
|
2410
2923
|
}
|
|
2411
|
-
const projectRoot =
|
|
2412
|
-
const distPath =
|
|
2413
|
-
if (
|
|
2924
|
+
const projectRoot = resolve2(selfDir, "../..");
|
|
2925
|
+
const distPath = join12(projectRoot, "dist", "cli.js");
|
|
2926
|
+
if (existsSync9(distPath))
|
|
2414
2927
|
return distPath;
|
|
2415
|
-
return
|
|
2928
|
+
return resolve2(selfDir, "../cli.ts");
|
|
2416
2929
|
}
|
|
2417
2930
|
function buildHooksConfig(runtime, cliPath) {
|
|
2418
2931
|
const isTsSource = cliPath.endsWith(".ts");
|
|
@@ -2446,7 +2959,7 @@ function isMinkHook(entry) {
|
|
|
2446
2959
|
return false;
|
|
2447
2960
|
}
|
|
2448
2961
|
function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
2449
|
-
|
|
2962
|
+
mkdirSync6(dirname4(settingsPath), { recursive: true });
|
|
2450
2963
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
2451
2964
|
const existingHooks = existing.hooks ?? {};
|
|
2452
2965
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -2459,15 +2972,15 @@ function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
|
2459
2972
|
}
|
|
2460
2973
|
function isExistingInstallation(cwd) {
|
|
2461
2974
|
const dir = projectDir(cwd);
|
|
2462
|
-
if (!
|
|
2975
|
+
if (!existsSync9(dir))
|
|
2463
2976
|
return false;
|
|
2464
|
-
return
|
|
2977
|
+
return existsSync9(join12(dir, "file-index.json"));
|
|
2465
2978
|
}
|
|
2466
2979
|
async function init(cwd) {
|
|
2467
2980
|
const runtime = detectRuntime();
|
|
2468
2981
|
const cliPath = resolveCliPath();
|
|
2469
2982
|
const hooks = buildHooksConfig(runtime, cliPath);
|
|
2470
|
-
const settingsPath =
|
|
2983
|
+
const settingsPath = resolve2(cwd, ".claude", "settings.json");
|
|
2471
2984
|
const dir = projectDir(cwd);
|
|
2472
2985
|
const upgrading = isExistingInstallation(cwd);
|
|
2473
2986
|
if (upgrading) {
|
|
@@ -2477,7 +2990,7 @@ async function init(cwd) {
|
|
|
2477
2990
|
console.log(` backup: ${backupName}`);
|
|
2478
2991
|
}
|
|
2479
2992
|
mergeHooksIntoSettings(settingsPath, hooks);
|
|
2480
|
-
|
|
2993
|
+
mkdirSync6(dir, { recursive: true });
|
|
2481
2994
|
const projectId = generateProjectId(cwd);
|
|
2482
2995
|
const isNotesProject = isWikiEnabled() && isVaultInitialized() && isInsideVault(cwd);
|
|
2483
2996
|
const metaPath = projectMetaPath(cwd);
|
|
@@ -2485,7 +2998,7 @@ async function init(cwd) {
|
|
|
2485
2998
|
atomicWriteJson(metaPath, {
|
|
2486
2999
|
...existingMeta ?? {},
|
|
2487
3000
|
cwd,
|
|
2488
|
-
name:
|
|
3001
|
+
name: basename5(cwd),
|
|
2489
3002
|
initTimestamp: existingMeta?.initTimestamp ?? new Date().toISOString(),
|
|
2490
3003
|
version: "0.1.0",
|
|
2491
3004
|
...isNotesProject ? { projectType: "notes" } : {}
|
|
@@ -2505,7 +3018,7 @@ async function init(cwd) {
|
|
|
2505
3018
|
scan2(cwd, { check: false });
|
|
2506
3019
|
const { learningMemoryPath: learningMemoryPath3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
2507
3020
|
const memPath = learningMemoryPath3(cwd);
|
|
2508
|
-
if (!
|
|
3021
|
+
if (!existsSync9(memPath)) {
|
|
2509
3022
|
const { seedLearningMemory: seedLearningMemory2 } = await Promise.resolve().then(() => (init_seed(), exports_seed));
|
|
2510
3023
|
const { serializeLearningMemory: serializeLearningMemory2 } = await Promise.resolve().then(() => (init_learning_memory(), exports_learning_memory));
|
|
2511
3024
|
const mem = seedLearningMemory2(cwd);
|
|
@@ -2513,9 +3026,9 @@ async function init(cwd) {
|
|
|
2513
3026
|
}
|
|
2514
3027
|
if (isWikiEnabled() && isVaultInitialized() && !isNotesProject) {
|
|
2515
3028
|
try {
|
|
2516
|
-
const projectSlug =
|
|
2517
|
-
const overviewPath =
|
|
2518
|
-
if (!
|
|
3029
|
+
const projectSlug = basename5(cwd);
|
|
3030
|
+
const overviewPath = join12(vaultProjects(projectSlug), "overview.md");
|
|
3031
|
+
if (!existsSync9(overviewPath)) {
|
|
2519
3032
|
const now = new Date().toISOString();
|
|
2520
3033
|
const overview = [
|
|
2521
3034
|
`---`,
|
|
@@ -2552,12 +3065,12 @@ var init_init = __esm(() => {
|
|
|
2552
3065
|
});
|
|
2553
3066
|
|
|
2554
3067
|
// src/core/daemon.ts
|
|
2555
|
-
import { readFileSync as
|
|
2556
|
-
import { mkdirSync as
|
|
2557
|
-
import { dirname as
|
|
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";
|
|
2558
3071
|
function readPidFile() {
|
|
2559
3072
|
try {
|
|
2560
|
-
const raw =
|
|
3073
|
+
const raw = readFileSync11(schedulerPidPath(), "utf-8");
|
|
2561
3074
|
const data = JSON.parse(raw);
|
|
2562
3075
|
if (data && typeof data.pid === "number" && typeof data.startedAt === "string" && typeof data.projectCwd === "string") {
|
|
2563
3076
|
return data;
|
|
@@ -2569,12 +3082,12 @@ function readPidFile() {
|
|
|
2569
3082
|
}
|
|
2570
3083
|
function writePidFile(data) {
|
|
2571
3084
|
const pidPath = schedulerPidPath();
|
|
2572
|
-
|
|
2573
|
-
|
|
3085
|
+
mkdirSync7(dirname5(pidPath), { recursive: true });
|
|
3086
|
+
writeFileSync5(pidPath, JSON.stringify(data, null, 2));
|
|
2574
3087
|
}
|
|
2575
3088
|
function removePidFile() {
|
|
2576
3089
|
try {
|
|
2577
|
-
|
|
3090
|
+
unlinkSync2(schedulerPidPath());
|
|
2578
3091
|
} catch {}
|
|
2579
3092
|
}
|
|
2580
3093
|
function isProcessAlive(pid) {
|
|
@@ -2594,10 +3107,10 @@ function startDaemon(cwd) {
|
|
|
2594
3107
|
if (existing) {
|
|
2595
3108
|
removePidFile();
|
|
2596
3109
|
}
|
|
2597
|
-
const __dir =
|
|
2598
|
-
const cliPath =
|
|
3110
|
+
const __dir = dirname5(new URL(import.meta.url).pathname);
|
|
3111
|
+
const cliPath = resolve3(__dir, "../cli.ts");
|
|
2599
3112
|
const logPath = schedulerLogPath();
|
|
2600
|
-
|
|
3113
|
+
mkdirSync7(dirname5(logPath), { recursive: true });
|
|
2601
3114
|
const logFd = openSync(logPath, "a");
|
|
2602
3115
|
const proc = Bun.spawn(["bun", "run", cliPath, "cron", "__daemon"], {
|
|
2603
3116
|
cwd,
|
|
@@ -2667,9 +3180,9 @@ var exports_status = {};
|
|
|
2667
3180
|
__export(exports_status, {
|
|
2668
3181
|
status: () => status
|
|
2669
3182
|
});
|
|
2670
|
-
import { existsSync as
|
|
3183
|
+
import { existsSync as existsSync11, readFileSync as readFileSync12, statSync as statSync5 } from "fs";
|
|
2671
3184
|
function checkJsonFile(name, filePath, validator) {
|
|
2672
|
-
if (!
|
|
3185
|
+
if (!existsSync11(filePath))
|
|
2673
3186
|
return { name, path: filePath, status: "missing" };
|
|
2674
3187
|
const data = safeReadJson(filePath);
|
|
2675
3188
|
if (data === null)
|
|
@@ -2679,10 +3192,10 @@ function checkJsonFile(name, filePath, validator) {
|
|
|
2679
3192
|
return { name, path: filePath, status: "ok" };
|
|
2680
3193
|
}
|
|
2681
3194
|
function checkTextFile(name, filePath) {
|
|
2682
|
-
if (!
|
|
3195
|
+
if (!existsSync11(filePath))
|
|
2683
3196
|
return { name, path: filePath, status: "missing" };
|
|
2684
3197
|
try {
|
|
2685
|
-
|
|
3198
|
+
readFileSync12(filePath, "utf-8");
|
|
2686
3199
|
return { name, path: filePath, status: "ok" };
|
|
2687
3200
|
} catch {
|
|
2688
3201
|
return { name, path: filePath, status: "corrupt" };
|
|
@@ -2742,8 +3255,8 @@ function status(cwd) {
|
|
|
2742
3255
|
console.log();
|
|
2743
3256
|
try {
|
|
2744
3257
|
const memPath = learningMemoryPath(cwd);
|
|
2745
|
-
if (
|
|
2746
|
-
const content =
|
|
3258
|
+
if (existsSync11(memPath)) {
|
|
3259
|
+
const content = readFileSync12(memPath, "utf-8");
|
|
2747
3260
|
const mem = parseLearningMemory(content);
|
|
2748
3261
|
const total = totalEntryCount(mem);
|
|
2749
3262
|
const mtime = statSync5(memPath).mtime;
|
|
@@ -2797,8 +3310,8 @@ var exports_scan2 = {};
|
|
|
2797
3310
|
__export(exports_scan2, {
|
|
2798
3311
|
scan: () => scan2
|
|
2799
3312
|
});
|
|
2800
|
-
import { readFileSync as
|
|
2801
|
-
import { join as
|
|
3313
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
3314
|
+
import { join as join13 } from "path";
|
|
2802
3315
|
function loadExistingIndex2(indexPath) {
|
|
2803
3316
|
const raw = safeReadJson(indexPath);
|
|
2804
3317
|
if (isFileIndex(raw))
|
|
@@ -2848,10 +3361,10 @@ function scan2(cwd, options) {
|
|
|
2848
3361
|
newIndex.header.lifetimeHits = index.header.lifetimeHits;
|
|
2849
3362
|
newIndex.header.lifetimeMisses = index.header.lifetimeMisses;
|
|
2850
3363
|
for (const file of scanned) {
|
|
2851
|
-
const fullPath =
|
|
3364
|
+
const fullPath = join13(cwd, file.relativePath);
|
|
2852
3365
|
let content;
|
|
2853
3366
|
try {
|
|
2854
|
-
content =
|
|
3367
|
+
content = readFileSync13(fullPath, "utf-8");
|
|
2855
3368
|
} catch {
|
|
2856
3369
|
continue;
|
|
2857
3370
|
}
|
|
@@ -2882,13 +3395,13 @@ var exports_reflect2 = {};
|
|
|
2882
3395
|
__export(exports_reflect2, {
|
|
2883
3396
|
reflect: () => reflect2
|
|
2884
3397
|
});
|
|
2885
|
-
import { existsSync as
|
|
3398
|
+
import { existsSync as existsSync12, readFileSync as readFileSync14 } from "fs";
|
|
2886
3399
|
function reflect2(projectDir3, memoryPath, configPath3) {
|
|
2887
|
-
if (!
|
|
3400
|
+
if (!existsSync12(memoryPath)) {
|
|
2888
3401
|
console.log("[mink] no learning memory found");
|
|
2889
3402
|
return null;
|
|
2890
3403
|
}
|
|
2891
|
-
const markdown =
|
|
3404
|
+
const markdown = readFileSync14(memoryPath, "utf-8");
|
|
2892
3405
|
const mem = parseLearningMemory(markdown);
|
|
2893
3406
|
const config = safeReadJson(configPath3);
|
|
2894
3407
|
const tokenBudget = config?.learningMemoryTokenBudget ?? DEFAULT_TOKEN_BUDGET2;
|
|
@@ -3169,7 +3682,7 @@ __export(exports_pre_write, {
|
|
|
3169
3682
|
analyzePreWrite: () => analyzePreWrite
|
|
3170
3683
|
});
|
|
3171
3684
|
import { relative as relative4 } from "path";
|
|
3172
|
-
import { readFileSync as
|
|
3685
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
3173
3686
|
function analyzePreWrite(filePath, writeContent, doNotRepeatEntries, bugMemory) {
|
|
3174
3687
|
const warnings = [];
|
|
3175
3688
|
const allMatches = [];
|
|
@@ -3223,7 +3736,7 @@ async function preWrite(cwd) {
|
|
|
3223
3736
|
const writeContent = extractWriteContent(input);
|
|
3224
3737
|
let doNotRepeatEntries = [];
|
|
3225
3738
|
try {
|
|
3226
|
-
const markdown =
|
|
3739
|
+
const markdown = readFileSync15(learningMemoryPath(cwd), "utf-8");
|
|
3227
3740
|
const mem = parseLearningMemory(markdown);
|
|
3228
3741
|
doNotRepeatEntries = getEntries(mem, "Do-Not-Repeat");
|
|
3229
3742
|
} catch {}
|
|
@@ -3260,12 +3773,12 @@ var init_pre_write = __esm(() => {
|
|
|
3260
3773
|
});
|
|
3261
3774
|
|
|
3262
3775
|
// src/core/write-exclusions.ts
|
|
3263
|
-
import { basename as
|
|
3776
|
+
import { basename as basename6 } from "path";
|
|
3264
3777
|
function isWriteExcluded(relativePath) {
|
|
3265
3778
|
if (relativePath === ".mink" || relativePath.startsWith(".mink/") || relativePath.startsWith(".mink\\")) {
|
|
3266
3779
|
return true;
|
|
3267
3780
|
}
|
|
3268
|
-
const name =
|
|
3781
|
+
const name = basename6(relativePath);
|
|
3269
3782
|
if (name === ".env" || name.startsWith(".env.")) {
|
|
3270
3783
|
return true;
|
|
3271
3784
|
}
|
|
@@ -3280,7 +3793,7 @@ __export(exports_post_write, {
|
|
|
3280
3793
|
analyzePostWrite: () => analyzePostWrite
|
|
3281
3794
|
});
|
|
3282
3795
|
import { relative as relative5 } from "path";
|
|
3283
|
-
import { readFileSync as
|
|
3796
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
3284
3797
|
function analyzePostWrite(filePath, fileContent, index) {
|
|
3285
3798
|
if (isWriteExcluded(filePath)) {
|
|
3286
3799
|
return {
|
|
@@ -3344,7 +3857,7 @@ async function postWrite(cwd) {
|
|
|
3344
3857
|
const filePath = relative5(cwd, absolutePath);
|
|
3345
3858
|
let fileContent = null;
|
|
3346
3859
|
try {
|
|
3347
|
-
fileContent =
|
|
3860
|
+
fileContent = readFileSync16(absolutePath, "utf-8");
|
|
3348
3861
|
} catch {}
|
|
3349
3862
|
const rawState = safeReadJson(sessionPath(cwd));
|
|
3350
3863
|
const state = isSessionState(rawState) ? rawState : createSessionState();
|
|
@@ -3764,10 +4277,10 @@ async function executeTask(taskId, projectCwd) {
|
|
|
3764
4277
|
if (task.actionType === "ai-cli") {
|
|
3765
4278
|
try {
|
|
3766
4279
|
const { learningMemoryPath: learningMemoryPath4 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
3767
|
-
const { readFileSync:
|
|
4280
|
+
const { readFileSync: readFileSync17 } = await import("fs");
|
|
3768
4281
|
let memoryContent;
|
|
3769
4282
|
try {
|
|
3770
|
-
memoryContent =
|
|
4283
|
+
memoryContent = readFileSync17(learningMemoryPath4(projectCwd), "utf-8");
|
|
3771
4284
|
} catch {
|
|
3772
4285
|
console.log("[mink] no learning memory found, skipping reflection");
|
|
3773
4286
|
return;
|
|
@@ -3897,7 +4410,7 @@ function loadManifest(cwd) {
|
|
|
3897
4410
|
}
|
|
3898
4411
|
return null;
|
|
3899
4412
|
}
|
|
3900
|
-
function
|
|
4413
|
+
function saveManifest2(cwd, manifest) {
|
|
3901
4414
|
atomicWriteJson(schedulerManifestPath(cwd), manifest);
|
|
3902
4415
|
}
|
|
3903
4416
|
function getOrCreateManifest(cwd, now) {
|
|
@@ -3905,7 +4418,7 @@ function getOrCreateManifest(cwd, now) {
|
|
|
3905
4418
|
if (existing)
|
|
3906
4419
|
return existing;
|
|
3907
4420
|
const fresh = createInitialManifest(now);
|
|
3908
|
-
|
|
4421
|
+
saveManifest2(cwd, fresh);
|
|
3909
4422
|
return fresh;
|
|
3910
4423
|
}
|
|
3911
4424
|
function recoverManifest(manifest, now) {
|
|
@@ -3954,7 +4467,7 @@ function createScheduler(projectCwd, options = {}) {
|
|
|
3954
4467
|
let ticking = false;
|
|
3955
4468
|
manifest = getOrCreateManifest(projectCwd, startedAt);
|
|
3956
4469
|
recoverManifest(manifest, startedAt);
|
|
3957
|
-
|
|
4470
|
+
saveManifest2(projectCwd, manifest);
|
|
3958
4471
|
async function tick() {
|
|
3959
4472
|
if (ticking)
|
|
3960
4473
|
return;
|
|
@@ -3995,7 +4508,7 @@ function createScheduler(projectCwd, options = {}) {
|
|
|
3995
4508
|
record.status = "running";
|
|
3996
4509
|
record.lastRunAt = now.toISOString();
|
|
3997
4510
|
activeTasks.push(taskId);
|
|
3998
|
-
|
|
4511
|
+
saveManifest2(projectCwd, manifest);
|
|
3999
4512
|
try {
|
|
4000
4513
|
await executeTask(taskId, projectCwd);
|
|
4001
4514
|
record.status = "idle";
|
|
@@ -4028,12 +4541,12 @@ function createScheduler(projectCwd, options = {}) {
|
|
|
4028
4541
|
}
|
|
4029
4542
|
} finally {
|
|
4030
4543
|
activeTasks = activeTasks.filter((id) => id !== taskId);
|
|
4031
|
-
|
|
4544
|
+
saveManifest2(projectCwd, manifest);
|
|
4032
4545
|
}
|
|
4033
4546
|
}
|
|
4034
4547
|
function emitHeartbeat() {
|
|
4035
4548
|
manifest.lastHeartbeat = new Date().toISOString();
|
|
4036
|
-
|
|
4549
|
+
saveManifest2(projectCwd, manifest);
|
|
4037
4550
|
console.log(`[mink] heartbeat at ${manifest.lastHeartbeat}`);
|
|
4038
4551
|
}
|
|
4039
4552
|
return {
|
|
@@ -4182,7 +4695,7 @@ async function cronRun(cwd, taskId) {
|
|
|
4182
4695
|
errorMessages: [lastError?.message ?? "Unknown error"],
|
|
4183
4696
|
attemptCount: task.retryPolicy.maxAttempts
|
|
4184
4697
|
});
|
|
4185
|
-
|
|
4698
|
+
saveManifest2(cwd, manifest);
|
|
4186
4699
|
}
|
|
4187
4700
|
process.exit(1);
|
|
4188
4701
|
}
|
|
@@ -4224,7 +4737,7 @@ async function cronDeadLetter(cwd, args) {
|
|
|
4224
4737
|
record.status = "idle";
|
|
4225
4738
|
record.currentAttempt = 0;
|
|
4226
4739
|
}
|
|
4227
|
-
|
|
4740
|
+
saveManifest2(cwd, manifest);
|
|
4228
4741
|
console.log(`[mink] retrying dead-lettered task: ${taskId}`);
|
|
4229
4742
|
try {
|
|
4230
4743
|
await executeTask(taskId, cwd);
|
|
@@ -4234,7 +4747,7 @@ async function cronDeadLetter(cwd, args) {
|
|
|
4234
4747
|
record.lastRunAt = new Date().toISOString();
|
|
4235
4748
|
record.consecutiveFailures = 0;
|
|
4236
4749
|
}
|
|
4237
|
-
|
|
4750
|
+
saveManifest2(cwd, manifest);
|
|
4238
4751
|
} catch (err) {
|
|
4239
4752
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
4240
4753
|
console.error(`[mink] task ${taskId} failed again: ${errorMsg}`);
|
|
@@ -4248,7 +4761,7 @@ async function cronDeadLetter(cwd, args) {
|
|
|
4248
4761
|
if (record) {
|
|
4249
4762
|
record.status = "dead-lettered";
|
|
4250
4763
|
}
|
|
4251
|
-
|
|
4764
|
+
saveManifest2(cwd, manifest);
|
|
4252
4765
|
process.exit(1);
|
|
4253
4766
|
}
|
|
4254
4767
|
return;
|
|
@@ -4325,9 +4838,9 @@ var init_design_eval = __esm(() => {
|
|
|
4325
4838
|
});
|
|
4326
4839
|
|
|
4327
4840
|
// src/core/dashboard-api.ts
|
|
4328
|
-
import { existsSync as
|
|
4841
|
+
import { existsSync as existsSync13, readFileSync as readFileSync17 } from "fs";
|
|
4329
4842
|
function checkJsonFile2(name, filePath, validator) {
|
|
4330
|
-
if (!
|
|
4843
|
+
if (!existsSync13(filePath))
|
|
4331
4844
|
return { name, status: "missing" };
|
|
4332
4845
|
const data = safeReadJson(filePath);
|
|
4333
4846
|
if (data === null)
|
|
@@ -4337,10 +4850,10 @@ function checkJsonFile2(name, filePath, validator) {
|
|
|
4337
4850
|
return { name, status: "ok" };
|
|
4338
4851
|
}
|
|
4339
4852
|
function checkTextFile2(name, filePath) {
|
|
4340
|
-
if (!
|
|
4853
|
+
if (!existsSync13(filePath))
|
|
4341
4854
|
return { name, status: "missing" };
|
|
4342
4855
|
try {
|
|
4343
|
-
|
|
4856
|
+
readFileSync17(filePath, "utf-8");
|
|
4344
4857
|
return { name, status: "ok" };
|
|
4345
4858
|
} catch {
|
|
4346
4859
|
return { name, status: "corrupt" };
|
|
@@ -4423,7 +4936,7 @@ function loadSchedulerPanel(cwd) {
|
|
|
4423
4936
|
}
|
|
4424
4937
|
function loadLearningMemoryPanel(cwd) {
|
|
4425
4938
|
const memPath = learningMemoryPath(cwd);
|
|
4426
|
-
if (!
|
|
4939
|
+
if (!existsSync13(memPath)) {
|
|
4427
4940
|
return {
|
|
4428
4941
|
projectName: "unknown",
|
|
4429
4942
|
sections: {
|
|
@@ -4435,7 +4948,7 @@ function loadLearningMemoryPanel(cwd) {
|
|
|
4435
4948
|
};
|
|
4436
4949
|
}
|
|
4437
4950
|
try {
|
|
4438
|
-
const content =
|
|
4951
|
+
const content = readFileSync17(memPath, "utf-8");
|
|
4439
4952
|
return parseLearningMemory(content);
|
|
4440
4953
|
} catch {
|
|
4441
4954
|
return {
|
|
@@ -4501,7 +5014,7 @@ async function triggerDeadLetterRetry(cwd, taskId) {
|
|
|
4501
5014
|
record.consecutiveFailures = 0;
|
|
4502
5015
|
record.currentAttempt = 0;
|
|
4503
5016
|
}
|
|
4504
|
-
|
|
5017
|
+
saveManifest2(cwd, manifest);
|
|
4505
5018
|
await executeTask(taskId, cwd);
|
|
4506
5019
|
return { success: true };
|
|
4507
5020
|
} catch (err) {
|
|
@@ -4537,10 +5050,10 @@ var init_dashboard_api = __esm(() => {
|
|
|
4537
5050
|
});
|
|
4538
5051
|
|
|
4539
5052
|
// src/core/project-registry.ts
|
|
4540
|
-
import { readdirSync as readdirSync4, existsSync as
|
|
4541
|
-
import { join as
|
|
5053
|
+
import { readdirSync as readdirSync4, existsSync as existsSync14 } from "fs";
|
|
5054
|
+
import { join as join14 } from "path";
|
|
4542
5055
|
function getProjectMeta(projDir) {
|
|
4543
|
-
const metaPath =
|
|
5056
|
+
const metaPath = join14(projDir, "project-meta.json");
|
|
4544
5057
|
const raw = safeReadJson(metaPath);
|
|
4545
5058
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
4546
5059
|
return null;
|
|
@@ -4557,15 +5070,15 @@ function getProjectMeta(projDir) {
|
|
|
4557
5070
|
};
|
|
4558
5071
|
}
|
|
4559
5072
|
function listRegisteredProjects() {
|
|
4560
|
-
const projectsDir =
|
|
4561
|
-
if (!
|
|
5073
|
+
const projectsDir = join14(minkRoot(), "projects");
|
|
5074
|
+
if (!existsSync14(projectsDir))
|
|
4562
5075
|
return [];
|
|
4563
5076
|
const entries = readdirSync4(projectsDir, { withFileTypes: true });
|
|
4564
5077
|
const projects = [];
|
|
4565
5078
|
for (const entry of entries) {
|
|
4566
5079
|
if (!entry.isDirectory())
|
|
4567
5080
|
continue;
|
|
4568
|
-
const projDir =
|
|
5081
|
+
const projDir = join14(projectsDir, entry.name);
|
|
4569
5082
|
const meta = getProjectMeta(projDir);
|
|
4570
5083
|
if (meta) {
|
|
4571
5084
|
projects.push({
|
|
@@ -4648,7 +5161,7 @@ async function runtimeServe(opts) {
|
|
|
4648
5161
|
}
|
|
4649
5162
|
const { createServer } = await import("node:http");
|
|
4650
5163
|
const { Readable } = await import("node:stream");
|
|
4651
|
-
return new Promise((
|
|
5164
|
+
return new Promise((resolve4) => {
|
|
4652
5165
|
const httpServer = createServer(async (req, res) => {
|
|
4653
5166
|
const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
|
|
4654
5167
|
const headers = new Headers;
|
|
@@ -4707,7 +5220,7 @@ async function runtimeServe(opts) {
|
|
|
4707
5220
|
httpServer.listen(opts.port, opts.hostname, () => {
|
|
4708
5221
|
const addr = httpServer.address();
|
|
4709
5222
|
const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
|
|
4710
|
-
|
|
5223
|
+
resolve4({
|
|
4711
5224
|
port: boundPort,
|
|
4712
5225
|
stop: (close) => {
|
|
4713
5226
|
if (close)
|
|
@@ -4729,8 +5242,8 @@ __export(exports_dashboard_server, {
|
|
|
4729
5242
|
startDashboardServer: () => startDashboardServer
|
|
4730
5243
|
});
|
|
4731
5244
|
import { watch } from "fs";
|
|
4732
|
-
import { existsSync as
|
|
4733
|
-
import { basename as
|
|
5245
|
+
import { existsSync as existsSync15 } from "fs";
|
|
5246
|
+
import { basename as basename7, dirname as dirname6, join as join15, extname as extname2 } from "path";
|
|
4734
5247
|
|
|
4735
5248
|
class SSEManager {
|
|
4736
5249
|
clients = new Map;
|
|
@@ -4809,7 +5322,7 @@ function getProjectsList(startupCwd, activeCwd) {
|
|
|
4809
5322
|
registered.unshift({
|
|
4810
5323
|
id: startupId,
|
|
4811
5324
|
cwd: startupCwd,
|
|
4812
|
-
name: meta?.name ??
|
|
5325
|
+
name: meta?.name ?? basename7(startupCwd),
|
|
4813
5326
|
version: meta?.version ?? "0.1.0"
|
|
4814
5327
|
});
|
|
4815
5328
|
}
|
|
@@ -4820,7 +5333,7 @@ function getProjectsList(startupCwd, activeCwd) {
|
|
|
4820
5333
|
registered.unshift({
|
|
4821
5334
|
id: activeId,
|
|
4822
5335
|
cwd: activeCwd,
|
|
4823
|
-
name: meta?.name ??
|
|
5336
|
+
name: meta?.name ?? basename7(activeCwd),
|
|
4824
5337
|
version: meta?.version ?? "0.1.0"
|
|
4825
5338
|
});
|
|
4826
5339
|
}
|
|
@@ -4835,7 +5348,7 @@ function createFileWatcher(cwd, onChange) {
|
|
|
4835
5348
|
watcher = watch(dir, (eventType, filename) => {
|
|
4836
5349
|
if (!filename)
|
|
4837
5350
|
return;
|
|
4838
|
-
const name =
|
|
5351
|
+
const name = basename7(filename);
|
|
4839
5352
|
if (name.endsWith(".tmp"))
|
|
4840
5353
|
return;
|
|
4841
5354
|
const fileId = STATE_FILE_MAP[name];
|
|
@@ -4883,7 +5396,7 @@ function extractPathParam(pathname, prefix) {
|
|
|
4883
5396
|
}
|
|
4884
5397
|
async function startDashboardServer(cwd, options = {}) {
|
|
4885
5398
|
const port = options.port ?? 4040;
|
|
4886
|
-
const
|
|
5399
|
+
const hostname2 = options.hostname ?? "127.0.0.1";
|
|
4887
5400
|
const sseManager = new SSEManager;
|
|
4888
5401
|
sseManager.start();
|
|
4889
5402
|
let activeCwd = cwd;
|
|
@@ -4903,15 +5416,15 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4903
5416
|
timestamp: new Date().toISOString()
|
|
4904
5417
|
});
|
|
4905
5418
|
});
|
|
4906
|
-
const __dir =
|
|
5419
|
+
const __dir = dirname6(new URL(import.meta.url).pathname);
|
|
4907
5420
|
let pkgRoot = __dir;
|
|
4908
|
-
while (pkgRoot !==
|
|
4909
|
-
if (
|
|
5421
|
+
while (pkgRoot !== dirname6(pkgRoot)) {
|
|
5422
|
+
if (existsSync15(join15(pkgRoot, "package.json")))
|
|
4910
5423
|
break;
|
|
4911
|
-
pkgRoot =
|
|
5424
|
+
pkgRoot = dirname6(pkgRoot);
|
|
4912
5425
|
}
|
|
4913
|
-
const dashboardOutDir =
|
|
4914
|
-
const dashboardBuilt =
|
|
5426
|
+
const dashboardOutDir = join15(pkgRoot, "dashboard", "out");
|
|
5427
|
+
const dashboardBuilt = existsSync15(join15(dashboardOutDir, "index.html"));
|
|
4915
5428
|
let clientIdCounter = 0;
|
|
4916
5429
|
if (!dashboardBuilt) {
|
|
4917
5430
|
console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
|
|
@@ -4927,7 +5440,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4927
5440
|
}
|
|
4928
5441
|
const server = await runtimeServe({
|
|
4929
5442
|
port,
|
|
4930
|
-
hostname,
|
|
5443
|
+
hostname: hostname2,
|
|
4931
5444
|
idleTimeout: 0,
|
|
4932
5445
|
async fetch(req) {
|
|
4933
5446
|
const url = new URL(req.url);
|
|
@@ -4941,9 +5454,9 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4941
5454
|
} else {
|
|
4942
5455
|
let filePath;
|
|
4943
5456
|
if (pathname === "/") {
|
|
4944
|
-
filePath =
|
|
5457
|
+
filePath = join15(dashboardOutDir, "index.html");
|
|
4945
5458
|
} else {
|
|
4946
|
-
filePath =
|
|
5459
|
+
filePath = join15(dashboardOutDir, pathname);
|
|
4947
5460
|
}
|
|
4948
5461
|
if (!filePath.startsWith(dashboardOutDir)) {
|
|
4949
5462
|
return jsonResponse({ error: "Forbidden" }, 403);
|
|
@@ -4956,7 +5469,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4956
5469
|
const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
|
|
4957
5470
|
if (htmlServed)
|
|
4958
5471
|
return htmlServed;
|
|
4959
|
-
const indexServed = await serveFile(
|
|
5472
|
+
const indexServed = await serveFile(join15(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
|
|
4960
5473
|
if (indexServed)
|
|
4961
5474
|
return indexServed;
|
|
4962
5475
|
}
|
|
@@ -5016,7 +5529,7 @@ retry: 3000
|
|
|
5016
5529
|
if (!filename || filename.includes("..") || filename.includes("/")) {
|
|
5017
5530
|
return jsonResponse({ error: "Invalid filename" }, 400);
|
|
5018
5531
|
}
|
|
5019
|
-
const imgPath =
|
|
5532
|
+
const imgPath = join15(designCapturesDir(resolvedCwd), filename);
|
|
5020
5533
|
const served = await serveFile(imgPath, "image/jpeg");
|
|
5021
5534
|
if (served) {
|
|
5022
5535
|
served.headers.set("Cache-Control", "public, max-age=60");
|
|
@@ -5090,11 +5603,11 @@ retry: 3000
|
|
|
5090
5603
|
return jsonResponse({ error: "Not found" }, 404);
|
|
5091
5604
|
}
|
|
5092
5605
|
});
|
|
5093
|
-
const serverUrl = `http://${
|
|
5606
|
+
const serverUrl = `http://${hostname2}:${server.port}`;
|
|
5094
5607
|
if (options.open !== false) {
|
|
5095
5608
|
try {
|
|
5096
|
-
const
|
|
5097
|
-
const cmd =
|
|
5609
|
+
const platform2 = process.platform;
|
|
5610
|
+
const cmd = platform2 === "darwin" ? ["open", serverUrl] : platform2 === "win32" ? ["cmd", "/c", "start", serverUrl] : ["xdg-open", serverUrl];
|
|
5098
5611
|
runtimeSpawn(cmd).unref();
|
|
5099
5612
|
} catch {}
|
|
5100
5613
|
}
|
|
@@ -5148,9 +5661,9 @@ var exports_dashboard = {};
|
|
|
5148
5661
|
__export(exports_dashboard, {
|
|
5149
5662
|
dashboard: () => dashboard
|
|
5150
5663
|
});
|
|
5151
|
-
import { existsSync as
|
|
5664
|
+
import { existsSync as existsSync16 } from "fs";
|
|
5152
5665
|
async function dashboard(cwd, args) {
|
|
5153
|
-
if (!
|
|
5666
|
+
if (!existsSync16(projectDir(cwd))) {
|
|
5154
5667
|
console.error("[mink] project not initialized. Run: mink init");
|
|
5155
5668
|
process.exit(1);
|
|
5156
5669
|
}
|
|
@@ -5172,7 +5685,7 @@ var exports_daemon = {};
|
|
|
5172
5685
|
__export(exports_daemon, {
|
|
5173
5686
|
daemon: () => daemon
|
|
5174
5687
|
});
|
|
5175
|
-
import { readFileSync as
|
|
5688
|
+
import { readFileSync as readFileSync18, existsSync as existsSync17 } from "fs";
|
|
5176
5689
|
async function daemon(cwd, args) {
|
|
5177
5690
|
const subcommand = args[0];
|
|
5178
5691
|
switch (subcommand) {
|
|
@@ -5188,12 +5701,12 @@ async function daemon(cwd, args) {
|
|
|
5188
5701
|
break;
|
|
5189
5702
|
case "logs": {
|
|
5190
5703
|
const logPath = schedulerLogPath();
|
|
5191
|
-
if (!
|
|
5704
|
+
if (!existsSync17(logPath)) {
|
|
5192
5705
|
console.log("[mink] no log file found");
|
|
5193
5706
|
return;
|
|
5194
5707
|
}
|
|
5195
5708
|
try {
|
|
5196
|
-
const content =
|
|
5709
|
+
const content = readFileSync18(logPath, "utf-8");
|
|
5197
5710
|
const lines = content.split(`
|
|
5198
5711
|
`);
|
|
5199
5712
|
const tail = lines.slice(-50).join(`
|
|
@@ -5227,13 +5740,13 @@ function printValidKeys() {
|
|
|
5227
5740
|
}
|
|
5228
5741
|
}
|
|
5229
5742
|
function readLineFromStdin() {
|
|
5230
|
-
return new Promise((
|
|
5743
|
+
return new Promise((resolve4) => {
|
|
5231
5744
|
const chunks = [];
|
|
5232
5745
|
process.stdin.resume();
|
|
5233
5746
|
process.stdin.setEncoding("utf-8");
|
|
5234
5747
|
process.stdin.once("data", (data) => {
|
|
5235
5748
|
process.stdin.pause();
|
|
5236
|
-
|
|
5749
|
+
resolve4(String(data).trim());
|
|
5237
5750
|
});
|
|
5238
5751
|
});
|
|
5239
5752
|
}
|
|
@@ -5270,7 +5783,7 @@ async function config(args) {
|
|
|
5270
5783
|
const all = resolveAllConfig();
|
|
5271
5784
|
console.log("[mink] configuration:");
|
|
5272
5785
|
for (const entry of all) {
|
|
5273
|
-
let line2 = ` ${entry.key} = ${entry.value} (source: ${entry.source})`;
|
|
5786
|
+
let line2 = ` ${entry.key} = ${entry.value} (${entry.scope}, source: ${entry.source})`;
|
|
5274
5787
|
if (entry.source === "environment variable" && entry.configFileValue !== undefined) {
|
|
5275
5788
|
line2 += ` [config file value: ${entry.configFileValue} — overridden]`;
|
|
5276
5789
|
}
|
|
@@ -5305,8 +5818,8 @@ var init_config2 = __esm(() => {
|
|
|
5305
5818
|
|
|
5306
5819
|
// src/commands/init.ts
|
|
5307
5820
|
import { execSync as execSync3 } from "child_process";
|
|
5308
|
-
import { mkdirSync as
|
|
5309
|
-
import { resolve as
|
|
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";
|
|
5310
5823
|
function detectRuntime2() {
|
|
5311
5824
|
try {
|
|
5312
5825
|
execSync3("bun --version", { stdio: "ignore" });
|
|
@@ -5347,7 +5860,7 @@ function isMinkHook2(entry) {
|
|
|
5347
5860
|
return false;
|
|
5348
5861
|
}
|
|
5349
5862
|
function mergeHooksIntoSettings2(settingsPath, newHooks) {
|
|
5350
|
-
|
|
5863
|
+
mkdirSync8(dirname7(settingsPath), { recursive: true });
|
|
5351
5864
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
5352
5865
|
const existingHooks = existing.hooks ?? {};
|
|
5353
5866
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -5370,7 +5883,7 @@ var exports_update = {};
|
|
|
5370
5883
|
__export(exports_update, {
|
|
5371
5884
|
update: () => update
|
|
5372
5885
|
});
|
|
5373
|
-
import { resolve as
|
|
5886
|
+
import { resolve as resolve5, dirname as dirname8 } from "path";
|
|
5374
5887
|
function parseArgs(args) {
|
|
5375
5888
|
let dryRun = false;
|
|
5376
5889
|
let project = null;
|
|
@@ -5418,7 +5931,7 @@ async function update(cwd, args) {
|
|
|
5418
5931
|
return;
|
|
5419
5932
|
}
|
|
5420
5933
|
const runtime = detectRuntime2();
|
|
5421
|
-
const cliPath =
|
|
5934
|
+
const cliPath = resolve5(dirname8(new URL(import.meta.url).pathname), "../cli.ts");
|
|
5422
5935
|
const newHooks = buildHooksConfig2(runtime, cliPath);
|
|
5423
5936
|
for (const target of targets) {
|
|
5424
5937
|
console.log(`[mink] updating: ${target.name} (${target.id})`);
|
|
@@ -5429,7 +5942,7 @@ async function update(cwd, args) {
|
|
|
5429
5942
|
}
|
|
5430
5943
|
const backupName = createBackup(target.cwd);
|
|
5431
5944
|
console.log(` backup: ${backupName}`);
|
|
5432
|
-
const settingsPath =
|
|
5945
|
+
const settingsPath = resolve5(target.cwd, ".claude", "settings.json");
|
|
5433
5946
|
mergeHooksIntoSettings2(settingsPath, newHooks);
|
|
5434
5947
|
console.log(" hooks: updated");
|
|
5435
5948
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -5487,8 +6000,8 @@ var init_restore = __esm(() => {
|
|
|
5487
6000
|
});
|
|
5488
6001
|
|
|
5489
6002
|
// src/core/design-eval/server-detect.ts
|
|
5490
|
-
import { readFileSync as
|
|
5491
|
-
import { join as
|
|
6003
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
6004
|
+
import { join as join17 } from "path";
|
|
5492
6005
|
async function probePort(port) {
|
|
5493
6006
|
try {
|
|
5494
6007
|
const controller = new AbortController;
|
|
@@ -5510,7 +6023,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
5510
6023
|
}
|
|
5511
6024
|
function detectDevCommand(cwd) {
|
|
5512
6025
|
try {
|
|
5513
|
-
const raw =
|
|
6026
|
+
const raw = readFileSync19(join17(cwd, "package.json"), "utf-8");
|
|
5514
6027
|
const pkg = JSON.parse(raw);
|
|
5515
6028
|
const scripts = pkg.scripts;
|
|
5516
6029
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -5530,10 +6043,10 @@ var init_server_detect = __esm(() => {
|
|
|
5530
6043
|
});
|
|
5531
6044
|
|
|
5532
6045
|
// src/core/design-eval/route-detect.ts
|
|
5533
|
-
import { existsSync as
|
|
5534
|
-
import { join as
|
|
6046
|
+
import { existsSync as existsSync19, readdirSync as readdirSync5, statSync as statSync8 } from "fs";
|
|
6047
|
+
import { join as join18, relative as relative6, sep } from "path";
|
|
5535
6048
|
function detectFramework(cwd) {
|
|
5536
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
6049
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync19(join18(cwd, `${name}.${ext}`))) || existsSync19(join18(cwd, name));
|
|
5537
6050
|
if (has("next.config"))
|
|
5538
6051
|
return "nextjs";
|
|
5539
6052
|
if (has("svelte.config"))
|
|
@@ -5558,8 +6071,8 @@ function detectRoutes(cwd) {
|
|
|
5558
6071
|
}
|
|
5559
6072
|
function detectNextRoutes(cwd) {
|
|
5560
6073
|
const routes = [];
|
|
5561
|
-
const appDir =
|
|
5562
|
-
if (
|
|
6074
|
+
const appDir = join18(cwd, "app");
|
|
6075
|
+
if (existsSync19(appDir)) {
|
|
5563
6076
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
5564
6077
|
for (const file of pageFiles) {
|
|
5565
6078
|
const rel = relative6(appDir, file);
|
|
@@ -5570,8 +6083,8 @@ function detectNextRoutes(cwd) {
|
|
|
5570
6083
|
routes.push(route);
|
|
5571
6084
|
}
|
|
5572
6085
|
}
|
|
5573
|
-
const pagesDir =
|
|
5574
|
-
if (
|
|
6086
|
+
const pagesDir = join18(cwd, "pages");
|
|
6087
|
+
if (existsSync19(pagesDir)) {
|
|
5575
6088
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
5576
6089
|
for (const file of pageFiles) {
|
|
5577
6090
|
const rel = relative6(pagesDir, file);
|
|
@@ -5590,8 +6103,8 @@ function detectNextRoutes(cwd) {
|
|
|
5590
6103
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
5591
6104
|
}
|
|
5592
6105
|
function detectSvelteKitRoutes(cwd) {
|
|
5593
|
-
const routesDir =
|
|
5594
|
-
if (!
|
|
6106
|
+
const routesDir = join18(cwd, "src", "routes");
|
|
6107
|
+
if (!existsSync19(routesDir))
|
|
5595
6108
|
return ["/"];
|
|
5596
6109
|
const routes = [];
|
|
5597
6110
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
@@ -5606,8 +6119,8 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
5606
6119
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
5607
6120
|
}
|
|
5608
6121
|
function detectNuxtRoutes(cwd) {
|
|
5609
|
-
const pagesDir =
|
|
5610
|
-
if (!
|
|
6122
|
+
const pagesDir = join18(cwd, "pages");
|
|
6123
|
+
if (!existsSync19(pagesDir))
|
|
5611
6124
|
return ["/"];
|
|
5612
6125
|
const routes = [];
|
|
5613
6126
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
@@ -5633,7 +6146,7 @@ function findFiles(dir, pattern) {
|
|
|
5633
6146
|
for (const entry of entries) {
|
|
5634
6147
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
5635
6148
|
continue;
|
|
5636
|
-
const full =
|
|
6149
|
+
const full = join18(current, entry);
|
|
5637
6150
|
try {
|
|
5638
6151
|
const stat2 = statSync8(full);
|
|
5639
6152
|
if (stat2.isDirectory()) {
|
|
@@ -5661,11 +6174,11 @@ function __extends(d, b) {
|
|
|
5661
6174
|
}
|
|
5662
6175
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
5663
6176
|
function adopt(value) {
|
|
5664
|
-
return value instanceof P ? value : new P(function(
|
|
5665
|
-
|
|
6177
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
6178
|
+
resolve6(value);
|
|
5666
6179
|
});
|
|
5667
6180
|
}
|
|
5668
|
-
return new (P || (P = Promise))(function(
|
|
6181
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
5669
6182
|
function fulfilled(value) {
|
|
5670
6183
|
try {
|
|
5671
6184
|
step(generator.next(value));
|
|
@@ -5681,7 +6194,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
5681
6194
|
}
|
|
5682
6195
|
}
|
|
5683
6196
|
function step(result) {
|
|
5684
|
-
result.done ?
|
|
6197
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
5685
6198
|
}
|
|
5686
6199
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5687
6200
|
});
|
|
@@ -5864,14 +6377,14 @@ function __asyncValues(o) {
|
|
|
5864
6377
|
}, i);
|
|
5865
6378
|
function verb(n) {
|
|
5866
6379
|
i[n] = o[n] && function(v) {
|
|
5867
|
-
return new Promise(function(
|
|
5868
|
-
v = o[n](v), settle(
|
|
6380
|
+
return new Promise(function(resolve6, reject) {
|
|
6381
|
+
v = o[n](v), settle(resolve6, reject, v.done, v.value);
|
|
5869
6382
|
});
|
|
5870
6383
|
};
|
|
5871
6384
|
}
|
|
5872
|
-
function settle(
|
|
6385
|
+
function settle(resolve6, reject, d, v) {
|
|
5873
6386
|
Promise.resolve(v).then(function(v2) {
|
|
5874
|
-
|
|
6387
|
+
resolve6({ value: v2, done: d });
|
|
5875
6388
|
}, reject);
|
|
5876
6389
|
}
|
|
5877
6390
|
}
|
|
@@ -6402,7 +6915,7 @@ function of() {
|
|
|
6402
6915
|
}
|
|
6403
6916
|
function lastValueFrom(source, config22) {
|
|
6404
6917
|
var hasConfig = typeof config22 === "object";
|
|
6405
|
-
return new Promise(function(
|
|
6918
|
+
return new Promise(function(resolve6, reject) {
|
|
6406
6919
|
var _hasValue = false;
|
|
6407
6920
|
var _value;
|
|
6408
6921
|
source.subscribe({
|
|
@@ -6413,9 +6926,9 @@ function lastValueFrom(source, config22) {
|
|
|
6413
6926
|
error: reject,
|
|
6414
6927
|
complete: function() {
|
|
6415
6928
|
if (_hasValue) {
|
|
6416
|
-
|
|
6929
|
+
resolve6(_value);
|
|
6417
6930
|
} else if (hasConfig) {
|
|
6418
|
-
|
|
6931
|
+
resolve6(config22.defaultValue);
|
|
6419
6932
|
} else {
|
|
6420
6933
|
reject(new EmptyError);
|
|
6421
6934
|
}
|
|
@@ -6425,16 +6938,16 @@ function lastValueFrom(source, config22) {
|
|
|
6425
6938
|
}
|
|
6426
6939
|
function firstValueFrom(source, config22) {
|
|
6427
6940
|
var hasConfig = typeof config22 === "object";
|
|
6428
|
-
return new Promise(function(
|
|
6941
|
+
return new Promise(function(resolve6, reject) {
|
|
6429
6942
|
var subscriber = new SafeSubscriber({
|
|
6430
6943
|
next: function(value) {
|
|
6431
|
-
|
|
6944
|
+
resolve6(value);
|
|
6432
6945
|
subscriber.unsubscribe();
|
|
6433
6946
|
},
|
|
6434
6947
|
error: reject,
|
|
6435
6948
|
complete: function() {
|
|
6436
6949
|
if (hasConfig) {
|
|
6437
|
-
|
|
6950
|
+
resolve6(config22.defaultValue);
|
|
6438
6951
|
} else {
|
|
6439
6952
|
reject(new EmptyError);
|
|
6440
6953
|
}
|
|
@@ -7486,7 +7999,7 @@ var init_rxjs = __esm(() => {
|
|
|
7486
7999
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
7487
8000
|
var _this = this;
|
|
7488
8001
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
7489
|
-
return new promiseCtor(function(
|
|
8002
|
+
return new promiseCtor(function(resolve6, reject) {
|
|
7490
8003
|
var subscriber = new SafeSubscriber({
|
|
7491
8004
|
next: function(value) {
|
|
7492
8005
|
try {
|
|
@@ -7497,7 +8010,7 @@ var init_rxjs = __esm(() => {
|
|
|
7497
8010
|
}
|
|
7498
8011
|
},
|
|
7499
8012
|
error: reject,
|
|
7500
|
-
complete:
|
|
8013
|
+
complete: resolve6
|
|
7501
8014
|
});
|
|
7502
8015
|
_this.subscribe(subscriber);
|
|
7503
8016
|
});
|
|
@@ -7519,14 +8032,14 @@ var init_rxjs = __esm(() => {
|
|
|
7519
8032
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
7520
8033
|
var _this = this;
|
|
7521
8034
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
7522
|
-
return new promiseCtor(function(
|
|
8035
|
+
return new promiseCtor(function(resolve6, reject) {
|
|
7523
8036
|
var value;
|
|
7524
8037
|
_this.subscribe(function(x) {
|
|
7525
8038
|
return value = x;
|
|
7526
8039
|
}, function(err) {
|
|
7527
8040
|
return reject(err);
|
|
7528
8041
|
}, function() {
|
|
7529
|
-
return
|
|
8042
|
+
return resolve6(value);
|
|
7530
8043
|
});
|
|
7531
8044
|
});
|
|
7532
8045
|
};
|
|
@@ -9452,8 +9965,8 @@ class Deferred {
|
|
|
9452
9965
|
#isRejected = false;
|
|
9453
9966
|
#value;
|
|
9454
9967
|
#resolve;
|
|
9455
|
-
#taskPromise = new Promise((
|
|
9456
|
-
this.#resolve =
|
|
9968
|
+
#taskPromise = new Promise((resolve6) => {
|
|
9969
|
+
this.#resolve = resolve6;
|
|
9457
9970
|
});
|
|
9458
9971
|
#timeoutId;
|
|
9459
9972
|
#timeoutError;
|
|
@@ -9542,12 +10055,12 @@ var init_Mutex = __esm(() => {
|
|
|
9542
10055
|
return new Mutex.Guard(this, onRelease);
|
|
9543
10056
|
}
|
|
9544
10057
|
release() {
|
|
9545
|
-
const
|
|
9546
|
-
if (!
|
|
10058
|
+
const resolve6 = this.#acquirers.shift();
|
|
10059
|
+
if (!resolve6) {
|
|
9547
10060
|
this.#locked = false;
|
|
9548
10061
|
return;
|
|
9549
10062
|
}
|
|
9550
|
-
|
|
10063
|
+
resolve6();
|
|
9551
10064
|
}
|
|
9552
10065
|
};
|
|
9553
10066
|
});
|
|
@@ -11291,12 +11804,12 @@ var init_locators = __esm(() => {
|
|
|
11291
11804
|
}
|
|
11292
11805
|
return defer(() => {
|
|
11293
11806
|
return from(handle.evaluate((element) => {
|
|
11294
|
-
return new Promise((
|
|
11807
|
+
return new Promise((resolve6) => {
|
|
11295
11808
|
window.requestAnimationFrame(() => {
|
|
11296
11809
|
const rect1 = element.getBoundingClientRect();
|
|
11297
11810
|
window.requestAnimationFrame(() => {
|
|
11298
11811
|
const rect2 = element.getBoundingClientRect();
|
|
11299
|
-
|
|
11812
|
+
resolve6([
|
|
11300
11813
|
{
|
|
11301
11814
|
x: rect1.x,
|
|
11302
11815
|
y: rect1.y,
|
|
@@ -12587,9 +13100,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
12587
13100
|
const handle = await this.#asSVGElementHandle();
|
|
12588
13101
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
12589
13102
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
12590
|
-
const visibleRatio = await new Promise((
|
|
13103
|
+
const visibleRatio = await new Promise((resolve6) => {
|
|
12591
13104
|
const observer = new IntersectionObserver((entries) => {
|
|
12592
|
-
|
|
13105
|
+
resolve6(entries[0].intersectionRatio);
|
|
12593
13106
|
observer.disconnect();
|
|
12594
13107
|
});
|
|
12595
13108
|
observer.observe(element);
|
|
@@ -12983,7 +13496,7 @@ var init_Frame = __esm(() => {
|
|
|
12983
13496
|
}
|
|
12984
13497
|
type = type ?? "text/javascript";
|
|
12985
13498
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
12986
|
-
return await new Promise((
|
|
13499
|
+
return await new Promise((resolve6, reject) => {
|
|
12987
13500
|
const script = document.createElement("script");
|
|
12988
13501
|
script.type = type2;
|
|
12989
13502
|
script.text = content2;
|
|
@@ -12996,12 +13509,12 @@ var init_Frame = __esm(() => {
|
|
|
12996
13509
|
if (url) {
|
|
12997
13510
|
script.src = url;
|
|
12998
13511
|
script.addEventListener("load", () => {
|
|
12999
|
-
|
|
13512
|
+
resolve6(script);
|
|
13000
13513
|
}, { once: true });
|
|
13001
13514
|
document.head.appendChild(script);
|
|
13002
13515
|
} else {
|
|
13003
13516
|
document.head.appendChild(script);
|
|
13004
|
-
|
|
13517
|
+
resolve6(script);
|
|
13005
13518
|
}
|
|
13006
13519
|
});
|
|
13007
13520
|
}, { ...options, type, content }));
|
|
@@ -13018,7 +13531,7 @@ var init_Frame = __esm(() => {
|
|
|
13018
13531
|
options.content = content;
|
|
13019
13532
|
}
|
|
13020
13533
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
13021
|
-
return await new Promise((
|
|
13534
|
+
return await new Promise((resolve6, reject) => {
|
|
13022
13535
|
let element;
|
|
13023
13536
|
if (!url) {
|
|
13024
13537
|
element = document.createElement("style");
|
|
@@ -13030,7 +13543,7 @@ var init_Frame = __esm(() => {
|
|
|
13030
13543
|
element = link;
|
|
13031
13544
|
}
|
|
13032
13545
|
element.addEventListener("load", () => {
|
|
13033
|
-
|
|
13546
|
+
resolve6(element);
|
|
13034
13547
|
}, { once: true });
|
|
13035
13548
|
element.addEventListener("error", (event) => {
|
|
13036
13549
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -13884,9 +14397,9 @@ var init_Page = __esm(() => {
|
|
|
13884
14397
|
++this.#screencastSessionCount;
|
|
13885
14398
|
if (!this.#startScreencastPromise) {
|
|
13886
14399
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
13887
|
-
return new Promise((
|
|
14400
|
+
return new Promise((resolve6) => {
|
|
13888
14401
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
13889
|
-
return
|
|
14402
|
+
return resolve6();
|
|
13890
14403
|
});
|
|
13891
14404
|
});
|
|
13892
14405
|
});
|
|
@@ -16544,11 +17057,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
16544
17057
|
return value instanceof Node;
|
|
16545
17058
|
})
|
|
16546
17059
|
}));
|
|
16547
|
-
return new Promise((
|
|
17060
|
+
return new Promise((resolve6, reject) => {
|
|
16548
17061
|
callPuppeteer.callbacks.set(seq, {
|
|
16549
17062
|
resolve(value) {
|
|
16550
17063
|
callPuppeteer.args.delete(seq);
|
|
16551
|
-
|
|
17064
|
+
resolve6(value);
|
|
16552
17065
|
},
|
|
16553
17066
|
reject(value) {
|
|
16554
17067
|
callPuppeteer.args.delete(seq);
|
|
@@ -18538,10 +19051,10 @@ var init_NetworkManager = __esm(() => {
|
|
|
18538
19051
|
throw error;
|
|
18539
19052
|
}
|
|
18540
19053
|
}
|
|
18541
|
-
async setUserAgent(userAgent, userAgentMetadata,
|
|
19054
|
+
async setUserAgent(userAgent, userAgentMetadata, platform2) {
|
|
18542
19055
|
this.#userAgent = userAgent;
|
|
18543
19056
|
this.#userAgentMetadata = userAgentMetadata;
|
|
18544
|
-
this.#platform =
|
|
19057
|
+
this.#platform = platform2;
|
|
18545
19058
|
await this.#applyToAllClients(this.#applyUserAgent.bind(this));
|
|
18546
19059
|
}
|
|
18547
19060
|
async#applyUserAgent(client) {
|
|
@@ -20011,8 +20524,8 @@ var init_Input2 = __esm(() => {
|
|
|
20011
20524
|
if (typeof delay === "number") {
|
|
20012
20525
|
await Promise.all(actions);
|
|
20013
20526
|
actions.length = 0;
|
|
20014
|
-
await new Promise((
|
|
20015
|
-
setTimeout(
|
|
20527
|
+
await new Promise((resolve6) => {
|
|
20528
|
+
setTimeout(resolve6, delay);
|
|
20016
20529
|
});
|
|
20017
20530
|
}
|
|
20018
20531
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -20032,9 +20545,9 @@ var init_Input2 = __esm(() => {
|
|
|
20032
20545
|
});
|
|
20033
20546
|
}
|
|
20034
20547
|
async drag(start, target) {
|
|
20035
|
-
const promise = new Promise((
|
|
20548
|
+
const promise = new Promise((resolve6) => {
|
|
20036
20549
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
20037
|
-
return
|
|
20550
|
+
return resolve6(event.data);
|
|
20038
20551
|
});
|
|
20039
20552
|
});
|
|
20040
20553
|
await this.move(start.x, start.y);
|
|
@@ -20075,8 +20588,8 @@ var init_Input2 = __esm(() => {
|
|
|
20075
20588
|
await this.dragEnter(target, data);
|
|
20076
20589
|
await this.dragOver(target, data);
|
|
20077
20590
|
if (delay) {
|
|
20078
|
-
await new Promise((
|
|
20079
|
-
return setTimeout(
|
|
20591
|
+
await new Promise((resolve6) => {
|
|
20592
|
+
return setTimeout(resolve6, delay);
|
|
20080
20593
|
});
|
|
20081
20594
|
}
|
|
20082
20595
|
await this.drop(target, data);
|
|
@@ -20888,9 +21401,9 @@ var init_Page2 = __esm(() => {
|
|
|
20888
21401
|
async captureHeapSnapshot(options) {
|
|
20889
21402
|
const { createWriteStream } = environment.value.fs;
|
|
20890
21403
|
const stream = createWriteStream(options.path);
|
|
20891
|
-
const streamPromise = new Promise((
|
|
21404
|
+
const streamPromise = new Promise((resolve6, reject) => {
|
|
20892
21405
|
stream.on("error", reject);
|
|
20893
|
-
stream.on("finish",
|
|
21406
|
+
stream.on("finish", resolve6);
|
|
20894
21407
|
});
|
|
20895
21408
|
const client = this.#primaryTargetClient;
|
|
20896
21409
|
await client.send("HeapProfiler.enable");
|
|
@@ -22403,10 +22916,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
22403
22916
|
|
|
22404
22917
|
class BrowserWebSocketTransport {
|
|
22405
22918
|
static create(url) {
|
|
22406
|
-
return new Promise((
|
|
22919
|
+
return new Promise((resolve6, reject) => {
|
|
22407
22920
|
const ws = new WebSocket(url);
|
|
22408
22921
|
ws.addEventListener("open", () => {
|
|
22409
|
-
return
|
|
22922
|
+
return resolve6(new BrowserWebSocketTransport(ws));
|
|
22410
22923
|
});
|
|
22411
22924
|
ws.addEventListener("error", reject);
|
|
22412
22925
|
});
|
|
@@ -25240,11 +25753,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
25240
25753
|
}
|
|
25241
25754
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
25242
25755
|
try {
|
|
25243
|
-
const detachedFromTargetPromise = new Promise((
|
|
25756
|
+
const detachedFromTargetPromise = new Promise((resolve6) => {
|
|
25244
25757
|
const onContextDestroyed = (event) => {
|
|
25245
25758
|
if (event.targetId === params.context) {
|
|
25246
25759
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
25247
|
-
|
|
25760
|
+
resolve6();
|
|
25248
25761
|
}
|
|
25249
25762
|
};
|
|
25250
25763
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -26564,7 +27077,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
26564
27077
|
}
|
|
26565
27078
|
}
|
|
26566
27079
|
const promises = [
|
|
26567
|
-
new Promise((
|
|
27080
|
+
new Promise((resolve6) => setTimeout(resolve6, this.#tickDuration))
|
|
26568
27081
|
];
|
|
26569
27082
|
for (const option of options) {
|
|
26570
27083
|
promises.push(this.#dispatchAction(option));
|
|
@@ -27163,8 +27676,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
27163
27676
|
acquire() {
|
|
27164
27677
|
const state = { resolved: false };
|
|
27165
27678
|
if (this.#locked) {
|
|
27166
|
-
return new Promise((
|
|
27167
|
-
this.#acquirers.push(() =>
|
|
27679
|
+
return new Promise((resolve6) => {
|
|
27680
|
+
this.#acquirers.push(() => resolve6(this.#release.bind(this, state)));
|
|
27168
27681
|
});
|
|
27169
27682
|
}
|
|
27170
27683
|
this.#locked = true;
|
|
@@ -27175,12 +27688,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
27175
27688
|
throw new Error("Cannot release more than once.");
|
|
27176
27689
|
}
|
|
27177
27690
|
state.resolved = true;
|
|
27178
|
-
const
|
|
27179
|
-
if (!
|
|
27691
|
+
const resolve6 = this.#acquirers.shift();
|
|
27692
|
+
if (!resolve6) {
|
|
27180
27693
|
this.#locked = false;
|
|
27181
27694
|
return;
|
|
27182
27695
|
}
|
|
27183
|
-
|
|
27696
|
+
resolve6();
|
|
27184
27697
|
}
|
|
27185
27698
|
async run(action) {
|
|
27186
27699
|
const release = await this.acquire();
|
|
@@ -28307,8 +28820,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
28307
28820
|
let queueNonEmptyResolver = null;
|
|
28308
28821
|
return {
|
|
28309
28822
|
async getMessage() {
|
|
28310
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
28311
|
-
queueNonEmptyResolver =
|
|
28823
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve6) => {
|
|
28824
|
+
queueNonEmptyResolver = resolve6;
|
|
28312
28825
|
});
|
|
28313
28826
|
await onMessage;
|
|
28314
28827
|
return queue.shift();
|
|
@@ -28394,7 +28907,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
28394
28907
|
functionDeclaration: String((id) => {
|
|
28395
28908
|
const w = window;
|
|
28396
28909
|
if (w[id] === undefined) {
|
|
28397
|
-
return new Promise((
|
|
28910
|
+
return new Promise((resolve6) => w[id] = resolve6);
|
|
28398
28911
|
}
|
|
28399
28912
|
const channelProxy = w[id];
|
|
28400
28913
|
delete w[id];
|
|
@@ -29745,8 +30258,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
29745
30258
|
return this.#result;
|
|
29746
30259
|
}
|
|
29747
30260
|
constructor() {
|
|
29748
|
-
this.#promise = new Promise((
|
|
29749
|
-
this.#resolve =
|
|
30261
|
+
this.#promise = new Promise((resolve6, reject) => {
|
|
30262
|
+
this.#resolve = resolve6;
|
|
29750
30263
|
this.#reject = reject;
|
|
29751
30264
|
});
|
|
29752
30265
|
this.#promise.catch((_error) => {});
|
|
@@ -34071,11 +34584,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
34071
34584
|
if (this.#contexts.has(browsingContextId)) {
|
|
34072
34585
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
34073
34586
|
}
|
|
34074
|
-
return new Promise((
|
|
34587
|
+
return new Promise((resolve6) => {
|
|
34075
34588
|
const listener = (event) => {
|
|
34076
34589
|
if (event.browsingContext.id === browsingContextId) {
|
|
34077
34590
|
this.#eventEmitter.off("added", listener);
|
|
34078
|
-
|
|
34591
|
+
resolve6(event.browsingContext);
|
|
34079
34592
|
}
|
|
34080
34593
|
};
|
|
34081
34594
|
this.#eventEmitter.on("added", listener);
|
|
@@ -37571,8 +38084,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
37571
38084
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
37572
38085
|
Object.assign(globalThis, {
|
|
37573
38086
|
[PLACEHOLDER("name")]: function(...args) {
|
|
37574
|
-
return new Promise((
|
|
37575
|
-
callback([
|
|
38087
|
+
return new Promise((resolve6, reject) => {
|
|
38088
|
+
callback([resolve6, reject, args]);
|
|
37576
38089
|
});
|
|
37577
38090
|
}
|
|
37578
38091
|
});
|
|
@@ -37660,8 +38173,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
37660
38173
|
return;
|
|
37661
38174
|
}
|
|
37662
38175
|
try {
|
|
37663
|
-
await dataHandle.evaluate(([
|
|
37664
|
-
|
|
38176
|
+
await dataHandle.evaluate(([resolve6], result2) => {
|
|
38177
|
+
resolve6(result2);
|
|
37665
38178
|
}, result);
|
|
37666
38179
|
} catch (error) {
|
|
37667
38180
|
debugError(error);
|
|
@@ -40053,22 +40566,22 @@ var init_Page3 = __esm(() => {
|
|
|
40053
40566
|
async setUserAgent(userAgentOrOptions, userAgentMetadata) {
|
|
40054
40567
|
let userAgent;
|
|
40055
40568
|
let clientHints;
|
|
40056
|
-
let
|
|
40569
|
+
let platform2;
|
|
40057
40570
|
if (typeof userAgentOrOptions === "string") {
|
|
40058
40571
|
userAgent = userAgentOrOptions;
|
|
40059
40572
|
clientHints = userAgentMetadata;
|
|
40060
40573
|
} else {
|
|
40061
40574
|
userAgent = userAgentOrOptions.userAgent ?? null;
|
|
40062
40575
|
clientHints = userAgentOrOptions.userAgentMetadata;
|
|
40063
|
-
|
|
40576
|
+
platform2 = userAgentOrOptions.platform === "" ? undefined : userAgentOrOptions.platform;
|
|
40064
40577
|
}
|
|
40065
40578
|
if (userAgent === "") {
|
|
40066
40579
|
userAgent = null;
|
|
40067
40580
|
}
|
|
40068
40581
|
await this.#frame.browsingContext.setUserAgent(userAgent);
|
|
40069
|
-
if (
|
|
40582
|
+
if (platform2 && platform2 !== "") {
|
|
40070
40583
|
clientHints = clientHints ?? {};
|
|
40071
|
-
clientHints.platform =
|
|
40584
|
+
clientHints.platform = platform2;
|
|
40072
40585
|
}
|
|
40073
40586
|
await this.#frame.browsingContext.setClientHintsOverride(clientHints ?? null);
|
|
40074
40587
|
}
|
|
@@ -44953,7 +45466,7 @@ __export(exports_NodeWebSocketTransport, {
|
|
|
44953
45466
|
|
|
44954
45467
|
class NodeWebSocketTransport {
|
|
44955
45468
|
static create(url, headers) {
|
|
44956
|
-
return new Promise((
|
|
45469
|
+
return new Promise((resolve6, reject) => {
|
|
44957
45470
|
const ws = new wrapper_default(url, [], {
|
|
44958
45471
|
followRedirects: true,
|
|
44959
45472
|
perMessageDeflate: false,
|
|
@@ -44965,7 +45478,7 @@ class NodeWebSocketTransport {
|
|
|
44965
45478
|
}
|
|
44966
45479
|
});
|
|
44967
45480
|
ws.addEventListener("open", () => {
|
|
44968
|
-
return
|
|
45481
|
+
return resolve6(new NodeWebSocketTransport(ws));
|
|
44969
45482
|
});
|
|
44970
45483
|
ws.addEventListener("error", reject);
|
|
44971
45484
|
});
|
|
@@ -47857,8 +48370,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
47857
48370
|
function req(url, opts = {}) {
|
|
47858
48371
|
const href = typeof url === "string" ? url : url.href;
|
|
47859
48372
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
47860
|
-
const promise = new Promise((
|
|
47861
|
-
req2.once("response",
|
|
48373
|
+
const promise = new Promise((resolve6, reject) => {
|
|
48374
|
+
req2.once("response", resolve6).once("error", reject).end();
|
|
47862
48375
|
});
|
|
47863
48376
|
req2.then = promise.then.bind(promise);
|
|
47864
48377
|
return req2;
|
|
@@ -48034,15 +48547,15 @@ var require_proxy_from_env = __commonJS((exports) => {
|
|
|
48034
48547
|
function getProxyForUrl(url) {
|
|
48035
48548
|
var parsedUrl = typeof url === "string" ? parseUrl(url) : url || {};
|
|
48036
48549
|
var proto = parsedUrl.protocol;
|
|
48037
|
-
var
|
|
48550
|
+
var hostname2 = parsedUrl.host;
|
|
48038
48551
|
var port = parsedUrl.port;
|
|
48039
|
-
if (typeof
|
|
48552
|
+
if (typeof hostname2 !== "string" || !hostname2 || typeof proto !== "string") {
|
|
48040
48553
|
return "";
|
|
48041
48554
|
}
|
|
48042
48555
|
proto = proto.split(":", 1)[0];
|
|
48043
|
-
|
|
48556
|
+
hostname2 = hostname2.replace(/:\d*$/, "");
|
|
48044
48557
|
port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
|
|
48045
|
-
if (!shouldProxy(
|
|
48558
|
+
if (!shouldProxy(hostname2, port)) {
|
|
48046
48559
|
return "";
|
|
48047
48560
|
}
|
|
48048
48561
|
var proxy = getEnv("npm_config_" + proto + "_proxy") || getEnv(proto + "_proxy") || getEnv("npm_config_proxy") || getEnv("all_proxy");
|
|
@@ -48051,7 +48564,7 @@ var require_proxy_from_env = __commonJS((exports) => {
|
|
|
48051
48564
|
}
|
|
48052
48565
|
return proxy;
|
|
48053
48566
|
}
|
|
48054
|
-
function shouldProxy(
|
|
48567
|
+
function shouldProxy(hostname2, port) {
|
|
48055
48568
|
var NO_PROXY = (getEnv("npm_config_no_proxy") || getEnv("no_proxy")).toLowerCase();
|
|
48056
48569
|
if (!NO_PROXY) {
|
|
48057
48570
|
return true;
|
|
@@ -48070,12 +48583,12 @@ var require_proxy_from_env = __commonJS((exports) => {
|
|
|
48070
48583
|
return true;
|
|
48071
48584
|
}
|
|
48072
48585
|
if (!/^[.*]/.test(parsedProxyHostname)) {
|
|
48073
|
-
return
|
|
48586
|
+
return hostname2 !== parsedProxyHostname;
|
|
48074
48587
|
}
|
|
48075
48588
|
if (parsedProxyHostname.charAt(0) === "*") {
|
|
48076
48589
|
parsedProxyHostname = parsedProxyHostname.slice(1);
|
|
48077
48590
|
}
|
|
48078
|
-
return !stringEndsWith.call(
|
|
48591
|
+
return !stringEndsWith.call(hostname2, parsedProxyHostname);
|
|
48079
48592
|
});
|
|
48080
48593
|
}
|
|
48081
48594
|
function getEnv(key) {
|
|
@@ -48153,8 +48666,8 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
48153
48666
|
setRequestProps(req, opts) {
|
|
48154
48667
|
const { proxy } = this;
|
|
48155
48668
|
const protocol = opts.secureEndpoint ? "https:" : "http:";
|
|
48156
|
-
const
|
|
48157
|
-
const base = `${protocol}//${
|
|
48669
|
+
const hostname2 = req.getHeader("host") || "localhost";
|
|
48670
|
+
const base = `${protocol}//${hostname2}`;
|
|
48158
48671
|
const url = new url_1.URL(req.path, base);
|
|
48159
48672
|
if (opts.port !== 80) {
|
|
48160
48673
|
url.port = String(opts.port);
|
|
@@ -48229,7 +48742,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
48229
48742
|
var debug_1 = __importDefault(require_src());
|
|
48230
48743
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
48231
48744
|
function parseProxyResponse(socket) {
|
|
48232
|
-
return new Promise((
|
|
48745
|
+
return new Promise((resolve6, reject) => {
|
|
48233
48746
|
let buffersLength = 0;
|
|
48234
48747
|
const buffers = [];
|
|
48235
48748
|
function read() {
|
|
@@ -48298,7 +48811,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
48298
48811
|
}
|
|
48299
48812
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
48300
48813
|
cleanup();
|
|
48301
|
-
|
|
48814
|
+
resolve6({
|
|
48302
48815
|
connect: {
|
|
48303
48816
|
statusCode,
|
|
48304
48817
|
statusText,
|
|
@@ -50402,11 +50915,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
50402
50915
|
var require_socksclient = __commonJS((exports) => {
|
|
50403
50916
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
50404
50917
|
function adopt(value) {
|
|
50405
|
-
return value instanceof P ? value : new P(function(
|
|
50406
|
-
|
|
50918
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
50919
|
+
resolve6(value);
|
|
50407
50920
|
});
|
|
50408
50921
|
}
|
|
50409
|
-
return new (P || (P = Promise))(function(
|
|
50922
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
50410
50923
|
function fulfilled(value) {
|
|
50411
50924
|
try {
|
|
50412
50925
|
step(generator.next(value));
|
|
@@ -50422,7 +50935,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50422
50935
|
}
|
|
50423
50936
|
}
|
|
50424
50937
|
function step(result) {
|
|
50425
|
-
result.done ?
|
|
50938
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
50426
50939
|
}
|
|
50427
50940
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50428
50941
|
});
|
|
@@ -50449,13 +50962,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50449
50962
|
this.setState(constants_1.SocksClientState.Created);
|
|
50450
50963
|
}
|
|
50451
50964
|
static createConnection(options, callback) {
|
|
50452
|
-
return new Promise((
|
|
50965
|
+
return new Promise((resolve6, reject) => {
|
|
50453
50966
|
try {
|
|
50454
50967
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
50455
50968
|
} catch (err) {
|
|
50456
50969
|
if (typeof callback === "function") {
|
|
50457
50970
|
callback(err);
|
|
50458
|
-
return
|
|
50971
|
+
return resolve6(err);
|
|
50459
50972
|
} else {
|
|
50460
50973
|
return reject(err);
|
|
50461
50974
|
}
|
|
@@ -50466,16 +50979,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50466
50979
|
client.removeAllListeners();
|
|
50467
50980
|
if (typeof callback === "function") {
|
|
50468
50981
|
callback(null, info);
|
|
50469
|
-
|
|
50982
|
+
resolve6(info);
|
|
50470
50983
|
} else {
|
|
50471
|
-
|
|
50984
|
+
resolve6(info);
|
|
50472
50985
|
}
|
|
50473
50986
|
});
|
|
50474
50987
|
client.once("error", (err) => {
|
|
50475
50988
|
client.removeAllListeners();
|
|
50476
50989
|
if (typeof callback === "function") {
|
|
50477
50990
|
callback(err);
|
|
50478
|
-
|
|
50991
|
+
resolve6(err);
|
|
50479
50992
|
} else {
|
|
50480
50993
|
reject(err);
|
|
50481
50994
|
}
|
|
@@ -50483,13 +50996,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50483
50996
|
});
|
|
50484
50997
|
}
|
|
50485
50998
|
static createConnectionChain(options, callback) {
|
|
50486
|
-
return new Promise((
|
|
50999
|
+
return new Promise((resolve6, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
50487
51000
|
try {
|
|
50488
51001
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
50489
51002
|
} catch (err) {
|
|
50490
51003
|
if (typeof callback === "function") {
|
|
50491
51004
|
callback(err);
|
|
50492
|
-
return
|
|
51005
|
+
return resolve6(err);
|
|
50493
51006
|
} else {
|
|
50494
51007
|
return reject(err);
|
|
50495
51008
|
}
|
|
@@ -50515,14 +51028,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50515
51028
|
}
|
|
50516
51029
|
if (typeof callback === "function") {
|
|
50517
51030
|
callback(null, { socket: sock });
|
|
50518
|
-
|
|
51031
|
+
resolve6({ socket: sock });
|
|
50519
51032
|
} else {
|
|
50520
|
-
|
|
51033
|
+
resolve6({ socket: sock });
|
|
50521
51034
|
}
|
|
50522
51035
|
} catch (err) {
|
|
50523
51036
|
if (typeof callback === "function") {
|
|
50524
51037
|
callback(err);
|
|
50525
|
-
|
|
51038
|
+
resolve6(err);
|
|
50526
51039
|
} else {
|
|
50527
51040
|
reject(err);
|
|
50528
51041
|
}
|
|
@@ -51122,12 +51635,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
51122
51635
|
let { host } = opts;
|
|
51123
51636
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
51124
51637
|
if (shouldLookup) {
|
|
51125
|
-
host = await new Promise((
|
|
51638
|
+
host = await new Promise((resolve6, reject) => {
|
|
51126
51639
|
lookupFn(host, {}, (err, res) => {
|
|
51127
51640
|
if (err) {
|
|
51128
51641
|
reject(err);
|
|
51129
51642
|
} else {
|
|
51130
|
-
|
|
51643
|
+
resolve6(res);
|
|
51131
51644
|
}
|
|
51132
51645
|
});
|
|
51133
51646
|
});
|
|
@@ -52134,7 +52647,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
52134
52647
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
52135
52648
|
}
|
|
52136
52649
|
function upgradeSocket(socket, options) {
|
|
52137
|
-
return new Promise((
|
|
52650
|
+
return new Promise((resolve6, reject) => {
|
|
52138
52651
|
const tlsOptions = Object.assign({}, options, {
|
|
52139
52652
|
socket
|
|
52140
52653
|
});
|
|
@@ -52144,7 +52657,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
52144
52657
|
reject(tlsSocket.authorizationError);
|
|
52145
52658
|
} else {
|
|
52146
52659
|
tlsSocket.removeAllListeners("error");
|
|
52147
|
-
|
|
52660
|
+
resolve6(tlsSocket);
|
|
52148
52661
|
}
|
|
52149
52662
|
}).once("error", (error) => {
|
|
52150
52663
|
reject(error);
|
|
@@ -52236,7 +52749,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
52236
52749
|
};
|
|
52237
52750
|
}
|
|
52238
52751
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
52239
|
-
return new Promise((
|
|
52752
|
+
return new Promise((resolve6, reject) => {
|
|
52240
52753
|
let socket = ftp._newSocket();
|
|
52241
52754
|
const handleConnErr = function(err) {
|
|
52242
52755
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -52259,7 +52772,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
52259
52772
|
socket.removeListener("error", handleConnErr);
|
|
52260
52773
|
socket.removeListener("timeout", handleTimeout);
|
|
52261
52774
|
ftp.dataSocket = socket;
|
|
52262
|
-
|
|
52775
|
+
resolve6();
|
|
52263
52776
|
});
|
|
52264
52777
|
});
|
|
52265
52778
|
}
|
|
@@ -54337,7 +54850,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
54337
54850
|
return path;
|
|
54338
54851
|
}
|
|
54339
54852
|
exports.normalize = normalize;
|
|
54340
|
-
function
|
|
54853
|
+
function join19(aRoot, aPath) {
|
|
54341
54854
|
if (aRoot === "") {
|
|
54342
54855
|
aRoot = ".";
|
|
54343
54856
|
}
|
|
@@ -54369,7 +54882,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
54369
54882
|
}
|
|
54370
54883
|
return joined;
|
|
54371
54884
|
}
|
|
54372
|
-
exports.join =
|
|
54885
|
+
exports.join = join19;
|
|
54373
54886
|
exports.isAbsolute = function(aPath) {
|
|
54374
54887
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
54375
54888
|
};
|
|
@@ -54542,7 +55055,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
54542
55055
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
54543
55056
|
}
|
|
54544
55057
|
}
|
|
54545
|
-
sourceURL =
|
|
55058
|
+
sourceURL = join19(urlGenerate(parsed), sourceURL);
|
|
54546
55059
|
}
|
|
54547
55060
|
return normalize(sourceURL);
|
|
54548
55061
|
}
|
|
@@ -56274,7 +56787,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56274
56787
|
function noEmptySpace() {
|
|
56275
56788
|
return space ? space : " ";
|
|
56276
56789
|
}
|
|
56277
|
-
function
|
|
56790
|
+
function join19(left, right) {
|
|
56278
56791
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
56279
56792
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
56280
56793
|
if (leftSource.length === 0) {
|
|
@@ -56615,8 +57128,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56615
57128
|
} else {
|
|
56616
57129
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
56617
57130
|
}
|
|
56618
|
-
result =
|
|
56619
|
-
result = [
|
|
57131
|
+
result = join19(result, operator);
|
|
57132
|
+
result = [join19(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
56620
57133
|
});
|
|
56621
57134
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
56622
57135
|
return result;
|
|
@@ -56754,11 +57267,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56754
57267
|
var result, fragment;
|
|
56755
57268
|
result = ["class"];
|
|
56756
57269
|
if (stmt.id) {
|
|
56757
|
-
result =
|
|
57270
|
+
result = join19(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
56758
57271
|
}
|
|
56759
57272
|
if (stmt.superClass) {
|
|
56760
|
-
fragment =
|
|
56761
|
-
result =
|
|
57273
|
+
fragment = join19("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
57274
|
+
result = join19(result, fragment);
|
|
56762
57275
|
}
|
|
56763
57276
|
result.push(space);
|
|
56764
57277
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -56771,9 +57284,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56771
57284
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
56772
57285
|
},
|
|
56773
57286
|
DoWhileStatement: function(stmt, flags) {
|
|
56774
|
-
var result =
|
|
57287
|
+
var result = join19("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
56775
57288
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
56776
|
-
return
|
|
57289
|
+
return join19(result, [
|
|
56777
57290
|
"while" + space + "(",
|
|
56778
57291
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
56779
57292
|
")" + this.semicolon(flags)
|
|
@@ -56809,11 +57322,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56809
57322
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
56810
57323
|
var result = ["export"], bodyFlags;
|
|
56811
57324
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
56812
|
-
result =
|
|
57325
|
+
result = join19(result, "default");
|
|
56813
57326
|
if (isStatement(stmt.declaration)) {
|
|
56814
|
-
result =
|
|
57327
|
+
result = join19(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
56815
57328
|
} else {
|
|
56816
|
-
result =
|
|
57329
|
+
result = join19(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
56817
57330
|
}
|
|
56818
57331
|
return result;
|
|
56819
57332
|
},
|
|
@@ -56821,15 +57334,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56821
57334
|
var result = ["export"], bodyFlags, that = this;
|
|
56822
57335
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
56823
57336
|
if (stmt.declaration) {
|
|
56824
|
-
return
|
|
57337
|
+
return join19(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
56825
57338
|
}
|
|
56826
57339
|
if (stmt.specifiers) {
|
|
56827
57340
|
if (stmt.specifiers.length === 0) {
|
|
56828
|
-
result =
|
|
57341
|
+
result = join19(result, "{" + space + "}");
|
|
56829
57342
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
56830
|
-
result =
|
|
57343
|
+
result = join19(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
56831
57344
|
} else {
|
|
56832
|
-
result =
|
|
57345
|
+
result = join19(result, "{");
|
|
56833
57346
|
withIndent(function(indent2) {
|
|
56834
57347
|
var i, iz;
|
|
56835
57348
|
result.push(newline);
|
|
@@ -56847,7 +57360,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56847
57360
|
result.push(base + "}");
|
|
56848
57361
|
}
|
|
56849
57362
|
if (stmt.source) {
|
|
56850
|
-
result =
|
|
57363
|
+
result = join19(result, [
|
|
56851
57364
|
"from" + space,
|
|
56852
57365
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
56853
57366
|
this.semicolon(flags)
|
|
@@ -56931,7 +57444,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56931
57444
|
];
|
|
56932
57445
|
cursor = 0;
|
|
56933
57446
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
56934
|
-
result =
|
|
57447
|
+
result = join19(result, [
|
|
56935
57448
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
56936
57449
|
]);
|
|
56937
57450
|
++cursor;
|
|
@@ -56941,7 +57454,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56941
57454
|
result.push(",");
|
|
56942
57455
|
}
|
|
56943
57456
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
56944
|
-
result =
|
|
57457
|
+
result = join19(result, [
|
|
56945
57458
|
space,
|
|
56946
57459
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
56947
57460
|
]);
|
|
@@ -56970,7 +57483,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56970
57483
|
}
|
|
56971
57484
|
}
|
|
56972
57485
|
}
|
|
56973
|
-
result =
|
|
57486
|
+
result = join19(result, [
|
|
56974
57487
|
"from" + space,
|
|
56975
57488
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
56976
57489
|
this.semicolon(flags)
|
|
@@ -57024,7 +57537,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57024
57537
|
return result;
|
|
57025
57538
|
},
|
|
57026
57539
|
ThrowStatement: function(stmt, flags) {
|
|
57027
|
-
return [
|
|
57540
|
+
return [join19("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
57028
57541
|
},
|
|
57029
57542
|
TryStatement: function(stmt, flags) {
|
|
57030
57543
|
var result, i, iz, guardedHandlers;
|
|
@@ -57032,7 +57545,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57032
57545
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
57033
57546
|
if (stmt.handlers) {
|
|
57034
57547
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
57035
|
-
result =
|
|
57548
|
+
result = join19(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
57036
57549
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
57037
57550
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
57038
57551
|
}
|
|
@@ -57040,7 +57553,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57040
57553
|
} else {
|
|
57041
57554
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
57042
57555
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
57043
|
-
result =
|
|
57556
|
+
result = join19(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
57044
57557
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
57045
57558
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
57046
57559
|
}
|
|
@@ -57048,13 +57561,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57048
57561
|
if (stmt.handler) {
|
|
57049
57562
|
if (Array.isArray(stmt.handler)) {
|
|
57050
57563
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
57051
|
-
result =
|
|
57564
|
+
result = join19(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
57052
57565
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
57053
57566
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
57054
57567
|
}
|
|
57055
57568
|
}
|
|
57056
57569
|
} else {
|
|
57057
|
-
result =
|
|
57570
|
+
result = join19(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
57058
57571
|
if (stmt.finalizer) {
|
|
57059
57572
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
57060
57573
|
}
|
|
@@ -57062,7 +57575,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57062
57575
|
}
|
|
57063
57576
|
}
|
|
57064
57577
|
if (stmt.finalizer) {
|
|
57065
|
-
result =
|
|
57578
|
+
result = join19(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
57066
57579
|
}
|
|
57067
57580
|
return result;
|
|
57068
57581
|
},
|
|
@@ -57096,7 +57609,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57096
57609
|
withIndent(function() {
|
|
57097
57610
|
if (stmt.test) {
|
|
57098
57611
|
result = [
|
|
57099
|
-
|
|
57612
|
+
join19("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
57100
57613
|
":"
|
|
57101
57614
|
];
|
|
57102
57615
|
} else {
|
|
@@ -57144,9 +57657,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57144
57657
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
57145
57658
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
57146
57659
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
57147
|
-
result =
|
|
57660
|
+
result = join19(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
57148
57661
|
} else {
|
|
57149
|
-
result =
|
|
57662
|
+
result = join19(result, join19("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
57150
57663
|
}
|
|
57151
57664
|
} else {
|
|
57152
57665
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -57248,7 +57761,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57248
57761
|
},
|
|
57249
57762
|
ReturnStatement: function(stmt, flags) {
|
|
57250
57763
|
if (stmt.argument) {
|
|
57251
|
-
return [
|
|
57764
|
+
return [join19("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
57252
57765
|
}
|
|
57253
57766
|
return ["return" + this.semicolon(flags)];
|
|
57254
57767
|
},
|
|
@@ -57330,14 +57843,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57330
57843
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
57331
57844
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
57332
57845
|
} else {
|
|
57333
|
-
result =
|
|
57846
|
+
result = join19(fragment, expr.operator);
|
|
57334
57847
|
}
|
|
57335
57848
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
57336
57849
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
57337
57850
|
result.push(noEmptySpace());
|
|
57338
57851
|
result.push(fragment);
|
|
57339
57852
|
} else {
|
|
57340
|
-
result =
|
|
57853
|
+
result = join19(result, fragment);
|
|
57341
57854
|
}
|
|
57342
57855
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
57343
57856
|
return ["(", result, ")"];
|
|
@@ -57377,7 +57890,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57377
57890
|
var result, length, i, iz, itemFlags;
|
|
57378
57891
|
length = expr["arguments"].length;
|
|
57379
57892
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
57380
|
-
result =
|
|
57893
|
+
result = join19("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
57381
57894
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
57382
57895
|
result.push("(");
|
|
57383
57896
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -57424,11 +57937,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57424
57937
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
57425
57938
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
57426
57939
|
if (space === "") {
|
|
57427
|
-
result =
|
|
57940
|
+
result = join19(expr.operator, fragment);
|
|
57428
57941
|
} else {
|
|
57429
57942
|
result = [expr.operator];
|
|
57430
57943
|
if (expr.operator.length > 2) {
|
|
57431
|
-
result =
|
|
57944
|
+
result = join19(result, fragment);
|
|
57432
57945
|
} else {
|
|
57433
57946
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
57434
57947
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -57451,12 +57964,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57451
57964
|
result = "yield";
|
|
57452
57965
|
}
|
|
57453
57966
|
if (expr.argument) {
|
|
57454
|
-
result =
|
|
57967
|
+
result = join19(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
57455
57968
|
}
|
|
57456
57969
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
57457
57970
|
},
|
|
57458
57971
|
AwaitExpression: function(expr, precedence, flags) {
|
|
57459
|
-
var result =
|
|
57972
|
+
var result = join19(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
57460
57973
|
return parenthesize(result, Precedence.Await, precedence);
|
|
57461
57974
|
},
|
|
57462
57975
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -57528,11 +58041,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57528
58041
|
var result, fragment;
|
|
57529
58042
|
result = ["class"];
|
|
57530
58043
|
if (expr.id) {
|
|
57531
|
-
result =
|
|
58044
|
+
result = join19(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
57532
58045
|
}
|
|
57533
58046
|
if (expr.superClass) {
|
|
57534
|
-
fragment =
|
|
57535
|
-
result =
|
|
58047
|
+
fragment = join19("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
58048
|
+
result = join19(result, fragment);
|
|
57536
58049
|
}
|
|
57537
58050
|
result.push(space);
|
|
57538
58051
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -57547,7 +58060,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57547
58060
|
}
|
|
57548
58061
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
57549
58062
|
fragment = [
|
|
57550
|
-
|
|
58063
|
+
join19(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
57551
58064
|
this.generateFunctionBody(expr.value)
|
|
57552
58065
|
];
|
|
57553
58066
|
} else {
|
|
@@ -57557,7 +58070,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57557
58070
|
this.generateFunctionBody(expr.value)
|
|
57558
58071
|
];
|
|
57559
58072
|
}
|
|
57560
|
-
return
|
|
58073
|
+
return join19(result, fragment);
|
|
57561
58074
|
},
|
|
57562
58075
|
Property: function(expr, precedence, flags) {
|
|
57563
58076
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -57751,7 +58264,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57751
58264
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
57752
58265
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
57753
58266
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
57754
|
-
result =
|
|
58267
|
+
result = join19(result, fragment);
|
|
57755
58268
|
} else {
|
|
57756
58269
|
result.push(fragment);
|
|
57757
58270
|
}
|
|
@@ -57759,13 +58272,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57759
58272
|
});
|
|
57760
58273
|
}
|
|
57761
58274
|
if (expr.filter) {
|
|
57762
|
-
result =
|
|
58275
|
+
result = join19(result, "if" + space);
|
|
57763
58276
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
57764
|
-
result =
|
|
58277
|
+
result = join19(result, ["(", fragment, ")"]);
|
|
57765
58278
|
}
|
|
57766
58279
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
57767
58280
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
57768
|
-
result =
|
|
58281
|
+
result = join19(result, fragment);
|
|
57769
58282
|
}
|
|
57770
58283
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
57771
58284
|
return result;
|
|
@@ -57781,8 +58294,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57781
58294
|
} else {
|
|
57782
58295
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
57783
58296
|
}
|
|
57784
|
-
fragment =
|
|
57785
|
-
fragment =
|
|
58297
|
+
fragment = join19(fragment, expr.of ? "of" : "in");
|
|
58298
|
+
fragment = join19(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
57786
58299
|
return ["for" + space + "(", fragment, ")"];
|
|
57787
58300
|
},
|
|
57788
58301
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -64270,11 +64783,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
64270
64783
|
};
|
|
64271
64784
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
64272
64785
|
function adopt(value) {
|
|
64273
|
-
return value instanceof P ? value : new P(function(
|
|
64274
|
-
|
|
64786
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
64787
|
+
resolve6(value);
|
|
64275
64788
|
});
|
|
64276
64789
|
}
|
|
64277
|
-
return new (P || (P = Promise))(function(
|
|
64790
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
64278
64791
|
function fulfilled(value) {
|
|
64279
64792
|
try {
|
|
64280
64793
|
step(generator.next(value));
|
|
@@ -64290,7 +64803,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
64290
64803
|
}
|
|
64291
64804
|
}
|
|
64292
64805
|
function step(result) {
|
|
64293
|
-
result.done ?
|
|
64806
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
64294
64807
|
}
|
|
64295
64808
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
64296
64809
|
});
|
|
@@ -64519,14 +65032,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
64519
65032
|
}, i);
|
|
64520
65033
|
function verb(n) {
|
|
64521
65034
|
i[n] = o[n] && function(v) {
|
|
64522
|
-
return new Promise(function(
|
|
64523
|
-
v = o[n](v), settle(
|
|
65035
|
+
return new Promise(function(resolve6, reject) {
|
|
65036
|
+
v = o[n](v), settle(resolve6, reject, v.done, v.value);
|
|
64524
65037
|
});
|
|
64525
65038
|
};
|
|
64526
65039
|
}
|
|
64527
|
-
function settle(
|
|
65040
|
+
function settle(resolve6, reject, d, v) {
|
|
64528
65041
|
Promise.resolve(v).then(function(v2) {
|
|
64529
|
-
|
|
65042
|
+
resolve6({ value: v2, done: d });
|
|
64530
65043
|
}, reject);
|
|
64531
65044
|
}
|
|
64532
65045
|
};
|
|
@@ -67765,12 +68278,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
67765
68278
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
67766
68279
|
var dns_1 = __require("dns");
|
|
67767
68280
|
function dnsLookup(host, opts) {
|
|
67768
|
-
return new Promise((
|
|
68281
|
+
return new Promise((resolve6, reject) => {
|
|
67769
68282
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
67770
68283
|
if (err) {
|
|
67771
68284
|
reject(err);
|
|
67772
68285
|
} else {
|
|
67773
|
-
|
|
68286
|
+
resolve6(res);
|
|
67774
68287
|
}
|
|
67775
68288
|
});
|
|
67776
68289
|
});
|
|
@@ -68344,10 +68857,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
68344
68857
|
var ip_1 = require_ip();
|
|
68345
68858
|
var net_1 = __importDefault(__require("net"));
|
|
68346
68859
|
async function myIpAddress() {
|
|
68347
|
-
return new Promise((
|
|
68860
|
+
return new Promise((resolve6, reject) => {
|
|
68348
68861
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
68349
68862
|
const onError = () => {
|
|
68350
|
-
|
|
68863
|
+
resolve6(ip_1.ip.address());
|
|
68351
68864
|
};
|
|
68352
68865
|
socket.once("error", onError);
|
|
68353
68866
|
socket.once("connect", () => {
|
|
@@ -68355,9 +68868,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
68355
68868
|
const addr = socket.address();
|
|
68356
68869
|
socket.destroy();
|
|
68357
68870
|
if (typeof addr === "string") {
|
|
68358
|
-
|
|
68871
|
+
resolve6(addr);
|
|
68359
68872
|
} else if (addr.address) {
|
|
68360
|
-
|
|
68873
|
+
resolve6(addr.address);
|
|
68361
68874
|
} else {
|
|
68362
68875
|
reject(new Error("Expected a `string`"));
|
|
68363
68876
|
}
|
|
@@ -68871,8 +69384,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
68871
69384
|
this.context = args.context;
|
|
68872
69385
|
this.owner = args.context.runtime;
|
|
68873
69386
|
this.handle = args.promiseHandle;
|
|
68874
|
-
this.settled = new Promise((
|
|
68875
|
-
this.onSettled =
|
|
69387
|
+
this.settled = new Promise((resolve6) => {
|
|
69388
|
+
this.onSettled = resolve6;
|
|
68876
69389
|
});
|
|
68877
69390
|
this.resolveHandle = args.resolveHandle;
|
|
68878
69391
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -69264,13 +69777,13 @@ var require_context = __commonJS((exports) => {
|
|
|
69264
69777
|
if (vmResolveResult.error) {
|
|
69265
69778
|
return Promise.resolve(vmResolveResult);
|
|
69266
69779
|
}
|
|
69267
|
-
return new Promise((
|
|
69780
|
+
return new Promise((resolve6) => {
|
|
69268
69781
|
lifetime_1.Scope.withScope((scope) => {
|
|
69269
69782
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
69270
|
-
|
|
69783
|
+
resolve6({ value: value && value.dup() });
|
|
69271
69784
|
}));
|
|
69272
69785
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
69273
|
-
|
|
69786
|
+
resolve6({ error: error && error.dup() });
|
|
69274
69787
|
}));
|
|
69275
69788
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
69276
69789
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -71384,13 +71897,13 @@ import * as http from "node:http";
|
|
|
71384
71897
|
import * as https from "node:https";
|
|
71385
71898
|
import { URL as URL2, urlToHttpOptions } from "node:url";
|
|
71386
71899
|
function headHttpRequest(url) {
|
|
71387
|
-
return new Promise((
|
|
71900
|
+
return new Promise((resolve6) => {
|
|
71388
71901
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
71389
71902
|
response.resume();
|
|
71390
|
-
|
|
71903
|
+
resolve6(response.statusCode === 200);
|
|
71391
71904
|
}, false);
|
|
71392
71905
|
request3.on("error", () => {
|
|
71393
|
-
|
|
71906
|
+
resolve6(false);
|
|
71394
71907
|
});
|
|
71395
71908
|
});
|
|
71396
71909
|
}
|
|
@@ -71418,7 +71931,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
71418
71931
|
return request3;
|
|
71419
71932
|
}
|
|
71420
71933
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
71421
|
-
return new Promise((
|
|
71934
|
+
return new Promise((resolve6, reject) => {
|
|
71422
71935
|
let downloadedBytes = 0;
|
|
71423
71936
|
let totalBytes = 0;
|
|
71424
71937
|
function onData(chunk) {
|
|
@@ -71434,7 +71947,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
71434
71947
|
}
|
|
71435
71948
|
const file = createWriteStream(destinationPath);
|
|
71436
71949
|
file.on("close", () => {
|
|
71437
|
-
return
|
|
71950
|
+
return resolve6();
|
|
71438
71951
|
});
|
|
71439
71952
|
file.on("error", (error) => {
|
|
71440
71953
|
return reject(error);
|
|
@@ -71459,7 +71972,7 @@ async function getJSON(url) {
|
|
|
71459
71972
|
}
|
|
71460
71973
|
}
|
|
71461
71974
|
function getText(url) {
|
|
71462
|
-
return new Promise((
|
|
71975
|
+
return new Promise((resolve6, reject) => {
|
|
71463
71976
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
71464
71977
|
let data = "";
|
|
71465
71978
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -71470,7 +71983,7 @@ function getText(url) {
|
|
|
71470
71983
|
});
|
|
71471
71984
|
response.on("end", () => {
|
|
71472
71985
|
try {
|
|
71473
|
-
return
|
|
71986
|
+
return resolve6(String(data));
|
|
71474
71987
|
} catch {
|
|
71475
71988
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
71476
71989
|
}
|
|
@@ -71490,8 +72003,8 @@ var init_httpUtil = __esm(() => {
|
|
|
71490
72003
|
import { execSync as execSync4 } from "node:child_process";
|
|
71491
72004
|
import os from "node:os";
|
|
71492
72005
|
import path from "node:path";
|
|
71493
|
-
function folder(
|
|
71494
|
-
switch (
|
|
72006
|
+
function folder(platform2) {
|
|
72007
|
+
switch (platform2) {
|
|
71495
72008
|
case BrowserPlatform.LINUX_ARM:
|
|
71496
72009
|
case BrowserPlatform.LINUX:
|
|
71497
72010
|
return "linux64";
|
|
@@ -71505,23 +72018,23 @@ function folder(platform) {
|
|
|
71505
72018
|
return "win64";
|
|
71506
72019
|
}
|
|
71507
72020
|
}
|
|
71508
|
-
function resolveDownloadUrl(
|
|
71509
|
-
return `${baseUrl}/${resolveDownloadPath(
|
|
72021
|
+
function resolveDownloadUrl(platform2, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
|
|
72022
|
+
return `${baseUrl}/${resolveDownloadPath(platform2, buildId).join("/")}`;
|
|
71510
72023
|
}
|
|
71511
|
-
function resolveDownloadPath(
|
|
71512
|
-
return [buildId, folder(
|
|
72024
|
+
function resolveDownloadPath(platform2, buildId) {
|
|
72025
|
+
return [buildId, folder(platform2), `chrome-${folder(platform2)}.zip`];
|
|
71513
72026
|
}
|
|
71514
|
-
function relativeExecutablePath(
|
|
71515
|
-
switch (
|
|
72027
|
+
function relativeExecutablePath(platform2, _buildId) {
|
|
72028
|
+
switch (platform2) {
|
|
71516
72029
|
case BrowserPlatform.MAC:
|
|
71517
72030
|
case BrowserPlatform.MAC_ARM:
|
|
71518
|
-
return path.join("chrome-" + folder(
|
|
72031
|
+
return path.join("chrome-" + folder(platform2), "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing");
|
|
71519
72032
|
case BrowserPlatform.LINUX_ARM:
|
|
71520
72033
|
case BrowserPlatform.LINUX:
|
|
71521
72034
|
return path.join("chrome-linux64", "chrome");
|
|
71522
72035
|
case BrowserPlatform.WIN32:
|
|
71523
72036
|
case BrowserPlatform.WIN64:
|
|
71524
|
-
return path.join("chrome-" + folder(
|
|
72037
|
+
return path.join("chrome-" + folder(platform2), "chrome.exe");
|
|
71525
72038
|
}
|
|
71526
72039
|
}
|
|
71527
72040
|
async function getLastKnownGoodReleaseForChannel(channel) {
|
|
@@ -71631,8 +72144,8 @@ function getChromeLinuxOrWslLocation(channel) {
|
|
|
71631
72144
|
} catch {}
|
|
71632
72145
|
return locations;
|
|
71633
72146
|
}
|
|
71634
|
-
function resolveSystemExecutablePaths(
|
|
71635
|
-
switch (
|
|
72147
|
+
function resolveSystemExecutablePaths(platform2, channel) {
|
|
72148
|
+
switch (platform2) {
|
|
71636
72149
|
case BrowserPlatform.WIN64:
|
|
71637
72150
|
case BrowserPlatform.WIN32:
|
|
71638
72151
|
const prefixLocation = new Set(WINDOWS_ENV_PARAM_NAMES.map((name) => {
|
|
@@ -71670,8 +72183,8 @@ function resolveSystemExecutablePaths(platform, channel) {
|
|
|
71670
72183
|
return getChromeLinuxOrWslLocation(channel);
|
|
71671
72184
|
}
|
|
71672
72185
|
}
|
|
71673
|
-
function resolveDefaultUserDataDir(
|
|
71674
|
-
switch (
|
|
72186
|
+
function resolveDefaultUserDataDir(platform2, channel) {
|
|
72187
|
+
switch (platform2) {
|
|
71675
72188
|
case BrowserPlatform.WIN64:
|
|
71676
72189
|
case BrowserPlatform.WIN32:
|
|
71677
72190
|
switch (channel) {
|
|
@@ -71749,8 +72262,8 @@ var init_chrome = __esm(() => {
|
|
|
71749
72262
|
|
|
71750
72263
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome-headless-shell.js
|
|
71751
72264
|
import path2 from "node:path";
|
|
71752
|
-
function folder2(
|
|
71753
|
-
switch (
|
|
72265
|
+
function folder2(platform2) {
|
|
72266
|
+
switch (platform2) {
|
|
71754
72267
|
case BrowserPlatform.LINUX_ARM:
|
|
71755
72268
|
case BrowserPlatform.LINUX:
|
|
71756
72269
|
return "linux64";
|
|
@@ -71764,27 +72277,27 @@ function folder2(platform) {
|
|
|
71764
72277
|
return "win64";
|
|
71765
72278
|
}
|
|
71766
72279
|
}
|
|
71767
|
-
function resolveDownloadUrl2(
|
|
71768
|
-
return `${baseUrl}/${resolveDownloadPath2(
|
|
72280
|
+
function resolveDownloadUrl2(platform2, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
|
|
72281
|
+
return `${baseUrl}/${resolveDownloadPath2(platform2, buildId).join("/")}`;
|
|
71769
72282
|
}
|
|
71770
|
-
function resolveDownloadPath2(
|
|
72283
|
+
function resolveDownloadPath2(platform2, buildId) {
|
|
71771
72284
|
return [
|
|
71772
72285
|
buildId,
|
|
71773
|
-
folder2(
|
|
71774
|
-
`chrome-headless-shell-${folder2(
|
|
72286
|
+
folder2(platform2),
|
|
72287
|
+
`chrome-headless-shell-${folder2(platform2)}.zip`
|
|
71775
72288
|
];
|
|
71776
72289
|
}
|
|
71777
|
-
function relativeExecutablePath2(
|
|
71778
|
-
switch (
|
|
72290
|
+
function relativeExecutablePath2(platform2, _buildId) {
|
|
72291
|
+
switch (platform2) {
|
|
71779
72292
|
case BrowserPlatform.MAC:
|
|
71780
72293
|
case BrowserPlatform.MAC_ARM:
|
|
71781
|
-
return path2.join("chrome-headless-shell-" + folder2(
|
|
72294
|
+
return path2.join("chrome-headless-shell-" + folder2(platform2), "chrome-headless-shell");
|
|
71782
72295
|
case BrowserPlatform.LINUX_ARM:
|
|
71783
72296
|
case BrowserPlatform.LINUX:
|
|
71784
72297
|
return path2.join("chrome-headless-shell-linux64", "chrome-headless-shell");
|
|
71785
72298
|
case BrowserPlatform.WIN32:
|
|
71786
72299
|
case BrowserPlatform.WIN64:
|
|
71787
|
-
return path2.join("chrome-headless-shell-" + folder2(
|
|
72300
|
+
return path2.join("chrome-headless-shell-" + folder2(platform2), "chrome-headless-shell.exe");
|
|
71788
72301
|
}
|
|
71789
72302
|
}
|
|
71790
72303
|
var init_chrome_headless_shell = __esm(() => {
|
|
@@ -71794,8 +72307,8 @@ var init_chrome_headless_shell = __esm(() => {
|
|
|
71794
72307
|
|
|
71795
72308
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chromedriver.js
|
|
71796
72309
|
import path3 from "node:path";
|
|
71797
|
-
function folder3(
|
|
71798
|
-
switch (
|
|
72310
|
+
function folder3(platform2) {
|
|
72311
|
+
switch (platform2) {
|
|
71799
72312
|
case BrowserPlatform.LINUX_ARM:
|
|
71800
72313
|
case BrowserPlatform.LINUX:
|
|
71801
72314
|
return "linux64";
|
|
@@ -71809,23 +72322,23 @@ function folder3(platform) {
|
|
|
71809
72322
|
return "win64";
|
|
71810
72323
|
}
|
|
71811
72324
|
}
|
|
71812
|
-
function resolveDownloadUrl3(
|
|
71813
|
-
return `${baseUrl}/${resolveDownloadPath3(
|
|
72325
|
+
function resolveDownloadUrl3(platform2, buildId, baseUrl = "https://storage.googleapis.com/chrome-for-testing-public") {
|
|
72326
|
+
return `${baseUrl}/${resolveDownloadPath3(platform2, buildId).join("/")}`;
|
|
71814
72327
|
}
|
|
71815
|
-
function resolveDownloadPath3(
|
|
71816
|
-
return [buildId, folder3(
|
|
72328
|
+
function resolveDownloadPath3(platform2, buildId) {
|
|
72329
|
+
return [buildId, folder3(platform2), `chromedriver-${folder3(platform2)}.zip`];
|
|
71817
72330
|
}
|
|
71818
|
-
function relativeExecutablePath3(
|
|
71819
|
-
switch (
|
|
72331
|
+
function relativeExecutablePath3(platform2, _buildId) {
|
|
72332
|
+
switch (platform2) {
|
|
71820
72333
|
case BrowserPlatform.MAC:
|
|
71821
72334
|
case BrowserPlatform.MAC_ARM:
|
|
71822
|
-
return path3.join("chromedriver-" + folder3(
|
|
72335
|
+
return path3.join("chromedriver-" + folder3(platform2), "chromedriver");
|
|
71823
72336
|
case BrowserPlatform.LINUX_ARM:
|
|
71824
72337
|
case BrowserPlatform.LINUX:
|
|
71825
72338
|
return path3.join("chromedriver-linux64", "chromedriver");
|
|
71826
72339
|
case BrowserPlatform.WIN32:
|
|
71827
72340
|
case BrowserPlatform.WIN64:
|
|
71828
|
-
return path3.join("chromedriver-" + folder3(
|
|
72341
|
+
return path3.join("chromedriver-" + folder3(platform2), "chromedriver.exe");
|
|
71829
72342
|
}
|
|
71830
72343
|
}
|
|
71831
72344
|
var init_chromedriver = __esm(() => {
|
|
@@ -71835,8 +72348,8 @@ var init_chromedriver = __esm(() => {
|
|
|
71835
72348
|
|
|
71836
72349
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chromium.js
|
|
71837
72350
|
import path4 from "node:path";
|
|
71838
|
-
function archive(
|
|
71839
|
-
switch (
|
|
72351
|
+
function archive(platform2, buildId) {
|
|
72352
|
+
switch (platform2) {
|
|
71840
72353
|
case BrowserPlatform.LINUX_ARM:
|
|
71841
72354
|
case BrowserPlatform.LINUX:
|
|
71842
72355
|
return "chrome-linux";
|
|
@@ -71848,8 +72361,8 @@ function archive(platform, buildId) {
|
|
|
71848
72361
|
return parseInt(buildId, 10) > 591479 ? "chrome-win" : "chrome-win32";
|
|
71849
72362
|
}
|
|
71850
72363
|
}
|
|
71851
|
-
function folder4(
|
|
71852
|
-
switch (
|
|
72364
|
+
function folder4(platform2) {
|
|
72365
|
+
switch (platform2) {
|
|
71853
72366
|
case BrowserPlatform.LINUX_ARM:
|
|
71854
72367
|
case BrowserPlatform.LINUX:
|
|
71855
72368
|
return "Linux_x64";
|
|
@@ -71863,14 +72376,14 @@ function folder4(platform) {
|
|
|
71863
72376
|
return "Win_x64";
|
|
71864
72377
|
}
|
|
71865
72378
|
}
|
|
71866
|
-
function resolveDownloadUrl4(
|
|
71867
|
-
return `${baseUrl}/${resolveDownloadPath4(
|
|
72379
|
+
function resolveDownloadUrl4(platform2, buildId, baseUrl = "https://storage.googleapis.com/chromium-browser-snapshots") {
|
|
72380
|
+
return `${baseUrl}/${resolveDownloadPath4(platform2, buildId).join("/")}`;
|
|
71868
72381
|
}
|
|
71869
|
-
function resolveDownloadPath4(
|
|
71870
|
-
return [folder4(
|
|
72382
|
+
function resolveDownloadPath4(platform2, buildId) {
|
|
72383
|
+
return [folder4(platform2), buildId, `${archive(platform2, buildId)}.zip`];
|
|
71871
72384
|
}
|
|
71872
|
-
function relativeExecutablePath4(
|
|
71873
|
-
switch (
|
|
72385
|
+
function relativeExecutablePath4(platform2, _buildId) {
|
|
72386
|
+
switch (platform2) {
|
|
71874
72387
|
case BrowserPlatform.MAC:
|
|
71875
72388
|
case BrowserPlatform.MAC_ARM:
|
|
71876
72389
|
return path4.join("chrome-mac", "Chromium.app", "Contents", "MacOS", "Chromium");
|
|
@@ -71882,8 +72395,8 @@ function relativeExecutablePath4(platform, _buildId) {
|
|
|
71882
72395
|
return path4.join("chrome-win", "chrome.exe");
|
|
71883
72396
|
}
|
|
71884
72397
|
}
|
|
71885
|
-
async function resolveBuildId2(
|
|
71886
|
-
return await getText(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder4(
|
|
72398
|
+
async function resolveBuildId2(platform2) {
|
|
72399
|
+
return await getText(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder4(platform2)}/LAST_CHANGE`));
|
|
71887
72400
|
}
|
|
71888
72401
|
function compareVersions2(a, b) {
|
|
71889
72402
|
return Number(a) - Number(b);
|
|
@@ -71900,8 +72413,8 @@ function getFormat(buildId) {
|
|
|
71900
72413
|
const majorVersion = Number(buildId.split(".").shift());
|
|
71901
72414
|
return majorVersion >= 135 ? "xz" : "bz2";
|
|
71902
72415
|
}
|
|
71903
|
-
function archiveNightly(
|
|
71904
|
-
switch (
|
|
72416
|
+
function archiveNightly(platform2, buildId) {
|
|
72417
|
+
switch (platform2) {
|
|
71905
72418
|
case BrowserPlatform.LINUX:
|
|
71906
72419
|
return `firefox-${buildId}.en-US.linux-x86_64.tar.${getFormat(buildId)}`;
|
|
71907
72420
|
case BrowserPlatform.LINUX_ARM:
|
|
@@ -71911,11 +72424,11 @@ function archiveNightly(platform, buildId) {
|
|
|
71911
72424
|
return `firefox-${buildId}.en-US.mac.dmg`;
|
|
71912
72425
|
case BrowserPlatform.WIN32:
|
|
71913
72426
|
case BrowserPlatform.WIN64:
|
|
71914
|
-
return `firefox-${buildId}.en-US.${
|
|
72427
|
+
return `firefox-${buildId}.en-US.${platform2}.zip`;
|
|
71915
72428
|
}
|
|
71916
72429
|
}
|
|
71917
|
-
function archive2(
|
|
71918
|
-
switch (
|
|
72430
|
+
function archive2(platform2, buildId) {
|
|
72431
|
+
switch (platform2) {
|
|
71919
72432
|
case BrowserPlatform.LINUX_ARM:
|
|
71920
72433
|
case BrowserPlatform.LINUX:
|
|
71921
72434
|
return `firefox-${buildId}.tar.${getFormat(buildId)}`;
|
|
@@ -71927,8 +72440,8 @@ function archive2(platform, buildId) {
|
|
|
71927
72440
|
return `Firefox Setup ${buildId}.exe`;
|
|
71928
72441
|
}
|
|
71929
72442
|
}
|
|
71930
|
-
function platformName(
|
|
71931
|
-
switch (
|
|
72443
|
+
function platformName(platform2) {
|
|
72444
|
+
switch (platform2) {
|
|
71932
72445
|
case BrowserPlatform.LINUX:
|
|
71933
72446
|
return `linux-x86_64`;
|
|
71934
72447
|
case BrowserPlatform.LINUX_ARM:
|
|
@@ -71938,7 +72451,7 @@ function platformName(platform) {
|
|
|
71938
72451
|
return `mac`;
|
|
71939
72452
|
case BrowserPlatform.WIN32:
|
|
71940
72453
|
case BrowserPlatform.WIN64:
|
|
71941
|
-
return
|
|
72454
|
+
return platform2;
|
|
71942
72455
|
}
|
|
71943
72456
|
}
|
|
71944
72457
|
function parseBuildId(buildId) {
|
|
@@ -71950,7 +72463,7 @@ function parseBuildId(buildId) {
|
|
|
71950
72463
|
}
|
|
71951
72464
|
return [FirefoxChannel.NIGHTLY, buildId];
|
|
71952
72465
|
}
|
|
71953
|
-
function resolveDownloadUrl5(
|
|
72466
|
+
function resolveDownloadUrl5(platform2, buildId, baseUrl) {
|
|
71954
72467
|
const [channel] = parseBuildId(buildId);
|
|
71955
72468
|
switch (channel) {
|
|
71956
72469
|
case FirefoxChannel.NIGHTLY:
|
|
@@ -71965,30 +72478,30 @@ function resolveDownloadUrl5(platform, buildId, baseUrl) {
|
|
|
71965
72478
|
baseUrl ??= "https://archive.mozilla.org/pub/firefox/releases";
|
|
71966
72479
|
break;
|
|
71967
72480
|
}
|
|
71968
|
-
return `${baseUrl}/${resolveDownloadPath5(
|
|
72481
|
+
return `${baseUrl}/${resolveDownloadPath5(platform2, buildId).join("/")}`;
|
|
71969
72482
|
}
|
|
71970
|
-
function resolveDownloadPath5(
|
|
72483
|
+
function resolveDownloadPath5(platform2, buildId) {
|
|
71971
72484
|
const [channel, resolvedBuildId] = parseBuildId(buildId);
|
|
71972
72485
|
switch (channel) {
|
|
71973
72486
|
case FirefoxChannel.NIGHTLY:
|
|
71974
|
-
return [archiveNightly(
|
|
72487
|
+
return [archiveNightly(platform2, resolvedBuildId)];
|
|
71975
72488
|
case FirefoxChannel.DEVEDITION:
|
|
71976
72489
|
case FirefoxChannel.BETA:
|
|
71977
72490
|
case FirefoxChannel.STABLE:
|
|
71978
72491
|
case FirefoxChannel.ESR:
|
|
71979
72492
|
return [
|
|
71980
72493
|
resolvedBuildId,
|
|
71981
|
-
platformName(
|
|
72494
|
+
platformName(platform2),
|
|
71982
72495
|
"en-US",
|
|
71983
|
-
archive2(
|
|
72496
|
+
archive2(platform2, resolvedBuildId)
|
|
71984
72497
|
];
|
|
71985
72498
|
}
|
|
71986
72499
|
}
|
|
71987
|
-
function relativeExecutablePath5(
|
|
72500
|
+
function relativeExecutablePath5(platform2, buildId) {
|
|
71988
72501
|
const [channel] = parseBuildId(buildId);
|
|
71989
72502
|
switch (channel) {
|
|
71990
72503
|
case FirefoxChannel.NIGHTLY:
|
|
71991
|
-
switch (
|
|
72504
|
+
switch (platform2) {
|
|
71992
72505
|
case BrowserPlatform.MAC_ARM:
|
|
71993
72506
|
case BrowserPlatform.MAC:
|
|
71994
72507
|
return path5.join("Firefox Nightly.app", "Contents", "MacOS", "firefox");
|
|
@@ -72003,7 +72516,7 @@ function relativeExecutablePath5(platform, buildId) {
|
|
|
72003
72516
|
case FirefoxChannel.DEVEDITION:
|
|
72004
72517
|
case FirefoxChannel.ESR:
|
|
72005
72518
|
case FirefoxChannel.STABLE:
|
|
72006
|
-
switch (
|
|
72519
|
+
switch (platform2) {
|
|
72007
72520
|
case BrowserPlatform.MAC_ARM:
|
|
72008
72521
|
case BrowserPlatform.MAC:
|
|
72009
72522
|
return path5.join("Firefox.app", "Contents", "MacOS", "firefox");
|
|
@@ -72168,7 +72681,7 @@ var init_firefox = __esm(() => {
|
|
|
72168
72681
|
});
|
|
72169
72682
|
|
|
72170
72683
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/browser-data.js
|
|
72171
|
-
async function resolveBuildIdForBrowserTag(browser,
|
|
72684
|
+
async function resolveBuildIdForBrowserTag(browser, platform2, tag) {
|
|
72172
72685
|
switch (browser) {
|
|
72173
72686
|
case Browser6.FIREFOX:
|
|
72174
72687
|
switch (tag) {
|
|
@@ -72243,7 +72756,7 @@ async function resolveBuildIdForBrowserTag(browser, platform, tag) {
|
|
|
72243
72756
|
case Browser6.CHROMIUM:
|
|
72244
72757
|
switch (tag) {
|
|
72245
72758
|
case BrowserTag.LATEST:
|
|
72246
|
-
return await resolveBuildId2(
|
|
72759
|
+
return await resolveBuildId2(platform2);
|
|
72247
72760
|
case BrowserTag.NIGHTLY:
|
|
72248
72761
|
case BrowserTag.CANARY:
|
|
72249
72762
|
case BrowserTag.DEV:
|
|
@@ -72255,10 +72768,10 @@ async function resolveBuildIdForBrowserTag(browser, platform, tag) {
|
|
|
72255
72768
|
}
|
|
72256
72769
|
}
|
|
72257
72770
|
}
|
|
72258
|
-
async function resolveBuildId4(browser,
|
|
72771
|
+
async function resolveBuildId4(browser, platform2, tag) {
|
|
72259
72772
|
const browserTag = tag;
|
|
72260
72773
|
if (Object.values(BrowserTag).includes(browserTag)) {
|
|
72261
|
-
return await resolveBuildIdForBrowserTag(browser,
|
|
72774
|
+
return await resolveBuildIdForBrowserTag(browser, platform2, browserTag);
|
|
72262
72775
|
}
|
|
72263
72776
|
switch (browser) {
|
|
72264
72777
|
case Browser6.FIREFOX:
|
|
@@ -72294,7 +72807,7 @@ async function createProfile2(browser, opts) {
|
|
|
72294
72807
|
throw new Error(`Profile creation is not support for ${browser} yet`);
|
|
72295
72808
|
}
|
|
72296
72809
|
}
|
|
72297
|
-
function resolveDefaultUserDataDir2(browser,
|
|
72810
|
+
function resolveDefaultUserDataDir2(browser, platform2, channel) {
|
|
72298
72811
|
switch (browser) {
|
|
72299
72812
|
case Browser6.CHROMEDRIVER:
|
|
72300
72813
|
case Browser6.CHROMEHEADLESSSHELL:
|
|
@@ -72302,10 +72815,10 @@ function resolveDefaultUserDataDir2(browser, platform, channel) {
|
|
|
72302
72815
|
case Browser6.CHROMIUM:
|
|
72303
72816
|
throw new Error(`Default user dir detection is not supported for ${browser} yet.`);
|
|
72304
72817
|
case Browser6.CHROME:
|
|
72305
|
-
return resolveDefaultUserDataDir(
|
|
72818
|
+
return resolveDefaultUserDataDir(platform2, channel);
|
|
72306
72819
|
}
|
|
72307
72820
|
}
|
|
72308
|
-
function resolveSystemExecutablePaths2(browser,
|
|
72821
|
+
function resolveSystemExecutablePaths2(browser, platform2, channel) {
|
|
72309
72822
|
switch (browser) {
|
|
72310
72823
|
case Browser6.CHROMEDRIVER:
|
|
72311
72824
|
case Browser6.CHROMEHEADLESSSHELL:
|
|
@@ -72313,7 +72826,7 @@ function resolveSystemExecutablePaths2(browser, platform, channel) {
|
|
|
72313
72826
|
case Browser6.CHROMIUM:
|
|
72314
72827
|
throw new Error(`System browser detection is not supported for ${browser} yet.`);
|
|
72315
72828
|
case Browser6.CHROME:
|
|
72316
|
-
return resolveSystemExecutablePaths(
|
|
72829
|
+
return resolveSystemExecutablePaths(platform2, channel);
|
|
72317
72830
|
}
|
|
72318
72831
|
}
|
|
72319
72832
|
function getVersionComparator(browser) {
|
|
@@ -72360,9 +72873,9 @@ var init_browser_data = __esm(() => {
|
|
|
72360
72873
|
// node_modules/@puppeteer/browsers/lib/esm/detectPlatform.js
|
|
72361
72874
|
import os2 from "node:os";
|
|
72362
72875
|
function detectBrowserPlatform() {
|
|
72363
|
-
const
|
|
72876
|
+
const platform2 = os2.platform();
|
|
72364
72877
|
const arch = os2.arch();
|
|
72365
|
-
switch (
|
|
72878
|
+
switch (platform2) {
|
|
72366
72879
|
case "darwin":
|
|
72367
72880
|
return arch === "arm64" ? BrowserPlatform.MAC_ARM : BrowserPlatform.MAC;
|
|
72368
72881
|
case "linux":
|
|
@@ -72398,15 +72911,15 @@ class InstalledBrowser {
|
|
|
72398
72911
|
platform;
|
|
72399
72912
|
executablePath;
|
|
72400
72913
|
#cache;
|
|
72401
|
-
constructor(cache, browser, buildId,
|
|
72914
|
+
constructor(cache, browser, buildId, platform2) {
|
|
72402
72915
|
this.#cache = cache;
|
|
72403
72916
|
this.browser = browser;
|
|
72404
72917
|
this.buildId = buildId;
|
|
72405
|
-
this.platform =
|
|
72918
|
+
this.platform = platform2;
|
|
72406
72919
|
this.executablePath = cache.computeExecutablePath({
|
|
72407
72920
|
browser,
|
|
72408
72921
|
buildId,
|
|
72409
|
-
platform
|
|
72922
|
+
platform: platform2
|
|
72410
72923
|
});
|
|
72411
72924
|
}
|
|
72412
72925
|
get path() {
|
|
@@ -72450,17 +72963,17 @@ class Cache {
|
|
|
72450
72963
|
fs2.mkdirSync(path6.dirname(metatadaPath), { recursive: true });
|
|
72451
72964
|
fs2.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
|
|
72452
72965
|
}
|
|
72453
|
-
readExecutablePath(browser,
|
|
72966
|
+
readExecutablePath(browser, platform2, buildId) {
|
|
72454
72967
|
const metadata = this.readMetadata(browser);
|
|
72455
|
-
const key = `${
|
|
72968
|
+
const key = `${platform2}-${buildId}`;
|
|
72456
72969
|
return metadata.executablePaths?.[key] ?? null;
|
|
72457
72970
|
}
|
|
72458
|
-
writeExecutablePath(browser,
|
|
72971
|
+
writeExecutablePath(browser, platform2, buildId, executablePath) {
|
|
72459
72972
|
const metadata = this.readMetadata(browser);
|
|
72460
72973
|
if (!metadata.executablePaths) {
|
|
72461
72974
|
metadata.executablePaths = {};
|
|
72462
72975
|
}
|
|
72463
|
-
const key = `${
|
|
72976
|
+
const key = `${platform2}-${buildId}`;
|
|
72464
72977
|
metadata.executablePaths[key] = executablePath;
|
|
72465
72978
|
this.writeMetadata(browser, metadata);
|
|
72466
72979
|
}
|
|
@@ -72471,8 +72984,8 @@ class Cache {
|
|
|
72471
72984
|
}
|
|
72472
72985
|
return metadata.aliases[alias];
|
|
72473
72986
|
}
|
|
72474
|
-
installationDir(browser,
|
|
72475
|
-
return path6.join(this.browserRoot(browser), `${
|
|
72987
|
+
installationDir(browser, platform2, buildId) {
|
|
72988
|
+
return path6.join(this.browserRoot(browser), `${platform2}-${buildId}`);
|
|
72476
72989
|
}
|
|
72477
72990
|
clear() {
|
|
72478
72991
|
fs2.rmSync(this.#rootDir, {
|
|
@@ -72482,19 +72995,19 @@ class Cache {
|
|
|
72482
72995
|
retryDelay: 500
|
|
72483
72996
|
});
|
|
72484
72997
|
}
|
|
72485
|
-
uninstall(browser,
|
|
72998
|
+
uninstall(browser, platform2, buildId) {
|
|
72486
72999
|
const metadata = this.readMetadata(browser);
|
|
72487
73000
|
for (const alias of Object.keys(metadata.aliases)) {
|
|
72488
73001
|
if (metadata.aliases[alias] === buildId) {
|
|
72489
73002
|
delete metadata.aliases[alias];
|
|
72490
73003
|
}
|
|
72491
73004
|
}
|
|
72492
|
-
const key = `${
|
|
73005
|
+
const key = `${platform2}-${buildId}`;
|
|
72493
73006
|
if (metadata.executablePaths?.[key]) {
|
|
72494
73007
|
delete metadata.executablePaths[key];
|
|
72495
73008
|
this.writeMetadata(browser, metadata);
|
|
72496
73009
|
}
|
|
72497
|
-
fs2.rmSync(this.installationDir(browser,
|
|
73010
|
+
fs2.rmSync(this.installationDir(browser, platform2, buildId), {
|
|
72498
73011
|
force: true,
|
|
72499
73012
|
recursive: true,
|
|
72500
73013
|
maxRetries: 10,
|
|
@@ -72546,11 +73059,11 @@ function parseFolderPath(folderPath) {
|
|
|
72546
73059
|
if (splits.length !== 2) {
|
|
72547
73060
|
return;
|
|
72548
73061
|
}
|
|
72549
|
-
const [
|
|
72550
|
-
if (!buildId || !
|
|
73062
|
+
const [platform2, buildId] = splits;
|
|
73063
|
+
if (!buildId || !platform2) {
|
|
72551
73064
|
return;
|
|
72552
73065
|
}
|
|
72553
|
-
return { platform, buildId };
|
|
73066
|
+
return { platform: platform2, buildId };
|
|
72554
73067
|
}
|
|
72555
73068
|
var import_debug, debugCache;
|
|
72556
73069
|
var init_Cache = __esm(() => {
|
|
@@ -72691,7 +73204,7 @@ class Process {
|
|
|
72691
73204
|
if (opts.onExit) {
|
|
72692
73205
|
this.#onExitHook = opts.onExit;
|
|
72693
73206
|
}
|
|
72694
|
-
this.#browserProcessExiting = new Promise((
|
|
73207
|
+
this.#browserProcessExiting = new Promise((resolve6, reject) => {
|
|
72695
73208
|
this.#browserProcess.once("exit", async () => {
|
|
72696
73209
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
72697
73210
|
this.#clearListeners();
|
|
@@ -72702,7 +73215,7 @@ class Process {
|
|
|
72702
73215
|
reject(err);
|
|
72703
73216
|
return;
|
|
72704
73217
|
}
|
|
72705
|
-
|
|
73218
|
+
resolve6();
|
|
72706
73219
|
});
|
|
72707
73220
|
});
|
|
72708
73221
|
}
|
|
@@ -72812,7 +73325,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
72812
73325
|
return [...this.#logs];
|
|
72813
73326
|
}
|
|
72814
73327
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
72815
|
-
return new Promise((
|
|
73328
|
+
return new Promise((resolve6, reject) => {
|
|
72816
73329
|
const onClose = (errorOrCode) => {
|
|
72817
73330
|
cleanup();
|
|
72818
73331
|
reject(new Error([
|
|
@@ -72850,7 +73363,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
72850
73363
|
return;
|
|
72851
73364
|
}
|
|
72852
73365
|
cleanup();
|
|
72853
|
-
|
|
73366
|
+
resolve6(match[1]);
|
|
72854
73367
|
}
|
|
72855
73368
|
});
|
|
72856
73369
|
}
|
|
@@ -73053,8 +73566,8 @@ class DefaultProvider {
|
|
|
73053
73566
|
getDownloadUrl(options) {
|
|
73054
73567
|
return this.#getDownloadUrl(options.browser, options.platform, options.buildId);
|
|
73055
73568
|
}
|
|
73056
|
-
#getDownloadUrl(browser,
|
|
73057
|
-
return new URL(downloadUrls[browser](
|
|
73569
|
+
#getDownloadUrl(browser, platform2, buildId) {
|
|
73570
|
+
return new URL(downloadUrls[browser](platform2, buildId, this.#baseUrl));
|
|
73058
73571
|
}
|
|
73059
73572
|
getExecutablePath(options) {
|
|
73060
73573
|
return executablePathByBrowser[options.browser](options.platform, options.buildId);
|
|
@@ -73380,7 +73893,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
73380
73893
|
};
|
|
73381
73894
|
const { maxBuffer } = options;
|
|
73382
73895
|
let stream;
|
|
73383
|
-
await new Promise((
|
|
73896
|
+
await new Promise((resolve6, reject) => {
|
|
73384
73897
|
const rejectPromise = (error) => {
|
|
73385
73898
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
73386
73899
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -73392,7 +73905,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
73392
73905
|
rejectPromise(error);
|
|
73393
73906
|
return;
|
|
73394
73907
|
}
|
|
73395
|
-
|
|
73908
|
+
resolve6();
|
|
73396
73909
|
});
|
|
73397
73910
|
stream.on("data", () => {
|
|
73398
73911
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -74753,7 +75266,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
74753
75266
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
74754
75267
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
74755
75268
|
this.canceled = false;
|
|
74756
|
-
return new Promise((
|
|
75269
|
+
return new Promise((resolve6, reject) => {
|
|
74757
75270
|
this.zipfile.on("error", (err) => {
|
|
74758
75271
|
this.canceled = true;
|
|
74759
75272
|
reject(err);
|
|
@@ -74762,7 +75275,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
74762
75275
|
this.zipfile.on("close", () => {
|
|
74763
75276
|
if (!this.canceled) {
|
|
74764
75277
|
debug4("zip extraction complete");
|
|
74765
|
-
|
|
75278
|
+
resolve6();
|
|
74766
75279
|
}
|
|
74767
75280
|
});
|
|
74768
75281
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -76104,8 +76617,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76104
76617
|
return this;
|
|
76105
76618
|
},
|
|
76106
76619
|
next() {
|
|
76107
|
-
return new Promise(function(
|
|
76108
|
-
promiseResolve =
|
|
76620
|
+
return new Promise(function(resolve6, reject) {
|
|
76621
|
+
promiseResolve = resolve6;
|
|
76109
76622
|
promiseReject = reject;
|
|
76110
76623
|
const data = stream.read();
|
|
76111
76624
|
if (data !== null)
|
|
@@ -76142,14 +76655,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76142
76655
|
}
|
|
76143
76656
|
function destroy(err) {
|
|
76144
76657
|
stream.destroy(err);
|
|
76145
|
-
return new Promise((
|
|
76658
|
+
return new Promise((resolve6, reject) => {
|
|
76146
76659
|
if (stream._duplexState & DESTROYED)
|
|
76147
|
-
return
|
|
76660
|
+
return resolve6({ value: undefined, done: true });
|
|
76148
76661
|
stream.once("close", function() {
|
|
76149
76662
|
if (err)
|
|
76150
76663
|
reject(err);
|
|
76151
76664
|
else
|
|
76152
|
-
|
|
76665
|
+
resolve6({ value: undefined, done: true });
|
|
76153
76666
|
});
|
|
76154
76667
|
});
|
|
76155
76668
|
}
|
|
@@ -76201,8 +76714,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76201
76714
|
return Promise.resolve(true);
|
|
76202
76715
|
if (state.drains === null)
|
|
76203
76716
|
state.drains = [];
|
|
76204
|
-
return new Promise((
|
|
76205
|
-
state.drains.push({ writes, resolve:
|
|
76717
|
+
return new Promise((resolve6) => {
|
|
76718
|
+
state.drains.push({ writes, resolve: resolve6 });
|
|
76206
76719
|
});
|
|
76207
76720
|
}
|
|
76208
76721
|
write(data) {
|
|
@@ -76316,11 +76829,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76316
76829
|
cb(null);
|
|
76317
76830
|
}
|
|
76318
76831
|
function pipelinePromise(...streams) {
|
|
76319
|
-
return new Promise((
|
|
76832
|
+
return new Promise((resolve6, reject) => {
|
|
76320
76833
|
return pipeline(...streams, (err) => {
|
|
76321
76834
|
if (err)
|
|
76322
76835
|
return reject(err);
|
|
76323
|
-
|
|
76836
|
+
resolve6();
|
|
76324
76837
|
});
|
|
76325
76838
|
});
|
|
76326
76839
|
}
|
|
@@ -77034,16 +77547,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
77034
77547
|
entryCallback = null;
|
|
77035
77548
|
cb(err);
|
|
77036
77549
|
}
|
|
77037
|
-
function onnext(
|
|
77550
|
+
function onnext(resolve6, reject) {
|
|
77038
77551
|
if (error) {
|
|
77039
77552
|
return reject(error);
|
|
77040
77553
|
}
|
|
77041
77554
|
if (entryStream) {
|
|
77042
|
-
|
|
77555
|
+
resolve6({ value: entryStream, done: false });
|
|
77043
77556
|
entryStream = null;
|
|
77044
77557
|
return;
|
|
77045
77558
|
}
|
|
77046
|
-
promiseResolve =
|
|
77559
|
+
promiseResolve = resolve6;
|
|
77047
77560
|
promiseReject = reject;
|
|
77048
77561
|
consumeCallback(null);
|
|
77049
77562
|
if (extract._finished && promiseResolve) {
|
|
@@ -77074,14 +77587,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
77074
77587
|
function destroy(err) {
|
|
77075
77588
|
extract.destroy(err);
|
|
77076
77589
|
consumeCallback(err);
|
|
77077
|
-
return new Promise((
|
|
77590
|
+
return new Promise((resolve6, reject) => {
|
|
77078
77591
|
if (extract.destroyed)
|
|
77079
|
-
return
|
|
77592
|
+
return resolve6({ value: undefined, done: true });
|
|
77080
77593
|
extract.once("close", function() {
|
|
77081
77594
|
if (err)
|
|
77082
77595
|
reject(err);
|
|
77083
77596
|
else
|
|
77084
|
-
|
|
77597
|
+
resolve6({ value: undefined, done: true });
|
|
77085
77598
|
});
|
|
77086
77599
|
});
|
|
77087
77600
|
}
|
|
@@ -77879,7 +78392,7 @@ var init_fileUtil = __esm(() => {
|
|
|
77879
78392
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
77880
78393
|
import assert2 from "node:assert";
|
|
77881
78394
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
77882
|
-
import { existsSync as
|
|
78395
|
+
import { existsSync as existsSync20, readFileSync as readFileSync20 } from "node:fs";
|
|
77883
78396
|
import { mkdir as mkdir2, unlink } from "node:fs/promises";
|
|
77884
78397
|
import os5 from "node:os";
|
|
77885
78398
|
import path8 from "node:path";
|
|
@@ -77932,7 +78445,7 @@ async function installWithProviders(options) {
|
|
|
77932
78445
|
continue;
|
|
77933
78446
|
}
|
|
77934
78447
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
77935
|
-
if (!
|
|
78448
|
+
if (!existsSync20(browserRoot)) {
|
|
77936
78449
|
await mkdir2(browserRoot, { recursive: true });
|
|
77937
78450
|
}
|
|
77938
78451
|
return await installUrl(url, options, provider);
|
|
@@ -77965,11 +78478,11 @@ async function installDeps(installedBrowser) {
|
|
|
77965
78478
|
return;
|
|
77966
78479
|
}
|
|
77967
78480
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
77968
|
-
if (!
|
|
78481
|
+
if (!existsSync20(depsPath)) {
|
|
77969
78482
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
77970
78483
|
return;
|
|
77971
78484
|
}
|
|
77972
|
-
const data =
|
|
78485
|
+
const data = readFileSync20(depsPath, "utf-8").split(`
|
|
77973
78486
|
`).join(",");
|
|
77974
78487
|
if (process.getuid?.() !== 0) {
|
|
77975
78488
|
throw new Error("Installing system dependencies requires root privileges");
|
|
@@ -78007,11 +78520,11 @@ async function installUrl(url, options, provider) {
|
|
|
78007
78520
|
const cache = new Cache(options.cacheDir);
|
|
78008
78521
|
const browserRoot = cache.browserRoot(options.browser);
|
|
78009
78522
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
78010
|
-
if (!
|
|
78523
|
+
if (!existsSync20(browserRoot)) {
|
|
78011
78524
|
await mkdir2(browserRoot, { recursive: true });
|
|
78012
78525
|
}
|
|
78013
78526
|
if (!options.unpack) {
|
|
78014
|
-
if (
|
|
78527
|
+
if (existsSync20(archivePath)) {
|
|
78015
78528
|
return archivePath;
|
|
78016
78529
|
}
|
|
78017
78530
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -78032,8 +78545,8 @@ async function installUrl(url, options, provider) {
|
|
|
78032
78545
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
78033
78546
|
}
|
|
78034
78547
|
try {
|
|
78035
|
-
if (
|
|
78036
|
-
if (!
|
|
78548
|
+
if (existsSync20(outputPath)) {
|
|
78549
|
+
if (!existsSync20(installedBrowser.executablePath)) {
|
|
78037
78550
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
78038
78551
|
}
|
|
78039
78552
|
await runSetup(installedBrowser);
|
|
@@ -78042,7 +78555,7 @@ async function installUrl(url, options, provider) {
|
|
|
78042
78555
|
}
|
|
78043
78556
|
return installedBrowser;
|
|
78044
78557
|
}
|
|
78045
|
-
if (!
|
|
78558
|
+
if (!existsSync20(archivePath)) {
|
|
78046
78559
|
debugInstall(`Downloading binary from ${url}`);
|
|
78047
78560
|
try {
|
|
78048
78561
|
debugTime("download");
|
|
@@ -78071,7 +78584,7 @@ async function installUrl(url, options, provider) {
|
|
|
78071
78584
|
}
|
|
78072
78585
|
return installedBrowser;
|
|
78073
78586
|
} finally {
|
|
78074
|
-
if (
|
|
78587
|
+
if (existsSync20(archivePath)) {
|
|
78075
78588
|
await unlink(archivePath);
|
|
78076
78589
|
}
|
|
78077
78590
|
}
|
|
@@ -78082,7 +78595,7 @@ async function runSetup(installedBrowser) {
|
|
|
78082
78595
|
debugTime("permissions");
|
|
78083
78596
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
78084
78597
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
78085
|
-
if (!
|
|
78598
|
+
if (!existsSync20(setupExePath)) {
|
|
78086
78599
|
return;
|
|
78087
78600
|
}
|
|
78088
78601
|
spawnSync2(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
@@ -78128,8 +78641,8 @@ async function canDownload(options) {
|
|
|
78128
78641
|
}
|
|
78129
78642
|
return false;
|
|
78130
78643
|
}
|
|
78131
|
-
function getDownloadUrl(browser,
|
|
78132
|
-
return new URL(downloadUrls[browser](
|
|
78644
|
+
function getDownloadUrl(browser, platform2, buildId, baseUrl) {
|
|
78645
|
+
return new URL(downloadUrls[browser](platform2, buildId, baseUrl));
|
|
78133
78646
|
}
|
|
78134
78647
|
function makeProgressCallback(browser, buildId) {
|
|
78135
78648
|
let progressBar;
|
|
@@ -78463,24 +78976,24 @@ var init_cliui = __esm(() => {
|
|
|
78463
78976
|
});
|
|
78464
78977
|
|
|
78465
78978
|
// node_modules/escalade/sync/index.mjs
|
|
78466
|
-
import { dirname as
|
|
78979
|
+
import { dirname as dirname9, resolve as resolve7 } from "path";
|
|
78467
78980
|
import { readdirSync as readdirSync6, statSync as statSync9 } from "fs";
|
|
78468
78981
|
function sync_default(start, callback) {
|
|
78469
|
-
let dir =
|
|
78982
|
+
let dir = resolve7(".", start);
|
|
78470
78983
|
let tmp, stats = statSync9(dir);
|
|
78471
78984
|
if (!stats.isDirectory()) {
|
|
78472
|
-
dir =
|
|
78985
|
+
dir = dirname9(dir);
|
|
78473
78986
|
}
|
|
78474
78987
|
while (true) {
|
|
78475
78988
|
tmp = callback(dir, readdirSync6(dir));
|
|
78476
78989
|
if (tmp)
|
|
78477
|
-
return
|
|
78478
|
-
dir =
|
|
78990
|
+
return resolve7(dir, tmp);
|
|
78991
|
+
dir = dirname9(tmp = dir);
|
|
78479
78992
|
if (tmp === dir)
|
|
78480
78993
|
break;
|
|
78481
78994
|
}
|
|
78482
78995
|
}
|
|
78483
|
-
var
|
|
78996
|
+
var init_sync2 = () => {};
|
|
78484
78997
|
|
|
78485
78998
|
// node_modules/yargs-parser/build/lib/string-utils.js
|
|
78486
78999
|
function camelCase(str) {
|
|
@@ -79421,7 +79934,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
79421
79934
|
|
|
79422
79935
|
// node_modules/yargs-parser/build/lib/index.js
|
|
79423
79936
|
import { format } from "util";
|
|
79424
|
-
import { normalize, resolve as
|
|
79937
|
+
import { normalize, resolve as resolve8 } from "path";
|
|
79425
79938
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
79426
79939
|
const result = parser.parse(args.slice(), opts);
|
|
79427
79940
|
return result.argv;
|
|
@@ -79444,7 +79957,7 @@ var init_lib2 = __esm(() => {
|
|
|
79444
79957
|
},
|
|
79445
79958
|
format,
|
|
79446
79959
|
normalize,
|
|
79447
|
-
resolve:
|
|
79960
|
+
resolve: resolve8,
|
|
79448
79961
|
require: (path9) => {
|
|
79449
79962
|
if (true) {
|
|
79450
79963
|
return __require(path9);
|
|
@@ -79495,18 +80008,18 @@ var init_yerror = __esm(() => {
|
|
|
79495
80008
|
});
|
|
79496
80009
|
|
|
79497
80010
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
79498
|
-
import { readFileSync as
|
|
80011
|
+
import { readFileSync as readFileSync21, statSync as statSync10, writeFile } from "fs";
|
|
79499
80012
|
import { format as format2 } from "util";
|
|
79500
|
-
import { resolve as
|
|
80013
|
+
import { resolve as resolve9 } from "path";
|
|
79501
80014
|
var node_default;
|
|
79502
80015
|
var init_node = __esm(() => {
|
|
79503
80016
|
node_default = {
|
|
79504
80017
|
fs: {
|
|
79505
|
-
readFileSync:
|
|
80018
|
+
readFileSync: readFileSync21,
|
|
79506
80019
|
writeFile
|
|
79507
80020
|
},
|
|
79508
80021
|
format: format2,
|
|
79509
|
-
resolve:
|
|
80022
|
+
resolve: resolve9,
|
|
79510
80023
|
exists: (file) => {
|
|
79511
80024
|
try {
|
|
79512
80025
|
return statSync10(file).isFile();
|
|
@@ -79687,13 +80200,13 @@ var init_y18n = __esm(() => {
|
|
|
79687
80200
|
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
79688
80201
|
import { notStrictEqual, strictEqual } from "assert";
|
|
79689
80202
|
import { inspect } from "util";
|
|
79690
|
-
import { readFileSync as
|
|
80203
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
79691
80204
|
import { fileURLToPath } from "url";
|
|
79692
|
-
import { basename as
|
|
80205
|
+
import { basename as basename10, dirname as dirname10, extname as extname3, relative as relative7, resolve as resolve10 } from "path";
|
|
79693
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;
|
|
79694
80207
|
var init_esm = __esm(() => {
|
|
79695
80208
|
init_cliui();
|
|
79696
|
-
|
|
80209
|
+
init_sync2();
|
|
79697
80210
|
init_lib2();
|
|
79698
80211
|
init_yerror();
|
|
79699
80212
|
init_y18n();
|
|
@@ -79721,11 +80234,11 @@ var init_esm = __esm(() => {
|
|
|
79721
80234
|
mainFilename: mainFilename || process.cwd(),
|
|
79722
80235
|
Parser: lib_default,
|
|
79723
80236
|
path: {
|
|
79724
|
-
basename:
|
|
79725
|
-
dirname:
|
|
80237
|
+
basename: basename10,
|
|
80238
|
+
dirname: dirname10,
|
|
79726
80239
|
extname: extname3,
|
|
79727
80240
|
relative: relative7,
|
|
79728
|
-
resolve:
|
|
80241
|
+
resolve: resolve10
|
|
79729
80242
|
},
|
|
79730
80243
|
process: {
|
|
79731
80244
|
argv: () => process.argv,
|
|
@@ -79736,7 +80249,7 @@ var init_esm = __esm(() => {
|
|
|
79736
80249
|
nextTick: process.nextTick,
|
|
79737
80250
|
stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
|
|
79738
80251
|
},
|
|
79739
|
-
readFileSync:
|
|
80252
|
+
readFileSync: readFileSync22,
|
|
79740
80253
|
require: () => {
|
|
79741
80254
|
throw new YError(REQUIRE_ERROR);
|
|
79742
80255
|
},
|
|
@@ -79747,7 +80260,7 @@ var init_esm = __esm(() => {
|
|
|
79747
80260
|
return [...str].length;
|
|
79748
80261
|
},
|
|
79749
80262
|
y18n: y18n_default({
|
|
79750
|
-
directory:
|
|
80263
|
+
directory: resolve10(__dirname2, "../../../locales"),
|
|
79751
80264
|
updateFiles: false
|
|
79752
80265
|
})
|
|
79753
80266
|
};
|
|
@@ -81995,12 +82508,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
81995
82508
|
async getCompletion(args, done) {
|
|
81996
82509
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
81997
82510
|
if (!done) {
|
|
81998
|
-
return new Promise((
|
|
82511
|
+
return new Promise((resolve11, reject) => {
|
|
81999
82512
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
82000
82513
|
if (err)
|
|
82001
82514
|
reject(err);
|
|
82002
82515
|
else
|
|
82003
|
-
|
|
82516
|
+
resolve11(completions);
|
|
82004
82517
|
});
|
|
82005
82518
|
});
|
|
82006
82519
|
} else {
|
|
@@ -83069,8 +83582,8 @@ import * as readline2 from "node:readline";
|
|
|
83069
83582
|
function isValidBrowser(browser) {
|
|
83070
83583
|
return Object.values(Browser6).includes(browser);
|
|
83071
83584
|
}
|
|
83072
|
-
function isValidPlatform(
|
|
83073
|
-
return Object.values(BrowserPlatform).includes(
|
|
83585
|
+
function isValidPlatform(platform2) {
|
|
83586
|
+
return Object.values(BrowserPlatform).includes(platform2);
|
|
83074
83587
|
}
|
|
83075
83588
|
|
|
83076
83589
|
class CLI {
|
|
@@ -83121,11 +83634,11 @@ class CLI {
|
|
|
83121
83634
|
desc: "Platform that the binary needs to be compatible with.",
|
|
83122
83635
|
choices: Object.values(BrowserPlatform),
|
|
83123
83636
|
default: detectBrowserPlatform(),
|
|
83124
|
-
coerce: (
|
|
83125
|
-
if (!isValidPlatform(
|
|
83126
|
-
throw new Error(`Unsupported platform '${
|
|
83637
|
+
coerce: (platform2) => {
|
|
83638
|
+
if (!isValidPlatform(platform2)) {
|
|
83639
|
+
throw new Error(`Unsupported platform '${platform2}'`);
|
|
83127
83640
|
}
|
|
83128
|
-
return
|
|
83641
|
+
return platform2;
|
|
83129
83642
|
},
|
|
83130
83643
|
defaultDescription: "Auto-detected"
|
|
83131
83644
|
});
|
|
@@ -83330,8 +83843,8 @@ var init_CLI = __esm(() => {
|
|
|
83330
83843
|
});
|
|
83331
83844
|
|
|
83332
83845
|
// node_modules/@puppeteer/browsers/lib/esm/provider.js
|
|
83333
|
-
function buildArchiveFilename(browser,
|
|
83334
|
-
return `${browser}-${
|
|
83846
|
+
function buildArchiveFilename(browser, platform2, buildId, extension2 = "zip") {
|
|
83847
|
+
return `${browser}-${platform2}-${buildId}.${extension2}`;
|
|
83335
83848
|
}
|
|
83336
83849
|
|
|
83337
83850
|
// node_modules/@puppeteer/browsers/lib/esm/main.js
|
|
@@ -83430,14 +83943,14 @@ async function getConnectionTransport(options) {
|
|
|
83430
83943
|
};
|
|
83431
83944
|
} else if (options.channel && isNode) {
|
|
83432
83945
|
const { detectBrowserPlatform: detectBrowserPlatform2, resolveDefaultUserDataDir: resolveDefaultUserDataDir3, Browser: Browser7 } = await Promise.resolve().then(() => (init_main(), exports_main));
|
|
83433
|
-
const
|
|
83434
|
-
if (!
|
|
83946
|
+
const platform2 = detectBrowserPlatform2();
|
|
83947
|
+
if (!platform2) {
|
|
83435
83948
|
throw new Error("Could not detect required browser platform");
|
|
83436
83949
|
}
|
|
83437
83950
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
83438
|
-
const { join:
|
|
83439
|
-
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME,
|
|
83440
|
-
const portPath =
|
|
83951
|
+
const { join: join20 } = await import("node:path");
|
|
83952
|
+
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
83953
|
+
const portPath = join20(userDataDir, "DevToolsActivePort");
|
|
83441
83954
|
try {
|
|
83442
83955
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
83443
83956
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -83661,9 +84174,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
83661
84174
|
});
|
|
83662
84175
|
|
|
83663
84176
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
83664
|
-
import { existsSync as
|
|
84177
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
83665
84178
|
import { tmpdir } from "node:os";
|
|
83666
|
-
import { join as
|
|
84179
|
+
import { join as join20 } from "node:path";
|
|
83667
84180
|
|
|
83668
84181
|
class BrowserLauncher {
|
|
83669
84182
|
#browser;
|
|
@@ -83688,7 +84201,7 @@ class BrowserLauncher {
|
|
|
83688
84201
|
...options,
|
|
83689
84202
|
protocol
|
|
83690
84203
|
});
|
|
83691
|
-
if (!
|
|
84204
|
+
if (!existsSync21(launchArgs.executablePath)) {
|
|
83692
84205
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
83693
84206
|
}
|
|
83694
84207
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -83763,7 +84276,7 @@ class BrowserLauncher {
|
|
|
83763
84276
|
browserCloseCallback();
|
|
83764
84277
|
const logs = browserProcess.getRecentLogs().join(`
|
|
83765
84278
|
`);
|
|
83766
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
84279
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync21(join20(launchArgs.userDataDir, "lockfile"))) {
|
|
83767
84280
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
83768
84281
|
}
|
|
83769
84282
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -83853,12 +84366,12 @@ class BrowserLauncher {
|
|
|
83853
84366
|
});
|
|
83854
84367
|
}
|
|
83855
84368
|
getProfilePath() {
|
|
83856
|
-
return
|
|
84369
|
+
return join20(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
83857
84370
|
}
|
|
83858
84371
|
resolveExecutablePath(headless, validatePath = true) {
|
|
83859
84372
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
83860
84373
|
if (executablePath) {
|
|
83861
|
-
if (validatePath && !
|
|
84374
|
+
if (validatePath && !existsSync21(executablePath)) {
|
|
83862
84375
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
83863
84376
|
}
|
|
83864
84377
|
return executablePath;
|
|
@@ -83881,7 +84394,7 @@ class BrowserLauncher {
|
|
|
83881
84394
|
browser: browserType,
|
|
83882
84395
|
buildId: this.puppeteer.browserVersion
|
|
83883
84396
|
});
|
|
83884
|
-
if (validatePath && !
|
|
84397
|
+
if (validatePath && !existsSync21(executablePath)) {
|
|
83885
84398
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
83886
84399
|
if (configVersion) {
|
|
83887
84400
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -84367,8 +84880,8 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
84367
84880
|
return this.#getLauncher(options.browser ?? this.lastLaunchedBrowser).defaultArgs(options);
|
|
84368
84881
|
}
|
|
84369
84882
|
async trimCache() {
|
|
84370
|
-
const
|
|
84371
|
-
if (!
|
|
84883
|
+
const platform2 = detectBrowserPlatform();
|
|
84884
|
+
if (!platform2) {
|
|
84372
84885
|
throw new Error("The current platform is not supported.");
|
|
84373
84886
|
}
|
|
84374
84887
|
const cacheDir = this.configuration.cacheDirectory;
|
|
@@ -84389,7 +84902,7 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
84389
84902
|
];
|
|
84390
84903
|
await Promise.all(puppeteerBrowsers.map(async (item) => {
|
|
84391
84904
|
const tag = this.configuration?.[item.product]?.version ?? PUPPETEER_REVISIONS[item.product];
|
|
84392
|
-
item.currentBuildId = await resolveBuildId4(item.browser,
|
|
84905
|
+
item.currentBuildId = await resolveBuildId4(item.browser, platform2, tag);
|
|
84393
84906
|
}));
|
|
84394
84907
|
const currentBrowserBuilds = new Set(puppeteerBrowsers.map((browser) => {
|
|
84395
84908
|
return `${browser.browser}_${browser.currentBuildId}`;
|
|
@@ -84406,7 +84919,7 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
84406
84919
|
}
|
|
84407
84920
|
await uninstall({
|
|
84408
84921
|
browser: installedBrowser.browser,
|
|
84409
|
-
platform,
|
|
84922
|
+
platform: platform2,
|
|
84410
84923
|
cacheDir,
|
|
84411
84924
|
buildId: installedBrowser.buildId
|
|
84412
84925
|
});
|
|
@@ -84419,7 +84932,7 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
84419
84932
|
import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
|
|
84420
84933
|
import fs5 from "node:fs";
|
|
84421
84934
|
import os8 from "node:os";
|
|
84422
|
-
import { dirname as
|
|
84935
|
+
import { dirname as dirname11 } from "node:path";
|
|
84423
84936
|
import { PassThrough } from "node:stream";
|
|
84424
84937
|
var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
|
|
84425
84938
|
var useValue = arguments.length > 2;
|
|
@@ -84493,8 +85006,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
84493
85006
|
static {
|
|
84494
85007
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
84495
85008
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
84496
|
-
const error = await new Promise((
|
|
84497
|
-
this.#process.stdin.write(buffer,
|
|
85009
|
+
const error = await new Promise((resolve11) => {
|
|
85010
|
+
this.#process.stdin.write(buffer, resolve11);
|
|
84498
85011
|
});
|
|
84499
85012
|
if (error) {
|
|
84500
85013
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -84543,7 +85056,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
84543
85056
|
filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
|
|
84544
85057
|
}
|
|
84545
85058
|
if (path11) {
|
|
84546
|
-
fs5.mkdirSync(
|
|
85059
|
+
fs5.mkdirSync(dirname11(path11), { recursive: overwrite });
|
|
84547
85060
|
}
|
|
84548
85061
|
this.#process = spawn2(ffmpegPath, [
|
|
84549
85062
|
["-loglevel", "error"],
|
|
@@ -84649,8 +85162,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
84649
85162
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
84650
85163
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
84651
85164
|
this.#process.stdin.end();
|
|
84652
|
-
await new Promise((
|
|
84653
|
-
this.#process.once("close",
|
|
85165
|
+
await new Promise((resolve11) => {
|
|
85166
|
+
this.#process.once("close", resolve11);
|
|
84654
85167
|
});
|
|
84655
85168
|
}
|
|
84656
85169
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -84696,17 +85209,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
84696
85209
|
});
|
|
84697
85210
|
|
|
84698
85211
|
// src/core/design-eval/capture.ts
|
|
84699
|
-
import { mkdirSync as
|
|
84700
|
-
import { join as
|
|
85212
|
+
import { mkdirSync as mkdirSync9, statSync as statSync11, existsSync as existsSync22 } from "fs";
|
|
85213
|
+
import { join as join21 } from "path";
|
|
84701
85214
|
function findBrowser() {
|
|
84702
|
-
const
|
|
84703
|
-
const paths = CHROME_PATHS[
|
|
85215
|
+
const platform2 = process.platform;
|
|
85216
|
+
const paths = CHROME_PATHS[platform2] ?? [];
|
|
84704
85217
|
for (const p of paths) {
|
|
84705
|
-
if (
|
|
85218
|
+
if (existsSync22(p))
|
|
84706
85219
|
return p;
|
|
84707
85220
|
}
|
|
84708
|
-
const minkBrowsers =
|
|
84709
|
-
if (
|
|
85221
|
+
const minkBrowsers = join21(minkRoot(), "browsers");
|
|
85222
|
+
if (existsSync22(minkBrowsers)) {
|
|
84710
85223
|
const found = findChromeInDir(minkBrowsers);
|
|
84711
85224
|
if (found)
|
|
84712
85225
|
return found;
|
|
@@ -84727,7 +85240,7 @@ function findChromeInDir(dir) {
|
|
|
84727
85240
|
try {
|
|
84728
85241
|
const entries = readdirSync7(dir);
|
|
84729
85242
|
for (const entry of entries) {
|
|
84730
|
-
const full =
|
|
85243
|
+
const full = join21(dir, entry);
|
|
84731
85244
|
try {
|
|
84732
85245
|
const stat2 = statSync12(full);
|
|
84733
85246
|
if (stat2.isDirectory()) {
|
|
@@ -84775,7 +85288,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
84775
85288
|
const y = section * viewport.height;
|
|
84776
85289
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
84777
85290
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
84778
|
-
const filePath =
|
|
85291
|
+
const filePath = join21(options.outputDir, fileName);
|
|
84779
85292
|
await page.screenshot({
|
|
84780
85293
|
path: filePath,
|
|
84781
85294
|
type: "jpeg",
|
|
@@ -84807,7 +85320,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
84807
85320
|
return results;
|
|
84808
85321
|
}
|
|
84809
85322
|
async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
|
|
84810
|
-
|
|
85323
|
+
mkdirSync9(outputDir, { recursive: true });
|
|
84811
85324
|
const executablePath = findBrowser();
|
|
84812
85325
|
const browser = await puppeteer_core_default.launch({
|
|
84813
85326
|
executablePath,
|
|
@@ -86235,22 +86748,22 @@ var init_framework_advisor2 = __esm(() => {
|
|
|
86235
86748
|
});
|
|
86236
86749
|
|
|
86237
86750
|
// src/core/vault-templates.ts
|
|
86238
|
-
import { join as
|
|
86239
|
-
import { existsSync as
|
|
86751
|
+
import { join as join22 } from "path";
|
|
86752
|
+
import { existsSync as existsSync23, writeFileSync as writeFileSync6, readFileSync as readFileSync23, mkdirSync as mkdirSync10 } from "fs";
|
|
86240
86753
|
function seedTemplates(templatesDir) {
|
|
86241
|
-
|
|
86754
|
+
mkdirSync10(templatesDir, { recursive: true });
|
|
86242
86755
|
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
86243
|
-
const filePath =
|
|
86244
|
-
if (!
|
|
86245
|
-
|
|
86756
|
+
const filePath = join22(templatesDir, `${name}.md`);
|
|
86757
|
+
if (!existsSync23(filePath)) {
|
|
86758
|
+
writeFileSync6(filePath, content);
|
|
86246
86759
|
}
|
|
86247
86760
|
}
|
|
86248
86761
|
}
|
|
86249
86762
|
function loadTemplate(templatesDir, templateName, vars) {
|
|
86250
|
-
const filePath =
|
|
86763
|
+
const filePath = join22(templatesDir, `${templateName}.md`);
|
|
86251
86764
|
let content;
|
|
86252
|
-
if (
|
|
86253
|
-
content =
|
|
86765
|
+
if (existsSync23(filePath)) {
|
|
86766
|
+
content = readFileSync23(filePath, "utf-8");
|
|
86254
86767
|
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
86255
86768
|
content = DEFAULT_TEMPLATES[templateName];
|
|
86256
86769
|
} else {
|
|
@@ -86403,8 +86916,8 @@ category: resources
|
|
|
86403
86916
|
});
|
|
86404
86917
|
|
|
86405
86918
|
// src/core/note-linker.ts
|
|
86406
|
-
import { join as
|
|
86407
|
-
import { existsSync as
|
|
86919
|
+
import { join as join23 } from "path";
|
|
86920
|
+
import { existsSync as existsSync24, readFileSync as readFileSync24, readdirSync as readdirSync7, statSync as statSync12 } from "fs";
|
|
86408
86921
|
function updateMasterIndex(vaultRootPath) {
|
|
86409
86922
|
const now = new Date().toISOString().split("T")[0];
|
|
86410
86923
|
const sections = [
|
|
@@ -86426,8 +86939,8 @@ function updateMasterIndex(vaultRootPath) {
|
|
|
86426
86939
|
{ name: "Patterns", dir: "patterns", emoji: "" }
|
|
86427
86940
|
];
|
|
86428
86941
|
for (const cat of categories) {
|
|
86429
|
-
const dirPath =
|
|
86430
|
-
if (!
|
|
86942
|
+
const dirPath = join23(vaultRootPath, cat.dir);
|
|
86943
|
+
if (!existsSync24(dirPath))
|
|
86431
86944
|
continue;
|
|
86432
86945
|
const files = collectMarkdownFiles(dirPath, vaultRootPath);
|
|
86433
86946
|
if (files.length === 0 && cat.dir !== "inbox")
|
|
@@ -86456,7 +86969,7 @@ function collectMarkdownFiles(dirPath, rootPath) {
|
|
|
86456
86969
|
try {
|
|
86457
86970
|
const entries = readdirSync7(dirPath, { withFileTypes: true });
|
|
86458
86971
|
for (const entry of entries) {
|
|
86459
|
-
const fullPath =
|
|
86972
|
+
const fullPath = join23(dirPath, entry.name);
|
|
86460
86973
|
if (entry.isDirectory()) {
|
|
86461
86974
|
files.push(...collectMarkdownFiles(fullPath, rootPath));
|
|
86462
86975
|
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
@@ -86479,8 +86992,8 @@ var exports_wiki = {};
|
|
|
86479
86992
|
__export(exports_wiki, {
|
|
86480
86993
|
wiki: () => wiki
|
|
86481
86994
|
});
|
|
86482
|
-
import { existsSync as
|
|
86483
|
-
import { resolve as
|
|
86995
|
+
import { existsSync as existsSync25, statSync as statSync13 } from "fs";
|
|
86996
|
+
import { resolve as resolve11 } from "path";
|
|
86484
86997
|
import { homedir as homedir4 } from "os";
|
|
86485
86998
|
async function wiki(_cwd, args) {
|
|
86486
86999
|
const sub = args[0];
|
|
@@ -86497,13 +87010,25 @@ async function wiki(_cwd, args) {
|
|
|
86497
87010
|
case "organize":
|
|
86498
87011
|
wikiOrganize();
|
|
86499
87012
|
break;
|
|
87013
|
+
case "link":
|
|
87014
|
+
wikiLink(args.slice(1));
|
|
87015
|
+
break;
|
|
87016
|
+
case "unlink":
|
|
87017
|
+
wikiUnlink(args.slice(1));
|
|
87018
|
+
break;
|
|
87019
|
+
case "links":
|
|
87020
|
+
wikiLinks();
|
|
87021
|
+
break;
|
|
86500
87022
|
default:
|
|
86501
|
-
console.log("Usage: mink wiki <
|
|
87023
|
+
console.log("Usage: mink wiki <command>");
|
|
86502
87024
|
console.log();
|
|
86503
87025
|
console.log(" init Initialize the notes/wiki vault");
|
|
86504
87026
|
console.log(" status Show vault statistics");
|
|
86505
87027
|
console.log(" rebuild-index Full rescan and reindex of vault");
|
|
86506
87028
|
console.log(" organize List inbox notes needing categorization");
|
|
87029
|
+
console.log(" link <path> [name] Symlink external notes into the vault");
|
|
87030
|
+
console.log(" unlink <name> Remove a symlinked directory from the vault");
|
|
87031
|
+
console.log(" links List all linked directories");
|
|
86507
87032
|
break;
|
|
86508
87033
|
}
|
|
86509
87034
|
}
|
|
@@ -86523,7 +87048,7 @@ async function wikiInit(args) {
|
|
|
86523
87048
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
86524
87049
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
86525
87050
|
}
|
|
86526
|
-
const isExisting =
|
|
87051
|
+
const isExisting = existsSync25(targetPath) && statSync13(targetPath).isDirectory();
|
|
86527
87052
|
setConfigValue("wiki.path", targetPath);
|
|
86528
87053
|
ensureVaultStructure();
|
|
86529
87054
|
seedTemplates(vaultTemplates());
|
|
@@ -86611,6 +87136,14 @@ function wikiStatus() {
|
|
|
86611
87136
|
}
|
|
86612
87137
|
console.log();
|
|
86613
87138
|
console.log(` last indexed: ${index.lastScanTimestamp || "never"}`);
|
|
87139
|
+
const links = listLinks();
|
|
87140
|
+
if (links.length > 0) {
|
|
87141
|
+
console.log();
|
|
87142
|
+
console.log(" Linked directories:");
|
|
87143
|
+
for (const link of links) {
|
|
87144
|
+
console.log(` ${link.name} -> ${link.target}`);
|
|
87145
|
+
}
|
|
87146
|
+
}
|
|
86614
87147
|
if (categoryCounts.inbox > 0) {
|
|
86615
87148
|
console.log();
|
|
86616
87149
|
console.log(` ${categoryCounts.inbox} notes in inbox need categorization`);
|
|
@@ -86650,11 +87183,78 @@ function wikiOrganize() {
|
|
|
86650
87183
|
}
|
|
86651
87184
|
console.log("Use '/mink:note' in Claude Code to intelligently categorize these notes.");
|
|
86652
87185
|
}
|
|
87186
|
+
function wikiLink(args) {
|
|
87187
|
+
if (!isVaultInitialized()) {
|
|
87188
|
+
console.log("[mink] no vault initialized");
|
|
87189
|
+
console.log(" Run 'mink wiki init' first.");
|
|
87190
|
+
return;
|
|
87191
|
+
}
|
|
87192
|
+
const targetPath = args[0];
|
|
87193
|
+
if (!targetPath) {
|
|
87194
|
+
console.log("Usage: mink wiki link <path> [name]");
|
|
87195
|
+
console.log();
|
|
87196
|
+
console.log(" Symlinks an external directory into the vault so it appears");
|
|
87197
|
+
console.log(" alongside Mink's content in Obsidian.");
|
|
87198
|
+
console.log();
|
|
87199
|
+
console.log(" Examples:");
|
|
87200
|
+
console.log(" mink wiki link ~/dev/notes");
|
|
87201
|
+
console.log(" mink wiki link ~/dev/notes my-notes");
|
|
87202
|
+
return;
|
|
87203
|
+
}
|
|
87204
|
+
const name = args[1];
|
|
87205
|
+
const result = linkExternal(targetPath, name);
|
|
87206
|
+
if (!result.ok) {
|
|
87207
|
+
console.error(`[mink] ${result.error}`);
|
|
87208
|
+
process.exit(1);
|
|
87209
|
+
}
|
|
87210
|
+
console.log(`[mink] linked: ${result.linkName} -> ${targetPath}`);
|
|
87211
|
+
console.log(` symlink: ${result.linkPath}`);
|
|
87212
|
+
console.log();
|
|
87213
|
+
console.log(" Open ~/.mink/wiki/ as your Obsidian vault to see everything together.");
|
|
87214
|
+
}
|
|
87215
|
+
function wikiUnlink(args) {
|
|
87216
|
+
if (!isVaultInitialized()) {
|
|
87217
|
+
console.log("[mink] no vault initialized");
|
|
87218
|
+
return;
|
|
87219
|
+
}
|
|
87220
|
+
const name = args[0];
|
|
87221
|
+
if (!name) {
|
|
87222
|
+
console.log("Usage: mink wiki unlink <name>");
|
|
87223
|
+
console.log();
|
|
87224
|
+
console.log(" Run 'mink wiki links' to see linked directories.");
|
|
87225
|
+
return;
|
|
87226
|
+
}
|
|
87227
|
+
const result = unlinkExternal(name);
|
|
87228
|
+
if (!result.ok) {
|
|
87229
|
+
console.error(`[mink] ${result.error}`);
|
|
87230
|
+
process.exit(1);
|
|
87231
|
+
}
|
|
87232
|
+
console.log(`[mink] unlinked: ${name}`);
|
|
87233
|
+
console.log(" (original directory was not modified)");
|
|
87234
|
+
}
|
|
87235
|
+
function wikiLinks() {
|
|
87236
|
+
if (!isVaultInitialized()) {
|
|
87237
|
+
console.log("[mink] no vault initialized");
|
|
87238
|
+
return;
|
|
87239
|
+
}
|
|
87240
|
+
const links = listLinks();
|
|
87241
|
+
if (links.length === 0) {
|
|
87242
|
+
console.log("[mink] no linked directories");
|
|
87243
|
+
console.log(" Use 'mink wiki link <path>' to symlink external notes into the vault.");
|
|
87244
|
+
return;
|
|
87245
|
+
}
|
|
87246
|
+
console.log("[mink] linked directories:");
|
|
87247
|
+
console.log();
|
|
87248
|
+
for (const link of links) {
|
|
87249
|
+
console.log(` ${link.name} -> ${link.target}`);
|
|
87250
|
+
console.log(` linked: ${link.linkedAt}`);
|
|
87251
|
+
}
|
|
87252
|
+
}
|
|
86653
87253
|
function expandPath(raw) {
|
|
86654
87254
|
if (raw.startsWith("~/")) {
|
|
86655
|
-
return
|
|
87255
|
+
return resolve11(homedir4(), raw.slice(2));
|
|
86656
87256
|
}
|
|
86657
|
-
return
|
|
87257
|
+
return resolve11(raw);
|
|
86658
87258
|
}
|
|
86659
87259
|
var init_wiki = __esm(() => {
|
|
86660
87260
|
init_vault();
|
|
@@ -86666,8 +87266,8 @@ var init_wiki = __esm(() => {
|
|
|
86666
87266
|
});
|
|
86667
87267
|
|
|
86668
87268
|
// src/core/note-writer.ts
|
|
86669
|
-
import { join as
|
|
86670
|
-
import { existsSync as
|
|
87269
|
+
import { join as join24 } from "path";
|
|
87270
|
+
import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
|
|
86671
87271
|
function slugifyTitle(title) {
|
|
86672
87272
|
return title.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
86673
87273
|
}
|
|
@@ -86700,7 +87300,7 @@ function createNote(meta) {
|
|
|
86700
87300
|
const now = meta.created || new Date().toISOString();
|
|
86701
87301
|
const slug = slugifyTitle(meta.title);
|
|
86702
87302
|
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
86703
|
-
const filePath =
|
|
87303
|
+
const filePath = join24(dir, `${slug}.md`);
|
|
86704
87304
|
let content;
|
|
86705
87305
|
if (meta.template) {
|
|
86706
87306
|
const rendered = loadTemplate(vaultTemplates(), meta.template, {
|
|
@@ -86734,9 +87334,9 @@ ${meta.body}
|
|
|
86734
87334
|
}
|
|
86735
87335
|
function appendToDaily(date, content) {
|
|
86736
87336
|
const dir = vaultDailyDir();
|
|
86737
|
-
const filePath =
|
|
86738
|
-
if (
|
|
86739
|
-
const existing =
|
|
87337
|
+
const filePath = join24(dir, `${date}.md`);
|
|
87338
|
+
if (existsSync26(filePath)) {
|
|
87339
|
+
const existing = readFileSync25(filePath, "utf-8");
|
|
86740
87340
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
86741
87341
|
hour: "2-digit",
|
|
86742
87342
|
minute: "2-digit",
|
|
@@ -86774,7 +87374,7 @@ ${content}
|
|
|
86774
87374
|
return filePath;
|
|
86775
87375
|
}
|
|
86776
87376
|
function ingestFile(sourcePath, meta) {
|
|
86777
|
-
const raw =
|
|
87377
|
+
const raw = readFileSync25(sourcePath, "utf-8");
|
|
86778
87378
|
const now = new Date().toISOString();
|
|
86779
87379
|
const headingMatch = raw.match(/^#\s+(.+)$/m);
|
|
86780
87380
|
const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
|
|
@@ -86812,7 +87412,7 @@ ${raw}`;
|
|
|
86812
87412
|
}
|
|
86813
87413
|
const slug = slugifyTitle(title);
|
|
86814
87414
|
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
86815
|
-
const filePath =
|
|
87415
|
+
const filePath = join24(dir, `${slug}.md`);
|
|
86816
87416
|
atomicWriteText(filePath, content);
|
|
86817
87417
|
return { filePath, content };
|
|
86818
87418
|
}
|
|
@@ -86827,8 +87427,8 @@ var exports_note = {};
|
|
|
86827
87427
|
__export(exports_note, {
|
|
86828
87428
|
note: () => note
|
|
86829
87429
|
});
|
|
86830
|
-
import { resolve as
|
|
86831
|
-
import { existsSync as
|
|
87430
|
+
import { resolve as resolve12 } from "path";
|
|
87431
|
+
import { existsSync as existsSync27, readFileSync as readFileSync26 } from "fs";
|
|
86832
87432
|
async function note(cwd, args) {
|
|
86833
87433
|
if (!isWikiEnabled()) {
|
|
86834
87434
|
console.error("[mink] wiki feature is disabled");
|
|
@@ -86853,13 +87453,13 @@ async function note(cwd, args) {
|
|
|
86853
87453
|
const date = new Date().toISOString().split("T")[0];
|
|
86854
87454
|
const content = parsed.positional || parsed.body || "";
|
|
86855
87455
|
const filePath = appendToDaily(date, content);
|
|
86856
|
-
updateVaultIndexForFile(filePath,
|
|
87456
|
+
updateVaultIndexForFile(filePath, readFileSync26(filePath, "utf-8"));
|
|
86857
87457
|
console.log(`[mink] daily note: ${filePath}`);
|
|
86858
87458
|
return;
|
|
86859
87459
|
}
|
|
86860
87460
|
if (parsed.file) {
|
|
86861
|
-
const sourcePath =
|
|
86862
|
-
if (!
|
|
87461
|
+
const sourcePath = resolve12(cwd, parsed.file);
|
|
87462
|
+
if (!existsSync27(sourcePath)) {
|
|
86863
87463
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
86864
87464
|
process.exit(1);
|
|
86865
87465
|
}
|
|
@@ -87020,29 +87620,29 @@ var exports_skill = {};
|
|
|
87020
87620
|
__export(exports_skill, {
|
|
87021
87621
|
skill: () => skill
|
|
87022
87622
|
});
|
|
87023
|
-
import { join as
|
|
87623
|
+
import { join as join25, resolve as resolve13, dirname as dirname12 } from "path";
|
|
87024
87624
|
import { homedir as homedir5 } from "os";
|
|
87025
87625
|
import {
|
|
87026
|
-
existsSync as
|
|
87027
|
-
mkdirSync as
|
|
87626
|
+
existsSync as existsSync28,
|
|
87627
|
+
mkdirSync as mkdirSync11,
|
|
87028
87628
|
copyFileSync,
|
|
87029
|
-
unlinkSync as
|
|
87629
|
+
unlinkSync as unlinkSync3,
|
|
87030
87630
|
readdirSync as readdirSync8,
|
|
87031
87631
|
rmSync,
|
|
87032
|
-
symlinkSync,
|
|
87033
|
-
lstatSync
|
|
87632
|
+
symlinkSync as symlinkSync2,
|
|
87633
|
+
lstatSync as lstatSync2
|
|
87034
87634
|
} from "fs";
|
|
87035
87635
|
function getSkillsSourceDir() {
|
|
87036
|
-
return
|
|
87636
|
+
return resolve13(dirname12(new URL(import.meta.url).pathname), "../../skills");
|
|
87037
87637
|
}
|
|
87038
87638
|
function getAvailableSkills() {
|
|
87039
87639
|
const dir = getSkillsSourceDir();
|
|
87040
|
-
if (!
|
|
87640
|
+
if (!existsSync28(dir))
|
|
87041
87641
|
return [];
|
|
87042
|
-
return readdirSync8(dir, { withFileTypes: true }).filter((d) => d.isDirectory() &&
|
|
87642
|
+
return readdirSync8(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync28(join25(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
87043
87643
|
}
|
|
87044
87644
|
function isInstalled(skillName) {
|
|
87045
|
-
return
|
|
87645
|
+
return existsSync28(join25(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
87046
87646
|
}
|
|
87047
87647
|
async function skill(args) {
|
|
87048
87648
|
const sub = args[0];
|
|
@@ -87076,29 +87676,29 @@ function skillInstall(name) {
|
|
|
87076
87676
|
console.error(" Expected skills at: " + sourceDir);
|
|
87077
87677
|
return;
|
|
87078
87678
|
}
|
|
87079
|
-
|
|
87679
|
+
mkdirSync11(AGENTS_SKILLS_DIR, { recursive: true });
|
|
87080
87680
|
for (const skillName of skills) {
|
|
87081
|
-
const srcDir =
|
|
87082
|
-
const srcFile =
|
|
87083
|
-
const destDir =
|
|
87084
|
-
if (!
|
|
87681
|
+
const srcDir = join25(sourceDir, skillName);
|
|
87682
|
+
const srcFile = join25(srcDir, "SKILL.md");
|
|
87683
|
+
const destDir = join25(AGENTS_SKILLS_DIR, skillName);
|
|
87684
|
+
if (!existsSync28(srcFile)) {
|
|
87085
87685
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
87086
87686
|
continue;
|
|
87087
87687
|
}
|
|
87088
|
-
|
|
87688
|
+
mkdirSync11(destDir, { recursive: true });
|
|
87089
87689
|
copyDirRecursive(srcDir, destDir);
|
|
87090
|
-
|
|
87091
|
-
const symlink =
|
|
87690
|
+
mkdirSync11(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
87691
|
+
const symlink = join25(CLAUDE_SKILLS_DIR, skillName);
|
|
87092
87692
|
try {
|
|
87093
|
-
if (
|
|
87094
|
-
if (
|
|
87095
|
-
|
|
87693
|
+
if (existsSync28(symlink)) {
|
|
87694
|
+
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
87695
|
+
unlinkSync3(symlink);
|
|
87096
87696
|
} else {
|
|
87097
87697
|
rmSync(symlink, { recursive: true, force: true });
|
|
87098
87698
|
}
|
|
87099
87699
|
}
|
|
87100
|
-
const relativeTarget =
|
|
87101
|
-
|
|
87700
|
+
const relativeTarget = join25("..", "..", ".agents", "skills", skillName);
|
|
87701
|
+
symlinkSync2(relativeTarget, symlink);
|
|
87102
87702
|
} catch {}
|
|
87103
87703
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
87104
87704
|
}
|
|
@@ -87108,16 +87708,16 @@ function skillInstall(name) {
|
|
|
87108
87708
|
function skillUninstall(name) {
|
|
87109
87709
|
const skills = name ? [name] : getAvailableSkills();
|
|
87110
87710
|
for (const skillName of skills) {
|
|
87111
|
-
const destDir =
|
|
87112
|
-
if (!
|
|
87711
|
+
const destDir = join25(AGENTS_SKILLS_DIR, skillName);
|
|
87712
|
+
if (!existsSync28(destDir)) {
|
|
87113
87713
|
console.log(`[mink] not installed: ${skillName}`);
|
|
87114
87714
|
continue;
|
|
87115
87715
|
}
|
|
87116
87716
|
rmSync(destDir, { recursive: true, force: true });
|
|
87117
|
-
const symlink =
|
|
87717
|
+
const symlink = join25(CLAUDE_SKILLS_DIR, skillName);
|
|
87118
87718
|
try {
|
|
87119
|
-
if (
|
|
87120
|
-
|
|
87719
|
+
if (existsSync28(symlink))
|
|
87720
|
+
unlinkSync3(symlink);
|
|
87121
87721
|
} catch {}
|
|
87122
87722
|
console.log(`[mink] uninstalled: ${skillName}`);
|
|
87123
87723
|
}
|
|
@@ -87131,7 +87731,7 @@ function skillList() {
|
|
|
87131
87731
|
if (installed.length > 0) {
|
|
87132
87732
|
console.log(" Installed:");
|
|
87133
87733
|
for (const s of installed) {
|
|
87134
|
-
console.log(` ${s} (${
|
|
87734
|
+
console.log(` ${s} (${join25(AGENTS_SKILLS_DIR, s)})`);
|
|
87135
87735
|
}
|
|
87136
87736
|
}
|
|
87137
87737
|
if (notInstalled.length > 0) {
|
|
@@ -87150,10 +87750,10 @@ function skillList() {
|
|
|
87150
87750
|
function copyDirRecursive(src, dest) {
|
|
87151
87751
|
const entries = readdirSync8(src, { withFileTypes: true });
|
|
87152
87752
|
for (const entry of entries) {
|
|
87153
|
-
const srcPath =
|
|
87154
|
-
const destPath =
|
|
87753
|
+
const srcPath = join25(src, entry.name);
|
|
87754
|
+
const destPath = join25(dest, entry.name);
|
|
87155
87755
|
if (entry.isDirectory()) {
|
|
87156
|
-
|
|
87756
|
+
mkdirSync11(destPath, { recursive: true });
|
|
87157
87757
|
copyDirRecursive(srcPath, destPath);
|
|
87158
87758
|
} else {
|
|
87159
87759
|
copyFileSync(srcPath, destPath);
|
|
@@ -87162,8 +87762,161 @@ function copyDirRecursive(src, dest) {
|
|
|
87162
87762
|
}
|
|
87163
87763
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
87164
87764
|
var init_skill = __esm(() => {
|
|
87165
|
-
AGENTS_SKILLS_DIR =
|
|
87166
|
-
CLAUDE_SKILLS_DIR =
|
|
87765
|
+
AGENTS_SKILLS_DIR = join25(homedir5(), ".agents", "skills");
|
|
87766
|
+
CLAUDE_SKILLS_DIR = join25(homedir5(), ".claude", "skills");
|
|
87767
|
+
});
|
|
87768
|
+
|
|
87769
|
+
// src/commands/sync.ts
|
|
87770
|
+
var exports_sync2 = {};
|
|
87771
|
+
__export(exports_sync2, {
|
|
87772
|
+
sync: () => sync
|
|
87773
|
+
});
|
|
87774
|
+
async function sync(args) {
|
|
87775
|
+
const subcommand = args[0];
|
|
87776
|
+
switch (subcommand) {
|
|
87777
|
+
case undefined:
|
|
87778
|
+
return handleManualSync();
|
|
87779
|
+
case "init":
|
|
87780
|
+
return handleInit(args.slice(1));
|
|
87781
|
+
case "status":
|
|
87782
|
+
return handleStatus();
|
|
87783
|
+
case "push":
|
|
87784
|
+
syncPush((msg) => console.error(msg));
|
|
87785
|
+
return;
|
|
87786
|
+
case "pull":
|
|
87787
|
+
syncPull((msg) => console.error(msg));
|
|
87788
|
+
return;
|
|
87789
|
+
case "pause":
|
|
87790
|
+
return handlePause();
|
|
87791
|
+
case "resume":
|
|
87792
|
+
return handleResume();
|
|
87793
|
+
case "disconnect":
|
|
87794
|
+
return handleDisconnect();
|
|
87795
|
+
default:
|
|
87796
|
+
console.error(`[mink] unknown sync subcommand: ${subcommand}`);
|
|
87797
|
+
console.error("Usage: mink sync [init|status|push|pull|pause|resume|disconnect]");
|
|
87798
|
+
process.exit(1);
|
|
87799
|
+
}
|
|
87800
|
+
}
|
|
87801
|
+
function handleManualSync() {
|
|
87802
|
+
if (!isSyncInitialized()) {
|
|
87803
|
+
console.error("[mink] sync is not initialized");
|
|
87804
|
+
console.error("Run 'mink sync init <remote-url>' to set up sync");
|
|
87805
|
+
return;
|
|
87806
|
+
}
|
|
87807
|
+
console.log("[mink] pulling remote changes...");
|
|
87808
|
+
syncPull((msg) => console.error(msg));
|
|
87809
|
+
console.log("[mink] pushing local changes...");
|
|
87810
|
+
syncPush((msg) => console.error(msg));
|
|
87811
|
+
console.log("[mink] sync complete");
|
|
87812
|
+
}
|
|
87813
|
+
function handleInit(args) {
|
|
87814
|
+
const remoteUrl = args[0];
|
|
87815
|
+
if (!remoteUrl) {
|
|
87816
|
+
console.error("[mink] missing remote URL");
|
|
87817
|
+
console.error("Usage: mink sync init <remote-url>");
|
|
87818
|
+
console.error("Example: mink sync init git@github.com:user/mink-data.git");
|
|
87819
|
+
process.exit(1);
|
|
87820
|
+
}
|
|
87821
|
+
initSync(remoteUrl);
|
|
87822
|
+
}
|
|
87823
|
+
function handleStatus() {
|
|
87824
|
+
const status2 = getSyncStatus();
|
|
87825
|
+
console.log("Mink Sync Status");
|
|
87826
|
+
console.log("─".repeat(40));
|
|
87827
|
+
console.log(` Enabled: ${status2.enabled ? "yes" : "no"}`);
|
|
87828
|
+
console.log(` Git initialized: ${status2.gitInitialized ? "yes" : "no"}`);
|
|
87829
|
+
console.log(` Remote URL: ${status2.remoteUrl || "(not set)"}`);
|
|
87830
|
+
console.log(` Branch: ${status2.branch || "(none)"}`);
|
|
87831
|
+
console.log(` Pending changes: ${status2.pendingChanges}`);
|
|
87832
|
+
console.log(` Last push: ${status2.lastPush || "(never)"}`);
|
|
87833
|
+
console.log(` Last pull: ${status2.lastPull || "(never)"}`);
|
|
87834
|
+
}
|
|
87835
|
+
function handlePause() {
|
|
87836
|
+
setConfigValue("sync.enabled", "false");
|
|
87837
|
+
console.log("[mink] sync paused — auto-sync disabled");
|
|
87838
|
+
console.log("[mink] run 'mink sync resume' to re-enable");
|
|
87839
|
+
}
|
|
87840
|
+
function handleResume() {
|
|
87841
|
+
const status2 = getSyncStatus();
|
|
87842
|
+
if (!status2.gitInitialized) {
|
|
87843
|
+
console.error("[mink] sync has not been initialized yet");
|
|
87844
|
+
console.error("Run 'mink sync init <remote-url>' first");
|
|
87845
|
+
return;
|
|
87846
|
+
}
|
|
87847
|
+
setConfigValue("sync.enabled", "true");
|
|
87848
|
+
console.log("[mink] sync resumed — auto-sync re-enabled");
|
|
87849
|
+
}
|
|
87850
|
+
function handleDisconnect() {
|
|
87851
|
+
disconnectSync();
|
|
87852
|
+
}
|
|
87853
|
+
var init_sync3 = __esm(() => {
|
|
87854
|
+
init_sync();
|
|
87855
|
+
init_global_config();
|
|
87856
|
+
});
|
|
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();
|
|
87167
87920
|
});
|
|
87168
87921
|
|
|
87169
87922
|
// src/commands/bug-search.ts
|
|
@@ -87207,10 +87960,24 @@ init_fs_utils();
|
|
|
87207
87960
|
init_action_log();
|
|
87208
87961
|
init_vault();
|
|
87209
87962
|
init_note_index();
|
|
87210
|
-
import { mkdirSync as
|
|
87963
|
+
import { mkdirSync as mkdirSync4 } from "fs";
|
|
87211
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 {}
|
|
87973
|
+
try {
|
|
87974
|
+
const { isSyncInitialized: isSyncInitialized2, syncPull: syncPull2 } = (init_sync(), __toCommonJS(exports_sync));
|
|
87975
|
+
if (isSyncInitialized2()) {
|
|
87976
|
+
syncPull2((msg) => console.error(msg));
|
|
87977
|
+
}
|
|
87978
|
+
} catch {}
|
|
87212
87979
|
const dir = projectDir(cwd);
|
|
87213
|
-
|
|
87980
|
+
mkdirSync4(dir, { recursive: true });
|
|
87214
87981
|
const state = createSessionState();
|
|
87215
87982
|
atomicWriteJson(sessionPath(cwd), state);
|
|
87216
87983
|
try {
|
|
@@ -87239,10 +88006,8 @@ init_token_ledger();
|
|
|
87239
88006
|
init_bug_memory();
|
|
87240
88007
|
init_action_log();
|
|
87241
88008
|
init_vault();
|
|
87242
|
-
|
|
87243
|
-
import {
|
|
87244
|
-
import { join as join5, dirname as dirname2 } from "path";
|
|
87245
|
-
import { execSync } from "child_process";
|
|
88009
|
+
import { statSync as statSync2, existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
|
|
88010
|
+
import { join as join6, dirname as dirname3 } from "path";
|
|
87246
88011
|
function hasActivity(state) {
|
|
87247
88012
|
return Object.keys(state.reads).length > 0 || state.writes.length > 0;
|
|
87248
88013
|
}
|
|
@@ -87273,7 +88038,7 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87273
88038
|
}
|
|
87274
88039
|
const state = raw;
|
|
87275
88040
|
state.stopCount++;
|
|
87276
|
-
const projDir =
|
|
88041
|
+
const projDir = dirname3(sessionFile);
|
|
87277
88042
|
const effectiveFinalizer = finalizer ?? createLedgerFinalizer(projDir);
|
|
87278
88043
|
if (hasActivity(state)) {
|
|
87279
88044
|
const summary = buildSummary(state);
|
|
@@ -87283,10 +88048,10 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87283
88048
|
effectiveFinalizer.updateSession(summary);
|
|
87284
88049
|
}
|
|
87285
88050
|
try {
|
|
87286
|
-
const logPath =
|
|
88051
|
+
const logPath = join6(projDir, "action-log.md");
|
|
87287
88052
|
const logWriter = createActionLogWriter(logPath);
|
|
87288
88053
|
logWriter.appendSessionEnd(summary);
|
|
87289
|
-
const cfgRaw = safeReadJson(
|
|
88054
|
+
const cfgRaw = safeReadJson(join6(projDir, "config.json"));
|
|
87290
88055
|
consolidateLog(logPath, {
|
|
87291
88056
|
maxEntries: cfgRaw?.actionLogMaxEntries ?? 200,
|
|
87292
88057
|
retentionDays: cfgRaw?.actionLogRetentionDays ?? 7
|
|
@@ -87294,7 +88059,7 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87294
88059
|
} catch {}
|
|
87295
88060
|
}
|
|
87296
88061
|
const editCounts = getEditCounts(state);
|
|
87297
|
-
const bugMemoryFile =
|
|
88062
|
+
const bugMemoryFile = join6(projDir, "bug-memory.json");
|
|
87298
88063
|
const bugMemory = loadBugMemory(bugMemoryFile);
|
|
87299
88064
|
for (const [filePath, count] of Object.entries(editCounts)) {
|
|
87300
88065
|
if (count >= 3) {
|
|
@@ -87304,9 +88069,9 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87304
88069
|
}
|
|
87305
88070
|
}
|
|
87306
88071
|
}
|
|
87307
|
-
const memoryPath =
|
|
87308
|
-
const cfgPath =
|
|
87309
|
-
if (
|
|
88072
|
+
const memoryPath = join6(projDir, "learning-memory.md");
|
|
88073
|
+
const cfgPath = join6(projDir, "config.json");
|
|
88074
|
+
if (existsSync6(memoryPath)) {
|
|
87310
88075
|
reflect(projDir, memoryPath, cfgPath);
|
|
87311
88076
|
}
|
|
87312
88077
|
if (isLearningMemoryStale(memoryPath)) {
|
|
@@ -87318,23 +88083,21 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87318
88083
|
}
|
|
87319
88084
|
} catch {}
|
|
87320
88085
|
try {
|
|
87321
|
-
|
|
87322
|
-
|
|
87323
|
-
|
|
87324
|
-
gitBackupVault(onReminder);
|
|
87325
|
-
}
|
|
88086
|
+
const { isSyncInitialized: isSyncInitialized2, syncPush: syncPush2 } = (init_sync(), __toCommonJS(exports_sync));
|
|
88087
|
+
if (isSyncInitialized2()) {
|
|
88088
|
+
syncPush2(onReminder);
|
|
87326
88089
|
}
|
|
87327
88090
|
} catch {}
|
|
87328
88091
|
atomicWriteJson(sessionFile, state);
|
|
87329
88092
|
}
|
|
87330
88093
|
function writeSessionToWiki(state, projDir) {
|
|
87331
|
-
const metaRaw = safeReadJson(
|
|
88094
|
+
const metaRaw = safeReadJson(join6(projDir, "project-meta.json"));
|
|
87332
88095
|
const projectName = metaRaw?.name ?? "unknown";
|
|
87333
88096
|
const date = new Date().toISOString().split("T")[0];
|
|
87334
88097
|
const readCount = Object.keys(state.reads).length;
|
|
87335
88098
|
const writeCount = state.writes.length;
|
|
87336
|
-
const sessionDir =
|
|
87337
|
-
const sessionFile =
|
|
88099
|
+
const sessionDir = join6(vaultProjects(projectName), "sessions");
|
|
88100
|
+
const sessionFile = join6(sessionDir, `${date}.md`);
|
|
87338
88101
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
87339
88102
|
hour: "2-digit",
|
|
87340
88103
|
minute: "2-digit",
|
|
@@ -87359,8 +88122,8 @@ function writeSessionToWiki(state, projDir) {
|
|
|
87359
88122
|
}
|
|
87360
88123
|
}
|
|
87361
88124
|
entry.push("");
|
|
87362
|
-
if (
|
|
87363
|
-
const existing =
|
|
88125
|
+
if (existsSync6(sessionFile)) {
|
|
88126
|
+
const existing = readFileSync7(sessionFile, "utf-8");
|
|
87364
88127
|
atomicWriteText(sessionFile, existing.trimEnd() + `
|
|
87365
88128
|
` + entry.join(`
|
|
87366
88129
|
`));
|
|
@@ -87381,39 +88144,6 @@ function writeSessionToWiki(state, projDir) {
|
|
|
87381
88144
|
`));
|
|
87382
88145
|
}
|
|
87383
88146
|
}
|
|
87384
|
-
function gitBackupVault(onReminder) {
|
|
87385
|
-
const vaultPath = resolveVaultPath();
|
|
87386
|
-
const gitDir = join5(vaultPath, ".git");
|
|
87387
|
-
if (!existsSync4(gitDir)) {
|
|
87388
|
-
onReminder("[mink] wiki git-backup enabled but vault is not a git repo — run 'git init' in " + vaultPath);
|
|
87389
|
-
return;
|
|
87390
|
-
}
|
|
87391
|
-
try {
|
|
87392
|
-
const status = execSync("git status --porcelain", {
|
|
87393
|
-
cwd: vaultPath,
|
|
87394
|
-
timeout: 5000
|
|
87395
|
-
}).toString();
|
|
87396
|
-
if (!status.trim())
|
|
87397
|
-
return;
|
|
87398
|
-
execSync("git add -A", { cwd: vaultPath, timeout: 5000 });
|
|
87399
|
-
const msg = `mink: vault update ${new Date().toISOString().split("T")[0]}`;
|
|
87400
|
-
execSync(`git commit -m "${msg}"`, {
|
|
87401
|
-
cwd: vaultPath,
|
|
87402
|
-
timeout: 5000
|
|
87403
|
-
});
|
|
87404
|
-
const remote = resolveConfigValue("wiki.git-remote").value;
|
|
87405
|
-
try {
|
|
87406
|
-
execSync(`git push ${remote}`, {
|
|
87407
|
-
cwd: vaultPath,
|
|
87408
|
-
timeout: 1e4
|
|
87409
|
-
});
|
|
87410
|
-
} catch {
|
|
87411
|
-
onReminder(`[mink] wiki git push to '${remote}' failed — local commit preserved, will retry next session`);
|
|
87412
|
-
}
|
|
87413
|
-
} catch (err) {
|
|
87414
|
-
onReminder(`[mink] wiki git backup error: ${err instanceof Error ? err.message : String(err)}`);
|
|
87415
|
-
}
|
|
87416
|
-
}
|
|
87417
88147
|
|
|
87418
88148
|
// src/cli.ts
|
|
87419
88149
|
init_paths2();
|
|
@@ -87528,6 +88258,16 @@ switch (command2) {
|
|
|
87528
88258
|
await skill2(process.argv.slice(3));
|
|
87529
88259
|
break;
|
|
87530
88260
|
}
|
|
88261
|
+
case "sync": {
|
|
88262
|
+
const { sync: sync2 } = await Promise.resolve().then(() => (init_sync3(), exports_sync2));
|
|
88263
|
+
await sync2(process.argv.slice(3));
|
|
88264
|
+
break;
|
|
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
|
+
}
|
|
87531
88271
|
case "bug-search": {
|
|
87532
88272
|
const { bugSearch: bugSearch2 } = await Promise.resolve().then(() => (init_bug_search(), exports_bug_search));
|
|
87533
88273
|
bugSearch2(cwd, process.argv.slice(3).join(" "));
|
|
@@ -87547,11 +88287,11 @@ switch (command2) {
|
|
|
87547
88287
|
case "version":
|
|
87548
88288
|
case "--version":
|
|
87549
88289
|
case "-v": {
|
|
87550
|
-
const { resolve:
|
|
87551
|
-
const cliPath =
|
|
87552
|
-
const { readFileSync:
|
|
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");
|
|
87553
88293
|
try {
|
|
87554
|
-
const pkg = JSON.parse(
|
|
88294
|
+
const pkg = JSON.parse(readFileSync27(resolve14(cliPath, "../package.json"), "utf-8"));
|
|
87555
88295
|
console.log(`mink ${pkg.version}`);
|
|
87556
88296
|
} catch {
|
|
87557
88297
|
console.log("mink (unknown version)");
|
|
@@ -87573,13 +88313,25 @@ switch (command2) {
|
|
|
87573
88313
|
console.log(" config [key] [value] Manage global user settings");
|
|
87574
88314
|
console.log();
|
|
87575
88315
|
console.log("Notes & Wiki:");
|
|
87576
|
-
console.log(" wiki <cmd> Manage the notes/wiki vault (init|status|rebuild-index|organize)");
|
|
88316
|
+
console.log(" wiki <cmd> Manage the notes/wiki vault (init|status|link|unlink|links|rebuild-index|organize)");
|
|
87577
88317
|
console.log(' note "text" Capture a note to the vault');
|
|
87578
88318
|
console.log(" note --daily [text] Create or append to today's daily note");
|
|
87579
88319
|
console.log(" note list [filters] List notes (--category, --tag, --recent)");
|
|
87580
88320
|
console.log(" note search <term> Full-text search across the vault");
|
|
87581
88321
|
console.log(" skill install Install /mink:note skill for Claude Code");
|
|
87582
88322
|
console.log();
|
|
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");
|
|
88327
|
+
console.log(" sync Full manual sync (pull then push)");
|
|
88328
|
+
console.log(" sync init <remote-url> Connect ~/.mink to a git remote for cross-device sync");
|
|
88329
|
+
console.log(" sync status Show sync state (remote, last sync, pending changes)");
|
|
88330
|
+
console.log(" sync push Manually push local changes");
|
|
88331
|
+
console.log(" sync pull Manually pull remote changes");
|
|
88332
|
+
console.log(" sync pause / resume Temporarily disable/enable auto-sync");
|
|
88333
|
+
console.log(" sync disconnect Remove git tracking (data preserved)");
|
|
88334
|
+
console.log();
|
|
87583
88335
|
console.log("Automation & Analysis:");
|
|
87584
88336
|
console.log(" dashboard [--port=N] Open the real-time web dashboard");
|
|
87585
88337
|
console.log(" daemon <cmd> Manage the background daemon (start|stop|restart|logs)");
|