@mnemonik/cli 7.103.0 → 7.103.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/digests.json +21 -21
- package/dist/install/journey.d.ts.map +1 -1
- package/dist/install/journey.js +171 -41
- package/dist/install/journey.js.map +1 -1
- package/dist/sbom.json +21 -21
- package/dist/scanner/discover.d.ts +2 -0
- package/dist/scanner/discover.d.ts.map +1 -1
- package/dist/scanner/discover.js +7 -4
- package/dist/scanner/discover.js.map +1 -1
- package/dist/scanner/enable.d.ts +1 -0
- package/dist/scanner/enable.d.ts.map +1 -1
- package/dist/scanner/enable.js +1 -0
- package/dist/scanner/enable.js.map +1 -1
- package/dist/scanner/picker.d.ts +1 -0
- package/dist/scanner/picker.d.ts.map +1 -1
- package/dist/scanner/picker.js +82 -49
- package/dist/scanner/picker.js.map +1 -1
- package/dist/scanner-release.json +19 -19
- package/dist/screens/journey.d.ts +3 -0
- package/dist/screens/journey.d.ts.map +1 -1
- package/dist/screens/journey.js +73 -3
- package/dist/screens/journey.js.map +1 -1
- package/package.json +41 -41
package/dist/digests.json
CHANGED
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"dist/router.d.ts.map": "0395d059355451637c0d6501875ec161bba7eb46f82a8023e6b3ba2d2886d1ec",
|
|
44
44
|
"dist/router.js": "1de5b58c00627bd2d654a64d7ee4bd597cff989be9af8d5624ca3191d210f47a",
|
|
45
45
|
"dist/router.js.map": "12a434e003c7cf2a62ea134224b9d79a64d69fd89cfdf3234c41f6b7d1befda0",
|
|
46
|
-
"dist/sbom.json": "
|
|
47
|
-
"dist/scanner-release.json": "
|
|
46
|
+
"dist/sbom.json": "2eac5e6a1192dc665b53fc2a6b80a5582064f110f0be65f4d95485ce1cc5677c",
|
|
47
|
+
"dist/scanner-release.json": "9de11c0584fa4e876a90cf9870a6fe2e560d55d6e22d9c6131b84b2b8141decf",
|
|
48
48
|
"dist/screens.d.ts": "1cf8371307f61409cb5f495a1577dac824b8c8b6cf41f1738c26d1eeb3379199",
|
|
49
49
|
"dist/screens.d.ts.map": "04c06aec78103390eb80382c4d4f0776ade2abafdb8dd2c3a9e9292ee01c4af8",
|
|
50
50
|
"dist/screens.js": "bc222e6dacd22f9d50432a7b6f48934c38913569a99f2636779ca45a7f88ac7b",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"dist/install/journal.js": "f62f672259d0b750f09dfa0d76a4129eb361f4b0d00dac69fc420f5e0f661aed",
|
|
95
95
|
"dist/install/journal.js.map": "24d7aa711920a3b514a72cb9914830d8540cf2188d93a0fd5dd726a8473e287d",
|
|
96
96
|
"dist/install/journey.d.ts": "f8a4ae8fa564e7d5b2720f524e4c5c5081399fbfc19d0c633a6036a53cf19b21",
|
|
97
|
-
"dist/install/journey.d.ts.map": "
|
|
98
|
-
"dist/install/journey.js": "
|
|
99
|
-
"dist/install/journey.js.map": "
|
|
97
|
+
"dist/install/journey.d.ts.map": "eca484ab4787d983942daae59e17d08304517ba508de3dbe59bef39a845fde26",
|
|
98
|
+
"dist/install/journey.js": "5001bb5959ee029397fc9ad474fb64ef06355afe760f9fd20d17c47768281be3",
|
|
99
|
+
"dist/install/journey.js.map": "eb08cd79412e8b3980aa342a7fb9b05fe6888831032097fac2fc9aa1e3db3416",
|
|
100
100
|
"dist/install/ownership.d.ts": "9ce76111b3424693a29036cd459ed14158ed11167f5f0aed13247df33941202b",
|
|
101
101
|
"dist/install/ownership.d.ts.map": "e16f1f8d7c9375f73041289ad78b9d8ea2dfdb01199967cdeb3c436c6a64570b",
|
|
102
102
|
"dist/install/ownership.js": "238b1e32ecbb170c8f24f03f31b06a2d308895168133291ee1a2902bf9c4255e",
|
|
@@ -145,18 +145,18 @@
|
|
|
145
145
|
"dist/scanner/data.d.ts.map": "997415437937f3c1c8848497198eb8a070fd5296adf6d5faffdfc5a885d26f7e",
|
|
146
146
|
"dist/scanner/data.js": "acb503efbe8e202550ef0b86c6a9a8a222682b8828042928947c92f76b13c1ae",
|
|
147
147
|
"dist/scanner/data.js.map": "490a61e186b7be15e63cc846563e323e91add45e1ed4a28a185ec22b07c7e8bd",
|
|
148
|
-
"dist/scanner/discover.d.ts": "
|
|
149
|
-
"dist/scanner/discover.d.ts.map": "
|
|
150
|
-
"dist/scanner/discover.js": "
|
|
151
|
-
"dist/scanner/discover.js.map": "
|
|
152
|
-
"dist/scanner/enable.d.ts": "
|
|
153
|
-
"dist/scanner/enable.d.ts.map": "
|
|
154
|
-
"dist/scanner/enable.js": "
|
|
155
|
-
"dist/scanner/enable.js.map": "
|
|
156
|
-
"dist/scanner/picker.d.ts": "
|
|
157
|
-
"dist/scanner/picker.d.ts.map": "
|
|
158
|
-
"dist/scanner/picker.js": "
|
|
159
|
-
"dist/scanner/picker.js.map": "
|
|
148
|
+
"dist/scanner/discover.d.ts": "8daf535b311c5cd6b0d8d4149aa279ba937fccdf6a66a7941789ab0345c87972",
|
|
149
|
+
"dist/scanner/discover.d.ts.map": "ceace7bbc93bd32e46f0c0afbad8c8dd5f51af0660dfd3b34fd6a7c08ded7b08",
|
|
150
|
+
"dist/scanner/discover.js": "acf8981edca1c87f949a19426539206964f54dccf44a2e80642aec3c2c7efd52",
|
|
151
|
+
"dist/scanner/discover.js.map": "0c16181109df421ccb2a563f8343eb5306acc945fd69547054145c889c3e99af",
|
|
152
|
+
"dist/scanner/enable.d.ts": "98857e3bd7bb91f3ef3693ded70f961f2bf108998717a3c7b7d4f760bd74be95",
|
|
153
|
+
"dist/scanner/enable.d.ts.map": "f900631cc60bc4cacc65320f63bf1fc76bffa445da00f18752a74676059f4c2d",
|
|
154
|
+
"dist/scanner/enable.js": "45ad7b4f065bd163121dbbe0ad65ad0b8b4b136fe48f334689e2b8a723a1f0a7",
|
|
155
|
+
"dist/scanner/enable.js.map": "9a2e8bd98c3eb84aa5391c3eecf1195f84772b989f59d6aa69b56f6aa6a60a84",
|
|
156
|
+
"dist/scanner/picker.d.ts": "6a6bc899c19f42c8820d0e68c92a0b54b79d0b1e577be2e882c3188f4bf75e84",
|
|
157
|
+
"dist/scanner/picker.d.ts.map": "dc812857aaa827af89486304054ac37e0e9dab31951c3e4693557ea7cc1480d7",
|
|
158
|
+
"dist/scanner/picker.js": "a6ebb7bd3afb86fe9326c5bd7d26638ba21ae63051c1eccc577257d4722172f1",
|
|
159
|
+
"dist/scanner/picker.js.map": "d2fe91bdefe7049b0240a47e4ae33646148792b30e1c33d1b9a3627e20f9e420",
|
|
160
160
|
"dist/scanner/service.d.ts": "f1559d1915dfc08efd7a149358fb39027312cbafd8a32f93e17cbc240ca62986",
|
|
161
161
|
"dist/scanner/service.d.ts.map": "58409ca5b81129cc619b8b166b913f764cb42753ad2cdf95ce6598abb2a51b74",
|
|
162
162
|
"dist/scanner/service.js": "f8b1dbf03ea07fc4bc9317673cbdcb2602c8d231ad7fcc67c79eb812a4c85638",
|
|
@@ -165,10 +165,10 @@
|
|
|
165
165
|
"dist/scanner/update.d.ts.map": "fdd2e50b12615000681f3f867cbc57ce2a7684627142008c570fa9832316ee24",
|
|
166
166
|
"dist/scanner/update.js": "a9427f65a91a0d19f72477d30607be00b472ac9b8a76e4dba8411377bcf1d145",
|
|
167
167
|
"dist/scanner/update.js.map": "f1bbe0ad9aff2eda7c7a4ea7888ac7091059481b637b0a88e2c6cbb5da5033e2",
|
|
168
|
-
"dist/screens/journey.d.ts": "
|
|
169
|
-
"dist/screens/journey.d.ts.map": "
|
|
170
|
-
"dist/screens/journey.js": "
|
|
171
|
-
"dist/screens/journey.js.map": "
|
|
168
|
+
"dist/screens/journey.d.ts": "c753f368bd0063c49b3b49093be4a61c30d11c060388428d4c2b6d853c758093",
|
|
169
|
+
"dist/screens/journey.d.ts.map": "9d10a3857a75e7c0be0f8519854e008bb71c35b20b144034ac793adf66f11e89",
|
|
170
|
+
"dist/screens/journey.js": "51ea38504f702b395a80cb03c5721b55f9259ca66c4cf30057812db446f89289",
|
|
171
|
+
"dist/screens/journey.js.map": "e6e5d91c341196ececd9f6ba5a5b34f4509f6efd354d84ce17b5e6c6d5213854",
|
|
172
172
|
"dist/transport/server.d.ts": "7c753c747615d9a4360ac669538d6653cdf1f3a100d25f6e11ce7a93f2c99166",
|
|
173
173
|
"dist/transport/server.d.ts.map": "86706da48210c58c6133bd104144dbdbfa4a48d27a109273a26607cf754c69f4",
|
|
174
174
|
"dist/transport/server.js": "23b9b32f3b027d64f7d32e699d6277f4449b4ec6724836468ea871f4b6d5fec4",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/install/journey.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/install/journey.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA0B3C,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEhB,MAAM,YAAY,CAAC;AAUpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EAAE,EACrB,OAAO,EAAE,OAAO,GACf,kBAAkB,EAAE,CAUtB;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,EACvC,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,EACxC,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,OAAO,CAAM,GAClD,OAAO,CAAC;IAAE,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CA0B7D;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EACjC,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAChC,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,GAC1C,OAAO,CAAC,MAAM,CAAC,CA60BjB"}
|
package/dist/install/journey.js
CHANGED
|
@@ -496,11 +496,54 @@ var require_ignore = __commonJS({
|
|
|
496
496
|
});
|
|
497
497
|
|
|
498
498
|
// packages/shared/dist/runtimeSigners.js
|
|
499
|
-
|
|
499
|
+
import { basename, dirname as dirname2, join as join2, resolve, sep, win32 } from "node:path";
|
|
500
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
501
|
+
function windowsCommand(file) {
|
|
502
|
+
const root = process.env.SystemRoot;
|
|
503
|
+
if (!root || !win32.isAbsolute(root))
|
|
504
|
+
throw new Error("acl_system_root_unavailable");
|
|
505
|
+
return win32.join(root, "System32", file);
|
|
506
|
+
}
|
|
507
|
+
function readIdentity(stdout) {
|
|
508
|
+
const match = /^"([^"\r\n]+)","(S-1-(?:\d+-)+\d+)"$/.exec(stdout.trim());
|
|
509
|
+
if (!match?.[1] || !match[2] || stdout.includes("\uFFFD"))
|
|
510
|
+
throw new Error("acl_identity_unavailable");
|
|
511
|
+
return { name: match[1], sid: match[2] };
|
|
512
|
+
}
|
|
513
|
+
function windowsCurrentAccountSync() {
|
|
514
|
+
return currentIdentity ??= readIdentity(hookExecuteSync(windowsCommand("whoami.exe"), identityArgs));
|
|
515
|
+
}
|
|
516
|
+
function hookInvocation(file, args2) {
|
|
517
|
+
if (win32.basename(file) === "whoami.exe") {
|
|
518
|
+
if ([file, ...args2].some((arg) => /[%!"\r\n]/.test(arg)))
|
|
519
|
+
throw new Error("acl_path_unavailable");
|
|
520
|
+
const command = args2.map((arg) => /^(?:[a-z0-9]+|\/[a-z]+)$/i.test(arg) ? arg : `"${arg}"`).join(" ");
|
|
521
|
+
return [
|
|
522
|
+
windowsCommand("cmd.exe"),
|
|
523
|
+
["/d", "/v:off", "/s", "/c", `"chcp 65001>nul & "${file}" ${command}"`]
|
|
524
|
+
];
|
|
525
|
+
}
|
|
526
|
+
if (win32.basename(file) === "cmd.exe")
|
|
527
|
+
return [file, ["/u", ...args2]];
|
|
528
|
+
return [file, args2];
|
|
529
|
+
}
|
|
530
|
+
function hookExecuteSync(file, args2, input) {
|
|
531
|
+
[file, args2] = hookInvocation(file, args2);
|
|
532
|
+
return execFileSync(file, args2, { ...hookOptions(file, args2), input });
|
|
533
|
+
}
|
|
534
|
+
var identityArgs, currentIdentity, ttl, hookOptions;
|
|
500
535
|
var init_runtimeSigners = __esm({
|
|
501
536
|
"packages/shared/dist/runtimeSigners.js"() {
|
|
502
537
|
"use strict";
|
|
538
|
+
identityArgs = ["/user", "/fo", "csv", "/nh"];
|
|
503
539
|
ttl = 10 * 6e4;
|
|
540
|
+
hookOptions = (file, args2) => ({
|
|
541
|
+
encoding: args2.includes("/u") ? "utf16le" : "utf8",
|
|
542
|
+
timeout: win32.basename(file) === "powershell.exe" ? 3e4 : 5e3,
|
|
543
|
+
windowsHide: true,
|
|
544
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
545
|
+
windowsVerbatimArguments: win32.basename(file) === "cmd.exe"
|
|
546
|
+
});
|
|
504
547
|
}
|
|
505
548
|
});
|
|
506
549
|
|
|
@@ -562,8 +605,8 @@ var init_hookRuntime = __esm({
|
|
|
562
605
|
});
|
|
563
606
|
|
|
564
607
|
// packages/cli/src/install/journey.ts
|
|
565
|
-
import { appendFile, mkdir, readFile } from "node:fs/promises";
|
|
566
|
-
import { join as
|
|
608
|
+
import { appendFile, mkdir as mkdir2, readFile as readFile2, rm } from "node:fs/promises";
|
|
609
|
+
import { join as join4 } from "node:path";
|
|
567
610
|
import { homedir as homedir2 } from "node:os";
|
|
568
611
|
import { setTimeout as delay } from "node:timers/promises";
|
|
569
612
|
|
|
@@ -2177,13 +2220,13 @@ async function Module2(moduleArg = {}) {
|
|
|
2177
2220
|
}
|
|
2178
2221
|
readAsync = /* @__PURE__ */ __name(async (url) => {
|
|
2179
2222
|
if (isFileURI(url)) {
|
|
2180
|
-
return new Promise((
|
|
2223
|
+
return new Promise((resolve2, reject) => {
|
|
2181
2224
|
var xhr = new XMLHttpRequest();
|
|
2182
2225
|
xhr.open("GET", url, true);
|
|
2183
2226
|
xhr.responseType = "arraybuffer";
|
|
2184
2227
|
xhr.onload = () => {
|
|
2185
2228
|
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
2186
|
-
|
|
2229
|
+
resolve2(xhr.response);
|
|
2187
2230
|
return;
|
|
2188
2231
|
}
|
|
2189
2232
|
reject(xhr.status);
|
|
@@ -2379,9 +2422,9 @@ async function Module2(moduleArg = {}) {
|
|
|
2379
2422
|
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
2380
2423
|
var info22 = getWasmImports();
|
|
2381
2424
|
if (Module["instantiateWasm"]) {
|
|
2382
|
-
return new Promise((
|
|
2425
|
+
return new Promise((resolve2, reject) => {
|
|
2383
2426
|
Module["instantiateWasm"](info22, (mod, inst) => {
|
|
2384
|
-
|
|
2427
|
+
resolve2(receiveInstance(mod, inst));
|
|
2385
2428
|
});
|
|
2386
2429
|
});
|
|
2387
2430
|
}
|
|
@@ -3712,8 +3755,8 @@ async function Module2(moduleArg = {}) {
|
|
|
3712
3755
|
if (runtimeInitialized) {
|
|
3713
3756
|
moduleRtn = Module;
|
|
3714
3757
|
} else {
|
|
3715
|
-
moduleRtn = new Promise((
|
|
3716
|
-
readyPromiseResolve =
|
|
3758
|
+
moduleRtn = new Promise((resolve2, reject) => {
|
|
3759
|
+
readyPromiseResolve = resolve2;
|
|
3717
3760
|
readyPromiseReject = reject;
|
|
3718
3761
|
});
|
|
3719
3762
|
}
|
|
@@ -4851,20 +4894,74 @@ function apiOrigin(env = process.env) {
|
|
|
4851
4894
|
// packages/local-setup/dist/storage.js
|
|
4852
4895
|
init_hookRuntime();
|
|
4853
4896
|
import { createHash, randomUUID } from "node:crypto";
|
|
4897
|
+
import { execFile as nodeExecFile } from "node:child_process";
|
|
4898
|
+
import { open, rename, readFile, mkdir, lstat, chmod, writeFile, unlink, rmdir } from "node:fs/promises";
|
|
4854
4899
|
import { homedir } from "node:os";
|
|
4855
|
-
import { dirname as
|
|
4900
|
+
import { dirname as dirname3, join as join3, win32 as win322, posix } from "node:path";
|
|
4856
4901
|
init_hookRuntime();
|
|
4857
4902
|
var hash2 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
4858
4903
|
function stateDirectory(platform = process.platform, env = process.env, home = homedir()) {
|
|
4859
4904
|
if (env.MNEMONIK_STATE_DIR)
|
|
4860
4905
|
return env.MNEMONIK_STATE_DIR;
|
|
4861
4906
|
if (platform === "win32")
|
|
4862
|
-
return
|
|
4907
|
+
return win322.join(env.LOCALAPPDATA || win322.join(home, "AppData", "Local"), "Mnemonik");
|
|
4863
4908
|
if (platform === "darwin")
|
|
4864
4909
|
return posix.join(home, "Library", "Application Support", "Mnemonik");
|
|
4865
4910
|
return posix.join(env.XDG_STATE_HOME || posix.join(home, ".local", "state"), "mnemonik");
|
|
4866
4911
|
}
|
|
4867
|
-
var recordPath = (root, state = stateDirectory()) =>
|
|
4912
|
+
var recordPath = (root, state = stateDirectory()) => join3(state, "project-setup", `${hash2(root)}.json`);
|
|
4913
|
+
async function syncDirectory(path) {
|
|
4914
|
+
if (process.platform === "win32")
|
|
4915
|
+
return;
|
|
4916
|
+
const fd = await open(path, "r");
|
|
4917
|
+
try {
|
|
4918
|
+
await fd.sync();
|
|
4919
|
+
} finally {
|
|
4920
|
+
await fd.close();
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
var windowsCurrentAccount = windowsCurrentAccountSync;
|
|
4924
|
+
async function windowsCurrentUserAcl(path, directory = false, options = {}) {
|
|
4925
|
+
const username = options.username ?? `*${windowsCurrentAccount().sid}`;
|
|
4926
|
+
const grant = `${username}:${directory ? "(OI)(CI)F" : "F"}`;
|
|
4927
|
+
const execFile2 = options.execFile ?? nodeExecFile;
|
|
4928
|
+
await new Promise((resolve2, reject) => {
|
|
4929
|
+
execFile2("icacls.exe", [path, "/inheritance:r", "/grant:r", grant], (error) => {
|
|
4930
|
+
if (error)
|
|
4931
|
+
reject(error);
|
|
4932
|
+
else
|
|
4933
|
+
resolve2();
|
|
4934
|
+
});
|
|
4935
|
+
});
|
|
4936
|
+
}
|
|
4937
|
+
async function protectStateFile(path, platform = process.platform, aclOptions) {
|
|
4938
|
+
if (platform === "win32")
|
|
4939
|
+
await windowsCurrentUserAcl(path, false, aclOptions);
|
|
4940
|
+
else
|
|
4941
|
+
await chmod(path, 384);
|
|
4942
|
+
return "private";
|
|
4943
|
+
}
|
|
4944
|
+
async function atomicWrite(path, bytes, fault, assertOwned) {
|
|
4945
|
+
await assertOwned?.();
|
|
4946
|
+
const temp = `${path}.${randomUUID()}.tmp`;
|
|
4947
|
+
const fd = await open(temp, "wx", 384);
|
|
4948
|
+
let permissionStatus;
|
|
4949
|
+
try {
|
|
4950
|
+
permissionStatus = await protectStateFile(temp);
|
|
4951
|
+
const split = Math.ceil(bytes.length / 2);
|
|
4952
|
+
await fd.writeFile(bytes.subarray(0, split));
|
|
4953
|
+
await fault?.("mid_write");
|
|
4954
|
+
await assertOwned?.();
|
|
4955
|
+
await fd.writeFile(bytes.subarray(split));
|
|
4956
|
+
await fd.sync();
|
|
4957
|
+
} finally {
|
|
4958
|
+
await fd.close();
|
|
4959
|
+
}
|
|
4960
|
+
await assertOwned?.();
|
|
4961
|
+
await rename(temp, path);
|
|
4962
|
+
await syncDirectory(dirname3(path));
|
|
4963
|
+
return permissionStatus;
|
|
4964
|
+
}
|
|
4868
4965
|
|
|
4869
4966
|
// packages/local-setup/dist/index.js
|
|
4870
4967
|
var MAX_ORIGINAL_BYTES = 64 * 1024;
|
|
@@ -4884,8 +4981,11 @@ import { devReadiness } from "../runtime/releaseSource.js";
|
|
|
4884
4981
|
import {
|
|
4885
4982
|
completedStep,
|
|
4886
4983
|
completedLine,
|
|
4984
|
+
ADD_ANOTHER_FOLDER,
|
|
4887
4985
|
renderCustomize,
|
|
4986
|
+
renderInterrupted,
|
|
4888
4987
|
renderJourney,
|
|
4988
|
+
renderRollbackResult,
|
|
4889
4989
|
journeyAnswers,
|
|
4890
4990
|
INSTALLATION_STOPPED,
|
|
4891
4991
|
stepProgress
|
|
@@ -4922,8 +5022,8 @@ async function waitForInstallation(check, timeout, clock = {}) {
|
|
|
4922
5022
|
try {
|
|
4923
5023
|
const result = await Promise.race([
|
|
4924
5024
|
check(),
|
|
4925
|
-
new Promise((
|
|
4926
|
-
timer = setTimeout(() =>
|
|
5025
|
+
new Promise((resolve2) => {
|
|
5026
|
+
timer = setTimeout(() => resolve2(void 0), Math.max(0, deadline - now()));
|
|
4927
5027
|
})
|
|
4928
5028
|
]);
|
|
4929
5029
|
if (result) document = result;
|
|
@@ -4941,7 +5041,9 @@ async function waitForInstallation(check, timeout, clock = {}) {
|
|
|
4941
5041
|
async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
4942
5042
|
if (flags2.has("accept-scanner")) flags2.set("accept-indexing", true);
|
|
4943
5043
|
const json = flags2.has("json");
|
|
4944
|
-
const
|
|
5044
|
+
const input = deps.input ?? process.stdin;
|
|
5045
|
+
const interactive = Boolean(input.isTTY);
|
|
5046
|
+
const automatic = json || flags2.has("non-interactive") || !interactive;
|
|
4945
5047
|
let components = String(
|
|
4946
5048
|
flags2.get("components") ?? (flags2.has("without-scanner") ? "hooks,mcp" : "hooks,mcp,scanner")
|
|
4947
5049
|
).split(",");
|
|
@@ -4975,8 +5077,6 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
4975
5077
|
}
|
|
4976
5078
|
const home = deps.home ?? homedir2();
|
|
4977
5079
|
let cwd = deps.cwd ?? process.cwd();
|
|
4978
|
-
const input = deps.input ?? process.stdin;
|
|
4979
|
-
const interactive = Boolean(input.isTTY);
|
|
4980
5080
|
let answers;
|
|
4981
5081
|
let stopped = false;
|
|
4982
5082
|
const interrupt = (signal) => {
|
|
@@ -5041,6 +5141,18 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5041
5141
|
scanner = components.includes("scanner");
|
|
5042
5142
|
names = [...new Set(previous.data.hostRequest?.selections.map((s) => s.host) ?? [])];
|
|
5043
5143
|
}
|
|
5144
|
+
const indexingSkippedPath = join4(stateDir, "indexing-skipped");
|
|
5145
|
+
const indexingOnly = Boolean(
|
|
5146
|
+
!previous && !automatic && !flags2.has("hosts") && !flags2.has("components") && (await readFile2(indexingSkippedPath).catch(() => void 0) || (await ownership.readOwnership(stateDir)).targets.length) && !await readFile2(join4(stateDir, "scanner/state.json")).then(
|
|
5147
|
+
() => true,
|
|
5148
|
+
() => false
|
|
5149
|
+
)
|
|
5150
|
+
);
|
|
5151
|
+
if (indexingOnly) {
|
|
5152
|
+
components = ["scanner"];
|
|
5153
|
+
scanner = true;
|
|
5154
|
+
names = [];
|
|
5155
|
+
}
|
|
5044
5156
|
startProgress("Checking this computer");
|
|
5045
5157
|
let preflight;
|
|
5046
5158
|
try {
|
|
@@ -5058,9 +5170,9 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5058
5170
|
throw error;
|
|
5059
5171
|
}
|
|
5060
5172
|
const root = preflight.project.root ?? cwd;
|
|
5061
|
-
const logPath =
|
|
5173
|
+
const logPath = join4(stateDir, "install.log");
|
|
5062
5174
|
const log = async (detail) => {
|
|
5063
|
-
await
|
|
5175
|
+
await mkdir2(stateDir, { recursive: true, mode: 448 });
|
|
5064
5176
|
await appendFile(logPath, `${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), detail })}
|
|
5065
5177
|
`, {
|
|
5066
5178
|
mode: 384
|
|
@@ -5068,7 +5180,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5068
5180
|
};
|
|
5069
5181
|
let roots = String(flags2.get("scan-roots") ?? previous?.data.roots.join(",") ?? "").split(",").filter(Boolean);
|
|
5070
5182
|
output.setContext({ home, projectRoot: root });
|
|
5071
|
-
if (!names.length)
|
|
5183
|
+
if (!names.length && !indexingOnly)
|
|
5072
5184
|
names = preflight.hosts.filter((h) => h.supported).map(
|
|
5073
5185
|
(h) => Object.keys(labels).find((key) => labels[key] === h.name) ?? ""
|
|
5074
5186
|
).filter(Boolean);
|
|
@@ -5146,7 +5258,8 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5146
5258
|
};
|
|
5147
5259
|
let restart = false;
|
|
5148
5260
|
try {
|
|
5149
|
-
if (previous?.data.joined
|
|
5261
|
+
if (previous?.data.joined) renderInterrupted(output);
|
|
5262
|
+
if (previous?.data.joined && await answers?.choose(["Resume", "Rollback"]) !== "Resume") {
|
|
5150
5263
|
const restored = await runHosts("install", [], {
|
|
5151
5264
|
stateDir,
|
|
5152
5265
|
account: previous.data.account,
|
|
@@ -5155,11 +5268,15 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5155
5268
|
rollbackInstall,
|
|
5156
5269
|
recovery: async () => "rollback"
|
|
5157
5270
|
});
|
|
5158
|
-
|
|
5159
|
-
for (const report of restored.reports) output.line(` ${report}`);
|
|
5271
|
+
renderRollbackResult(restored.journal.phase === "rolled_back", output);
|
|
5160
5272
|
return restored.journal.phase === "rolled_back" ? 130 : 1;
|
|
5161
5273
|
}
|
|
5162
|
-
if (
|
|
5274
|
+
if (indexingOnly) {
|
|
5275
|
+
const indexingLines = renderJourney("indexing", output);
|
|
5276
|
+
const choice = await answers?.choose(["Set up indexing", "Cancel"]);
|
|
5277
|
+
replaceScreen(indexingLines, choice === "Set up indexing" ? "Set up indexing" : void 0);
|
|
5278
|
+
if (choice !== "Set up indexing") return 130;
|
|
5279
|
+
} else if (!previous && !automatic && !flags2.has("hosts") && !flags2.has("components")) {
|
|
5163
5280
|
for (; ; ) {
|
|
5164
5281
|
const recommendedLines = renderJourney("recommended", output, {
|
|
5165
5282
|
hosts: names.map((h) => labels[h]),
|
|
@@ -5213,14 +5330,14 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5213
5330
|
}
|
|
5214
5331
|
throw new Error("preflight_failed");
|
|
5215
5332
|
}
|
|
5216
|
-
if (!automatic && !flags2.has("apply")) {
|
|
5333
|
+
if (!automatic && !flags2.has("apply") && !indexingOnly) {
|
|
5217
5334
|
renderJourney("account", output);
|
|
5218
5335
|
}
|
|
5219
5336
|
for (; ; ) {
|
|
5220
|
-
startProgress("Signing in");
|
|
5337
|
+
startProgress(indexingOnly ? "Checking your account" : "Signing in");
|
|
5221
5338
|
try {
|
|
5222
5339
|
await authorize();
|
|
5223
|
-
completeProgress("Signed in");
|
|
5340
|
+
completeProgress(indexingOnly ? "Account checked" : "Signed in");
|
|
5224
5341
|
break;
|
|
5225
5342
|
} catch (error) {
|
|
5226
5343
|
activeProgress?.stop();
|
|
@@ -5229,8 +5346,8 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5229
5346
|
throw error;
|
|
5230
5347
|
}
|
|
5231
5348
|
}
|
|
5232
|
-
if (!automatic) output.line(completedStep(3, "Configure editors"));
|
|
5233
|
-
startProgress("Configuring your editors");
|
|
5349
|
+
if (!automatic && !indexingOnly) output.line(completedStep(3, "Configure editors"));
|
|
5350
|
+
startProgress(indexingOnly ? "Getting ready" : "Configuring your editors");
|
|
5234
5351
|
const managed = await management();
|
|
5235
5352
|
reportFinal = async (readiness) => {
|
|
5236
5353
|
const versions = await ownership.readInstallVersions(stateDir, readiness.scanner?.version ?? void 0).catch(() => void 0);
|
|
@@ -5295,7 +5412,9 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5295
5412
|
}))
|
|
5296
5413
|
);
|
|
5297
5414
|
const afterHosts = async (journal, results, refreshHosts) => {
|
|
5298
|
-
completeProgress(
|
|
5415
|
+
completeProgress(
|
|
5416
|
+
indexingOnly ? "Ready" : `${names.length} ${names.length === 1 ? "editor" : "editors"} configured`
|
|
5417
|
+
);
|
|
5299
5418
|
journal.data.components = components;
|
|
5300
5419
|
journal.data.roots = roots;
|
|
5301
5420
|
const projectConditions = [];
|
|
@@ -5304,6 +5423,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5304
5423
|
prepared = scannerPlan;
|
|
5305
5424
|
let limitMessage;
|
|
5306
5425
|
if (scannerPlan) {
|
|
5426
|
+
startProgress("Connecting your repositories");
|
|
5307
5427
|
if (!executor) {
|
|
5308
5428
|
const runtime = await createRealProjectRuntime({
|
|
5309
5429
|
stateDir,
|
|
@@ -5321,7 +5441,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5321
5441
|
allowNestedInherit: false,
|
|
5322
5442
|
...repo.nonGitSelected ? { nonGitSelected: true } : {}
|
|
5323
5443
|
};
|
|
5324
|
-
const target = await journal.plan(
|
|
5444
|
+
const target = await journal.plan(join4(repo.path, ".mnemonik.json"), null, {
|
|
5325
5445
|
kind: "project"
|
|
5326
5446
|
});
|
|
5327
5447
|
await journal.event("project_stage_intent", repo.path);
|
|
@@ -5353,7 +5473,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5353
5473
|
nonGitSelected: repo.nonGitSelected
|
|
5354
5474
|
});
|
|
5355
5475
|
const record = JSON.parse(
|
|
5356
|
-
await
|
|
5476
|
+
await readFile2(recordPath(repo.path, deps.projectStateDir ?? stateDir), "utf8")
|
|
5357
5477
|
);
|
|
5358
5478
|
if (record.staged) await journal.propose(target, Buffer.from(record.staged.content));
|
|
5359
5479
|
await journal.stage(target);
|
|
@@ -5362,7 +5482,10 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5362
5482
|
roots = scannerPlan.roots;
|
|
5363
5483
|
journal.data.roots = roots;
|
|
5364
5484
|
}
|
|
5365
|
-
if (scannerPlan)
|
|
5485
|
+
if (scannerPlan) {
|
|
5486
|
+
completeProgress("Repositories connected");
|
|
5487
|
+
if (!json) output.line(` ${ADD_ANOTHER_FOLDER}`);
|
|
5488
|
+
}
|
|
5366
5489
|
if (!automatic && !flags2.has("apply")) {
|
|
5367
5490
|
for (; ; ) {
|
|
5368
5491
|
const applyLines = renderJourney("apply", output, {
|
|
@@ -5394,7 +5517,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5394
5517
|
if (result2?.status !== "done") throw new Error("project_apply_failed");
|
|
5395
5518
|
project.uuid = result2.projectId;
|
|
5396
5519
|
const target = journal.data.targets.find(
|
|
5397
|
-
(t) => t.path ===
|
|
5520
|
+
(t) => t.path === join4(project.root, ".mnemonik.json")
|
|
5398
5521
|
);
|
|
5399
5522
|
if (target) {
|
|
5400
5523
|
target.status = "committed";
|
|
@@ -5405,6 +5528,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5405
5528
|
if (scannerPlan) {
|
|
5406
5529
|
try {
|
|
5407
5530
|
scannerDocument = await scannerPlan.apply(journal, scannerPlan.roots);
|
|
5531
|
+
await rm(indexingSkippedPath, { force: true });
|
|
5408
5532
|
if (!json) {
|
|
5409
5533
|
if (scannerPlan.roots.length)
|
|
5410
5534
|
output.line(connectedProjectsMessage(scannerPlan.roots));
|
|
@@ -5495,13 +5619,13 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5495
5619
|
};
|
|
5496
5620
|
if (scanner) {
|
|
5497
5621
|
if (!automatic) renderJourney("scanner", output);
|
|
5498
|
-
startProgress("Connecting your repositories");
|
|
5499
5622
|
try {
|
|
5500
5623
|
await prepareScanner(
|
|
5501
5624
|
{
|
|
5502
5625
|
stateDir,
|
|
5503
5626
|
cwd: root,
|
|
5504
5627
|
input: deps.input ?? process.stdin,
|
|
5628
|
+
readAnswer: answers?.text,
|
|
5505
5629
|
output,
|
|
5506
5630
|
nonInteractive: automatic,
|
|
5507
5631
|
...roots.length ? { roots } : {},
|
|
@@ -5541,7 +5665,7 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5541
5665
|
(t) => t.kind === "project" && t.status !== "committed" && t.status !== "restored"
|
|
5542
5666
|
)) {
|
|
5543
5667
|
await executor?.rollback({
|
|
5544
|
-
cwd:
|
|
5668
|
+
cwd: join4(target.path, ".."),
|
|
5545
5669
|
allowCreate: true,
|
|
5546
5670
|
allowNestedInherit: false
|
|
5547
5671
|
});
|
|
@@ -5627,6 +5751,8 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5627
5751
|
};
|
|
5628
5752
|
final = await reportFinal({ ...final, ...launcher ? { launcher } : {} });
|
|
5629
5753
|
await log({ preflight, journal: result.journal, targets: result.results, readiness: final });
|
|
5754
|
+
if (!scanner && result.journal.state !== "FAILED")
|
|
5755
|
+
await atomicWrite(indexingSkippedPath, Buffer.from("indexing was skipped\n"));
|
|
5630
5756
|
completeProgress("Installation finished");
|
|
5631
5757
|
if (json)
|
|
5632
5758
|
output.json({
|
|
@@ -5640,8 +5766,13 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5640
5766
|
else {
|
|
5641
5767
|
if (result.journal.state === "FAILED") {
|
|
5642
5768
|
output.line(` Installation failed. Details: ${logPath}`);
|
|
5769
|
+
} else if (!scanner) {
|
|
5770
|
+
renderJourney("indexing_skipped", output);
|
|
5771
|
+
for (const action of new Set(final.installation.actions))
|
|
5772
|
+
if (action !== "mnemonik install" && action !== launcherError?.launcher.action)
|
|
5773
|
+
output.line(` ${action}`);
|
|
5643
5774
|
} else if (final.installation.state === "READY")
|
|
5644
|
-
renderJourney("done", output, {
|
|
5775
|
+
renderJourney(indexingOnly ? "indexing_done" : "done", output, {
|
|
5645
5776
|
total: final.indexing?.total,
|
|
5646
5777
|
completed: final.indexing?.completed
|
|
5647
5778
|
});
|
|
@@ -5650,10 +5781,9 @@ async function joinedInstall(flags2, deps, output, authorize, management) {
|
|
|
5650
5781
|
remaining: remainingReadinessCount(final.installation),
|
|
5651
5782
|
skipped: [...new Set(final.installation.actions)].join("\n") || "mnemonik status"
|
|
5652
5783
|
});
|
|
5653
|
-
if (launcherError
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
);
|
|
5784
|
+
if (launcherError) output.line(` ${launcherError.launcher.action}`);
|
|
5785
|
+
else if (launcher && !launcher.onPath)
|
|
5786
|
+
output.line(` ${launcherPathAction(launcherOptions)}`);
|
|
5657
5787
|
}
|
|
5658
5788
|
return result.journal.state === "FAILED" ? 1 : result.journal.phase === "rolled_back" ? 130 : final.installation.state === "READY" ? 0 : 3;
|
|
5659
5789
|
} catch (error) {
|