@drewpayment/mink 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1019 -530
- package/package.json +1 -1
- package/src/cli.ts +16 -1
- package/src/commands/session-start.ts +10 -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/sync.ts +333 -0
- package/src/core/vault.ts +82 -3
- package/src/types/config.ts +30 -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) {
|
|
@@ -560,19 +578,43 @@ var init_config = __esm(() => {
|
|
|
560
578
|
key: "wiki.git-backup",
|
|
561
579
|
default: "false",
|
|
562
580
|
envVar: "MINK_WIKI_GIT_BACKUP",
|
|
563
|
-
description: "
|
|
581
|
+
description: "Deprecated: use sync.enabled instead"
|
|
564
582
|
},
|
|
565
583
|
{
|
|
566
584
|
key: "wiki.git-remote",
|
|
567
585
|
default: "origin",
|
|
568
586
|
envVar: "MINK_WIKI_GIT_REMOTE",
|
|
569
|
-
description: "
|
|
587
|
+
description: "Deprecated: use sync.remote-url instead"
|
|
570
588
|
},
|
|
571
589
|
{
|
|
572
590
|
key: "notes.default-category",
|
|
573
591
|
default: "inbox",
|
|
574
592
|
envVar: "MINK_NOTES_DEFAULT_CATEGORY",
|
|
575
593
|
description: "Default category for notes captured via CLI"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
key: "sync.enabled",
|
|
597
|
+
default: "false",
|
|
598
|
+
envVar: "MINK_SYNC_ENABLED",
|
|
599
|
+
description: "Enable/disable automatic git sync of ~/.mink"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
key: "sync.remote-url",
|
|
603
|
+
default: "",
|
|
604
|
+
envVar: "MINK_SYNC_REMOTE_URL",
|
|
605
|
+
description: "Git remote URL for ~/.mink sync"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
key: "sync.last-push",
|
|
609
|
+
default: "",
|
|
610
|
+
envVar: "MINK_SYNC_LAST_PUSH",
|
|
611
|
+
description: "ISO timestamp of last successful sync push"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
key: "sync.last-pull",
|
|
615
|
+
default: "",
|
|
616
|
+
envVar: "MINK_SYNC_LAST_PULL",
|
|
617
|
+
description: "ISO timestamp of last successful sync pull"
|
|
576
618
|
}
|
|
577
619
|
];
|
|
578
620
|
VALID_KEYS = new Set(CONFIG_KEYS.map((k) => k.key));
|
|
@@ -635,9 +677,9 @@ var init_global_config = __esm(() => {
|
|
|
635
677
|
});
|
|
636
678
|
|
|
637
679
|
// src/core/vault.ts
|
|
638
|
-
import { join as join2 } from "path";
|
|
680
|
+
import { join as join2, basename as basename2, resolve } from "path";
|
|
639
681
|
import { homedir as homedir2 } from "os";
|
|
640
|
-
import { existsSync, mkdirSync as mkdirSync2 } from "fs";
|
|
682
|
+
import { existsSync, mkdirSync as mkdirSync2, symlinkSync, unlinkSync, lstatSync, readlinkSync } from "fs";
|
|
641
683
|
function resolveVaultPath() {
|
|
642
684
|
const resolved = resolveConfigValue("wiki.path");
|
|
643
685
|
const raw = resolved.value;
|
|
@@ -678,6 +720,12 @@ function isWikiEnabled() {
|
|
|
678
720
|
const resolved = resolveConfigValue("wiki.enabled");
|
|
679
721
|
return resolved.value === "true";
|
|
680
722
|
}
|
|
723
|
+
function loadVaultManifest() {
|
|
724
|
+
const raw = safeReadJson(vaultManifestPath());
|
|
725
|
+
if (raw === null || typeof raw !== "object")
|
|
726
|
+
return null;
|
|
727
|
+
return raw;
|
|
728
|
+
}
|
|
681
729
|
function ensureVaultStructure() {
|
|
682
730
|
const root = resolveVaultPath();
|
|
683
731
|
for (const dir of VAULT_DIRS) {
|
|
@@ -700,10 +748,66 @@ function categoryToDir(category, projectSlug) {
|
|
|
700
748
|
return join2(root, "inbox");
|
|
701
749
|
}
|
|
702
750
|
}
|
|
751
|
+
function saveManifest(manifest) {
|
|
752
|
+
atomicWriteJson(vaultManifestPath(), manifest);
|
|
753
|
+
}
|
|
754
|
+
function linkExternal(targetPath, name) {
|
|
755
|
+
const root = resolveVaultPath();
|
|
756
|
+
const absTarget = targetPath.startsWith("~/") ? join2(homedir2(), targetPath.slice(2)) : resolve(targetPath);
|
|
757
|
+
if (!existsSync(absTarget)) {
|
|
758
|
+
return { ok: false, error: `target does not exist: ${absTarget}` };
|
|
759
|
+
}
|
|
760
|
+
if (!lstatSync(absTarget).isDirectory()) {
|
|
761
|
+
return { ok: false, error: `target is not a directory: ${absTarget}` };
|
|
762
|
+
}
|
|
763
|
+
const linkName = name ?? basename2(absTarget);
|
|
764
|
+
const linkPath = join2(root, linkName);
|
|
765
|
+
if (existsSync(linkPath)) {
|
|
766
|
+
if (lstatSync(linkPath).isSymbolicLink()) {
|
|
767
|
+
const existing = readlinkSync(linkPath);
|
|
768
|
+
if (existing === absTarget) {
|
|
769
|
+
return { ok: false, error: `already linked: ${linkName} -> ${absTarget}` };
|
|
770
|
+
}
|
|
771
|
+
return { ok: false, error: `a different link already exists at ${linkName} -> ${existing}` };
|
|
772
|
+
}
|
|
773
|
+
return { ok: false, error: `${linkName} already exists in the vault and is not a symlink` };
|
|
774
|
+
}
|
|
775
|
+
symlinkSync(absTarget, linkPath, "dir");
|
|
776
|
+
const manifest = loadVaultManifest();
|
|
777
|
+
if (manifest) {
|
|
778
|
+
const links = manifest.links ?? [];
|
|
779
|
+
links.push({ name: linkName, target: absTarget, linkedAt: new Date().toISOString() });
|
|
780
|
+
manifest.links = links;
|
|
781
|
+
saveManifest(manifest);
|
|
782
|
+
}
|
|
783
|
+
return { ok: true, linkName, linkPath };
|
|
784
|
+
}
|
|
785
|
+
function unlinkExternal(name) {
|
|
786
|
+
const root = resolveVaultPath();
|
|
787
|
+
const linkPath = join2(root, name);
|
|
788
|
+
if (!existsSync(linkPath)) {
|
|
789
|
+
return { ok: false, error: `no link named "${name}" in the vault` };
|
|
790
|
+
}
|
|
791
|
+
if (!lstatSync(linkPath).isSymbolicLink()) {
|
|
792
|
+
return { ok: false, error: `"${name}" is not a symlink — refusing to remove` };
|
|
793
|
+
}
|
|
794
|
+
unlinkSync(linkPath);
|
|
795
|
+
const manifest = loadVaultManifest();
|
|
796
|
+
if (manifest && manifest.links) {
|
|
797
|
+
manifest.links = manifest.links.filter((l) => l.name !== name);
|
|
798
|
+
saveManifest(manifest);
|
|
799
|
+
}
|
|
800
|
+
return { ok: true };
|
|
801
|
+
}
|
|
802
|
+
function listLinks() {
|
|
803
|
+
const manifest = loadVaultManifest();
|
|
804
|
+
return manifest?.links ?? [];
|
|
805
|
+
}
|
|
703
806
|
var DEFAULT_VAULT_PATH, VAULT_DIRS;
|
|
704
807
|
var init_vault = __esm(() => {
|
|
705
808
|
init_global_config();
|
|
706
809
|
init_fs_utils();
|
|
810
|
+
init_fs_utils();
|
|
707
811
|
DEFAULT_VAULT_PATH = join2(homedir2(), ".mink", "wiki");
|
|
708
812
|
VAULT_DIRS = [
|
|
709
813
|
"",
|
|
@@ -906,6 +1010,232 @@ var init_note_index = __esm(() => {
|
|
|
906
1010
|
]);
|
|
907
1011
|
});
|
|
908
1012
|
|
|
1013
|
+
// src/core/sync.ts
|
|
1014
|
+
var exports_sync = {};
|
|
1015
|
+
__export(exports_sync, {
|
|
1016
|
+
syncPush: () => syncPush,
|
|
1017
|
+
syncPull: () => syncPull,
|
|
1018
|
+
isSyncInitialized: () => isSyncInitialized,
|
|
1019
|
+
initSync: () => initSync,
|
|
1020
|
+
getSyncStatus: () => getSyncStatus,
|
|
1021
|
+
ensureGitignore: () => ensureGitignore,
|
|
1022
|
+
disconnectSync: () => disconnectSync
|
|
1023
|
+
});
|
|
1024
|
+
import { existsSync as existsSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
1025
|
+
import { join as join4 } from "path";
|
|
1026
|
+
import { execSync } from "child_process";
|
|
1027
|
+
function git(args, timeoutMs = GIT_TIMEOUT) {
|
|
1028
|
+
return execSync(`git ${args}`, {
|
|
1029
|
+
cwd: minkRoot(),
|
|
1030
|
+
timeout: timeoutMs,
|
|
1031
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1032
|
+
}).toString().trim();
|
|
1033
|
+
}
|
|
1034
|
+
function gitSafe(args, timeoutMs = GIT_TIMEOUT) {
|
|
1035
|
+
try {
|
|
1036
|
+
return git(args, timeoutMs);
|
|
1037
|
+
} catch {
|
|
1038
|
+
return null;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function isSyncInitialized() {
|
|
1042
|
+
const enabled = resolveConfigValue("sync.enabled").value;
|
|
1043
|
+
if (enabled !== "true")
|
|
1044
|
+
return false;
|
|
1045
|
+
return existsSync3(join4(minkRoot(), ".git"));
|
|
1046
|
+
}
|
|
1047
|
+
function ensureGitignore() {
|
|
1048
|
+
const gitignorePath = join4(minkRoot(), ".gitignore");
|
|
1049
|
+
writeFileSync2(gitignorePath, GITIGNORE_CONTENTS);
|
|
1050
|
+
}
|
|
1051
|
+
function getSyncStatus() {
|
|
1052
|
+
const enabled = resolveConfigValue("sync.enabled").value === "true";
|
|
1053
|
+
const gitInitialized = existsSync3(join4(minkRoot(), ".git"));
|
|
1054
|
+
const remoteUrl = resolveConfigValue("sync.remote-url").value;
|
|
1055
|
+
const lastPush = resolveConfigValue("sync.last-push").value;
|
|
1056
|
+
const lastPull = resolveConfigValue("sync.last-pull").value;
|
|
1057
|
+
let pendingChanges = 0;
|
|
1058
|
+
let branch = "";
|
|
1059
|
+
if (gitInitialized) {
|
|
1060
|
+
const status = gitSafe("status --porcelain");
|
|
1061
|
+
if (status !== null) {
|
|
1062
|
+
pendingChanges = status.split(`
|
|
1063
|
+
`).filter((l) => l.trim().length > 0).length;
|
|
1064
|
+
}
|
|
1065
|
+
branch = gitSafe("rev-parse --abbrev-ref HEAD") ?? "";
|
|
1066
|
+
}
|
|
1067
|
+
return {
|
|
1068
|
+
enabled,
|
|
1069
|
+
gitInitialized,
|
|
1070
|
+
remoteUrl,
|
|
1071
|
+
lastPush,
|
|
1072
|
+
lastPull,
|
|
1073
|
+
pendingChanges,
|
|
1074
|
+
branch
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
function initSync(remoteUrl) {
|
|
1078
|
+
const root = minkRoot();
|
|
1079
|
+
const gitDir = join4(root, ".git");
|
|
1080
|
+
if (existsSync3(gitDir)) {
|
|
1081
|
+
console.log("[mink] sync is already initialized in " + root);
|
|
1082
|
+
console.log("[mink] run 'mink sync disconnect' first to reinitialize");
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
ensureGitignore();
|
|
1086
|
+
git("init");
|
|
1087
|
+
git(`remote add origin ${remoteUrl}`);
|
|
1088
|
+
const fetchResult = gitSafe("fetch origin", FETCH_TIMEOUT);
|
|
1089
|
+
if (fetchResult !== null) {
|
|
1090
|
+
const remoteBranches = gitSafe("branch -r");
|
|
1091
|
+
if (remoteBranches && remoteBranches.trim().length > 0) {
|
|
1092
|
+
const defaultBranch = detectRemoteDefaultBranch();
|
|
1093
|
+
try {
|
|
1094
|
+
git("add -A");
|
|
1095
|
+
const status = gitSafe("status --porcelain");
|
|
1096
|
+
if (status && status.trim().length > 0) {
|
|
1097
|
+
git(`commit -m "mink: local state before sync"`);
|
|
1098
|
+
}
|
|
1099
|
+
git(`pull --rebase origin ${defaultBranch}`, FETCH_TIMEOUT);
|
|
1100
|
+
} catch {
|
|
1101
|
+
gitSafe("rebase --abort");
|
|
1102
|
+
console.error("[mink] warning: could not merge remote content. Local state preserved.");
|
|
1103
|
+
console.error("[mink] you may need to resolve conflicts manually with 'mink sync pull'");
|
|
1104
|
+
}
|
|
1105
|
+
} else {
|
|
1106
|
+
git("add -A");
|
|
1107
|
+
git(`commit -m "mink: initial sync"`);
|
|
1108
|
+
git("branch -M main");
|
|
1109
|
+
git("push -u origin main", PUSH_TIMEOUT);
|
|
1110
|
+
}
|
|
1111
|
+
} else {
|
|
1112
|
+
git("add -A");
|
|
1113
|
+
git(`commit -m "mink: initial sync"`);
|
|
1114
|
+
git("branch -M main");
|
|
1115
|
+
try {
|
|
1116
|
+
git("push -u origin main", PUSH_TIMEOUT);
|
|
1117
|
+
} catch {
|
|
1118
|
+
console.error("[mink] push failed — local commit preserved, will retry on next sync");
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
setConfigValue("sync.enabled", "true");
|
|
1122
|
+
setConfigValue("sync.remote-url", remoteUrl);
|
|
1123
|
+
setConfigValue("sync.last-push", new Date().toISOString());
|
|
1124
|
+
console.log("[mink] sync initialized successfully");
|
|
1125
|
+
console.log("[mink] remote: " + remoteUrl);
|
|
1126
|
+
console.log("[mink] auto-sync: pull on session-start, push on session-stop");
|
|
1127
|
+
console.log("[mink] manual sync: run 'mink sync' at any time");
|
|
1128
|
+
}
|
|
1129
|
+
function syncPull(onMessage = (msg) => console.error(msg)) {
|
|
1130
|
+
if (!isSyncInitialized())
|
|
1131
|
+
return;
|
|
1132
|
+
const root = minkRoot();
|
|
1133
|
+
try {
|
|
1134
|
+
const status = gitSafe("status --porcelain");
|
|
1135
|
+
const hasLocalChanges = status !== null && status.trim().length > 0;
|
|
1136
|
+
if (hasLocalChanges) {
|
|
1137
|
+
gitSafe("stash push -m mink-sync-pull");
|
|
1138
|
+
}
|
|
1139
|
+
const branch = gitSafe("rev-parse --abbrev-ref HEAD") ?? "main";
|
|
1140
|
+
try {
|
|
1141
|
+
git(`pull --rebase origin ${branch}`, FETCH_TIMEOUT);
|
|
1142
|
+
} catch (err) {
|
|
1143
|
+
if (existsSync3(join4(root, ".git", "rebase-merge")) || existsSync3(join4(root, ".git", "rebase-apply"))) {
|
|
1144
|
+
gitSafe("rebase --abort");
|
|
1145
|
+
onMessage("[mink] sync pull: rebase conflict detected — aborted rebase, local state preserved");
|
|
1146
|
+
onMessage("[mink] resolve manually with 'mink sync pull' or 'cd ~/.mink && git pull --rebase origin main'");
|
|
1147
|
+
} else {
|
|
1148
|
+
onMessage(`[mink] sync pull failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
if (hasLocalChanges) {
|
|
1152
|
+
try {
|
|
1153
|
+
gitSafe("stash pop");
|
|
1154
|
+
} catch {
|
|
1155
|
+
onMessage("[mink] sync pull: stash pop had conflicts — your local changes are in git stash");
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
setConfigValue("sync.last-pull", new Date().toISOString());
|
|
1159
|
+
} catch (err) {
|
|
1160
|
+
onMessage(`[mink] sync pull error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
function syncPush(onMessage = (msg) => console.error(msg)) {
|
|
1164
|
+
if (!isSyncInitialized())
|
|
1165
|
+
return;
|
|
1166
|
+
const root = minkRoot();
|
|
1167
|
+
try {
|
|
1168
|
+
const status = gitSafe("status --porcelain");
|
|
1169
|
+
if (!status || !status.trim()) {
|
|
1170
|
+
const branch2 = gitSafe("rev-parse --abbrev-ref HEAD") ?? "main";
|
|
1171
|
+
try {
|
|
1172
|
+
git(`push origin ${branch2}`, PUSH_TIMEOUT);
|
|
1173
|
+
setConfigValue("sync.last-push", new Date().toISOString());
|
|
1174
|
+
} catch {}
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
git("add -A");
|
|
1178
|
+
const now = new Date;
|
|
1179
|
+
const timestamp = now.toISOString().replace("T", " ").slice(0, 16);
|
|
1180
|
+
git(`commit -m "mink: sync ${timestamp}"`);
|
|
1181
|
+
const branch = gitSafe("rev-parse --abbrev-ref HEAD") ?? "main";
|
|
1182
|
+
try {
|
|
1183
|
+
git(`pull --rebase origin ${branch}`, FETCH_TIMEOUT);
|
|
1184
|
+
} catch {
|
|
1185
|
+
if (existsSync3(join4(root, ".git", "rebase-merge")) || existsSync3(join4(root, ".git", "rebase-apply"))) {
|
|
1186
|
+
gitSafe("rebase --abort");
|
|
1187
|
+
onMessage("[mink] sync: rebase conflict during push — local commit preserved, skipping push");
|
|
1188
|
+
onMessage("[mink] resolve manually with 'mink sync pull' then 'mink sync push'");
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
try {
|
|
1193
|
+
git(`push origin ${branch}`, PUSH_TIMEOUT);
|
|
1194
|
+
setConfigValue("sync.last-push", new Date().toISOString());
|
|
1195
|
+
} catch {
|
|
1196
|
+
onMessage("[mink] sync push failed — local commit preserved, will retry next session");
|
|
1197
|
+
}
|
|
1198
|
+
} catch (err) {
|
|
1199
|
+
onMessage(`[mink] sync push error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
function disconnectSync() {
|
|
1203
|
+
const root = minkRoot();
|
|
1204
|
+
const gitDir = join4(root, ".git");
|
|
1205
|
+
if (!existsSync3(gitDir)) {
|
|
1206
|
+
console.log("[mink] sync is not initialized — nothing to disconnect");
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
const { rmSync } = __require("fs");
|
|
1210
|
+
rmSync(gitDir, { recursive: true, force: true });
|
|
1211
|
+
setConfigValue("sync.enabled", "false");
|
|
1212
|
+
setConfigValue("sync.remote-url", "");
|
|
1213
|
+
setConfigValue("sync.last-push", "");
|
|
1214
|
+
setConfigValue("sync.last-pull", "");
|
|
1215
|
+
console.log("[mink] sync disconnected — git tracking removed, data preserved");
|
|
1216
|
+
}
|
|
1217
|
+
function detectRemoteDefaultBranch() {
|
|
1218
|
+
const remoteBranches = gitSafe("branch -r") ?? "";
|
|
1219
|
+
if (remoteBranches.includes("origin/main"))
|
|
1220
|
+
return "main";
|
|
1221
|
+
if (remoteBranches.includes("origin/master"))
|
|
1222
|
+
return "master";
|
|
1223
|
+
const first = remoteBranches.split(`
|
|
1224
|
+
`).map((b) => b.trim()).filter((b) => b.startsWith("origin/") && !b.includes("HEAD")).map((b) => b.replace("origin/", ""))[0];
|
|
1225
|
+
return first ?? "main";
|
|
1226
|
+
}
|
|
1227
|
+
var GIT_TIMEOUT = 5000, PUSH_TIMEOUT = 1e4, FETCH_TIMEOUT = 15000, GITIGNORE_CONTENTS = `# Runtime state — machine-specific
|
|
1228
|
+
scheduler.pid
|
|
1229
|
+
scheduler.log
|
|
1230
|
+
|
|
1231
|
+
# Local backups — machine-specific snapshots
|
|
1232
|
+
projects/*/backups/
|
|
1233
|
+
`;
|
|
1234
|
+
var init_sync = __esm(() => {
|
|
1235
|
+
init_paths();
|
|
1236
|
+
init_global_config();
|
|
1237
|
+
});
|
|
1238
|
+
|
|
909
1239
|
// src/core/learning-memory.ts
|
|
910
1240
|
var exports_learning_memory = {};
|
|
911
1241
|
__export(exports_learning_memory, {
|
|
@@ -1281,13 +1611,13 @@ var exports_reflect = {};
|
|
|
1281
1611
|
__export(exports_reflect, {
|
|
1282
1612
|
reflect: () => reflect
|
|
1283
1613
|
});
|
|
1284
|
-
import { existsSync as
|
|
1614
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
|
|
1285
1615
|
function reflect(projectDir2, memoryPath, configPath2) {
|
|
1286
|
-
if (!
|
|
1616
|
+
if (!existsSync4(memoryPath)) {
|
|
1287
1617
|
console.log("[mink] no learning memory found");
|
|
1288
1618
|
return null;
|
|
1289
1619
|
}
|
|
1290
|
-
const markdown =
|
|
1620
|
+
const markdown = readFileSync5(memoryPath, "utf-8");
|
|
1291
1621
|
const mem = parseLearningMemory(markdown);
|
|
1292
1622
|
const config = safeReadJson(configPath2);
|
|
1293
1623
|
const tokenBudget = config?.learningMemoryTokenBudget ?? DEFAULT_TOKEN_BUDGET;
|
|
@@ -1306,7 +1636,7 @@ var init_reflect = __esm(() => {
|
|
|
1306
1636
|
});
|
|
1307
1637
|
|
|
1308
1638
|
// src/core/token-ledger.ts
|
|
1309
|
-
import { join as
|
|
1639
|
+
import { join as join5 } from "path";
|
|
1310
1640
|
function addToLifetime(lifetime, session) {
|
|
1311
1641
|
lifetime.totalTokens += session.totals.estimatedTokens;
|
|
1312
1642
|
lifetime.totalReads += session.totals.readCount;
|
|
@@ -1433,8 +1763,8 @@ function saveArchive(archivePath, newlyArchived) {
|
|
|
1433
1763
|
atomicWriteJson(archivePath, combined);
|
|
1434
1764
|
}
|
|
1435
1765
|
function createLedgerFinalizer(projectDir2, archiveThreshold = 1000) {
|
|
1436
|
-
const ledgerPath =
|
|
1437
|
-
const archivePath =
|
|
1766
|
+
const ledgerPath = join5(projectDir2, "token-ledger.json");
|
|
1767
|
+
const archivePath = join5(projectDir2, "token-ledger-archive.json");
|
|
1438
1768
|
return {
|
|
1439
1769
|
appendSession(summary) {
|
|
1440
1770
|
const ledger = loadLedger(ledgerPath);
|
|
@@ -1595,73 +1925,73 @@ __export(exports_paths2, {
|
|
|
1595
1925
|
backupDirPath: () => backupDirPath2,
|
|
1596
1926
|
actionLogPath: () => actionLogPath2
|
|
1597
1927
|
});
|
|
1598
|
-
import { join as
|
|
1928
|
+
import { join as join7 } from "path";
|
|
1599
1929
|
import { homedir as homedir3 } from "os";
|
|
1600
1930
|
function minkRoot2() {
|
|
1601
1931
|
return MINK_ROOT2;
|
|
1602
1932
|
}
|
|
1603
1933
|
function projectDir2(cwd) {
|
|
1604
1934
|
const id = generateProjectId(cwd);
|
|
1605
|
-
return
|
|
1935
|
+
return join7(MINK_ROOT2, "projects", id);
|
|
1606
1936
|
}
|
|
1607
1937
|
function sessionPath2(cwd) {
|
|
1608
|
-
return
|
|
1938
|
+
return join7(projectDir2(cwd), "session.json");
|
|
1609
1939
|
}
|
|
1610
1940
|
function fileIndexPath2(cwd) {
|
|
1611
|
-
return
|
|
1941
|
+
return join7(projectDir2(cwd), "file-index.json");
|
|
1612
1942
|
}
|
|
1613
1943
|
function configPath2(cwd) {
|
|
1614
|
-
return
|
|
1944
|
+
return join7(projectDir2(cwd), "config.json");
|
|
1615
1945
|
}
|
|
1616
1946
|
function learningMemoryPath2(cwd) {
|
|
1617
|
-
return
|
|
1947
|
+
return join7(projectDir2(cwd), "learning-memory.md");
|
|
1618
1948
|
}
|
|
1619
1949
|
function tokenLedgerPath2(cwd) {
|
|
1620
|
-
return
|
|
1950
|
+
return join7(projectDir2(cwd), "token-ledger.json");
|
|
1621
1951
|
}
|
|
1622
1952
|
function tokenLedgerArchivePath2(cwd) {
|
|
1623
|
-
return
|
|
1953
|
+
return join7(projectDir2(cwd), "token-ledger-archive.json");
|
|
1624
1954
|
}
|
|
1625
1955
|
function bugMemoryPath2(cwd) {
|
|
1626
|
-
return
|
|
1956
|
+
return join7(projectDir2(cwd), "bug-memory.json");
|
|
1627
1957
|
}
|
|
1628
1958
|
function actionLogPath2(cwd) {
|
|
1629
|
-
return
|
|
1959
|
+
return join7(projectDir2(cwd), "action-log.md");
|
|
1630
1960
|
}
|
|
1631
1961
|
function schedulerPidPath2() {
|
|
1632
|
-
return
|
|
1962
|
+
return join7(MINK_ROOT2, "scheduler.pid");
|
|
1633
1963
|
}
|
|
1634
1964
|
function schedulerLogPath2() {
|
|
1635
|
-
return
|
|
1965
|
+
return join7(MINK_ROOT2, "scheduler.log");
|
|
1636
1966
|
}
|
|
1637
1967
|
function schedulerManifestPath2(cwd) {
|
|
1638
|
-
return
|
|
1968
|
+
return join7(projectDir2(cwd), "scheduler-manifest.json");
|
|
1639
1969
|
}
|
|
1640
1970
|
function globalConfigPath2() {
|
|
1641
|
-
return
|
|
1971
|
+
return join7(MINK_ROOT2, "config");
|
|
1642
1972
|
}
|
|
1643
1973
|
function projectMetaPath2(cwd) {
|
|
1644
|
-
return
|
|
1974
|
+
return join7(projectDir2(cwd), "project-meta.json");
|
|
1645
1975
|
}
|
|
1646
1976
|
function backupDirPath2(cwd) {
|
|
1647
|
-
return
|
|
1977
|
+
return join7(projectDir2(cwd), "backups");
|
|
1648
1978
|
}
|
|
1649
1979
|
function designCapturesDir2(cwd) {
|
|
1650
|
-
return
|
|
1980
|
+
return join7(projectDir2(cwd), "design-captures");
|
|
1651
1981
|
}
|
|
1652
1982
|
function designReportPath2(cwd) {
|
|
1653
|
-
return
|
|
1983
|
+
return join7(projectDir2(cwd), "design-report.json");
|
|
1654
1984
|
}
|
|
1655
1985
|
function frameworkAdvisorPath2(cwd) {
|
|
1656
|
-
return
|
|
1986
|
+
return join7(projectDir2(cwd), "framework-advisor.md");
|
|
1657
1987
|
}
|
|
1658
1988
|
function frameworkAdvisorJsonPath2(cwd) {
|
|
1659
|
-
return
|
|
1989
|
+
return join7(projectDir2(cwd), "framework-advisor.json");
|
|
1660
1990
|
}
|
|
1661
1991
|
var MINK_ROOT2;
|
|
1662
1992
|
var init_paths2 = __esm(() => {
|
|
1663
1993
|
init_project_id();
|
|
1664
|
-
MINK_ROOT2 =
|
|
1994
|
+
MINK_ROOT2 = join7(homedir3(), ".mink");
|
|
1665
1995
|
});
|
|
1666
1996
|
|
|
1667
1997
|
// src/core/backup.ts
|
|
@@ -1674,12 +2004,12 @@ __export(exports_backup, {
|
|
|
1674
2004
|
import {
|
|
1675
2005
|
mkdirSync as mkdirSync4,
|
|
1676
2006
|
readdirSync as readdirSync2,
|
|
1677
|
-
readFileSync as
|
|
1678
|
-
writeFileSync as
|
|
1679
|
-
existsSync as
|
|
2007
|
+
readFileSync as readFileSync7,
|
|
2008
|
+
writeFileSync as writeFileSync3,
|
|
2009
|
+
existsSync as existsSync6,
|
|
1680
2010
|
statSync as statSync3
|
|
1681
2011
|
} from "fs";
|
|
1682
|
-
import { join as
|
|
2012
|
+
import { join as join8 } from "path";
|
|
1683
2013
|
function formatTimestamp(date) {
|
|
1684
2014
|
const y = date.getFullYear();
|
|
1685
2015
|
const mo = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -1697,9 +2027,9 @@ function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
|
|
|
1697
2027
|
if (entry.isDirectory()) {
|
|
1698
2028
|
if (excludeDirs.includes(entry.name))
|
|
1699
2029
|
continue;
|
|
1700
|
-
copyDirectoryFiles(
|
|
2030
|
+
copyDirectoryFiles(join8(srcDir, entry.name), join8(destDir, entry.name), excludeDirs);
|
|
1701
2031
|
} else if (entry.isFile()) {
|
|
1702
|
-
|
|
2032
|
+
writeFileSync3(join8(destDir, entry.name), readFileSync7(join8(srcDir, entry.name)));
|
|
1703
2033
|
}
|
|
1704
2034
|
}
|
|
1705
2035
|
}
|
|
@@ -1708,25 +2038,25 @@ function createBackup(cwd) {
|
|
|
1708
2038
|
const dir = backupDirPath(cwd);
|
|
1709
2039
|
let name = base;
|
|
1710
2040
|
let suffix = 1;
|
|
1711
|
-
while (
|
|
2041
|
+
while (existsSync6(join8(dir, name))) {
|
|
1712
2042
|
name = `${base}-${suffix}`;
|
|
1713
2043
|
suffix++;
|
|
1714
2044
|
}
|
|
1715
2045
|
const src = projectDir(cwd);
|
|
1716
|
-
const dest =
|
|
2046
|
+
const dest = join8(dir, name);
|
|
1717
2047
|
copyDirectoryFiles(src, dest, ["backups"]);
|
|
1718
2048
|
return name;
|
|
1719
2049
|
}
|
|
1720
2050
|
function listBackups(cwd) {
|
|
1721
2051
|
const dir = backupDirPath(cwd);
|
|
1722
|
-
if (!
|
|
2052
|
+
if (!existsSync6(dir))
|
|
1723
2053
|
return [];
|
|
1724
2054
|
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
1725
2055
|
const backups = [];
|
|
1726
2056
|
for (const entry of entries) {
|
|
1727
2057
|
if (!entry.isDirectory() || !entry.name.startsWith("backup-"))
|
|
1728
2058
|
continue;
|
|
1729
|
-
const backupPath =
|
|
2059
|
+
const backupPath = join8(dir, entry.name);
|
|
1730
2060
|
const match = entry.name.match(/^backup-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})(\d{3})?(?:-\d+)?$/);
|
|
1731
2061
|
let timestamp;
|
|
1732
2062
|
if (match) {
|
|
@@ -1749,8 +2079,8 @@ function listBackups(cwd) {
|
|
|
1749
2079
|
return backups;
|
|
1750
2080
|
}
|
|
1751
2081
|
function restoreBackup(cwd, backupName) {
|
|
1752
|
-
const backupPath =
|
|
1753
|
-
if (!
|
|
2082
|
+
const backupPath = join8(backupDirPath(cwd), backupName);
|
|
2083
|
+
if (!existsSync6(backupPath)) {
|
|
1754
2084
|
throw new Error(`backup not found: ${backupName}`);
|
|
1755
2085
|
}
|
|
1756
2086
|
createBackup(cwd);
|
|
@@ -1762,7 +2092,7 @@ var init_backup = __esm(() => {
|
|
|
1762
2092
|
|
|
1763
2093
|
// src/core/scanner.ts
|
|
1764
2094
|
import { readdirSync as readdirSync3, statSync as statSync4 } from "fs";
|
|
1765
|
-
import { join as
|
|
2095
|
+
import { join as join9, relative } from "path";
|
|
1766
2096
|
function matchesPattern(name, pattern) {
|
|
1767
2097
|
if (pattern.includes("*")) {
|
|
1768
2098
|
const regex = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
|
|
@@ -1786,14 +2116,14 @@ function walkDirectory(dir, projectRoot, excludes, results) {
|
|
|
1786
2116
|
if (entry.isDirectory()) {
|
|
1787
2117
|
if (isExcluded(entry.name, excludes))
|
|
1788
2118
|
continue;
|
|
1789
|
-
walkDirectory(
|
|
2119
|
+
walkDirectory(join9(dir, entry.name), projectRoot, excludes, results);
|
|
1790
2120
|
continue;
|
|
1791
2121
|
}
|
|
1792
2122
|
if (entry.isFile()) {
|
|
1793
2123
|
if (isExcluded(entry.name, excludes))
|
|
1794
2124
|
continue;
|
|
1795
2125
|
try {
|
|
1796
|
-
const fullPath =
|
|
2126
|
+
const fullPath = join9(dir, entry.name);
|
|
1797
2127
|
const stat = statSync4(fullPath);
|
|
1798
2128
|
results.push({
|
|
1799
2129
|
relativePath: relative(projectRoot, fullPath),
|
|
@@ -1882,7 +2212,7 @@ var init_scanner = __esm(() => {
|
|
|
1882
2212
|
});
|
|
1883
2213
|
|
|
1884
2214
|
// src/core/description.ts
|
|
1885
|
-
import { basename as
|
|
2215
|
+
import { basename as basename3, extname } from "path";
|
|
1886
2216
|
function truncate(str) {
|
|
1887
2217
|
if (str.length <= MAX_DESCRIPTION_LENGTH)
|
|
1888
2218
|
return str;
|
|
@@ -1938,7 +2268,7 @@ function extractComponent(content, filePath) {
|
|
|
1938
2268
|
if (![".tsx", ".jsx", ".vue", ".svelte"].includes(ext))
|
|
1939
2269
|
return null;
|
|
1940
2270
|
const namedMatch = content.match(/(?:export\s+(?:default\s+)?function|export\s+const)\s+([A-Z]\w+)/);
|
|
1941
|
-
const componentName = namedMatch ? namedMatch[1] :
|
|
2271
|
+
const componentName = namedMatch ? namedMatch[1] : basename3(filePath, ext);
|
|
1942
2272
|
const elements = [];
|
|
1943
2273
|
if (/<form[\s>]/i.test(content))
|
|
1944
2274
|
elements.push("form");
|
|
@@ -1956,13 +2286,13 @@ function extractComponent(content, filePath) {
|
|
|
1956
2286
|
}
|
|
1957
2287
|
function extractCiWorkflow(content, filePath) {
|
|
1958
2288
|
const normalized = filePath.replace(/\\/g, "/");
|
|
1959
|
-
const isCi = normalized.includes(".github/workflows/") || normalized.includes(".gitlab-ci") ||
|
|
2289
|
+
const isCi = normalized.includes(".github/workflows/") || normalized.includes(".gitlab-ci") || basename3(filePath).toLowerCase() === "jenkinsfile";
|
|
1960
2290
|
if (!isCi)
|
|
1961
2291
|
return null;
|
|
1962
2292
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
1963
2293
|
if (nameMatch)
|
|
1964
2294
|
return `CI: ${nameMatch[1].trim()}`;
|
|
1965
|
-
return `CI: ${
|
|
2295
|
+
return `CI: ${basename3(filePath)}`;
|
|
1966
2296
|
}
|
|
1967
2297
|
function extractMigration(content, filePath) {
|
|
1968
2298
|
const normalized = filePath.toLowerCase();
|
|
@@ -1972,7 +2302,7 @@ function extractMigration(content, filePath) {
|
|
|
1972
2302
|
const tableMatch = content.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["`]?(\w+)/i);
|
|
1973
2303
|
if (tableMatch)
|
|
1974
2304
|
return `migration: create ${tableMatch[1]}`;
|
|
1975
|
-
return `migration: ${
|
|
2305
|
+
return `migration: ${basename3(filePath)}`;
|
|
1976
2306
|
}
|
|
1977
2307
|
function extractFallback(content) {
|
|
1978
2308
|
const lines = content.split(`
|
|
@@ -1986,7 +2316,7 @@ function extractFallback(content) {
|
|
|
1986
2316
|
return null;
|
|
1987
2317
|
}
|
|
1988
2318
|
function extractDescription(filePath, content) {
|
|
1989
|
-
const name =
|
|
2319
|
+
const name = basename3(filePath);
|
|
1990
2320
|
const ext = extname(filePath).toLowerCase();
|
|
1991
2321
|
if (content.length === 0)
|
|
1992
2322
|
return `${name} — empty file`;
|
|
@@ -2120,8 +2450,8 @@ var exports_scan = {};
|
|
|
2120
2450
|
__export(exports_scan, {
|
|
2121
2451
|
scan: () => scan
|
|
2122
2452
|
});
|
|
2123
|
-
import { readFileSync as
|
|
2124
|
-
import { join as
|
|
2453
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
2454
|
+
import { join as join10 } from "path";
|
|
2125
2455
|
function loadExistingIndex(indexPath) {
|
|
2126
2456
|
const raw = safeReadJson(indexPath);
|
|
2127
2457
|
if (isFileIndex(raw))
|
|
@@ -2171,10 +2501,10 @@ function scan(cwd, options) {
|
|
|
2171
2501
|
newIndex.header.lifetimeHits = index.header.lifetimeHits;
|
|
2172
2502
|
newIndex.header.lifetimeMisses = index.header.lifetimeMisses;
|
|
2173
2503
|
for (const file of scanned) {
|
|
2174
|
-
const fullPath =
|
|
2504
|
+
const fullPath = join10(cwd, file.relativePath);
|
|
2175
2505
|
let content;
|
|
2176
2506
|
try {
|
|
2177
|
-
content =
|
|
2507
|
+
content = readFileSync8(fullPath, "utf-8");
|
|
2178
2508
|
} catch {
|
|
2179
2509
|
continue;
|
|
2180
2510
|
}
|
|
@@ -2209,13 +2539,13 @@ __export(exports_seed, {
|
|
|
2209
2539
|
parseGoMod: () => parseGoMod,
|
|
2210
2540
|
parseCargoToml: () => parseCargoToml
|
|
2211
2541
|
});
|
|
2212
|
-
import { basename as
|
|
2213
|
-
import { readFileSync as
|
|
2542
|
+
import { basename as basename4, join as join11 } from "path";
|
|
2543
|
+
import { readFileSync as readFileSync9, existsSync as existsSync7 } from "fs";
|
|
2214
2544
|
function readFile(filePath) {
|
|
2215
|
-
if (!
|
|
2545
|
+
if (!existsSync7(filePath))
|
|
2216
2546
|
return null;
|
|
2217
2547
|
try {
|
|
2218
|
-
return
|
|
2548
|
+
return readFileSync9(filePath, "utf-8");
|
|
2219
2549
|
} catch {
|
|
2220
2550
|
return null;
|
|
2221
2551
|
}
|
|
@@ -2290,7 +2620,7 @@ function parseGoMod(filePath) {
|
|
|
2290
2620
|
return null;
|
|
2291
2621
|
const moduleMatch = raw.match(/^module\s+(\S+)/m);
|
|
2292
2622
|
const modulePath = moduleMatch ? moduleMatch[1] : "";
|
|
2293
|
-
const projectName = modulePath ?
|
|
2623
|
+
const projectName = modulePath ? basename4(modulePath) : "";
|
|
2294
2624
|
const frameworks = [];
|
|
2295
2625
|
for (const [key, label] of Object.entries(GO_FRAMEWORKS)) {
|
|
2296
2626
|
if (raw.includes(key)) {
|
|
@@ -2305,13 +2635,13 @@ function parseGoMod(filePath) {
|
|
|
2305
2635
|
}
|
|
2306
2636
|
function seedLearningMemory(projectRoot) {
|
|
2307
2637
|
const parsers = [
|
|
2308
|
-
() => parsePackageJson(
|
|
2309
|
-
() => parsePyprojectToml(
|
|
2310
|
-
() => parseCargoToml(
|
|
2311
|
-
() => parseGoMod(
|
|
2638
|
+
() => parsePackageJson(join11(projectRoot, "package.json")),
|
|
2639
|
+
() => parsePyprojectToml(join11(projectRoot, "pyproject.toml")),
|
|
2640
|
+
() => parseCargoToml(join11(projectRoot, "Cargo.toml")),
|
|
2641
|
+
() => parseGoMod(join11(projectRoot, "go.mod"))
|
|
2312
2642
|
];
|
|
2313
2643
|
const infos = parsers.map((fn) => fn()).filter((info) => info !== null);
|
|
2314
|
-
const projectName = infos.find((i) => i.projectName)?.projectName ??
|
|
2644
|
+
const projectName = infos.find((i) => i.projectName)?.projectName ?? basename4(projectRoot);
|
|
2315
2645
|
const mem = createEmptyLearningMemory(projectName);
|
|
2316
2646
|
const infoWithDesc = infos.find((i) => i.description);
|
|
2317
2647
|
if (infoWithDesc?.description) {
|
|
@@ -2392,8 +2722,8 @@ __export(exports_init, {
|
|
|
2392
2722
|
buildHooksConfig: () => buildHooksConfig
|
|
2393
2723
|
});
|
|
2394
2724
|
import { execSync as execSync2 } from "child_process";
|
|
2395
|
-
import { mkdirSync as mkdirSync5, existsSync as
|
|
2396
|
-
import { resolve, dirname as dirname3, basename as
|
|
2725
|
+
import { mkdirSync as mkdirSync5, existsSync as existsSync8 } from "fs";
|
|
2726
|
+
import { resolve as resolve2, dirname as dirname3, basename as basename5, join as join12 } from "path";
|
|
2397
2727
|
function detectRuntime() {
|
|
2398
2728
|
try {
|
|
2399
2729
|
execSync2("bun --version", { stdio: "ignore" });
|
|
@@ -2408,11 +2738,11 @@ function resolveCliPath() {
|
|
|
2408
2738
|
if (selfPath.endsWith("dist/cli.js")) {
|
|
2409
2739
|
return selfPath;
|
|
2410
2740
|
}
|
|
2411
|
-
const projectRoot =
|
|
2412
|
-
const distPath =
|
|
2413
|
-
if (
|
|
2741
|
+
const projectRoot = resolve2(selfDir, "../..");
|
|
2742
|
+
const distPath = join12(projectRoot, "dist", "cli.js");
|
|
2743
|
+
if (existsSync8(distPath))
|
|
2414
2744
|
return distPath;
|
|
2415
|
-
return
|
|
2745
|
+
return resolve2(selfDir, "../cli.ts");
|
|
2416
2746
|
}
|
|
2417
2747
|
function buildHooksConfig(runtime, cliPath) {
|
|
2418
2748
|
const isTsSource = cliPath.endsWith(".ts");
|
|
@@ -2459,15 +2789,15 @@ function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
|
2459
2789
|
}
|
|
2460
2790
|
function isExistingInstallation(cwd) {
|
|
2461
2791
|
const dir = projectDir(cwd);
|
|
2462
|
-
if (!
|
|
2792
|
+
if (!existsSync8(dir))
|
|
2463
2793
|
return false;
|
|
2464
|
-
return
|
|
2794
|
+
return existsSync8(join12(dir, "file-index.json"));
|
|
2465
2795
|
}
|
|
2466
2796
|
async function init(cwd) {
|
|
2467
2797
|
const runtime = detectRuntime();
|
|
2468
2798
|
const cliPath = resolveCliPath();
|
|
2469
2799
|
const hooks = buildHooksConfig(runtime, cliPath);
|
|
2470
|
-
const settingsPath =
|
|
2800
|
+
const settingsPath = resolve2(cwd, ".claude", "settings.json");
|
|
2471
2801
|
const dir = projectDir(cwd);
|
|
2472
2802
|
const upgrading = isExistingInstallation(cwd);
|
|
2473
2803
|
if (upgrading) {
|
|
@@ -2485,7 +2815,7 @@ async function init(cwd) {
|
|
|
2485
2815
|
atomicWriteJson(metaPath, {
|
|
2486
2816
|
...existingMeta ?? {},
|
|
2487
2817
|
cwd,
|
|
2488
|
-
name:
|
|
2818
|
+
name: basename5(cwd),
|
|
2489
2819
|
initTimestamp: existingMeta?.initTimestamp ?? new Date().toISOString(),
|
|
2490
2820
|
version: "0.1.0",
|
|
2491
2821
|
...isNotesProject ? { projectType: "notes" } : {}
|
|
@@ -2505,7 +2835,7 @@ async function init(cwd) {
|
|
|
2505
2835
|
scan2(cwd, { check: false });
|
|
2506
2836
|
const { learningMemoryPath: learningMemoryPath3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
2507
2837
|
const memPath = learningMemoryPath3(cwd);
|
|
2508
|
-
if (!
|
|
2838
|
+
if (!existsSync8(memPath)) {
|
|
2509
2839
|
const { seedLearningMemory: seedLearningMemory2 } = await Promise.resolve().then(() => (init_seed(), exports_seed));
|
|
2510
2840
|
const { serializeLearningMemory: serializeLearningMemory2 } = await Promise.resolve().then(() => (init_learning_memory(), exports_learning_memory));
|
|
2511
2841
|
const mem = seedLearningMemory2(cwd);
|
|
@@ -2513,9 +2843,9 @@ async function init(cwd) {
|
|
|
2513
2843
|
}
|
|
2514
2844
|
if (isWikiEnabled() && isVaultInitialized() && !isNotesProject) {
|
|
2515
2845
|
try {
|
|
2516
|
-
const projectSlug =
|
|
2517
|
-
const overviewPath =
|
|
2518
|
-
if (!
|
|
2846
|
+
const projectSlug = basename5(cwd);
|
|
2847
|
+
const overviewPath = join12(vaultProjects(projectSlug), "overview.md");
|
|
2848
|
+
if (!existsSync8(overviewPath)) {
|
|
2519
2849
|
const now = new Date().toISOString();
|
|
2520
2850
|
const overview = [
|
|
2521
2851
|
`---`,
|
|
@@ -2552,12 +2882,12 @@ var init_init = __esm(() => {
|
|
|
2552
2882
|
});
|
|
2553
2883
|
|
|
2554
2884
|
// src/core/daemon.ts
|
|
2555
|
-
import { readFileSync as
|
|
2885
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, openSync } from "fs";
|
|
2556
2886
|
import { mkdirSync as mkdirSync6 } from "fs";
|
|
2557
|
-
import { dirname as dirname4, resolve as
|
|
2887
|
+
import { dirname as dirname4, resolve as resolve3 } from "path";
|
|
2558
2888
|
function readPidFile() {
|
|
2559
2889
|
try {
|
|
2560
|
-
const raw =
|
|
2890
|
+
const raw = readFileSync10(schedulerPidPath(), "utf-8");
|
|
2561
2891
|
const data = JSON.parse(raw);
|
|
2562
2892
|
if (data && typeof data.pid === "number" && typeof data.startedAt === "string" && typeof data.projectCwd === "string") {
|
|
2563
2893
|
return data;
|
|
@@ -2570,11 +2900,11 @@ function readPidFile() {
|
|
|
2570
2900
|
function writePidFile(data) {
|
|
2571
2901
|
const pidPath = schedulerPidPath();
|
|
2572
2902
|
mkdirSync6(dirname4(pidPath), { recursive: true });
|
|
2573
|
-
|
|
2903
|
+
writeFileSync4(pidPath, JSON.stringify(data, null, 2));
|
|
2574
2904
|
}
|
|
2575
2905
|
function removePidFile() {
|
|
2576
2906
|
try {
|
|
2577
|
-
|
|
2907
|
+
unlinkSync2(schedulerPidPath());
|
|
2578
2908
|
} catch {}
|
|
2579
2909
|
}
|
|
2580
2910
|
function isProcessAlive(pid) {
|
|
@@ -2595,7 +2925,7 @@ function startDaemon(cwd) {
|
|
|
2595
2925
|
removePidFile();
|
|
2596
2926
|
}
|
|
2597
2927
|
const __dir = dirname4(new URL(import.meta.url).pathname);
|
|
2598
|
-
const cliPath =
|
|
2928
|
+
const cliPath = resolve3(__dir, "../cli.ts");
|
|
2599
2929
|
const logPath = schedulerLogPath();
|
|
2600
2930
|
mkdirSync6(dirname4(logPath), { recursive: true });
|
|
2601
2931
|
const logFd = openSync(logPath, "a");
|
|
@@ -2667,9 +2997,9 @@ var exports_status = {};
|
|
|
2667
2997
|
__export(exports_status, {
|
|
2668
2998
|
status: () => status
|
|
2669
2999
|
});
|
|
2670
|
-
import { existsSync as
|
|
3000
|
+
import { existsSync as existsSync10, readFileSync as readFileSync11, statSync as statSync5 } from "fs";
|
|
2671
3001
|
function checkJsonFile(name, filePath, validator) {
|
|
2672
|
-
if (!
|
|
3002
|
+
if (!existsSync10(filePath))
|
|
2673
3003
|
return { name, path: filePath, status: "missing" };
|
|
2674
3004
|
const data = safeReadJson(filePath);
|
|
2675
3005
|
if (data === null)
|
|
@@ -2679,10 +3009,10 @@ function checkJsonFile(name, filePath, validator) {
|
|
|
2679
3009
|
return { name, path: filePath, status: "ok" };
|
|
2680
3010
|
}
|
|
2681
3011
|
function checkTextFile(name, filePath) {
|
|
2682
|
-
if (!
|
|
3012
|
+
if (!existsSync10(filePath))
|
|
2683
3013
|
return { name, path: filePath, status: "missing" };
|
|
2684
3014
|
try {
|
|
2685
|
-
|
|
3015
|
+
readFileSync11(filePath, "utf-8");
|
|
2686
3016
|
return { name, path: filePath, status: "ok" };
|
|
2687
3017
|
} catch {
|
|
2688
3018
|
return { name, path: filePath, status: "corrupt" };
|
|
@@ -2742,8 +3072,8 @@ function status(cwd) {
|
|
|
2742
3072
|
console.log();
|
|
2743
3073
|
try {
|
|
2744
3074
|
const memPath = learningMemoryPath(cwd);
|
|
2745
|
-
if (
|
|
2746
|
-
const content =
|
|
3075
|
+
if (existsSync10(memPath)) {
|
|
3076
|
+
const content = readFileSync11(memPath, "utf-8");
|
|
2747
3077
|
const mem = parseLearningMemory(content);
|
|
2748
3078
|
const total = totalEntryCount(mem);
|
|
2749
3079
|
const mtime = statSync5(memPath).mtime;
|
|
@@ -2797,8 +3127,8 @@ var exports_scan2 = {};
|
|
|
2797
3127
|
__export(exports_scan2, {
|
|
2798
3128
|
scan: () => scan2
|
|
2799
3129
|
});
|
|
2800
|
-
import { readFileSync as
|
|
2801
|
-
import { join as
|
|
3130
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
3131
|
+
import { join as join13 } from "path";
|
|
2802
3132
|
function loadExistingIndex2(indexPath) {
|
|
2803
3133
|
const raw = safeReadJson(indexPath);
|
|
2804
3134
|
if (isFileIndex(raw))
|
|
@@ -2848,10 +3178,10 @@ function scan2(cwd, options) {
|
|
|
2848
3178
|
newIndex.header.lifetimeHits = index.header.lifetimeHits;
|
|
2849
3179
|
newIndex.header.lifetimeMisses = index.header.lifetimeMisses;
|
|
2850
3180
|
for (const file of scanned) {
|
|
2851
|
-
const fullPath =
|
|
3181
|
+
const fullPath = join13(cwd, file.relativePath);
|
|
2852
3182
|
let content;
|
|
2853
3183
|
try {
|
|
2854
|
-
content =
|
|
3184
|
+
content = readFileSync12(fullPath, "utf-8");
|
|
2855
3185
|
} catch {
|
|
2856
3186
|
continue;
|
|
2857
3187
|
}
|
|
@@ -2882,13 +3212,13 @@ var exports_reflect2 = {};
|
|
|
2882
3212
|
__export(exports_reflect2, {
|
|
2883
3213
|
reflect: () => reflect2
|
|
2884
3214
|
});
|
|
2885
|
-
import { existsSync as
|
|
3215
|
+
import { existsSync as existsSync11, readFileSync as readFileSync13 } from "fs";
|
|
2886
3216
|
function reflect2(projectDir3, memoryPath, configPath3) {
|
|
2887
|
-
if (!
|
|
3217
|
+
if (!existsSync11(memoryPath)) {
|
|
2888
3218
|
console.log("[mink] no learning memory found");
|
|
2889
3219
|
return null;
|
|
2890
3220
|
}
|
|
2891
|
-
const markdown =
|
|
3221
|
+
const markdown = readFileSync13(memoryPath, "utf-8");
|
|
2892
3222
|
const mem = parseLearningMemory(markdown);
|
|
2893
3223
|
const config = safeReadJson(configPath3);
|
|
2894
3224
|
const tokenBudget = config?.learningMemoryTokenBudget ?? DEFAULT_TOKEN_BUDGET2;
|
|
@@ -3169,7 +3499,7 @@ __export(exports_pre_write, {
|
|
|
3169
3499
|
analyzePreWrite: () => analyzePreWrite
|
|
3170
3500
|
});
|
|
3171
3501
|
import { relative as relative4 } from "path";
|
|
3172
|
-
import { readFileSync as
|
|
3502
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
3173
3503
|
function analyzePreWrite(filePath, writeContent, doNotRepeatEntries, bugMemory) {
|
|
3174
3504
|
const warnings = [];
|
|
3175
3505
|
const allMatches = [];
|
|
@@ -3223,7 +3553,7 @@ async function preWrite(cwd) {
|
|
|
3223
3553
|
const writeContent = extractWriteContent(input);
|
|
3224
3554
|
let doNotRepeatEntries = [];
|
|
3225
3555
|
try {
|
|
3226
|
-
const markdown =
|
|
3556
|
+
const markdown = readFileSync14(learningMemoryPath(cwd), "utf-8");
|
|
3227
3557
|
const mem = parseLearningMemory(markdown);
|
|
3228
3558
|
doNotRepeatEntries = getEntries(mem, "Do-Not-Repeat");
|
|
3229
3559
|
} catch {}
|
|
@@ -3260,12 +3590,12 @@ var init_pre_write = __esm(() => {
|
|
|
3260
3590
|
});
|
|
3261
3591
|
|
|
3262
3592
|
// src/core/write-exclusions.ts
|
|
3263
|
-
import { basename as
|
|
3593
|
+
import { basename as basename6 } from "path";
|
|
3264
3594
|
function isWriteExcluded(relativePath) {
|
|
3265
3595
|
if (relativePath === ".mink" || relativePath.startsWith(".mink/") || relativePath.startsWith(".mink\\")) {
|
|
3266
3596
|
return true;
|
|
3267
3597
|
}
|
|
3268
|
-
const name =
|
|
3598
|
+
const name = basename6(relativePath);
|
|
3269
3599
|
if (name === ".env" || name.startsWith(".env.")) {
|
|
3270
3600
|
return true;
|
|
3271
3601
|
}
|
|
@@ -3280,7 +3610,7 @@ __export(exports_post_write, {
|
|
|
3280
3610
|
analyzePostWrite: () => analyzePostWrite
|
|
3281
3611
|
});
|
|
3282
3612
|
import { relative as relative5 } from "path";
|
|
3283
|
-
import { readFileSync as
|
|
3613
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
3284
3614
|
function analyzePostWrite(filePath, fileContent, index) {
|
|
3285
3615
|
if (isWriteExcluded(filePath)) {
|
|
3286
3616
|
return {
|
|
@@ -3344,7 +3674,7 @@ async function postWrite(cwd) {
|
|
|
3344
3674
|
const filePath = relative5(cwd, absolutePath);
|
|
3345
3675
|
let fileContent = null;
|
|
3346
3676
|
try {
|
|
3347
|
-
fileContent =
|
|
3677
|
+
fileContent = readFileSync15(absolutePath, "utf-8");
|
|
3348
3678
|
} catch {}
|
|
3349
3679
|
const rawState = safeReadJson(sessionPath(cwd));
|
|
3350
3680
|
const state = isSessionState(rawState) ? rawState : createSessionState();
|
|
@@ -3764,10 +4094,10 @@ async function executeTask(taskId, projectCwd) {
|
|
|
3764
4094
|
if (task.actionType === "ai-cli") {
|
|
3765
4095
|
try {
|
|
3766
4096
|
const { learningMemoryPath: learningMemoryPath4 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
3767
|
-
const { readFileSync:
|
|
4097
|
+
const { readFileSync: readFileSync16 } = await import("fs");
|
|
3768
4098
|
let memoryContent;
|
|
3769
4099
|
try {
|
|
3770
|
-
memoryContent =
|
|
4100
|
+
memoryContent = readFileSync16(learningMemoryPath4(projectCwd), "utf-8");
|
|
3771
4101
|
} catch {
|
|
3772
4102
|
console.log("[mink] no learning memory found, skipping reflection");
|
|
3773
4103
|
return;
|
|
@@ -3897,7 +4227,7 @@ function loadManifest(cwd) {
|
|
|
3897
4227
|
}
|
|
3898
4228
|
return null;
|
|
3899
4229
|
}
|
|
3900
|
-
function
|
|
4230
|
+
function saveManifest2(cwd, manifest) {
|
|
3901
4231
|
atomicWriteJson(schedulerManifestPath(cwd), manifest);
|
|
3902
4232
|
}
|
|
3903
4233
|
function getOrCreateManifest(cwd, now) {
|
|
@@ -3905,7 +4235,7 @@ function getOrCreateManifest(cwd, now) {
|
|
|
3905
4235
|
if (existing)
|
|
3906
4236
|
return existing;
|
|
3907
4237
|
const fresh = createInitialManifest(now);
|
|
3908
|
-
|
|
4238
|
+
saveManifest2(cwd, fresh);
|
|
3909
4239
|
return fresh;
|
|
3910
4240
|
}
|
|
3911
4241
|
function recoverManifest(manifest, now) {
|
|
@@ -3954,7 +4284,7 @@ function createScheduler(projectCwd, options = {}) {
|
|
|
3954
4284
|
let ticking = false;
|
|
3955
4285
|
manifest = getOrCreateManifest(projectCwd, startedAt);
|
|
3956
4286
|
recoverManifest(manifest, startedAt);
|
|
3957
|
-
|
|
4287
|
+
saveManifest2(projectCwd, manifest);
|
|
3958
4288
|
async function tick() {
|
|
3959
4289
|
if (ticking)
|
|
3960
4290
|
return;
|
|
@@ -3995,7 +4325,7 @@ function createScheduler(projectCwd, options = {}) {
|
|
|
3995
4325
|
record.status = "running";
|
|
3996
4326
|
record.lastRunAt = now.toISOString();
|
|
3997
4327
|
activeTasks.push(taskId);
|
|
3998
|
-
|
|
4328
|
+
saveManifest2(projectCwd, manifest);
|
|
3999
4329
|
try {
|
|
4000
4330
|
await executeTask(taskId, projectCwd);
|
|
4001
4331
|
record.status = "idle";
|
|
@@ -4028,12 +4358,12 @@ function createScheduler(projectCwd, options = {}) {
|
|
|
4028
4358
|
}
|
|
4029
4359
|
} finally {
|
|
4030
4360
|
activeTasks = activeTasks.filter((id) => id !== taskId);
|
|
4031
|
-
|
|
4361
|
+
saveManifest2(projectCwd, manifest);
|
|
4032
4362
|
}
|
|
4033
4363
|
}
|
|
4034
4364
|
function emitHeartbeat() {
|
|
4035
4365
|
manifest.lastHeartbeat = new Date().toISOString();
|
|
4036
|
-
|
|
4366
|
+
saveManifest2(projectCwd, manifest);
|
|
4037
4367
|
console.log(`[mink] heartbeat at ${manifest.lastHeartbeat}`);
|
|
4038
4368
|
}
|
|
4039
4369
|
return {
|
|
@@ -4182,7 +4512,7 @@ async function cronRun(cwd, taskId) {
|
|
|
4182
4512
|
errorMessages: [lastError?.message ?? "Unknown error"],
|
|
4183
4513
|
attemptCount: task.retryPolicy.maxAttempts
|
|
4184
4514
|
});
|
|
4185
|
-
|
|
4515
|
+
saveManifest2(cwd, manifest);
|
|
4186
4516
|
}
|
|
4187
4517
|
process.exit(1);
|
|
4188
4518
|
}
|
|
@@ -4224,7 +4554,7 @@ async function cronDeadLetter(cwd, args) {
|
|
|
4224
4554
|
record.status = "idle";
|
|
4225
4555
|
record.currentAttempt = 0;
|
|
4226
4556
|
}
|
|
4227
|
-
|
|
4557
|
+
saveManifest2(cwd, manifest);
|
|
4228
4558
|
console.log(`[mink] retrying dead-lettered task: ${taskId}`);
|
|
4229
4559
|
try {
|
|
4230
4560
|
await executeTask(taskId, cwd);
|
|
@@ -4234,7 +4564,7 @@ async function cronDeadLetter(cwd, args) {
|
|
|
4234
4564
|
record.lastRunAt = new Date().toISOString();
|
|
4235
4565
|
record.consecutiveFailures = 0;
|
|
4236
4566
|
}
|
|
4237
|
-
|
|
4567
|
+
saveManifest2(cwd, manifest);
|
|
4238
4568
|
} catch (err) {
|
|
4239
4569
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
4240
4570
|
console.error(`[mink] task ${taskId} failed again: ${errorMsg}`);
|
|
@@ -4248,7 +4578,7 @@ async function cronDeadLetter(cwd, args) {
|
|
|
4248
4578
|
if (record) {
|
|
4249
4579
|
record.status = "dead-lettered";
|
|
4250
4580
|
}
|
|
4251
|
-
|
|
4581
|
+
saveManifest2(cwd, manifest);
|
|
4252
4582
|
process.exit(1);
|
|
4253
4583
|
}
|
|
4254
4584
|
return;
|
|
@@ -4325,9 +4655,9 @@ var init_design_eval = __esm(() => {
|
|
|
4325
4655
|
});
|
|
4326
4656
|
|
|
4327
4657
|
// src/core/dashboard-api.ts
|
|
4328
|
-
import { existsSync as
|
|
4658
|
+
import { existsSync as existsSync12, readFileSync as readFileSync16 } from "fs";
|
|
4329
4659
|
function checkJsonFile2(name, filePath, validator) {
|
|
4330
|
-
if (!
|
|
4660
|
+
if (!existsSync12(filePath))
|
|
4331
4661
|
return { name, status: "missing" };
|
|
4332
4662
|
const data = safeReadJson(filePath);
|
|
4333
4663
|
if (data === null)
|
|
@@ -4337,10 +4667,10 @@ function checkJsonFile2(name, filePath, validator) {
|
|
|
4337
4667
|
return { name, status: "ok" };
|
|
4338
4668
|
}
|
|
4339
4669
|
function checkTextFile2(name, filePath) {
|
|
4340
|
-
if (!
|
|
4670
|
+
if (!existsSync12(filePath))
|
|
4341
4671
|
return { name, status: "missing" };
|
|
4342
4672
|
try {
|
|
4343
|
-
|
|
4673
|
+
readFileSync16(filePath, "utf-8");
|
|
4344
4674
|
return { name, status: "ok" };
|
|
4345
4675
|
} catch {
|
|
4346
4676
|
return { name, status: "corrupt" };
|
|
@@ -4423,7 +4753,7 @@ function loadSchedulerPanel(cwd) {
|
|
|
4423
4753
|
}
|
|
4424
4754
|
function loadLearningMemoryPanel(cwd) {
|
|
4425
4755
|
const memPath = learningMemoryPath(cwd);
|
|
4426
|
-
if (!
|
|
4756
|
+
if (!existsSync12(memPath)) {
|
|
4427
4757
|
return {
|
|
4428
4758
|
projectName: "unknown",
|
|
4429
4759
|
sections: {
|
|
@@ -4435,7 +4765,7 @@ function loadLearningMemoryPanel(cwd) {
|
|
|
4435
4765
|
};
|
|
4436
4766
|
}
|
|
4437
4767
|
try {
|
|
4438
|
-
const content =
|
|
4768
|
+
const content = readFileSync16(memPath, "utf-8");
|
|
4439
4769
|
return parseLearningMemory(content);
|
|
4440
4770
|
} catch {
|
|
4441
4771
|
return {
|
|
@@ -4501,7 +4831,7 @@ async function triggerDeadLetterRetry(cwd, taskId) {
|
|
|
4501
4831
|
record.consecutiveFailures = 0;
|
|
4502
4832
|
record.currentAttempt = 0;
|
|
4503
4833
|
}
|
|
4504
|
-
|
|
4834
|
+
saveManifest2(cwd, manifest);
|
|
4505
4835
|
await executeTask(taskId, cwd);
|
|
4506
4836
|
return { success: true };
|
|
4507
4837
|
} catch (err) {
|
|
@@ -4537,10 +4867,10 @@ var init_dashboard_api = __esm(() => {
|
|
|
4537
4867
|
});
|
|
4538
4868
|
|
|
4539
4869
|
// src/core/project-registry.ts
|
|
4540
|
-
import { readdirSync as readdirSync4, existsSync as
|
|
4541
|
-
import { join as
|
|
4870
|
+
import { readdirSync as readdirSync4, existsSync as existsSync13 } from "fs";
|
|
4871
|
+
import { join as join14 } from "path";
|
|
4542
4872
|
function getProjectMeta(projDir) {
|
|
4543
|
-
const metaPath =
|
|
4873
|
+
const metaPath = join14(projDir, "project-meta.json");
|
|
4544
4874
|
const raw = safeReadJson(metaPath);
|
|
4545
4875
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
4546
4876
|
return null;
|
|
@@ -4557,15 +4887,15 @@ function getProjectMeta(projDir) {
|
|
|
4557
4887
|
};
|
|
4558
4888
|
}
|
|
4559
4889
|
function listRegisteredProjects() {
|
|
4560
|
-
const projectsDir =
|
|
4561
|
-
if (!
|
|
4890
|
+
const projectsDir = join14(minkRoot(), "projects");
|
|
4891
|
+
if (!existsSync13(projectsDir))
|
|
4562
4892
|
return [];
|
|
4563
4893
|
const entries = readdirSync4(projectsDir, { withFileTypes: true });
|
|
4564
4894
|
const projects = [];
|
|
4565
4895
|
for (const entry of entries) {
|
|
4566
4896
|
if (!entry.isDirectory())
|
|
4567
4897
|
continue;
|
|
4568
|
-
const projDir =
|
|
4898
|
+
const projDir = join14(projectsDir, entry.name);
|
|
4569
4899
|
const meta = getProjectMeta(projDir);
|
|
4570
4900
|
if (meta) {
|
|
4571
4901
|
projects.push({
|
|
@@ -4648,7 +4978,7 @@ async function runtimeServe(opts) {
|
|
|
4648
4978
|
}
|
|
4649
4979
|
const { createServer } = await import("node:http");
|
|
4650
4980
|
const { Readable } = await import("node:stream");
|
|
4651
|
-
return new Promise((
|
|
4981
|
+
return new Promise((resolve4) => {
|
|
4652
4982
|
const httpServer = createServer(async (req, res) => {
|
|
4653
4983
|
const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
|
|
4654
4984
|
const headers = new Headers;
|
|
@@ -4707,7 +5037,7 @@ async function runtimeServe(opts) {
|
|
|
4707
5037
|
httpServer.listen(opts.port, opts.hostname, () => {
|
|
4708
5038
|
const addr = httpServer.address();
|
|
4709
5039
|
const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
|
|
4710
|
-
|
|
5040
|
+
resolve4({
|
|
4711
5041
|
port: boundPort,
|
|
4712
5042
|
stop: (close) => {
|
|
4713
5043
|
if (close)
|
|
@@ -4729,8 +5059,8 @@ __export(exports_dashboard_server, {
|
|
|
4729
5059
|
startDashboardServer: () => startDashboardServer
|
|
4730
5060
|
});
|
|
4731
5061
|
import { watch } from "fs";
|
|
4732
|
-
import { existsSync as
|
|
4733
|
-
import { basename as
|
|
5062
|
+
import { existsSync as existsSync14 } from "fs";
|
|
5063
|
+
import { basename as basename7, dirname as dirname5, join as join15, extname as extname2 } from "path";
|
|
4734
5064
|
|
|
4735
5065
|
class SSEManager {
|
|
4736
5066
|
clients = new Map;
|
|
@@ -4809,7 +5139,7 @@ function getProjectsList(startupCwd, activeCwd) {
|
|
|
4809
5139
|
registered.unshift({
|
|
4810
5140
|
id: startupId,
|
|
4811
5141
|
cwd: startupCwd,
|
|
4812
|
-
name: meta?.name ??
|
|
5142
|
+
name: meta?.name ?? basename7(startupCwd),
|
|
4813
5143
|
version: meta?.version ?? "0.1.0"
|
|
4814
5144
|
});
|
|
4815
5145
|
}
|
|
@@ -4820,7 +5150,7 @@ function getProjectsList(startupCwd, activeCwd) {
|
|
|
4820
5150
|
registered.unshift({
|
|
4821
5151
|
id: activeId,
|
|
4822
5152
|
cwd: activeCwd,
|
|
4823
|
-
name: meta?.name ??
|
|
5153
|
+
name: meta?.name ?? basename7(activeCwd),
|
|
4824
5154
|
version: meta?.version ?? "0.1.0"
|
|
4825
5155
|
});
|
|
4826
5156
|
}
|
|
@@ -4835,7 +5165,7 @@ function createFileWatcher(cwd, onChange) {
|
|
|
4835
5165
|
watcher = watch(dir, (eventType, filename) => {
|
|
4836
5166
|
if (!filename)
|
|
4837
5167
|
return;
|
|
4838
|
-
const name =
|
|
5168
|
+
const name = basename7(filename);
|
|
4839
5169
|
if (name.endsWith(".tmp"))
|
|
4840
5170
|
return;
|
|
4841
5171
|
const fileId = STATE_FILE_MAP[name];
|
|
@@ -4906,12 +5236,12 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4906
5236
|
const __dir = dirname5(new URL(import.meta.url).pathname);
|
|
4907
5237
|
let pkgRoot = __dir;
|
|
4908
5238
|
while (pkgRoot !== dirname5(pkgRoot)) {
|
|
4909
|
-
if (
|
|
5239
|
+
if (existsSync14(join15(pkgRoot, "package.json")))
|
|
4910
5240
|
break;
|
|
4911
5241
|
pkgRoot = dirname5(pkgRoot);
|
|
4912
5242
|
}
|
|
4913
|
-
const dashboardOutDir =
|
|
4914
|
-
const dashboardBuilt =
|
|
5243
|
+
const dashboardOutDir = join15(pkgRoot, "dashboard", "out");
|
|
5244
|
+
const dashboardBuilt = existsSync14(join15(dashboardOutDir, "index.html"));
|
|
4915
5245
|
let clientIdCounter = 0;
|
|
4916
5246
|
if (!dashboardBuilt) {
|
|
4917
5247
|
console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
|
|
@@ -4941,9 +5271,9 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4941
5271
|
} else {
|
|
4942
5272
|
let filePath;
|
|
4943
5273
|
if (pathname === "/") {
|
|
4944
|
-
filePath =
|
|
5274
|
+
filePath = join15(dashboardOutDir, "index.html");
|
|
4945
5275
|
} else {
|
|
4946
|
-
filePath =
|
|
5276
|
+
filePath = join15(dashboardOutDir, pathname);
|
|
4947
5277
|
}
|
|
4948
5278
|
if (!filePath.startsWith(dashboardOutDir)) {
|
|
4949
5279
|
return jsonResponse({ error: "Forbidden" }, 403);
|
|
@@ -4956,7 +5286,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
4956
5286
|
const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
|
|
4957
5287
|
if (htmlServed)
|
|
4958
5288
|
return htmlServed;
|
|
4959
|
-
const indexServed = await serveFile(
|
|
5289
|
+
const indexServed = await serveFile(join15(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
|
|
4960
5290
|
if (indexServed)
|
|
4961
5291
|
return indexServed;
|
|
4962
5292
|
}
|
|
@@ -5016,7 +5346,7 @@ retry: 3000
|
|
|
5016
5346
|
if (!filename || filename.includes("..") || filename.includes("/")) {
|
|
5017
5347
|
return jsonResponse({ error: "Invalid filename" }, 400);
|
|
5018
5348
|
}
|
|
5019
|
-
const imgPath =
|
|
5349
|
+
const imgPath = join15(designCapturesDir(resolvedCwd), filename);
|
|
5020
5350
|
const served = await serveFile(imgPath, "image/jpeg");
|
|
5021
5351
|
if (served) {
|
|
5022
5352
|
served.headers.set("Cache-Control", "public, max-age=60");
|
|
@@ -5148,9 +5478,9 @@ var exports_dashboard = {};
|
|
|
5148
5478
|
__export(exports_dashboard, {
|
|
5149
5479
|
dashboard: () => dashboard
|
|
5150
5480
|
});
|
|
5151
|
-
import { existsSync as
|
|
5481
|
+
import { existsSync as existsSync15 } from "fs";
|
|
5152
5482
|
async function dashboard(cwd, args) {
|
|
5153
|
-
if (!
|
|
5483
|
+
if (!existsSync15(projectDir(cwd))) {
|
|
5154
5484
|
console.error("[mink] project not initialized. Run: mink init");
|
|
5155
5485
|
process.exit(1);
|
|
5156
5486
|
}
|
|
@@ -5172,7 +5502,7 @@ var exports_daemon = {};
|
|
|
5172
5502
|
__export(exports_daemon, {
|
|
5173
5503
|
daemon: () => daemon
|
|
5174
5504
|
});
|
|
5175
|
-
import { readFileSync as
|
|
5505
|
+
import { readFileSync as readFileSync17, existsSync as existsSync16 } from "fs";
|
|
5176
5506
|
async function daemon(cwd, args) {
|
|
5177
5507
|
const subcommand = args[0];
|
|
5178
5508
|
switch (subcommand) {
|
|
@@ -5188,12 +5518,12 @@ async function daemon(cwd, args) {
|
|
|
5188
5518
|
break;
|
|
5189
5519
|
case "logs": {
|
|
5190
5520
|
const logPath = schedulerLogPath();
|
|
5191
|
-
if (!
|
|
5521
|
+
if (!existsSync16(logPath)) {
|
|
5192
5522
|
console.log("[mink] no log file found");
|
|
5193
5523
|
return;
|
|
5194
5524
|
}
|
|
5195
5525
|
try {
|
|
5196
|
-
const content =
|
|
5526
|
+
const content = readFileSync17(logPath, "utf-8");
|
|
5197
5527
|
const lines = content.split(`
|
|
5198
5528
|
`);
|
|
5199
5529
|
const tail = lines.slice(-50).join(`
|
|
@@ -5227,13 +5557,13 @@ function printValidKeys() {
|
|
|
5227
5557
|
}
|
|
5228
5558
|
}
|
|
5229
5559
|
function readLineFromStdin() {
|
|
5230
|
-
return new Promise((
|
|
5560
|
+
return new Promise((resolve4) => {
|
|
5231
5561
|
const chunks = [];
|
|
5232
5562
|
process.stdin.resume();
|
|
5233
5563
|
process.stdin.setEncoding("utf-8");
|
|
5234
5564
|
process.stdin.once("data", (data) => {
|
|
5235
5565
|
process.stdin.pause();
|
|
5236
|
-
|
|
5566
|
+
resolve4(String(data).trim());
|
|
5237
5567
|
});
|
|
5238
5568
|
});
|
|
5239
5569
|
}
|
|
@@ -5305,8 +5635,8 @@ var init_config2 = __esm(() => {
|
|
|
5305
5635
|
|
|
5306
5636
|
// src/commands/init.ts
|
|
5307
5637
|
import { execSync as execSync3 } from "child_process";
|
|
5308
|
-
import { mkdirSync as mkdirSync7, existsSync as
|
|
5309
|
-
import { resolve as
|
|
5638
|
+
import { mkdirSync as mkdirSync7, existsSync as existsSync17 } from "fs";
|
|
5639
|
+
import { resolve as resolve4, dirname as dirname6, basename as basename8, join as join16 } from "path";
|
|
5310
5640
|
function detectRuntime2() {
|
|
5311
5641
|
try {
|
|
5312
5642
|
execSync3("bun --version", { stdio: "ignore" });
|
|
@@ -5370,7 +5700,7 @@ var exports_update = {};
|
|
|
5370
5700
|
__export(exports_update, {
|
|
5371
5701
|
update: () => update
|
|
5372
5702
|
});
|
|
5373
|
-
import { resolve as
|
|
5703
|
+
import { resolve as resolve5, dirname as dirname7 } from "path";
|
|
5374
5704
|
function parseArgs(args) {
|
|
5375
5705
|
let dryRun = false;
|
|
5376
5706
|
let project = null;
|
|
@@ -5418,7 +5748,7 @@ async function update(cwd, args) {
|
|
|
5418
5748
|
return;
|
|
5419
5749
|
}
|
|
5420
5750
|
const runtime = detectRuntime2();
|
|
5421
|
-
const cliPath =
|
|
5751
|
+
const cliPath = resolve5(dirname7(new URL(import.meta.url).pathname), "../cli.ts");
|
|
5422
5752
|
const newHooks = buildHooksConfig2(runtime, cliPath);
|
|
5423
5753
|
for (const target of targets) {
|
|
5424
5754
|
console.log(`[mink] updating: ${target.name} (${target.id})`);
|
|
@@ -5429,7 +5759,7 @@ async function update(cwd, args) {
|
|
|
5429
5759
|
}
|
|
5430
5760
|
const backupName = createBackup(target.cwd);
|
|
5431
5761
|
console.log(` backup: ${backupName}`);
|
|
5432
|
-
const settingsPath =
|
|
5762
|
+
const settingsPath = resolve5(target.cwd, ".claude", "settings.json");
|
|
5433
5763
|
mergeHooksIntoSettings2(settingsPath, newHooks);
|
|
5434
5764
|
console.log(" hooks: updated");
|
|
5435
5765
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -5487,8 +5817,8 @@ var init_restore = __esm(() => {
|
|
|
5487
5817
|
});
|
|
5488
5818
|
|
|
5489
5819
|
// src/core/design-eval/server-detect.ts
|
|
5490
|
-
import { readFileSync as
|
|
5491
|
-
import { join as
|
|
5820
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
5821
|
+
import { join as join17 } from "path";
|
|
5492
5822
|
async function probePort(port) {
|
|
5493
5823
|
try {
|
|
5494
5824
|
const controller = new AbortController;
|
|
@@ -5510,7 +5840,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
5510
5840
|
}
|
|
5511
5841
|
function detectDevCommand(cwd) {
|
|
5512
5842
|
try {
|
|
5513
|
-
const raw =
|
|
5843
|
+
const raw = readFileSync18(join17(cwd, "package.json"), "utf-8");
|
|
5514
5844
|
const pkg = JSON.parse(raw);
|
|
5515
5845
|
const scripts = pkg.scripts;
|
|
5516
5846
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -5530,10 +5860,10 @@ var init_server_detect = __esm(() => {
|
|
|
5530
5860
|
});
|
|
5531
5861
|
|
|
5532
5862
|
// src/core/design-eval/route-detect.ts
|
|
5533
|
-
import { existsSync as
|
|
5534
|
-
import { join as
|
|
5863
|
+
import { existsSync as existsSync18, readdirSync as readdirSync5, statSync as statSync8 } from "fs";
|
|
5864
|
+
import { join as join18, relative as relative6, sep } from "path";
|
|
5535
5865
|
function detectFramework(cwd) {
|
|
5536
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
5866
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync18(join18(cwd, `${name}.${ext}`))) || existsSync18(join18(cwd, name));
|
|
5537
5867
|
if (has("next.config"))
|
|
5538
5868
|
return "nextjs";
|
|
5539
5869
|
if (has("svelte.config"))
|
|
@@ -5558,8 +5888,8 @@ function detectRoutes(cwd) {
|
|
|
5558
5888
|
}
|
|
5559
5889
|
function detectNextRoutes(cwd) {
|
|
5560
5890
|
const routes = [];
|
|
5561
|
-
const appDir =
|
|
5562
|
-
if (
|
|
5891
|
+
const appDir = join18(cwd, "app");
|
|
5892
|
+
if (existsSync18(appDir)) {
|
|
5563
5893
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
5564
5894
|
for (const file of pageFiles) {
|
|
5565
5895
|
const rel = relative6(appDir, file);
|
|
@@ -5570,8 +5900,8 @@ function detectNextRoutes(cwd) {
|
|
|
5570
5900
|
routes.push(route);
|
|
5571
5901
|
}
|
|
5572
5902
|
}
|
|
5573
|
-
const pagesDir =
|
|
5574
|
-
if (
|
|
5903
|
+
const pagesDir = join18(cwd, "pages");
|
|
5904
|
+
if (existsSync18(pagesDir)) {
|
|
5575
5905
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
5576
5906
|
for (const file of pageFiles) {
|
|
5577
5907
|
const rel = relative6(pagesDir, file);
|
|
@@ -5590,8 +5920,8 @@ function detectNextRoutes(cwd) {
|
|
|
5590
5920
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
5591
5921
|
}
|
|
5592
5922
|
function detectSvelteKitRoutes(cwd) {
|
|
5593
|
-
const routesDir =
|
|
5594
|
-
if (!
|
|
5923
|
+
const routesDir = join18(cwd, "src", "routes");
|
|
5924
|
+
if (!existsSync18(routesDir))
|
|
5595
5925
|
return ["/"];
|
|
5596
5926
|
const routes = [];
|
|
5597
5927
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
@@ -5606,8 +5936,8 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
5606
5936
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
5607
5937
|
}
|
|
5608
5938
|
function detectNuxtRoutes(cwd) {
|
|
5609
|
-
const pagesDir =
|
|
5610
|
-
if (!
|
|
5939
|
+
const pagesDir = join18(cwd, "pages");
|
|
5940
|
+
if (!existsSync18(pagesDir))
|
|
5611
5941
|
return ["/"];
|
|
5612
5942
|
const routes = [];
|
|
5613
5943
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
@@ -5633,7 +5963,7 @@ function findFiles(dir, pattern) {
|
|
|
5633
5963
|
for (const entry of entries) {
|
|
5634
5964
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
5635
5965
|
continue;
|
|
5636
|
-
const full =
|
|
5966
|
+
const full = join18(current, entry);
|
|
5637
5967
|
try {
|
|
5638
5968
|
const stat2 = statSync8(full);
|
|
5639
5969
|
if (stat2.isDirectory()) {
|
|
@@ -5661,11 +5991,11 @@ function __extends(d, b) {
|
|
|
5661
5991
|
}
|
|
5662
5992
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
5663
5993
|
function adopt(value) {
|
|
5664
|
-
return value instanceof P ? value : new P(function(
|
|
5665
|
-
|
|
5994
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
5995
|
+
resolve6(value);
|
|
5666
5996
|
});
|
|
5667
5997
|
}
|
|
5668
|
-
return new (P || (P = Promise))(function(
|
|
5998
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
5669
5999
|
function fulfilled(value) {
|
|
5670
6000
|
try {
|
|
5671
6001
|
step(generator.next(value));
|
|
@@ -5681,7 +6011,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
5681
6011
|
}
|
|
5682
6012
|
}
|
|
5683
6013
|
function step(result) {
|
|
5684
|
-
result.done ?
|
|
6014
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
5685
6015
|
}
|
|
5686
6016
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5687
6017
|
});
|
|
@@ -5864,14 +6194,14 @@ function __asyncValues(o) {
|
|
|
5864
6194
|
}, i);
|
|
5865
6195
|
function verb(n) {
|
|
5866
6196
|
i[n] = o[n] && function(v) {
|
|
5867
|
-
return new Promise(function(
|
|
5868
|
-
v = o[n](v), settle(
|
|
6197
|
+
return new Promise(function(resolve6, reject) {
|
|
6198
|
+
v = o[n](v), settle(resolve6, reject, v.done, v.value);
|
|
5869
6199
|
});
|
|
5870
6200
|
};
|
|
5871
6201
|
}
|
|
5872
|
-
function settle(
|
|
6202
|
+
function settle(resolve6, reject, d, v) {
|
|
5873
6203
|
Promise.resolve(v).then(function(v2) {
|
|
5874
|
-
|
|
6204
|
+
resolve6({ value: v2, done: d });
|
|
5875
6205
|
}, reject);
|
|
5876
6206
|
}
|
|
5877
6207
|
}
|
|
@@ -6402,7 +6732,7 @@ function of() {
|
|
|
6402
6732
|
}
|
|
6403
6733
|
function lastValueFrom(source, config22) {
|
|
6404
6734
|
var hasConfig = typeof config22 === "object";
|
|
6405
|
-
return new Promise(function(
|
|
6735
|
+
return new Promise(function(resolve6, reject) {
|
|
6406
6736
|
var _hasValue = false;
|
|
6407
6737
|
var _value;
|
|
6408
6738
|
source.subscribe({
|
|
@@ -6413,9 +6743,9 @@ function lastValueFrom(source, config22) {
|
|
|
6413
6743
|
error: reject,
|
|
6414
6744
|
complete: function() {
|
|
6415
6745
|
if (_hasValue) {
|
|
6416
|
-
|
|
6746
|
+
resolve6(_value);
|
|
6417
6747
|
} else if (hasConfig) {
|
|
6418
|
-
|
|
6748
|
+
resolve6(config22.defaultValue);
|
|
6419
6749
|
} else {
|
|
6420
6750
|
reject(new EmptyError);
|
|
6421
6751
|
}
|
|
@@ -6425,16 +6755,16 @@ function lastValueFrom(source, config22) {
|
|
|
6425
6755
|
}
|
|
6426
6756
|
function firstValueFrom(source, config22) {
|
|
6427
6757
|
var hasConfig = typeof config22 === "object";
|
|
6428
|
-
return new Promise(function(
|
|
6758
|
+
return new Promise(function(resolve6, reject) {
|
|
6429
6759
|
var subscriber = new SafeSubscriber({
|
|
6430
6760
|
next: function(value) {
|
|
6431
|
-
|
|
6761
|
+
resolve6(value);
|
|
6432
6762
|
subscriber.unsubscribe();
|
|
6433
6763
|
},
|
|
6434
6764
|
error: reject,
|
|
6435
6765
|
complete: function() {
|
|
6436
6766
|
if (hasConfig) {
|
|
6437
|
-
|
|
6767
|
+
resolve6(config22.defaultValue);
|
|
6438
6768
|
} else {
|
|
6439
6769
|
reject(new EmptyError);
|
|
6440
6770
|
}
|
|
@@ -7486,7 +7816,7 @@ var init_rxjs = __esm(() => {
|
|
|
7486
7816
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
7487
7817
|
var _this = this;
|
|
7488
7818
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
7489
|
-
return new promiseCtor(function(
|
|
7819
|
+
return new promiseCtor(function(resolve6, reject) {
|
|
7490
7820
|
var subscriber = new SafeSubscriber({
|
|
7491
7821
|
next: function(value) {
|
|
7492
7822
|
try {
|
|
@@ -7497,7 +7827,7 @@ var init_rxjs = __esm(() => {
|
|
|
7497
7827
|
}
|
|
7498
7828
|
},
|
|
7499
7829
|
error: reject,
|
|
7500
|
-
complete:
|
|
7830
|
+
complete: resolve6
|
|
7501
7831
|
});
|
|
7502
7832
|
_this.subscribe(subscriber);
|
|
7503
7833
|
});
|
|
@@ -7519,14 +7849,14 @@ var init_rxjs = __esm(() => {
|
|
|
7519
7849
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
7520
7850
|
var _this = this;
|
|
7521
7851
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
7522
|
-
return new promiseCtor(function(
|
|
7852
|
+
return new promiseCtor(function(resolve6, reject) {
|
|
7523
7853
|
var value;
|
|
7524
7854
|
_this.subscribe(function(x) {
|
|
7525
7855
|
return value = x;
|
|
7526
7856
|
}, function(err) {
|
|
7527
7857
|
return reject(err);
|
|
7528
7858
|
}, function() {
|
|
7529
|
-
return
|
|
7859
|
+
return resolve6(value);
|
|
7530
7860
|
});
|
|
7531
7861
|
});
|
|
7532
7862
|
};
|
|
@@ -9452,8 +9782,8 @@ class Deferred {
|
|
|
9452
9782
|
#isRejected = false;
|
|
9453
9783
|
#value;
|
|
9454
9784
|
#resolve;
|
|
9455
|
-
#taskPromise = new Promise((
|
|
9456
|
-
this.#resolve =
|
|
9785
|
+
#taskPromise = new Promise((resolve6) => {
|
|
9786
|
+
this.#resolve = resolve6;
|
|
9457
9787
|
});
|
|
9458
9788
|
#timeoutId;
|
|
9459
9789
|
#timeoutError;
|
|
@@ -9542,12 +9872,12 @@ var init_Mutex = __esm(() => {
|
|
|
9542
9872
|
return new Mutex.Guard(this, onRelease);
|
|
9543
9873
|
}
|
|
9544
9874
|
release() {
|
|
9545
|
-
const
|
|
9546
|
-
if (!
|
|
9875
|
+
const resolve6 = this.#acquirers.shift();
|
|
9876
|
+
if (!resolve6) {
|
|
9547
9877
|
this.#locked = false;
|
|
9548
9878
|
return;
|
|
9549
9879
|
}
|
|
9550
|
-
|
|
9880
|
+
resolve6();
|
|
9551
9881
|
}
|
|
9552
9882
|
};
|
|
9553
9883
|
});
|
|
@@ -11291,12 +11621,12 @@ var init_locators = __esm(() => {
|
|
|
11291
11621
|
}
|
|
11292
11622
|
return defer(() => {
|
|
11293
11623
|
return from(handle.evaluate((element) => {
|
|
11294
|
-
return new Promise((
|
|
11624
|
+
return new Promise((resolve6) => {
|
|
11295
11625
|
window.requestAnimationFrame(() => {
|
|
11296
11626
|
const rect1 = element.getBoundingClientRect();
|
|
11297
11627
|
window.requestAnimationFrame(() => {
|
|
11298
11628
|
const rect2 = element.getBoundingClientRect();
|
|
11299
|
-
|
|
11629
|
+
resolve6([
|
|
11300
11630
|
{
|
|
11301
11631
|
x: rect1.x,
|
|
11302
11632
|
y: rect1.y,
|
|
@@ -12587,9 +12917,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
12587
12917
|
const handle = await this.#asSVGElementHandle();
|
|
12588
12918
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
12589
12919
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
12590
|
-
const visibleRatio = await new Promise((
|
|
12920
|
+
const visibleRatio = await new Promise((resolve6) => {
|
|
12591
12921
|
const observer = new IntersectionObserver((entries) => {
|
|
12592
|
-
|
|
12922
|
+
resolve6(entries[0].intersectionRatio);
|
|
12593
12923
|
observer.disconnect();
|
|
12594
12924
|
});
|
|
12595
12925
|
observer.observe(element);
|
|
@@ -12983,7 +13313,7 @@ var init_Frame = __esm(() => {
|
|
|
12983
13313
|
}
|
|
12984
13314
|
type = type ?? "text/javascript";
|
|
12985
13315
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
12986
|
-
return await new Promise((
|
|
13316
|
+
return await new Promise((resolve6, reject) => {
|
|
12987
13317
|
const script = document.createElement("script");
|
|
12988
13318
|
script.type = type2;
|
|
12989
13319
|
script.text = content2;
|
|
@@ -12996,12 +13326,12 @@ var init_Frame = __esm(() => {
|
|
|
12996
13326
|
if (url) {
|
|
12997
13327
|
script.src = url;
|
|
12998
13328
|
script.addEventListener("load", () => {
|
|
12999
|
-
|
|
13329
|
+
resolve6(script);
|
|
13000
13330
|
}, { once: true });
|
|
13001
13331
|
document.head.appendChild(script);
|
|
13002
13332
|
} else {
|
|
13003
13333
|
document.head.appendChild(script);
|
|
13004
|
-
|
|
13334
|
+
resolve6(script);
|
|
13005
13335
|
}
|
|
13006
13336
|
});
|
|
13007
13337
|
}, { ...options, type, content }));
|
|
@@ -13018,7 +13348,7 @@ var init_Frame = __esm(() => {
|
|
|
13018
13348
|
options.content = content;
|
|
13019
13349
|
}
|
|
13020
13350
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
13021
|
-
return await new Promise((
|
|
13351
|
+
return await new Promise((resolve6, reject) => {
|
|
13022
13352
|
let element;
|
|
13023
13353
|
if (!url) {
|
|
13024
13354
|
element = document.createElement("style");
|
|
@@ -13030,7 +13360,7 @@ var init_Frame = __esm(() => {
|
|
|
13030
13360
|
element = link;
|
|
13031
13361
|
}
|
|
13032
13362
|
element.addEventListener("load", () => {
|
|
13033
|
-
|
|
13363
|
+
resolve6(element);
|
|
13034
13364
|
}, { once: true });
|
|
13035
13365
|
element.addEventListener("error", (event) => {
|
|
13036
13366
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -13884,9 +14214,9 @@ var init_Page = __esm(() => {
|
|
|
13884
14214
|
++this.#screencastSessionCount;
|
|
13885
14215
|
if (!this.#startScreencastPromise) {
|
|
13886
14216
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
13887
|
-
return new Promise((
|
|
14217
|
+
return new Promise((resolve6) => {
|
|
13888
14218
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
13889
|
-
return
|
|
14219
|
+
return resolve6();
|
|
13890
14220
|
});
|
|
13891
14221
|
});
|
|
13892
14222
|
});
|
|
@@ -16544,11 +16874,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
16544
16874
|
return value instanceof Node;
|
|
16545
16875
|
})
|
|
16546
16876
|
}));
|
|
16547
|
-
return new Promise((
|
|
16877
|
+
return new Promise((resolve6, reject) => {
|
|
16548
16878
|
callPuppeteer.callbacks.set(seq, {
|
|
16549
16879
|
resolve(value) {
|
|
16550
16880
|
callPuppeteer.args.delete(seq);
|
|
16551
|
-
|
|
16881
|
+
resolve6(value);
|
|
16552
16882
|
},
|
|
16553
16883
|
reject(value) {
|
|
16554
16884
|
callPuppeteer.args.delete(seq);
|
|
@@ -20011,8 +20341,8 @@ var init_Input2 = __esm(() => {
|
|
|
20011
20341
|
if (typeof delay === "number") {
|
|
20012
20342
|
await Promise.all(actions);
|
|
20013
20343
|
actions.length = 0;
|
|
20014
|
-
await new Promise((
|
|
20015
|
-
setTimeout(
|
|
20344
|
+
await new Promise((resolve6) => {
|
|
20345
|
+
setTimeout(resolve6, delay);
|
|
20016
20346
|
});
|
|
20017
20347
|
}
|
|
20018
20348
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -20032,9 +20362,9 @@ var init_Input2 = __esm(() => {
|
|
|
20032
20362
|
});
|
|
20033
20363
|
}
|
|
20034
20364
|
async drag(start, target) {
|
|
20035
|
-
const promise = new Promise((
|
|
20365
|
+
const promise = new Promise((resolve6) => {
|
|
20036
20366
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
20037
|
-
return
|
|
20367
|
+
return resolve6(event.data);
|
|
20038
20368
|
});
|
|
20039
20369
|
});
|
|
20040
20370
|
await this.move(start.x, start.y);
|
|
@@ -20075,8 +20405,8 @@ var init_Input2 = __esm(() => {
|
|
|
20075
20405
|
await this.dragEnter(target, data);
|
|
20076
20406
|
await this.dragOver(target, data);
|
|
20077
20407
|
if (delay) {
|
|
20078
|
-
await new Promise((
|
|
20079
|
-
return setTimeout(
|
|
20408
|
+
await new Promise((resolve6) => {
|
|
20409
|
+
return setTimeout(resolve6, delay);
|
|
20080
20410
|
});
|
|
20081
20411
|
}
|
|
20082
20412
|
await this.drop(target, data);
|
|
@@ -20888,9 +21218,9 @@ var init_Page2 = __esm(() => {
|
|
|
20888
21218
|
async captureHeapSnapshot(options) {
|
|
20889
21219
|
const { createWriteStream } = environment.value.fs;
|
|
20890
21220
|
const stream = createWriteStream(options.path);
|
|
20891
|
-
const streamPromise = new Promise((
|
|
21221
|
+
const streamPromise = new Promise((resolve6, reject) => {
|
|
20892
21222
|
stream.on("error", reject);
|
|
20893
|
-
stream.on("finish",
|
|
21223
|
+
stream.on("finish", resolve6);
|
|
20894
21224
|
});
|
|
20895
21225
|
const client = this.#primaryTargetClient;
|
|
20896
21226
|
await client.send("HeapProfiler.enable");
|
|
@@ -22403,10 +22733,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
22403
22733
|
|
|
22404
22734
|
class BrowserWebSocketTransport {
|
|
22405
22735
|
static create(url) {
|
|
22406
|
-
return new Promise((
|
|
22736
|
+
return new Promise((resolve6, reject) => {
|
|
22407
22737
|
const ws = new WebSocket(url);
|
|
22408
22738
|
ws.addEventListener("open", () => {
|
|
22409
|
-
return
|
|
22739
|
+
return resolve6(new BrowserWebSocketTransport(ws));
|
|
22410
22740
|
});
|
|
22411
22741
|
ws.addEventListener("error", reject);
|
|
22412
22742
|
});
|
|
@@ -25240,11 +25570,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
25240
25570
|
}
|
|
25241
25571
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
25242
25572
|
try {
|
|
25243
|
-
const detachedFromTargetPromise = new Promise((
|
|
25573
|
+
const detachedFromTargetPromise = new Promise((resolve6) => {
|
|
25244
25574
|
const onContextDestroyed = (event) => {
|
|
25245
25575
|
if (event.targetId === params.context) {
|
|
25246
25576
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
25247
|
-
|
|
25577
|
+
resolve6();
|
|
25248
25578
|
}
|
|
25249
25579
|
};
|
|
25250
25580
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -26564,7 +26894,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
26564
26894
|
}
|
|
26565
26895
|
}
|
|
26566
26896
|
const promises = [
|
|
26567
|
-
new Promise((
|
|
26897
|
+
new Promise((resolve6) => setTimeout(resolve6, this.#tickDuration))
|
|
26568
26898
|
];
|
|
26569
26899
|
for (const option of options) {
|
|
26570
26900
|
promises.push(this.#dispatchAction(option));
|
|
@@ -27163,8 +27493,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
27163
27493
|
acquire() {
|
|
27164
27494
|
const state = { resolved: false };
|
|
27165
27495
|
if (this.#locked) {
|
|
27166
|
-
return new Promise((
|
|
27167
|
-
this.#acquirers.push(() =>
|
|
27496
|
+
return new Promise((resolve6) => {
|
|
27497
|
+
this.#acquirers.push(() => resolve6(this.#release.bind(this, state)));
|
|
27168
27498
|
});
|
|
27169
27499
|
}
|
|
27170
27500
|
this.#locked = true;
|
|
@@ -27175,12 +27505,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
27175
27505
|
throw new Error("Cannot release more than once.");
|
|
27176
27506
|
}
|
|
27177
27507
|
state.resolved = true;
|
|
27178
|
-
const
|
|
27179
|
-
if (!
|
|
27508
|
+
const resolve6 = this.#acquirers.shift();
|
|
27509
|
+
if (!resolve6) {
|
|
27180
27510
|
this.#locked = false;
|
|
27181
27511
|
return;
|
|
27182
27512
|
}
|
|
27183
|
-
|
|
27513
|
+
resolve6();
|
|
27184
27514
|
}
|
|
27185
27515
|
async run(action) {
|
|
27186
27516
|
const release = await this.acquire();
|
|
@@ -28307,8 +28637,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
28307
28637
|
let queueNonEmptyResolver = null;
|
|
28308
28638
|
return {
|
|
28309
28639
|
async getMessage() {
|
|
28310
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
28311
|
-
queueNonEmptyResolver =
|
|
28640
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve6) => {
|
|
28641
|
+
queueNonEmptyResolver = resolve6;
|
|
28312
28642
|
});
|
|
28313
28643
|
await onMessage;
|
|
28314
28644
|
return queue.shift();
|
|
@@ -28394,7 +28724,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
28394
28724
|
functionDeclaration: String((id) => {
|
|
28395
28725
|
const w = window;
|
|
28396
28726
|
if (w[id] === undefined) {
|
|
28397
|
-
return new Promise((
|
|
28727
|
+
return new Promise((resolve6) => w[id] = resolve6);
|
|
28398
28728
|
}
|
|
28399
28729
|
const channelProxy = w[id];
|
|
28400
28730
|
delete w[id];
|
|
@@ -29745,8 +30075,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
29745
30075
|
return this.#result;
|
|
29746
30076
|
}
|
|
29747
30077
|
constructor() {
|
|
29748
|
-
this.#promise = new Promise((
|
|
29749
|
-
this.#resolve =
|
|
30078
|
+
this.#promise = new Promise((resolve6, reject) => {
|
|
30079
|
+
this.#resolve = resolve6;
|
|
29750
30080
|
this.#reject = reject;
|
|
29751
30081
|
});
|
|
29752
30082
|
this.#promise.catch((_error) => {});
|
|
@@ -34071,11 +34401,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
34071
34401
|
if (this.#contexts.has(browsingContextId)) {
|
|
34072
34402
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
34073
34403
|
}
|
|
34074
|
-
return new Promise((
|
|
34404
|
+
return new Promise((resolve6) => {
|
|
34075
34405
|
const listener = (event) => {
|
|
34076
34406
|
if (event.browsingContext.id === browsingContextId) {
|
|
34077
34407
|
this.#eventEmitter.off("added", listener);
|
|
34078
|
-
|
|
34408
|
+
resolve6(event.browsingContext);
|
|
34079
34409
|
}
|
|
34080
34410
|
};
|
|
34081
34411
|
this.#eventEmitter.on("added", listener);
|
|
@@ -37571,8 +37901,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
37571
37901
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
37572
37902
|
Object.assign(globalThis, {
|
|
37573
37903
|
[PLACEHOLDER("name")]: function(...args) {
|
|
37574
|
-
return new Promise((
|
|
37575
|
-
callback([
|
|
37904
|
+
return new Promise((resolve6, reject) => {
|
|
37905
|
+
callback([resolve6, reject, args]);
|
|
37576
37906
|
});
|
|
37577
37907
|
}
|
|
37578
37908
|
});
|
|
@@ -37660,8 +37990,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
37660
37990
|
return;
|
|
37661
37991
|
}
|
|
37662
37992
|
try {
|
|
37663
|
-
await dataHandle.evaluate(([
|
|
37664
|
-
|
|
37993
|
+
await dataHandle.evaluate(([resolve6], result2) => {
|
|
37994
|
+
resolve6(result2);
|
|
37665
37995
|
}, result);
|
|
37666
37996
|
} catch (error) {
|
|
37667
37997
|
debugError(error);
|
|
@@ -44953,7 +45283,7 @@ __export(exports_NodeWebSocketTransport, {
|
|
|
44953
45283
|
|
|
44954
45284
|
class NodeWebSocketTransport {
|
|
44955
45285
|
static create(url, headers) {
|
|
44956
|
-
return new Promise((
|
|
45286
|
+
return new Promise((resolve6, reject) => {
|
|
44957
45287
|
const ws = new wrapper_default(url, [], {
|
|
44958
45288
|
followRedirects: true,
|
|
44959
45289
|
perMessageDeflate: false,
|
|
@@ -44965,7 +45295,7 @@ class NodeWebSocketTransport {
|
|
|
44965
45295
|
}
|
|
44966
45296
|
});
|
|
44967
45297
|
ws.addEventListener("open", () => {
|
|
44968
|
-
return
|
|
45298
|
+
return resolve6(new NodeWebSocketTransport(ws));
|
|
44969
45299
|
});
|
|
44970
45300
|
ws.addEventListener("error", reject);
|
|
44971
45301
|
});
|
|
@@ -47857,8 +48187,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
47857
48187
|
function req(url, opts = {}) {
|
|
47858
48188
|
const href = typeof url === "string" ? url : url.href;
|
|
47859
48189
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
47860
|
-
const promise = new Promise((
|
|
47861
|
-
req2.once("response",
|
|
48190
|
+
const promise = new Promise((resolve6, reject) => {
|
|
48191
|
+
req2.once("response", resolve6).once("error", reject).end();
|
|
47862
48192
|
});
|
|
47863
48193
|
req2.then = promise.then.bind(promise);
|
|
47864
48194
|
return req2;
|
|
@@ -48229,7 +48559,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
48229
48559
|
var debug_1 = __importDefault(require_src());
|
|
48230
48560
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
48231
48561
|
function parseProxyResponse(socket) {
|
|
48232
|
-
return new Promise((
|
|
48562
|
+
return new Promise((resolve6, reject) => {
|
|
48233
48563
|
let buffersLength = 0;
|
|
48234
48564
|
const buffers = [];
|
|
48235
48565
|
function read() {
|
|
@@ -48298,7 +48628,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
48298
48628
|
}
|
|
48299
48629
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
48300
48630
|
cleanup();
|
|
48301
|
-
|
|
48631
|
+
resolve6({
|
|
48302
48632
|
connect: {
|
|
48303
48633
|
statusCode,
|
|
48304
48634
|
statusText,
|
|
@@ -50402,11 +50732,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
50402
50732
|
var require_socksclient = __commonJS((exports) => {
|
|
50403
50733
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
50404
50734
|
function adopt(value) {
|
|
50405
|
-
return value instanceof P ? value : new P(function(
|
|
50406
|
-
|
|
50735
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
50736
|
+
resolve6(value);
|
|
50407
50737
|
});
|
|
50408
50738
|
}
|
|
50409
|
-
return new (P || (P = Promise))(function(
|
|
50739
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
50410
50740
|
function fulfilled(value) {
|
|
50411
50741
|
try {
|
|
50412
50742
|
step(generator.next(value));
|
|
@@ -50422,7 +50752,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50422
50752
|
}
|
|
50423
50753
|
}
|
|
50424
50754
|
function step(result) {
|
|
50425
|
-
result.done ?
|
|
50755
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
50426
50756
|
}
|
|
50427
50757
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50428
50758
|
});
|
|
@@ -50449,13 +50779,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50449
50779
|
this.setState(constants_1.SocksClientState.Created);
|
|
50450
50780
|
}
|
|
50451
50781
|
static createConnection(options, callback) {
|
|
50452
|
-
return new Promise((
|
|
50782
|
+
return new Promise((resolve6, reject) => {
|
|
50453
50783
|
try {
|
|
50454
50784
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
50455
50785
|
} catch (err) {
|
|
50456
50786
|
if (typeof callback === "function") {
|
|
50457
50787
|
callback(err);
|
|
50458
|
-
return
|
|
50788
|
+
return resolve6(err);
|
|
50459
50789
|
} else {
|
|
50460
50790
|
return reject(err);
|
|
50461
50791
|
}
|
|
@@ -50466,16 +50796,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50466
50796
|
client.removeAllListeners();
|
|
50467
50797
|
if (typeof callback === "function") {
|
|
50468
50798
|
callback(null, info);
|
|
50469
|
-
|
|
50799
|
+
resolve6(info);
|
|
50470
50800
|
} else {
|
|
50471
|
-
|
|
50801
|
+
resolve6(info);
|
|
50472
50802
|
}
|
|
50473
50803
|
});
|
|
50474
50804
|
client.once("error", (err) => {
|
|
50475
50805
|
client.removeAllListeners();
|
|
50476
50806
|
if (typeof callback === "function") {
|
|
50477
50807
|
callback(err);
|
|
50478
|
-
|
|
50808
|
+
resolve6(err);
|
|
50479
50809
|
} else {
|
|
50480
50810
|
reject(err);
|
|
50481
50811
|
}
|
|
@@ -50483,13 +50813,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50483
50813
|
});
|
|
50484
50814
|
}
|
|
50485
50815
|
static createConnectionChain(options, callback) {
|
|
50486
|
-
return new Promise((
|
|
50816
|
+
return new Promise((resolve6, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
50487
50817
|
try {
|
|
50488
50818
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
50489
50819
|
} catch (err) {
|
|
50490
50820
|
if (typeof callback === "function") {
|
|
50491
50821
|
callback(err);
|
|
50492
|
-
return
|
|
50822
|
+
return resolve6(err);
|
|
50493
50823
|
} else {
|
|
50494
50824
|
return reject(err);
|
|
50495
50825
|
}
|
|
@@ -50515,14 +50845,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
50515
50845
|
}
|
|
50516
50846
|
if (typeof callback === "function") {
|
|
50517
50847
|
callback(null, { socket: sock });
|
|
50518
|
-
|
|
50848
|
+
resolve6({ socket: sock });
|
|
50519
50849
|
} else {
|
|
50520
|
-
|
|
50850
|
+
resolve6({ socket: sock });
|
|
50521
50851
|
}
|
|
50522
50852
|
} catch (err) {
|
|
50523
50853
|
if (typeof callback === "function") {
|
|
50524
50854
|
callback(err);
|
|
50525
|
-
|
|
50855
|
+
resolve6(err);
|
|
50526
50856
|
} else {
|
|
50527
50857
|
reject(err);
|
|
50528
50858
|
}
|
|
@@ -51122,12 +51452,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
51122
51452
|
let { host } = opts;
|
|
51123
51453
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
51124
51454
|
if (shouldLookup) {
|
|
51125
|
-
host = await new Promise((
|
|
51455
|
+
host = await new Promise((resolve6, reject) => {
|
|
51126
51456
|
lookupFn(host, {}, (err, res) => {
|
|
51127
51457
|
if (err) {
|
|
51128
51458
|
reject(err);
|
|
51129
51459
|
} else {
|
|
51130
|
-
|
|
51460
|
+
resolve6(res);
|
|
51131
51461
|
}
|
|
51132
51462
|
});
|
|
51133
51463
|
});
|
|
@@ -52134,7 +52464,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
52134
52464
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
52135
52465
|
}
|
|
52136
52466
|
function upgradeSocket(socket, options) {
|
|
52137
|
-
return new Promise((
|
|
52467
|
+
return new Promise((resolve6, reject) => {
|
|
52138
52468
|
const tlsOptions = Object.assign({}, options, {
|
|
52139
52469
|
socket
|
|
52140
52470
|
});
|
|
@@ -52144,7 +52474,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
52144
52474
|
reject(tlsSocket.authorizationError);
|
|
52145
52475
|
} else {
|
|
52146
52476
|
tlsSocket.removeAllListeners("error");
|
|
52147
|
-
|
|
52477
|
+
resolve6(tlsSocket);
|
|
52148
52478
|
}
|
|
52149
52479
|
}).once("error", (error) => {
|
|
52150
52480
|
reject(error);
|
|
@@ -52236,7 +52566,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
52236
52566
|
};
|
|
52237
52567
|
}
|
|
52238
52568
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
52239
|
-
return new Promise((
|
|
52569
|
+
return new Promise((resolve6, reject) => {
|
|
52240
52570
|
let socket = ftp._newSocket();
|
|
52241
52571
|
const handleConnErr = function(err) {
|
|
52242
52572
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -52259,7 +52589,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
52259
52589
|
socket.removeListener("error", handleConnErr);
|
|
52260
52590
|
socket.removeListener("timeout", handleTimeout);
|
|
52261
52591
|
ftp.dataSocket = socket;
|
|
52262
|
-
|
|
52592
|
+
resolve6();
|
|
52263
52593
|
});
|
|
52264
52594
|
});
|
|
52265
52595
|
}
|
|
@@ -54337,7 +54667,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
54337
54667
|
return path;
|
|
54338
54668
|
}
|
|
54339
54669
|
exports.normalize = normalize;
|
|
54340
|
-
function
|
|
54670
|
+
function join19(aRoot, aPath) {
|
|
54341
54671
|
if (aRoot === "") {
|
|
54342
54672
|
aRoot = ".";
|
|
54343
54673
|
}
|
|
@@ -54369,7 +54699,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
54369
54699
|
}
|
|
54370
54700
|
return joined;
|
|
54371
54701
|
}
|
|
54372
|
-
exports.join =
|
|
54702
|
+
exports.join = join19;
|
|
54373
54703
|
exports.isAbsolute = function(aPath) {
|
|
54374
54704
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
54375
54705
|
};
|
|
@@ -54542,7 +54872,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
54542
54872
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
54543
54873
|
}
|
|
54544
54874
|
}
|
|
54545
|
-
sourceURL =
|
|
54875
|
+
sourceURL = join19(urlGenerate(parsed), sourceURL);
|
|
54546
54876
|
}
|
|
54547
54877
|
return normalize(sourceURL);
|
|
54548
54878
|
}
|
|
@@ -56274,7 +56604,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56274
56604
|
function noEmptySpace() {
|
|
56275
56605
|
return space ? space : " ";
|
|
56276
56606
|
}
|
|
56277
|
-
function
|
|
56607
|
+
function join19(left, right) {
|
|
56278
56608
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
56279
56609
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
56280
56610
|
if (leftSource.length === 0) {
|
|
@@ -56615,8 +56945,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56615
56945
|
} else {
|
|
56616
56946
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
56617
56947
|
}
|
|
56618
|
-
result =
|
|
56619
|
-
result = [
|
|
56948
|
+
result = join19(result, operator);
|
|
56949
|
+
result = [join19(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
56620
56950
|
});
|
|
56621
56951
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
56622
56952
|
return result;
|
|
@@ -56754,11 +57084,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56754
57084
|
var result, fragment;
|
|
56755
57085
|
result = ["class"];
|
|
56756
57086
|
if (stmt.id) {
|
|
56757
|
-
result =
|
|
57087
|
+
result = join19(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
56758
57088
|
}
|
|
56759
57089
|
if (stmt.superClass) {
|
|
56760
|
-
fragment =
|
|
56761
|
-
result =
|
|
57090
|
+
fragment = join19("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
57091
|
+
result = join19(result, fragment);
|
|
56762
57092
|
}
|
|
56763
57093
|
result.push(space);
|
|
56764
57094
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -56771,9 +57101,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56771
57101
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
56772
57102
|
},
|
|
56773
57103
|
DoWhileStatement: function(stmt, flags) {
|
|
56774
|
-
var result =
|
|
57104
|
+
var result = join19("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
56775
57105
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
56776
|
-
return
|
|
57106
|
+
return join19(result, [
|
|
56777
57107
|
"while" + space + "(",
|
|
56778
57108
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
56779
57109
|
")" + this.semicolon(flags)
|
|
@@ -56809,11 +57139,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56809
57139
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
56810
57140
|
var result = ["export"], bodyFlags;
|
|
56811
57141
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
56812
|
-
result =
|
|
57142
|
+
result = join19(result, "default");
|
|
56813
57143
|
if (isStatement(stmt.declaration)) {
|
|
56814
|
-
result =
|
|
57144
|
+
result = join19(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
56815
57145
|
} else {
|
|
56816
|
-
result =
|
|
57146
|
+
result = join19(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
56817
57147
|
}
|
|
56818
57148
|
return result;
|
|
56819
57149
|
},
|
|
@@ -56821,15 +57151,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56821
57151
|
var result = ["export"], bodyFlags, that = this;
|
|
56822
57152
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
56823
57153
|
if (stmt.declaration) {
|
|
56824
|
-
return
|
|
57154
|
+
return join19(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
56825
57155
|
}
|
|
56826
57156
|
if (stmt.specifiers) {
|
|
56827
57157
|
if (stmt.specifiers.length === 0) {
|
|
56828
|
-
result =
|
|
57158
|
+
result = join19(result, "{" + space + "}");
|
|
56829
57159
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
56830
|
-
result =
|
|
57160
|
+
result = join19(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
56831
57161
|
} else {
|
|
56832
|
-
result =
|
|
57162
|
+
result = join19(result, "{");
|
|
56833
57163
|
withIndent(function(indent2) {
|
|
56834
57164
|
var i, iz;
|
|
56835
57165
|
result.push(newline);
|
|
@@ -56847,7 +57177,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56847
57177
|
result.push(base + "}");
|
|
56848
57178
|
}
|
|
56849
57179
|
if (stmt.source) {
|
|
56850
|
-
result =
|
|
57180
|
+
result = join19(result, [
|
|
56851
57181
|
"from" + space,
|
|
56852
57182
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
56853
57183
|
this.semicolon(flags)
|
|
@@ -56931,7 +57261,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56931
57261
|
];
|
|
56932
57262
|
cursor = 0;
|
|
56933
57263
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
56934
|
-
result =
|
|
57264
|
+
result = join19(result, [
|
|
56935
57265
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
56936
57266
|
]);
|
|
56937
57267
|
++cursor;
|
|
@@ -56941,7 +57271,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56941
57271
|
result.push(",");
|
|
56942
57272
|
}
|
|
56943
57273
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
56944
|
-
result =
|
|
57274
|
+
result = join19(result, [
|
|
56945
57275
|
space,
|
|
56946
57276
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
56947
57277
|
]);
|
|
@@ -56970,7 +57300,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
56970
57300
|
}
|
|
56971
57301
|
}
|
|
56972
57302
|
}
|
|
56973
|
-
result =
|
|
57303
|
+
result = join19(result, [
|
|
56974
57304
|
"from" + space,
|
|
56975
57305
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
56976
57306
|
this.semicolon(flags)
|
|
@@ -57024,7 +57354,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57024
57354
|
return result;
|
|
57025
57355
|
},
|
|
57026
57356
|
ThrowStatement: function(stmt, flags) {
|
|
57027
|
-
return [
|
|
57357
|
+
return [join19("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
57028
57358
|
},
|
|
57029
57359
|
TryStatement: function(stmt, flags) {
|
|
57030
57360
|
var result, i, iz, guardedHandlers;
|
|
@@ -57032,7 +57362,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57032
57362
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
57033
57363
|
if (stmt.handlers) {
|
|
57034
57364
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
57035
|
-
result =
|
|
57365
|
+
result = join19(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
57036
57366
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
57037
57367
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
57038
57368
|
}
|
|
@@ -57040,7 +57370,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57040
57370
|
} else {
|
|
57041
57371
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
57042
57372
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
57043
|
-
result =
|
|
57373
|
+
result = join19(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
57044
57374
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
57045
57375
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
57046
57376
|
}
|
|
@@ -57048,13 +57378,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57048
57378
|
if (stmt.handler) {
|
|
57049
57379
|
if (Array.isArray(stmt.handler)) {
|
|
57050
57380
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
57051
|
-
result =
|
|
57381
|
+
result = join19(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
57052
57382
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
57053
57383
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
57054
57384
|
}
|
|
57055
57385
|
}
|
|
57056
57386
|
} else {
|
|
57057
|
-
result =
|
|
57387
|
+
result = join19(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
57058
57388
|
if (stmt.finalizer) {
|
|
57059
57389
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
57060
57390
|
}
|
|
@@ -57062,7 +57392,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57062
57392
|
}
|
|
57063
57393
|
}
|
|
57064
57394
|
if (stmt.finalizer) {
|
|
57065
|
-
result =
|
|
57395
|
+
result = join19(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
57066
57396
|
}
|
|
57067
57397
|
return result;
|
|
57068
57398
|
},
|
|
@@ -57096,7 +57426,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57096
57426
|
withIndent(function() {
|
|
57097
57427
|
if (stmt.test) {
|
|
57098
57428
|
result = [
|
|
57099
|
-
|
|
57429
|
+
join19("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
57100
57430
|
":"
|
|
57101
57431
|
];
|
|
57102
57432
|
} else {
|
|
@@ -57144,9 +57474,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57144
57474
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
57145
57475
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
57146
57476
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
57147
|
-
result =
|
|
57477
|
+
result = join19(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
57148
57478
|
} else {
|
|
57149
|
-
result =
|
|
57479
|
+
result = join19(result, join19("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
57150
57480
|
}
|
|
57151
57481
|
} else {
|
|
57152
57482
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -57248,7 +57578,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57248
57578
|
},
|
|
57249
57579
|
ReturnStatement: function(stmt, flags) {
|
|
57250
57580
|
if (stmt.argument) {
|
|
57251
|
-
return [
|
|
57581
|
+
return [join19("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
57252
57582
|
}
|
|
57253
57583
|
return ["return" + this.semicolon(flags)];
|
|
57254
57584
|
},
|
|
@@ -57330,14 +57660,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57330
57660
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
57331
57661
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
57332
57662
|
} else {
|
|
57333
|
-
result =
|
|
57663
|
+
result = join19(fragment, expr.operator);
|
|
57334
57664
|
}
|
|
57335
57665
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
57336
57666
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
57337
57667
|
result.push(noEmptySpace());
|
|
57338
57668
|
result.push(fragment);
|
|
57339
57669
|
} else {
|
|
57340
|
-
result =
|
|
57670
|
+
result = join19(result, fragment);
|
|
57341
57671
|
}
|
|
57342
57672
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
57343
57673
|
return ["(", result, ")"];
|
|
@@ -57377,7 +57707,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57377
57707
|
var result, length, i, iz, itemFlags;
|
|
57378
57708
|
length = expr["arguments"].length;
|
|
57379
57709
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
57380
|
-
result =
|
|
57710
|
+
result = join19("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
57381
57711
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
57382
57712
|
result.push("(");
|
|
57383
57713
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -57424,11 +57754,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57424
57754
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
57425
57755
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
57426
57756
|
if (space === "") {
|
|
57427
|
-
result =
|
|
57757
|
+
result = join19(expr.operator, fragment);
|
|
57428
57758
|
} else {
|
|
57429
57759
|
result = [expr.operator];
|
|
57430
57760
|
if (expr.operator.length > 2) {
|
|
57431
|
-
result =
|
|
57761
|
+
result = join19(result, fragment);
|
|
57432
57762
|
} else {
|
|
57433
57763
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
57434
57764
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -57451,12 +57781,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57451
57781
|
result = "yield";
|
|
57452
57782
|
}
|
|
57453
57783
|
if (expr.argument) {
|
|
57454
|
-
result =
|
|
57784
|
+
result = join19(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
57455
57785
|
}
|
|
57456
57786
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
57457
57787
|
},
|
|
57458
57788
|
AwaitExpression: function(expr, precedence, flags) {
|
|
57459
|
-
var result =
|
|
57789
|
+
var result = join19(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
57460
57790
|
return parenthesize(result, Precedence.Await, precedence);
|
|
57461
57791
|
},
|
|
57462
57792
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -57528,11 +57858,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57528
57858
|
var result, fragment;
|
|
57529
57859
|
result = ["class"];
|
|
57530
57860
|
if (expr.id) {
|
|
57531
|
-
result =
|
|
57861
|
+
result = join19(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
57532
57862
|
}
|
|
57533
57863
|
if (expr.superClass) {
|
|
57534
|
-
fragment =
|
|
57535
|
-
result =
|
|
57864
|
+
fragment = join19("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
57865
|
+
result = join19(result, fragment);
|
|
57536
57866
|
}
|
|
57537
57867
|
result.push(space);
|
|
57538
57868
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -57547,7 +57877,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57547
57877
|
}
|
|
57548
57878
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
57549
57879
|
fragment = [
|
|
57550
|
-
|
|
57880
|
+
join19(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
57551
57881
|
this.generateFunctionBody(expr.value)
|
|
57552
57882
|
];
|
|
57553
57883
|
} else {
|
|
@@ -57557,7 +57887,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57557
57887
|
this.generateFunctionBody(expr.value)
|
|
57558
57888
|
];
|
|
57559
57889
|
}
|
|
57560
|
-
return
|
|
57890
|
+
return join19(result, fragment);
|
|
57561
57891
|
},
|
|
57562
57892
|
Property: function(expr, precedence, flags) {
|
|
57563
57893
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -57751,7 +58081,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57751
58081
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
57752
58082
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
57753
58083
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
57754
|
-
result =
|
|
58084
|
+
result = join19(result, fragment);
|
|
57755
58085
|
} else {
|
|
57756
58086
|
result.push(fragment);
|
|
57757
58087
|
}
|
|
@@ -57759,13 +58089,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57759
58089
|
});
|
|
57760
58090
|
}
|
|
57761
58091
|
if (expr.filter) {
|
|
57762
|
-
result =
|
|
58092
|
+
result = join19(result, "if" + space);
|
|
57763
58093
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
57764
|
-
result =
|
|
58094
|
+
result = join19(result, ["(", fragment, ")"]);
|
|
57765
58095
|
}
|
|
57766
58096
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
57767
58097
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
57768
|
-
result =
|
|
58098
|
+
result = join19(result, fragment);
|
|
57769
58099
|
}
|
|
57770
58100
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
57771
58101
|
return result;
|
|
@@ -57781,8 +58111,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57781
58111
|
} else {
|
|
57782
58112
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
57783
58113
|
}
|
|
57784
|
-
fragment =
|
|
57785
|
-
fragment =
|
|
58114
|
+
fragment = join19(fragment, expr.of ? "of" : "in");
|
|
58115
|
+
fragment = join19(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
57786
58116
|
return ["for" + space + "(", fragment, ")"];
|
|
57787
58117
|
},
|
|
57788
58118
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -64270,11 +64600,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
64270
64600
|
};
|
|
64271
64601
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
64272
64602
|
function adopt(value) {
|
|
64273
|
-
return value instanceof P ? value : new P(function(
|
|
64274
|
-
|
|
64603
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
64604
|
+
resolve6(value);
|
|
64275
64605
|
});
|
|
64276
64606
|
}
|
|
64277
|
-
return new (P || (P = Promise))(function(
|
|
64607
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
64278
64608
|
function fulfilled(value) {
|
|
64279
64609
|
try {
|
|
64280
64610
|
step(generator.next(value));
|
|
@@ -64290,7 +64620,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
64290
64620
|
}
|
|
64291
64621
|
}
|
|
64292
64622
|
function step(result) {
|
|
64293
|
-
result.done ?
|
|
64623
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
64294
64624
|
}
|
|
64295
64625
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
64296
64626
|
});
|
|
@@ -64519,14 +64849,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
64519
64849
|
}, i);
|
|
64520
64850
|
function verb(n) {
|
|
64521
64851
|
i[n] = o[n] && function(v) {
|
|
64522
|
-
return new Promise(function(
|
|
64523
|
-
v = o[n](v), settle(
|
|
64852
|
+
return new Promise(function(resolve6, reject) {
|
|
64853
|
+
v = o[n](v), settle(resolve6, reject, v.done, v.value);
|
|
64524
64854
|
});
|
|
64525
64855
|
};
|
|
64526
64856
|
}
|
|
64527
|
-
function settle(
|
|
64857
|
+
function settle(resolve6, reject, d, v) {
|
|
64528
64858
|
Promise.resolve(v).then(function(v2) {
|
|
64529
|
-
|
|
64859
|
+
resolve6({ value: v2, done: d });
|
|
64530
64860
|
}, reject);
|
|
64531
64861
|
}
|
|
64532
64862
|
};
|
|
@@ -67765,12 +68095,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
67765
68095
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
67766
68096
|
var dns_1 = __require("dns");
|
|
67767
68097
|
function dnsLookup(host, opts) {
|
|
67768
|
-
return new Promise((
|
|
68098
|
+
return new Promise((resolve6, reject) => {
|
|
67769
68099
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
67770
68100
|
if (err) {
|
|
67771
68101
|
reject(err);
|
|
67772
68102
|
} else {
|
|
67773
|
-
|
|
68103
|
+
resolve6(res);
|
|
67774
68104
|
}
|
|
67775
68105
|
});
|
|
67776
68106
|
});
|
|
@@ -68344,10 +68674,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
68344
68674
|
var ip_1 = require_ip();
|
|
68345
68675
|
var net_1 = __importDefault(__require("net"));
|
|
68346
68676
|
async function myIpAddress() {
|
|
68347
|
-
return new Promise((
|
|
68677
|
+
return new Promise((resolve6, reject) => {
|
|
68348
68678
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
68349
68679
|
const onError = () => {
|
|
68350
|
-
|
|
68680
|
+
resolve6(ip_1.ip.address());
|
|
68351
68681
|
};
|
|
68352
68682
|
socket.once("error", onError);
|
|
68353
68683
|
socket.once("connect", () => {
|
|
@@ -68355,9 +68685,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
68355
68685
|
const addr = socket.address();
|
|
68356
68686
|
socket.destroy();
|
|
68357
68687
|
if (typeof addr === "string") {
|
|
68358
|
-
|
|
68688
|
+
resolve6(addr);
|
|
68359
68689
|
} else if (addr.address) {
|
|
68360
|
-
|
|
68690
|
+
resolve6(addr.address);
|
|
68361
68691
|
} else {
|
|
68362
68692
|
reject(new Error("Expected a `string`"));
|
|
68363
68693
|
}
|
|
@@ -68871,8 +69201,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
68871
69201
|
this.context = args.context;
|
|
68872
69202
|
this.owner = args.context.runtime;
|
|
68873
69203
|
this.handle = args.promiseHandle;
|
|
68874
|
-
this.settled = new Promise((
|
|
68875
|
-
this.onSettled =
|
|
69204
|
+
this.settled = new Promise((resolve6) => {
|
|
69205
|
+
this.onSettled = resolve6;
|
|
68876
69206
|
});
|
|
68877
69207
|
this.resolveHandle = args.resolveHandle;
|
|
68878
69208
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -69264,13 +69594,13 @@ var require_context = __commonJS((exports) => {
|
|
|
69264
69594
|
if (vmResolveResult.error) {
|
|
69265
69595
|
return Promise.resolve(vmResolveResult);
|
|
69266
69596
|
}
|
|
69267
|
-
return new Promise((
|
|
69597
|
+
return new Promise((resolve6) => {
|
|
69268
69598
|
lifetime_1.Scope.withScope((scope) => {
|
|
69269
69599
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
69270
|
-
|
|
69600
|
+
resolve6({ value: value && value.dup() });
|
|
69271
69601
|
}));
|
|
69272
69602
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
69273
|
-
|
|
69603
|
+
resolve6({ error: error && error.dup() });
|
|
69274
69604
|
}));
|
|
69275
69605
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
69276
69606
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -71384,13 +71714,13 @@ import * as http from "node:http";
|
|
|
71384
71714
|
import * as https from "node:https";
|
|
71385
71715
|
import { URL as URL2, urlToHttpOptions } from "node:url";
|
|
71386
71716
|
function headHttpRequest(url) {
|
|
71387
|
-
return new Promise((
|
|
71717
|
+
return new Promise((resolve6) => {
|
|
71388
71718
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
71389
71719
|
response.resume();
|
|
71390
|
-
|
|
71720
|
+
resolve6(response.statusCode === 200);
|
|
71391
71721
|
}, false);
|
|
71392
71722
|
request3.on("error", () => {
|
|
71393
|
-
|
|
71723
|
+
resolve6(false);
|
|
71394
71724
|
});
|
|
71395
71725
|
});
|
|
71396
71726
|
}
|
|
@@ -71418,7 +71748,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
71418
71748
|
return request3;
|
|
71419
71749
|
}
|
|
71420
71750
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
71421
|
-
return new Promise((
|
|
71751
|
+
return new Promise((resolve6, reject) => {
|
|
71422
71752
|
let downloadedBytes = 0;
|
|
71423
71753
|
let totalBytes = 0;
|
|
71424
71754
|
function onData(chunk) {
|
|
@@ -71434,7 +71764,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
71434
71764
|
}
|
|
71435
71765
|
const file = createWriteStream(destinationPath);
|
|
71436
71766
|
file.on("close", () => {
|
|
71437
|
-
return
|
|
71767
|
+
return resolve6();
|
|
71438
71768
|
});
|
|
71439
71769
|
file.on("error", (error) => {
|
|
71440
71770
|
return reject(error);
|
|
@@ -71459,7 +71789,7 @@ async function getJSON(url) {
|
|
|
71459
71789
|
}
|
|
71460
71790
|
}
|
|
71461
71791
|
function getText(url) {
|
|
71462
|
-
return new Promise((
|
|
71792
|
+
return new Promise((resolve6, reject) => {
|
|
71463
71793
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
71464
71794
|
let data = "";
|
|
71465
71795
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -71470,7 +71800,7 @@ function getText(url) {
|
|
|
71470
71800
|
});
|
|
71471
71801
|
response.on("end", () => {
|
|
71472
71802
|
try {
|
|
71473
|
-
return
|
|
71803
|
+
return resolve6(String(data));
|
|
71474
71804
|
} catch {
|
|
71475
71805
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
71476
71806
|
}
|
|
@@ -72691,7 +73021,7 @@ class Process {
|
|
|
72691
73021
|
if (opts.onExit) {
|
|
72692
73022
|
this.#onExitHook = opts.onExit;
|
|
72693
73023
|
}
|
|
72694
|
-
this.#browserProcessExiting = new Promise((
|
|
73024
|
+
this.#browserProcessExiting = new Promise((resolve6, reject) => {
|
|
72695
73025
|
this.#browserProcess.once("exit", async () => {
|
|
72696
73026
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
72697
73027
|
this.#clearListeners();
|
|
@@ -72702,7 +73032,7 @@ class Process {
|
|
|
72702
73032
|
reject(err);
|
|
72703
73033
|
return;
|
|
72704
73034
|
}
|
|
72705
|
-
|
|
73035
|
+
resolve6();
|
|
72706
73036
|
});
|
|
72707
73037
|
});
|
|
72708
73038
|
}
|
|
@@ -72812,7 +73142,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
72812
73142
|
return [...this.#logs];
|
|
72813
73143
|
}
|
|
72814
73144
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
72815
|
-
return new Promise((
|
|
73145
|
+
return new Promise((resolve6, reject) => {
|
|
72816
73146
|
const onClose = (errorOrCode) => {
|
|
72817
73147
|
cleanup();
|
|
72818
73148
|
reject(new Error([
|
|
@@ -72850,7 +73180,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
72850
73180
|
return;
|
|
72851
73181
|
}
|
|
72852
73182
|
cleanup();
|
|
72853
|
-
|
|
73183
|
+
resolve6(match[1]);
|
|
72854
73184
|
}
|
|
72855
73185
|
});
|
|
72856
73186
|
}
|
|
@@ -73380,7 +73710,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
73380
73710
|
};
|
|
73381
73711
|
const { maxBuffer } = options;
|
|
73382
73712
|
let stream;
|
|
73383
|
-
await new Promise((
|
|
73713
|
+
await new Promise((resolve6, reject) => {
|
|
73384
73714
|
const rejectPromise = (error) => {
|
|
73385
73715
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
73386
73716
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -73392,7 +73722,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
73392
73722
|
rejectPromise(error);
|
|
73393
73723
|
return;
|
|
73394
73724
|
}
|
|
73395
|
-
|
|
73725
|
+
resolve6();
|
|
73396
73726
|
});
|
|
73397
73727
|
stream.on("data", () => {
|
|
73398
73728
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -74753,7 +75083,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
74753
75083
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
74754
75084
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
74755
75085
|
this.canceled = false;
|
|
74756
|
-
return new Promise((
|
|
75086
|
+
return new Promise((resolve6, reject) => {
|
|
74757
75087
|
this.zipfile.on("error", (err) => {
|
|
74758
75088
|
this.canceled = true;
|
|
74759
75089
|
reject(err);
|
|
@@ -74762,7 +75092,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
74762
75092
|
this.zipfile.on("close", () => {
|
|
74763
75093
|
if (!this.canceled) {
|
|
74764
75094
|
debug4("zip extraction complete");
|
|
74765
|
-
|
|
75095
|
+
resolve6();
|
|
74766
75096
|
}
|
|
74767
75097
|
});
|
|
74768
75098
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -76104,8 +76434,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76104
76434
|
return this;
|
|
76105
76435
|
},
|
|
76106
76436
|
next() {
|
|
76107
|
-
return new Promise(function(
|
|
76108
|
-
promiseResolve =
|
|
76437
|
+
return new Promise(function(resolve6, reject) {
|
|
76438
|
+
promiseResolve = resolve6;
|
|
76109
76439
|
promiseReject = reject;
|
|
76110
76440
|
const data = stream.read();
|
|
76111
76441
|
if (data !== null)
|
|
@@ -76142,14 +76472,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76142
76472
|
}
|
|
76143
76473
|
function destroy(err) {
|
|
76144
76474
|
stream.destroy(err);
|
|
76145
|
-
return new Promise((
|
|
76475
|
+
return new Promise((resolve6, reject) => {
|
|
76146
76476
|
if (stream._duplexState & DESTROYED)
|
|
76147
|
-
return
|
|
76477
|
+
return resolve6({ value: undefined, done: true });
|
|
76148
76478
|
stream.once("close", function() {
|
|
76149
76479
|
if (err)
|
|
76150
76480
|
reject(err);
|
|
76151
76481
|
else
|
|
76152
|
-
|
|
76482
|
+
resolve6({ value: undefined, done: true });
|
|
76153
76483
|
});
|
|
76154
76484
|
});
|
|
76155
76485
|
}
|
|
@@ -76201,8 +76531,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76201
76531
|
return Promise.resolve(true);
|
|
76202
76532
|
if (state.drains === null)
|
|
76203
76533
|
state.drains = [];
|
|
76204
|
-
return new Promise((
|
|
76205
|
-
state.drains.push({ writes, resolve:
|
|
76534
|
+
return new Promise((resolve6) => {
|
|
76535
|
+
state.drains.push({ writes, resolve: resolve6 });
|
|
76206
76536
|
});
|
|
76207
76537
|
}
|
|
76208
76538
|
write(data) {
|
|
@@ -76316,11 +76646,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
76316
76646
|
cb(null);
|
|
76317
76647
|
}
|
|
76318
76648
|
function pipelinePromise(...streams) {
|
|
76319
|
-
return new Promise((
|
|
76649
|
+
return new Promise((resolve6, reject) => {
|
|
76320
76650
|
return pipeline(...streams, (err) => {
|
|
76321
76651
|
if (err)
|
|
76322
76652
|
return reject(err);
|
|
76323
|
-
|
|
76653
|
+
resolve6();
|
|
76324
76654
|
});
|
|
76325
76655
|
});
|
|
76326
76656
|
}
|
|
@@ -77034,16 +77364,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
77034
77364
|
entryCallback = null;
|
|
77035
77365
|
cb(err);
|
|
77036
77366
|
}
|
|
77037
|
-
function onnext(
|
|
77367
|
+
function onnext(resolve6, reject) {
|
|
77038
77368
|
if (error) {
|
|
77039
77369
|
return reject(error);
|
|
77040
77370
|
}
|
|
77041
77371
|
if (entryStream) {
|
|
77042
|
-
|
|
77372
|
+
resolve6({ value: entryStream, done: false });
|
|
77043
77373
|
entryStream = null;
|
|
77044
77374
|
return;
|
|
77045
77375
|
}
|
|
77046
|
-
promiseResolve =
|
|
77376
|
+
promiseResolve = resolve6;
|
|
77047
77377
|
promiseReject = reject;
|
|
77048
77378
|
consumeCallback(null);
|
|
77049
77379
|
if (extract._finished && promiseResolve) {
|
|
@@ -77074,14 +77404,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
77074
77404
|
function destroy(err) {
|
|
77075
77405
|
extract.destroy(err);
|
|
77076
77406
|
consumeCallback(err);
|
|
77077
|
-
return new Promise((
|
|
77407
|
+
return new Promise((resolve6, reject) => {
|
|
77078
77408
|
if (extract.destroyed)
|
|
77079
|
-
return
|
|
77409
|
+
return resolve6({ value: undefined, done: true });
|
|
77080
77410
|
extract.once("close", function() {
|
|
77081
77411
|
if (err)
|
|
77082
77412
|
reject(err);
|
|
77083
77413
|
else
|
|
77084
|
-
|
|
77414
|
+
resolve6({ value: undefined, done: true });
|
|
77085
77415
|
});
|
|
77086
77416
|
});
|
|
77087
77417
|
}
|
|
@@ -77879,7 +78209,7 @@ var init_fileUtil = __esm(() => {
|
|
|
77879
78209
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
77880
78210
|
import assert2 from "node:assert";
|
|
77881
78211
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
77882
|
-
import { existsSync as
|
|
78212
|
+
import { existsSync as existsSync19, readFileSync as readFileSync19 } from "node:fs";
|
|
77883
78213
|
import { mkdir as mkdir2, unlink } from "node:fs/promises";
|
|
77884
78214
|
import os5 from "node:os";
|
|
77885
78215
|
import path8 from "node:path";
|
|
@@ -77932,7 +78262,7 @@ async function installWithProviders(options) {
|
|
|
77932
78262
|
continue;
|
|
77933
78263
|
}
|
|
77934
78264
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
77935
|
-
if (!
|
|
78265
|
+
if (!existsSync19(browserRoot)) {
|
|
77936
78266
|
await mkdir2(browserRoot, { recursive: true });
|
|
77937
78267
|
}
|
|
77938
78268
|
return await installUrl(url, options, provider);
|
|
@@ -77965,11 +78295,11 @@ async function installDeps(installedBrowser) {
|
|
|
77965
78295
|
return;
|
|
77966
78296
|
}
|
|
77967
78297
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
77968
|
-
if (!
|
|
78298
|
+
if (!existsSync19(depsPath)) {
|
|
77969
78299
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
77970
78300
|
return;
|
|
77971
78301
|
}
|
|
77972
|
-
const data =
|
|
78302
|
+
const data = readFileSync19(depsPath, "utf-8").split(`
|
|
77973
78303
|
`).join(",");
|
|
77974
78304
|
if (process.getuid?.() !== 0) {
|
|
77975
78305
|
throw new Error("Installing system dependencies requires root privileges");
|
|
@@ -78007,11 +78337,11 @@ async function installUrl(url, options, provider) {
|
|
|
78007
78337
|
const cache = new Cache(options.cacheDir);
|
|
78008
78338
|
const browserRoot = cache.browserRoot(options.browser);
|
|
78009
78339
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
78010
|
-
if (!
|
|
78340
|
+
if (!existsSync19(browserRoot)) {
|
|
78011
78341
|
await mkdir2(browserRoot, { recursive: true });
|
|
78012
78342
|
}
|
|
78013
78343
|
if (!options.unpack) {
|
|
78014
|
-
if (
|
|
78344
|
+
if (existsSync19(archivePath)) {
|
|
78015
78345
|
return archivePath;
|
|
78016
78346
|
}
|
|
78017
78347
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -78032,8 +78362,8 @@ async function installUrl(url, options, provider) {
|
|
|
78032
78362
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
78033
78363
|
}
|
|
78034
78364
|
try {
|
|
78035
|
-
if (
|
|
78036
|
-
if (!
|
|
78365
|
+
if (existsSync19(outputPath)) {
|
|
78366
|
+
if (!existsSync19(installedBrowser.executablePath)) {
|
|
78037
78367
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
78038
78368
|
}
|
|
78039
78369
|
await runSetup(installedBrowser);
|
|
@@ -78042,7 +78372,7 @@ async function installUrl(url, options, provider) {
|
|
|
78042
78372
|
}
|
|
78043
78373
|
return installedBrowser;
|
|
78044
78374
|
}
|
|
78045
|
-
if (!
|
|
78375
|
+
if (!existsSync19(archivePath)) {
|
|
78046
78376
|
debugInstall(`Downloading binary from ${url}`);
|
|
78047
78377
|
try {
|
|
78048
78378
|
debugTime("download");
|
|
@@ -78071,7 +78401,7 @@ async function installUrl(url, options, provider) {
|
|
|
78071
78401
|
}
|
|
78072
78402
|
return installedBrowser;
|
|
78073
78403
|
} finally {
|
|
78074
|
-
if (
|
|
78404
|
+
if (existsSync19(archivePath)) {
|
|
78075
78405
|
await unlink(archivePath);
|
|
78076
78406
|
}
|
|
78077
78407
|
}
|
|
@@ -78082,7 +78412,7 @@ async function runSetup(installedBrowser) {
|
|
|
78082
78412
|
debugTime("permissions");
|
|
78083
78413
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
78084
78414
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
78085
|
-
if (!
|
|
78415
|
+
if (!existsSync19(setupExePath)) {
|
|
78086
78416
|
return;
|
|
78087
78417
|
}
|
|
78088
78418
|
spawnSync2(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
@@ -78463,10 +78793,10 @@ var init_cliui = __esm(() => {
|
|
|
78463
78793
|
});
|
|
78464
78794
|
|
|
78465
78795
|
// node_modules/escalade/sync/index.mjs
|
|
78466
|
-
import { dirname as dirname8, resolve as
|
|
78796
|
+
import { dirname as dirname8, resolve as resolve7 } from "path";
|
|
78467
78797
|
import { readdirSync as readdirSync6, statSync as statSync9 } from "fs";
|
|
78468
78798
|
function sync_default(start, callback) {
|
|
78469
|
-
let dir =
|
|
78799
|
+
let dir = resolve7(".", start);
|
|
78470
78800
|
let tmp, stats = statSync9(dir);
|
|
78471
78801
|
if (!stats.isDirectory()) {
|
|
78472
78802
|
dir = dirname8(dir);
|
|
@@ -78474,13 +78804,13 @@ function sync_default(start, callback) {
|
|
|
78474
78804
|
while (true) {
|
|
78475
78805
|
tmp = callback(dir, readdirSync6(dir));
|
|
78476
78806
|
if (tmp)
|
|
78477
|
-
return
|
|
78807
|
+
return resolve7(dir, tmp);
|
|
78478
78808
|
dir = dirname8(tmp = dir);
|
|
78479
78809
|
if (tmp === dir)
|
|
78480
78810
|
break;
|
|
78481
78811
|
}
|
|
78482
78812
|
}
|
|
78483
|
-
var
|
|
78813
|
+
var init_sync2 = () => {};
|
|
78484
78814
|
|
|
78485
78815
|
// node_modules/yargs-parser/build/lib/string-utils.js
|
|
78486
78816
|
function camelCase(str) {
|
|
@@ -79421,7 +79751,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
79421
79751
|
|
|
79422
79752
|
// node_modules/yargs-parser/build/lib/index.js
|
|
79423
79753
|
import { format } from "util";
|
|
79424
|
-
import { normalize, resolve as
|
|
79754
|
+
import { normalize, resolve as resolve8 } from "path";
|
|
79425
79755
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
79426
79756
|
const result = parser.parse(args.slice(), opts);
|
|
79427
79757
|
return result.argv;
|
|
@@ -79444,7 +79774,7 @@ var init_lib2 = __esm(() => {
|
|
|
79444
79774
|
},
|
|
79445
79775
|
format,
|
|
79446
79776
|
normalize,
|
|
79447
|
-
resolve:
|
|
79777
|
+
resolve: resolve8,
|
|
79448
79778
|
require: (path9) => {
|
|
79449
79779
|
if (true) {
|
|
79450
79780
|
return __require(path9);
|
|
@@ -79495,18 +79825,18 @@ var init_yerror = __esm(() => {
|
|
|
79495
79825
|
});
|
|
79496
79826
|
|
|
79497
79827
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
79498
|
-
import { readFileSync as
|
|
79828
|
+
import { readFileSync as readFileSync20, statSync as statSync10, writeFile } from "fs";
|
|
79499
79829
|
import { format as format2 } from "util";
|
|
79500
|
-
import { resolve as
|
|
79830
|
+
import { resolve as resolve9 } from "path";
|
|
79501
79831
|
var node_default;
|
|
79502
79832
|
var init_node = __esm(() => {
|
|
79503
79833
|
node_default = {
|
|
79504
79834
|
fs: {
|
|
79505
|
-
readFileSync:
|
|
79835
|
+
readFileSync: readFileSync20,
|
|
79506
79836
|
writeFile
|
|
79507
79837
|
},
|
|
79508
79838
|
format: format2,
|
|
79509
|
-
resolve:
|
|
79839
|
+
resolve: resolve9,
|
|
79510
79840
|
exists: (file) => {
|
|
79511
79841
|
try {
|
|
79512
79842
|
return statSync10(file).isFile();
|
|
@@ -79687,13 +80017,13 @@ var init_y18n = __esm(() => {
|
|
|
79687
80017
|
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
79688
80018
|
import { notStrictEqual, strictEqual } from "assert";
|
|
79689
80019
|
import { inspect } from "util";
|
|
79690
|
-
import { readFileSync as
|
|
80020
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
79691
80021
|
import { fileURLToPath } from "url";
|
|
79692
|
-
import { basename as
|
|
80022
|
+
import { basename as basename10, dirname as dirname9, extname as extname3, relative as relative7, resolve as resolve10 } from "path";
|
|
79693
80023
|
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
80024
|
var init_esm = __esm(() => {
|
|
79695
80025
|
init_cliui();
|
|
79696
|
-
|
|
80026
|
+
init_sync2();
|
|
79697
80027
|
init_lib2();
|
|
79698
80028
|
init_yerror();
|
|
79699
80029
|
init_y18n();
|
|
@@ -79721,11 +80051,11 @@ var init_esm = __esm(() => {
|
|
|
79721
80051
|
mainFilename: mainFilename || process.cwd(),
|
|
79722
80052
|
Parser: lib_default,
|
|
79723
80053
|
path: {
|
|
79724
|
-
basename:
|
|
80054
|
+
basename: basename10,
|
|
79725
80055
|
dirname: dirname9,
|
|
79726
80056
|
extname: extname3,
|
|
79727
80057
|
relative: relative7,
|
|
79728
|
-
resolve:
|
|
80058
|
+
resolve: resolve10
|
|
79729
80059
|
},
|
|
79730
80060
|
process: {
|
|
79731
80061
|
argv: () => process.argv,
|
|
@@ -79736,7 +80066,7 @@ var init_esm = __esm(() => {
|
|
|
79736
80066
|
nextTick: process.nextTick,
|
|
79737
80067
|
stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
|
|
79738
80068
|
},
|
|
79739
|
-
readFileSync:
|
|
80069
|
+
readFileSync: readFileSync21,
|
|
79740
80070
|
require: () => {
|
|
79741
80071
|
throw new YError(REQUIRE_ERROR);
|
|
79742
80072
|
},
|
|
@@ -79747,7 +80077,7 @@ var init_esm = __esm(() => {
|
|
|
79747
80077
|
return [...str].length;
|
|
79748
80078
|
},
|
|
79749
80079
|
y18n: y18n_default({
|
|
79750
|
-
directory:
|
|
80080
|
+
directory: resolve10(__dirname2, "../../../locales"),
|
|
79751
80081
|
updateFiles: false
|
|
79752
80082
|
})
|
|
79753
80083
|
};
|
|
@@ -81995,12 +82325,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
81995
82325
|
async getCompletion(args, done) {
|
|
81996
82326
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
81997
82327
|
if (!done) {
|
|
81998
|
-
return new Promise((
|
|
82328
|
+
return new Promise((resolve11, reject) => {
|
|
81999
82329
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
82000
82330
|
if (err)
|
|
82001
82331
|
reject(err);
|
|
82002
82332
|
else
|
|
82003
|
-
|
|
82333
|
+
resolve11(completions);
|
|
82004
82334
|
});
|
|
82005
82335
|
});
|
|
82006
82336
|
} else {
|
|
@@ -83435,9 +83765,9 @@ async function getConnectionTransport(options) {
|
|
|
83435
83765
|
throw new Error("Could not detect required browser platform");
|
|
83436
83766
|
}
|
|
83437
83767
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
83438
|
-
const { join:
|
|
83768
|
+
const { join: join20 } = await import("node:path");
|
|
83439
83769
|
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
83440
|
-
const portPath =
|
|
83770
|
+
const portPath = join20(userDataDir, "DevToolsActivePort");
|
|
83441
83771
|
try {
|
|
83442
83772
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
83443
83773
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -83661,9 +83991,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
83661
83991
|
});
|
|
83662
83992
|
|
|
83663
83993
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
83664
|
-
import { existsSync as
|
|
83994
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
83665
83995
|
import { tmpdir } from "node:os";
|
|
83666
|
-
import { join as
|
|
83996
|
+
import { join as join20 } from "node:path";
|
|
83667
83997
|
|
|
83668
83998
|
class BrowserLauncher {
|
|
83669
83999
|
#browser;
|
|
@@ -83688,7 +84018,7 @@ class BrowserLauncher {
|
|
|
83688
84018
|
...options,
|
|
83689
84019
|
protocol
|
|
83690
84020
|
});
|
|
83691
|
-
if (!
|
|
84021
|
+
if (!existsSync20(launchArgs.executablePath)) {
|
|
83692
84022
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
83693
84023
|
}
|
|
83694
84024
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -83763,7 +84093,7 @@ class BrowserLauncher {
|
|
|
83763
84093
|
browserCloseCallback();
|
|
83764
84094
|
const logs = browserProcess.getRecentLogs().join(`
|
|
83765
84095
|
`);
|
|
83766
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
84096
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync20(join20(launchArgs.userDataDir, "lockfile"))) {
|
|
83767
84097
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
83768
84098
|
}
|
|
83769
84099
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -83853,12 +84183,12 @@ class BrowserLauncher {
|
|
|
83853
84183
|
});
|
|
83854
84184
|
}
|
|
83855
84185
|
getProfilePath() {
|
|
83856
|
-
return
|
|
84186
|
+
return join20(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
83857
84187
|
}
|
|
83858
84188
|
resolveExecutablePath(headless, validatePath = true) {
|
|
83859
84189
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
83860
84190
|
if (executablePath) {
|
|
83861
|
-
if (validatePath && !
|
|
84191
|
+
if (validatePath && !existsSync20(executablePath)) {
|
|
83862
84192
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
83863
84193
|
}
|
|
83864
84194
|
return executablePath;
|
|
@@ -83881,7 +84211,7 @@ class BrowserLauncher {
|
|
|
83881
84211
|
browser: browserType,
|
|
83882
84212
|
buildId: this.puppeteer.browserVersion
|
|
83883
84213
|
});
|
|
83884
|
-
if (validatePath && !
|
|
84214
|
+
if (validatePath && !existsSync20(executablePath)) {
|
|
83885
84215
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
83886
84216
|
if (configVersion) {
|
|
83887
84217
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -84493,8 +84823,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
84493
84823
|
static {
|
|
84494
84824
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
84495
84825
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
84496
|
-
const error = await new Promise((
|
|
84497
|
-
this.#process.stdin.write(buffer,
|
|
84826
|
+
const error = await new Promise((resolve11) => {
|
|
84827
|
+
this.#process.stdin.write(buffer, resolve11);
|
|
84498
84828
|
});
|
|
84499
84829
|
if (error) {
|
|
84500
84830
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -84649,8 +84979,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
84649
84979
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
84650
84980
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
84651
84981
|
this.#process.stdin.end();
|
|
84652
|
-
await new Promise((
|
|
84653
|
-
this.#process.once("close",
|
|
84982
|
+
await new Promise((resolve11) => {
|
|
84983
|
+
this.#process.once("close", resolve11);
|
|
84654
84984
|
});
|
|
84655
84985
|
}
|
|
84656
84986
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -84696,17 +85026,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
84696
85026
|
});
|
|
84697
85027
|
|
|
84698
85028
|
// src/core/design-eval/capture.ts
|
|
84699
|
-
import { mkdirSync as mkdirSync8, statSync as statSync11, existsSync as
|
|
84700
|
-
import { join as
|
|
85029
|
+
import { mkdirSync as mkdirSync8, statSync as statSync11, existsSync as existsSync21 } from "fs";
|
|
85030
|
+
import { join as join21 } from "path";
|
|
84701
85031
|
function findBrowser() {
|
|
84702
85032
|
const platform = process.platform;
|
|
84703
85033
|
const paths = CHROME_PATHS[platform] ?? [];
|
|
84704
85034
|
for (const p of paths) {
|
|
84705
|
-
if (
|
|
85035
|
+
if (existsSync21(p))
|
|
84706
85036
|
return p;
|
|
84707
85037
|
}
|
|
84708
|
-
const minkBrowsers =
|
|
84709
|
-
if (
|
|
85038
|
+
const minkBrowsers = join21(minkRoot(), "browsers");
|
|
85039
|
+
if (existsSync21(minkBrowsers)) {
|
|
84710
85040
|
const found = findChromeInDir(minkBrowsers);
|
|
84711
85041
|
if (found)
|
|
84712
85042
|
return found;
|
|
@@ -84727,7 +85057,7 @@ function findChromeInDir(dir) {
|
|
|
84727
85057
|
try {
|
|
84728
85058
|
const entries = readdirSync7(dir);
|
|
84729
85059
|
for (const entry of entries) {
|
|
84730
|
-
const full =
|
|
85060
|
+
const full = join21(dir, entry);
|
|
84731
85061
|
try {
|
|
84732
85062
|
const stat2 = statSync12(full);
|
|
84733
85063
|
if (stat2.isDirectory()) {
|
|
@@ -84775,7 +85105,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
84775
85105
|
const y = section * viewport.height;
|
|
84776
85106
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
84777
85107
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
84778
|
-
const filePath =
|
|
85108
|
+
const filePath = join21(options.outputDir, fileName);
|
|
84779
85109
|
await page.screenshot({
|
|
84780
85110
|
path: filePath,
|
|
84781
85111
|
type: "jpeg",
|
|
@@ -86235,22 +86565,22 @@ var init_framework_advisor2 = __esm(() => {
|
|
|
86235
86565
|
});
|
|
86236
86566
|
|
|
86237
86567
|
// src/core/vault-templates.ts
|
|
86238
|
-
import { join as
|
|
86239
|
-
import { existsSync as
|
|
86568
|
+
import { join as join22 } from "path";
|
|
86569
|
+
import { existsSync as existsSync22, writeFileSync as writeFileSync5, readFileSync as readFileSync22, mkdirSync as mkdirSync9 } from "fs";
|
|
86240
86570
|
function seedTemplates(templatesDir) {
|
|
86241
86571
|
mkdirSync9(templatesDir, { recursive: true });
|
|
86242
86572
|
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
86243
|
-
const filePath =
|
|
86244
|
-
if (!
|
|
86245
|
-
|
|
86573
|
+
const filePath = join22(templatesDir, `${name}.md`);
|
|
86574
|
+
if (!existsSync22(filePath)) {
|
|
86575
|
+
writeFileSync5(filePath, content);
|
|
86246
86576
|
}
|
|
86247
86577
|
}
|
|
86248
86578
|
}
|
|
86249
86579
|
function loadTemplate(templatesDir, templateName, vars) {
|
|
86250
|
-
const filePath =
|
|
86580
|
+
const filePath = join22(templatesDir, `${templateName}.md`);
|
|
86251
86581
|
let content;
|
|
86252
|
-
if (
|
|
86253
|
-
content =
|
|
86582
|
+
if (existsSync22(filePath)) {
|
|
86583
|
+
content = readFileSync22(filePath, "utf-8");
|
|
86254
86584
|
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
86255
86585
|
content = DEFAULT_TEMPLATES[templateName];
|
|
86256
86586
|
} else {
|
|
@@ -86403,8 +86733,8 @@ category: resources
|
|
|
86403
86733
|
});
|
|
86404
86734
|
|
|
86405
86735
|
// src/core/note-linker.ts
|
|
86406
|
-
import { join as
|
|
86407
|
-
import { existsSync as
|
|
86736
|
+
import { join as join23 } from "path";
|
|
86737
|
+
import { existsSync as existsSync23, readFileSync as readFileSync23, readdirSync as readdirSync7, statSync as statSync12 } from "fs";
|
|
86408
86738
|
function updateMasterIndex(vaultRootPath) {
|
|
86409
86739
|
const now = new Date().toISOString().split("T")[0];
|
|
86410
86740
|
const sections = [
|
|
@@ -86426,8 +86756,8 @@ function updateMasterIndex(vaultRootPath) {
|
|
|
86426
86756
|
{ name: "Patterns", dir: "patterns", emoji: "" }
|
|
86427
86757
|
];
|
|
86428
86758
|
for (const cat of categories) {
|
|
86429
|
-
const dirPath =
|
|
86430
|
-
if (!
|
|
86759
|
+
const dirPath = join23(vaultRootPath, cat.dir);
|
|
86760
|
+
if (!existsSync23(dirPath))
|
|
86431
86761
|
continue;
|
|
86432
86762
|
const files = collectMarkdownFiles(dirPath, vaultRootPath);
|
|
86433
86763
|
if (files.length === 0 && cat.dir !== "inbox")
|
|
@@ -86456,7 +86786,7 @@ function collectMarkdownFiles(dirPath, rootPath) {
|
|
|
86456
86786
|
try {
|
|
86457
86787
|
const entries = readdirSync7(dirPath, { withFileTypes: true });
|
|
86458
86788
|
for (const entry of entries) {
|
|
86459
|
-
const fullPath =
|
|
86789
|
+
const fullPath = join23(dirPath, entry.name);
|
|
86460
86790
|
if (entry.isDirectory()) {
|
|
86461
86791
|
files.push(...collectMarkdownFiles(fullPath, rootPath));
|
|
86462
86792
|
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
@@ -86479,8 +86809,8 @@ var exports_wiki = {};
|
|
|
86479
86809
|
__export(exports_wiki, {
|
|
86480
86810
|
wiki: () => wiki
|
|
86481
86811
|
});
|
|
86482
|
-
import { existsSync as
|
|
86483
|
-
import { resolve as
|
|
86812
|
+
import { existsSync as existsSync24, statSync as statSync13 } from "fs";
|
|
86813
|
+
import { resolve as resolve11 } from "path";
|
|
86484
86814
|
import { homedir as homedir4 } from "os";
|
|
86485
86815
|
async function wiki(_cwd, args) {
|
|
86486
86816
|
const sub = args[0];
|
|
@@ -86497,13 +86827,25 @@ async function wiki(_cwd, args) {
|
|
|
86497
86827
|
case "organize":
|
|
86498
86828
|
wikiOrganize();
|
|
86499
86829
|
break;
|
|
86830
|
+
case "link":
|
|
86831
|
+
wikiLink(args.slice(1));
|
|
86832
|
+
break;
|
|
86833
|
+
case "unlink":
|
|
86834
|
+
wikiUnlink(args.slice(1));
|
|
86835
|
+
break;
|
|
86836
|
+
case "links":
|
|
86837
|
+
wikiLinks();
|
|
86838
|
+
break;
|
|
86500
86839
|
default:
|
|
86501
|
-
console.log("Usage: mink wiki <
|
|
86840
|
+
console.log("Usage: mink wiki <command>");
|
|
86502
86841
|
console.log();
|
|
86503
86842
|
console.log(" init Initialize the notes/wiki vault");
|
|
86504
86843
|
console.log(" status Show vault statistics");
|
|
86505
86844
|
console.log(" rebuild-index Full rescan and reindex of vault");
|
|
86506
86845
|
console.log(" organize List inbox notes needing categorization");
|
|
86846
|
+
console.log(" link <path> [name] Symlink external notes into the vault");
|
|
86847
|
+
console.log(" unlink <name> Remove a symlinked directory from the vault");
|
|
86848
|
+
console.log(" links List all linked directories");
|
|
86507
86849
|
break;
|
|
86508
86850
|
}
|
|
86509
86851
|
}
|
|
@@ -86523,7 +86865,7 @@ async function wikiInit(args) {
|
|
|
86523
86865
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
86524
86866
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
86525
86867
|
}
|
|
86526
|
-
const isExisting =
|
|
86868
|
+
const isExisting = existsSync24(targetPath) && statSync13(targetPath).isDirectory();
|
|
86527
86869
|
setConfigValue("wiki.path", targetPath);
|
|
86528
86870
|
ensureVaultStructure();
|
|
86529
86871
|
seedTemplates(vaultTemplates());
|
|
@@ -86611,6 +86953,14 @@ function wikiStatus() {
|
|
|
86611
86953
|
}
|
|
86612
86954
|
console.log();
|
|
86613
86955
|
console.log(` last indexed: ${index.lastScanTimestamp || "never"}`);
|
|
86956
|
+
const links = listLinks();
|
|
86957
|
+
if (links.length > 0) {
|
|
86958
|
+
console.log();
|
|
86959
|
+
console.log(" Linked directories:");
|
|
86960
|
+
for (const link of links) {
|
|
86961
|
+
console.log(` ${link.name} -> ${link.target}`);
|
|
86962
|
+
}
|
|
86963
|
+
}
|
|
86614
86964
|
if (categoryCounts.inbox > 0) {
|
|
86615
86965
|
console.log();
|
|
86616
86966
|
console.log(` ${categoryCounts.inbox} notes in inbox need categorization`);
|
|
@@ -86650,11 +87000,78 @@ function wikiOrganize() {
|
|
|
86650
87000
|
}
|
|
86651
87001
|
console.log("Use '/mink:note' in Claude Code to intelligently categorize these notes.");
|
|
86652
87002
|
}
|
|
87003
|
+
function wikiLink(args) {
|
|
87004
|
+
if (!isVaultInitialized()) {
|
|
87005
|
+
console.log("[mink] no vault initialized");
|
|
87006
|
+
console.log(" Run 'mink wiki init' first.");
|
|
87007
|
+
return;
|
|
87008
|
+
}
|
|
87009
|
+
const targetPath = args[0];
|
|
87010
|
+
if (!targetPath) {
|
|
87011
|
+
console.log("Usage: mink wiki link <path> [name]");
|
|
87012
|
+
console.log();
|
|
87013
|
+
console.log(" Symlinks an external directory into the vault so it appears");
|
|
87014
|
+
console.log(" alongside Mink's content in Obsidian.");
|
|
87015
|
+
console.log();
|
|
87016
|
+
console.log(" Examples:");
|
|
87017
|
+
console.log(" mink wiki link ~/dev/notes");
|
|
87018
|
+
console.log(" mink wiki link ~/dev/notes my-notes");
|
|
87019
|
+
return;
|
|
87020
|
+
}
|
|
87021
|
+
const name = args[1];
|
|
87022
|
+
const result = linkExternal(targetPath, name);
|
|
87023
|
+
if (!result.ok) {
|
|
87024
|
+
console.error(`[mink] ${result.error}`);
|
|
87025
|
+
process.exit(1);
|
|
87026
|
+
}
|
|
87027
|
+
console.log(`[mink] linked: ${result.linkName} -> ${targetPath}`);
|
|
87028
|
+
console.log(` symlink: ${result.linkPath}`);
|
|
87029
|
+
console.log();
|
|
87030
|
+
console.log(" Open ~/.mink/wiki/ as your Obsidian vault to see everything together.");
|
|
87031
|
+
}
|
|
87032
|
+
function wikiUnlink(args) {
|
|
87033
|
+
if (!isVaultInitialized()) {
|
|
87034
|
+
console.log("[mink] no vault initialized");
|
|
87035
|
+
return;
|
|
87036
|
+
}
|
|
87037
|
+
const name = args[0];
|
|
87038
|
+
if (!name) {
|
|
87039
|
+
console.log("Usage: mink wiki unlink <name>");
|
|
87040
|
+
console.log();
|
|
87041
|
+
console.log(" Run 'mink wiki links' to see linked directories.");
|
|
87042
|
+
return;
|
|
87043
|
+
}
|
|
87044
|
+
const result = unlinkExternal(name);
|
|
87045
|
+
if (!result.ok) {
|
|
87046
|
+
console.error(`[mink] ${result.error}`);
|
|
87047
|
+
process.exit(1);
|
|
87048
|
+
}
|
|
87049
|
+
console.log(`[mink] unlinked: ${name}`);
|
|
87050
|
+
console.log(" (original directory was not modified)");
|
|
87051
|
+
}
|
|
87052
|
+
function wikiLinks() {
|
|
87053
|
+
if (!isVaultInitialized()) {
|
|
87054
|
+
console.log("[mink] no vault initialized");
|
|
87055
|
+
return;
|
|
87056
|
+
}
|
|
87057
|
+
const links = listLinks();
|
|
87058
|
+
if (links.length === 0) {
|
|
87059
|
+
console.log("[mink] no linked directories");
|
|
87060
|
+
console.log(" Use 'mink wiki link <path>' to symlink external notes into the vault.");
|
|
87061
|
+
return;
|
|
87062
|
+
}
|
|
87063
|
+
console.log("[mink] linked directories:");
|
|
87064
|
+
console.log();
|
|
87065
|
+
for (const link of links) {
|
|
87066
|
+
console.log(` ${link.name} -> ${link.target}`);
|
|
87067
|
+
console.log(` linked: ${link.linkedAt}`);
|
|
87068
|
+
}
|
|
87069
|
+
}
|
|
86653
87070
|
function expandPath(raw) {
|
|
86654
87071
|
if (raw.startsWith("~/")) {
|
|
86655
|
-
return
|
|
87072
|
+
return resolve11(homedir4(), raw.slice(2));
|
|
86656
87073
|
}
|
|
86657
|
-
return
|
|
87074
|
+
return resolve11(raw);
|
|
86658
87075
|
}
|
|
86659
87076
|
var init_wiki = __esm(() => {
|
|
86660
87077
|
init_vault();
|
|
@@ -86666,8 +87083,8 @@ var init_wiki = __esm(() => {
|
|
|
86666
87083
|
});
|
|
86667
87084
|
|
|
86668
87085
|
// src/core/note-writer.ts
|
|
86669
|
-
import { join as
|
|
86670
|
-
import { existsSync as
|
|
87086
|
+
import { join as join24 } from "path";
|
|
87087
|
+
import { existsSync as existsSync25, readFileSync as readFileSync24 } from "fs";
|
|
86671
87088
|
function slugifyTitle(title) {
|
|
86672
87089
|
return title.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
86673
87090
|
}
|
|
@@ -86700,7 +87117,7 @@ function createNote(meta) {
|
|
|
86700
87117
|
const now = meta.created || new Date().toISOString();
|
|
86701
87118
|
const slug = slugifyTitle(meta.title);
|
|
86702
87119
|
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
86703
|
-
const filePath =
|
|
87120
|
+
const filePath = join24(dir, `${slug}.md`);
|
|
86704
87121
|
let content;
|
|
86705
87122
|
if (meta.template) {
|
|
86706
87123
|
const rendered = loadTemplate(vaultTemplates(), meta.template, {
|
|
@@ -86734,9 +87151,9 @@ ${meta.body}
|
|
|
86734
87151
|
}
|
|
86735
87152
|
function appendToDaily(date, content) {
|
|
86736
87153
|
const dir = vaultDailyDir();
|
|
86737
|
-
const filePath =
|
|
86738
|
-
if (
|
|
86739
|
-
const existing =
|
|
87154
|
+
const filePath = join24(dir, `${date}.md`);
|
|
87155
|
+
if (existsSync25(filePath)) {
|
|
87156
|
+
const existing = readFileSync24(filePath, "utf-8");
|
|
86740
87157
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
86741
87158
|
hour: "2-digit",
|
|
86742
87159
|
minute: "2-digit",
|
|
@@ -86774,7 +87191,7 @@ ${content}
|
|
|
86774
87191
|
return filePath;
|
|
86775
87192
|
}
|
|
86776
87193
|
function ingestFile(sourcePath, meta) {
|
|
86777
|
-
const raw =
|
|
87194
|
+
const raw = readFileSync24(sourcePath, "utf-8");
|
|
86778
87195
|
const now = new Date().toISOString();
|
|
86779
87196
|
const headingMatch = raw.match(/^#\s+(.+)$/m);
|
|
86780
87197
|
const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
|
|
@@ -86812,7 +87229,7 @@ ${raw}`;
|
|
|
86812
87229
|
}
|
|
86813
87230
|
const slug = slugifyTitle(title);
|
|
86814
87231
|
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
86815
|
-
const filePath =
|
|
87232
|
+
const filePath = join24(dir, `${slug}.md`);
|
|
86816
87233
|
atomicWriteText(filePath, content);
|
|
86817
87234
|
return { filePath, content };
|
|
86818
87235
|
}
|
|
@@ -86827,8 +87244,8 @@ var exports_note = {};
|
|
|
86827
87244
|
__export(exports_note, {
|
|
86828
87245
|
note: () => note
|
|
86829
87246
|
});
|
|
86830
|
-
import { resolve as
|
|
86831
|
-
import { existsSync as
|
|
87247
|
+
import { resolve as resolve12 } from "path";
|
|
87248
|
+
import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
|
|
86832
87249
|
async function note(cwd, args) {
|
|
86833
87250
|
if (!isWikiEnabled()) {
|
|
86834
87251
|
console.error("[mink] wiki feature is disabled");
|
|
@@ -86853,13 +87270,13 @@ async function note(cwd, args) {
|
|
|
86853
87270
|
const date = new Date().toISOString().split("T")[0];
|
|
86854
87271
|
const content = parsed.positional || parsed.body || "";
|
|
86855
87272
|
const filePath = appendToDaily(date, content);
|
|
86856
|
-
updateVaultIndexForFile(filePath,
|
|
87273
|
+
updateVaultIndexForFile(filePath, readFileSync25(filePath, "utf-8"));
|
|
86857
87274
|
console.log(`[mink] daily note: ${filePath}`);
|
|
86858
87275
|
return;
|
|
86859
87276
|
}
|
|
86860
87277
|
if (parsed.file) {
|
|
86861
|
-
const sourcePath =
|
|
86862
|
-
if (!
|
|
87278
|
+
const sourcePath = resolve12(cwd, parsed.file);
|
|
87279
|
+
if (!existsSync26(sourcePath)) {
|
|
86863
87280
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
86864
87281
|
process.exit(1);
|
|
86865
87282
|
}
|
|
@@ -87020,29 +87437,29 @@ var exports_skill = {};
|
|
|
87020
87437
|
__export(exports_skill, {
|
|
87021
87438
|
skill: () => skill
|
|
87022
87439
|
});
|
|
87023
|
-
import { join as
|
|
87440
|
+
import { join as join25, resolve as resolve13, dirname as dirname11 } from "path";
|
|
87024
87441
|
import { homedir as homedir5 } from "os";
|
|
87025
87442
|
import {
|
|
87026
|
-
existsSync as
|
|
87443
|
+
existsSync as existsSync27,
|
|
87027
87444
|
mkdirSync as mkdirSync10,
|
|
87028
87445
|
copyFileSync,
|
|
87029
|
-
unlinkSync as
|
|
87446
|
+
unlinkSync as unlinkSync3,
|
|
87030
87447
|
readdirSync as readdirSync8,
|
|
87031
87448
|
rmSync,
|
|
87032
|
-
symlinkSync,
|
|
87033
|
-
lstatSync
|
|
87449
|
+
symlinkSync as symlinkSync2,
|
|
87450
|
+
lstatSync as lstatSync2
|
|
87034
87451
|
} from "fs";
|
|
87035
87452
|
function getSkillsSourceDir() {
|
|
87036
|
-
return
|
|
87453
|
+
return resolve13(dirname11(new URL(import.meta.url).pathname), "../../skills");
|
|
87037
87454
|
}
|
|
87038
87455
|
function getAvailableSkills() {
|
|
87039
87456
|
const dir = getSkillsSourceDir();
|
|
87040
|
-
if (!
|
|
87457
|
+
if (!existsSync27(dir))
|
|
87041
87458
|
return [];
|
|
87042
|
-
return readdirSync8(dir, { withFileTypes: true }).filter((d) => d.isDirectory() &&
|
|
87459
|
+
return readdirSync8(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync27(join25(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
87043
87460
|
}
|
|
87044
87461
|
function isInstalled(skillName) {
|
|
87045
|
-
return
|
|
87462
|
+
return existsSync27(join25(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
87046
87463
|
}
|
|
87047
87464
|
async function skill(args) {
|
|
87048
87465
|
const sub = args[0];
|
|
@@ -87078,27 +87495,27 @@ function skillInstall(name) {
|
|
|
87078
87495
|
}
|
|
87079
87496
|
mkdirSync10(AGENTS_SKILLS_DIR, { recursive: true });
|
|
87080
87497
|
for (const skillName of skills) {
|
|
87081
|
-
const srcDir =
|
|
87082
|
-
const srcFile =
|
|
87083
|
-
const destDir =
|
|
87084
|
-
if (!
|
|
87498
|
+
const srcDir = join25(sourceDir, skillName);
|
|
87499
|
+
const srcFile = join25(srcDir, "SKILL.md");
|
|
87500
|
+
const destDir = join25(AGENTS_SKILLS_DIR, skillName);
|
|
87501
|
+
if (!existsSync27(srcFile)) {
|
|
87085
87502
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
87086
87503
|
continue;
|
|
87087
87504
|
}
|
|
87088
87505
|
mkdirSync10(destDir, { recursive: true });
|
|
87089
87506
|
copyDirRecursive(srcDir, destDir);
|
|
87090
87507
|
mkdirSync10(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
87091
|
-
const symlink =
|
|
87508
|
+
const symlink = join25(CLAUDE_SKILLS_DIR, skillName);
|
|
87092
87509
|
try {
|
|
87093
|
-
if (
|
|
87094
|
-
if (
|
|
87095
|
-
|
|
87510
|
+
if (existsSync27(symlink)) {
|
|
87511
|
+
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
87512
|
+
unlinkSync3(symlink);
|
|
87096
87513
|
} else {
|
|
87097
87514
|
rmSync(symlink, { recursive: true, force: true });
|
|
87098
87515
|
}
|
|
87099
87516
|
}
|
|
87100
|
-
const relativeTarget =
|
|
87101
|
-
|
|
87517
|
+
const relativeTarget = join25("..", "..", ".agents", "skills", skillName);
|
|
87518
|
+
symlinkSync2(relativeTarget, symlink);
|
|
87102
87519
|
} catch {}
|
|
87103
87520
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
87104
87521
|
}
|
|
@@ -87108,16 +87525,16 @@ function skillInstall(name) {
|
|
|
87108
87525
|
function skillUninstall(name) {
|
|
87109
87526
|
const skills = name ? [name] : getAvailableSkills();
|
|
87110
87527
|
for (const skillName of skills) {
|
|
87111
|
-
const destDir =
|
|
87112
|
-
if (!
|
|
87528
|
+
const destDir = join25(AGENTS_SKILLS_DIR, skillName);
|
|
87529
|
+
if (!existsSync27(destDir)) {
|
|
87113
87530
|
console.log(`[mink] not installed: ${skillName}`);
|
|
87114
87531
|
continue;
|
|
87115
87532
|
}
|
|
87116
87533
|
rmSync(destDir, { recursive: true, force: true });
|
|
87117
|
-
const symlink =
|
|
87534
|
+
const symlink = join25(CLAUDE_SKILLS_DIR, skillName);
|
|
87118
87535
|
try {
|
|
87119
|
-
if (
|
|
87120
|
-
|
|
87536
|
+
if (existsSync27(symlink))
|
|
87537
|
+
unlinkSync3(symlink);
|
|
87121
87538
|
} catch {}
|
|
87122
87539
|
console.log(`[mink] uninstalled: ${skillName}`);
|
|
87123
87540
|
}
|
|
@@ -87131,7 +87548,7 @@ function skillList() {
|
|
|
87131
87548
|
if (installed.length > 0) {
|
|
87132
87549
|
console.log(" Installed:");
|
|
87133
87550
|
for (const s of installed) {
|
|
87134
|
-
console.log(` ${s} (${
|
|
87551
|
+
console.log(` ${s} (${join25(AGENTS_SKILLS_DIR, s)})`);
|
|
87135
87552
|
}
|
|
87136
87553
|
}
|
|
87137
87554
|
if (notInstalled.length > 0) {
|
|
@@ -87150,8 +87567,8 @@ function skillList() {
|
|
|
87150
87567
|
function copyDirRecursive(src, dest) {
|
|
87151
87568
|
const entries = readdirSync8(src, { withFileTypes: true });
|
|
87152
87569
|
for (const entry of entries) {
|
|
87153
|
-
const srcPath =
|
|
87154
|
-
const destPath =
|
|
87570
|
+
const srcPath = join25(src, entry.name);
|
|
87571
|
+
const destPath = join25(dest, entry.name);
|
|
87155
87572
|
if (entry.isDirectory()) {
|
|
87156
87573
|
mkdirSync10(destPath, { recursive: true });
|
|
87157
87574
|
copyDirRecursive(srcPath, destPath);
|
|
@@ -87162,8 +87579,97 @@ function copyDirRecursive(src, dest) {
|
|
|
87162
87579
|
}
|
|
87163
87580
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
87164
87581
|
var init_skill = __esm(() => {
|
|
87165
|
-
AGENTS_SKILLS_DIR =
|
|
87166
|
-
CLAUDE_SKILLS_DIR =
|
|
87582
|
+
AGENTS_SKILLS_DIR = join25(homedir5(), ".agents", "skills");
|
|
87583
|
+
CLAUDE_SKILLS_DIR = join25(homedir5(), ".claude", "skills");
|
|
87584
|
+
});
|
|
87585
|
+
|
|
87586
|
+
// src/commands/sync.ts
|
|
87587
|
+
var exports_sync2 = {};
|
|
87588
|
+
__export(exports_sync2, {
|
|
87589
|
+
sync: () => sync
|
|
87590
|
+
});
|
|
87591
|
+
async function sync(args) {
|
|
87592
|
+
const subcommand = args[0];
|
|
87593
|
+
switch (subcommand) {
|
|
87594
|
+
case undefined:
|
|
87595
|
+
return handleManualSync();
|
|
87596
|
+
case "init":
|
|
87597
|
+
return handleInit(args.slice(1));
|
|
87598
|
+
case "status":
|
|
87599
|
+
return handleStatus();
|
|
87600
|
+
case "push":
|
|
87601
|
+
syncPush((msg) => console.error(msg));
|
|
87602
|
+
return;
|
|
87603
|
+
case "pull":
|
|
87604
|
+
syncPull((msg) => console.error(msg));
|
|
87605
|
+
return;
|
|
87606
|
+
case "pause":
|
|
87607
|
+
return handlePause();
|
|
87608
|
+
case "resume":
|
|
87609
|
+
return handleResume();
|
|
87610
|
+
case "disconnect":
|
|
87611
|
+
return handleDisconnect();
|
|
87612
|
+
default:
|
|
87613
|
+
console.error(`[mink] unknown sync subcommand: ${subcommand}`);
|
|
87614
|
+
console.error("Usage: mink sync [init|status|push|pull|pause|resume|disconnect]");
|
|
87615
|
+
process.exit(1);
|
|
87616
|
+
}
|
|
87617
|
+
}
|
|
87618
|
+
function handleManualSync() {
|
|
87619
|
+
if (!isSyncInitialized()) {
|
|
87620
|
+
console.error("[mink] sync is not initialized");
|
|
87621
|
+
console.error("Run 'mink sync init <remote-url>' to set up sync");
|
|
87622
|
+
return;
|
|
87623
|
+
}
|
|
87624
|
+
console.log("[mink] pulling remote changes...");
|
|
87625
|
+
syncPull((msg) => console.error(msg));
|
|
87626
|
+
console.log("[mink] pushing local changes...");
|
|
87627
|
+
syncPush((msg) => console.error(msg));
|
|
87628
|
+
console.log("[mink] sync complete");
|
|
87629
|
+
}
|
|
87630
|
+
function handleInit(args) {
|
|
87631
|
+
const remoteUrl = args[0];
|
|
87632
|
+
if (!remoteUrl) {
|
|
87633
|
+
console.error("[mink] missing remote URL");
|
|
87634
|
+
console.error("Usage: mink sync init <remote-url>");
|
|
87635
|
+
console.error("Example: mink sync init git@github.com:user/mink-data.git");
|
|
87636
|
+
process.exit(1);
|
|
87637
|
+
}
|
|
87638
|
+
initSync(remoteUrl);
|
|
87639
|
+
}
|
|
87640
|
+
function handleStatus() {
|
|
87641
|
+
const status2 = getSyncStatus();
|
|
87642
|
+
console.log("Mink Sync Status");
|
|
87643
|
+
console.log("─".repeat(40));
|
|
87644
|
+
console.log(` Enabled: ${status2.enabled ? "yes" : "no"}`);
|
|
87645
|
+
console.log(` Git initialized: ${status2.gitInitialized ? "yes" : "no"}`);
|
|
87646
|
+
console.log(` Remote URL: ${status2.remoteUrl || "(not set)"}`);
|
|
87647
|
+
console.log(` Branch: ${status2.branch || "(none)"}`);
|
|
87648
|
+
console.log(` Pending changes: ${status2.pendingChanges}`);
|
|
87649
|
+
console.log(` Last push: ${status2.lastPush || "(never)"}`);
|
|
87650
|
+
console.log(` Last pull: ${status2.lastPull || "(never)"}`);
|
|
87651
|
+
}
|
|
87652
|
+
function handlePause() {
|
|
87653
|
+
setConfigValue("sync.enabled", "false");
|
|
87654
|
+
console.log("[mink] sync paused — auto-sync disabled");
|
|
87655
|
+
console.log("[mink] run 'mink sync resume' to re-enable");
|
|
87656
|
+
}
|
|
87657
|
+
function handleResume() {
|
|
87658
|
+
const status2 = getSyncStatus();
|
|
87659
|
+
if (!status2.gitInitialized) {
|
|
87660
|
+
console.error("[mink] sync has not been initialized yet");
|
|
87661
|
+
console.error("Run 'mink sync init <remote-url>' first");
|
|
87662
|
+
return;
|
|
87663
|
+
}
|
|
87664
|
+
setConfigValue("sync.enabled", "true");
|
|
87665
|
+
console.log("[mink] sync resumed — auto-sync re-enabled");
|
|
87666
|
+
}
|
|
87667
|
+
function handleDisconnect() {
|
|
87668
|
+
disconnectSync();
|
|
87669
|
+
}
|
|
87670
|
+
var init_sync3 = __esm(() => {
|
|
87671
|
+
init_sync();
|
|
87672
|
+
init_global_config();
|
|
87167
87673
|
});
|
|
87168
87674
|
|
|
87169
87675
|
// src/commands/bug-search.ts
|
|
@@ -87209,6 +87715,12 @@ init_vault();
|
|
|
87209
87715
|
init_note_index();
|
|
87210
87716
|
import { mkdirSync as mkdirSync3 } from "fs";
|
|
87211
87717
|
function sessionStart(cwd) {
|
|
87718
|
+
try {
|
|
87719
|
+
const { isSyncInitialized: isSyncInitialized2, syncPull: syncPull2 } = (init_sync(), __toCommonJS(exports_sync));
|
|
87720
|
+
if (isSyncInitialized2()) {
|
|
87721
|
+
syncPull2((msg) => console.error(msg));
|
|
87722
|
+
}
|
|
87723
|
+
} catch {}
|
|
87212
87724
|
const dir = projectDir(cwd);
|
|
87213
87725
|
mkdirSync3(dir, { recursive: true });
|
|
87214
87726
|
const state = createSessionState();
|
|
@@ -87239,10 +87751,8 @@ init_token_ledger();
|
|
|
87239
87751
|
init_bug_memory();
|
|
87240
87752
|
init_action_log();
|
|
87241
87753
|
init_vault();
|
|
87242
|
-
|
|
87243
|
-
import {
|
|
87244
|
-
import { join as join5, dirname as dirname2 } from "path";
|
|
87245
|
-
import { execSync } from "child_process";
|
|
87754
|
+
import { statSync as statSync2, existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
|
|
87755
|
+
import { join as join6, dirname as dirname2 } from "path";
|
|
87246
87756
|
function hasActivity(state) {
|
|
87247
87757
|
return Object.keys(state.reads).length > 0 || state.writes.length > 0;
|
|
87248
87758
|
}
|
|
@@ -87283,10 +87793,10 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87283
87793
|
effectiveFinalizer.updateSession(summary);
|
|
87284
87794
|
}
|
|
87285
87795
|
try {
|
|
87286
|
-
const logPath =
|
|
87796
|
+
const logPath = join6(projDir, "action-log.md");
|
|
87287
87797
|
const logWriter = createActionLogWriter(logPath);
|
|
87288
87798
|
logWriter.appendSessionEnd(summary);
|
|
87289
|
-
const cfgRaw = safeReadJson(
|
|
87799
|
+
const cfgRaw = safeReadJson(join6(projDir, "config.json"));
|
|
87290
87800
|
consolidateLog(logPath, {
|
|
87291
87801
|
maxEntries: cfgRaw?.actionLogMaxEntries ?? 200,
|
|
87292
87802
|
retentionDays: cfgRaw?.actionLogRetentionDays ?? 7
|
|
@@ -87294,7 +87804,7 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87294
87804
|
} catch {}
|
|
87295
87805
|
}
|
|
87296
87806
|
const editCounts = getEditCounts(state);
|
|
87297
|
-
const bugMemoryFile =
|
|
87807
|
+
const bugMemoryFile = join6(projDir, "bug-memory.json");
|
|
87298
87808
|
const bugMemory = loadBugMemory(bugMemoryFile);
|
|
87299
87809
|
for (const [filePath, count] of Object.entries(editCounts)) {
|
|
87300
87810
|
if (count >= 3) {
|
|
@@ -87304,9 +87814,9 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87304
87814
|
}
|
|
87305
87815
|
}
|
|
87306
87816
|
}
|
|
87307
|
-
const memoryPath =
|
|
87308
|
-
const cfgPath =
|
|
87309
|
-
if (
|
|
87817
|
+
const memoryPath = join6(projDir, "learning-memory.md");
|
|
87818
|
+
const cfgPath = join6(projDir, "config.json");
|
|
87819
|
+
if (existsSync5(memoryPath)) {
|
|
87310
87820
|
reflect(projDir, memoryPath, cfgPath);
|
|
87311
87821
|
}
|
|
87312
87822
|
if (isLearningMemoryStale(memoryPath)) {
|
|
@@ -87318,23 +87828,21 @@ function sessionStop(sessionFile, finalizer, onReminder = (msg) => console.error
|
|
|
87318
87828
|
}
|
|
87319
87829
|
} catch {}
|
|
87320
87830
|
try {
|
|
87321
|
-
|
|
87322
|
-
|
|
87323
|
-
|
|
87324
|
-
gitBackupVault(onReminder);
|
|
87325
|
-
}
|
|
87831
|
+
const { isSyncInitialized: isSyncInitialized2, syncPush: syncPush2 } = (init_sync(), __toCommonJS(exports_sync));
|
|
87832
|
+
if (isSyncInitialized2()) {
|
|
87833
|
+
syncPush2(onReminder);
|
|
87326
87834
|
}
|
|
87327
87835
|
} catch {}
|
|
87328
87836
|
atomicWriteJson(sessionFile, state);
|
|
87329
87837
|
}
|
|
87330
87838
|
function writeSessionToWiki(state, projDir) {
|
|
87331
|
-
const metaRaw = safeReadJson(
|
|
87839
|
+
const metaRaw = safeReadJson(join6(projDir, "project-meta.json"));
|
|
87332
87840
|
const projectName = metaRaw?.name ?? "unknown";
|
|
87333
87841
|
const date = new Date().toISOString().split("T")[0];
|
|
87334
87842
|
const readCount = Object.keys(state.reads).length;
|
|
87335
87843
|
const writeCount = state.writes.length;
|
|
87336
|
-
const sessionDir =
|
|
87337
|
-
const sessionFile =
|
|
87844
|
+
const sessionDir = join6(vaultProjects(projectName), "sessions");
|
|
87845
|
+
const sessionFile = join6(sessionDir, `${date}.md`);
|
|
87338
87846
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
87339
87847
|
hour: "2-digit",
|
|
87340
87848
|
minute: "2-digit",
|
|
@@ -87359,8 +87867,8 @@ function writeSessionToWiki(state, projDir) {
|
|
|
87359
87867
|
}
|
|
87360
87868
|
}
|
|
87361
87869
|
entry.push("");
|
|
87362
|
-
if (
|
|
87363
|
-
const existing =
|
|
87870
|
+
if (existsSync5(sessionFile)) {
|
|
87871
|
+
const existing = readFileSync6(sessionFile, "utf-8");
|
|
87364
87872
|
atomicWriteText(sessionFile, existing.trimEnd() + `
|
|
87365
87873
|
` + entry.join(`
|
|
87366
87874
|
`));
|
|
@@ -87381,39 +87889,6 @@ function writeSessionToWiki(state, projDir) {
|
|
|
87381
87889
|
`));
|
|
87382
87890
|
}
|
|
87383
87891
|
}
|
|
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
87892
|
|
|
87418
87893
|
// src/cli.ts
|
|
87419
87894
|
init_paths2();
|
|
@@ -87528,6 +88003,11 @@ switch (command2) {
|
|
|
87528
88003
|
await skill2(process.argv.slice(3));
|
|
87529
88004
|
break;
|
|
87530
88005
|
}
|
|
88006
|
+
case "sync": {
|
|
88007
|
+
const { sync: sync2 } = await Promise.resolve().then(() => (init_sync3(), exports_sync2));
|
|
88008
|
+
await sync2(process.argv.slice(3));
|
|
88009
|
+
break;
|
|
88010
|
+
}
|
|
87531
88011
|
case "bug-search": {
|
|
87532
88012
|
const { bugSearch: bugSearch2 } = await Promise.resolve().then(() => (init_bug_search(), exports_bug_search));
|
|
87533
88013
|
bugSearch2(cwd, process.argv.slice(3).join(" "));
|
|
@@ -87547,11 +88027,11 @@ switch (command2) {
|
|
|
87547
88027
|
case "version":
|
|
87548
88028
|
case "--version":
|
|
87549
88029
|
case "-v": {
|
|
87550
|
-
const { resolve:
|
|
87551
|
-
const cliPath =
|
|
87552
|
-
const { readFileSync:
|
|
88030
|
+
const { resolve: resolve14, dirname: dirname12 } = await import("path");
|
|
88031
|
+
const cliPath = resolve14(dirname12(new URL(import.meta.url).pathname));
|
|
88032
|
+
const { readFileSync: readFileSync26 } = await import("fs");
|
|
87553
88033
|
try {
|
|
87554
|
-
const pkg = JSON.parse(
|
|
88034
|
+
const pkg = JSON.parse(readFileSync26(resolve14(cliPath, "../package.json"), "utf-8"));
|
|
87555
88035
|
console.log(`mink ${pkg.version}`);
|
|
87556
88036
|
} catch {
|
|
87557
88037
|
console.log("mink (unknown version)");
|
|
@@ -87573,13 +88053,22 @@ switch (command2) {
|
|
|
87573
88053
|
console.log(" config [key] [value] Manage global user settings");
|
|
87574
88054
|
console.log();
|
|
87575
88055
|
console.log("Notes & Wiki:");
|
|
87576
|
-
console.log(" wiki <cmd> Manage the notes/wiki vault (init|status|rebuild-index|organize)");
|
|
88056
|
+
console.log(" wiki <cmd> Manage the notes/wiki vault (init|status|link|unlink|links|rebuild-index|organize)");
|
|
87577
88057
|
console.log(' note "text" Capture a note to the vault');
|
|
87578
88058
|
console.log(" note --daily [text] Create or append to today's daily note");
|
|
87579
88059
|
console.log(" note list [filters] List notes (--category, --tag, --recent)");
|
|
87580
88060
|
console.log(" note search <term> Full-text search across the vault");
|
|
87581
88061
|
console.log(" skill install Install /mink:note skill for Claude Code");
|
|
87582
88062
|
console.log();
|
|
88063
|
+
console.log("Sync:");
|
|
88064
|
+
console.log(" sync Full manual sync (pull then push)");
|
|
88065
|
+
console.log(" sync init <remote-url> Connect ~/.mink to a git remote for cross-device sync");
|
|
88066
|
+
console.log(" sync status Show sync state (remote, last sync, pending changes)");
|
|
88067
|
+
console.log(" sync push Manually push local changes");
|
|
88068
|
+
console.log(" sync pull Manually pull remote changes");
|
|
88069
|
+
console.log(" sync pause / resume Temporarily disable/enable auto-sync");
|
|
88070
|
+
console.log(" sync disconnect Remove git tracking (data preserved)");
|
|
88071
|
+
console.log();
|
|
87583
88072
|
console.log("Automation & Analysis:");
|
|
87584
88073
|
console.log(" dashboard [--port=N] Open the real-time web dashboard");
|
|
87585
88074
|
console.log(" daemon <cmd> Manage the background daemon (start|stop|restart|logs)");
|