@quatronic/qore 0.2.0-rc.7 → 0.2.0-test.25bcaa2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +142 -52
- package/dist/qore-capabilities.json +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="28cd5ca7-9197-5e2a-b7a3-beb912fc49ed")}catch(e){}}();
|
|
4
4
|
import { createRequire as __qoreCreateRequire } from "node:module"; const require = __qoreCreateRequire(import.meta.url);
|
|
5
5
|
import {
|
|
6
6
|
addSecretValues,
|
|
@@ -269,26 +269,26 @@ function byStatus(status2) {
|
|
|
269
269
|
return "QORE_INTERNAL";
|
|
270
270
|
}
|
|
271
271
|
async function problemToError(res) {
|
|
272
|
-
let
|
|
272
|
+
let body2 = {};
|
|
273
273
|
try {
|
|
274
|
-
|
|
274
|
+
body2 = await res.json();
|
|
275
275
|
} catch {
|
|
276
276
|
}
|
|
277
|
-
const serverCode =
|
|
277
|
+
const serverCode = body2.code;
|
|
278
278
|
const code = serverCode && BY_SERVER_CODE[serverCode] || byStatus(res.status);
|
|
279
279
|
const requestId = res.headers.get("x-request-id") ?? void 0;
|
|
280
280
|
const details = {};
|
|
281
|
-
if (
|
|
282
|
-
const detail2 = typeof
|
|
281
|
+
if (body2.detail && typeof body2.detail === "object") Object.assign(details, body2.detail);
|
|
282
|
+
const detail2 = typeof body2.detail === "string" && body2.detail ? body2.detail : void 0;
|
|
283
283
|
if (detail2) details.detail = detail2;
|
|
284
284
|
const retry = res.headers.get("retry-after");
|
|
285
285
|
if (retry && /^\d+$/.test(retry)) details.retryAfter = Number(retry);
|
|
286
286
|
const hint = code === "QORE_UPGRADE_REQUIRED" ? "Run: npm i -g @quatronic/qore" : code === "QORE_RATE_LIMITED" ? `Wait ${details.retryAfter ?? "a moment"} s and retry.` : code === "QORE_API_UNAVAILABLE" ? "Qore is temporarily unavailable; retry in a minute." : code === "QORE_APP_AMBIGUOUS" ? "Pass --app <slug>." : void 0;
|
|
287
|
-
const apps =
|
|
287
|
+
const apps = body2.detail?.apps;
|
|
288
288
|
const candidates = code === "QORE_APP_AMBIGUOUS" && Array.isArray(apps) ? apps.map((a) => ({ kind: "app", id: a.id, slug: a.slug, name: a.name })) : void 0;
|
|
289
289
|
if (candidates) delete details.apps;
|
|
290
|
-
const genericTitle = !
|
|
291
|
-
const message = genericTitle && detail2 ||
|
|
290
|
+
const genericTitle = !body2.title || body2.title === "HTTP error" || body2.title === serverCode;
|
|
291
|
+
const message = genericTitle && detail2 || body2.title || `Request failed (${res.status})`;
|
|
292
292
|
return new QoreError(code, message, {
|
|
293
293
|
status: res.status,
|
|
294
294
|
requestId,
|
|
@@ -660,7 +660,7 @@ var QoreApiClient = class {
|
|
|
660
660
|
this.o = o;
|
|
661
661
|
}
|
|
662
662
|
o;
|
|
663
|
-
async once(method, path2,
|
|
663
|
+
async once(method, path2, body2, force) {
|
|
664
664
|
const token = await this.o.token(force);
|
|
665
665
|
const headers = {
|
|
666
666
|
authorization: `Bearer ${token}`,
|
|
@@ -669,13 +669,13 @@ var QoreApiClient = class {
|
|
|
669
669
|
"qore-command": this.o.command,
|
|
670
670
|
"user-agent": `qore/${this.o.cliVersion} (${this.o.platform})`
|
|
671
671
|
};
|
|
672
|
-
if (
|
|
672
|
+
if (body2 !== void 0) headers["content-type"] = "application/json";
|
|
673
673
|
let res;
|
|
674
674
|
try {
|
|
675
675
|
res = await this.o.fetch(`${this.o.apiOrigin}${path2}`, {
|
|
676
676
|
method,
|
|
677
677
|
headers,
|
|
678
|
-
body:
|
|
678
|
+
body: body2 === void 0 ? void 0 : JSON.stringify(body2)
|
|
679
679
|
});
|
|
680
680
|
} catch (e) {
|
|
681
681
|
throw fetchError(e, new URL(this.o.apiOrigin).host);
|
|
@@ -684,10 +684,10 @@ var QoreApiClient = class {
|
|
|
684
684
|
this.o.onRequest?.(`${method} ${path2} \u2192 ${res.status}${rid ? ` (${rid})` : ""}`);
|
|
685
685
|
return res;
|
|
686
686
|
}
|
|
687
|
-
async request(method, path2,
|
|
688
|
-
let res = await this.once(method, path2,
|
|
687
|
+
async request(method, path2, body2, parse2 = (r) => r.json()) {
|
|
688
|
+
let res = await this.once(method, path2, body2, false);
|
|
689
689
|
if (res.status === 401) {
|
|
690
|
-
res = await this.once(method, path2,
|
|
690
|
+
res = await this.once(method, path2, body2, true);
|
|
691
691
|
if (res.status === 401) {
|
|
692
692
|
const skew = clockSkewSeconds(res.headers.get("date"), (this.o.now ?? (() => /* @__PURE__ */ new Date()))());
|
|
693
693
|
if (skew !== null && Math.abs(skew) > 60) {
|
|
@@ -714,8 +714,8 @@ var QoreApiClient = class {
|
|
|
714
714
|
getText(path2) {
|
|
715
715
|
return this.request("GET", path2, void 0, (r) => r.text());
|
|
716
716
|
}
|
|
717
|
-
post(path2,
|
|
718
|
-
return this.request("POST", path2,
|
|
717
|
+
post(path2, body2) {
|
|
718
|
+
return this.request("POST", path2, body2);
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
721
|
|
|
@@ -2497,12 +2497,13 @@ async function readRepoConfig(root) {
|
|
|
2497
2497
|
|
|
2498
2498
|
// src/core/env/fetch.ts
|
|
2499
2499
|
async function fetchLocalEnv(deps2, mc, app) {
|
|
2500
|
-
await ensureCapability(deps2, mc.portal.apiOrigin, "module.local-env");
|
|
2500
|
+
const meta = await ensureCapability(deps2, mc.portal.apiOrigin, "module.local-env");
|
|
2501
2501
|
try {
|
|
2502
2502
|
const local = await mc.session.api.get(
|
|
2503
2503
|
`/api/cli/v1/modules/${encodeURIComponent(mc.module.id)}/local-env?app_id=${encodeURIComponent(app.id)}`
|
|
2504
2504
|
);
|
|
2505
2505
|
deps2.registerSecrets(Object.values(local.env));
|
|
2506
|
+
if (!meta.capabilities.includes("module.local-env-rules")) delete local.rules;
|
|
2506
2507
|
return local;
|
|
2507
2508
|
} catch (e) {
|
|
2508
2509
|
if (!(e instanceof QoreError) || e.code !== "QORE_ACCESS_DENIED") throw e;
|
|
@@ -2519,14 +2520,50 @@ async function fetchLocalEnv(deps2, mc, app) {
|
|
|
2519
2520
|
}
|
|
2520
2521
|
|
|
2521
2522
|
// src/core/env/merge.ts
|
|
2523
|
+
var KEY_LINE = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/;
|
|
2524
|
+
var stripCr = (line2) => line2.replace(/\r$/, "");
|
|
2525
|
+
var expandDouble = (raw) => raw.replace(/\\[nr]/g, (e) => e === "\\n" ? "\n" : "\r");
|
|
2526
|
+
function readValue(lines, at, rest) {
|
|
2527
|
+
const quote = rest[0];
|
|
2528
|
+
if (quote === '"' || quote === "'" || quote === "`") {
|
|
2529
|
+
let raw = "";
|
|
2530
|
+
let chunk = rest.slice(1);
|
|
2531
|
+
for (let j = at; ; ) {
|
|
2532
|
+
const end2 = chunk.indexOf(quote);
|
|
2533
|
+
if (end2 >= 0) {
|
|
2534
|
+
raw += chunk.slice(0, end2);
|
|
2535
|
+
return { value: quote === '"' ? expandDouble(raw) : raw, last: j };
|
|
2536
|
+
}
|
|
2537
|
+
raw += chunk + "\n";
|
|
2538
|
+
j++;
|
|
2539
|
+
if (j >= lines.length) break;
|
|
2540
|
+
chunk = stripCr(lines[j] ?? "");
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
return { value: rest, last: at };
|
|
2544
|
+
}
|
|
2545
|
+
function readEntries(lines) {
|
|
2546
|
+
const entries = [];
|
|
2547
|
+
for (let i = 0; i < lines.length; i++) {
|
|
2548
|
+
const m = stripCr(lines[i] ?? "").match(KEY_LINE);
|
|
2549
|
+
if (m?.[1] === void 0 || m[2] === void 0) continue;
|
|
2550
|
+
const { value, last } = readValue(lines, i, m[2]);
|
|
2551
|
+
entries.push({ key: m[1], value, first: i, last });
|
|
2552
|
+
i = last;
|
|
2553
|
+
}
|
|
2554
|
+
return entries;
|
|
2555
|
+
}
|
|
2522
2556
|
function parseEnv(contents) {
|
|
2523
2557
|
const map = /* @__PURE__ */ new Map();
|
|
2524
|
-
for (const
|
|
2525
|
-
const m = line2.replace(/\r$/, "").match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
2526
|
-
if (m?.[1] !== void 0 && m[2] !== void 0) map.set(m[1], m[2]);
|
|
2527
|
-
}
|
|
2558
|
+
for (const { key: key2, value } of readEntries(contents.split("\n"))) map.set(key2, value);
|
|
2528
2559
|
return map;
|
|
2529
2560
|
}
|
|
2561
|
+
function renderValue(value) {
|
|
2562
|
+
if (!/[\r\n#"'`]|^\s|\s$/.test(value)) return value;
|
|
2563
|
+
if (!/["\\\r]/.test(value)) return `"${value.replace(/\n/g, "\\n")}"`;
|
|
2564
|
+
if (!value.includes("'")) return `'${value}'`;
|
|
2565
|
+
return `\`${value}\``;
|
|
2566
|
+
}
|
|
2530
2567
|
function isManagedKey(key2, managed) {
|
|
2531
2568
|
for (const pattern of managed) {
|
|
2532
2569
|
if (pattern.endsWith("*")) {
|
|
@@ -2571,25 +2608,35 @@ function planEnvUpdate({
|
|
|
2571
2608
|
}
|
|
2572
2609
|
return { merged, conflicts, added, unchanged, overwritten };
|
|
2573
2610
|
}
|
|
2611
|
+
var renderEntry = (key2, value, eol) => `${key2}=${renderValue(value)}`.replace(/\r?\n/g, eol);
|
|
2574
2612
|
function renderEnv(original, merged) {
|
|
2575
2613
|
const seen = /* @__PURE__ */ new Set();
|
|
2576
2614
|
const lines = original.split("\n");
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2615
|
+
const eol = /\r?\n/.exec(original)?.[0] ?? "\n";
|
|
2616
|
+
const out = [];
|
|
2617
|
+
let next = 0;
|
|
2618
|
+
for (const { key: key2, value, first, last } of readEntries(lines)) {
|
|
2619
|
+
out.push(...lines.slice(next, first));
|
|
2620
|
+
next = last + 1;
|
|
2621
|
+
if (!merged.has(key2) || merged.get(key2) === value) {
|
|
2622
|
+
out.push(...lines.slice(first, next));
|
|
2623
|
+
if (merged.has(key2)) seen.add(key2);
|
|
2624
|
+
continue;
|
|
2625
|
+
}
|
|
2582
2626
|
seen.add(key2);
|
|
2583
|
-
|
|
2584
|
-
|
|
2627
|
+
const cr = lines[last]?.endsWith("\r") ? "\r" : "";
|
|
2628
|
+
out.push(renderEntry(key2, merged.get(key2) ?? "", `${cr}
|
|
2629
|
+
`) + cr);
|
|
2630
|
+
}
|
|
2631
|
+
out.push(...lines.slice(next));
|
|
2585
2632
|
const appended = [];
|
|
2586
2633
|
for (const [key2, value] of merged) {
|
|
2587
|
-
if (!seen.has(key2)) appended.push(
|
|
2634
|
+
if (!seen.has(key2)) appended.push(renderEntry(key2, value, eol));
|
|
2588
2635
|
}
|
|
2589
2636
|
let text2 = out.join("\n");
|
|
2590
2637
|
if (appended.length) {
|
|
2591
|
-
if (text2.length && !text2.endsWith("\n")) text2 +=
|
|
2592
|
-
text2 += appended.join(
|
|
2638
|
+
if (text2.length && !text2.endsWith("\n")) text2 += eol;
|
|
2639
|
+
text2 += appended.join(eol) + eol;
|
|
2593
2640
|
}
|
|
2594
2641
|
return text2;
|
|
2595
2642
|
}
|
|
@@ -2643,7 +2690,7 @@ function planPull(o) {
|
|
|
2643
2690
|
for (const key2 of o.localSecrets) {
|
|
2644
2691
|
const v = r.merged.get(key2);
|
|
2645
2692
|
if (v === void 0 || v === "" || v === '""' || v === "''") {
|
|
2646
|
-
r.merged.set(key2, o.random());
|
|
2693
|
+
r.merged.set(key2, o.random(key2));
|
|
2647
2694
|
generated.push(key2);
|
|
2648
2695
|
}
|
|
2649
2696
|
}
|
|
@@ -2686,6 +2733,13 @@ async function writeSecurely(target, text2) {
|
|
|
2686
2733
|
});
|
|
2687
2734
|
}
|
|
2688
2735
|
}
|
|
2736
|
+
function isGitIgnored(git, repoRoot, file) {
|
|
2737
|
+
return git.checkIgnore(repoRoot, file);
|
|
2738
|
+
}
|
|
2739
|
+
function notIgnoredWarning(file, repo) {
|
|
2740
|
+
const shown = repo ? join13(repo, file) : file;
|
|
2741
|
+
return `${shown} is not ignored by git. Add it to .gitignore; if it is already committed, run git ${repo ? `-C ${repo} ` : ""}rm --cached ${file}.`;
|
|
2742
|
+
}
|
|
2689
2743
|
async function syncEnvFile(o) {
|
|
2690
2744
|
const existing = await readOrNull(o.target);
|
|
2691
2745
|
const plan = planPull({
|
|
@@ -2699,7 +2753,7 @@ async function syncEnvFile(o) {
|
|
|
2699
2753
|
});
|
|
2700
2754
|
if (existing !== null && plan.text === existing) await chmod2(o.target, 384);
|
|
2701
2755
|
else await writeSecurely(o.target, plan.text);
|
|
2702
|
-
return { created: plan.created, kept: plan.kept };
|
|
2756
|
+
return { created: plan.created, kept: plan.kept, ignored: await isGitIgnored(o.git, o.repoRoot, o.target) };
|
|
2703
2757
|
}
|
|
2704
2758
|
|
|
2705
2759
|
// src/core/erd/source.ts
|
|
@@ -2713,7 +2767,7 @@ async function resolveDatabaseUrl(deps2, mc, app) {
|
|
|
2713
2767
|
const cfg = await readRepoConfig(mc.repoRoot);
|
|
2714
2768
|
const envFile = await resolveTarget(mc.repoRoot, cfg.envFile ?? moduleDefaults(mc.module.type).envFile);
|
|
2715
2769
|
const text2 = await readOrNull(envFile);
|
|
2716
|
-
const url2 = text2 === null ? void 0 : parseEnv(text2).get("DATABASE_URL")?.trim()
|
|
2770
|
+
const url2 = text2 === null ? void 0 : parseEnv(text2).get("DATABASE_URL")?.trim();
|
|
2717
2771
|
if (url2) {
|
|
2718
2772
|
deps2.registerSecrets([url2]);
|
|
2719
2773
|
return { url: url2, source: "env-file", envFile };
|
|
@@ -2770,9 +2824,9 @@ async function serveErd(o) {
|
|
|
2770
2824
|
const produce = o.routes[path2];
|
|
2771
2825
|
if (produce) {
|
|
2772
2826
|
try {
|
|
2773
|
-
const
|
|
2827
|
+
const body2 = JSON.stringify(await produce());
|
|
2774
2828
|
res.writeHead(200, { "content-type": TYPES[".json"], "cache-control": "no-store" });
|
|
2775
|
-
res.end(
|
|
2829
|
+
res.end(body2);
|
|
2776
2830
|
return;
|
|
2777
2831
|
} catch (e) {
|
|
2778
2832
|
try {
|
|
@@ -2787,9 +2841,9 @@ async function serveErd(o) {
|
|
|
2787
2841
|
const file = resolve6(root, `.${path2 === "/" ? "/index.html" : path2}`);
|
|
2788
2842
|
if (file !== root && !file.startsWith(root + sep3)) return end(res, 404);
|
|
2789
2843
|
try {
|
|
2790
|
-
const
|
|
2844
|
+
const body2 = await readFile6(file);
|
|
2791
2845
|
res.writeHead(200, { "content-type": TYPES[extname(file)] ?? "application/octet-stream" });
|
|
2792
|
-
res.end(
|
|
2846
|
+
res.end(body2);
|
|
2793
2847
|
} catch {
|
|
2794
2848
|
end(res, 404);
|
|
2795
2849
|
}
|
|
@@ -3412,7 +3466,7 @@ async function loadLastStart(deps2, root) {
|
|
|
3412
3466
|
function envPort(env, key2) {
|
|
3413
3467
|
const raw = env[key2];
|
|
3414
3468
|
if (raw === void 0) return null;
|
|
3415
|
-
const v = raw.trim()
|
|
3469
|
+
const v = raw.trim();
|
|
3416
3470
|
if (!/^\d+$/.test(v)) return null;
|
|
3417
3471
|
const n = Number(v);
|
|
3418
3472
|
return n >= 1024 && n <= 65535 ? n : null;
|
|
@@ -3431,7 +3485,9 @@ async function devEnv(deps2, o) {
|
|
|
3431
3485
|
fetched: local.env,
|
|
3432
3486
|
managed: local.managedKeys,
|
|
3433
3487
|
localSecrets: o.cfg.localSecrets ?? defaults.localSecrets,
|
|
3434
|
-
random: o.random
|
|
3488
|
+
random: (key2) => o.random(key2, local.rules?.[key2]),
|
|
3489
|
+
git: deps2.git,
|
|
3490
|
+
repoRoot: o.root
|
|
3435
3491
|
});
|
|
3436
3492
|
return {
|
|
3437
3493
|
env: local.env,
|
|
@@ -3453,7 +3509,27 @@ async function devEnv(deps2, o) {
|
|
|
3453
3509
|
});
|
|
3454
3510
|
}
|
|
3455
3511
|
const env = Object.fromEntries(parseEnv(text2));
|
|
3456
|
-
return { env, offline: true, envFile: target, port: envPort(env, "PORT"), dbPort: envPort(env, "DB_PORT"), created: false, kept: [] };
|
|
3512
|
+
return { env, offline: true, envFile: target, port: envPort(env, "PORT"), dbPort: envPort(env, "DB_PORT"), created: false, kept: [], ignored: null };
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
// src/core/env/secret.ts
|
|
3516
|
+
var DEFAULT_LENGTH = 64;
|
|
3517
|
+
function body(format, length, bytes) {
|
|
3518
|
+
if (length === 0) return "";
|
|
3519
|
+
if (format === "hex") return bytes(Math.ceil(length / 2)).toString("hex").slice(0, length);
|
|
3520
|
+
return bytes(Math.ceil(length * 3 / 4)).toString(format).slice(0, length);
|
|
3521
|
+
}
|
|
3522
|
+
function generateSecret(rules, bytes) {
|
|
3523
|
+
const prefix = rules?.startsWith ?? "";
|
|
3524
|
+
const suffix = rules?.endsWith ?? "";
|
|
3525
|
+
const format = rules?.format ?? "hex";
|
|
3526
|
+
let length = Math.max(rules?.minLength ?? 0, DEFAULT_LENGTH);
|
|
3527
|
+
if (rules?.maxLength !== void 0) length = Math.min(length, rules.maxLength);
|
|
3528
|
+
if (format === "base64" && length % 4) {
|
|
3529
|
+
const up = length + 4 - length % 4;
|
|
3530
|
+
length = rules?.maxLength === void 0 || up <= rules.maxLength ? up : length - length % 4;
|
|
3531
|
+
}
|
|
3532
|
+
return prefix + body(format, Math.max(0, length - prefix.length - suffix.length), bytes) + suffix;
|
|
3457
3533
|
}
|
|
3458
3534
|
|
|
3459
3535
|
// src/core/workspace/access.ts
|
|
@@ -4805,7 +4881,7 @@ async function prepareWorkspace(ctx, ws, f, waitTimeout, p) {
|
|
|
4805
4881
|
type: u.m.type,
|
|
4806
4882
|
moduleId: u.m.id,
|
|
4807
4883
|
cfg: u.cfg,
|
|
4808
|
-
random: () => randomBytes5
|
|
4884
|
+
random: (_key, rules) => generateSecret(rules, randomBytes5)
|
|
4809
4885
|
});
|
|
4810
4886
|
} catch (e) {
|
|
4811
4887
|
if (offlineCause && isOffline(e)) throw offlineCause;
|
|
@@ -4817,6 +4893,10 @@ async function prepareWorkspace(ctx, ws, f, waitTimeout, p) {
|
|
|
4817
4893
|
if (online && dev.offline) {
|
|
4818
4894
|
warn(`${slug}: the portal is unreachable \u2014 starting from ${relative6(rootReal, dev.envFile)} as last written; values may be stale.`, { module: slug });
|
|
4819
4895
|
}
|
|
4896
|
+
if (dev.ignored === false) {
|
|
4897
|
+
const repo = await realpath7(u.dir);
|
|
4898
|
+
warn(`${slug}: ${notIgnoredWarning(relative6(repo, dev.envFile), relative6(rootReal, repo))}`, { module: slug });
|
|
4899
|
+
}
|
|
4820
4900
|
if (dev.kept.length) {
|
|
4821
4901
|
warn(
|
|
4822
4902
|
`${slug}: ${dev.kept.length} key(s) differ locally and were kept: ${dev.kept.join(", ")} \u2014 qore env pull --use-portal takes the portal's values`,
|
|
@@ -5234,7 +5314,7 @@ async function prepareModule(ctx, f, waitTimeout, p) {
|
|
|
5234
5314
|
type: c.module.type,
|
|
5235
5315
|
moduleId: c.module.id,
|
|
5236
5316
|
cfg,
|
|
5237
|
-
random: () => randomBytes6
|
|
5317
|
+
random: (_key, rules) => generateSecret(rules, randomBytes6)
|
|
5238
5318
|
});
|
|
5239
5319
|
} catch (e) {
|
|
5240
5320
|
if (c.offlineCause && isOffline(e)) throw c.offlineCause;
|
|
@@ -5242,6 +5322,7 @@ async function prepareModule(ctx, f, waitTimeout, p) {
|
|
|
5242
5322
|
}
|
|
5243
5323
|
const envFile = relative7(await realpath8(root), dev.envFile);
|
|
5244
5324
|
if (dev.offline) io2.err(`! The portal is unreachable \u2014 starting from ${envFile} as last written; values may be stale.`);
|
|
5325
|
+
if (dev.ignored === false) io2.err(`! ${notIgnoredWarning(envFile)}`);
|
|
5245
5326
|
if (dev.kept.length) {
|
|
5246
5327
|
io2.err(`! ${dev.kept.length} key(s) differ locally and were kept: ${dev.kept.join(", ")} \u2014 qore env pull --use-portal takes the portal's values`);
|
|
5247
5328
|
}
|
|
@@ -5600,15 +5681,15 @@ async function runDoctor(deps2, o = {}) {
|
|
|
5600
5681
|
const results = [];
|
|
5601
5682
|
const context = { kind: "none" };
|
|
5602
5683
|
const push = async (id, group, fn, module) => {
|
|
5603
|
-
let
|
|
5684
|
+
let body2;
|
|
5604
5685
|
try {
|
|
5605
|
-
|
|
5686
|
+
body2 = await fn();
|
|
5606
5687
|
} catch (e) {
|
|
5607
|
-
if (e instanceof ToolTimeout)
|
|
5688
|
+
if (e instanceof ToolTimeout) body2 = { status: "warn", label: e.message, details: { timeoutMs: e.ms } };
|
|
5608
5689
|
else if (isCancel(e, signal)) throw e;
|
|
5609
|
-
else
|
|
5690
|
+
else body2 = withError("fail", errorLabel(e), e);
|
|
5610
5691
|
}
|
|
5611
|
-
const r = { id, group, ...module ? { module } : {}, ...
|
|
5692
|
+
const r = { id, group, ...module ? { module } : {}, ...body2 };
|
|
5612
5693
|
results.push(r);
|
|
5613
5694
|
return r;
|
|
5614
5695
|
};
|
|
@@ -5796,7 +5877,7 @@ function registerEnv(program, ctx) {
|
|
|
5796
5877
|
managed: local.managedKeys,
|
|
5797
5878
|
localSecrets: cfg.localSecrets ?? defaults.localSecrets,
|
|
5798
5879
|
defaultChoice: f.usePortal ? "use-portal" : "keep",
|
|
5799
|
-
random: () =>
|
|
5880
|
+
random: (key2) => generateSecret(local.rules?.[key2], randomBytes7)
|
|
5800
5881
|
};
|
|
5801
5882
|
let plan = planPull(inputs);
|
|
5802
5883
|
if (plan.conflicts.length && io2.interactive && !f.usePortal) {
|
|
@@ -5843,6 +5924,7 @@ function registerEnv(program, ctx) {
|
|
|
5843
5924
|
renderJson(io2, { context: contextJson(mc, app), target: rel, ...names });
|
|
5844
5925
|
return;
|
|
5845
5926
|
}
|
|
5927
|
+
if (await isGitIgnored(deps2.git, mc.repoRoot, target) === false) io2.err(`! ${notIgnoredWarning(rel)}`);
|
|
5846
5928
|
if (plan.kept.length && !io2.interactive) {
|
|
5847
5929
|
io2.err(`! ${plan.kept.length} key(s) differ locally and were kept: ${plan.kept.join(", ")} \u2014 --use-portal takes the portal's values`);
|
|
5848
5930
|
}
|
|
@@ -7519,6 +7601,14 @@ async function status(repoRoot) {
|
|
|
7519
7601
|
if (r.code !== 0) return { ok: false, stderr: r.stderr, command };
|
|
7520
7602
|
return parseStatus(r.stdout);
|
|
7521
7603
|
}
|
|
7604
|
+
async function checkIgnore(repoRoot, file) {
|
|
7605
|
+
try {
|
|
7606
|
+
const r = await runGit(["-C", repoRoot, "check-ignore", "-q", "--", file], repoRoot);
|
|
7607
|
+
return r.code === 0 ? true : r.code === 1 ? false : null;
|
|
7608
|
+
} catch {
|
|
7609
|
+
return null;
|
|
7610
|
+
}
|
|
7611
|
+
}
|
|
7522
7612
|
async function statOrThrow(path2) {
|
|
7523
7613
|
try {
|
|
7524
7614
|
return await stat7(path2);
|
|
@@ -7542,7 +7632,7 @@ async function inspect(dir2) {
|
|
|
7542
7632
|
const dirRemotes = isRepo ? await remotes(dir2) : [];
|
|
7543
7633
|
return { exists: true, empty: empty2, isRepo, remotes: dirRemotes };
|
|
7544
7634
|
}
|
|
7545
|
-
var systemGit = { remotes, clone, fetch, pullFfOnly, status, inspect };
|
|
7635
|
+
var systemGit = { remotes, clone, fetch, pullFfOnly, status, inspect, checkIgnore };
|
|
7546
7636
|
|
|
7547
7637
|
// src/platform/keychain.ts
|
|
7548
7638
|
import { Entry } from "@napi-rs/keyring";
|
|
@@ -8120,4 +8210,4 @@ if (!drained) {
|
|
|
8120
8210
|
process.exit();
|
|
8121
8211
|
}
|
|
8122
8212
|
//# sourceMappingURL=cli.js.map
|
|
8123
|
-
//# debugId=
|
|
8213
|
+
//# debugId=28cd5ca7-9197-5e2a-b7a3-beb912fc49ed
|