@drewpayment/mink 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dashboard/out/404.html +1 -1
- package/dashboard/out/_next/static/Dw8C--0lGz5BIGsnG-e5H/_buildManifest.js +1 -0
- package/dashboard/out/_next/static/chunks/189-fe789442321eb5eb.js +1 -0
- package/dashboard/out/_next/static/chunks/255-6b79f309a27fb98b.js +1 -0
- package/dashboard/out/_next/static/chunks/4bd1b696-c023c6e3521b1417.js +1 -0
- package/dashboard/out/_next/static/chunks/738-11c31dcbdbb98d77.js +1 -0
- package/dashboard/out/_next/static/chunks/926-6421b9e9b03abc7b.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/action-log/page-1f507b433af52d16.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/activity/page-096a97ba539d5323.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/bugs/page-449d31c133432458.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/capture/page-c6617aa0a8a7333e.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/config/page-aa0a0623b3fdd0d8.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/daemon/page-7cd3fac2f5d87a0d.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/design/page-5304675c96b6793b.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/discord/page-9940dde80ba2a69e.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/file-index/page-ecd8a753614e981e.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/insights/page-7909d8beb8d8ef7a.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/learning/page-b766adc79099adb4.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/overview/page-7a9e86dcde67d6a9.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/scheduler/page-a88f93204c9742a1.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/sync/page-8a9ad4c36aa6cb65.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/tokens/page-8dac7d50d4db2756.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/waste/page-bcf56144faf7d133.js +1 -0
- package/dashboard/out/_next/static/chunks/app/(panels)/wiki/page-a32fdbd0bf58b30b.js +1 -0
- package/dashboard/out/_next/static/chunks/app/_not-found/page-dc2312ec30d73c4e.js +1 -0
- package/dashboard/out/_next/static/chunks/app/layout-782cd26e0ccc4514.js +1 -0
- package/dashboard/out/_next/static/chunks/app/page-6aca8457abc5d313.js +1 -0
- package/dashboard/out/_next/static/chunks/framework-050c1f32293f7182.js +1 -0
- package/dashboard/out/_next/static/chunks/main-app-c2dc0acf542ec1c6.js +1 -0
- package/dashboard/out/_next/static/chunks/main-ed79d05490604b83.js +1 -0
- package/dashboard/out/_next/static/chunks/pages/_app-7d307437aca18ad4.js +1 -0
- package/dashboard/out/_next/static/chunks/pages/_error-cb2a52f75f2162e2.js +1 -0
- package/dashboard/out/_next/static/chunks/webpack-4e3139a490df1cfe.js +1 -0
- package/dashboard/out/_next/static/css/5e43917ea49c5b3e.css +1 -0
- package/dashboard/out/_next/static/media/0aa834ed78bf6d07-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/21350d82a1f187e9-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/67957d42bae0796d-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/886030b0b59bc5a7-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/939c4f875ee75fbb-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/bb3ef058b751a6ad-s.p.woff2 +0 -0
- package/dashboard/out/_next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
- package/dashboard/out/_next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/dashboard/out/_next/static/media/f911b923c6adde36-s.woff2 +0 -0
- package/dashboard/out/action-log.html +1 -1
- package/dashboard/out/action-log.txt +23 -22
- package/dashboard/out/activity.html +1 -1
- package/dashboard/out/activity.txt +23 -22
- package/dashboard/out/bugs.html +1 -1
- package/dashboard/out/bugs.txt +23 -22
- package/dashboard/out/capture.html +1 -0
- package/dashboard/out/capture.txt +24 -0
- package/dashboard/out/config.html +1 -0
- package/dashboard/out/config.txt +24 -0
- package/dashboard/out/daemon.html +1 -0
- package/dashboard/out/daemon.txt +24 -0
- package/dashboard/out/design.html +1 -1
- package/dashboard/out/design.txt +23 -22
- package/dashboard/out/discord.html +1 -0
- package/dashboard/out/discord.txt +24 -0
- package/dashboard/out/file-index.html +1 -1
- package/dashboard/out/file-index.txt +23 -22
- package/dashboard/out/index.html +1 -1
- package/dashboard/out/index.txt +23 -22
- package/dashboard/out/insights.html +1 -1
- package/dashboard/out/insights.txt +23 -22
- package/dashboard/out/learning.html +1 -1
- package/dashboard/out/learning.txt +23 -22
- package/dashboard/out/overview.html +1 -1
- package/dashboard/out/overview.txt +23 -22
- package/dashboard/out/scheduler.html +1 -1
- package/dashboard/out/scheduler.txt +23 -22
- package/dashboard/out/sync.html +1 -0
- package/dashboard/out/sync.txt +24 -0
- package/dashboard/out/tokens.html +1 -1
- package/dashboard/out/tokens.txt +23 -22
- package/dashboard/out/waste.html +1 -0
- package/dashboard/out/waste.txt +24 -0
- package/dashboard/out/wiki.html +1 -0
- package/dashboard/out/wiki.txt +24 -0
- package/dist/cli.js +1695 -892
- package/package.json +1 -1
- package/src/core/daemon.ts +5 -3
- package/src/core/dashboard-api.ts +764 -1
- package/src/core/dashboard-server.ts +270 -0
- package/src/core/runtime.ts +7 -4
- package/src/core/vault.ts +4 -4
- package/src/types/config.ts +9 -1
- package/src/types/dashboard.ts +84 -1
- package/dashboard/out/_next/static/1wsj8DdMTS0IF2Rk9fkxV/_buildManifest.js +0 -1
- package/dashboard/out/_next/static/chunks/160-3e240a3c66269b3f.js +0 -1
- package/dashboard/out/_next/static/chunks/212-0f603e7affd3ee2a.js +0 -4
- package/dashboard/out/_next/static/chunks/255-b047925426c4e4ba.js +0 -1
- package/dashboard/out/_next/static/chunks/4bd1b696-409494caf8c83275.js +0 -1
- package/dashboard/out/_next/static/chunks/55-079130502e972d37.js +0 -1
- package/dashboard/out/_next/static/chunks/692-9c8d44014aa1813d.js +0 -1
- package/dashboard/out/_next/static/chunks/717-3d920b69f8c31178.js +0 -1
- package/dashboard/out/_next/static/chunks/752-8a8e79b1a2a3b489.js +0 -1
- package/dashboard/out/_next/static/chunks/83-ddf005b52ec7bd16.js +0 -1
- package/dashboard/out/_next/static/chunks/845-bed7bdd2fed7ff76.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/action-log/page-c52cf3851d9d92d5.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/activity/page-25a84ac9ddbbc077.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/bugs/page-7de0b71150a91377.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/design/page-a2153b4f18533187.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/file-index/page-b37bdd2344d3f81c.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/insights/page-b9cea601167e83d1.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/learning/page-faa4afcf1473c9e5.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/overview/page-354f274bc72789a8.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/scheduler/page-fc11b7fbbd04a4d7.js +0 -1
- package/dashboard/out/_next/static/chunks/app/(panels)/tokens/page-c08c102aa883500a.js +0 -1
- package/dashboard/out/_next/static/chunks/app/_not-found/page-88217a29323e3700.js +0 -1
- package/dashboard/out/_next/static/chunks/app/layout-93083f9f140da937.js +0 -1
- package/dashboard/out/_next/static/chunks/app/page-0e7a5cffcfa1d064.js +0 -1
- package/dashboard/out/_next/static/chunks/framework-1a308e28e19f1a97.js +0 -1
- package/dashboard/out/_next/static/chunks/main-7c6d83fa0f7c5e5b.js +0 -1
- package/dashboard/out/_next/static/chunks/main-app-2f83d483d67187ef.js +0 -1
- package/dashboard/out/_next/static/chunks/pages/_app-5addca2b3b969fde.js +0 -1
- package/dashboard/out/_next/static/chunks/pages/_error-022e4ac7bbb9914f.js +0 -1
- package/dashboard/out/_next/static/chunks/webpack-ee71d9ae9be3609d.js +0 -1
- package/dashboard/out/_next/static/css/cfd58816f9a2afb9.css +0 -1
- /package/dashboard/out/_next/static/{1wsj8DdMTS0IF2Rk9fkxV → Dw8C--0lGz5BIGsnG-e5H}/_ssgManifest.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -578,7 +578,7 @@ var init_config = __esm(() => {
|
|
|
578
578
|
CONFIG_KEYS = [
|
|
579
579
|
{
|
|
580
580
|
key: "wiki.path",
|
|
581
|
-
default: "~/.mink/wiki
|
|
581
|
+
default: "~/.mink/wiki",
|
|
582
582
|
envVar: "MINK_WIKI_PATH",
|
|
583
583
|
description: "Wiki vault location",
|
|
584
584
|
scope: "local"
|
|
@@ -660,6 +660,13 @@ var init_config = __esm(() => {
|
|
|
660
660
|
description: "Auto-start Discord channel when daemon starts",
|
|
661
661
|
scope: "local"
|
|
662
662
|
},
|
|
663
|
+
{
|
|
664
|
+
key: "channel.discord.allowlist",
|
|
665
|
+
default: "",
|
|
666
|
+
envVar: "MINK_CHANNEL_DISCORD_ALLOWLIST",
|
|
667
|
+
description: "Comma-separated list of Discord user IDs permitted to DM the bot",
|
|
668
|
+
scope: "local"
|
|
669
|
+
},
|
|
663
670
|
{
|
|
664
671
|
key: "channel.default-platform",
|
|
665
672
|
default: "discord",
|
|
@@ -802,10 +809,8 @@ import { existsSync, mkdirSync as mkdirSync2, symlinkSync, unlinkSync, lstatSync
|
|
|
802
809
|
function resolveVaultPath() {
|
|
803
810
|
const resolved = resolveConfigValue("wiki.path");
|
|
804
811
|
const raw = resolved.value;
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
return raw;
|
|
812
|
+
const expanded = raw.startsWith("~/") ? join2(homedir2(), raw.slice(2)) : raw;
|
|
813
|
+
return resolve(expanded);
|
|
809
814
|
}
|
|
810
815
|
function vaultProjects(slug) {
|
|
811
816
|
const base = join2(resolveVaultPath(), "projects");
|
|
@@ -1089,6 +1094,10 @@ function searchVaultIndex(term) {
|
|
|
1089
1094
|
const lower = term.toLowerCase();
|
|
1090
1095
|
return Object.values(index.entries).filter((e) => e.title.toLowerCase().includes(lower) || e.description.toLowerCase().includes(lower) || e.tags.some((t) => t.toLowerCase().includes(lower)) || e.filePath.toLowerCase().includes(lower));
|
|
1091
1096
|
}
|
|
1097
|
+
function getRecentNotes(n) {
|
|
1098
|
+
const index = loadVaultIndex();
|
|
1099
|
+
return Object.values(index.entries).sort((a, b) => b.lastModified.localeCompare(a.lastModified)).slice(0, n);
|
|
1100
|
+
}
|
|
1092
1101
|
function collectAllMarkdown(rootPath) {
|
|
1093
1102
|
const files = [];
|
|
1094
1103
|
function walk(dir) {
|
|
@@ -3457,6 +3466,146 @@ var init_channel_process = __esm(() => {
|
|
|
3457
3466
|
};
|
|
3458
3467
|
});
|
|
3459
3468
|
|
|
3469
|
+
// src/core/runtime.ts
|
|
3470
|
+
import { readFile as readFile2, stat } from "fs/promises";
|
|
3471
|
+
import { spawn as nodeSpawn } from "child_process";
|
|
3472
|
+
function runtimeFile(path) {
|
|
3473
|
+
if (isBun) {
|
|
3474
|
+
const f = Bun.file(path);
|
|
3475
|
+
return {
|
|
3476
|
+
exists: () => f.exists(),
|
|
3477
|
+
bytes: () => f.arrayBuffer().then((ab) => new Uint8Array(ab))
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
3480
|
+
return {
|
|
3481
|
+
async exists() {
|
|
3482
|
+
try {
|
|
3483
|
+
await stat(path);
|
|
3484
|
+
return true;
|
|
3485
|
+
} catch {
|
|
3486
|
+
return false;
|
|
3487
|
+
}
|
|
3488
|
+
},
|
|
3489
|
+
async bytes() {
|
|
3490
|
+
return readFile2(path);
|
|
3491
|
+
}
|
|
3492
|
+
};
|
|
3493
|
+
}
|
|
3494
|
+
function runtimeSpawn(cmd, opts = {}) {
|
|
3495
|
+
if (isBun) {
|
|
3496
|
+
const proc2 = Bun.spawn(cmd, {
|
|
3497
|
+
cwd: opts.cwd,
|
|
3498
|
+
env: opts.env,
|
|
3499
|
+
stdout: opts.stdout ?? "ignore",
|
|
3500
|
+
stderr: opts.stderr ?? "ignore",
|
|
3501
|
+
stdin: opts.stdin ?? "ignore"
|
|
3502
|
+
});
|
|
3503
|
+
return { pid: proc2.pid, unref: () => proc2.unref() };
|
|
3504
|
+
}
|
|
3505
|
+
const [bin, ...args] = cmd;
|
|
3506
|
+
const proc = nodeSpawn(bin, args, {
|
|
3507
|
+
cwd: opts.cwd,
|
|
3508
|
+
env: opts.env,
|
|
3509
|
+
stdio: [
|
|
3510
|
+
opts.stdin ?? "ignore",
|
|
3511
|
+
opts.stdout ?? "ignore",
|
|
3512
|
+
opts.stderr ?? "ignore"
|
|
3513
|
+
],
|
|
3514
|
+
detached: true
|
|
3515
|
+
});
|
|
3516
|
+
proc.unref();
|
|
3517
|
+
return { pid: proc.pid ?? -1, unref: () => {} };
|
|
3518
|
+
}
|
|
3519
|
+
async function runtimeServe(opts) {
|
|
3520
|
+
if (isBun) {
|
|
3521
|
+
const server = Bun.serve({
|
|
3522
|
+
port: opts.port,
|
|
3523
|
+
hostname: opts.hostname,
|
|
3524
|
+
idleTimeout: opts.idleTimeout ?? 0,
|
|
3525
|
+
fetch: opts.fetch
|
|
3526
|
+
});
|
|
3527
|
+
return {
|
|
3528
|
+
port: server.port,
|
|
3529
|
+
stop: (close) => server.stop(close)
|
|
3530
|
+
};
|
|
3531
|
+
}
|
|
3532
|
+
const { createServer } = await import("node:http");
|
|
3533
|
+
const { Readable } = await import("node:stream");
|
|
3534
|
+
return new Promise((resolve3) => {
|
|
3535
|
+
const httpServer = createServer(async (req, res) => {
|
|
3536
|
+
const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
|
|
3537
|
+
const headers = new Headers;
|
|
3538
|
+
for (const [key, val] of Object.entries(req.headers)) {
|
|
3539
|
+
if (val)
|
|
3540
|
+
headers.set(key, Array.isArray(val) ? val.join(", ") : val);
|
|
3541
|
+
}
|
|
3542
|
+
let body = null;
|
|
3543
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
3544
|
+
const chunks = [];
|
|
3545
|
+
for await (const chunk of req) {
|
|
3546
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
3547
|
+
}
|
|
3548
|
+
body = Buffer.concat(chunks);
|
|
3549
|
+
}
|
|
3550
|
+
const request = new Request(url, {
|
|
3551
|
+
method: req.method,
|
|
3552
|
+
headers,
|
|
3553
|
+
body,
|
|
3554
|
+
duplex: body ? "half" : undefined
|
|
3555
|
+
});
|
|
3556
|
+
try {
|
|
3557
|
+
const response = await opts.fetch(request);
|
|
3558
|
+
res.writeHead(response.status, Object.fromEntries(response.headers));
|
|
3559
|
+
if (!response.body) {
|
|
3560
|
+
res.end();
|
|
3561
|
+
return;
|
|
3562
|
+
}
|
|
3563
|
+
const reader = response.body.getReader();
|
|
3564
|
+
const nodeStream = new Readable({
|
|
3565
|
+
async read() {
|
|
3566
|
+
try {
|
|
3567
|
+
const { done, value } = await reader.read();
|
|
3568
|
+
if (done) {
|
|
3569
|
+
this.push(null);
|
|
3570
|
+
} else {
|
|
3571
|
+
this.push(Buffer.from(value));
|
|
3572
|
+
}
|
|
3573
|
+
} catch {
|
|
3574
|
+
this.push(null);
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
});
|
|
3578
|
+
res.on("close", () => {
|
|
3579
|
+
reader.cancel().catch(() => {});
|
|
3580
|
+
nodeStream.destroy();
|
|
3581
|
+
});
|
|
3582
|
+
nodeStream.pipe(res);
|
|
3583
|
+
} catch (err) {
|
|
3584
|
+
if (!res.headersSent) {
|
|
3585
|
+
res.writeHead(500);
|
|
3586
|
+
res.end(String(err));
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
});
|
|
3590
|
+
httpServer.listen(opts.port, opts.hostname, () => {
|
|
3591
|
+
const addr = httpServer.address();
|
|
3592
|
+
const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
|
|
3593
|
+
resolve3({
|
|
3594
|
+
port: boundPort,
|
|
3595
|
+
stop: (close) => {
|
|
3596
|
+
if (close)
|
|
3597
|
+
httpServer.closeAllConnections();
|
|
3598
|
+
httpServer.close();
|
|
3599
|
+
}
|
|
3600
|
+
});
|
|
3601
|
+
});
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
var isBun;
|
|
3605
|
+
var init_runtime = __esm(() => {
|
|
3606
|
+
isBun = typeof globalThis.Bun !== "undefined";
|
|
3607
|
+
});
|
|
3608
|
+
|
|
3460
3609
|
// src/core/daemon.ts
|
|
3461
3610
|
import { readFileSync as readFileSync12, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, openSync } from "fs";
|
|
3462
3611
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
@@ -3501,11 +3650,11 @@ function startDaemon(cwd) {
|
|
|
3501
3650
|
removePidFile();
|
|
3502
3651
|
}
|
|
3503
3652
|
const __dir = dirname6(new URL(import.meta.url).pathname);
|
|
3504
|
-
const cliPath = resolve3(__dir, "../cli.ts");
|
|
3653
|
+
const cliPath = process.argv[1] ?? resolve3(__dir, "../cli.ts");
|
|
3505
3654
|
const logPath = schedulerLogPath();
|
|
3506
3655
|
mkdirSync9(dirname6(logPath), { recursive: true });
|
|
3507
3656
|
const logFd = openSync(logPath, "a");
|
|
3508
|
-
const proc =
|
|
3657
|
+
const proc = runtimeSpawn(["bun", "run", cliPath, "cron", "__daemon"], {
|
|
3509
3658
|
cwd,
|
|
3510
3659
|
stdout: logFd,
|
|
3511
3660
|
stderr: logFd,
|
|
@@ -3609,6 +3758,7 @@ var init_daemon = __esm(() => {
|
|
|
3609
3758
|
init_vault();
|
|
3610
3759
|
init_channel_templates();
|
|
3611
3760
|
init_channel_process();
|
|
3761
|
+
init_runtime();
|
|
3612
3762
|
});
|
|
3613
3763
|
|
|
3614
3764
|
// src/commands/status.ts
|
|
@@ -5252,6 +5402,414 @@ var init_cron = __esm(() => {
|
|
|
5252
5402
|
init_task_registry();
|
|
5253
5403
|
});
|
|
5254
5404
|
|
|
5405
|
+
// src/core/note-linker.ts
|
|
5406
|
+
import { join as join16 } from "path";
|
|
5407
|
+
import { existsSync as existsSync15, readFileSync as readFileSync18, readdirSync as readdirSync4, statSync as statSync8 } from "fs";
|
|
5408
|
+
function extractWikilinks(content) {
|
|
5409
|
+
const links = [];
|
|
5410
|
+
let match;
|
|
5411
|
+
const re = new RegExp(WIKILINK_RE.source, "g");
|
|
5412
|
+
while ((match = re.exec(content)) !== null) {
|
|
5413
|
+
links.push(match[1].trim());
|
|
5414
|
+
}
|
|
5415
|
+
return [...new Set(links)];
|
|
5416
|
+
}
|
|
5417
|
+
function updateMasterIndex(vaultRootPath) {
|
|
5418
|
+
const now = new Date().toISOString().split("T")[0];
|
|
5419
|
+
const sections = [
|
|
5420
|
+
`---`,
|
|
5421
|
+
`updated: "${new Date().toISOString()}"`,
|
|
5422
|
+
`---`,
|
|
5423
|
+
``,
|
|
5424
|
+
`# Knowledge Base`,
|
|
5425
|
+
``,
|
|
5426
|
+
`> Last updated: ${now}`,
|
|
5427
|
+
``
|
|
5428
|
+
];
|
|
5429
|
+
const categories = [
|
|
5430
|
+
{ name: "Inbox", dir: "inbox", emoji: "" },
|
|
5431
|
+
{ name: "Projects", dir: "projects", emoji: "" },
|
|
5432
|
+
{ name: "Areas", dir: "areas", emoji: "" },
|
|
5433
|
+
{ name: "Resources", dir: "resources", emoji: "" },
|
|
5434
|
+
{ name: "Archives", dir: "archives", emoji: "" },
|
|
5435
|
+
{ name: "Patterns", dir: "patterns", emoji: "" }
|
|
5436
|
+
];
|
|
5437
|
+
for (const cat of categories) {
|
|
5438
|
+
const dirPath = join16(vaultRootPath, cat.dir);
|
|
5439
|
+
if (!existsSync15(dirPath))
|
|
5440
|
+
continue;
|
|
5441
|
+
const files = collectMarkdownFiles(dirPath, vaultRootPath);
|
|
5442
|
+
if (files.length === 0 && cat.dir !== "inbox")
|
|
5443
|
+
continue;
|
|
5444
|
+
sections.push(`## ${cat.name}`);
|
|
5445
|
+
sections.push("");
|
|
5446
|
+
if (files.length === 0) {
|
|
5447
|
+
sections.push("*No notes yet.*");
|
|
5448
|
+
} else {
|
|
5449
|
+
const sorted = files.sort((a, b) => b.mtime - a.mtime).slice(0, 20);
|
|
5450
|
+
for (const file of sorted) {
|
|
5451
|
+
sections.push(`- [[${file.title}]]`);
|
|
5452
|
+
}
|
|
5453
|
+
if (files.length > 20) {
|
|
5454
|
+
sections.push(`- *...and ${files.length - 20} more*`);
|
|
5455
|
+
}
|
|
5456
|
+
}
|
|
5457
|
+
sections.push("");
|
|
5458
|
+
}
|
|
5459
|
+
const indexPath = vaultMasterIndexPath();
|
|
5460
|
+
atomicWriteText(indexPath, sections.join(`
|
|
5461
|
+
`));
|
|
5462
|
+
}
|
|
5463
|
+
function collectMarkdownFiles(dirPath, rootPath) {
|
|
5464
|
+
const files = [];
|
|
5465
|
+
try {
|
|
5466
|
+
const entries = readdirSync4(dirPath, { withFileTypes: true });
|
|
5467
|
+
for (const entry of entries) {
|
|
5468
|
+
const fullPath = join16(dirPath, entry.name);
|
|
5469
|
+
if (entry.isDirectory()) {
|
|
5470
|
+
files.push(...collectMarkdownFiles(fullPath, rootPath));
|
|
5471
|
+
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
5472
|
+
const stat2 = statSync8(fullPath);
|
|
5473
|
+
const title = entry.name.replace(/\.md$/, "");
|
|
5474
|
+
const relativePath = fullPath.slice(rootPath.length + 1);
|
|
5475
|
+
files.push({ title, relativePath, mtime: stat2.mtimeMs });
|
|
5476
|
+
}
|
|
5477
|
+
}
|
|
5478
|
+
} catch {}
|
|
5479
|
+
return files;
|
|
5480
|
+
}
|
|
5481
|
+
var WIKILINK_RE;
|
|
5482
|
+
var init_note_linker = __esm(() => {
|
|
5483
|
+
init_fs_utils();
|
|
5484
|
+
init_vault();
|
|
5485
|
+
WIKILINK_RE = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g;
|
|
5486
|
+
});
|
|
5487
|
+
|
|
5488
|
+
// src/core/vault-templates.ts
|
|
5489
|
+
import { join as join17 } from "path";
|
|
5490
|
+
import { existsSync as existsSync16, writeFileSync as writeFileSync8, readFileSync as readFileSync19, mkdirSync as mkdirSync10 } from "fs";
|
|
5491
|
+
function seedTemplates(templatesDir) {
|
|
5492
|
+
mkdirSync10(templatesDir, { recursive: true });
|
|
5493
|
+
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
5494
|
+
const filePath = join17(templatesDir, `${name}.md`);
|
|
5495
|
+
if (!existsSync16(filePath)) {
|
|
5496
|
+
writeFileSync8(filePath, content);
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
function loadTemplate(templatesDir, templateName, vars) {
|
|
5501
|
+
const filePath = join17(templatesDir, `${templateName}.md`);
|
|
5502
|
+
let content;
|
|
5503
|
+
if (existsSync16(filePath)) {
|
|
5504
|
+
content = readFileSync19(filePath, "utf-8");
|
|
5505
|
+
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
5506
|
+
content = DEFAULT_TEMPLATES[templateName];
|
|
5507
|
+
} else {
|
|
5508
|
+
return null;
|
|
5509
|
+
}
|
|
5510
|
+
return fillTemplate(content, vars);
|
|
5511
|
+
}
|
|
5512
|
+
function fillTemplate(template, vars) {
|
|
5513
|
+
let result = template;
|
|
5514
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
5515
|
+
result = result.replaceAll(`{{${key}}}`, value);
|
|
5516
|
+
}
|
|
5517
|
+
return result;
|
|
5518
|
+
}
|
|
5519
|
+
var DEFAULT_TEMPLATES;
|
|
5520
|
+
var init_vault_templates = __esm(() => {
|
|
5521
|
+
DEFAULT_TEMPLATES = {
|
|
5522
|
+
"quick-capture": `---
|
|
5523
|
+
created: "{{created}}"
|
|
5524
|
+
updated: "{{updated}}"
|
|
5525
|
+
tags: []
|
|
5526
|
+
category: inbox
|
|
5527
|
+
---
|
|
5528
|
+
|
|
5529
|
+
# {{title}}
|
|
5530
|
+
|
|
5531
|
+
{{body}}
|
|
5532
|
+
`,
|
|
5533
|
+
"daily-note": `---
|
|
5534
|
+
created: "{{created}}"
|
|
5535
|
+
updated: "{{updated}}"
|
|
5536
|
+
tags: [daily]
|
|
5537
|
+
category: areas
|
|
5538
|
+
---
|
|
5539
|
+
|
|
5540
|
+
# {{date}}
|
|
5541
|
+
|
|
5542
|
+
## Focus
|
|
5543
|
+
|
|
5544
|
+
-
|
|
5545
|
+
|
|
5546
|
+
## Notes
|
|
5547
|
+
|
|
5548
|
+
-
|
|
5549
|
+
|
|
5550
|
+
## Tasks
|
|
5551
|
+
|
|
5552
|
+
- [ ]
|
|
5553
|
+
|
|
5554
|
+
## Reflections
|
|
5555
|
+
|
|
5556
|
+
`,
|
|
5557
|
+
meeting: `---
|
|
5558
|
+
created: "{{created}}"
|
|
5559
|
+
updated: "{{updated}}"
|
|
5560
|
+
tags: [meeting]
|
|
5561
|
+
category: areas
|
|
5562
|
+
---
|
|
5563
|
+
|
|
5564
|
+
# {{title}}
|
|
5565
|
+
|
|
5566
|
+
**Date**: {{date}}
|
|
5567
|
+
**Attendees**:
|
|
5568
|
+
|
|
5569
|
+
## Agenda
|
|
5570
|
+
|
|
5571
|
+
-
|
|
5572
|
+
|
|
5573
|
+
## Discussion
|
|
5574
|
+
|
|
5575
|
+
-
|
|
5576
|
+
|
|
5577
|
+
## Decisions
|
|
5578
|
+
|
|
5579
|
+
-
|
|
5580
|
+
|
|
5581
|
+
## Action Items
|
|
5582
|
+
|
|
5583
|
+
- [ ]
|
|
5584
|
+
`,
|
|
5585
|
+
project: `---
|
|
5586
|
+
created: "{{created}}"
|
|
5587
|
+
updated: "{{updated}}"
|
|
5588
|
+
tags: [project]
|
|
5589
|
+
category: projects
|
|
5590
|
+
status: active
|
|
5591
|
+
---
|
|
5592
|
+
|
|
5593
|
+
# {{title}}
|
|
5594
|
+
|
|
5595
|
+
## Overview
|
|
5596
|
+
|
|
5597
|
+
{{body}}
|
|
5598
|
+
|
|
5599
|
+
## Goals
|
|
5600
|
+
|
|
5601
|
+
-
|
|
5602
|
+
|
|
5603
|
+
## Key Decisions
|
|
5604
|
+
|
|
5605
|
+
-
|
|
5606
|
+
|
|
5607
|
+
## Links
|
|
5608
|
+
|
|
5609
|
+
-
|
|
5610
|
+
`,
|
|
5611
|
+
area: `---
|
|
5612
|
+
created: "{{created}}"
|
|
5613
|
+
updated: "{{updated}}"
|
|
5614
|
+
tags: [area]
|
|
5615
|
+
category: areas
|
|
5616
|
+
---
|
|
5617
|
+
|
|
5618
|
+
# {{title}}
|
|
5619
|
+
|
|
5620
|
+
## Purpose
|
|
5621
|
+
|
|
5622
|
+
{{body}}
|
|
5623
|
+
|
|
5624
|
+
## Standards
|
|
5625
|
+
|
|
5626
|
+
-
|
|
5627
|
+
|
|
5628
|
+
## Key Resources
|
|
5629
|
+
|
|
5630
|
+
-
|
|
5631
|
+
`,
|
|
5632
|
+
person: `---
|
|
5633
|
+
created: "{{created}}"
|
|
5634
|
+
updated: "{{updated}}"
|
|
5635
|
+
tags: [person]
|
|
5636
|
+
category: resources
|
|
5637
|
+
---
|
|
5638
|
+
|
|
5639
|
+
# {{title}}
|
|
5640
|
+
|
|
5641
|
+
## Role
|
|
5642
|
+
|
|
5643
|
+
## Context
|
|
5644
|
+
|
|
5645
|
+
## 1:1 Notes
|
|
5646
|
+
|
|
5647
|
+
-
|
|
5648
|
+
|
|
5649
|
+
## Key Projects
|
|
5650
|
+
|
|
5651
|
+
-
|
|
5652
|
+
`
|
|
5653
|
+
};
|
|
5654
|
+
});
|
|
5655
|
+
|
|
5656
|
+
// src/core/note-writer.ts
|
|
5657
|
+
import { join as join18 } from "path";
|
|
5658
|
+
import { existsSync as existsSync17, readFileSync as readFileSync20 } from "fs";
|
|
5659
|
+
function slugifyTitle(title) {
|
|
5660
|
+
return title.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
5661
|
+
}
|
|
5662
|
+
function generateFrontmatter(meta) {
|
|
5663
|
+
const lines = ["---"];
|
|
5664
|
+
lines.push(`created: "${meta.created}"`);
|
|
5665
|
+
lines.push(`updated: "${meta.updated}"`);
|
|
5666
|
+
if (meta.tags.length > 0) {
|
|
5667
|
+
lines.push(`tags: [${meta.tags.join(", ")}]`);
|
|
5668
|
+
} else {
|
|
5669
|
+
lines.push("tags: []");
|
|
5670
|
+
}
|
|
5671
|
+
lines.push(`category: ${meta.category}`);
|
|
5672
|
+
if (meta.sourceProject) {
|
|
5673
|
+
lines.push(`source_project: ${meta.sourceProject}`);
|
|
5674
|
+
}
|
|
5675
|
+
if (meta.aliases && meta.aliases.length > 0) {
|
|
5676
|
+
lines.push(`aliases: [${meta.aliases.join(", ")}]`);
|
|
5677
|
+
}
|
|
5678
|
+
if (meta.extra) {
|
|
5679
|
+
for (const [key, value] of Object.entries(meta.extra)) {
|
|
5680
|
+
lines.push(`${key}: ${JSON.stringify(value)}`);
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
lines.push("---");
|
|
5684
|
+
return lines.join(`
|
|
5685
|
+
`);
|
|
5686
|
+
}
|
|
5687
|
+
function createNote(meta) {
|
|
5688
|
+
const now = meta.created || new Date().toISOString();
|
|
5689
|
+
const slug = slugifyTitle(meta.title);
|
|
5690
|
+
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
5691
|
+
const filePath = join18(dir, `${slug}.md`);
|
|
5692
|
+
let content;
|
|
5693
|
+
if (meta.template) {
|
|
5694
|
+
const rendered = loadTemplate(vaultTemplates(), meta.template, {
|
|
5695
|
+
title: meta.title,
|
|
5696
|
+
body: meta.body,
|
|
5697
|
+
created: now,
|
|
5698
|
+
updated: now,
|
|
5699
|
+
date: now.split("T")[0]
|
|
5700
|
+
});
|
|
5701
|
+
content = rendered ?? buildNoteContent(meta, now);
|
|
5702
|
+
} else {
|
|
5703
|
+
content = buildNoteContent(meta, now);
|
|
5704
|
+
}
|
|
5705
|
+
atomicWriteText(filePath, content);
|
|
5706
|
+
return { filePath, content };
|
|
5707
|
+
}
|
|
5708
|
+
function buildNoteContent(meta, now) {
|
|
5709
|
+
const frontmatter = generateFrontmatter({
|
|
5710
|
+
created: now,
|
|
5711
|
+
updated: now,
|
|
5712
|
+
tags: meta.tags,
|
|
5713
|
+
category: meta.category,
|
|
5714
|
+
sourceProject: meta.sourceProject
|
|
5715
|
+
});
|
|
5716
|
+
return `${frontmatter}
|
|
5717
|
+
|
|
5718
|
+
# ${meta.title}
|
|
5719
|
+
|
|
5720
|
+
${meta.body}
|
|
5721
|
+
`;
|
|
5722
|
+
}
|
|
5723
|
+
function appendToDaily(date, content) {
|
|
5724
|
+
const dir = vaultDailyDir();
|
|
5725
|
+
const filePath = join18(dir, `${date}.md`);
|
|
5726
|
+
if (existsSync17(filePath)) {
|
|
5727
|
+
const existing = readFileSync20(filePath, "utf-8");
|
|
5728
|
+
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
5729
|
+
hour: "2-digit",
|
|
5730
|
+
minute: "2-digit",
|
|
5731
|
+
hour12: false
|
|
5732
|
+
});
|
|
5733
|
+
const updated = `${existing.trimEnd()}
|
|
5734
|
+
|
|
5735
|
+
## ${timestamp}
|
|
5736
|
+
|
|
5737
|
+
${content}
|
|
5738
|
+
`;
|
|
5739
|
+
atomicWriteText(filePath, updated);
|
|
5740
|
+
} else {
|
|
5741
|
+
const now = new Date().toISOString();
|
|
5742
|
+
const rendered = loadTemplate(vaultTemplates(), "daily-note", {
|
|
5743
|
+
title: date,
|
|
5744
|
+
date,
|
|
5745
|
+
body: content,
|
|
5746
|
+
created: now,
|
|
5747
|
+
updated: now
|
|
5748
|
+
});
|
|
5749
|
+
const noteContent = rendered ?? `---
|
|
5750
|
+
created: "${now}"
|
|
5751
|
+
updated: "${now}"
|
|
5752
|
+
tags: [daily]
|
|
5753
|
+
category: areas
|
|
5754
|
+
---
|
|
5755
|
+
|
|
5756
|
+
# ${date}
|
|
5757
|
+
|
|
5758
|
+
${content}
|
|
5759
|
+
`;
|
|
5760
|
+
atomicWriteText(filePath, noteContent);
|
|
5761
|
+
}
|
|
5762
|
+
return filePath;
|
|
5763
|
+
}
|
|
5764
|
+
function ingestFile(sourcePath, meta) {
|
|
5765
|
+
const raw = readFileSync20(sourcePath, "utf-8");
|
|
5766
|
+
const now = new Date().toISOString();
|
|
5767
|
+
const headingMatch = raw.match(/^#\s+(.+)$/m);
|
|
5768
|
+
const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
|
|
5769
|
+
const hasFrontmatter = raw.startsWith("---");
|
|
5770
|
+
let content;
|
|
5771
|
+
if (hasFrontmatter) {
|
|
5772
|
+
const endIdx = raw.indexOf("---", 3);
|
|
5773
|
+
if (endIdx !== -1) {
|
|
5774
|
+
const existingFm = raw.slice(0, endIdx + 3);
|
|
5775
|
+
const body = raw.slice(endIdx + 3).trim();
|
|
5776
|
+
if (!existingFm.includes("category:")) {
|
|
5777
|
+
const updatedFm = existingFm.replace(/---$/, `category: ${meta.category}
|
|
5778
|
+
---`);
|
|
5779
|
+
content = `${updatedFm}
|
|
5780
|
+
|
|
5781
|
+
${body}
|
|
5782
|
+
`;
|
|
5783
|
+
} else {
|
|
5784
|
+
content = raw;
|
|
5785
|
+
}
|
|
5786
|
+
} else {
|
|
5787
|
+
content = raw;
|
|
5788
|
+
}
|
|
5789
|
+
} else {
|
|
5790
|
+
const frontmatter = generateFrontmatter({
|
|
5791
|
+
created: now,
|
|
5792
|
+
updated: now,
|
|
5793
|
+
tags: meta.tags ?? [],
|
|
5794
|
+
category: meta.category,
|
|
5795
|
+
sourceProject: meta.sourceProject
|
|
5796
|
+
});
|
|
5797
|
+
content = `${frontmatter}
|
|
5798
|
+
|
|
5799
|
+
${raw}`;
|
|
5800
|
+
}
|
|
5801
|
+
const slug = slugifyTitle(title);
|
|
5802
|
+
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
5803
|
+
const filePath = join18(dir, `${slug}.md`);
|
|
5804
|
+
atomicWriteText(filePath, content);
|
|
5805
|
+
return { filePath, content };
|
|
5806
|
+
}
|
|
5807
|
+
var init_note_writer = __esm(() => {
|
|
5808
|
+
init_fs_utils();
|
|
5809
|
+
init_vault();
|
|
5810
|
+
init_vault_templates();
|
|
5811
|
+
});
|
|
5812
|
+
|
|
5255
5813
|
// src/types/design-eval.ts
|
|
5256
5814
|
function isDesignEvalReport(v) {
|
|
5257
5815
|
return typeof v === "object" && v !== null && "capturedAt" in v && "captures" in v && Array.isArray(v.captures);
|
|
@@ -5274,9 +5832,22 @@ var init_design_eval = __esm(() => {
|
|
|
5274
5832
|
});
|
|
5275
5833
|
|
|
5276
5834
|
// src/core/dashboard-api.ts
|
|
5277
|
-
import { existsSync as
|
|
5835
|
+
import { existsSync as existsSync18, readFileSync as readFileSync21 } from "fs";
|
|
5836
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSyncFS, existsSync as fsExistsSync } from "fs";
|
|
5837
|
+
import { join as join19, resolve as resolve4, normalize, sep } from "path";
|
|
5838
|
+
import { execSync as execSync3 } from "child_process";
|
|
5839
|
+
function isSecretKey(key) {
|
|
5840
|
+
return SECRET_KEY_PATTERNS.some((re) => re.test(key));
|
|
5841
|
+
}
|
|
5842
|
+
function maskSecret(value, showLast = 4) {
|
|
5843
|
+
if (!value)
|
|
5844
|
+
return "";
|
|
5845
|
+
if (value.length <= showLast)
|
|
5846
|
+
return "••••";
|
|
5847
|
+
return "••••" + value.slice(-showLast);
|
|
5848
|
+
}
|
|
5278
5849
|
function checkJsonFile2(name, filePath, validator) {
|
|
5279
|
-
if (!
|
|
5850
|
+
if (!existsSync18(filePath))
|
|
5280
5851
|
return { name, status: "missing" };
|
|
5281
5852
|
const data = safeReadJson(filePath);
|
|
5282
5853
|
if (data === null)
|
|
@@ -5286,10 +5857,10 @@ function checkJsonFile2(name, filePath, validator) {
|
|
|
5286
5857
|
return { name, status: "ok" };
|
|
5287
5858
|
}
|
|
5288
5859
|
function checkTextFile2(name, filePath) {
|
|
5289
|
-
if (!
|
|
5860
|
+
if (!existsSync18(filePath))
|
|
5290
5861
|
return { name, status: "missing" };
|
|
5291
5862
|
try {
|
|
5292
|
-
|
|
5863
|
+
readFileSync21(filePath, "utf-8");
|
|
5293
5864
|
return { name, status: "ok" };
|
|
5294
5865
|
} catch {
|
|
5295
5866
|
return { name, status: "corrupt" };
|
|
@@ -5372,7 +5943,7 @@ function loadSchedulerPanel(cwd) {
|
|
|
5372
5943
|
}
|
|
5373
5944
|
function loadLearningMemoryPanel(cwd) {
|
|
5374
5945
|
const memPath = learningMemoryPath(cwd);
|
|
5375
|
-
if (!
|
|
5946
|
+
if (!existsSync18(memPath)) {
|
|
5376
5947
|
return {
|
|
5377
5948
|
projectName: "unknown",
|
|
5378
5949
|
sections: {
|
|
@@ -5384,7 +5955,7 @@ function loadLearningMemoryPanel(cwd) {
|
|
|
5384
5955
|
};
|
|
5385
5956
|
}
|
|
5386
5957
|
try {
|
|
5387
|
-
const content =
|
|
5958
|
+
const content = readFileSync21(memPath, "utf-8");
|
|
5388
5959
|
return parseLearningMemory(content);
|
|
5389
5960
|
} catch {
|
|
5390
5961
|
return {
|
|
@@ -5423,6 +5994,310 @@ function loadDesignPanel(cwd) {
|
|
|
5423
5994
|
}))
|
|
5424
5995
|
};
|
|
5425
5996
|
}
|
|
5997
|
+
function groupFromKey(key) {
|
|
5998
|
+
const prefix = key.split(".")[0] ?? "other";
|
|
5999
|
+
return GROUP_LABELS[prefix] ?? prefix.charAt(0).toUpperCase() + prefix.slice(1);
|
|
6000
|
+
}
|
|
6001
|
+
function inferType(defaultValue, currentValue) {
|
|
6002
|
+
const candidate = currentValue || defaultValue;
|
|
6003
|
+
if (BOOLEAN_VALUES.has(candidate))
|
|
6004
|
+
return "boolean";
|
|
6005
|
+
if (candidate !== "" && !Number.isNaN(Number(candidate)) && /^-?\d+(\.\d+)?$/.test(candidate)) {
|
|
6006
|
+
return "number";
|
|
6007
|
+
}
|
|
6008
|
+
return "string";
|
|
6009
|
+
}
|
|
6010
|
+
function mapSource(source, scope) {
|
|
6011
|
+
if (source === "environment variable")
|
|
6012
|
+
return "env";
|
|
6013
|
+
if (source === "default")
|
|
6014
|
+
return "default";
|
|
6015
|
+
return scope;
|
|
6016
|
+
}
|
|
6017
|
+
function loadConfigPanel() {
|
|
6018
|
+
const resolved = resolveAllConfig();
|
|
6019
|
+
const entries = resolved.map((r) => {
|
|
6020
|
+
const meta = CONFIG_KEYS.find((k) => k.key === r.key);
|
|
6021
|
+
const isSecret = isSecretKey(r.key);
|
|
6022
|
+
return {
|
|
6023
|
+
key: r.key,
|
|
6024
|
+
value: isSecret ? maskSecret(r.value) : r.value,
|
|
6025
|
+
source: mapSource(r.source, r.scope),
|
|
6026
|
+
type: inferType(meta.default, r.value),
|
|
6027
|
+
group: groupFromKey(r.key),
|
|
6028
|
+
scope: r.scope,
|
|
6029
|
+
description: meta.description,
|
|
6030
|
+
isSecret
|
|
6031
|
+
};
|
|
6032
|
+
});
|
|
6033
|
+
return { entries };
|
|
6034
|
+
}
|
|
6035
|
+
function parsePorcelain(output) {
|
|
6036
|
+
const changes = [];
|
|
6037
|
+
for (const rawLine of output.split(`
|
|
6038
|
+
`)) {
|
|
6039
|
+
if (!rawLine.trim())
|
|
6040
|
+
continue;
|
|
6041
|
+
const xy = rawLine.slice(0, 2);
|
|
6042
|
+
const file = rawLine.slice(3);
|
|
6043
|
+
let op;
|
|
6044
|
+
if (xy === "??")
|
|
6045
|
+
op = "?";
|
|
6046
|
+
else if (xy.includes("D"))
|
|
6047
|
+
op = "D";
|
|
6048
|
+
else if (xy.includes("A") || xy.includes("?"))
|
|
6049
|
+
op = "A";
|
|
6050
|
+
else
|
|
6051
|
+
op = "M";
|
|
6052
|
+
changes.push({ op, file });
|
|
6053
|
+
}
|
|
6054
|
+
return changes;
|
|
6055
|
+
}
|
|
6056
|
+
function getAheadBehind(branch) {
|
|
6057
|
+
if (!branch)
|
|
6058
|
+
return { ahead: 0, behind: 0 };
|
|
6059
|
+
try {
|
|
6060
|
+
const raw = execSync3(`git rev-list --left-right --count origin/${branch}...${branch}`, { cwd: minkRoot(), timeout: 5000, stdio: ["pipe", "pipe", "pipe"] }).toString().trim();
|
|
6061
|
+
const [behindStr, aheadStr] = raw.split(/\s+/);
|
|
6062
|
+
return {
|
|
6063
|
+
behind: Number(behindStr) || 0,
|
|
6064
|
+
ahead: Number(aheadStr) || 0
|
|
6065
|
+
};
|
|
6066
|
+
} catch {
|
|
6067
|
+
return { ahead: 0, behind: 0 };
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6070
|
+
function getPendingChanges() {
|
|
6071
|
+
try {
|
|
6072
|
+
const raw = execSync3("git status --porcelain", {
|
|
6073
|
+
cwd: minkRoot(),
|
|
6074
|
+
timeout: 5000,
|
|
6075
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
6076
|
+
}).toString();
|
|
6077
|
+
return parsePorcelain(raw);
|
|
6078
|
+
} catch {
|
|
6079
|
+
return [];
|
|
6080
|
+
}
|
|
6081
|
+
}
|
|
6082
|
+
function loadSyncPanel() {
|
|
6083
|
+
const status2 = getSyncStatus();
|
|
6084
|
+
const initialized = isSyncInitialized();
|
|
6085
|
+
const pending = status2.gitInitialized ? getPendingChanges() : [];
|
|
6086
|
+
const { ahead, behind } = status2.gitInitialized ? getAheadBehind(status2.branch) : { ahead: 0, behind: 0 };
|
|
6087
|
+
return {
|
|
6088
|
+
initialized,
|
|
6089
|
+
enabled: status2.enabled,
|
|
6090
|
+
branch: status2.branch,
|
|
6091
|
+
remote: status2.remoteUrl,
|
|
6092
|
+
ahead,
|
|
6093
|
+
behind,
|
|
6094
|
+
lastPush: status2.lastPush,
|
|
6095
|
+
lastPull: status2.lastPull,
|
|
6096
|
+
pending
|
|
6097
|
+
};
|
|
6098
|
+
}
|
|
6099
|
+
function parseChannelLogs(raw) {
|
|
6100
|
+
if (!raw)
|
|
6101
|
+
return [];
|
|
6102
|
+
const lines = raw.split(`
|
|
6103
|
+
`).map((l) => l.replace(/\u001b\[[0-9;]*m/g, "").trim()).filter(Boolean);
|
|
6104
|
+
const parsed = lines.map((line) => {
|
|
6105
|
+
const match = line.match(TIMESTAMP_PREFIX);
|
|
6106
|
+
if (match) {
|
|
6107
|
+
return { t: match[1], m: line.slice(match[0].length) };
|
|
6108
|
+
}
|
|
6109
|
+
return { t: "", m: line };
|
|
6110
|
+
});
|
|
6111
|
+
return parsed.slice(-CHANNEL_LOG_LIMIT);
|
|
6112
|
+
}
|
|
6113
|
+
function parseAllowlist(raw) {
|
|
6114
|
+
if (!raw)
|
|
6115
|
+
return [];
|
|
6116
|
+
return raw.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
6117
|
+
}
|
|
6118
|
+
function loadChannelPanel() {
|
|
6119
|
+
const running = isChannelRunning();
|
|
6120
|
+
const status2 = running ? getChannelStatus() : null;
|
|
6121
|
+
const rawLogs = running ? getChannelLogs() : null;
|
|
6122
|
+
const logs = parseChannelLogs(rawLogs);
|
|
6123
|
+
const token = resolveConfigValue("channel.discord.bot-token").value;
|
|
6124
|
+
const allowlistRaw = resolveConfigValue("channel.discord.allowlist").value;
|
|
6125
|
+
const autoStart = resolveConfigValue("channel.discord.enabled").value === "true";
|
|
6126
|
+
return {
|
|
6127
|
+
status: running ? "running" : "stopped",
|
|
6128
|
+
platform: status2?.platform ?? null,
|
|
6129
|
+
session: status2?.session ?? "",
|
|
6130
|
+
startedAt: status2?.startedAt ?? "",
|
|
6131
|
+
uptimeSec: status2?.uptime ?? 0,
|
|
6132
|
+
autoStart,
|
|
6133
|
+
tokenMasked: maskSecret(token),
|
|
6134
|
+
allowlist: parseAllowlist(allowlistRaw),
|
|
6135
|
+
logs
|
|
6136
|
+
};
|
|
6137
|
+
}
|
|
6138
|
+
function countMarkdownIn(dir) {
|
|
6139
|
+
let count = 0;
|
|
6140
|
+
try {
|
|
6141
|
+
for (const entry of readdirSync5(dir, { withFileTypes: true })) {
|
|
6142
|
+
if (WIKI_TREE_EXCLUDES.has(entry.name) || entry.name.startsWith("."))
|
|
6143
|
+
continue;
|
|
6144
|
+
const fullPath = join19(dir, entry.name);
|
|
6145
|
+
if (entry.isDirectory()) {
|
|
6146
|
+
count += countMarkdownIn(fullPath);
|
|
6147
|
+
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
6148
|
+
count += 1;
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6151
|
+
} catch {}
|
|
6152
|
+
return count;
|
|
6153
|
+
}
|
|
6154
|
+
function buildVaultTree(root) {
|
|
6155
|
+
const nodes = [];
|
|
6156
|
+
function walk(dir, depth) {
|
|
6157
|
+
if (depth > WIKI_TREE_MAX_DEPTH)
|
|
6158
|
+
return;
|
|
6159
|
+
let entries = [];
|
|
6160
|
+
try {
|
|
6161
|
+
entries = readdirSync5(dir, { withFileTypes: true }).filter((e) => !WIKI_TREE_EXCLUDES.has(e.name) && !e.name.startsWith(".")).map((e) => ({ name: e.name, isDir: e.isDirectory() }));
|
|
6162
|
+
} catch {
|
|
6163
|
+
return;
|
|
6164
|
+
}
|
|
6165
|
+
entries.sort((a, b) => {
|
|
6166
|
+
if (a.isDir !== b.isDir)
|
|
6167
|
+
return a.isDir ? -1 : 1;
|
|
6168
|
+
return a.name.localeCompare(b.name);
|
|
6169
|
+
});
|
|
6170
|
+
for (const entry of entries) {
|
|
6171
|
+
if (!entry.isDir)
|
|
6172
|
+
continue;
|
|
6173
|
+
const fullPath = join19(dir, entry.name);
|
|
6174
|
+
const relPath = fullPath.slice(root.length + 1);
|
|
6175
|
+
const count = countMarkdownIn(fullPath);
|
|
6176
|
+
nodes.push({ name: entry.name, path: relPath, count, depth });
|
|
6177
|
+
walk(fullPath, depth + 1);
|
|
6178
|
+
}
|
|
6179
|
+
}
|
|
6180
|
+
walk(root, 0);
|
|
6181
|
+
return nodes;
|
|
6182
|
+
}
|
|
6183
|
+
function tallyTags(entries) {
|
|
6184
|
+
const counts = new Map;
|
|
6185
|
+
for (const entry of entries) {
|
|
6186
|
+
for (const tag of entry.tags) {
|
|
6187
|
+
counts.set(tag, (counts.get(tag) ?? 0) + 1);
|
|
6188
|
+
}
|
|
6189
|
+
}
|
|
6190
|
+
return Array.from(counts.entries()).sort((a, b) => b[1] - a[1]);
|
|
6191
|
+
}
|
|
6192
|
+
function loadWikiPanel(opts = {}) {
|
|
6193
|
+
const initialized = isVaultInitialized();
|
|
6194
|
+
const vaultPath = resolveVaultPath();
|
|
6195
|
+
if (!initialized) {
|
|
6196
|
+
return {
|
|
6197
|
+
initialized: false,
|
|
6198
|
+
vaultPath,
|
|
6199
|
+
totalNotes: 0,
|
|
6200
|
+
inboxCount: 0,
|
|
6201
|
+
recent: [],
|
|
6202
|
+
tags: [],
|
|
6203
|
+
tree: []
|
|
6204
|
+
};
|
|
6205
|
+
}
|
|
6206
|
+
const index = loadVaultIndex();
|
|
6207
|
+
const allEntries = Object.values(index.entries);
|
|
6208
|
+
const limit = Math.max(1, Math.min(opts.limit ?? DEFAULT_RECENT_LIMIT, 200));
|
|
6209
|
+
let recent = getRecentNotes(limit);
|
|
6210
|
+
if (opts.category && opts.category !== "all") {
|
|
6211
|
+
recent = recent.filter((e) => e.category === opts.category);
|
|
6212
|
+
}
|
|
6213
|
+
const inboxCount = allEntries.filter((e) => e.category === "inbox").length;
|
|
6214
|
+
const tags = tallyTags(allEntries);
|
|
6215
|
+
const tree = buildVaultTree(vaultPath);
|
|
6216
|
+
return {
|
|
6217
|
+
initialized: true,
|
|
6218
|
+
vaultPath,
|
|
6219
|
+
totalNotes: index.totalNotes || allEntries.length,
|
|
6220
|
+
inboxCount,
|
|
6221
|
+
recent,
|
|
6222
|
+
tags,
|
|
6223
|
+
tree
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
function parseFrontmatter(content) {
|
|
6227
|
+
if (!content.startsWith("---"))
|
|
6228
|
+
return { frontmatter: {}, body: content };
|
|
6229
|
+
const end = content.indexOf(`
|
|
6230
|
+
---`, 3);
|
|
6231
|
+
if (end === -1)
|
|
6232
|
+
return { frontmatter: {}, body: content };
|
|
6233
|
+
const raw = content.slice(3, end).trim();
|
|
6234
|
+
const body = content.slice(end + 4).replace(/^\n/, "");
|
|
6235
|
+
const frontmatter = {};
|
|
6236
|
+
for (const rawLine of raw.split(`
|
|
6237
|
+
`)) {
|
|
6238
|
+
const line = rawLine.trim();
|
|
6239
|
+
if (!line || line.startsWith("#"))
|
|
6240
|
+
continue;
|
|
6241
|
+
const colonIdx = line.indexOf(":");
|
|
6242
|
+
if (colonIdx === -1)
|
|
6243
|
+
continue;
|
|
6244
|
+
const key = line.slice(0, colonIdx).trim();
|
|
6245
|
+
const valRaw = line.slice(colonIdx + 1).trim();
|
|
6246
|
+
if (valRaw.startsWith("[") && valRaw.endsWith("]")) {
|
|
6247
|
+
frontmatter[key] = valRaw.slice(1, -1).split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")).filter(Boolean);
|
|
6248
|
+
} else {
|
|
6249
|
+
frontmatter[key] = valRaw.replace(/^["']|["']$/g, "");
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
return { frontmatter, body };
|
|
6253
|
+
}
|
|
6254
|
+
function resolveVaultRelativePath(relPath) {
|
|
6255
|
+
if (!relPath || relPath.includes("\x00"))
|
|
6256
|
+
return null;
|
|
6257
|
+
const root = resolveVaultPath();
|
|
6258
|
+
const absolute = resolve4(root, relPath);
|
|
6259
|
+
const normalizedRoot = normalize(root) + sep;
|
|
6260
|
+
if (!absolute.startsWith(normalizedRoot) && absolute !== normalize(root)) {
|
|
6261
|
+
return null;
|
|
6262
|
+
}
|
|
6263
|
+
return absolute;
|
|
6264
|
+
}
|
|
6265
|
+
function loadWikiNote(relPath) {
|
|
6266
|
+
const absolute = resolveVaultRelativePath(relPath);
|
|
6267
|
+
if (!absolute)
|
|
6268
|
+
return null;
|
|
6269
|
+
let content;
|
|
6270
|
+
try {
|
|
6271
|
+
content = readFileSyncFS(absolute, "utf-8");
|
|
6272
|
+
} catch {
|
|
6273
|
+
return null;
|
|
6274
|
+
}
|
|
6275
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
6276
|
+
const index = loadVaultIndex();
|
|
6277
|
+
const thisEntry = index.entries[relPath];
|
|
6278
|
+
const targetTitle = thisEntry?.title ?? relPath.replace(/\.md$/, "");
|
|
6279
|
+
const targetBasename = relPath.replace(/\.md$/, "").split("/").pop() ?? "";
|
|
6280
|
+
const backlinks = [];
|
|
6281
|
+
for (const entry of Object.values(index.entries)) {
|
|
6282
|
+
if (entry.filePath === relPath)
|
|
6283
|
+
continue;
|
|
6284
|
+
const absSource = resolveVaultRelativePath(entry.filePath);
|
|
6285
|
+
if (!absSource)
|
|
6286
|
+
continue;
|
|
6287
|
+
let sourceContent;
|
|
6288
|
+
try {
|
|
6289
|
+
sourceContent = readFileSyncFS(absSource, "utf-8");
|
|
6290
|
+
} catch {
|
|
6291
|
+
continue;
|
|
6292
|
+
}
|
|
6293
|
+
const links = extractWikilinks(sourceContent);
|
|
6294
|
+
const matches2 = links.some((l) => l === targetTitle || l === targetBasename || l === relPath);
|
|
6295
|
+
if (matches2) {
|
|
6296
|
+
backlinks.push({ path: entry.filePath, title: entry.title });
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6299
|
+
return { path: relPath, frontmatter, body, backlinks };
|
|
6300
|
+
}
|
|
5426
6301
|
async function triggerTask(cwd, taskId) {
|
|
5427
6302
|
try {
|
|
5428
6303
|
await executeTask(taskId, cwd);
|
|
@@ -5472,6 +6347,292 @@ async function triggerRescan(cwd) {
|
|
|
5472
6347
|
};
|
|
5473
6348
|
}
|
|
5474
6349
|
}
|
|
6350
|
+
async function triggerDaemonStart(cwd) {
|
|
6351
|
+
try {
|
|
6352
|
+
startDaemon(cwd);
|
|
6353
|
+
return { success: true };
|
|
6354
|
+
} catch (err) {
|
|
6355
|
+
return {
|
|
6356
|
+
success: false,
|
|
6357
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6358
|
+
};
|
|
6359
|
+
}
|
|
6360
|
+
}
|
|
6361
|
+
async function triggerDaemonStop() {
|
|
6362
|
+
try {
|
|
6363
|
+
await stopDaemon();
|
|
6364
|
+
return { success: true };
|
|
6365
|
+
} catch (err) {
|
|
6366
|
+
return {
|
|
6367
|
+
success: false,
|
|
6368
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6369
|
+
};
|
|
6370
|
+
}
|
|
6371
|
+
}
|
|
6372
|
+
async function triggerDaemonRestart(cwd) {
|
|
6373
|
+
try {
|
|
6374
|
+
await stopDaemon();
|
|
6375
|
+
startDaemon(cwd);
|
|
6376
|
+
return { success: true };
|
|
6377
|
+
} catch (err) {
|
|
6378
|
+
return {
|
|
6379
|
+
success: false,
|
|
6380
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6381
|
+
};
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
6384
|
+
async function triggerConfigSet(key, value) {
|
|
6385
|
+
try {
|
|
6386
|
+
if (!isValidConfigKey(key)) {
|
|
6387
|
+
return { success: false, error: `Unknown config key: ${key}` };
|
|
6388
|
+
}
|
|
6389
|
+
if (typeof value !== "string") {
|
|
6390
|
+
return { success: false, error: "Config value must be a string" };
|
|
6391
|
+
}
|
|
6392
|
+
setConfigValue(key, value);
|
|
6393
|
+
return { success: true };
|
|
6394
|
+
} catch (err) {
|
|
6395
|
+
return {
|
|
6396
|
+
success: false,
|
|
6397
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6398
|
+
};
|
|
6399
|
+
}
|
|
6400
|
+
}
|
|
6401
|
+
async function triggerSyncPull() {
|
|
6402
|
+
try {
|
|
6403
|
+
if (!isSyncInitialized()) {
|
|
6404
|
+
return { success: false, error: "Sync is not initialized" };
|
|
6405
|
+
}
|
|
6406
|
+
const errors = [];
|
|
6407
|
+
syncPull((msg) => errors.push(msg));
|
|
6408
|
+
if (errors.length > 0) {
|
|
6409
|
+
return { success: false, error: errors.join(`
|
|
6410
|
+
`) };
|
|
6411
|
+
}
|
|
6412
|
+
return { success: true };
|
|
6413
|
+
} catch (err) {
|
|
6414
|
+
return {
|
|
6415
|
+
success: false,
|
|
6416
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6417
|
+
};
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
async function triggerSyncPush() {
|
|
6421
|
+
try {
|
|
6422
|
+
if (!isSyncInitialized()) {
|
|
6423
|
+
return { success: false, error: "Sync is not initialized" };
|
|
6424
|
+
}
|
|
6425
|
+
const errors = [];
|
|
6426
|
+
syncPush((msg) => errors.push(msg));
|
|
6427
|
+
if (errors.length > 0) {
|
|
6428
|
+
return { success: false, error: errors.join(`
|
|
6429
|
+
`) };
|
|
6430
|
+
}
|
|
6431
|
+
return { success: true };
|
|
6432
|
+
} catch (err) {
|
|
6433
|
+
return {
|
|
6434
|
+
success: false,
|
|
6435
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6436
|
+
};
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
async function triggerChannelStart() {
|
|
6440
|
+
try {
|
|
6441
|
+
if (!isVaultInitialized()) {
|
|
6442
|
+
return {
|
|
6443
|
+
success: false,
|
|
6444
|
+
error: "Vault is not initialized. Run `mink wiki init` first."
|
|
6445
|
+
};
|
|
6446
|
+
}
|
|
6447
|
+
const platform2 = resolveConfigValue("channel.default-platform").value || "discord";
|
|
6448
|
+
const token = resolveConfigValue("channel.discord.bot-token").value;
|
|
6449
|
+
if (!token) {
|
|
6450
|
+
return {
|
|
6451
|
+
success: false,
|
|
6452
|
+
error: "No bot token configured. Set channel.discord.bot-token first."
|
|
6453
|
+
};
|
|
6454
|
+
}
|
|
6455
|
+
const skipPermissions = resolveConfigValue("channel.skip-permissions").value === "true";
|
|
6456
|
+
const vaultPath = resolveVaultPath();
|
|
6457
|
+
await startChannelProcess({ vaultPath, platform: platform2, token, skipPermissions });
|
|
6458
|
+
return { success: true };
|
|
6459
|
+
} catch (err) {
|
|
6460
|
+
return {
|
|
6461
|
+
success: false,
|
|
6462
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6463
|
+
};
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6466
|
+
async function triggerChannelStop() {
|
|
6467
|
+
try {
|
|
6468
|
+
await stopChannelProcess();
|
|
6469
|
+
return { success: true };
|
|
6470
|
+
} catch (err) {
|
|
6471
|
+
return {
|
|
6472
|
+
success: false,
|
|
6473
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6474
|
+
};
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
async function triggerChannelRestart() {
|
|
6478
|
+
const stop = await triggerChannelStop();
|
|
6479
|
+
if (!stop.success)
|
|
6480
|
+
return stop;
|
|
6481
|
+
return triggerChannelStart();
|
|
6482
|
+
}
|
|
6483
|
+
async function triggerSyncDisconnect() {
|
|
6484
|
+
try {
|
|
6485
|
+
disconnectSync();
|
|
6486
|
+
return { success: true };
|
|
6487
|
+
} catch (err) {
|
|
6488
|
+
return {
|
|
6489
|
+
success: false,
|
|
6490
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6491
|
+
};
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
6494
|
+
function isValidCategory(cat) {
|
|
6495
|
+
return typeof cat === "string" && VALID_CATEGORIES.includes(cat);
|
|
6496
|
+
}
|
|
6497
|
+
function firstNonEmptyLine(s) {
|
|
6498
|
+
for (const line of s.split(`
|
|
6499
|
+
`)) {
|
|
6500
|
+
const trimmed = line.trim().replace(/^#+\s*/, "");
|
|
6501
|
+
if (trimmed)
|
|
6502
|
+
return trimmed;
|
|
6503
|
+
}
|
|
6504
|
+
return "";
|
|
6505
|
+
}
|
|
6506
|
+
function deriveQuickTitle(body) {
|
|
6507
|
+
const first = firstNonEmptyLine(body);
|
|
6508
|
+
if (!first)
|
|
6509
|
+
return `quick-capture-${new Date().toISOString().slice(0, 10)}`;
|
|
6510
|
+
return first.slice(0, 80);
|
|
6511
|
+
}
|
|
6512
|
+
function checkDedup(key) {
|
|
6513
|
+
if (!key)
|
|
6514
|
+
return null;
|
|
6515
|
+
const now = Date.now();
|
|
6516
|
+
for (const [k, v] of dedupCache) {
|
|
6517
|
+
if (v.expiresAt < now)
|
|
6518
|
+
dedupCache.delete(k);
|
|
6519
|
+
}
|
|
6520
|
+
const hit = dedupCache.get(key);
|
|
6521
|
+
return hit && hit.expiresAt >= now ? { filePath: hit.filePath } : null;
|
|
6522
|
+
}
|
|
6523
|
+
function recordDedup(key, filePath) {
|
|
6524
|
+
if (!key)
|
|
6525
|
+
return;
|
|
6526
|
+
dedupCache.set(key, { filePath, expiresAt: Date.now() + DEDUP_TTL_MS });
|
|
6527
|
+
}
|
|
6528
|
+
async function triggerCreateNote(req) {
|
|
6529
|
+
try {
|
|
6530
|
+
if (!isVaultInitialized()) {
|
|
6531
|
+
return { success: false, error: "Vault is not initialized. Run `mink wiki init` first." };
|
|
6532
|
+
}
|
|
6533
|
+
if (typeof req.body !== "string" || !req.body.trim()) {
|
|
6534
|
+
return { success: false, error: "Body is required" };
|
|
6535
|
+
}
|
|
6536
|
+
const existing = checkDedup(req.dedupKey);
|
|
6537
|
+
if (existing)
|
|
6538
|
+
return { success: true, filePath: existing.filePath };
|
|
6539
|
+
const category = isValidCategory(req.category) ? req.category : "inbox";
|
|
6540
|
+
const title = req.title?.trim() || "" || deriveQuickTitle(req.body);
|
|
6541
|
+
const tags = (req.tags ?? []).map((t) => t.trim()).filter(Boolean);
|
|
6542
|
+
const now = new Date().toISOString();
|
|
6543
|
+
const result = createNote({
|
|
6544
|
+
title,
|
|
6545
|
+
category,
|
|
6546
|
+
tags,
|
|
6547
|
+
created: now,
|
|
6548
|
+
updated: now,
|
|
6549
|
+
body: req.body
|
|
6550
|
+
});
|
|
6551
|
+
updateVaultIndexForFile(result.filePath, result.content);
|
|
6552
|
+
recordDedup(req.dedupKey, result.filePath);
|
|
6553
|
+
return { success: true, filePath: result.filePath };
|
|
6554
|
+
} catch (err) {
|
|
6555
|
+
return {
|
|
6556
|
+
success: false,
|
|
6557
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6558
|
+
};
|
|
6559
|
+
}
|
|
6560
|
+
}
|
|
6561
|
+
async function triggerAppendDaily(content, dedupKey) {
|
|
6562
|
+
try {
|
|
6563
|
+
if (!isVaultInitialized()) {
|
|
6564
|
+
return { success: false, error: "Vault is not initialized." };
|
|
6565
|
+
}
|
|
6566
|
+
if (typeof content !== "string" || !content.trim()) {
|
|
6567
|
+
return { success: false, error: "Content is required" };
|
|
6568
|
+
}
|
|
6569
|
+
const existing = checkDedup(dedupKey);
|
|
6570
|
+
if (existing)
|
|
6571
|
+
return { success: true, filePath: existing.filePath };
|
|
6572
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
6573
|
+
const filePath = appendToDaily(today, content);
|
|
6574
|
+
const updated = readFileSyncFS(filePath, "utf-8");
|
|
6575
|
+
updateVaultIndexForFile(filePath, updated);
|
|
6576
|
+
recordDedup(dedupKey, filePath);
|
|
6577
|
+
return { success: true, filePath };
|
|
6578
|
+
} catch (err) {
|
|
6579
|
+
return {
|
|
6580
|
+
success: false,
|
|
6581
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6582
|
+
};
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6585
|
+
async function triggerIngestFile(sourcePath, category, tags, dedupKey) {
|
|
6586
|
+
try {
|
|
6587
|
+
if (!isVaultInitialized()) {
|
|
6588
|
+
return { success: false, error: "Vault is not initialized." };
|
|
6589
|
+
}
|
|
6590
|
+
if (!sourcePath) {
|
|
6591
|
+
return { success: false, error: "sourcePath is required" };
|
|
6592
|
+
}
|
|
6593
|
+
if (!isValidCategory(category)) {
|
|
6594
|
+
return { success: false, error: `Invalid category: ${category}` };
|
|
6595
|
+
}
|
|
6596
|
+
const expanded = sourcePath.startsWith("~/") ? join19(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
|
|
6597
|
+
if (!fsExistsSync(expanded)) {
|
|
6598
|
+
return { success: false, error: `Source file not found: ${sourcePath}` };
|
|
6599
|
+
}
|
|
6600
|
+
const existing = checkDedup(dedupKey);
|
|
6601
|
+
if (existing)
|
|
6602
|
+
return { success: true, filePath: existing.filePath };
|
|
6603
|
+
const result = ingestFile(expanded, { category, tags });
|
|
6604
|
+
updateVaultIndexForFile(result.filePath, result.content);
|
|
6605
|
+
recordDedup(dedupKey, result.filePath);
|
|
6606
|
+
return { success: true, filePath: result.filePath };
|
|
6607
|
+
} catch (err) {
|
|
6608
|
+
return {
|
|
6609
|
+
success: false,
|
|
6610
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6611
|
+
};
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6614
|
+
async function triggerConfigReset(key, all) {
|
|
6615
|
+
try {
|
|
6616
|
+
if (all) {
|
|
6617
|
+
resetAllConfig();
|
|
6618
|
+
return { success: true };
|
|
6619
|
+
}
|
|
6620
|
+
if (!key) {
|
|
6621
|
+
return { success: false, error: "Missing key (or set all: true)" };
|
|
6622
|
+
}
|
|
6623
|
+
if (!isValidConfigKey(key)) {
|
|
6624
|
+
return { success: false, error: `Unknown config key: ${key}` };
|
|
6625
|
+
}
|
|
6626
|
+
resetConfigKey(key);
|
|
6627
|
+
return { success: true };
|
|
6628
|
+
} catch (err) {
|
|
6629
|
+
return {
|
|
6630
|
+
success: false,
|
|
6631
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6632
|
+
};
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
var SECRET_KEY_PATTERNS, BOOLEAN_VALUES, GROUP_LABELS, CHANNEL_LOG_LIMIT = 120, TIMESTAMP_PREFIX, WIKI_TREE_MAX_DEPTH = 2, WIKI_TREE_EXCLUDES, DEFAULT_RECENT_LIMIT = 25, VALID_CATEGORIES, DEDUP_TTL_MS = 600000, dedupCache;
|
|
5475
6636
|
var init_dashboard_api = __esm(() => {
|
|
5476
6637
|
init_paths();
|
|
5477
6638
|
init_fs_utils();
|
|
@@ -5482,14 +6643,42 @@ var init_dashboard_api = __esm(() => {
|
|
|
5482
6643
|
init_daemon();
|
|
5483
6644
|
init_scheduler();
|
|
5484
6645
|
init_task_registry();
|
|
6646
|
+
init_global_config();
|
|
6647
|
+
init_sync();
|
|
6648
|
+
init_channel_process();
|
|
6649
|
+
init_global_config();
|
|
6650
|
+
init_vault();
|
|
6651
|
+
init_note_index();
|
|
6652
|
+
init_note_linker();
|
|
6653
|
+
init_note_writer();
|
|
6654
|
+
init_paths();
|
|
6655
|
+
init_config();
|
|
5485
6656
|
init_design_eval();
|
|
6657
|
+
SECRET_KEY_PATTERNS = [/token/i, /secret/i, /password/i, /api[-_]?key/i];
|
|
6658
|
+
BOOLEAN_VALUES = new Set(["true", "false"]);
|
|
6659
|
+
GROUP_LABELS = {
|
|
6660
|
+
wiki: "Wiki",
|
|
6661
|
+
notes: "Notes",
|
|
6662
|
+
sync: "Sync",
|
|
6663
|
+
channel: "Channels"
|
|
6664
|
+
};
|
|
6665
|
+
TIMESTAMP_PREFIX = /^\[?(\d{1,2}:\d{2}(?::\d{2})?)\]?\s*/;
|
|
6666
|
+
WIKI_TREE_EXCLUDES = new Set([
|
|
6667
|
+
".obsidian",
|
|
6668
|
+
".git",
|
|
6669
|
+
".mink-vault.json",
|
|
6670
|
+
".mink-index.json",
|
|
6671
|
+
"node_modules"
|
|
6672
|
+
]);
|
|
6673
|
+
VALID_CATEGORIES = ["inbox", "projects", "areas", "resources", "archives"];
|
|
6674
|
+
dedupCache = new Map;
|
|
5486
6675
|
});
|
|
5487
6676
|
|
|
5488
6677
|
// src/core/project-registry.ts
|
|
5489
|
-
import { readdirSync as
|
|
5490
|
-
import { join as
|
|
6678
|
+
import { readdirSync as readdirSync6, existsSync as existsSync19 } from "fs";
|
|
6679
|
+
import { join as join20 } from "path";
|
|
5491
6680
|
function getProjectMeta(projDir) {
|
|
5492
|
-
const metaPath =
|
|
6681
|
+
const metaPath = join20(projDir, "project-meta.json");
|
|
5493
6682
|
const raw = safeReadJson(metaPath);
|
|
5494
6683
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
5495
6684
|
return null;
|
|
@@ -5506,15 +6695,15 @@ function getProjectMeta(projDir) {
|
|
|
5506
6695
|
};
|
|
5507
6696
|
}
|
|
5508
6697
|
function listRegisteredProjects() {
|
|
5509
|
-
const projectsDir =
|
|
5510
|
-
if (!
|
|
6698
|
+
const projectsDir = join20(minkRoot(), "projects");
|
|
6699
|
+
if (!existsSync19(projectsDir))
|
|
5511
6700
|
return [];
|
|
5512
|
-
const entries =
|
|
6701
|
+
const entries = readdirSync6(projectsDir, { withFileTypes: true });
|
|
5513
6702
|
const projects = [];
|
|
5514
6703
|
for (const entry of entries) {
|
|
5515
6704
|
if (!entry.isDirectory())
|
|
5516
6705
|
continue;
|
|
5517
|
-
const projDir =
|
|
6706
|
+
const projDir = join20(projectsDir, entry.name);
|
|
5518
6707
|
const meta = getProjectMeta(projDir);
|
|
5519
6708
|
if (meta) {
|
|
5520
6709
|
projects.push({
|
|
@@ -5532,154 +6721,14 @@ var init_project_registry = __esm(() => {
|
|
|
5532
6721
|
init_fs_utils();
|
|
5533
6722
|
});
|
|
5534
6723
|
|
|
5535
|
-
// src/core/runtime.ts
|
|
5536
|
-
import { readFile as readFile2, stat } from "fs/promises";
|
|
5537
|
-
import { spawn as nodeSpawn } from "child_process";
|
|
5538
|
-
function runtimeFile(path) {
|
|
5539
|
-
if (isBun) {
|
|
5540
|
-
const f = Bun.file(path);
|
|
5541
|
-
return {
|
|
5542
|
-
exists: () => f.exists(),
|
|
5543
|
-
bytes: () => f.arrayBuffer().then((ab) => new Uint8Array(ab))
|
|
5544
|
-
};
|
|
5545
|
-
}
|
|
5546
|
-
return {
|
|
5547
|
-
async exists() {
|
|
5548
|
-
try {
|
|
5549
|
-
await stat(path);
|
|
5550
|
-
return true;
|
|
5551
|
-
} catch {
|
|
5552
|
-
return false;
|
|
5553
|
-
}
|
|
5554
|
-
},
|
|
5555
|
-
async bytes() {
|
|
5556
|
-
return readFile2(path);
|
|
5557
|
-
}
|
|
5558
|
-
};
|
|
5559
|
-
}
|
|
5560
|
-
function runtimeSpawn(cmd, opts = {}) {
|
|
5561
|
-
if (isBun) {
|
|
5562
|
-
const proc2 = Bun.spawn(cmd, {
|
|
5563
|
-
cwd: opts.cwd,
|
|
5564
|
-
env: opts.env,
|
|
5565
|
-
stdout: opts.stdout ?? "ignore",
|
|
5566
|
-
stderr: opts.stderr ?? "ignore",
|
|
5567
|
-
stdin: opts.stdin ?? "ignore"
|
|
5568
|
-
});
|
|
5569
|
-
return { unref: () => proc2.unref() };
|
|
5570
|
-
}
|
|
5571
|
-
const [bin, ...args] = cmd;
|
|
5572
|
-
const proc = nodeSpawn(bin, args, {
|
|
5573
|
-
cwd: opts.cwd,
|
|
5574
|
-
env: opts.env,
|
|
5575
|
-
stdio: [
|
|
5576
|
-
opts.stdin ?? "ignore",
|
|
5577
|
-
opts.stdout ?? "ignore",
|
|
5578
|
-
opts.stderr ?? "ignore"
|
|
5579
|
-
],
|
|
5580
|
-
detached: true
|
|
5581
|
-
});
|
|
5582
|
-
proc.unref();
|
|
5583
|
-
return { unref: () => {} };
|
|
5584
|
-
}
|
|
5585
|
-
async function runtimeServe(opts) {
|
|
5586
|
-
if (isBun) {
|
|
5587
|
-
const server = Bun.serve({
|
|
5588
|
-
port: opts.port,
|
|
5589
|
-
hostname: opts.hostname,
|
|
5590
|
-
idleTimeout: opts.idleTimeout ?? 0,
|
|
5591
|
-
fetch: opts.fetch
|
|
5592
|
-
});
|
|
5593
|
-
return {
|
|
5594
|
-
port: server.port,
|
|
5595
|
-
stop: (close) => server.stop(close)
|
|
5596
|
-
};
|
|
5597
|
-
}
|
|
5598
|
-
const { createServer } = await import("node:http");
|
|
5599
|
-
const { Readable } = await import("node:stream");
|
|
5600
|
-
return new Promise((resolve4) => {
|
|
5601
|
-
const httpServer = createServer(async (req, res) => {
|
|
5602
|
-
const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
|
|
5603
|
-
const headers = new Headers;
|
|
5604
|
-
for (const [key, val] of Object.entries(req.headers)) {
|
|
5605
|
-
if (val)
|
|
5606
|
-
headers.set(key, Array.isArray(val) ? val.join(", ") : val);
|
|
5607
|
-
}
|
|
5608
|
-
let body = null;
|
|
5609
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
5610
|
-
const chunks = [];
|
|
5611
|
-
for await (const chunk of req) {
|
|
5612
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
5613
|
-
}
|
|
5614
|
-
body = Buffer.concat(chunks);
|
|
5615
|
-
}
|
|
5616
|
-
const request = new Request(url, {
|
|
5617
|
-
method: req.method,
|
|
5618
|
-
headers,
|
|
5619
|
-
body,
|
|
5620
|
-
duplex: body ? "half" : undefined
|
|
5621
|
-
});
|
|
5622
|
-
try {
|
|
5623
|
-
const response = await opts.fetch(request);
|
|
5624
|
-
res.writeHead(response.status, Object.fromEntries(response.headers));
|
|
5625
|
-
if (!response.body) {
|
|
5626
|
-
res.end();
|
|
5627
|
-
return;
|
|
5628
|
-
}
|
|
5629
|
-
const reader = response.body.getReader();
|
|
5630
|
-
const nodeStream = new Readable({
|
|
5631
|
-
async read() {
|
|
5632
|
-
try {
|
|
5633
|
-
const { done, value } = await reader.read();
|
|
5634
|
-
if (done) {
|
|
5635
|
-
this.push(null);
|
|
5636
|
-
} else {
|
|
5637
|
-
this.push(Buffer.from(value));
|
|
5638
|
-
}
|
|
5639
|
-
} catch {
|
|
5640
|
-
this.push(null);
|
|
5641
|
-
}
|
|
5642
|
-
}
|
|
5643
|
-
});
|
|
5644
|
-
res.on("close", () => {
|
|
5645
|
-
reader.cancel().catch(() => {});
|
|
5646
|
-
nodeStream.destroy();
|
|
5647
|
-
});
|
|
5648
|
-
nodeStream.pipe(res);
|
|
5649
|
-
} catch (err) {
|
|
5650
|
-
if (!res.headersSent) {
|
|
5651
|
-
res.writeHead(500);
|
|
5652
|
-
res.end(String(err));
|
|
5653
|
-
}
|
|
5654
|
-
}
|
|
5655
|
-
});
|
|
5656
|
-
httpServer.listen(opts.port, opts.hostname, () => {
|
|
5657
|
-
const addr = httpServer.address();
|
|
5658
|
-
const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
|
|
5659
|
-
resolve4({
|
|
5660
|
-
port: boundPort,
|
|
5661
|
-
stop: (close) => {
|
|
5662
|
-
if (close)
|
|
5663
|
-
httpServer.closeAllConnections();
|
|
5664
|
-
httpServer.close();
|
|
5665
|
-
}
|
|
5666
|
-
});
|
|
5667
|
-
});
|
|
5668
|
-
});
|
|
5669
|
-
}
|
|
5670
|
-
var isBun;
|
|
5671
|
-
var init_runtime = __esm(() => {
|
|
5672
|
-
isBun = typeof globalThis.Bun !== "undefined";
|
|
5673
|
-
});
|
|
5674
|
-
|
|
5675
6724
|
// src/core/dashboard-server.ts
|
|
5676
6725
|
var exports_dashboard_server = {};
|
|
5677
6726
|
__export(exports_dashboard_server, {
|
|
5678
6727
|
startDashboardServer: () => startDashboardServer
|
|
5679
6728
|
});
|
|
5680
6729
|
import { watch } from "fs";
|
|
5681
|
-
import { existsSync as
|
|
5682
|
-
import { basename as basename7, dirname as dirname7, join as
|
|
6730
|
+
import { existsSync as existsSync20 } from "fs";
|
|
6731
|
+
import { basename as basename7, dirname as dirname7, join as join21, extname as extname2 } from "path";
|
|
5683
6732
|
|
|
5684
6733
|
class SSEManager {
|
|
5685
6734
|
clients = new Map;
|
|
@@ -5855,12 +6904,12 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
5855
6904
|
const __dir = dirname7(new URL(import.meta.url).pathname);
|
|
5856
6905
|
let pkgRoot = __dir;
|
|
5857
6906
|
while (pkgRoot !== dirname7(pkgRoot)) {
|
|
5858
|
-
if (
|
|
6907
|
+
if (existsSync20(join21(pkgRoot, "package.json")))
|
|
5859
6908
|
break;
|
|
5860
6909
|
pkgRoot = dirname7(pkgRoot);
|
|
5861
6910
|
}
|
|
5862
|
-
const dashboardOutDir =
|
|
5863
|
-
const dashboardBuilt =
|
|
6911
|
+
const dashboardOutDir = join21(pkgRoot, "dashboard", "out");
|
|
6912
|
+
const dashboardBuilt = existsSync20(join21(dashboardOutDir, "index.html"));
|
|
5864
6913
|
let clientIdCounter = 0;
|
|
5865
6914
|
if (!dashboardBuilt) {
|
|
5866
6915
|
console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
|
|
@@ -5890,9 +6939,9 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
5890
6939
|
} else {
|
|
5891
6940
|
let filePath;
|
|
5892
6941
|
if (pathname === "/") {
|
|
5893
|
-
filePath =
|
|
6942
|
+
filePath = join21(dashboardOutDir, "index.html");
|
|
5894
6943
|
} else {
|
|
5895
|
-
filePath =
|
|
6944
|
+
filePath = join21(dashboardOutDir, pathname);
|
|
5896
6945
|
}
|
|
5897
6946
|
if (!filePath.startsWith(dashboardOutDir)) {
|
|
5898
6947
|
return jsonResponse({ error: "Forbidden" }, 403);
|
|
@@ -5905,7 +6954,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
5905
6954
|
const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
|
|
5906
6955
|
if (htmlServed)
|
|
5907
6956
|
return htmlServed;
|
|
5908
|
-
const indexServed = await serveFile(
|
|
6957
|
+
const indexServed = await serveFile(join21(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
|
|
5909
6958
|
if (indexServed)
|
|
5910
6959
|
return indexServed;
|
|
5911
6960
|
}
|
|
@@ -5937,6 +6986,55 @@ retry: 3000
|
|
|
5937
6986
|
if (pathname === "/api/projects") {
|
|
5938
6987
|
return jsonResponse(getProjectsList(cwd, activeCwd));
|
|
5939
6988
|
}
|
|
6989
|
+
if (pathname === "/api/config") {
|
|
6990
|
+
try {
|
|
6991
|
+
return jsonResponse(loadConfigPanel());
|
|
6992
|
+
} catch (err) {
|
|
6993
|
+
return jsonResponse({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
6994
|
+
}
|
|
6995
|
+
}
|
|
6996
|
+
if (pathname === "/api/sync") {
|
|
6997
|
+
try {
|
|
6998
|
+
return jsonResponse(loadSyncPanel());
|
|
6999
|
+
} catch (err) {
|
|
7000
|
+
return jsonResponse({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7001
|
+
}
|
|
7002
|
+
}
|
|
7003
|
+
if (pathname === "/api/channel") {
|
|
7004
|
+
try {
|
|
7005
|
+
return jsonResponse(loadChannelPanel());
|
|
7006
|
+
} catch (err) {
|
|
7007
|
+
return jsonResponse({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7008
|
+
}
|
|
7009
|
+
}
|
|
7010
|
+
if (pathname === "/api/wiki") {
|
|
7011
|
+
try {
|
|
7012
|
+
const limitRaw = url.searchParams.get("limit");
|
|
7013
|
+
const categoryRaw = url.searchParams.get("category");
|
|
7014
|
+
const limit = limitRaw ? Number(limitRaw) : undefined;
|
|
7015
|
+
return jsonResponse(loadWikiPanel({
|
|
7016
|
+
limit: Number.isFinite(limit) ? limit : undefined,
|
|
7017
|
+
category: categoryRaw ?? undefined
|
|
7018
|
+
}));
|
|
7019
|
+
} catch (err) {
|
|
7020
|
+
return jsonResponse({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
if (pathname === "/api/wiki/note") {
|
|
7024
|
+
try {
|
|
7025
|
+
const notePath = url.searchParams.get("path");
|
|
7026
|
+
if (!notePath) {
|
|
7027
|
+
return jsonResponse({ error: "Missing path parameter" }, 400);
|
|
7028
|
+
}
|
|
7029
|
+
const note = loadWikiNote(notePath);
|
|
7030
|
+
if (!note) {
|
|
7031
|
+
return jsonResponse({ error: "Note not found" }, 404);
|
|
7032
|
+
}
|
|
7033
|
+
return jsonResponse(note);
|
|
7034
|
+
} catch (err) {
|
|
7035
|
+
return jsonResponse({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7036
|
+
}
|
|
7037
|
+
}
|
|
5940
7038
|
const resolvedCwd = resolveProjectCwd(url, activeCwd);
|
|
5941
7039
|
if (resolvedCwd === null) {
|
|
5942
7040
|
return jsonResponse({ error: "Project not found" }, 404);
|
|
@@ -5965,7 +7063,7 @@ retry: 3000
|
|
|
5965
7063
|
if (!filename || filename.includes("..") || filename.includes("/")) {
|
|
5966
7064
|
return jsonResponse({ error: "Invalid filename" }, 400);
|
|
5967
7065
|
}
|
|
5968
|
-
const imgPath =
|
|
7066
|
+
const imgPath = join21(designCapturesDir(resolvedCwd), filename);
|
|
5969
7067
|
const served = await serveFile(imgPath, "image/jpeg");
|
|
5970
7068
|
if (served) {
|
|
5971
7069
|
served.headers.set("Cache-Control", "public, max-age=60");
|
|
@@ -6002,6 +7100,108 @@ retry: 3000
|
|
|
6002
7100
|
return jsonResponse({ success: false, error: err instanceof Error ? err.message : String(err) }, 500);
|
|
6003
7101
|
}
|
|
6004
7102
|
}
|
|
7103
|
+
if (pathname === "/api/config/set") {
|
|
7104
|
+
try {
|
|
7105
|
+
const body = await req.json();
|
|
7106
|
+
if (!body.key || typeof body.value !== "string") {
|
|
7107
|
+
return jsonResponse({ success: false, error: "Missing key or value" }, 400);
|
|
7108
|
+
}
|
|
7109
|
+
const result = await triggerConfigSet(body.key, body.value);
|
|
7110
|
+
if (result.success) {
|
|
7111
|
+
sseManager.broadcast({
|
|
7112
|
+
fileId: "config-changed",
|
|
7113
|
+
timestamp: new Date().toISOString()
|
|
7114
|
+
});
|
|
7115
|
+
}
|
|
7116
|
+
return jsonResponse(result, result.success ? 200 : 500);
|
|
7117
|
+
} catch (err) {
|
|
7118
|
+
return jsonResponse({ success: false, error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7119
|
+
}
|
|
7120
|
+
}
|
|
7121
|
+
if (pathname === "/api/config/reset") {
|
|
7122
|
+
try {
|
|
7123
|
+
const body = await req.json();
|
|
7124
|
+
const result = await triggerConfigReset(body.key, body.all);
|
|
7125
|
+
if (result.success) {
|
|
7126
|
+
sseManager.broadcast({
|
|
7127
|
+
fileId: "config-changed",
|
|
7128
|
+
timestamp: new Date().toISOString()
|
|
7129
|
+
});
|
|
7130
|
+
}
|
|
7131
|
+
return jsonResponse(result, result.success ? 200 : 500);
|
|
7132
|
+
} catch (err) {
|
|
7133
|
+
return jsonResponse({ success: false, error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
if (pathname === "/api/wiki/notes" || pathname === "/api/wiki/daily" || pathname === "/api/wiki/ingest") {
|
|
7137
|
+
const dedupKey = req.headers.get("X-Mink-Dedup-Key") ?? undefined;
|
|
7138
|
+
try {
|
|
7139
|
+
const body = await req.json();
|
|
7140
|
+
let action;
|
|
7141
|
+
if (pathname === "/api/wiki/notes") {
|
|
7142
|
+
const mode = body.mode === "structured" ? "structured" : "quick";
|
|
7143
|
+
action = triggerCreateNote({
|
|
7144
|
+
mode,
|
|
7145
|
+
title: typeof body.title === "string" ? body.title : undefined,
|
|
7146
|
+
category: typeof body.category === "string" ? body.category : undefined,
|
|
7147
|
+
body: typeof body.body === "string" ? body.body : "",
|
|
7148
|
+
tags: Array.isArray(body.tags) ? body.tags : undefined,
|
|
7149
|
+
dedupKey
|
|
7150
|
+
});
|
|
7151
|
+
} else if (pathname === "/api/wiki/daily") {
|
|
7152
|
+
action = triggerAppendDaily(typeof body.content === "string" ? body.content : "", dedupKey);
|
|
7153
|
+
} else {
|
|
7154
|
+
action = triggerIngestFile(typeof body.sourcePath === "string" ? body.sourcePath : "", typeof body.category === "string" ? body.category : "inbox", Array.isArray(body.tags) ? body.tags : undefined, dedupKey);
|
|
7155
|
+
}
|
|
7156
|
+
return action.then((result) => {
|
|
7157
|
+
if (result.success) {
|
|
7158
|
+
sseManager.broadcast({
|
|
7159
|
+
fileId: "vault-index",
|
|
7160
|
+
timestamp: new Date().toISOString()
|
|
7161
|
+
});
|
|
7162
|
+
}
|
|
7163
|
+
return jsonResponse(result, result.success ? 200 : 500);
|
|
7164
|
+
});
|
|
7165
|
+
} catch (err) {
|
|
7166
|
+
return jsonResponse({ success: false, error: err instanceof Error ? err.message : String(err) }, 500);
|
|
7167
|
+
}
|
|
7168
|
+
}
|
|
7169
|
+
if (pathname === "/api/channel/start" || pathname === "/api/channel/stop" || pathname === "/api/channel/restart") {
|
|
7170
|
+
const action = pathname === "/api/channel/start" ? triggerChannelStart() : pathname === "/api/channel/stop" ? triggerChannelStop() : triggerChannelRestart();
|
|
7171
|
+
return action.then((result) => {
|
|
7172
|
+
if (result.success) {
|
|
7173
|
+
sseManager.broadcast({
|
|
7174
|
+
fileId: "channel-status",
|
|
7175
|
+
timestamp: new Date().toISOString()
|
|
7176
|
+
});
|
|
7177
|
+
}
|
|
7178
|
+
return jsonResponse(result, result.success ? 200 : 500);
|
|
7179
|
+
});
|
|
7180
|
+
}
|
|
7181
|
+
if (pathname === "/api/sync/pull" || pathname === "/api/sync/push" || pathname === "/api/sync/disconnect") {
|
|
7182
|
+
const action = pathname === "/api/sync/pull" ? triggerSyncPull() : pathname === "/api/sync/push" ? triggerSyncPush() : triggerSyncDisconnect();
|
|
7183
|
+
return action.then((result) => {
|
|
7184
|
+
if (result.success) {
|
|
7185
|
+
sseManager.broadcast({
|
|
7186
|
+
fileId: "sync-status",
|
|
7187
|
+
timestamp: new Date().toISOString()
|
|
7188
|
+
});
|
|
7189
|
+
}
|
|
7190
|
+
return jsonResponse(result, result.success ? 200 : 500);
|
|
7191
|
+
});
|
|
7192
|
+
}
|
|
7193
|
+
if (pathname === "/api/daemon/start" || pathname === "/api/daemon/stop" || pathname === "/api/daemon/restart") {
|
|
7194
|
+
const action = pathname === "/api/daemon/start" ? triggerDaemonStart(activeCwd) : pathname === "/api/daemon/stop" ? triggerDaemonStop() : triggerDaemonRestart(activeCwd);
|
|
7195
|
+
return action.then((result) => {
|
|
7196
|
+
if (result.success) {
|
|
7197
|
+
sseManager.broadcast({
|
|
7198
|
+
fileId: "daemon-status",
|
|
7199
|
+
timestamp: new Date().toISOString()
|
|
7200
|
+
});
|
|
7201
|
+
}
|
|
7202
|
+
return jsonResponse(result, result.success ? 200 : 500);
|
|
7203
|
+
});
|
|
7204
|
+
}
|
|
6005
7205
|
const resolvedCwd = resolveProjectCwd(url, activeCwd);
|
|
6006
7206
|
if (resolvedCwd === null) {
|
|
6007
7207
|
return jsonResponse({ error: "Project not found" }, 404);
|
|
@@ -6097,9 +7297,9 @@ var exports_dashboard = {};
|
|
|
6097
7297
|
__export(exports_dashboard, {
|
|
6098
7298
|
dashboard: () => dashboard
|
|
6099
7299
|
});
|
|
6100
|
-
import { existsSync as
|
|
7300
|
+
import { existsSync as existsSync21 } from "fs";
|
|
6101
7301
|
async function dashboard(cwd, args) {
|
|
6102
|
-
if (!
|
|
7302
|
+
if (!existsSync21(projectDir(cwd))) {
|
|
6103
7303
|
console.error("[mink] project not initialized. Run: mink init");
|
|
6104
7304
|
process.exit(1);
|
|
6105
7305
|
}
|
|
@@ -6121,7 +7321,7 @@ var exports_daemon = {};
|
|
|
6121
7321
|
__export(exports_daemon, {
|
|
6122
7322
|
daemon: () => daemon
|
|
6123
7323
|
});
|
|
6124
|
-
import { readFileSync as
|
|
7324
|
+
import { readFileSync as readFileSync22, existsSync as existsSync22 } from "fs";
|
|
6125
7325
|
async function daemon(cwd, args) {
|
|
6126
7326
|
const subcommand = args[0];
|
|
6127
7327
|
switch (subcommand) {
|
|
@@ -6137,12 +7337,12 @@ async function daemon(cwd, args) {
|
|
|
6137
7337
|
break;
|
|
6138
7338
|
case "logs": {
|
|
6139
7339
|
const logPath = schedulerLogPath();
|
|
6140
|
-
if (!
|
|
7340
|
+
if (!existsSync22(logPath)) {
|
|
6141
7341
|
console.log("[mink] no log file found");
|
|
6142
7342
|
return;
|
|
6143
7343
|
}
|
|
6144
7344
|
try {
|
|
6145
|
-
const content =
|
|
7345
|
+
const content = readFileSync22(logPath, "utf-8");
|
|
6146
7346
|
const lines = content.split(`
|
|
6147
7347
|
`);
|
|
6148
7348
|
const tail = lines.slice(-50).join(`
|
|
@@ -6402,13 +7602,13 @@ function printValidKeys() {
|
|
|
6402
7602
|
}
|
|
6403
7603
|
}
|
|
6404
7604
|
function readLineFromStdin() {
|
|
6405
|
-
return new Promise((
|
|
7605
|
+
return new Promise((resolve5) => {
|
|
6406
7606
|
const chunks = [];
|
|
6407
7607
|
process.stdin.resume();
|
|
6408
7608
|
process.stdin.setEncoding("utf-8");
|
|
6409
7609
|
process.stdin.once("data", (data) => {
|
|
6410
7610
|
process.stdin.pause();
|
|
6411
|
-
|
|
7611
|
+
resolve5(String(data).trim());
|
|
6412
7612
|
});
|
|
6413
7613
|
});
|
|
6414
7614
|
}
|
|
@@ -6479,12 +7679,12 @@ var init_config2 = __esm(() => {
|
|
|
6479
7679
|
});
|
|
6480
7680
|
|
|
6481
7681
|
// src/commands/init.ts
|
|
6482
|
-
import { execSync as
|
|
6483
|
-
import { mkdirSync as
|
|
6484
|
-
import { resolve as
|
|
7682
|
+
import { execSync as execSync4 } from "child_process";
|
|
7683
|
+
import { mkdirSync as mkdirSync11, existsSync as existsSync23 } from "fs";
|
|
7684
|
+
import { resolve as resolve5, dirname as dirname8, basename as basename8, join as join22 } from "path";
|
|
6485
7685
|
function detectRuntime2() {
|
|
6486
7686
|
try {
|
|
6487
|
-
|
|
7687
|
+
execSync4("bun --version", { stdio: "ignore" });
|
|
6488
7688
|
return "bun";
|
|
6489
7689
|
} catch {
|
|
6490
7690
|
return "node";
|
|
@@ -6522,7 +7722,7 @@ function isMinkHook2(entry) {
|
|
|
6522
7722
|
return false;
|
|
6523
7723
|
}
|
|
6524
7724
|
function mergeHooksIntoSettings2(settingsPath, newHooks) {
|
|
6525
|
-
|
|
7725
|
+
mkdirSync11(dirname8(settingsPath), { recursive: true });
|
|
6526
7726
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
6527
7727
|
const existingHooks = existing.hooks ?? {};
|
|
6528
7728
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -6545,7 +7745,7 @@ var exports_update = {};
|
|
|
6545
7745
|
__export(exports_update, {
|
|
6546
7746
|
update: () => update
|
|
6547
7747
|
});
|
|
6548
|
-
import { resolve as
|
|
7748
|
+
import { resolve as resolve6, dirname as dirname9 } from "path";
|
|
6549
7749
|
function parseArgs(args) {
|
|
6550
7750
|
let dryRun = false;
|
|
6551
7751
|
let project = null;
|
|
@@ -6593,7 +7793,7 @@ async function update(cwd, args) {
|
|
|
6593
7793
|
return;
|
|
6594
7794
|
}
|
|
6595
7795
|
const runtime = detectRuntime2();
|
|
6596
|
-
const cliPath =
|
|
7796
|
+
const cliPath = resolve6(dirname9(new URL(import.meta.url).pathname), "../cli.ts");
|
|
6597
7797
|
const newHooks = buildHooksConfig2(runtime, cliPath);
|
|
6598
7798
|
for (const target of targets) {
|
|
6599
7799
|
console.log(`[mink] updating: ${target.name} (${target.id})`);
|
|
@@ -6604,7 +7804,7 @@ async function update(cwd, args) {
|
|
|
6604
7804
|
}
|
|
6605
7805
|
const backupName = createBackup(target.cwd);
|
|
6606
7806
|
console.log(` backup: ${backupName}`);
|
|
6607
|
-
const settingsPath =
|
|
7807
|
+
const settingsPath = resolve6(target.cwd, ".claude", "settings.json");
|
|
6608
7808
|
mergeHooksIntoSettings2(settingsPath, newHooks);
|
|
6609
7809
|
console.log(" hooks: updated");
|
|
6610
7810
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -6662,8 +7862,8 @@ var init_restore = __esm(() => {
|
|
|
6662
7862
|
});
|
|
6663
7863
|
|
|
6664
7864
|
// src/core/design-eval/server-detect.ts
|
|
6665
|
-
import { readFileSync as
|
|
6666
|
-
import { join as
|
|
7865
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
7866
|
+
import { join as join23 } from "path";
|
|
6667
7867
|
async function probePort(port) {
|
|
6668
7868
|
try {
|
|
6669
7869
|
const controller = new AbortController;
|
|
@@ -6685,7 +7885,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
6685
7885
|
}
|
|
6686
7886
|
function detectDevCommand(cwd) {
|
|
6687
7887
|
try {
|
|
6688
|
-
const raw =
|
|
7888
|
+
const raw = readFileSync23(join23(cwd, "package.json"), "utf-8");
|
|
6689
7889
|
const pkg = JSON.parse(raw);
|
|
6690
7890
|
const scripts = pkg.scripts;
|
|
6691
7891
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -6705,10 +7905,10 @@ var init_server_detect = __esm(() => {
|
|
|
6705
7905
|
});
|
|
6706
7906
|
|
|
6707
7907
|
// src/core/design-eval/route-detect.ts
|
|
6708
|
-
import { existsSync as
|
|
6709
|
-
import { join as
|
|
7908
|
+
import { existsSync as existsSync24, readdirSync as readdirSync7, statSync as statSync9 } from "fs";
|
|
7909
|
+
import { join as join24, relative as relative6, sep as sep2 } from "path";
|
|
6710
7910
|
function detectFramework(cwd) {
|
|
6711
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
7911
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync24(join24(cwd, `${name}.${ext}`))) || existsSync24(join24(cwd, name));
|
|
6712
7912
|
if (has("next.config"))
|
|
6713
7913
|
return "nextjs";
|
|
6714
7914
|
if (has("svelte.config"))
|
|
@@ -6733,31 +7933,31 @@ function detectRoutes(cwd) {
|
|
|
6733
7933
|
}
|
|
6734
7934
|
function detectNextRoutes(cwd) {
|
|
6735
7935
|
const routes = [];
|
|
6736
|
-
const appDir =
|
|
6737
|
-
if (
|
|
7936
|
+
const appDir = join24(cwd, "app");
|
|
7937
|
+
if (existsSync24(appDir)) {
|
|
6738
7938
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
6739
7939
|
for (const file of pageFiles) {
|
|
6740
7940
|
const rel = relative6(appDir, file);
|
|
6741
7941
|
const dir = rel.replace(/([/\\])?page\.(tsx?|jsx?)$/, "");
|
|
6742
|
-
const route = dir === "" ? "/" : `/${dir.split(
|
|
7942
|
+
const route = dir === "" ? "/" : `/${dir.split(sep2).join("/")}`;
|
|
6743
7943
|
if (/\[|@|\(/.test(route))
|
|
6744
7944
|
continue;
|
|
6745
7945
|
routes.push(route);
|
|
6746
7946
|
}
|
|
6747
7947
|
}
|
|
6748
|
-
const pagesDir =
|
|
6749
|
-
if (
|
|
7948
|
+
const pagesDir = join24(cwd, "pages");
|
|
7949
|
+
if (existsSync24(pagesDir)) {
|
|
6750
7950
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
6751
7951
|
for (const file of pageFiles) {
|
|
6752
7952
|
const rel = relative6(pagesDir, file);
|
|
6753
7953
|
const name = rel.replace(/\.(tsx?|jsx?)$/, "");
|
|
6754
7954
|
if (/^_(app|document|error)/.test(name))
|
|
6755
7955
|
continue;
|
|
6756
|
-
if (name.startsWith(`api${
|
|
7956
|
+
if (name.startsWith(`api${sep2}`) || name === "api")
|
|
6757
7957
|
continue;
|
|
6758
7958
|
if (/\[/.test(name))
|
|
6759
7959
|
continue;
|
|
6760
|
-
const route = name === "index" ? "/" : `/${name.split(
|
|
7960
|
+
const route = name === "index" ? "/" : `/${name.split(sep2).join("/")}`;
|
|
6761
7961
|
routes.push(route);
|
|
6762
7962
|
}
|
|
6763
7963
|
}
|
|
@@ -6765,15 +7965,15 @@ function detectNextRoutes(cwd) {
|
|
|
6765
7965
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
6766
7966
|
}
|
|
6767
7967
|
function detectSvelteKitRoutes(cwd) {
|
|
6768
|
-
const routesDir =
|
|
6769
|
-
if (!
|
|
7968
|
+
const routesDir = join24(cwd, "src", "routes");
|
|
7969
|
+
if (!existsSync24(routesDir))
|
|
6770
7970
|
return ["/"];
|
|
6771
7971
|
const routes = [];
|
|
6772
7972
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
6773
7973
|
for (const file of pageFiles) {
|
|
6774
7974
|
const rel = relative6(routesDir, file);
|
|
6775
7975
|
const dir = rel.replace(/([/\\])?\+page\.svelte$/, "");
|
|
6776
|
-
const route = dir === "" ? "/" : `/${dir.split(
|
|
7976
|
+
const route = dir === "" ? "/" : `/${dir.split(sep2).join("/")}`;
|
|
6777
7977
|
if (/\[|\(/.test(route))
|
|
6778
7978
|
continue;
|
|
6779
7979
|
routes.push(route);
|
|
@@ -6781,8 +7981,8 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
6781
7981
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
6782
7982
|
}
|
|
6783
7983
|
function detectNuxtRoutes(cwd) {
|
|
6784
|
-
const pagesDir =
|
|
6785
|
-
if (!
|
|
7984
|
+
const pagesDir = join24(cwd, "pages");
|
|
7985
|
+
if (!existsSync24(pagesDir))
|
|
6786
7986
|
return ["/"];
|
|
6787
7987
|
const routes = [];
|
|
6788
7988
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
@@ -6791,7 +7991,7 @@ function detectNuxtRoutes(cwd) {
|
|
|
6791
7991
|
const name = rel.replace(/\.vue$/, "");
|
|
6792
7992
|
if (/\[/.test(name))
|
|
6793
7993
|
continue;
|
|
6794
|
-
const route = name === "index" ? "/" : `/${name.split(
|
|
7994
|
+
const route = name === "index" ? "/" : `/${name.split(sep2).join("/")}`;
|
|
6795
7995
|
routes.push(route);
|
|
6796
7996
|
}
|
|
6797
7997
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
@@ -6801,16 +8001,16 @@ function findFiles(dir, pattern) {
|
|
|
6801
8001
|
function walk(current) {
|
|
6802
8002
|
let entries;
|
|
6803
8003
|
try {
|
|
6804
|
-
entries =
|
|
8004
|
+
entries = readdirSync7(current);
|
|
6805
8005
|
} catch {
|
|
6806
8006
|
return;
|
|
6807
8007
|
}
|
|
6808
8008
|
for (const entry of entries) {
|
|
6809
8009
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
6810
8010
|
continue;
|
|
6811
|
-
const full =
|
|
8011
|
+
const full = join24(current, entry);
|
|
6812
8012
|
try {
|
|
6813
|
-
const stat2 =
|
|
8013
|
+
const stat2 = statSync9(full);
|
|
6814
8014
|
if (stat2.isDirectory()) {
|
|
6815
8015
|
walk(full);
|
|
6816
8016
|
} else if (pattern.test(entry)) {
|
|
@@ -6836,11 +8036,11 @@ function __extends(d, b) {
|
|
|
6836
8036
|
}
|
|
6837
8037
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
6838
8038
|
function adopt(value) {
|
|
6839
|
-
return value instanceof P ? value : new P(function(
|
|
6840
|
-
|
|
8039
|
+
return value instanceof P ? value : new P(function(resolve7) {
|
|
8040
|
+
resolve7(value);
|
|
6841
8041
|
});
|
|
6842
8042
|
}
|
|
6843
|
-
return new (P || (P = Promise))(function(
|
|
8043
|
+
return new (P || (P = Promise))(function(resolve7, reject) {
|
|
6844
8044
|
function fulfilled(value) {
|
|
6845
8045
|
try {
|
|
6846
8046
|
step(generator.next(value));
|
|
@@ -6856,7 +8056,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
6856
8056
|
}
|
|
6857
8057
|
}
|
|
6858
8058
|
function step(result) {
|
|
6859
|
-
result.done ?
|
|
8059
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
6860
8060
|
}
|
|
6861
8061
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6862
8062
|
});
|
|
@@ -7039,14 +8239,14 @@ function __asyncValues(o) {
|
|
|
7039
8239
|
}, i);
|
|
7040
8240
|
function verb(n) {
|
|
7041
8241
|
i[n] = o[n] && function(v) {
|
|
7042
|
-
return new Promise(function(
|
|
7043
|
-
v = o[n](v), settle(
|
|
8242
|
+
return new Promise(function(resolve7, reject) {
|
|
8243
|
+
v = o[n](v), settle(resolve7, reject, v.done, v.value);
|
|
7044
8244
|
});
|
|
7045
8245
|
};
|
|
7046
8246
|
}
|
|
7047
|
-
function settle(
|
|
8247
|
+
function settle(resolve7, reject, d, v) {
|
|
7048
8248
|
Promise.resolve(v).then(function(v2) {
|
|
7049
|
-
|
|
8249
|
+
resolve7({ value: v2, done: d });
|
|
7050
8250
|
}, reject);
|
|
7051
8251
|
}
|
|
7052
8252
|
}
|
|
@@ -7577,7 +8777,7 @@ function of() {
|
|
|
7577
8777
|
}
|
|
7578
8778
|
function lastValueFrom(source, config22) {
|
|
7579
8779
|
var hasConfig = typeof config22 === "object";
|
|
7580
|
-
return new Promise(function(
|
|
8780
|
+
return new Promise(function(resolve7, reject) {
|
|
7581
8781
|
var _hasValue = false;
|
|
7582
8782
|
var _value;
|
|
7583
8783
|
source.subscribe({
|
|
@@ -7588,9 +8788,9 @@ function lastValueFrom(source, config22) {
|
|
|
7588
8788
|
error: reject,
|
|
7589
8789
|
complete: function() {
|
|
7590
8790
|
if (_hasValue) {
|
|
7591
|
-
|
|
8791
|
+
resolve7(_value);
|
|
7592
8792
|
} else if (hasConfig) {
|
|
7593
|
-
|
|
8793
|
+
resolve7(config22.defaultValue);
|
|
7594
8794
|
} else {
|
|
7595
8795
|
reject(new EmptyError);
|
|
7596
8796
|
}
|
|
@@ -7600,16 +8800,16 @@ function lastValueFrom(source, config22) {
|
|
|
7600
8800
|
}
|
|
7601
8801
|
function firstValueFrom(source, config22) {
|
|
7602
8802
|
var hasConfig = typeof config22 === "object";
|
|
7603
|
-
return new Promise(function(
|
|
8803
|
+
return new Promise(function(resolve7, reject) {
|
|
7604
8804
|
var subscriber = new SafeSubscriber({
|
|
7605
8805
|
next: function(value) {
|
|
7606
|
-
|
|
8806
|
+
resolve7(value);
|
|
7607
8807
|
subscriber.unsubscribe();
|
|
7608
8808
|
},
|
|
7609
8809
|
error: reject,
|
|
7610
8810
|
complete: function() {
|
|
7611
8811
|
if (hasConfig) {
|
|
7612
|
-
|
|
8812
|
+
resolve7(config22.defaultValue);
|
|
7613
8813
|
} else {
|
|
7614
8814
|
reject(new EmptyError);
|
|
7615
8815
|
}
|
|
@@ -8661,7 +9861,7 @@ var init_rxjs = __esm(() => {
|
|
|
8661
9861
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
8662
9862
|
var _this = this;
|
|
8663
9863
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
8664
|
-
return new promiseCtor(function(
|
|
9864
|
+
return new promiseCtor(function(resolve7, reject) {
|
|
8665
9865
|
var subscriber = new SafeSubscriber({
|
|
8666
9866
|
next: function(value) {
|
|
8667
9867
|
try {
|
|
@@ -8672,7 +9872,7 @@ var init_rxjs = __esm(() => {
|
|
|
8672
9872
|
}
|
|
8673
9873
|
},
|
|
8674
9874
|
error: reject,
|
|
8675
|
-
complete:
|
|
9875
|
+
complete: resolve7
|
|
8676
9876
|
});
|
|
8677
9877
|
_this.subscribe(subscriber);
|
|
8678
9878
|
});
|
|
@@ -8694,14 +9894,14 @@ var init_rxjs = __esm(() => {
|
|
|
8694
9894
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
8695
9895
|
var _this = this;
|
|
8696
9896
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
8697
|
-
return new promiseCtor(function(
|
|
9897
|
+
return new promiseCtor(function(resolve7, reject) {
|
|
8698
9898
|
var value;
|
|
8699
9899
|
_this.subscribe(function(x) {
|
|
8700
9900
|
return value = x;
|
|
8701
9901
|
}, function(err) {
|
|
8702
9902
|
return reject(err);
|
|
8703
9903
|
}, function() {
|
|
8704
|
-
return
|
|
9904
|
+
return resolve7(value);
|
|
8705
9905
|
});
|
|
8706
9906
|
});
|
|
8707
9907
|
};
|
|
@@ -10627,8 +11827,8 @@ class Deferred {
|
|
|
10627
11827
|
#isRejected = false;
|
|
10628
11828
|
#value;
|
|
10629
11829
|
#resolve;
|
|
10630
|
-
#taskPromise = new Promise((
|
|
10631
|
-
this.#resolve =
|
|
11830
|
+
#taskPromise = new Promise((resolve7) => {
|
|
11831
|
+
this.#resolve = resolve7;
|
|
10632
11832
|
});
|
|
10633
11833
|
#timeoutId;
|
|
10634
11834
|
#timeoutError;
|
|
@@ -10717,12 +11917,12 @@ var init_Mutex = __esm(() => {
|
|
|
10717
11917
|
return new Mutex.Guard(this, onRelease);
|
|
10718
11918
|
}
|
|
10719
11919
|
release() {
|
|
10720
|
-
const
|
|
10721
|
-
if (!
|
|
11920
|
+
const resolve7 = this.#acquirers.shift();
|
|
11921
|
+
if (!resolve7) {
|
|
10722
11922
|
this.#locked = false;
|
|
10723
11923
|
return;
|
|
10724
11924
|
}
|
|
10725
|
-
|
|
11925
|
+
resolve7();
|
|
10726
11926
|
}
|
|
10727
11927
|
};
|
|
10728
11928
|
});
|
|
@@ -12466,12 +13666,12 @@ var init_locators = __esm(() => {
|
|
|
12466
13666
|
}
|
|
12467
13667
|
return defer(() => {
|
|
12468
13668
|
return from(handle.evaluate((element) => {
|
|
12469
|
-
return new Promise((
|
|
13669
|
+
return new Promise((resolve7) => {
|
|
12470
13670
|
window.requestAnimationFrame(() => {
|
|
12471
13671
|
const rect1 = element.getBoundingClientRect();
|
|
12472
13672
|
window.requestAnimationFrame(() => {
|
|
12473
13673
|
const rect2 = element.getBoundingClientRect();
|
|
12474
|
-
|
|
13674
|
+
resolve7([
|
|
12475
13675
|
{
|
|
12476
13676
|
x: rect1.x,
|
|
12477
13677
|
y: rect1.y,
|
|
@@ -13762,9 +14962,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
13762
14962
|
const handle = await this.#asSVGElementHandle();
|
|
13763
14963
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
13764
14964
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
13765
|
-
const visibleRatio = await new Promise((
|
|
14965
|
+
const visibleRatio = await new Promise((resolve7) => {
|
|
13766
14966
|
const observer = new IntersectionObserver((entries) => {
|
|
13767
|
-
|
|
14967
|
+
resolve7(entries[0].intersectionRatio);
|
|
13768
14968
|
observer.disconnect();
|
|
13769
14969
|
});
|
|
13770
14970
|
observer.observe(element);
|
|
@@ -14158,7 +15358,7 @@ var init_Frame = __esm(() => {
|
|
|
14158
15358
|
}
|
|
14159
15359
|
type = type ?? "text/javascript";
|
|
14160
15360
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
14161
|
-
return await new Promise((
|
|
15361
|
+
return await new Promise((resolve7, reject) => {
|
|
14162
15362
|
const script = document.createElement("script");
|
|
14163
15363
|
script.type = type2;
|
|
14164
15364
|
script.text = content2;
|
|
@@ -14171,12 +15371,12 @@ var init_Frame = __esm(() => {
|
|
|
14171
15371
|
if (url) {
|
|
14172
15372
|
script.src = url;
|
|
14173
15373
|
script.addEventListener("load", () => {
|
|
14174
|
-
|
|
15374
|
+
resolve7(script);
|
|
14175
15375
|
}, { once: true });
|
|
14176
15376
|
document.head.appendChild(script);
|
|
14177
15377
|
} else {
|
|
14178
15378
|
document.head.appendChild(script);
|
|
14179
|
-
|
|
15379
|
+
resolve7(script);
|
|
14180
15380
|
}
|
|
14181
15381
|
});
|
|
14182
15382
|
}, { ...options, type, content }));
|
|
@@ -14193,7 +15393,7 @@ var init_Frame = __esm(() => {
|
|
|
14193
15393
|
options.content = content;
|
|
14194
15394
|
}
|
|
14195
15395
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
14196
|
-
return await new Promise((
|
|
15396
|
+
return await new Promise((resolve7, reject) => {
|
|
14197
15397
|
let element;
|
|
14198
15398
|
if (!url) {
|
|
14199
15399
|
element = document.createElement("style");
|
|
@@ -14205,7 +15405,7 @@ var init_Frame = __esm(() => {
|
|
|
14205
15405
|
element = link;
|
|
14206
15406
|
}
|
|
14207
15407
|
element.addEventListener("load", () => {
|
|
14208
|
-
|
|
15408
|
+
resolve7(element);
|
|
14209
15409
|
}, { once: true });
|
|
14210
15410
|
element.addEventListener("error", (event) => {
|
|
14211
15411
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -15059,9 +16259,9 @@ var init_Page = __esm(() => {
|
|
|
15059
16259
|
++this.#screencastSessionCount;
|
|
15060
16260
|
if (!this.#startScreencastPromise) {
|
|
15061
16261
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
15062
|
-
return new Promise((
|
|
16262
|
+
return new Promise((resolve7) => {
|
|
15063
16263
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
15064
|
-
return
|
|
16264
|
+
return resolve7();
|
|
15065
16265
|
});
|
|
15066
16266
|
});
|
|
15067
16267
|
});
|
|
@@ -17719,11 +18919,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
17719
18919
|
return value instanceof Node;
|
|
17720
18920
|
})
|
|
17721
18921
|
}));
|
|
17722
|
-
return new Promise((
|
|
18922
|
+
return new Promise((resolve7, reject) => {
|
|
17723
18923
|
callPuppeteer.callbacks.set(seq, {
|
|
17724
18924
|
resolve(value) {
|
|
17725
18925
|
callPuppeteer.args.delete(seq);
|
|
17726
|
-
|
|
18926
|
+
resolve7(value);
|
|
17727
18927
|
},
|
|
17728
18928
|
reject(value) {
|
|
17729
18929
|
callPuppeteer.args.delete(seq);
|
|
@@ -21186,8 +22386,8 @@ var init_Input2 = __esm(() => {
|
|
|
21186
22386
|
if (typeof delay === "number") {
|
|
21187
22387
|
await Promise.all(actions);
|
|
21188
22388
|
actions.length = 0;
|
|
21189
|
-
await new Promise((
|
|
21190
|
-
setTimeout(
|
|
22389
|
+
await new Promise((resolve7) => {
|
|
22390
|
+
setTimeout(resolve7, delay);
|
|
21191
22391
|
});
|
|
21192
22392
|
}
|
|
21193
22393
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -21207,9 +22407,9 @@ var init_Input2 = __esm(() => {
|
|
|
21207
22407
|
});
|
|
21208
22408
|
}
|
|
21209
22409
|
async drag(start, target) {
|
|
21210
|
-
const promise = new Promise((
|
|
22410
|
+
const promise = new Promise((resolve7) => {
|
|
21211
22411
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
21212
|
-
return
|
|
22412
|
+
return resolve7(event.data);
|
|
21213
22413
|
});
|
|
21214
22414
|
});
|
|
21215
22415
|
await this.move(start.x, start.y);
|
|
@@ -21250,8 +22450,8 @@ var init_Input2 = __esm(() => {
|
|
|
21250
22450
|
await this.dragEnter(target, data);
|
|
21251
22451
|
await this.dragOver(target, data);
|
|
21252
22452
|
if (delay) {
|
|
21253
|
-
await new Promise((
|
|
21254
|
-
return setTimeout(
|
|
22453
|
+
await new Promise((resolve7) => {
|
|
22454
|
+
return setTimeout(resolve7, delay);
|
|
21255
22455
|
});
|
|
21256
22456
|
}
|
|
21257
22457
|
await this.drop(target, data);
|
|
@@ -22063,9 +23263,9 @@ var init_Page2 = __esm(() => {
|
|
|
22063
23263
|
async captureHeapSnapshot(options) {
|
|
22064
23264
|
const { createWriteStream } = environment.value.fs;
|
|
22065
23265
|
const stream = createWriteStream(options.path);
|
|
22066
|
-
const streamPromise = new Promise((
|
|
23266
|
+
const streamPromise = new Promise((resolve7, reject) => {
|
|
22067
23267
|
stream.on("error", reject);
|
|
22068
|
-
stream.on("finish",
|
|
23268
|
+
stream.on("finish", resolve7);
|
|
22069
23269
|
});
|
|
22070
23270
|
const client = this.#primaryTargetClient;
|
|
22071
23271
|
await client.send("HeapProfiler.enable");
|
|
@@ -23578,10 +24778,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
23578
24778
|
|
|
23579
24779
|
class BrowserWebSocketTransport {
|
|
23580
24780
|
static create(url) {
|
|
23581
|
-
return new Promise((
|
|
24781
|
+
return new Promise((resolve7, reject) => {
|
|
23582
24782
|
const ws = new WebSocket(url);
|
|
23583
24783
|
ws.addEventListener("open", () => {
|
|
23584
|
-
return
|
|
24784
|
+
return resolve7(new BrowserWebSocketTransport(ws));
|
|
23585
24785
|
});
|
|
23586
24786
|
ws.addEventListener("error", reject);
|
|
23587
24787
|
});
|
|
@@ -26415,11 +27615,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
26415
27615
|
}
|
|
26416
27616
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
26417
27617
|
try {
|
|
26418
|
-
const detachedFromTargetPromise = new Promise((
|
|
27618
|
+
const detachedFromTargetPromise = new Promise((resolve7) => {
|
|
26419
27619
|
const onContextDestroyed = (event) => {
|
|
26420
27620
|
if (event.targetId === params.context) {
|
|
26421
27621
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
26422
|
-
|
|
27622
|
+
resolve7();
|
|
26423
27623
|
}
|
|
26424
27624
|
};
|
|
26425
27625
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -27739,7 +28939,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
27739
28939
|
}
|
|
27740
28940
|
}
|
|
27741
28941
|
const promises = [
|
|
27742
|
-
new Promise((
|
|
28942
|
+
new Promise((resolve7) => setTimeout(resolve7, this.#tickDuration))
|
|
27743
28943
|
];
|
|
27744
28944
|
for (const option of options) {
|
|
27745
28945
|
promises.push(this.#dispatchAction(option));
|
|
@@ -28338,8 +29538,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
28338
29538
|
acquire() {
|
|
28339
29539
|
const state = { resolved: false };
|
|
28340
29540
|
if (this.#locked) {
|
|
28341
|
-
return new Promise((
|
|
28342
|
-
this.#acquirers.push(() =>
|
|
29541
|
+
return new Promise((resolve7) => {
|
|
29542
|
+
this.#acquirers.push(() => resolve7(this.#release.bind(this, state)));
|
|
28343
29543
|
});
|
|
28344
29544
|
}
|
|
28345
29545
|
this.#locked = true;
|
|
@@ -28350,12 +29550,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
28350
29550
|
throw new Error("Cannot release more than once.");
|
|
28351
29551
|
}
|
|
28352
29552
|
state.resolved = true;
|
|
28353
|
-
const
|
|
28354
|
-
if (!
|
|
29553
|
+
const resolve7 = this.#acquirers.shift();
|
|
29554
|
+
if (!resolve7) {
|
|
28355
29555
|
this.#locked = false;
|
|
28356
29556
|
return;
|
|
28357
29557
|
}
|
|
28358
|
-
|
|
29558
|
+
resolve7();
|
|
28359
29559
|
}
|
|
28360
29560
|
async run(action) {
|
|
28361
29561
|
const release = await this.acquire();
|
|
@@ -29482,8 +30682,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
29482
30682
|
let queueNonEmptyResolver = null;
|
|
29483
30683
|
return {
|
|
29484
30684
|
async getMessage() {
|
|
29485
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
29486
|
-
queueNonEmptyResolver =
|
|
30685
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve7) => {
|
|
30686
|
+
queueNonEmptyResolver = resolve7;
|
|
29487
30687
|
});
|
|
29488
30688
|
await onMessage;
|
|
29489
30689
|
return queue.shift();
|
|
@@ -29569,7 +30769,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
29569
30769
|
functionDeclaration: String((id) => {
|
|
29570
30770
|
const w = window;
|
|
29571
30771
|
if (w[id] === undefined) {
|
|
29572
|
-
return new Promise((
|
|
30772
|
+
return new Promise((resolve7) => w[id] = resolve7);
|
|
29573
30773
|
}
|
|
29574
30774
|
const channelProxy = w[id];
|
|
29575
30775
|
delete w[id];
|
|
@@ -30920,8 +32120,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
30920
32120
|
return this.#result;
|
|
30921
32121
|
}
|
|
30922
32122
|
constructor() {
|
|
30923
|
-
this.#promise = new Promise((
|
|
30924
|
-
this.#resolve =
|
|
32123
|
+
this.#promise = new Promise((resolve7, reject) => {
|
|
32124
|
+
this.#resolve = resolve7;
|
|
30925
32125
|
this.#reject = reject;
|
|
30926
32126
|
});
|
|
30927
32127
|
this.#promise.catch((_error) => {});
|
|
@@ -35246,11 +36446,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
35246
36446
|
if (this.#contexts.has(browsingContextId)) {
|
|
35247
36447
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
35248
36448
|
}
|
|
35249
|
-
return new Promise((
|
|
36449
|
+
return new Promise((resolve7) => {
|
|
35250
36450
|
const listener = (event) => {
|
|
35251
36451
|
if (event.browsingContext.id === browsingContextId) {
|
|
35252
36452
|
this.#eventEmitter.off("added", listener);
|
|
35253
|
-
|
|
36453
|
+
resolve7(event.browsingContext);
|
|
35254
36454
|
}
|
|
35255
36455
|
};
|
|
35256
36456
|
this.#eventEmitter.on("added", listener);
|
|
@@ -38746,8 +39946,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
38746
39946
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
38747
39947
|
Object.assign(globalThis, {
|
|
38748
39948
|
[PLACEHOLDER("name")]: function(...args) {
|
|
38749
|
-
return new Promise((
|
|
38750
|
-
callback([
|
|
39949
|
+
return new Promise((resolve7, reject) => {
|
|
39950
|
+
callback([resolve7, reject, args]);
|
|
38751
39951
|
});
|
|
38752
39952
|
}
|
|
38753
39953
|
});
|
|
@@ -38835,8 +40035,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
38835
40035
|
return;
|
|
38836
40036
|
}
|
|
38837
40037
|
try {
|
|
38838
|
-
await dataHandle.evaluate(([
|
|
38839
|
-
|
|
40038
|
+
await dataHandle.evaluate(([resolve7], result2) => {
|
|
40039
|
+
resolve7(result2);
|
|
38840
40040
|
}, result);
|
|
38841
40041
|
} catch (error) {
|
|
38842
40042
|
debugError(error);
|
|
@@ -46128,7 +47328,7 @@ __export(exports_NodeWebSocketTransport, {
|
|
|
46128
47328
|
|
|
46129
47329
|
class NodeWebSocketTransport {
|
|
46130
47330
|
static create(url, headers) {
|
|
46131
|
-
return new Promise((
|
|
47331
|
+
return new Promise((resolve7, reject) => {
|
|
46132
47332
|
const ws = new wrapper_default(url, [], {
|
|
46133
47333
|
followRedirects: true,
|
|
46134
47334
|
perMessageDeflate: false,
|
|
@@ -46140,7 +47340,7 @@ class NodeWebSocketTransport {
|
|
|
46140
47340
|
}
|
|
46141
47341
|
});
|
|
46142
47342
|
ws.addEventListener("open", () => {
|
|
46143
|
-
return
|
|
47343
|
+
return resolve7(new NodeWebSocketTransport(ws));
|
|
46144
47344
|
});
|
|
46145
47345
|
ws.addEventListener("error", reject);
|
|
46146
47346
|
});
|
|
@@ -49032,8 +50232,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
49032
50232
|
function req(url, opts = {}) {
|
|
49033
50233
|
const href = typeof url === "string" ? url : url.href;
|
|
49034
50234
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
49035
|
-
const promise = new Promise((
|
|
49036
|
-
req2.once("response",
|
|
50235
|
+
const promise = new Promise((resolve7, reject) => {
|
|
50236
|
+
req2.once("response", resolve7).once("error", reject).end();
|
|
49037
50237
|
});
|
|
49038
50238
|
req2.then = promise.then.bind(promise);
|
|
49039
50239
|
return req2;
|
|
@@ -49404,7 +50604,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
49404
50604
|
var debug_1 = __importDefault(require_src());
|
|
49405
50605
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
49406
50606
|
function parseProxyResponse(socket) {
|
|
49407
|
-
return new Promise((
|
|
50607
|
+
return new Promise((resolve7, reject) => {
|
|
49408
50608
|
let buffersLength = 0;
|
|
49409
50609
|
const buffers = [];
|
|
49410
50610
|
function read() {
|
|
@@ -49473,7 +50673,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
49473
50673
|
}
|
|
49474
50674
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
49475
50675
|
cleanup();
|
|
49476
|
-
|
|
50676
|
+
resolve7({
|
|
49477
50677
|
connect: {
|
|
49478
50678
|
statusCode,
|
|
49479
50679
|
statusText,
|
|
@@ -51577,11 +52777,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
51577
52777
|
var require_socksclient = __commonJS((exports) => {
|
|
51578
52778
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
51579
52779
|
function adopt(value) {
|
|
51580
|
-
return value instanceof P ? value : new P(function(
|
|
51581
|
-
|
|
52780
|
+
return value instanceof P ? value : new P(function(resolve7) {
|
|
52781
|
+
resolve7(value);
|
|
51582
52782
|
});
|
|
51583
52783
|
}
|
|
51584
|
-
return new (P || (P = Promise))(function(
|
|
52784
|
+
return new (P || (P = Promise))(function(resolve7, reject) {
|
|
51585
52785
|
function fulfilled(value) {
|
|
51586
52786
|
try {
|
|
51587
52787
|
step(generator.next(value));
|
|
@@ -51597,7 +52797,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
51597
52797
|
}
|
|
51598
52798
|
}
|
|
51599
52799
|
function step(result) {
|
|
51600
|
-
result.done ?
|
|
52800
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
51601
52801
|
}
|
|
51602
52802
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51603
52803
|
});
|
|
@@ -51624,13 +52824,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
51624
52824
|
this.setState(constants_1.SocksClientState.Created);
|
|
51625
52825
|
}
|
|
51626
52826
|
static createConnection(options, callback) {
|
|
51627
|
-
return new Promise((
|
|
52827
|
+
return new Promise((resolve7, reject) => {
|
|
51628
52828
|
try {
|
|
51629
52829
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
51630
52830
|
} catch (err) {
|
|
51631
52831
|
if (typeof callback === "function") {
|
|
51632
52832
|
callback(err);
|
|
51633
|
-
return
|
|
52833
|
+
return resolve7(err);
|
|
51634
52834
|
} else {
|
|
51635
52835
|
return reject(err);
|
|
51636
52836
|
}
|
|
@@ -51641,16 +52841,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
51641
52841
|
client.removeAllListeners();
|
|
51642
52842
|
if (typeof callback === "function") {
|
|
51643
52843
|
callback(null, info);
|
|
51644
|
-
|
|
52844
|
+
resolve7(info);
|
|
51645
52845
|
} else {
|
|
51646
|
-
|
|
52846
|
+
resolve7(info);
|
|
51647
52847
|
}
|
|
51648
52848
|
});
|
|
51649
52849
|
client.once("error", (err) => {
|
|
51650
52850
|
client.removeAllListeners();
|
|
51651
52851
|
if (typeof callback === "function") {
|
|
51652
52852
|
callback(err);
|
|
51653
|
-
|
|
52853
|
+
resolve7(err);
|
|
51654
52854
|
} else {
|
|
51655
52855
|
reject(err);
|
|
51656
52856
|
}
|
|
@@ -51658,13 +52858,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
51658
52858
|
});
|
|
51659
52859
|
}
|
|
51660
52860
|
static createConnectionChain(options, callback) {
|
|
51661
|
-
return new Promise((
|
|
52861
|
+
return new Promise((resolve7, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
51662
52862
|
try {
|
|
51663
52863
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
51664
52864
|
} catch (err) {
|
|
51665
52865
|
if (typeof callback === "function") {
|
|
51666
52866
|
callback(err);
|
|
51667
|
-
return
|
|
52867
|
+
return resolve7(err);
|
|
51668
52868
|
} else {
|
|
51669
52869
|
return reject(err);
|
|
51670
52870
|
}
|
|
@@ -51690,14 +52890,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
51690
52890
|
}
|
|
51691
52891
|
if (typeof callback === "function") {
|
|
51692
52892
|
callback(null, { socket: sock });
|
|
51693
|
-
|
|
52893
|
+
resolve7({ socket: sock });
|
|
51694
52894
|
} else {
|
|
51695
|
-
|
|
52895
|
+
resolve7({ socket: sock });
|
|
51696
52896
|
}
|
|
51697
52897
|
} catch (err) {
|
|
51698
52898
|
if (typeof callback === "function") {
|
|
51699
52899
|
callback(err);
|
|
51700
|
-
|
|
52900
|
+
resolve7(err);
|
|
51701
52901
|
} else {
|
|
51702
52902
|
reject(err);
|
|
51703
52903
|
}
|
|
@@ -52297,12 +53497,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
52297
53497
|
let { host } = opts;
|
|
52298
53498
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
52299
53499
|
if (shouldLookup) {
|
|
52300
|
-
host = await new Promise((
|
|
53500
|
+
host = await new Promise((resolve7, reject) => {
|
|
52301
53501
|
lookupFn(host, {}, (err, res) => {
|
|
52302
53502
|
if (err) {
|
|
52303
53503
|
reject(err);
|
|
52304
53504
|
} else {
|
|
52305
|
-
|
|
53505
|
+
resolve7(res);
|
|
52306
53506
|
}
|
|
52307
53507
|
});
|
|
52308
53508
|
});
|
|
@@ -53309,7 +54509,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
53309
54509
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
53310
54510
|
}
|
|
53311
54511
|
function upgradeSocket(socket, options) {
|
|
53312
|
-
return new Promise((
|
|
54512
|
+
return new Promise((resolve7, reject) => {
|
|
53313
54513
|
const tlsOptions = Object.assign({}, options, {
|
|
53314
54514
|
socket
|
|
53315
54515
|
});
|
|
@@ -53319,7 +54519,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
53319
54519
|
reject(tlsSocket.authorizationError);
|
|
53320
54520
|
} else {
|
|
53321
54521
|
tlsSocket.removeAllListeners("error");
|
|
53322
|
-
|
|
54522
|
+
resolve7(tlsSocket);
|
|
53323
54523
|
}
|
|
53324
54524
|
}).once("error", (error) => {
|
|
53325
54525
|
reject(error);
|
|
@@ -53411,7 +54611,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
53411
54611
|
};
|
|
53412
54612
|
}
|
|
53413
54613
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
53414
|
-
return new Promise((
|
|
54614
|
+
return new Promise((resolve7, reject) => {
|
|
53415
54615
|
let socket = ftp._newSocket();
|
|
53416
54616
|
const handleConnErr = function(err) {
|
|
53417
54617
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -53434,7 +54634,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
53434
54634
|
socket.removeListener("error", handleConnErr);
|
|
53435
54635
|
socket.removeListener("timeout", handleTimeout);
|
|
53436
54636
|
ftp.dataSocket = socket;
|
|
53437
|
-
|
|
54637
|
+
resolve7();
|
|
53438
54638
|
});
|
|
53439
54639
|
});
|
|
53440
54640
|
}
|
|
@@ -55474,7 +56674,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
55474
56674
|
return url;
|
|
55475
56675
|
}
|
|
55476
56676
|
exports.urlGenerate = urlGenerate;
|
|
55477
|
-
function
|
|
56677
|
+
function normalize2(aPath) {
|
|
55478
56678
|
var path = aPath;
|
|
55479
56679
|
var url = urlParse(aPath);
|
|
55480
56680
|
if (url) {
|
|
@@ -55511,8 +56711,8 @@ var require_util2 = __commonJS((exports) => {
|
|
|
55511
56711
|
}
|
|
55512
56712
|
return path;
|
|
55513
56713
|
}
|
|
55514
|
-
exports.normalize =
|
|
55515
|
-
function
|
|
56714
|
+
exports.normalize = normalize2;
|
|
56715
|
+
function join25(aRoot, aPath) {
|
|
55516
56716
|
if (aRoot === "") {
|
|
55517
56717
|
aRoot = ".";
|
|
55518
56718
|
}
|
|
@@ -55537,14 +56737,14 @@ var require_util2 = __commonJS((exports) => {
|
|
|
55537
56737
|
aRootUrl.host = aPath;
|
|
55538
56738
|
return urlGenerate(aRootUrl);
|
|
55539
56739
|
}
|
|
55540
|
-
var joined = aPath.charAt(0) === "/" ? aPath :
|
|
56740
|
+
var joined = aPath.charAt(0) === "/" ? aPath : normalize2(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
|
55541
56741
|
if (aRootUrl) {
|
|
55542
56742
|
aRootUrl.path = joined;
|
|
55543
56743
|
return urlGenerate(aRootUrl);
|
|
55544
56744
|
}
|
|
55545
56745
|
return joined;
|
|
55546
56746
|
}
|
|
55547
|
-
exports.join =
|
|
56747
|
+
exports.join = join25;
|
|
55548
56748
|
exports.isAbsolute = function(aPath) {
|
|
55549
56749
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
55550
56750
|
};
|
|
@@ -55717,9 +56917,9 @@ var require_util2 = __commonJS((exports) => {
|
|
|
55717
56917
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
55718
56918
|
}
|
|
55719
56919
|
}
|
|
55720
|
-
sourceURL =
|
|
56920
|
+
sourceURL = join25(urlGenerate(parsed), sourceURL);
|
|
55721
56921
|
}
|
|
55722
|
-
return
|
|
56922
|
+
return normalize2(sourceURL);
|
|
55723
56923
|
}
|
|
55724
56924
|
exports.computeSourceURL = computeSourceURL;
|
|
55725
56925
|
});
|
|
@@ -57449,7 +58649,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57449
58649
|
function noEmptySpace() {
|
|
57450
58650
|
return space ? space : " ";
|
|
57451
58651
|
}
|
|
57452
|
-
function
|
|
58652
|
+
function join25(left, right) {
|
|
57453
58653
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
57454
58654
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
57455
58655
|
if (leftSource.length === 0) {
|
|
@@ -57790,8 +58990,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57790
58990
|
} else {
|
|
57791
58991
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
57792
58992
|
}
|
|
57793
|
-
result =
|
|
57794
|
-
result = [
|
|
58993
|
+
result = join25(result, operator);
|
|
58994
|
+
result = [join25(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
57795
58995
|
});
|
|
57796
58996
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
57797
58997
|
return result;
|
|
@@ -57929,11 +59129,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57929
59129
|
var result, fragment;
|
|
57930
59130
|
result = ["class"];
|
|
57931
59131
|
if (stmt.id) {
|
|
57932
|
-
result =
|
|
59132
|
+
result = join25(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
57933
59133
|
}
|
|
57934
59134
|
if (stmt.superClass) {
|
|
57935
|
-
fragment =
|
|
57936
|
-
result =
|
|
59135
|
+
fragment = join25("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
59136
|
+
result = join25(result, fragment);
|
|
57937
59137
|
}
|
|
57938
59138
|
result.push(space);
|
|
57939
59139
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -57946,9 +59146,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57946
59146
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
57947
59147
|
},
|
|
57948
59148
|
DoWhileStatement: function(stmt, flags) {
|
|
57949
|
-
var result =
|
|
59149
|
+
var result = join25("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
57950
59150
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
57951
|
-
return
|
|
59151
|
+
return join25(result, [
|
|
57952
59152
|
"while" + space + "(",
|
|
57953
59153
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
57954
59154
|
")" + this.semicolon(flags)
|
|
@@ -57984,11 +59184,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57984
59184
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
57985
59185
|
var result = ["export"], bodyFlags;
|
|
57986
59186
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
57987
|
-
result =
|
|
59187
|
+
result = join25(result, "default");
|
|
57988
59188
|
if (isStatement(stmt.declaration)) {
|
|
57989
|
-
result =
|
|
59189
|
+
result = join25(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
57990
59190
|
} else {
|
|
57991
|
-
result =
|
|
59191
|
+
result = join25(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
57992
59192
|
}
|
|
57993
59193
|
return result;
|
|
57994
59194
|
},
|
|
@@ -57996,15 +59196,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
57996
59196
|
var result = ["export"], bodyFlags, that = this;
|
|
57997
59197
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
57998
59198
|
if (stmt.declaration) {
|
|
57999
|
-
return
|
|
59199
|
+
return join25(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
58000
59200
|
}
|
|
58001
59201
|
if (stmt.specifiers) {
|
|
58002
59202
|
if (stmt.specifiers.length === 0) {
|
|
58003
|
-
result =
|
|
59203
|
+
result = join25(result, "{" + space + "}");
|
|
58004
59204
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
58005
|
-
result =
|
|
59205
|
+
result = join25(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
58006
59206
|
} else {
|
|
58007
|
-
result =
|
|
59207
|
+
result = join25(result, "{");
|
|
58008
59208
|
withIndent(function(indent2) {
|
|
58009
59209
|
var i, iz;
|
|
58010
59210
|
result.push(newline);
|
|
@@ -58022,7 +59222,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58022
59222
|
result.push(base + "}");
|
|
58023
59223
|
}
|
|
58024
59224
|
if (stmt.source) {
|
|
58025
|
-
result =
|
|
59225
|
+
result = join25(result, [
|
|
58026
59226
|
"from" + space,
|
|
58027
59227
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
58028
59228
|
this.semicolon(flags)
|
|
@@ -58106,7 +59306,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58106
59306
|
];
|
|
58107
59307
|
cursor = 0;
|
|
58108
59308
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
58109
|
-
result =
|
|
59309
|
+
result = join25(result, [
|
|
58110
59310
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
58111
59311
|
]);
|
|
58112
59312
|
++cursor;
|
|
@@ -58116,7 +59316,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58116
59316
|
result.push(",");
|
|
58117
59317
|
}
|
|
58118
59318
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
58119
|
-
result =
|
|
59319
|
+
result = join25(result, [
|
|
58120
59320
|
space,
|
|
58121
59321
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
58122
59322
|
]);
|
|
@@ -58145,7 +59345,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58145
59345
|
}
|
|
58146
59346
|
}
|
|
58147
59347
|
}
|
|
58148
|
-
result =
|
|
59348
|
+
result = join25(result, [
|
|
58149
59349
|
"from" + space,
|
|
58150
59350
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
58151
59351
|
this.semicolon(flags)
|
|
@@ -58199,7 +59399,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58199
59399
|
return result;
|
|
58200
59400
|
},
|
|
58201
59401
|
ThrowStatement: function(stmt, flags) {
|
|
58202
|
-
return [
|
|
59402
|
+
return [join25("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
58203
59403
|
},
|
|
58204
59404
|
TryStatement: function(stmt, flags) {
|
|
58205
59405
|
var result, i, iz, guardedHandlers;
|
|
@@ -58207,7 +59407,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58207
59407
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
58208
59408
|
if (stmt.handlers) {
|
|
58209
59409
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
58210
|
-
result =
|
|
59410
|
+
result = join25(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
58211
59411
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
58212
59412
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
58213
59413
|
}
|
|
@@ -58215,7 +59415,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58215
59415
|
} else {
|
|
58216
59416
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
58217
59417
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
58218
|
-
result =
|
|
59418
|
+
result = join25(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
58219
59419
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
58220
59420
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
58221
59421
|
}
|
|
@@ -58223,13 +59423,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58223
59423
|
if (stmt.handler) {
|
|
58224
59424
|
if (Array.isArray(stmt.handler)) {
|
|
58225
59425
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
58226
|
-
result =
|
|
59426
|
+
result = join25(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
58227
59427
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
58228
59428
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
58229
59429
|
}
|
|
58230
59430
|
}
|
|
58231
59431
|
} else {
|
|
58232
|
-
result =
|
|
59432
|
+
result = join25(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
58233
59433
|
if (stmt.finalizer) {
|
|
58234
59434
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
58235
59435
|
}
|
|
@@ -58237,7 +59437,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58237
59437
|
}
|
|
58238
59438
|
}
|
|
58239
59439
|
if (stmt.finalizer) {
|
|
58240
|
-
result =
|
|
59440
|
+
result = join25(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
58241
59441
|
}
|
|
58242
59442
|
return result;
|
|
58243
59443
|
},
|
|
@@ -58271,7 +59471,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58271
59471
|
withIndent(function() {
|
|
58272
59472
|
if (stmt.test) {
|
|
58273
59473
|
result = [
|
|
58274
|
-
|
|
59474
|
+
join25("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
58275
59475
|
":"
|
|
58276
59476
|
];
|
|
58277
59477
|
} else {
|
|
@@ -58319,9 +59519,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58319
59519
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
58320
59520
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
58321
59521
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
58322
|
-
result =
|
|
59522
|
+
result = join25(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
58323
59523
|
} else {
|
|
58324
|
-
result =
|
|
59524
|
+
result = join25(result, join25("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
58325
59525
|
}
|
|
58326
59526
|
} else {
|
|
58327
59527
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -58423,7 +59623,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58423
59623
|
},
|
|
58424
59624
|
ReturnStatement: function(stmt, flags) {
|
|
58425
59625
|
if (stmt.argument) {
|
|
58426
|
-
return [
|
|
59626
|
+
return [join25("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
58427
59627
|
}
|
|
58428
59628
|
return ["return" + this.semicolon(flags)];
|
|
58429
59629
|
},
|
|
@@ -58505,14 +59705,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58505
59705
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
58506
59706
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
58507
59707
|
} else {
|
|
58508
|
-
result =
|
|
59708
|
+
result = join25(fragment, expr.operator);
|
|
58509
59709
|
}
|
|
58510
59710
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
58511
59711
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
58512
59712
|
result.push(noEmptySpace());
|
|
58513
59713
|
result.push(fragment);
|
|
58514
59714
|
} else {
|
|
58515
|
-
result =
|
|
59715
|
+
result = join25(result, fragment);
|
|
58516
59716
|
}
|
|
58517
59717
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
58518
59718
|
return ["(", result, ")"];
|
|
@@ -58552,7 +59752,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58552
59752
|
var result, length, i, iz, itemFlags;
|
|
58553
59753
|
length = expr["arguments"].length;
|
|
58554
59754
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
58555
|
-
result =
|
|
59755
|
+
result = join25("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
58556
59756
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
58557
59757
|
result.push("(");
|
|
58558
59758
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -58599,11 +59799,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58599
59799
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
58600
59800
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
58601
59801
|
if (space === "") {
|
|
58602
|
-
result =
|
|
59802
|
+
result = join25(expr.operator, fragment);
|
|
58603
59803
|
} else {
|
|
58604
59804
|
result = [expr.operator];
|
|
58605
59805
|
if (expr.operator.length > 2) {
|
|
58606
|
-
result =
|
|
59806
|
+
result = join25(result, fragment);
|
|
58607
59807
|
} else {
|
|
58608
59808
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
58609
59809
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -58626,12 +59826,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58626
59826
|
result = "yield";
|
|
58627
59827
|
}
|
|
58628
59828
|
if (expr.argument) {
|
|
58629
|
-
result =
|
|
59829
|
+
result = join25(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
58630
59830
|
}
|
|
58631
59831
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
58632
59832
|
},
|
|
58633
59833
|
AwaitExpression: function(expr, precedence, flags) {
|
|
58634
|
-
var result =
|
|
59834
|
+
var result = join25(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
58635
59835
|
return parenthesize(result, Precedence.Await, precedence);
|
|
58636
59836
|
},
|
|
58637
59837
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -58703,11 +59903,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58703
59903
|
var result, fragment;
|
|
58704
59904
|
result = ["class"];
|
|
58705
59905
|
if (expr.id) {
|
|
58706
|
-
result =
|
|
59906
|
+
result = join25(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
58707
59907
|
}
|
|
58708
59908
|
if (expr.superClass) {
|
|
58709
|
-
fragment =
|
|
58710
|
-
result =
|
|
59909
|
+
fragment = join25("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
59910
|
+
result = join25(result, fragment);
|
|
58711
59911
|
}
|
|
58712
59912
|
result.push(space);
|
|
58713
59913
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -58722,7 +59922,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58722
59922
|
}
|
|
58723
59923
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
58724
59924
|
fragment = [
|
|
58725
|
-
|
|
59925
|
+
join25(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
58726
59926
|
this.generateFunctionBody(expr.value)
|
|
58727
59927
|
];
|
|
58728
59928
|
} else {
|
|
@@ -58732,7 +59932,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58732
59932
|
this.generateFunctionBody(expr.value)
|
|
58733
59933
|
];
|
|
58734
59934
|
}
|
|
58735
|
-
return
|
|
59935
|
+
return join25(result, fragment);
|
|
58736
59936
|
},
|
|
58737
59937
|
Property: function(expr, precedence, flags) {
|
|
58738
59938
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -58926,7 +60126,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58926
60126
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
58927
60127
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
58928
60128
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
58929
|
-
result =
|
|
60129
|
+
result = join25(result, fragment);
|
|
58930
60130
|
} else {
|
|
58931
60131
|
result.push(fragment);
|
|
58932
60132
|
}
|
|
@@ -58934,13 +60134,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58934
60134
|
});
|
|
58935
60135
|
}
|
|
58936
60136
|
if (expr.filter) {
|
|
58937
|
-
result =
|
|
60137
|
+
result = join25(result, "if" + space);
|
|
58938
60138
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
58939
|
-
result =
|
|
60139
|
+
result = join25(result, ["(", fragment, ")"]);
|
|
58940
60140
|
}
|
|
58941
60141
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
58942
60142
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
58943
|
-
result =
|
|
60143
|
+
result = join25(result, fragment);
|
|
58944
60144
|
}
|
|
58945
60145
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
58946
60146
|
return result;
|
|
@@ -58956,8 +60156,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58956
60156
|
} else {
|
|
58957
60157
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
58958
60158
|
}
|
|
58959
|
-
fragment =
|
|
58960
|
-
fragment =
|
|
60159
|
+
fragment = join25(fragment, expr.of ? "of" : "in");
|
|
60160
|
+
fragment = join25(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
58961
60161
|
return ["for" + space + "(", fragment, ")"];
|
|
58962
60162
|
},
|
|
58963
60163
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -65445,11 +66645,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
65445
66645
|
};
|
|
65446
66646
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
65447
66647
|
function adopt(value) {
|
|
65448
|
-
return value instanceof P ? value : new P(function(
|
|
65449
|
-
|
|
66648
|
+
return value instanceof P ? value : new P(function(resolve7) {
|
|
66649
|
+
resolve7(value);
|
|
65450
66650
|
});
|
|
65451
66651
|
}
|
|
65452
|
-
return new (P || (P = Promise))(function(
|
|
66652
|
+
return new (P || (P = Promise))(function(resolve7, reject) {
|
|
65453
66653
|
function fulfilled(value) {
|
|
65454
66654
|
try {
|
|
65455
66655
|
step(generator.next(value));
|
|
@@ -65465,7 +66665,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
65465
66665
|
}
|
|
65466
66666
|
}
|
|
65467
66667
|
function step(result) {
|
|
65468
|
-
result.done ?
|
|
66668
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
65469
66669
|
}
|
|
65470
66670
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
65471
66671
|
});
|
|
@@ -65694,14 +66894,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
65694
66894
|
}, i);
|
|
65695
66895
|
function verb(n) {
|
|
65696
66896
|
i[n] = o[n] && function(v) {
|
|
65697
|
-
return new Promise(function(
|
|
65698
|
-
v = o[n](v), settle(
|
|
66897
|
+
return new Promise(function(resolve7, reject) {
|
|
66898
|
+
v = o[n](v), settle(resolve7, reject, v.done, v.value);
|
|
65699
66899
|
});
|
|
65700
66900
|
};
|
|
65701
66901
|
}
|
|
65702
|
-
function settle(
|
|
66902
|
+
function settle(resolve7, reject, d, v) {
|
|
65703
66903
|
Promise.resolve(v).then(function(v2) {
|
|
65704
|
-
|
|
66904
|
+
resolve7({ value: v2, done: d });
|
|
65705
66905
|
}, reject);
|
|
65706
66906
|
}
|
|
65707
66907
|
};
|
|
@@ -68940,12 +70140,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
68940
70140
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
68941
70141
|
var dns_1 = __require("dns");
|
|
68942
70142
|
function dnsLookup(host, opts) {
|
|
68943
|
-
return new Promise((
|
|
70143
|
+
return new Promise((resolve7, reject) => {
|
|
68944
70144
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
68945
70145
|
if (err) {
|
|
68946
70146
|
reject(err);
|
|
68947
70147
|
} else {
|
|
68948
|
-
|
|
70148
|
+
resolve7(res);
|
|
68949
70149
|
}
|
|
68950
70150
|
});
|
|
68951
70151
|
});
|
|
@@ -69519,10 +70719,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
69519
70719
|
var ip_1 = require_ip();
|
|
69520
70720
|
var net_1 = __importDefault(__require("net"));
|
|
69521
70721
|
async function myIpAddress() {
|
|
69522
|
-
return new Promise((
|
|
70722
|
+
return new Promise((resolve7, reject) => {
|
|
69523
70723
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
69524
70724
|
const onError = () => {
|
|
69525
|
-
|
|
70725
|
+
resolve7(ip_1.ip.address());
|
|
69526
70726
|
};
|
|
69527
70727
|
socket.once("error", onError);
|
|
69528
70728
|
socket.once("connect", () => {
|
|
@@ -69530,9 +70730,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
69530
70730
|
const addr = socket.address();
|
|
69531
70731
|
socket.destroy();
|
|
69532
70732
|
if (typeof addr === "string") {
|
|
69533
|
-
|
|
70733
|
+
resolve7(addr);
|
|
69534
70734
|
} else if (addr.address) {
|
|
69535
|
-
|
|
70735
|
+
resolve7(addr.address);
|
|
69536
70736
|
} else {
|
|
69537
70737
|
reject(new Error("Expected a `string`"));
|
|
69538
70738
|
}
|
|
@@ -70046,8 +71246,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
70046
71246
|
this.context = args.context;
|
|
70047
71247
|
this.owner = args.context.runtime;
|
|
70048
71248
|
this.handle = args.promiseHandle;
|
|
70049
|
-
this.settled = new Promise((
|
|
70050
|
-
this.onSettled =
|
|
71249
|
+
this.settled = new Promise((resolve7) => {
|
|
71250
|
+
this.onSettled = resolve7;
|
|
70051
71251
|
});
|
|
70052
71252
|
this.resolveHandle = args.resolveHandle;
|
|
70053
71253
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -70439,13 +71639,13 @@ var require_context = __commonJS((exports) => {
|
|
|
70439
71639
|
if (vmResolveResult.error) {
|
|
70440
71640
|
return Promise.resolve(vmResolveResult);
|
|
70441
71641
|
}
|
|
70442
|
-
return new Promise((
|
|
71642
|
+
return new Promise((resolve7) => {
|
|
70443
71643
|
lifetime_1.Scope.withScope((scope) => {
|
|
70444
71644
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
70445
|
-
|
|
71645
|
+
resolve7({ value: value && value.dup() });
|
|
70446
71646
|
}));
|
|
70447
71647
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
70448
|
-
|
|
71648
|
+
resolve7({ error: error && error.dup() });
|
|
70449
71649
|
}));
|
|
70450
71650
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
70451
71651
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -72559,13 +73759,13 @@ import * as http from "node:http";
|
|
|
72559
73759
|
import * as https from "node:https";
|
|
72560
73760
|
import { URL as URL2, urlToHttpOptions } from "node:url";
|
|
72561
73761
|
function headHttpRequest(url) {
|
|
72562
|
-
return new Promise((
|
|
73762
|
+
return new Promise((resolve7) => {
|
|
72563
73763
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
72564
73764
|
response.resume();
|
|
72565
|
-
|
|
73765
|
+
resolve7(response.statusCode === 200);
|
|
72566
73766
|
}, false);
|
|
72567
73767
|
request3.on("error", () => {
|
|
72568
|
-
|
|
73768
|
+
resolve7(false);
|
|
72569
73769
|
});
|
|
72570
73770
|
});
|
|
72571
73771
|
}
|
|
@@ -72593,7 +73793,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
72593
73793
|
return request3;
|
|
72594
73794
|
}
|
|
72595
73795
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
72596
|
-
return new Promise((
|
|
73796
|
+
return new Promise((resolve7, reject) => {
|
|
72597
73797
|
let downloadedBytes = 0;
|
|
72598
73798
|
let totalBytes = 0;
|
|
72599
73799
|
function onData(chunk) {
|
|
@@ -72609,7 +73809,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
72609
73809
|
}
|
|
72610
73810
|
const file = createWriteStream(destinationPath);
|
|
72611
73811
|
file.on("close", () => {
|
|
72612
|
-
return
|
|
73812
|
+
return resolve7();
|
|
72613
73813
|
});
|
|
72614
73814
|
file.on("error", (error) => {
|
|
72615
73815
|
return reject(error);
|
|
@@ -72634,7 +73834,7 @@ async function getJSON(url) {
|
|
|
72634
73834
|
}
|
|
72635
73835
|
}
|
|
72636
73836
|
function getText(url) {
|
|
72637
|
-
return new Promise((
|
|
73837
|
+
return new Promise((resolve7, reject) => {
|
|
72638
73838
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
72639
73839
|
let data = "";
|
|
72640
73840
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -72645,7 +73845,7 @@ function getText(url) {
|
|
|
72645
73845
|
});
|
|
72646
73846
|
response.on("end", () => {
|
|
72647
73847
|
try {
|
|
72648
|
-
return
|
|
73848
|
+
return resolve7(String(data));
|
|
72649
73849
|
} catch {
|
|
72650
73850
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
72651
73851
|
}
|
|
@@ -72662,7 +73862,7 @@ var init_httpUtil = __esm(() => {
|
|
|
72662
73862
|
});
|
|
72663
73863
|
|
|
72664
73864
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js
|
|
72665
|
-
import { execSync as
|
|
73865
|
+
import { execSync as execSync5 } from "node:child_process";
|
|
72666
73866
|
import os from "node:os";
|
|
72667
73867
|
import path from "node:path";
|
|
72668
73868
|
function folder(platform2) {
|
|
@@ -72752,7 +73952,7 @@ function getChromeWindowsLocation(channel2, locationsPrefixes) {
|
|
|
72752
73952
|
}
|
|
72753
73953
|
function getWslVariable(variable) {
|
|
72754
73954
|
try {
|
|
72755
|
-
const result =
|
|
73955
|
+
const result = execSync5(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
|
|
72756
73956
|
stdio: ["ignore", "pipe", "ignore"],
|
|
72757
73957
|
encoding: "utf-8"
|
|
72758
73958
|
}).trim();
|
|
@@ -72763,7 +73963,7 @@ function getWslVariable(variable) {
|
|
|
72763
73963
|
return;
|
|
72764
73964
|
}
|
|
72765
73965
|
function getWslLocation(channel2) {
|
|
72766
|
-
const wslVersion =
|
|
73966
|
+
const wslVersion = execSync5("wslinfo --version", {
|
|
72767
73967
|
stdio: ["ignore", "pipe", "ignore"],
|
|
72768
73968
|
encoding: "utf-8"
|
|
72769
73969
|
}).trim();
|
|
@@ -72779,7 +73979,7 @@ function getWslLocation(channel2) {
|
|
|
72779
73979
|
}
|
|
72780
73980
|
const windowsPath = getChromeWindowsLocation(channel2, wslPrefixes);
|
|
72781
73981
|
return windowsPath.map((path2) => {
|
|
72782
|
-
return
|
|
73982
|
+
return execSync5(`wslpath "${path2}"`).toString().trim();
|
|
72783
73983
|
});
|
|
72784
73984
|
}
|
|
72785
73985
|
function getChromeLinuxOrWslLocation(channel2) {
|
|
@@ -73866,7 +75066,7 @@ class Process {
|
|
|
73866
75066
|
if (opts.onExit) {
|
|
73867
75067
|
this.#onExitHook = opts.onExit;
|
|
73868
75068
|
}
|
|
73869
|
-
this.#browserProcessExiting = new Promise((
|
|
75069
|
+
this.#browserProcessExiting = new Promise((resolve7, reject) => {
|
|
73870
75070
|
this.#browserProcess.once("exit", async () => {
|
|
73871
75071
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
73872
75072
|
this.#clearListeners();
|
|
@@ -73877,7 +75077,7 @@ class Process {
|
|
|
73877
75077
|
reject(err);
|
|
73878
75078
|
return;
|
|
73879
75079
|
}
|
|
73880
|
-
|
|
75080
|
+
resolve7();
|
|
73881
75081
|
});
|
|
73882
75082
|
});
|
|
73883
75083
|
}
|
|
@@ -73987,7 +75187,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
73987
75187
|
return [...this.#logs];
|
|
73988
75188
|
}
|
|
73989
75189
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
73990
|
-
return new Promise((
|
|
75190
|
+
return new Promise((resolve7, reject) => {
|
|
73991
75191
|
const onClose = (errorOrCode) => {
|
|
73992
75192
|
cleanup();
|
|
73993
75193
|
reject(new Error([
|
|
@@ -74025,7 +75225,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
74025
75225
|
return;
|
|
74026
75226
|
}
|
|
74027
75227
|
cleanup();
|
|
74028
|
-
|
|
75228
|
+
resolve7(match[1]);
|
|
74029
75229
|
}
|
|
74030
75230
|
});
|
|
74031
75231
|
}
|
|
@@ -74555,7 +75755,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
74555
75755
|
};
|
|
74556
75756
|
const { maxBuffer } = options;
|
|
74557
75757
|
let stream;
|
|
74558
|
-
await new Promise((
|
|
75758
|
+
await new Promise((resolve7, reject) => {
|
|
74559
75759
|
const rejectPromise = (error) => {
|
|
74560
75760
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
74561
75761
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -74567,7 +75767,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
74567
75767
|
rejectPromise(error);
|
|
74568
75768
|
return;
|
|
74569
75769
|
}
|
|
74570
|
-
|
|
75770
|
+
resolve7();
|
|
74571
75771
|
});
|
|
74572
75772
|
stream.on("data", () => {
|
|
74573
75773
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -75928,7 +77128,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
75928
77128
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
75929
77129
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
75930
77130
|
this.canceled = false;
|
|
75931
|
-
return new Promise((
|
|
77131
|
+
return new Promise((resolve7, reject) => {
|
|
75932
77132
|
this.zipfile.on("error", (err) => {
|
|
75933
77133
|
this.canceled = true;
|
|
75934
77134
|
reject(err);
|
|
@@ -75937,7 +77137,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
75937
77137
|
this.zipfile.on("close", () => {
|
|
75938
77138
|
if (!this.canceled) {
|
|
75939
77139
|
debug4("zip extraction complete");
|
|
75940
|
-
|
|
77140
|
+
resolve7();
|
|
75941
77141
|
}
|
|
75942
77142
|
});
|
|
75943
77143
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -77279,8 +78479,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
77279
78479
|
return this;
|
|
77280
78480
|
},
|
|
77281
78481
|
next() {
|
|
77282
|
-
return new Promise(function(
|
|
77283
|
-
promiseResolve =
|
|
78482
|
+
return new Promise(function(resolve7, reject) {
|
|
78483
|
+
promiseResolve = resolve7;
|
|
77284
78484
|
promiseReject = reject;
|
|
77285
78485
|
const data = stream.read();
|
|
77286
78486
|
if (data !== null)
|
|
@@ -77317,14 +78517,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
77317
78517
|
}
|
|
77318
78518
|
function destroy(err) {
|
|
77319
78519
|
stream.destroy(err);
|
|
77320
|
-
return new Promise((
|
|
78520
|
+
return new Promise((resolve7, reject) => {
|
|
77321
78521
|
if (stream._duplexState & DESTROYED)
|
|
77322
|
-
return
|
|
78522
|
+
return resolve7({ value: undefined, done: true });
|
|
77323
78523
|
stream.once("close", function() {
|
|
77324
78524
|
if (err)
|
|
77325
78525
|
reject(err);
|
|
77326
78526
|
else
|
|
77327
|
-
|
|
78527
|
+
resolve7({ value: undefined, done: true });
|
|
77328
78528
|
});
|
|
77329
78529
|
});
|
|
77330
78530
|
}
|
|
@@ -77376,8 +78576,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
77376
78576
|
return Promise.resolve(true);
|
|
77377
78577
|
if (state.drains === null)
|
|
77378
78578
|
state.drains = [];
|
|
77379
|
-
return new Promise((
|
|
77380
|
-
state.drains.push({ writes, resolve:
|
|
78579
|
+
return new Promise((resolve7) => {
|
|
78580
|
+
state.drains.push({ writes, resolve: resolve7 });
|
|
77381
78581
|
});
|
|
77382
78582
|
}
|
|
77383
78583
|
write(data) {
|
|
@@ -77491,11 +78691,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
77491
78691
|
cb(null);
|
|
77492
78692
|
}
|
|
77493
78693
|
function pipelinePromise(...streams) {
|
|
77494
|
-
return new Promise((
|
|
78694
|
+
return new Promise((resolve7, reject) => {
|
|
77495
78695
|
return pipeline(...streams, (err) => {
|
|
77496
78696
|
if (err)
|
|
77497
78697
|
return reject(err);
|
|
77498
|
-
|
|
78698
|
+
resolve7();
|
|
77499
78699
|
});
|
|
77500
78700
|
});
|
|
77501
78701
|
}
|
|
@@ -78209,16 +79409,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
78209
79409
|
entryCallback = null;
|
|
78210
79410
|
cb(err);
|
|
78211
79411
|
}
|
|
78212
|
-
function onnext(
|
|
79412
|
+
function onnext(resolve7, reject) {
|
|
78213
79413
|
if (error) {
|
|
78214
79414
|
return reject(error);
|
|
78215
79415
|
}
|
|
78216
79416
|
if (entryStream) {
|
|
78217
|
-
|
|
79417
|
+
resolve7({ value: entryStream, done: false });
|
|
78218
79418
|
entryStream = null;
|
|
78219
79419
|
return;
|
|
78220
79420
|
}
|
|
78221
|
-
promiseResolve =
|
|
79421
|
+
promiseResolve = resolve7;
|
|
78222
79422
|
promiseReject = reject;
|
|
78223
79423
|
consumeCallback(null);
|
|
78224
79424
|
if (extract._finished && promiseResolve) {
|
|
@@ -78249,14 +79449,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
78249
79449
|
function destroy(err) {
|
|
78250
79450
|
extract.destroy(err);
|
|
78251
79451
|
consumeCallback(err);
|
|
78252
|
-
return new Promise((
|
|
79452
|
+
return new Promise((resolve7, reject) => {
|
|
78253
79453
|
if (extract.destroyed)
|
|
78254
|
-
return
|
|
79454
|
+
return resolve7({ value: undefined, done: true });
|
|
78255
79455
|
extract.once("close", function() {
|
|
78256
79456
|
if (err)
|
|
78257
79457
|
reject(err);
|
|
78258
79458
|
else
|
|
78259
|
-
|
|
79459
|
+
resolve7({ value: undefined, done: true });
|
|
78260
79460
|
});
|
|
78261
79461
|
});
|
|
78262
79462
|
}
|
|
@@ -78591,7 +79791,7 @@ var require_tar_fs = __commonJS((exports) => {
|
|
|
78591
79791
|
xfs.readlink(path7.join(cwd, filename), function(err, linkname) {
|
|
78592
79792
|
if (err)
|
|
78593
79793
|
return pack2.destroy(err);
|
|
78594
|
-
header.linkname =
|
|
79794
|
+
header.linkname = normalize2(linkname);
|
|
78595
79795
|
pack2.entry(header, onnextentry);
|
|
78596
79796
|
});
|
|
78597
79797
|
}
|
|
@@ -78608,7 +79808,7 @@ var require_tar_fs = __commonJS((exports) => {
|
|
|
78608
79808
|
if (stat2.isSocket())
|
|
78609
79809
|
return onnextentry();
|
|
78610
79810
|
let header = {
|
|
78611
|
-
name:
|
|
79811
|
+
name: normalize2(filename),
|
|
78612
79812
|
mode: (stat2.mode | (stat2.isDirectory() ? dmode : fmode)) & umask,
|
|
78613
79813
|
mtime: stat2.mtime,
|
|
78614
79814
|
size: stat2.size,
|
|
@@ -78692,7 +79892,7 @@ var require_tar_fs = __commonJS((exports) => {
|
|
|
78692
79892
|
return extract2;
|
|
78693
79893
|
function onentry(header, stream, next) {
|
|
78694
79894
|
header = map2(header) || header;
|
|
78695
|
-
header.name =
|
|
79895
|
+
header.name = normalize2(header.name);
|
|
78696
79896
|
const name = path7.join(cwd, path7.join("/", header.name));
|
|
78697
79897
|
if (ignore(name, header)) {
|
|
78698
79898
|
stream.resume();
|
|
@@ -78880,7 +80080,7 @@ var require_tar_fs = __commonJS((exports) => {
|
|
|
78880
80080
|
function echo(name) {
|
|
78881
80081
|
return name;
|
|
78882
80082
|
}
|
|
78883
|
-
function
|
|
80083
|
+
function normalize2(name) {
|
|
78884
80084
|
return win32 ? name.replace(/\\/g, "/").replace(/[:?<>|]/g, "_") : name;
|
|
78885
80085
|
}
|
|
78886
80086
|
function statAll(fs4, stat2, cwd, ignore, entries, sort) {
|
|
@@ -79054,7 +80254,7 @@ var init_fileUtil = __esm(() => {
|
|
|
79054
80254
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
79055
80255
|
import assert2 from "node:assert";
|
|
79056
80256
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
79057
|
-
import { existsSync as
|
|
80257
|
+
import { existsSync as existsSync25, readFileSync as readFileSync24 } from "node:fs";
|
|
79058
80258
|
import { mkdir as mkdir2, unlink } from "node:fs/promises";
|
|
79059
80259
|
import os5 from "node:os";
|
|
79060
80260
|
import path8 from "node:path";
|
|
@@ -79107,7 +80307,7 @@ async function installWithProviders(options) {
|
|
|
79107
80307
|
continue;
|
|
79108
80308
|
}
|
|
79109
80309
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
79110
|
-
if (!
|
|
80310
|
+
if (!existsSync25(browserRoot)) {
|
|
79111
80311
|
await mkdir2(browserRoot, { recursive: true });
|
|
79112
80312
|
}
|
|
79113
80313
|
return await installUrl(url, options, provider);
|
|
@@ -79140,11 +80340,11 @@ async function installDeps(installedBrowser) {
|
|
|
79140
80340
|
return;
|
|
79141
80341
|
}
|
|
79142
80342
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
79143
|
-
if (!
|
|
80343
|
+
if (!existsSync25(depsPath)) {
|
|
79144
80344
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
79145
80345
|
return;
|
|
79146
80346
|
}
|
|
79147
|
-
const data =
|
|
80347
|
+
const data = readFileSync24(depsPath, "utf-8").split(`
|
|
79148
80348
|
`).join(",");
|
|
79149
80349
|
if (process.getuid?.() !== 0) {
|
|
79150
80350
|
throw new Error("Installing system dependencies requires root privileges");
|
|
@@ -79182,11 +80382,11 @@ async function installUrl(url, options, provider) {
|
|
|
79182
80382
|
const cache = new Cache(options.cacheDir);
|
|
79183
80383
|
const browserRoot = cache.browserRoot(options.browser);
|
|
79184
80384
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
79185
|
-
if (!
|
|
80385
|
+
if (!existsSync25(browserRoot)) {
|
|
79186
80386
|
await mkdir2(browserRoot, { recursive: true });
|
|
79187
80387
|
}
|
|
79188
80388
|
if (!options.unpack) {
|
|
79189
|
-
if (
|
|
80389
|
+
if (existsSync25(archivePath)) {
|
|
79190
80390
|
return archivePath;
|
|
79191
80391
|
}
|
|
79192
80392
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -79207,8 +80407,8 @@ async function installUrl(url, options, provider) {
|
|
|
79207
80407
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
79208
80408
|
}
|
|
79209
80409
|
try {
|
|
79210
|
-
if (
|
|
79211
|
-
if (!
|
|
80410
|
+
if (existsSync25(outputPath)) {
|
|
80411
|
+
if (!existsSync25(installedBrowser.executablePath)) {
|
|
79212
80412
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
79213
80413
|
}
|
|
79214
80414
|
await runSetup(installedBrowser);
|
|
@@ -79217,7 +80417,7 @@ async function installUrl(url, options, provider) {
|
|
|
79217
80417
|
}
|
|
79218
80418
|
return installedBrowser;
|
|
79219
80419
|
}
|
|
79220
|
-
if (!
|
|
80420
|
+
if (!existsSync25(archivePath)) {
|
|
79221
80421
|
debugInstall(`Downloading binary from ${url}`);
|
|
79222
80422
|
try {
|
|
79223
80423
|
debugTime("download");
|
|
@@ -79246,7 +80446,7 @@ async function installUrl(url, options, provider) {
|
|
|
79246
80446
|
}
|
|
79247
80447
|
return installedBrowser;
|
|
79248
80448
|
} finally {
|
|
79249
|
-
if (
|
|
80449
|
+
if (existsSync25(archivePath)) {
|
|
79250
80450
|
await unlink(archivePath);
|
|
79251
80451
|
}
|
|
79252
80452
|
}
|
|
@@ -79257,7 +80457,7 @@ async function runSetup(installedBrowser) {
|
|
|
79257
80457
|
debugTime("permissions");
|
|
79258
80458
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
79259
80459
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
79260
|
-
if (!
|
|
80460
|
+
if (!existsSync25(setupExePath)) {
|
|
79261
80461
|
return;
|
|
79262
80462
|
}
|
|
79263
80463
|
spawnSync3(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
@@ -79638,18 +80838,18 @@ var init_cliui = __esm(() => {
|
|
|
79638
80838
|
});
|
|
79639
80839
|
|
|
79640
80840
|
// node_modules/escalade/sync/index.mjs
|
|
79641
|
-
import { dirname as dirname10, resolve as
|
|
79642
|
-
import { readdirSync as
|
|
80841
|
+
import { dirname as dirname10, resolve as resolve8 } from "path";
|
|
80842
|
+
import { readdirSync as readdirSync8, statSync as statSync10 } from "fs";
|
|
79643
80843
|
function sync_default(start, callback) {
|
|
79644
|
-
let dir =
|
|
79645
|
-
let tmp, stats =
|
|
80844
|
+
let dir = resolve8(".", start);
|
|
80845
|
+
let tmp, stats = statSync10(dir);
|
|
79646
80846
|
if (!stats.isDirectory()) {
|
|
79647
80847
|
dir = dirname10(dir);
|
|
79648
80848
|
}
|
|
79649
80849
|
while (true) {
|
|
79650
|
-
tmp = callback(dir,
|
|
80850
|
+
tmp = callback(dir, readdirSync8(dir));
|
|
79651
80851
|
if (tmp)
|
|
79652
|
-
return
|
|
80852
|
+
return resolve8(dir, tmp);
|
|
79653
80853
|
dir = dirname10(tmp = dir);
|
|
79654
80854
|
if (tmp === dir)
|
|
79655
80855
|
break;
|
|
@@ -80596,7 +81796,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
80596
81796
|
|
|
80597
81797
|
// node_modules/yargs-parser/build/lib/index.js
|
|
80598
81798
|
import { format } from "util";
|
|
80599
|
-
import { normalize, resolve as
|
|
81799
|
+
import { normalize as normalize2, resolve as resolve9 } from "path";
|
|
80600
81800
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
80601
81801
|
const result = parser.parse(args.slice(), opts);
|
|
80602
81802
|
return result.argv;
|
|
@@ -80618,8 +81818,8 @@ var init_lib2 = __esm(() => {
|
|
|
80618
81818
|
return env;
|
|
80619
81819
|
},
|
|
80620
81820
|
format,
|
|
80621
|
-
normalize,
|
|
80622
|
-
resolve:
|
|
81821
|
+
normalize: normalize2,
|
|
81822
|
+
resolve: resolve9,
|
|
80623
81823
|
require: (path9) => {
|
|
80624
81824
|
if (true) {
|
|
80625
81825
|
return __require(path9);
|
|
@@ -80670,21 +81870,21 @@ var init_yerror = __esm(() => {
|
|
|
80670
81870
|
});
|
|
80671
81871
|
|
|
80672
81872
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
80673
|
-
import { readFileSync as
|
|
81873
|
+
import { readFileSync as readFileSync25, statSync as statSync11, writeFile } from "fs";
|
|
80674
81874
|
import { format as format2 } from "util";
|
|
80675
|
-
import { resolve as
|
|
81875
|
+
import { resolve as resolve10 } from "path";
|
|
80676
81876
|
var node_default;
|
|
80677
81877
|
var init_node = __esm(() => {
|
|
80678
81878
|
node_default = {
|
|
80679
81879
|
fs: {
|
|
80680
|
-
readFileSync:
|
|
81880
|
+
readFileSync: readFileSync25,
|
|
80681
81881
|
writeFile
|
|
80682
81882
|
},
|
|
80683
81883
|
format: format2,
|
|
80684
|
-
resolve:
|
|
81884
|
+
resolve: resolve10,
|
|
80685
81885
|
exists: (file) => {
|
|
80686
81886
|
try {
|
|
80687
|
-
return
|
|
81887
|
+
return statSync11(file).isFile();
|
|
80688
81888
|
} catch (err) {
|
|
80689
81889
|
return false;
|
|
80690
81890
|
}
|
|
@@ -80862,9 +82062,9 @@ var init_y18n = __esm(() => {
|
|
|
80862
82062
|
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
80863
82063
|
import { notStrictEqual, strictEqual } from "assert";
|
|
80864
82064
|
import { inspect } from "util";
|
|
80865
|
-
import { readFileSync as
|
|
82065
|
+
import { readFileSync as readFileSync26 } from "fs";
|
|
80866
82066
|
import { fileURLToPath } from "url";
|
|
80867
|
-
import { basename as basename10, dirname as dirname11, extname as extname3, relative as relative7, resolve as
|
|
82067
|
+
import { basename as basename10, dirname as dirname11, extname as extname3, relative as relative7, resolve as resolve11 } from "path";
|
|
80868
82068
|
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;
|
|
80869
82069
|
var init_esm = __esm(() => {
|
|
80870
82070
|
init_cliui();
|
|
@@ -80900,7 +82100,7 @@ var init_esm = __esm(() => {
|
|
|
80900
82100
|
dirname: dirname11,
|
|
80901
82101
|
extname: extname3,
|
|
80902
82102
|
relative: relative7,
|
|
80903
|
-
resolve:
|
|
82103
|
+
resolve: resolve11
|
|
80904
82104
|
},
|
|
80905
82105
|
process: {
|
|
80906
82106
|
argv: () => process.argv,
|
|
@@ -80911,7 +82111,7 @@ var init_esm = __esm(() => {
|
|
|
80911
82111
|
nextTick: process.nextTick,
|
|
80912
82112
|
stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
|
|
80913
82113
|
},
|
|
80914
|
-
readFileSync:
|
|
82114
|
+
readFileSync: readFileSync26,
|
|
80915
82115
|
require: () => {
|
|
80916
82116
|
throw new YError(REQUIRE_ERROR);
|
|
80917
82117
|
},
|
|
@@ -80922,7 +82122,7 @@ var init_esm = __esm(() => {
|
|
|
80922
82122
|
return [...str].length;
|
|
80923
82123
|
},
|
|
80924
82124
|
y18n: y18n_default({
|
|
80925
|
-
directory:
|
|
82125
|
+
directory: resolve11(__dirname2, "../../../locales"),
|
|
80926
82126
|
updateFiles: false
|
|
80927
82127
|
})
|
|
80928
82128
|
};
|
|
@@ -81989,13 +83189,13 @@ function usage(yargs, shim2) {
|
|
|
81989
83189
|
};
|
|
81990
83190
|
self2.stringifiedValues = function stringifiedValues(values, separator) {
|
|
81991
83191
|
let string = "";
|
|
81992
|
-
const
|
|
83192
|
+
const sep3 = separator || ", ";
|
|
81993
83193
|
const array = [].concat(values);
|
|
81994
83194
|
if (!values || !array.length)
|
|
81995
83195
|
return string;
|
|
81996
83196
|
array.forEach((value) => {
|
|
81997
83197
|
if (string.length)
|
|
81998
|
-
string +=
|
|
83198
|
+
string += sep3;
|
|
81999
83199
|
string += JSON.stringify(value);
|
|
82000
83200
|
});
|
|
82001
83201
|
return string;
|
|
@@ -83170,12 +84370,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
83170
84370
|
async getCompletion(args, done) {
|
|
83171
84371
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
83172
84372
|
if (!done) {
|
|
83173
|
-
return new Promise((
|
|
84373
|
+
return new Promise((resolve12, reject) => {
|
|
83174
84374
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
83175
84375
|
if (err)
|
|
83176
84376
|
reject(err);
|
|
83177
84377
|
else
|
|
83178
|
-
|
|
84378
|
+
resolve12(completions);
|
|
83179
84379
|
});
|
|
83180
84380
|
});
|
|
83181
84381
|
} else {
|
|
@@ -84610,9 +85810,9 @@ async function getConnectionTransport(options) {
|
|
|
84610
85810
|
throw new Error("Could not detect required browser platform");
|
|
84611
85811
|
}
|
|
84612
85812
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
84613
|
-
const { join:
|
|
85813
|
+
const { join: join26 } = await import("node:path");
|
|
84614
85814
|
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
84615
|
-
const portPath =
|
|
85815
|
+
const portPath = join26(userDataDir, "DevToolsActivePort");
|
|
84616
85816
|
try {
|
|
84617
85817
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
84618
85818
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -84836,9 +86036,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
84836
86036
|
});
|
|
84837
86037
|
|
|
84838
86038
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
84839
|
-
import { existsSync as
|
|
86039
|
+
import { existsSync as existsSync26 } from "node:fs";
|
|
84840
86040
|
import { tmpdir } from "node:os";
|
|
84841
|
-
import { join as
|
|
86041
|
+
import { join as join26 } from "node:path";
|
|
84842
86042
|
|
|
84843
86043
|
class BrowserLauncher {
|
|
84844
86044
|
#browser;
|
|
@@ -84863,7 +86063,7 @@ class BrowserLauncher {
|
|
|
84863
86063
|
...options,
|
|
84864
86064
|
protocol
|
|
84865
86065
|
});
|
|
84866
|
-
if (!
|
|
86066
|
+
if (!existsSync26(launchArgs.executablePath)) {
|
|
84867
86067
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
84868
86068
|
}
|
|
84869
86069
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -84938,7 +86138,7 @@ class BrowserLauncher {
|
|
|
84938
86138
|
browserCloseCallback();
|
|
84939
86139
|
const logs = browserProcess.getRecentLogs().join(`
|
|
84940
86140
|
`);
|
|
84941
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
86141
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync26(join26(launchArgs.userDataDir, "lockfile"))) {
|
|
84942
86142
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
84943
86143
|
}
|
|
84944
86144
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -85028,12 +86228,12 @@ class BrowserLauncher {
|
|
|
85028
86228
|
});
|
|
85029
86229
|
}
|
|
85030
86230
|
getProfilePath() {
|
|
85031
|
-
return
|
|
86231
|
+
return join26(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
85032
86232
|
}
|
|
85033
86233
|
resolveExecutablePath(headless, validatePath = true) {
|
|
85034
86234
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
85035
86235
|
if (executablePath) {
|
|
85036
|
-
if (validatePath && !
|
|
86236
|
+
if (validatePath && !existsSync26(executablePath)) {
|
|
85037
86237
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
85038
86238
|
}
|
|
85039
86239
|
return executablePath;
|
|
@@ -85056,7 +86256,7 @@ class BrowserLauncher {
|
|
|
85056
86256
|
browser: browserType,
|
|
85057
86257
|
buildId: this.puppeteer.browserVersion
|
|
85058
86258
|
});
|
|
85059
|
-
if (validatePath && !
|
|
86259
|
+
if (validatePath && !existsSync26(executablePath)) {
|
|
85060
86260
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
85061
86261
|
if (configVersion) {
|
|
85062
86262
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -85668,8 +86868,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
85668
86868
|
static {
|
|
85669
86869
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
85670
86870
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
85671
|
-
const error = await new Promise((
|
|
85672
|
-
this.#process.stdin.write(buffer,
|
|
86871
|
+
const error = await new Promise((resolve12) => {
|
|
86872
|
+
this.#process.stdin.write(buffer, resolve12);
|
|
85673
86873
|
});
|
|
85674
86874
|
if (error) {
|
|
85675
86875
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -85824,8 +87024,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
85824
87024
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
85825
87025
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
85826
87026
|
this.#process.stdin.end();
|
|
85827
|
-
await new Promise((
|
|
85828
|
-
this.#process.once("close",
|
|
87027
|
+
await new Promise((resolve12) => {
|
|
87028
|
+
this.#process.once("close", resolve12);
|
|
85829
87029
|
});
|
|
85830
87030
|
}
|
|
85831
87031
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -85871,17 +87071,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
85871
87071
|
});
|
|
85872
87072
|
|
|
85873
87073
|
// src/core/design-eval/capture.ts
|
|
85874
|
-
import { mkdirSync as
|
|
85875
|
-
import { join as
|
|
87074
|
+
import { mkdirSync as mkdirSync12, statSync as statSync12, existsSync as existsSync27 } from "fs";
|
|
87075
|
+
import { join as join27 } from "path";
|
|
85876
87076
|
function findBrowser() {
|
|
85877
87077
|
const platform2 = process.platform;
|
|
85878
87078
|
const paths = CHROME_PATHS[platform2] ?? [];
|
|
85879
87079
|
for (const p of paths) {
|
|
85880
|
-
if (
|
|
87080
|
+
if (existsSync27(p))
|
|
85881
87081
|
return p;
|
|
85882
87082
|
}
|
|
85883
|
-
const minkBrowsers =
|
|
85884
|
-
if (
|
|
87083
|
+
const minkBrowsers = join27(minkRoot(), "browsers");
|
|
87084
|
+
if (existsSync27(minkBrowsers)) {
|
|
85885
87085
|
const found = findChromeInDir(minkBrowsers);
|
|
85886
87086
|
if (found)
|
|
85887
87087
|
return found;
|
|
@@ -85898,13 +87098,13 @@ function findBrowser() {
|
|
|
85898
87098
|
`));
|
|
85899
87099
|
}
|
|
85900
87100
|
function findChromeInDir(dir) {
|
|
85901
|
-
const { readdirSync:
|
|
87101
|
+
const { readdirSync: readdirSync9, statSync: statSync13 } = __require("fs");
|
|
85902
87102
|
try {
|
|
85903
|
-
const entries =
|
|
87103
|
+
const entries = readdirSync9(dir);
|
|
85904
87104
|
for (const entry of entries) {
|
|
85905
|
-
const full =
|
|
87105
|
+
const full = join27(dir, entry);
|
|
85906
87106
|
try {
|
|
85907
|
-
const stat2 =
|
|
87107
|
+
const stat2 = statSync13(full);
|
|
85908
87108
|
if (stat2.isDirectory()) {
|
|
85909
87109
|
const found = findChromeInDir(full);
|
|
85910
87110
|
if (found)
|
|
@@ -85950,7 +87150,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
85950
87150
|
const y = section * viewport.height;
|
|
85951
87151
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
85952
87152
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
85953
|
-
const filePath =
|
|
87153
|
+
const filePath = join27(options.outputDir, fileName);
|
|
85954
87154
|
await page.screenshot({
|
|
85955
87155
|
path: filePath,
|
|
85956
87156
|
type: "jpeg",
|
|
@@ -85964,7 +87164,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
85964
87164
|
});
|
|
85965
87165
|
let fileSize = 0;
|
|
85966
87166
|
try {
|
|
85967
|
-
fileSize =
|
|
87167
|
+
fileSize = statSync12(filePath).size;
|
|
85968
87168
|
} catch {}
|
|
85969
87169
|
results.push({
|
|
85970
87170
|
route,
|
|
@@ -85982,7 +87182,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
85982
87182
|
return results;
|
|
85983
87183
|
}
|
|
85984
87184
|
async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
|
|
85985
|
-
|
|
87185
|
+
mkdirSync12(outputDir, { recursive: true });
|
|
85986
87186
|
const executablePath = findBrowser();
|
|
85987
87187
|
const browser = await puppeteer_core_default.launch({
|
|
85988
87188
|
executablePath,
|
|
@@ -87409,253 +88609,13 @@ var init_framework_advisor2 = __esm(() => {
|
|
|
87409
88609
|
init_validate();
|
|
87410
88610
|
});
|
|
87411
88611
|
|
|
87412
|
-
// src/core/vault-templates.ts
|
|
87413
|
-
import { join as join24 } from "path";
|
|
87414
|
-
import { existsSync as existsSync25, writeFileSync as writeFileSync8, readFileSync as readFileSync24, mkdirSync as mkdirSync12 } from "fs";
|
|
87415
|
-
function seedTemplates(templatesDir) {
|
|
87416
|
-
mkdirSync12(templatesDir, { recursive: true });
|
|
87417
|
-
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
87418
|
-
const filePath = join24(templatesDir, `${name}.md`);
|
|
87419
|
-
if (!existsSync25(filePath)) {
|
|
87420
|
-
writeFileSync8(filePath, content);
|
|
87421
|
-
}
|
|
87422
|
-
}
|
|
87423
|
-
}
|
|
87424
|
-
function loadTemplate(templatesDir, templateName, vars) {
|
|
87425
|
-
const filePath = join24(templatesDir, `${templateName}.md`);
|
|
87426
|
-
let content;
|
|
87427
|
-
if (existsSync25(filePath)) {
|
|
87428
|
-
content = readFileSync24(filePath, "utf-8");
|
|
87429
|
-
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
87430
|
-
content = DEFAULT_TEMPLATES[templateName];
|
|
87431
|
-
} else {
|
|
87432
|
-
return null;
|
|
87433
|
-
}
|
|
87434
|
-
return fillTemplate(content, vars);
|
|
87435
|
-
}
|
|
87436
|
-
function fillTemplate(template, vars) {
|
|
87437
|
-
let result = template;
|
|
87438
|
-
for (const [key, value] of Object.entries(vars)) {
|
|
87439
|
-
result = result.replaceAll(`{{${key}}}`, value);
|
|
87440
|
-
}
|
|
87441
|
-
return result;
|
|
87442
|
-
}
|
|
87443
|
-
var DEFAULT_TEMPLATES;
|
|
87444
|
-
var init_vault_templates = __esm(() => {
|
|
87445
|
-
DEFAULT_TEMPLATES = {
|
|
87446
|
-
"quick-capture": `---
|
|
87447
|
-
created: "{{created}}"
|
|
87448
|
-
updated: "{{updated}}"
|
|
87449
|
-
tags: []
|
|
87450
|
-
category: inbox
|
|
87451
|
-
---
|
|
87452
|
-
|
|
87453
|
-
# {{title}}
|
|
87454
|
-
|
|
87455
|
-
{{body}}
|
|
87456
|
-
`,
|
|
87457
|
-
"daily-note": `---
|
|
87458
|
-
created: "{{created}}"
|
|
87459
|
-
updated: "{{updated}}"
|
|
87460
|
-
tags: [daily]
|
|
87461
|
-
category: areas
|
|
87462
|
-
---
|
|
87463
|
-
|
|
87464
|
-
# {{date}}
|
|
87465
|
-
|
|
87466
|
-
## Focus
|
|
87467
|
-
|
|
87468
|
-
-
|
|
87469
|
-
|
|
87470
|
-
## Notes
|
|
87471
|
-
|
|
87472
|
-
-
|
|
87473
|
-
|
|
87474
|
-
## Tasks
|
|
87475
|
-
|
|
87476
|
-
- [ ]
|
|
87477
|
-
|
|
87478
|
-
## Reflections
|
|
87479
|
-
|
|
87480
|
-
`,
|
|
87481
|
-
meeting: `---
|
|
87482
|
-
created: "{{created}}"
|
|
87483
|
-
updated: "{{updated}}"
|
|
87484
|
-
tags: [meeting]
|
|
87485
|
-
category: areas
|
|
87486
|
-
---
|
|
87487
|
-
|
|
87488
|
-
# {{title}}
|
|
87489
|
-
|
|
87490
|
-
**Date**: {{date}}
|
|
87491
|
-
**Attendees**:
|
|
87492
|
-
|
|
87493
|
-
## Agenda
|
|
87494
|
-
|
|
87495
|
-
-
|
|
87496
|
-
|
|
87497
|
-
## Discussion
|
|
87498
|
-
|
|
87499
|
-
-
|
|
87500
|
-
|
|
87501
|
-
## Decisions
|
|
87502
|
-
|
|
87503
|
-
-
|
|
87504
|
-
|
|
87505
|
-
## Action Items
|
|
87506
|
-
|
|
87507
|
-
- [ ]
|
|
87508
|
-
`,
|
|
87509
|
-
project: `---
|
|
87510
|
-
created: "{{created}}"
|
|
87511
|
-
updated: "{{updated}}"
|
|
87512
|
-
tags: [project]
|
|
87513
|
-
category: projects
|
|
87514
|
-
status: active
|
|
87515
|
-
---
|
|
87516
|
-
|
|
87517
|
-
# {{title}}
|
|
87518
|
-
|
|
87519
|
-
## Overview
|
|
87520
|
-
|
|
87521
|
-
{{body}}
|
|
87522
|
-
|
|
87523
|
-
## Goals
|
|
87524
|
-
|
|
87525
|
-
-
|
|
87526
|
-
|
|
87527
|
-
## Key Decisions
|
|
87528
|
-
|
|
87529
|
-
-
|
|
87530
|
-
|
|
87531
|
-
## Links
|
|
87532
|
-
|
|
87533
|
-
-
|
|
87534
|
-
`,
|
|
87535
|
-
area: `---
|
|
87536
|
-
created: "{{created}}"
|
|
87537
|
-
updated: "{{updated}}"
|
|
87538
|
-
tags: [area]
|
|
87539
|
-
category: areas
|
|
87540
|
-
---
|
|
87541
|
-
|
|
87542
|
-
# {{title}}
|
|
87543
|
-
|
|
87544
|
-
## Purpose
|
|
87545
|
-
|
|
87546
|
-
{{body}}
|
|
87547
|
-
|
|
87548
|
-
## Standards
|
|
87549
|
-
|
|
87550
|
-
-
|
|
87551
|
-
|
|
87552
|
-
## Key Resources
|
|
87553
|
-
|
|
87554
|
-
-
|
|
87555
|
-
`,
|
|
87556
|
-
person: `---
|
|
87557
|
-
created: "{{created}}"
|
|
87558
|
-
updated: "{{updated}}"
|
|
87559
|
-
tags: [person]
|
|
87560
|
-
category: resources
|
|
87561
|
-
---
|
|
87562
|
-
|
|
87563
|
-
# {{title}}
|
|
87564
|
-
|
|
87565
|
-
## Role
|
|
87566
|
-
|
|
87567
|
-
## Context
|
|
87568
|
-
|
|
87569
|
-
## 1:1 Notes
|
|
87570
|
-
|
|
87571
|
-
-
|
|
87572
|
-
|
|
87573
|
-
## Key Projects
|
|
87574
|
-
|
|
87575
|
-
-
|
|
87576
|
-
`
|
|
87577
|
-
};
|
|
87578
|
-
});
|
|
87579
|
-
|
|
87580
|
-
// src/core/note-linker.ts
|
|
87581
|
-
import { join as join25 } from "path";
|
|
87582
|
-
import { existsSync as existsSync26, readFileSync as readFileSync25, readdirSync as readdirSync7, statSync as statSync12 } from "fs";
|
|
87583
|
-
function updateMasterIndex(vaultRootPath) {
|
|
87584
|
-
const now = new Date().toISOString().split("T")[0];
|
|
87585
|
-
const sections = [
|
|
87586
|
-
`---`,
|
|
87587
|
-
`updated: "${new Date().toISOString()}"`,
|
|
87588
|
-
`---`,
|
|
87589
|
-
``,
|
|
87590
|
-
`# Knowledge Base`,
|
|
87591
|
-
``,
|
|
87592
|
-
`> Last updated: ${now}`,
|
|
87593
|
-
``
|
|
87594
|
-
];
|
|
87595
|
-
const categories = [
|
|
87596
|
-
{ name: "Inbox", dir: "inbox", emoji: "" },
|
|
87597
|
-
{ name: "Projects", dir: "projects", emoji: "" },
|
|
87598
|
-
{ name: "Areas", dir: "areas", emoji: "" },
|
|
87599
|
-
{ name: "Resources", dir: "resources", emoji: "" },
|
|
87600
|
-
{ name: "Archives", dir: "archives", emoji: "" },
|
|
87601
|
-
{ name: "Patterns", dir: "patterns", emoji: "" }
|
|
87602
|
-
];
|
|
87603
|
-
for (const cat of categories) {
|
|
87604
|
-
const dirPath = join25(vaultRootPath, cat.dir);
|
|
87605
|
-
if (!existsSync26(dirPath))
|
|
87606
|
-
continue;
|
|
87607
|
-
const files = collectMarkdownFiles(dirPath, vaultRootPath);
|
|
87608
|
-
if (files.length === 0 && cat.dir !== "inbox")
|
|
87609
|
-
continue;
|
|
87610
|
-
sections.push(`## ${cat.name}`);
|
|
87611
|
-
sections.push("");
|
|
87612
|
-
if (files.length === 0) {
|
|
87613
|
-
sections.push("*No notes yet.*");
|
|
87614
|
-
} else {
|
|
87615
|
-
const sorted = files.sort((a, b) => b.mtime - a.mtime).slice(0, 20);
|
|
87616
|
-
for (const file of sorted) {
|
|
87617
|
-
sections.push(`- [[${file.title}]]`);
|
|
87618
|
-
}
|
|
87619
|
-
if (files.length > 20) {
|
|
87620
|
-
sections.push(`- *...and ${files.length - 20} more*`);
|
|
87621
|
-
}
|
|
87622
|
-
}
|
|
87623
|
-
sections.push("");
|
|
87624
|
-
}
|
|
87625
|
-
const indexPath = vaultMasterIndexPath();
|
|
87626
|
-
atomicWriteText(indexPath, sections.join(`
|
|
87627
|
-
`));
|
|
87628
|
-
}
|
|
87629
|
-
function collectMarkdownFiles(dirPath, rootPath) {
|
|
87630
|
-
const files = [];
|
|
87631
|
-
try {
|
|
87632
|
-
const entries = readdirSync7(dirPath, { withFileTypes: true });
|
|
87633
|
-
for (const entry of entries) {
|
|
87634
|
-
const fullPath = join25(dirPath, entry.name);
|
|
87635
|
-
if (entry.isDirectory()) {
|
|
87636
|
-
files.push(...collectMarkdownFiles(fullPath, rootPath));
|
|
87637
|
-
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
87638
|
-
const stat2 = statSync12(fullPath);
|
|
87639
|
-
const title = entry.name.replace(/\.md$/, "");
|
|
87640
|
-
const relativePath = fullPath.slice(rootPath.length + 1);
|
|
87641
|
-
files.push({ title, relativePath, mtime: stat2.mtimeMs });
|
|
87642
|
-
}
|
|
87643
|
-
}
|
|
87644
|
-
} catch {}
|
|
87645
|
-
return files;
|
|
87646
|
-
}
|
|
87647
|
-
var init_note_linker = __esm(() => {
|
|
87648
|
-
init_fs_utils();
|
|
87649
|
-
init_vault();
|
|
87650
|
-
});
|
|
87651
|
-
|
|
87652
88612
|
// src/commands/wiki.ts
|
|
87653
88613
|
var exports_wiki = {};
|
|
87654
88614
|
__export(exports_wiki, {
|
|
87655
88615
|
wiki: () => wiki
|
|
87656
88616
|
});
|
|
87657
|
-
import { existsSync as
|
|
87658
|
-
import { resolve as
|
|
88617
|
+
import { existsSync as existsSync28, statSync as statSync13 } from "fs";
|
|
88618
|
+
import { resolve as resolve12 } from "path";
|
|
87659
88619
|
import { homedir as homedir4 } from "os";
|
|
87660
88620
|
async function wiki(_cwd, args) {
|
|
87661
88621
|
const sub = args[0];
|
|
@@ -87710,7 +88670,7 @@ async function wikiInit(args) {
|
|
|
87710
88670
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
87711
88671
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
87712
88672
|
}
|
|
87713
|
-
const isExisting =
|
|
88673
|
+
const isExisting = existsSync28(targetPath) && statSync13(targetPath).isDirectory();
|
|
87714
88674
|
setConfigValue("wiki.path", targetPath);
|
|
87715
88675
|
ensureVaultStructure();
|
|
87716
88676
|
seedTemplates(vaultTemplates());
|
|
@@ -87914,9 +88874,9 @@ function wikiLinks() {
|
|
|
87914
88874
|
}
|
|
87915
88875
|
function expandPath(raw) {
|
|
87916
88876
|
if (raw.startsWith("~/")) {
|
|
87917
|
-
return
|
|
88877
|
+
return resolve12(homedir4(), raw.slice(2));
|
|
87918
88878
|
}
|
|
87919
|
-
return
|
|
88879
|
+
return resolve12(raw);
|
|
87920
88880
|
}
|
|
87921
88881
|
var init_wiki = __esm(() => {
|
|
87922
88882
|
init_vault();
|
|
@@ -87927,169 +88887,12 @@ var init_wiki = __esm(() => {
|
|
|
87927
88887
|
init_note_linker();
|
|
87928
88888
|
});
|
|
87929
88889
|
|
|
87930
|
-
// src/core/note-writer.ts
|
|
87931
|
-
import { join as join26 } from "path";
|
|
87932
|
-
import { existsSync as existsSync28, readFileSync as readFileSync26 } from "fs";
|
|
87933
|
-
function slugifyTitle(title) {
|
|
87934
|
-
return title.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
87935
|
-
}
|
|
87936
|
-
function generateFrontmatter(meta) {
|
|
87937
|
-
const lines = ["---"];
|
|
87938
|
-
lines.push(`created: "${meta.created}"`);
|
|
87939
|
-
lines.push(`updated: "${meta.updated}"`);
|
|
87940
|
-
if (meta.tags.length > 0) {
|
|
87941
|
-
lines.push(`tags: [${meta.tags.join(", ")}]`);
|
|
87942
|
-
} else {
|
|
87943
|
-
lines.push("tags: []");
|
|
87944
|
-
}
|
|
87945
|
-
lines.push(`category: ${meta.category}`);
|
|
87946
|
-
if (meta.sourceProject) {
|
|
87947
|
-
lines.push(`source_project: ${meta.sourceProject}`);
|
|
87948
|
-
}
|
|
87949
|
-
if (meta.aliases && meta.aliases.length > 0) {
|
|
87950
|
-
lines.push(`aliases: [${meta.aliases.join(", ")}]`);
|
|
87951
|
-
}
|
|
87952
|
-
if (meta.extra) {
|
|
87953
|
-
for (const [key, value] of Object.entries(meta.extra)) {
|
|
87954
|
-
lines.push(`${key}: ${JSON.stringify(value)}`);
|
|
87955
|
-
}
|
|
87956
|
-
}
|
|
87957
|
-
lines.push("---");
|
|
87958
|
-
return lines.join(`
|
|
87959
|
-
`);
|
|
87960
|
-
}
|
|
87961
|
-
function createNote(meta) {
|
|
87962
|
-
const now = meta.created || new Date().toISOString();
|
|
87963
|
-
const slug = slugifyTitle(meta.title);
|
|
87964
|
-
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
87965
|
-
const filePath = join26(dir, `${slug}.md`);
|
|
87966
|
-
let content;
|
|
87967
|
-
if (meta.template) {
|
|
87968
|
-
const rendered = loadTemplate(vaultTemplates(), meta.template, {
|
|
87969
|
-
title: meta.title,
|
|
87970
|
-
body: meta.body,
|
|
87971
|
-
created: now,
|
|
87972
|
-
updated: now,
|
|
87973
|
-
date: now.split("T")[0]
|
|
87974
|
-
});
|
|
87975
|
-
content = rendered ?? buildNoteContent(meta, now);
|
|
87976
|
-
} else {
|
|
87977
|
-
content = buildNoteContent(meta, now);
|
|
87978
|
-
}
|
|
87979
|
-
atomicWriteText(filePath, content);
|
|
87980
|
-
return { filePath, content };
|
|
87981
|
-
}
|
|
87982
|
-
function buildNoteContent(meta, now) {
|
|
87983
|
-
const frontmatter = generateFrontmatter({
|
|
87984
|
-
created: now,
|
|
87985
|
-
updated: now,
|
|
87986
|
-
tags: meta.tags,
|
|
87987
|
-
category: meta.category,
|
|
87988
|
-
sourceProject: meta.sourceProject
|
|
87989
|
-
});
|
|
87990
|
-
return `${frontmatter}
|
|
87991
|
-
|
|
87992
|
-
# ${meta.title}
|
|
87993
|
-
|
|
87994
|
-
${meta.body}
|
|
87995
|
-
`;
|
|
87996
|
-
}
|
|
87997
|
-
function appendToDaily(date, content) {
|
|
87998
|
-
const dir = vaultDailyDir();
|
|
87999
|
-
const filePath = join26(dir, `${date}.md`);
|
|
88000
|
-
if (existsSync28(filePath)) {
|
|
88001
|
-
const existing = readFileSync26(filePath, "utf-8");
|
|
88002
|
-
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
88003
|
-
hour: "2-digit",
|
|
88004
|
-
minute: "2-digit",
|
|
88005
|
-
hour12: false
|
|
88006
|
-
});
|
|
88007
|
-
const updated = `${existing.trimEnd()}
|
|
88008
|
-
|
|
88009
|
-
## ${timestamp}
|
|
88010
|
-
|
|
88011
|
-
${content}
|
|
88012
|
-
`;
|
|
88013
|
-
atomicWriteText(filePath, updated);
|
|
88014
|
-
} else {
|
|
88015
|
-
const now = new Date().toISOString();
|
|
88016
|
-
const rendered = loadTemplate(vaultTemplates(), "daily-note", {
|
|
88017
|
-
title: date,
|
|
88018
|
-
date,
|
|
88019
|
-
body: content,
|
|
88020
|
-
created: now,
|
|
88021
|
-
updated: now
|
|
88022
|
-
});
|
|
88023
|
-
const noteContent = rendered ?? `---
|
|
88024
|
-
created: "${now}"
|
|
88025
|
-
updated: "${now}"
|
|
88026
|
-
tags: [daily]
|
|
88027
|
-
category: areas
|
|
88028
|
-
---
|
|
88029
|
-
|
|
88030
|
-
# ${date}
|
|
88031
|
-
|
|
88032
|
-
${content}
|
|
88033
|
-
`;
|
|
88034
|
-
atomicWriteText(filePath, noteContent);
|
|
88035
|
-
}
|
|
88036
|
-
return filePath;
|
|
88037
|
-
}
|
|
88038
|
-
function ingestFile(sourcePath, meta) {
|
|
88039
|
-
const raw = readFileSync26(sourcePath, "utf-8");
|
|
88040
|
-
const now = new Date().toISOString();
|
|
88041
|
-
const headingMatch = raw.match(/^#\s+(.+)$/m);
|
|
88042
|
-
const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
|
|
88043
|
-
const hasFrontmatter = raw.startsWith("---");
|
|
88044
|
-
let content;
|
|
88045
|
-
if (hasFrontmatter) {
|
|
88046
|
-
const endIdx = raw.indexOf("---", 3);
|
|
88047
|
-
if (endIdx !== -1) {
|
|
88048
|
-
const existingFm = raw.slice(0, endIdx + 3);
|
|
88049
|
-
const body = raw.slice(endIdx + 3).trim();
|
|
88050
|
-
if (!existingFm.includes("category:")) {
|
|
88051
|
-
const updatedFm = existingFm.replace(/---$/, `category: ${meta.category}
|
|
88052
|
-
---`);
|
|
88053
|
-
content = `${updatedFm}
|
|
88054
|
-
|
|
88055
|
-
${body}
|
|
88056
|
-
`;
|
|
88057
|
-
} else {
|
|
88058
|
-
content = raw;
|
|
88059
|
-
}
|
|
88060
|
-
} else {
|
|
88061
|
-
content = raw;
|
|
88062
|
-
}
|
|
88063
|
-
} else {
|
|
88064
|
-
const frontmatter = generateFrontmatter({
|
|
88065
|
-
created: now,
|
|
88066
|
-
updated: now,
|
|
88067
|
-
tags: meta.tags ?? [],
|
|
88068
|
-
category: meta.category,
|
|
88069
|
-
sourceProject: meta.sourceProject
|
|
88070
|
-
});
|
|
88071
|
-
content = `${frontmatter}
|
|
88072
|
-
|
|
88073
|
-
${raw}`;
|
|
88074
|
-
}
|
|
88075
|
-
const slug = slugifyTitle(title);
|
|
88076
|
-
const dir = categoryToDir(meta.category, meta.projectSlug);
|
|
88077
|
-
const filePath = join26(dir, `${slug}.md`);
|
|
88078
|
-
atomicWriteText(filePath, content);
|
|
88079
|
-
return { filePath, content };
|
|
88080
|
-
}
|
|
88081
|
-
var init_note_writer = __esm(() => {
|
|
88082
|
-
init_fs_utils();
|
|
88083
|
-
init_vault();
|
|
88084
|
-
init_vault_templates();
|
|
88085
|
-
});
|
|
88086
|
-
|
|
88087
88890
|
// src/commands/note.ts
|
|
88088
88891
|
var exports_note = {};
|
|
88089
88892
|
__export(exports_note, {
|
|
88090
88893
|
note: () => note
|
|
88091
88894
|
});
|
|
88092
|
-
import { resolve as
|
|
88895
|
+
import { resolve as resolve13 } from "path";
|
|
88093
88896
|
import { existsSync as existsSync29, readFileSync as readFileSync27 } from "fs";
|
|
88094
88897
|
async function note(cwd, args) {
|
|
88095
88898
|
if (!isWikiEnabled()) {
|
|
@@ -88120,7 +88923,7 @@ async function note(cwd, args) {
|
|
|
88120
88923
|
return;
|
|
88121
88924
|
}
|
|
88122
88925
|
if (parsed.file) {
|
|
88123
|
-
const sourcePath =
|
|
88926
|
+
const sourcePath = resolve13(cwd, parsed.file);
|
|
88124
88927
|
if (!existsSync29(sourcePath)) {
|
|
88125
88928
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
88126
88929
|
process.exit(1);
|
|
@@ -88282,29 +89085,29 @@ var exports_skill = {};
|
|
|
88282
89085
|
__export(exports_skill, {
|
|
88283
89086
|
skill: () => skill
|
|
88284
89087
|
});
|
|
88285
|
-
import { join as
|
|
89088
|
+
import { join as join28, resolve as resolve14, dirname as dirname13 } from "path";
|
|
88286
89089
|
import { homedir as homedir5 } from "os";
|
|
88287
89090
|
import {
|
|
88288
89091
|
existsSync as existsSync30,
|
|
88289
89092
|
mkdirSync as mkdirSync13,
|
|
88290
89093
|
copyFileSync,
|
|
88291
89094
|
unlinkSync as unlinkSync4,
|
|
88292
|
-
readdirSync as
|
|
89095
|
+
readdirSync as readdirSync9,
|
|
88293
89096
|
rmSync,
|
|
88294
89097
|
symlinkSync as symlinkSync2,
|
|
88295
89098
|
lstatSync as lstatSync2
|
|
88296
89099
|
} from "fs";
|
|
88297
89100
|
function getSkillsSourceDir() {
|
|
88298
|
-
return
|
|
89101
|
+
return resolve14(dirname13(new URL(import.meta.url).pathname), "../../skills");
|
|
88299
89102
|
}
|
|
88300
89103
|
function getAvailableSkills() {
|
|
88301
89104
|
const dir = getSkillsSourceDir();
|
|
88302
89105
|
if (!existsSync30(dir))
|
|
88303
89106
|
return [];
|
|
88304
|
-
return
|
|
89107
|
+
return readdirSync9(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync30(join28(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
88305
89108
|
}
|
|
88306
89109
|
function isInstalled(skillName) {
|
|
88307
|
-
return existsSync30(
|
|
89110
|
+
return existsSync30(join28(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
88308
89111
|
}
|
|
88309
89112
|
async function skill(args) {
|
|
88310
89113
|
const sub = args[0];
|
|
@@ -88340,9 +89143,9 @@ function skillInstall(name) {
|
|
|
88340
89143
|
}
|
|
88341
89144
|
mkdirSync13(AGENTS_SKILLS_DIR, { recursive: true });
|
|
88342
89145
|
for (const skillName of skills) {
|
|
88343
|
-
const srcDir =
|
|
88344
|
-
const srcFile =
|
|
88345
|
-
const destDir =
|
|
89146
|
+
const srcDir = join28(sourceDir, skillName);
|
|
89147
|
+
const srcFile = join28(srcDir, "SKILL.md");
|
|
89148
|
+
const destDir = join28(AGENTS_SKILLS_DIR, skillName);
|
|
88346
89149
|
if (!existsSync30(srcFile)) {
|
|
88347
89150
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
88348
89151
|
continue;
|
|
@@ -88350,7 +89153,7 @@ function skillInstall(name) {
|
|
|
88350
89153
|
mkdirSync13(destDir, { recursive: true });
|
|
88351
89154
|
copyDirRecursive(srcDir, destDir);
|
|
88352
89155
|
mkdirSync13(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
88353
|
-
const symlink =
|
|
89156
|
+
const symlink = join28(CLAUDE_SKILLS_DIR, skillName);
|
|
88354
89157
|
try {
|
|
88355
89158
|
if (existsSync30(symlink)) {
|
|
88356
89159
|
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
@@ -88359,7 +89162,7 @@ function skillInstall(name) {
|
|
|
88359
89162
|
rmSync(symlink, { recursive: true, force: true });
|
|
88360
89163
|
}
|
|
88361
89164
|
}
|
|
88362
|
-
const relativeTarget =
|
|
89165
|
+
const relativeTarget = join28("..", "..", ".agents", "skills", skillName);
|
|
88363
89166
|
symlinkSync2(relativeTarget, symlink);
|
|
88364
89167
|
} catch {}
|
|
88365
89168
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
@@ -88370,13 +89173,13 @@ function skillInstall(name) {
|
|
|
88370
89173
|
function skillUninstall(name) {
|
|
88371
89174
|
const skills = name ? [name] : getAvailableSkills();
|
|
88372
89175
|
for (const skillName of skills) {
|
|
88373
|
-
const destDir =
|
|
89176
|
+
const destDir = join28(AGENTS_SKILLS_DIR, skillName);
|
|
88374
89177
|
if (!existsSync30(destDir)) {
|
|
88375
89178
|
console.log(`[mink] not installed: ${skillName}`);
|
|
88376
89179
|
continue;
|
|
88377
89180
|
}
|
|
88378
89181
|
rmSync(destDir, { recursive: true, force: true });
|
|
88379
|
-
const symlink =
|
|
89182
|
+
const symlink = join28(CLAUDE_SKILLS_DIR, skillName);
|
|
88380
89183
|
try {
|
|
88381
89184
|
if (existsSync30(symlink))
|
|
88382
89185
|
unlinkSync4(symlink);
|
|
@@ -88393,7 +89196,7 @@ function skillList() {
|
|
|
88393
89196
|
if (installed.length > 0) {
|
|
88394
89197
|
console.log(" Installed:");
|
|
88395
89198
|
for (const s of installed) {
|
|
88396
|
-
console.log(` ${s} (${
|
|
89199
|
+
console.log(` ${s} (${join28(AGENTS_SKILLS_DIR, s)})`);
|
|
88397
89200
|
}
|
|
88398
89201
|
}
|
|
88399
89202
|
if (notInstalled.length > 0) {
|
|
@@ -88410,10 +89213,10 @@ function skillList() {
|
|
|
88410
89213
|
console.log(" Or via skills CLI: npx skills add drewpayment/mink");
|
|
88411
89214
|
}
|
|
88412
89215
|
function copyDirRecursive(src, dest) {
|
|
88413
|
-
const entries =
|
|
89216
|
+
const entries = readdirSync9(src, { withFileTypes: true });
|
|
88414
89217
|
for (const entry of entries) {
|
|
88415
|
-
const srcPath =
|
|
88416
|
-
const destPath =
|
|
89218
|
+
const srcPath = join28(src, entry.name);
|
|
89219
|
+
const destPath = join28(dest, entry.name);
|
|
88417
89220
|
if (entry.isDirectory()) {
|
|
88418
89221
|
mkdirSync13(destPath, { recursive: true });
|
|
88419
89222
|
copyDirRecursive(srcPath, destPath);
|
|
@@ -88424,8 +89227,8 @@ function copyDirRecursive(src, dest) {
|
|
|
88424
89227
|
}
|
|
88425
89228
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
88426
89229
|
var init_skill = __esm(() => {
|
|
88427
|
-
AGENTS_SKILLS_DIR =
|
|
88428
|
-
CLAUDE_SKILLS_DIR =
|
|
89230
|
+
AGENTS_SKILLS_DIR = join28(homedir5(), ".agents", "skills");
|
|
89231
|
+
CLAUDE_SKILLS_DIR = join28(homedir5(), ".claude", "skills");
|
|
88429
89232
|
});
|
|
88430
89233
|
|
|
88431
89234
|
// src/commands/sync.ts
|
|
@@ -88954,11 +89757,11 @@ switch (command2) {
|
|
|
88954
89757
|
case "version":
|
|
88955
89758
|
case "--version":
|
|
88956
89759
|
case "-v": {
|
|
88957
|
-
const { resolve:
|
|
88958
|
-
const cliPath =
|
|
89760
|
+
const { resolve: resolve15, dirname: dirname14 } = await import("path");
|
|
89761
|
+
const cliPath = resolve15(dirname14(new URL(import.meta.url).pathname));
|
|
88959
89762
|
const { readFileSync: readFileSync28 } = await import("fs");
|
|
88960
89763
|
try {
|
|
88961
|
-
const pkg = JSON.parse(readFileSync28(
|
|
89764
|
+
const pkg = JSON.parse(readFileSync28(resolve15(cliPath, "../package.json"), "utf-8"));
|
|
88962
89765
|
console.log(`mink ${pkg.version}`);
|
|
88963
89766
|
} catch {
|
|
88964
89767
|
console.log("mink (unknown version)");
|