@quatronic/qore 0.4.0-test.45abf0b → 0.4.0-test.8369eed
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 +6 -0
- package/dist/cli.js +74 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,12 @@ a hint rather than leaving a bare error (spec §14.2):
|
|
|
293
293
|
- **A leftover `qore dev` holds the port**: in a TTY, offers to stop it
|
|
294
294
|
(`Stop the previous qore dev (pid N)?`); outside a TTY it's just
|
|
295
295
|
`QORE_PORT_IN_USE`.
|
|
296
|
+
- **Another checkout of the same module holds `DB_PORT`** (a worktree or a
|
|
297
|
+
second clone, whose compose project is named after its own folder): the
|
|
298
|
+
error names that checkout and suggests stopping its database there or
|
|
299
|
+
running `qore dev` from it. The two checkouts are matched on the managed
|
|
300
|
+
keys `QORE_MODULE` and `QORE_CUSTOMER_ID` in their env files, so this needs
|
|
301
|
+
no portal call. `qore doctor` reports the same.
|
|
296
302
|
- **The dev server exits within seconds of starting**: its tail output is
|
|
297
303
|
classified into a hint — a missing dependency (`Cannot find module`), an
|
|
298
304
|
invalid/missing env var (a `ZodError`'s keys, never values), a port taken
|
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]="fdf8ddca-c1bb-5549-9d3b-a2a664c8a79c")}catch(e){}}();
|
|
4
4
|
import { createRequire as __qoreCreateRequire } from "node:module"; const require = __qoreCreateRequire(import.meta.url);
|
|
5
5
|
import {
|
|
6
6
|
addSecretValues,
|
|
@@ -4621,9 +4621,9 @@ async function erdApp(ctx, f, ws) {
|
|
|
4621
4621
|
|
|
4622
4622
|
// src/cli/commands/dev.ts
|
|
4623
4623
|
import { randomBytes as randomBytes8 } from "crypto";
|
|
4624
|
-
import { realpath as
|
|
4624
|
+
import { realpath as realpath12 } from "fs/promises";
|
|
4625
4625
|
import { constants as constants5 } from "os";
|
|
4626
|
-
import { dirname as dirname10, join as
|
|
4626
|
+
import { dirname as dirname10, join as join29, relative as relative9 } from "path";
|
|
4627
4627
|
import { StringDecoder } from "string_decoder";
|
|
4628
4628
|
|
|
4629
4629
|
// src/core/diagnostics/node.ts
|
|
@@ -4907,6 +4907,10 @@ function noLocalRole(o) {
|
|
|
4907
4907
|
};
|
|
4908
4908
|
}
|
|
4909
4909
|
|
|
4910
|
+
// src/core/dev/preflight.ts
|
|
4911
|
+
import { realpath as realpath10 } from "fs/promises";
|
|
4912
|
+
import { join as join25 } from "path";
|
|
4913
|
+
|
|
4910
4914
|
// src/core/dev/project.ts
|
|
4911
4915
|
import { access, readFile as readFile7 } from "fs/promises";
|
|
4912
4916
|
import { join as join23 } from "path";
|
|
@@ -5195,6 +5199,24 @@ async function installIfNeeded(deps2, r, slug, onLine, report, signal) {
|
|
|
5195
5199
|
}
|
|
5196
5200
|
report({ module: slug, step: "install", status: "done", detail: secs(deps2.now().getTime() - began) });
|
|
5197
5201
|
}
|
|
5202
|
+
async function checkoutEnv(dir2) {
|
|
5203
|
+
const named2 = await readRepoConfig(dir2).then((c) => c.envFile, () => void 0);
|
|
5204
|
+
for (const file of [named2, ".env.local", ".env"]) {
|
|
5205
|
+
if (!file) continue;
|
|
5206
|
+
const text2 = await readOrNull(join25(dir2, file));
|
|
5207
|
+
if (text2 !== null) return Object.fromEntries(parseEnv(text2));
|
|
5208
|
+
}
|
|
5209
|
+
return null;
|
|
5210
|
+
}
|
|
5211
|
+
async function isOtherCheckoutOfModule(dir2, o) {
|
|
5212
|
+
const module = o.env?.QORE_MODULE;
|
|
5213
|
+
const customer = o.env?.QORE_CUSTOMER_ID;
|
|
5214
|
+
if (!module || !customer || !o.root) return false;
|
|
5215
|
+
const resolve9 = (p) => realpath10(p).catch(() => p);
|
|
5216
|
+
if (await resolve9(dir2) === await resolve9(o.root)) return false;
|
|
5217
|
+
const other = await checkoutEnv(dir2);
|
|
5218
|
+
return other?.QORE_MODULE === module && other.QORE_CUSTOMER_ID === customer;
|
|
5219
|
+
}
|
|
5198
5220
|
async function portInUseError(deps2, o) {
|
|
5199
5221
|
const owner = await deps2.ports.owner(o.port);
|
|
5200
5222
|
const qoreRun = (o.runs ?? []).find((r) => r.children.some((c) => c.port === o.port) || owner !== null && (r.qorePid === owner.pid || r.children.some((c) => c.pid === owner.pid)));
|
|
@@ -5207,6 +5229,12 @@ async function portInUseError(deps2, o) {
|
|
|
5207
5229
|
if (owner) {
|
|
5208
5230
|
if (/^(com\.docker\.backend|com\.docker\.vpnkit|docker-proxy|vpnkit|dockerd)$/.test(owner.command)) {
|
|
5209
5231
|
const pub = await deps2.ports.dockerPublisher(o.port);
|
|
5232
|
+
if (pub?.workingDir && await isOtherCheckoutOfModule(pub.workingDir, o)) {
|
|
5233
|
+
return new QoreError("QORE_PORT_IN_USE", `Port ${o.port} is held by ${o.slug}'s database from ${pub.workingDir}`, {
|
|
5234
|
+
hint: `That is another checkout of ${o.slug}, and both use port ${o.port}. Stop it there (docker compose down in ${pub.workingDir}, or docker stop ${pub.name}), or run qore dev from that checkout instead.`,
|
|
5235
|
+
details: { port: o.port, module: o.slug, key: o.key, owner: "docker", sameModule: true, ...pub }
|
|
5236
|
+
});
|
|
5237
|
+
}
|
|
5210
5238
|
if (pub) {
|
|
5211
5239
|
return new QoreError("QORE_PORT_IN_USE", `Port ${o.port} is held by the Docker container ${pub.name} (needed by ${o.slug})`, {
|
|
5212
5240
|
hint: `It belongs to compose project ${pub.project} in ${pub.workingDir} \u2014 typically another module's or tenant's database. Stop it there with docker compose down, or docker stop ${pub.name}.`,
|
|
@@ -5276,7 +5304,7 @@ async function startServices(deps2, r, slug, env, dbPort2, waitMs, signal, onLin
|
|
|
5276
5304
|
const res = await runTool(deps2, cmd, args, { cwd: r.root, env, onLine, signal });
|
|
5277
5305
|
if (res.code !== 0) {
|
|
5278
5306
|
if (dbPort2 !== null && /port is already allocated|address already in use/i.test(res.tail.join("\n"))) {
|
|
5279
|
-
throw await portInUseError(deps2, { slug, port: dbPort2, key: "DB_PORT" });
|
|
5307
|
+
throw await portInUseError(deps2, { slug, port: dbPort2, key: "DB_PORT", root: r.root, env });
|
|
5280
5308
|
}
|
|
5281
5309
|
throw await composeFailure(deps2, r, slug, env, signal, `${script} failed in ${slug}`, `${cmd} ${args.join(" ")}`, res.tail);
|
|
5282
5310
|
}
|
|
@@ -5450,11 +5478,11 @@ function hintContext(recipe, pkg, env) {
|
|
|
5450
5478
|
|
|
5451
5479
|
// src/core/dev/runFile.ts
|
|
5452
5480
|
import { readdir as readdir5, unlink as unlink2 } from "fs/promises";
|
|
5453
|
-
import { join as
|
|
5481
|
+
import { join as join26 } from "path";
|
|
5454
5482
|
async function runFilePath(deps2, root) {
|
|
5455
|
-
const dir2 =
|
|
5483
|
+
const dir2 = join26(deps2.config.dir, "run");
|
|
5456
5484
|
const name = `${await stateKey(deps2, root)}.json`;
|
|
5457
|
-
return { dir: dir2, name, path:
|
|
5485
|
+
return { dir: dir2, name, path: join26(dir2, name) };
|
|
5458
5486
|
}
|
|
5459
5487
|
async function writeRunFile(deps2, root, rec) {
|
|
5460
5488
|
const { dir: dir2, name } = await runFilePath(deps2, root);
|
|
@@ -5475,9 +5503,9 @@ async function leftoverRun(deps2, root, o = {}) {
|
|
|
5475
5503
|
return null;
|
|
5476
5504
|
}
|
|
5477
5505
|
async function listRunFiles(deps2) {
|
|
5478
|
-
const dir2 =
|
|
5506
|
+
const dir2 = join26(deps2.config.dir, "run");
|
|
5479
5507
|
const names = await readdir5(dir2).catch(() => []);
|
|
5480
|
-
const recs = await Promise.all(names.filter((n) => n.endsWith(".json")).map((n) => readJson(
|
|
5508
|
+
const recs = await Promise.all(names.filter((n) => n.endsWith(".json")).map((n) => readJson(join26(dir2, n)).catch(() => null)));
|
|
5481
5509
|
return recs.filter((r) => !!r && r.schemaVersion === 1 && Array.isArray(r.children));
|
|
5482
5510
|
}
|
|
5483
5511
|
|
|
@@ -5606,8 +5634,8 @@ async function inPreflight(signals, outer, fn) {
|
|
|
5606
5634
|
// src/cli/commands/devWorkspace.ts
|
|
5607
5635
|
import { randomBytes as randomBytes7 } from "crypto";
|
|
5608
5636
|
import { constants as constants4 } from "os";
|
|
5609
|
-
import { realpath as
|
|
5610
|
-
import { basename as basename7, join as
|
|
5637
|
+
import { realpath as realpath11 } from "fs/promises";
|
|
5638
|
+
import { basename as basename7, join as join28, relative as relative8 } from "path";
|
|
5611
5639
|
|
|
5612
5640
|
// src/core/dev/order.ts
|
|
5613
5641
|
function selectSkips(modules, sel) {
|
|
@@ -5928,7 +5956,7 @@ function supervise(o) {
|
|
|
5928
5956
|
|
|
5929
5957
|
// src/core/workspace/stray.ts
|
|
5930
5958
|
import { lstat as lstat4, readdir as readdir6 } from "fs/promises";
|
|
5931
|
-
import { join as
|
|
5959
|
+
import { join as join27 } from "path";
|
|
5932
5960
|
var VIEW_ENTRIES = /* @__PURE__ */ new Set(["qore.workspace.json", ".idea", ".claude", "CLAUDE.md", "README.md"]);
|
|
5933
5961
|
async function strayRepos(root, slugs, o = {}) {
|
|
5934
5962
|
let entries;
|
|
@@ -5942,8 +5970,8 @@ async function strayRepos(root, slugs, o = {}) {
|
|
|
5942
5970
|
if (slugs.has(name)) continue;
|
|
5943
5971
|
if (o.view && (VIEW_ENTRIES.has(name) || name.endsWith(".code-workspace"))) continue;
|
|
5944
5972
|
try {
|
|
5945
|
-
if ((await readEntry(
|
|
5946
|
-
await lstat4(
|
|
5973
|
+
if ((await readEntry(join27(root, name))).kind !== "dir") continue;
|
|
5974
|
+
await lstat4(join27(root, name, ".git"));
|
|
5947
5975
|
names.push(name);
|
|
5948
5976
|
} catch {
|
|
5949
5977
|
}
|
|
@@ -6147,7 +6175,7 @@ async function prepareWorkspace(ctx, ws, f, waitTimeout, p) {
|
|
|
6147
6175
|
let neutral;
|
|
6148
6176
|
const units = [];
|
|
6149
6177
|
for (const u of planned) {
|
|
6150
|
-
u.realDir = await
|
|
6178
|
+
u.realDir = await realpath11(u.dir).catch(() => u.dir);
|
|
6151
6179
|
const match = await findRunning(running, { moduleId: u.m.id, realDir: u.realDir, exceptPid: deps2.pid, exceptRoot: ws.root });
|
|
6152
6180
|
const port = match?.child.port ?? null;
|
|
6153
6181
|
if (!match) {
|
|
@@ -6261,7 +6289,7 @@ async function prepareWorkspace(ctx, ws, f, waitTimeout, p) {
|
|
|
6261
6289
|
workspace: ws,
|
|
6262
6290
|
module: { id: u.m.id, slug: u.m.slug, name: u.m.name, type: u.m.type, access: u.m.access, tenant: am.app.tenant, apps: [appRef] }
|
|
6263
6291
|
});
|
|
6264
|
-
const rootReal = await
|
|
6292
|
+
const rootReal = await realpath11(ws.root);
|
|
6265
6293
|
const withDocker = dockerRecovery(ctx, p.signal);
|
|
6266
6294
|
for (const u of units.filter((x) => x.recipe && x.trusted)) {
|
|
6267
6295
|
const slug = u.m.slug;
|
|
@@ -6287,7 +6315,7 @@ async function prepareWorkspace(ctx, ws, f, waitTimeout, p) {
|
|
|
6287
6315
|
warn(`${slug}: the portal is unreachable \u2014 starting from ${relative8(rootReal, dev.envFile)} as last written; values may be stale.`, { module: slug });
|
|
6288
6316
|
}
|
|
6289
6317
|
if (dev.ignored === false) {
|
|
6290
|
-
const repo = await
|
|
6318
|
+
const repo = await realpath11(u.dir);
|
|
6291
6319
|
warn(`${slug}: ${notIgnoredWarning(relative8(repo, dev.envFile), relative8(rootReal, repo))}`, { module: slug });
|
|
6292
6320
|
}
|
|
6293
6321
|
if (dev.kept.length) {
|
|
@@ -6343,7 +6371,7 @@ async function prepareWorkspace(ctx, ws, f, waitTimeout, p) {
|
|
|
6343
6371
|
if (online && units.every((u) => !u.dev.offline)) {
|
|
6344
6372
|
const envFile = (m) => {
|
|
6345
6373
|
const u = units.find((x) => x.m.id === m.id);
|
|
6346
|
-
return u ? relative8(rootReal, u.dev.envFile) :
|
|
6374
|
+
return u ? relative8(rootReal, u.dev.envFile) : join28(m.slug, moduleDefaults(m.type).envFile);
|
|
6347
6375
|
};
|
|
6348
6376
|
await saveLastStart(deps2, ws.root, {
|
|
6349
6377
|
schemaVersion: 1,
|
|
@@ -6628,7 +6656,7 @@ async function providerFindings(ctx, root, mc, app, env) {
|
|
|
6628
6656
|
let fix = `qore clone ${app.slug}`;
|
|
6629
6657
|
if (ws && ws.appId === app.id) fix = cdAndDev(deps2.home, ws.root);
|
|
6630
6658
|
else if (providers.length === 1) {
|
|
6631
|
-
const sibling =
|
|
6659
|
+
const sibling = join29(dirname10(root), providers[0].slug);
|
|
6632
6660
|
if ((await deps2.git.inspect(sibling)).isRepo) fix = cdAndDev(deps2.home, sibling);
|
|
6633
6661
|
}
|
|
6634
6662
|
return providerDown({
|
|
@@ -6764,7 +6792,7 @@ async function prepareModule(ctx, f, waitTimeout, p) {
|
|
|
6764
6792
|
if (c.offlineCause && isOffline(e)) throw c.offlineCause;
|
|
6765
6793
|
throw e;
|
|
6766
6794
|
}
|
|
6767
|
-
const envFile = relative9(await
|
|
6795
|
+
const envFile = relative9(await realpath12(root), dev.envFile);
|
|
6768
6796
|
if (dev.offline) io2.err(`! The portal is unreachable \u2014 starting from ${envFile} as last written; values may be stale.`);
|
|
6769
6797
|
if (dev.ignored === false) io2.err(`! ${notIgnoredWarning(envFile)}`);
|
|
6770
6798
|
if (dev.kept.length) {
|
|
@@ -6825,7 +6853,7 @@ function registerDebugTelemetry(program, ctx) {
|
|
|
6825
6853
|
import pc3 from "picocolors";
|
|
6826
6854
|
|
|
6827
6855
|
// src/core/doctor/checks.ts
|
|
6828
|
-
import { realpath as
|
|
6856
|
+
import { realpath as realpath13, stat as stat6 } from "fs/promises";
|
|
6829
6857
|
import { basename as basename8 } from "path";
|
|
6830
6858
|
|
|
6831
6859
|
// src/core/diagnostics/ssh.ts
|
|
@@ -7004,11 +7032,12 @@ function checkClock(meta) {
|
|
|
7004
7032
|
function ownerText(e) {
|
|
7005
7033
|
const d = e.details ?? {};
|
|
7006
7034
|
if (d.owner === "process") return ` by ${String(d.command)} (pid ${String(d.pid)})`;
|
|
7035
|
+
if (d.owner === "docker" && d.sameModule) return ` by another checkout of ${String(d.module)} (${String(d.workingDir)})`;
|
|
7007
7036
|
if (d.owner === "docker") return ` by the Docker container ${String(d.name)}`;
|
|
7008
7037
|
if (d.owner === "qore") return ` by a previous qore dev (pid ${String(d.pid)})`;
|
|
7009
7038
|
return "";
|
|
7010
7039
|
}
|
|
7011
|
-
var sameDir = async (a, b) => await
|
|
7040
|
+
var sameDir = async (a, b) => await realpath13(a).catch(() => a) === await realpath13(b).catch(() => b);
|
|
7012
7041
|
async function moduleBody(deps2, m, runs, signal) {
|
|
7013
7042
|
const parts = [];
|
|
7014
7043
|
const part = async (fn) => {
|
|
@@ -7051,7 +7080,7 @@ async function moduleBody(deps2, m, runs, signal) {
|
|
|
7051
7080
|
if (!await deps2.ports.inUse(dbPort2)) return { status: "ok", label: `db:up (DB_PORT ${dbPort2} free)` };
|
|
7052
7081
|
const pub = await deps2.ports.dockerPublisher(dbPort2);
|
|
7053
7082
|
if (pub?.workingDir && await sameDir(pub.workingDir, m.root)) return { status: "ok", label: "db running" };
|
|
7054
|
-
const e = await portInUseError(deps2, { slug: m.slug, port: dbPort2, key: "DB_PORT" });
|
|
7083
|
+
const e = await portInUseError(deps2, { slug: m.slug, port: dbPort2, key: "DB_PORT", root: m.root, env: env ?? void 0 });
|
|
7055
7084
|
return { status: "fail", label: `DB_PORT ${dbPort2} in use${ownerText(e)}`, error: e };
|
|
7056
7085
|
});
|
|
7057
7086
|
const status2 = parts.reduce((w, p) => RANK[p.status] > RANK[w] ? p.status : w, "ok");
|
|
@@ -7297,17 +7326,17 @@ function registerDoctor(program, ctx) {
|
|
|
7297
7326
|
|
|
7298
7327
|
// src/cli/commands/env.ts
|
|
7299
7328
|
import { randomBytes as randomBytes9 } from "crypto";
|
|
7300
|
-
import { chmod as chmod4, realpath as
|
|
7301
|
-
import { dirname as dirname11, join as
|
|
7329
|
+
import { chmod as chmod4, realpath as realpath14 } from "fs/promises";
|
|
7330
|
+
import { dirname as dirname11, join as join31, relative as relative10 } from "path";
|
|
7302
7331
|
|
|
7303
7332
|
// src/core/env/mobile.ts
|
|
7304
7333
|
import { chmod as chmod3, stat as stat7 } from "fs/promises";
|
|
7305
|
-
import { join as
|
|
7334
|
+
import { join as join30 } from "path";
|
|
7306
7335
|
var MOBILE_ENV_FILE = "mobile/.env.local";
|
|
7307
7336
|
var MOBILE_KEYS = ["EXPO_PUBLIC_SERVER_URL", "EXPO_PUBLIC_SENTRY_DSN", "EXPO_PUBLIC_QORE_ENV"];
|
|
7308
7337
|
async function hasMobileApp(repoRoot) {
|
|
7309
7338
|
try {
|
|
7310
|
-
return (await stat7(
|
|
7339
|
+
return (await stat7(join30(repoRoot, "mobile"))).isDirectory();
|
|
7311
7340
|
} catch {
|
|
7312
7341
|
return false;
|
|
7313
7342
|
}
|
|
@@ -7359,7 +7388,7 @@ function registerEnv(program, ctx) {
|
|
|
7359
7388
|
const target = f.target ? await resolveTarget(mc.repoRoot, f.target, deps2.cwd) : await resolveTarget(mc.repoRoot, cfg.envFile ?? defaults.envFile);
|
|
7360
7389
|
await ensureTrusted(c, mc, app, { yes: f.yes });
|
|
7361
7390
|
const existing = await readOrNull(target);
|
|
7362
|
-
const example = existing === null ? await readOrNull(
|
|
7391
|
+
const example = existing === null ? await readOrNull(join31(dirname11(target), ".env.example")) : null;
|
|
7363
7392
|
const local = await fetchLocalEnv(deps2, mc, app);
|
|
7364
7393
|
const inputs = {
|
|
7365
7394
|
existing,
|
|
@@ -7400,7 +7429,7 @@ function registerEnv(program, ctx) {
|
|
|
7400
7429
|
} else {
|
|
7401
7430
|
await writeSecurely(target, plan.text);
|
|
7402
7431
|
}
|
|
7403
|
-
const rel = relative10(await
|
|
7432
|
+
const rel = relative10(await realpath14(mc.repoRoot), target);
|
|
7404
7433
|
const mobile = await pullMobile(c, mc, app);
|
|
7405
7434
|
if (g.json) {
|
|
7406
7435
|
const names = {
|
|
@@ -7948,7 +7977,7 @@ function registerErrors(program, ctx) {
|
|
|
7948
7977
|
}
|
|
7949
7978
|
|
|
7950
7979
|
// src/cli/commands/init.ts
|
|
7951
|
-
import { realpath as
|
|
7980
|
+
import { realpath as realpath15 } from "fs/promises";
|
|
7952
7981
|
|
|
7953
7982
|
// src/core/auth/oidc.ts
|
|
7954
7983
|
import * as oc from "openid-client";
|
|
@@ -8227,7 +8256,7 @@ async function rootStep(ctx, f) {
|
|
|
8227
8256
|
input2 = await io2.input("Projects folder", { default: current ?? "~/qore" }) || current || "~/qore";
|
|
8228
8257
|
}
|
|
8229
8258
|
const wanted = await checkRoot(deps2, input2);
|
|
8230
|
-
const asked = await
|
|
8259
|
+
const asked = await realpath15(wanted).catch(() => wanted);
|
|
8231
8260
|
if (current && asked !== current && io2.interactive && !await io2.confirm(`Change the projects folder from ${current} to ${asked}? Nothing is moved.`, ctx.signal)) {
|
|
8232
8261
|
return step("skipped", current);
|
|
8233
8262
|
}
|
|
@@ -8411,7 +8440,7 @@ function registerPortal(program, ctx) {
|
|
|
8411
8440
|
}
|
|
8412
8441
|
|
|
8413
8442
|
// src/core/roles/read.ts
|
|
8414
|
-
import { join as
|
|
8443
|
+
import { join as join32 } from "path";
|
|
8415
8444
|
|
|
8416
8445
|
// src/core/roles/extract.ts
|
|
8417
8446
|
var KNOWN = { user: "User", admin: "App admin" };
|
|
@@ -8446,7 +8475,7 @@ var SLUG = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
|
8446
8475
|
var MAX_SLUG = 64;
|
|
8447
8476
|
var MAX_ROLES = 100;
|
|
8448
8477
|
async function readCodeRoles(repoRoot) {
|
|
8449
|
-
const source = await readOrNull(
|
|
8478
|
+
const source = await readOrNull(join32(repoRoot, PERMISSIONS_FILE));
|
|
8450
8479
|
if (source === null) {
|
|
8451
8480
|
throw new QoreError("QORE_CONTEXT_UNSUPPORTED", `No ${PERMISSIONS_FILE} in this module`, {
|
|
8452
8481
|
hint: "App roles live in the app's frontend module; run this there."
|
|
@@ -8637,8 +8666,8 @@ function registerStatus(program, ctx) {
|
|
|
8637
8666
|
}
|
|
8638
8667
|
|
|
8639
8668
|
// src/cli/commands/sync.ts
|
|
8640
|
-
import { realpath as
|
|
8641
|
-
import { basename as basename9, join as
|
|
8669
|
+
import { realpath as realpath16 } from "fs/promises";
|
|
8670
|
+
import { basename as basename9, join as join33, relative as relative11 } from "path";
|
|
8642
8671
|
import { Option as Option3 } from "commander";
|
|
8643
8672
|
function asFailure2(slug, e) {
|
|
8644
8673
|
if (e instanceof QoreError && e.code !== "QORE_GIT_UNAVAILABLE") {
|
|
@@ -8658,7 +8687,7 @@ async function syncInPlace(deps2, o) {
|
|
|
8658
8687
|
continue;
|
|
8659
8688
|
}
|
|
8660
8689
|
try {
|
|
8661
|
-
dirs[m.slug] = await deps2.git.inspect(
|
|
8690
|
+
dirs[m.slug] = await deps2.git.inspect(join33(root, m.slug));
|
|
8662
8691
|
modulesForPlan.push(m);
|
|
8663
8692
|
} catch (e) {
|
|
8664
8693
|
earlyFailures.push(asFailure2(m.slug, e));
|
|
@@ -8690,7 +8719,7 @@ async function syncTenant(ctx, o) {
|
|
|
8690
8719
|
const { deps: deps2, io: io2 } = ctx;
|
|
8691
8720
|
const { layout, app } = o;
|
|
8692
8721
|
const label3 = (root) => relative11(layout.tenantDir, root) || basename9(root);
|
|
8693
|
-
const own = await
|
|
8722
|
+
const own = await realpath16(o.wsRoot).catch(() => o.wsRoot);
|
|
8694
8723
|
const apps = [{ appSlug: app.app.slug, root: own, kind: o.kind, modules: app.modules }];
|
|
8695
8724
|
const views = [{ appSlug: app.app.slug, name: app.app.name, appId: app.app.id, modules: app.modules }];
|
|
8696
8725
|
const leftAlone = [];
|
|
@@ -9104,7 +9133,7 @@ async function maybeNotifyUpdate(deps2, io2, o, timeoutMs = DEFAULT_TIMEOUT_MS)
|
|
|
9104
9133
|
|
|
9105
9134
|
// src/core/config.ts
|
|
9106
9135
|
import { readFile as readFile8 } from "fs/promises";
|
|
9107
|
-
import { join as
|
|
9136
|
+
import { join as join34 } from "path";
|
|
9108
9137
|
var empty = () => ({ schemaVersion: 1, profiles: {} });
|
|
9109
9138
|
var ConfigStore = class {
|
|
9110
9139
|
constructor(dir2) {
|
|
@@ -9112,7 +9141,7 @@ var ConfigStore = class {
|
|
|
9112
9141
|
}
|
|
9113
9142
|
dir;
|
|
9114
9143
|
get file() {
|
|
9115
|
-
return
|
|
9144
|
+
return join34(this.dir, "config.json");
|
|
9116
9145
|
}
|
|
9117
9146
|
async read() {
|
|
9118
9147
|
let raw;
|
|
@@ -9145,7 +9174,7 @@ var ConfigStore = class {
|
|
|
9145
9174
|
import { execFile, execFileSync } from "child_process";
|
|
9146
9175
|
import { mkdir as mkdir6, readdir as readdir7, stat as stat8 } from "fs/promises";
|
|
9147
9176
|
import { homedir } from "os";
|
|
9148
|
-
import { dirname as dirname12, join as
|
|
9177
|
+
import { dirname as dirname12, join as join35 } from "path";
|
|
9149
9178
|
function parseRemotes(stdout) {
|
|
9150
9179
|
const seen = /* @__PURE__ */ new Set();
|
|
9151
9180
|
const out = [];
|
|
@@ -9303,7 +9332,7 @@ async function inspect(dir2) {
|
|
|
9303
9332
|
throw new QoreError("QORE_INTERNAL", `could not read ${dir2}`, { cause: err });
|
|
9304
9333
|
}
|
|
9305
9334
|
const empty2 = entries.length === 0;
|
|
9306
|
-
const isRepo = await statOrThrow(
|
|
9335
|
+
const isRepo = await statOrThrow(join35(dir2, ".git")) !== void 0;
|
|
9307
9336
|
const dirRemotes = isRepo ? await remotes(dir2) : [];
|
|
9308
9337
|
return { exists: true, empty: empty2, isRepo, remotes: dirRemotes };
|
|
9309
9338
|
}
|
|
@@ -9436,13 +9465,13 @@ var OsKeychain = class extends ChunkedKeychain {
|
|
|
9436
9465
|
|
|
9437
9466
|
// src/platform/lock.ts
|
|
9438
9467
|
import { mkdir as mkdir7, writeFile as writeFile7 } from "fs/promises";
|
|
9439
|
-
import { join as
|
|
9468
|
+
import { join as join36 } from "path";
|
|
9440
9469
|
import lockfile from "proper-lockfile";
|
|
9441
9470
|
function fileLock(dir2) {
|
|
9442
9471
|
return async (name, fn) => {
|
|
9443
|
-
const locks =
|
|
9472
|
+
const locks = join36(dir2, "locks");
|
|
9444
9473
|
await mkdir7(locks, { recursive: true, mode: 448 });
|
|
9445
|
-
const target =
|
|
9474
|
+
const target = join36(locks, `${name}.lock`);
|
|
9446
9475
|
await writeFile7(target, "", { flag: "a" });
|
|
9447
9476
|
let release;
|
|
9448
9477
|
let compromised;
|
|
@@ -9895,4 +9924,4 @@ if (!drained) {
|
|
|
9895
9924
|
process.exit();
|
|
9896
9925
|
}
|
|
9897
9926
|
//# sourceMappingURL=cli.js.map
|
|
9898
|
-
//# debugId=
|
|
9927
|
+
//# debugId=fdf8ddca-c1bb-5549-9d3b-a2a664c8a79c
|