xovris 0.2.1 → 0.2.3

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.
@@ -86,6 +86,10 @@ var Api = class {
86
86
  ...typeof d.type === "string" ? { type: d.type } : {}
87
87
  }, false);
88
88
  }
89
+ /** D01.07: a site added to the workspace by its address - its first checks start at once and every part it exposes is watched after. */
90
+ addSite(url) {
91
+ return this.ok("POST", "/assets", { url });
92
+ }
89
93
  deviceCode(clientName) {
90
94
  return this.ok("POST", "/device/code", {
91
95
  client_id: "xovris-cli",
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
- import { F as guardStrip, G as leaveBy, J as reviewChange, K as forAgents, M as commandRunner, N as undoFixes, R as valueCopy, S as revertOne, W as handOff, X as readsForShape, Y as stackChain, Z as testsFirst, at as probeNames, ct as parseDiff, et as refreshDeprecations, it as assumptionsOf, nt as dirReader, ot as readingsOf, q as readsForReview, rt as workOut, st as newFileDiff, x as fixAll, z as applyGuarded } from "./src-F88zycxp.js";
2
- import { a as whoami, c as Cancelled, d as ApiFailure, f as CLI_AGENT, l as clackUi, n as login, o as writeFileAtomic, p as CLI_VERSION, r as logout, s as signIn, t as apiCommand, u as Api } from "./apicmd-BHGPPVbb.js";
3
- import { a as gatedWriteFile, i as gatedWrite, n as gatedRun, t as MANIFEST_FILES } from "./gated-write-C1W3tG1Z.js";
4
- import { i as splitCommandLine, n as collectorAt, r as joinCollector, t as addExporter } from "./collector-join-B_k2_7BR.js";
5
- import { a as reviewSarif, i as reviewJson, n as progressLine, r as renderReview, s as styleFor, t as leftToFix } from "./review-ui-D-aMGRo2.js";
1
+ import { F as guardStrip, G as leaveBy, J as reviewChange, K as forAgents, M as commandRunner, N as undoFixes, R as valueCopy, S as revertOne, W as handOff, X as readsForShape, Y as stackChain, Z as testsFirst, at as probeNames, ct as parseDiff, et as refreshDeprecations, it as assumptionsOf, nt as dirReader, ot as readingsOf, q as readsForReview, rt as workOut, st as newFileDiff, x as fixAll, z as applyGuarded } from "./src-B0vsXZ7G.js";
2
+ import { a as whoami, c as Cancelled, d as ApiFailure, f as CLI_AGENT, l as clackUi, n as login, o as writeFileAtomic, p as CLI_VERSION, r as logout, s as signIn, t as apiCommand, u as Api } from "./apicmd-jzeA2Hy4.js";
3
+ import { a as gatedWriteFile, i as gatedWrite, n as gatedRun, t as MANIFEST_FILES } from "./gated-write-B4sTpeuD.js";
4
+ import { i as splitCommandLine, n as collectorAt, r as joinCollector, t as addExporter } from "./collector-join-Clmi1Zd4.js";
5
+ import { a as reviewSarif, i as reviewJson, n as progressLine, r as renderReview, s as styleFor, t as leftToFix } from "./review-ui-BpNWzPD7.js";
6
6
  import { builtinModules } from "node:module";
7
7
  import { mkdir, mkdtemp, readFile, readdir, rm, stat, unlink, writeFile } from "node:fs/promises";
8
8
  import { homedir, tmpdir } from "node:os";
@@ -3333,15 +3333,33 @@ const first = (rules, n) => {
3333
3333
  }
3334
3334
  return null;
3335
3335
  };
3336
+ const ownRecord = (xs, what) => {
3337
+ const x = xs.find((v) => v.includes("."));
3338
+ if (!x) return null;
3339
+ const d = x.split(".").slice(-2).join(".");
3340
+ return {
3341
+ id: `open:${d}`,
3342
+ name: d,
3343
+ evidence: [`${what} ${x}`]
3344
+ };
3345
+ };
3346
+ const ownHeader = (n, k, what) => {
3347
+ const v = n.h[k]?.trim();
3348
+ return v ? {
3349
+ id: `open:${v.toLowerCase().replace(/[^a-z0-9.-]+/g, "-").slice(0, 60)}`,
3350
+ name: v.slice(0, 80),
3351
+ evidence: [`${what} "${v.slice(0, 80)}"`]
3352
+ } : null;
3353
+ };
3336
3354
  function fingerprint(r) {
3337
3355
  const n = norm(r);
3338
3356
  const stack = first(STACK_RULES, n);
3339
3357
  return {
3340
3358
  url: r.url,
3341
- host: first(HOSTS$1, n),
3342
- cdn: first(CDNS, n),
3343
- dns: first(DNS, n),
3344
- mail: first(MAIL, n),
3359
+ host: first(HOSTS$1, n) ?? ownRecord(n.cname, "its address points at") ?? ownHeader(n, "server", "it answers with server"),
3360
+ cdn: first(CDNS, n) ?? ownHeader(n, "via", "it passes through"),
3361
+ dns: first(DNS, n) ?? ownRecord(n.ns, "its name server is"),
3362
+ mail: first(MAIL, n) ?? ownRecord(n.mx, "its mail goes to"),
3345
3363
  stack: stack ? {
3346
3364
  ...stack,
3347
3365
  name: STACKS.find((s) => s.id === stack.id)?.name ?? stack.name
@@ -9152,6 +9170,175 @@ async function recipeChanges(p, r, stack) {
9152
9170
  return { changes: out };
9153
9171
  }
9154
9172
 
9173
+ //#endregion
9174
+ //#region src/scan.ts
9175
+ /**
9176
+ * The machine's own resolver first; when it cannot be reached at all (a local resolver that refuses, as on some VPNs and
9177
+ * corporate laptops), the same question goes to Cloudflare's public resolver over HTTPS (DNS JSON API) - the names are
9178
+ * public records, and a scan is never blocked by a resolver it could route around (G99). "No such record" stays an answer.
9179
+ */
9180
+ const ANSWERED = new Set([
9181
+ "ENODATA",
9182
+ "ENOTFOUND",
9183
+ "NOTFOUND",
9184
+ "NODATA"
9185
+ ]);
9186
+ const DOH_TYPE = {
9187
+ ns: 2,
9188
+ mx: 15,
9189
+ cname: 5
9190
+ };
9191
+ function resolverFor(f = fetch) {
9192
+ const doh = async (name, type) => {
9193
+ try {
9194
+ return ((await (await f(`https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(name)}&type=${type.toUpperCase()}`, {
9195
+ headers: { accept: "application/dns-json" },
9196
+ signal: AbortSignal.timeout(8e3)
9197
+ })).json()).Answer ?? []).filter((a) => a.type === DOH_TYPE[type]).map((a) => (type === "mx" ? a.data.split(/\s+/).pop() : a.data).replace(/\.$/, ""));
9198
+ } catch {
9199
+ return [];
9200
+ }
9201
+ };
9202
+ const ask$1 = (sys, map, name, type) => sys().then(map, (e) => ANSWERED.has(e?.code ?? "") ? [] : doh(name, type));
9203
+ return {
9204
+ ns: (n) => ask$1(() => resolveNs(n), (x) => x, n, "ns"),
9205
+ mx: (n) => ask$1(() => resolveMx(n), (r) => r.sort((a, b) => a.priority - b.priority).map((x) => x.exchange), n, "mx"),
9206
+ cname: (n) => ask$1(() => resolveCname(n), (x) => x, n, "cname")
9207
+ };
9208
+ }
9209
+ const realResolver = resolverFor();
9210
+ /** An address as typed ("acme.com", "https://www.acme.com/shop") made a URL; null when it cannot be one. */
9211
+ function addressUrl(input) {
9212
+ const t = input.trim();
9213
+ if (!t || /\s/.test(t)) return null;
9214
+ try {
9215
+ const u = new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(t) ? t : `https://${t}`);
9216
+ return (u.protocol === "https:" || u.protocol === "http:") && u.hostname.includes(".") ? u : null;
9217
+ } catch {
9218
+ return null;
9219
+ }
9220
+ }
9221
+ /** The name servers sit at the zone's apex: walk up from the host until a name answers (www.shop.acme.com -> acme.com). */
9222
+ async function zoneOf(host, r) {
9223
+ const labels = host.split(".");
9224
+ for (let i = 0; i < labels.length - 1; i++) {
9225
+ const zone = labels.slice(i).join(".");
9226
+ const ns$1 = await r.ns(zone);
9227
+ if (ns$1.length) return {
9228
+ zone,
9229
+ ns: ns$1
9230
+ };
9231
+ }
9232
+ return {
9233
+ zone: labels.slice(-2).join("."),
9234
+ ns: []
9235
+ };
9236
+ }
9237
+ async function readAddress(sys, url, r = realResolver) {
9238
+ const [{ zone, ns: ns$1 }, cname$1] = await Promise.all([zoneOf(url.hostname, r), r.cname(url.hostname)]);
9239
+ const mx$1 = await r.mx(zone);
9240
+ let headers = {};
9241
+ let html$1 = null;
9242
+ let status = null;
9243
+ try {
9244
+ const res = await sys.fetch(url.toString(), {
9245
+ redirect: "follow",
9246
+ headers: {
9247
+ "user-agent": `${CLI_AGENT} (+https://xovris.ai/docs/connect)`,
9248
+ accept: "text/html,*/*"
9249
+ },
9250
+ signal: AbortSignal.timeout(1e4)
9251
+ });
9252
+ status = res.status;
9253
+ res.headers.forEach((v, k) => {
9254
+ headers[k.toLowerCase()] = v;
9255
+ });
9256
+ const cookies = res.headers.getSetCookie?.();
9257
+ if (cookies?.length) headers["set-cookie"] = cookies.join("\n");
9258
+ if (/text\/html/i.test(res.headers.get("content-type") ?? "")) html$1 = (await res.text()).slice(0, 256 * 1024);
9259
+ } catch {
9260
+ headers = {};
9261
+ }
9262
+ return {
9263
+ reading: {
9264
+ url: url.toString(),
9265
+ headers,
9266
+ html: html$1,
9267
+ dns: {
9268
+ ns: ns$1,
9269
+ mx: mx$1,
9270
+ cname: cname$1
9271
+ }
9272
+ },
9273
+ status,
9274
+ zone
9275
+ };
9276
+ }
9277
+ const line = (label, f) => `${label.padEnd(10)}${f ? `${f.name} (${f.evidence.slice(0, 2).join("; ")})` : "not recognised from the outside"}`;
9278
+ const mark = (p) => p.state === "ready" ? "+" : "…";
9279
+ /** The one screen: what was read, then every step of the setup, the ones on the way marked so - never offered as live. */
9280
+ function scanScreen(f, steps, status) {
9281
+ return [
9282
+ status === null ? "The page did not answer from this machine, so only its DNS was read." : `The page answered ${status}.`,
9283
+ line("Stack", f.stack),
9284
+ line("Host", f.host),
9285
+ line("CDN", f.cdn),
9286
+ line("DNS", f.dns),
9287
+ line("Mail", f.mail),
9288
+ "",
9289
+ "The setup, in one pass:",
9290
+ ...steps.map((p) => `${mark(p)} ${p.title}${p.state === "on_the_way" ? " (on the way)" : ""}\n ${p.action}`)
9291
+ ].join("\n");
9292
+ }
9293
+ async function scan(input, ui, sys, r = resolverFor(sys.fetch), appOrigin = "https://app.xovris.ai") {
9294
+ const url = input ? addressUrl(input) : null;
9295
+ if (!url) {
9296
+ ui.error(input ? `"${input}" is not a web address Xovris can read.` : "Give the address to read.");
9297
+ ui.info("Run npx xovris@latest scan acme.com (or https://www.acme.com).");
9298
+ return 2;
9299
+ }
9300
+ ui.intro(`Xovris – ${url.hostname} from the outside`);
9301
+ const read$1 = await ui.task("Reading the page, its name servers and its mail exchangers", () => readAddress(sys, url, r), (x) => `Read ${x.zone}`);
9302
+ const f = fingerprint(read$1.reading);
9303
+ const steps = proposal(f, read$1.reading);
9304
+ ui.note(scanScreen(f, steps, read$1.status), "What Xovris found");
9305
+ ui.outro(`Set it all up from here: ${appOrigin}/?url=${encodeURIComponent(url.toString())}`);
9306
+ return 0;
9307
+ }
9308
+ const TIER_WORDS = {
9309
+ outside_in: "from outside",
9310
+ browser: "in its visitors' browsers",
9311
+ backend: "the app's own errors",
9312
+ infrastructure: "the servers it runs on",
9313
+ write_access: "the fixes Xovris may make"
9314
+ };
9315
+ /** D01.07: the site at an address added to the signed-in workspace in the same run as its app - the server starts its first checks at once
9316
+ * and finds and watches every part the site exposes after (POST /v1/assets) - and each connection the reading calls for named with its
9317
+ * one step. An address Xovris does not watch from the internet (a local name, a private address) is said, and the app goes on alone. */
9318
+ async function siteLayer(api, input, ui, sys, r = resolverFor(sys.fetch)) {
9319
+ const url = addressUrl(input);
9320
+ if (!url) {
9321
+ ui.warn(`${input} is not an address Xovris watches from the internet, so the app is set up on its own.`);
9322
+ return null;
9323
+ }
9324
+ const read$1 = await ui.task(`Reading ${url.hostname} from the outside`, () => readAddress(sys, url, r), (x) => `Read ${x.zone}`);
9325
+ const steps = proposal(fingerprint(read$1.reading), read$1.reading);
9326
+ const site = await ui.task(`Adding ${url.hostname} to your workspace`, () => api.addSite(url.toString()), (x) => x.created ? `Xovris watches ${url.hostname}: its first checks run now, and every part it exposes is found and watched next` : `${url.hostname} is already watched in this workspace - nothing was added twice`);
9327
+ const connections = steps.filter((x) => x.kind === "connection");
9328
+ const tiers = site.setup?.coverage?.find((c) => c.assetId === site.assetId)?.tiers ?? [];
9329
+ const seen = tiers.filter((t) => t.state === "covered").map((t) => TIER_WORDS[t.tier] ?? t.tier), unseen = tiers.filter((t) => t.state !== "covered").map((t) => TIER_WORDS[t.tier] ?? t.tier);
9330
+ if (tiers.length) ui.info(`Xovris sees ${url.hostname} ${seen.length} of ${tiers.length} ways${seen.length ? ` (${seen.join(", ")})` : ""}; still unseen: ${unseen.join(", ") || "nothing"}.`);
9331
+ for (const c of connections) ui.info(`${c.title}: ${c.action}${c.state === "on_the_way" ? " (on the way)" : ""}`);
9332
+ return {
9333
+ host: url.hostname,
9334
+ added: site.created,
9335
+ checks: steps.filter((x) => x.kind === "check").map((x) => x.id),
9336
+ connections,
9337
+ seen,
9338
+ unseen
9339
+ };
9340
+ }
9341
+
9155
9342
  //#endregion
9156
9343
  //#region src/system.ts
9157
9344
  const META = /([()\][%!^"`<>&|;, *?])/g;
@@ -10226,6 +10413,16 @@ async function sentrySdkOnly(o, ui, sys, secrets, project, sdk) {
10226
10413
  ui.outro("Your Sentry SDK now reports to Xovris, and the change is recorded so npx xovris remove puts it back exactly.");
10227
10414
  return 0;
10228
10415
  }
10416
+ /** D01.07: with no app to set up here, the address given still has its site layers set up in this run, one sign-in. */
10417
+ async function siteAlone(o, ui, sys) {
10418
+ if (!o.url) return false;
10419
+ const api = new Api(o.api, sys);
10420
+ await signIn(api, ui, sys, o.effort);
10421
+ return await siteLayer(api, o.url, ui, sys).catch((e) => {
10422
+ ui.warn(`Adding ${o.url} stopped at: ${e.message}`);
10423
+ return null;
10424
+ }) !== null;
10425
+ }
10229
10426
  async function init(o, ui, sys, secrets) {
10230
10427
  if (!o.relocated) ui.intro("Xovris – connect your app");
10231
10428
  if (!o.ran) o = {
@@ -10236,6 +10433,10 @@ async function init(o, ui, sys, secrets) {
10236
10433
  const project = await choosePackage(o, root, ui, sys);
10237
10434
  if (!project) {
10238
10435
  ui.error(`No supported app was found in this monorepo. Supported now: ${supportedList()}.`);
10436
+ if (await siteAlone(o, ui, sys)) {
10437
+ ui.info("The app's own errors are set up from its folder: npx xovris@latest init there.");
10438
+ return 0;
10439
+ }
10239
10440
  return 2;
10240
10441
  }
10241
10442
  const cwd = project.cwd;
@@ -10278,6 +10479,7 @@ async function init(o, ui, sys, secrets) {
10278
10479
  const stack = preflight(project, found, ui, sys, o.nightlyRun === true);
10279
10480
  if (!stack) {
10280
10481
  if (found?.language === "python") for (const f of await pythonInstrumentation(project)) ui.info(f.summary);
10482
+ await siteAlone(o, ui, sys);
10281
10483
  return 2;
10282
10484
  }
10283
10485
  let refusal = await stackPreflight(project, stack);
@@ -10321,6 +10523,7 @@ async function init(o, ui, sys, secrets) {
10321
10523
  if (refusal) {
10322
10524
  ui.error(`${refusal.reason} Nothing was changed.`);
10323
10525
  ui.info(refusal.next);
10526
+ await siteAlone(o, ui, sys);
10324
10527
  return 2;
10325
10528
  }
10326
10529
  const ownSignal = !!project.snapshot.packageJson?.packageManager || project.snapshot.rootFiles.some((f) => /^(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/.test(f));
@@ -10346,6 +10549,7 @@ async function init(o, ui, sys, secrets) {
10346
10549
  const needsIgnore = repo && !await isIgnored(sys, cwd, envPath);
10347
10550
  const api = new Api(o.api, sys);
10348
10551
  const { workspace } = await signIn(api, ui, sys, o.effort);
10552
+ if (o.url) await siteLayer(api, o.url, ui, sys).catch((e) => ui.warn(`Adding ${o.url} stopped at: ${e.message} - the app is set up all the same; add the site from the command centre's Sites.`));
10349
10553
  let run = await ui.task("Creating an ingestion key for this app", () => api.startRun(project.packageName, stack.id, sys.hostname()), (r) => r.resumed ? "Resumed the earlier install and replaced its unused key" : "Created an ingestion-only key");
10350
10554
  secrets.add(run.ingestKey);
10351
10555
  if (joinAt) return collectorJoinRun(o, ui, sys, api, run, cwd, joinAt, project.packageName, stack.language, secrets);
@@ -10778,142 +10982,6 @@ async function guarded(work, ui) {
10778
10982
  }
10779
10983
  }
10780
10984
 
10781
- //#endregion
10782
- //#region src/scan.ts
10783
- /**
10784
- * The machine's own resolver first; when it cannot be reached at all (a local resolver that refuses, as on some VPNs and
10785
- * corporate laptops), the same question goes to Cloudflare's public resolver over HTTPS (DNS JSON API) - the names are
10786
- * public records, and a scan is never blocked by a resolver it could route around (G99). "No such record" stays an answer.
10787
- */
10788
- const ANSWERED = new Set([
10789
- "ENODATA",
10790
- "ENOTFOUND",
10791
- "NOTFOUND",
10792
- "NODATA"
10793
- ]);
10794
- const DOH_TYPE = {
10795
- ns: 2,
10796
- mx: 15,
10797
- cname: 5
10798
- };
10799
- function resolverFor(f = fetch) {
10800
- const doh = async (name, type) => {
10801
- try {
10802
- return ((await (await f(`https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(name)}&type=${type.toUpperCase()}`, {
10803
- headers: { accept: "application/dns-json" },
10804
- signal: AbortSignal.timeout(8e3)
10805
- })).json()).Answer ?? []).filter((a) => a.type === DOH_TYPE[type]).map((a) => (type === "mx" ? a.data.split(/\s+/).pop() : a.data).replace(/\.$/, ""));
10806
- } catch {
10807
- return [];
10808
- }
10809
- };
10810
- const ask$1 = (sys, map, name, type) => sys().then(map, (e) => ANSWERED.has(e?.code ?? "") ? [] : doh(name, type));
10811
- return {
10812
- ns: (n) => ask$1(() => resolveNs(n), (x) => x, n, "ns"),
10813
- mx: (n) => ask$1(() => resolveMx(n), (r) => r.sort((a, b) => a.priority - b.priority).map((x) => x.exchange), n, "mx"),
10814
- cname: (n) => ask$1(() => resolveCname(n), (x) => x, n, "cname")
10815
- };
10816
- }
10817
- const realResolver = resolverFor();
10818
- /** An address as typed ("acme.com", "https://www.acme.com/shop") made a URL; null when it cannot be one. */
10819
- function addressUrl(input) {
10820
- const t = input.trim();
10821
- if (!t || /\s/.test(t)) return null;
10822
- try {
10823
- const u = new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(t) ? t : `https://${t}`);
10824
- return (u.protocol === "https:" || u.protocol === "http:") && u.hostname.includes(".") ? u : null;
10825
- } catch {
10826
- return null;
10827
- }
10828
- }
10829
- /** The name servers sit at the zone's apex: walk up from the host until a name answers (www.shop.acme.com -> acme.com). */
10830
- async function zoneOf(host, r) {
10831
- const labels = host.split(".");
10832
- for (let i = 0; i < labels.length - 1; i++) {
10833
- const zone = labels.slice(i).join(".");
10834
- const ns$1 = await r.ns(zone);
10835
- if (ns$1.length) return {
10836
- zone,
10837
- ns: ns$1
10838
- };
10839
- }
10840
- return {
10841
- zone: labels.slice(-2).join("."),
10842
- ns: []
10843
- };
10844
- }
10845
- async function readAddress(sys, url, r = realResolver) {
10846
- const [{ zone, ns: ns$1 }, cname$1] = await Promise.all([zoneOf(url.hostname, r), r.cname(url.hostname)]);
10847
- const mx$1 = await r.mx(zone);
10848
- let headers = {};
10849
- let html$1 = null;
10850
- let status = null;
10851
- try {
10852
- const res = await sys.fetch(url.toString(), {
10853
- redirect: "follow",
10854
- headers: {
10855
- "user-agent": `${CLI_AGENT} (+https://xovris.ai/docs/connect)`,
10856
- accept: "text/html,*/*"
10857
- },
10858
- signal: AbortSignal.timeout(1e4)
10859
- });
10860
- status = res.status;
10861
- res.headers.forEach((v, k) => {
10862
- headers[k.toLowerCase()] = v;
10863
- });
10864
- const cookies = res.headers.getSetCookie?.();
10865
- if (cookies?.length) headers["set-cookie"] = cookies.join("\n");
10866
- if (/text\/html/i.test(res.headers.get("content-type") ?? "")) html$1 = (await res.text()).slice(0, 256 * 1024);
10867
- } catch {
10868
- headers = {};
10869
- }
10870
- return {
10871
- reading: {
10872
- url: url.toString(),
10873
- headers,
10874
- html: html$1,
10875
- dns: {
10876
- ns: ns$1,
10877
- mx: mx$1,
10878
- cname: cname$1
10879
- }
10880
- },
10881
- status,
10882
- zone
10883
- };
10884
- }
10885
- const line = (label, f) => `${label.padEnd(10)}${f ? `${f.name} (${f.evidence.slice(0, 2).join("; ")})` : "not recognised from the outside"}`;
10886
- const mark = (p) => p.state === "ready" ? "+" : "…";
10887
- /** The one screen: what was read, then every step of the setup, the ones on the way marked so - never offered as live. */
10888
- function scanScreen(f, steps, status) {
10889
- return [
10890
- status === null ? "The page did not answer from this machine, so only its DNS was read." : `The page answered ${status}.`,
10891
- line("Stack", f.stack),
10892
- line("Host", f.host),
10893
- line("CDN", f.cdn),
10894
- line("DNS", f.dns),
10895
- line("Mail", f.mail),
10896
- "",
10897
- "The setup, in one pass:",
10898
- ...steps.map((p) => `${mark(p)} ${p.title}${p.state === "on_the_way" ? " (on the way)" : ""}\n ${p.action}`)
10899
- ].join("\n");
10900
- }
10901
- async function scan(input, ui, sys, r = resolverFor(sys.fetch), appOrigin = "https://app.xovris.ai") {
10902
- const url = input ? addressUrl(input) : null;
10903
- if (!url) {
10904
- ui.error(input ? `"${input}" is not a web address Xovris can read.` : "Give the address to read.");
10905
- ui.info("Run npx xovris@latest scan acme.com (or https://www.acme.com).");
10906
- return 2;
10907
- }
10908
- ui.intro(`Xovris – ${url.hostname} from the outside`);
10909
- const read$1 = await ui.task("Reading the page, its name servers and its mail exchangers", () => readAddress(sys, url, r), (x) => `Read ${x.zone}`);
10910
- const f = fingerprint(read$1.reading);
10911
- const steps = proposal(f, read$1.reading);
10912
- ui.note(scanScreen(f, steps, read$1.status), "What Xovris found");
10913
- ui.outro(`Set it all up from here: ${appOrigin}/?url=${encodeURIComponent(url.toString())}`);
10914
- return 0;
10915
- }
10916
-
10917
10985
  //#endregion
10918
10986
  //#region src/review.ts
10919
10987
  /** How much of what git does not track yet is read as part of the change; anything past either is named, never skipped silently. */
@@ -11591,6 +11659,7 @@ Options
11591
11659
  --yes, -y Accept the listed changes without asking
11592
11660
  --wait After install, wait for the first real event from your deployed app
11593
11661
  --recipe <file> With init: repeat a verified install's recipe (.xovris/recipe.json) on a fresh copy of the same app
11662
+ --url <address> With init: the site at that address set up in the same run - its checks start and every part it exposes is watched
11594
11663
  --local-only With remove: undo local changes without signing in
11595
11664
  --undo With remove: put back the files Xovris set aside when it deleted them
11596
11665
  --cwd <dir> Run in another folder
@@ -11611,6 +11680,7 @@ Options
11611
11680
  const VALUE_FLAGS = [
11612
11681
  "--cwd",
11613
11682
  "--recipe",
11683
+ "--url",
11614
11684
  "--out",
11615
11685
  "--from",
11616
11686
  "--format",
@@ -11740,6 +11810,7 @@ async function main(argv) {
11740
11810
  ...value("--repo") ? { repo: value("--repo") } : {},
11741
11811
  ...value("--connection") ? { connection: value("--connection") } : {},
11742
11812
  ...value("--recipe") ? { recipe: value("--recipe") } : {},
11813
+ ...value("--url") ? { url: value("--url") } : {},
11743
11814
  ci: !!process.env.CI,
11744
11815
  ...process.env.XOVRIS_TOKEN ? { token: process.env.XOVRIS_TOKEN } : {}
11745
11816
  };
@@ -11769,7 +11840,7 @@ async function main(argv) {
11769
11840
  }, ui, sys, secrets, io), ui);
11770
11841
  case "logout": return logout(io);
11771
11842
  case "sourcemaps": {
11772
- const { sayUpload, uploadSourceMaps } = await import("./sourcemaps-DFeg7Yue.js");
11843
+ const { sayUpload, uploadSourceMaps } = await import("./sourcemaps-CbnUEHCi.js");
11773
11844
  const dir = positional[1] ?? "dist";
11774
11845
  let isDir$2 = false;
11775
11846
  try {
@@ -11847,7 +11918,7 @@ async function main(argv) {
11847
11918
  io.err(`Say xovris limit, xovris limit set <n> or xovris limit remove - "${positional[1]}" is none of them.\n`);
11848
11919
  return 2;
11849
11920
  }
11850
- const { limitCommand } = await import("./limit-zU8xPAtN.js");
11921
+ const { limitCommand } = await import("./limit-ToaAMqI8.js");
11851
11922
  return limitCommand({
11852
11923
  action: act,
11853
11924
  value: positional[2] ?? null,
@@ -11855,7 +11926,7 @@ async function main(argv) {
11855
11926
  }, { api: o.api }, sys, secrets, io);
11856
11927
  }
11857
11928
  case "spend": {
11858
- const { spendCommand } = await import("./spend-CvJZo_T1.js");
11929
+ const { spendCommand } = await import("./spend-DibxD9CK.js");
11859
11930
  return spendCommand({
11860
11931
  since: value("--since") ?? null,
11861
11932
  groupBy: value("--group-by") ?? null,
@@ -11885,7 +11956,7 @@ async function main(argv) {
11885
11956
  case "receipt": return guarded(() => receiptCommand(positional[1], positional[2], value("--key"), ui, sys), ui);
11886
11957
  case "verify": return guarded(() => verify$1(o, ui, sys, secrets, true), ui);
11887
11958
  case "secrets": {
11888
- const { secretsCommand } = await import("./secrets-scan-BcPn_pPi.js");
11959
+ const { secretsCommand } = await import("./secrets-scan-D-J49MTr.js");
11889
11960
  return secretsCommand({
11890
11961
  cwd: o.cwd,
11891
11962
  installHook: flag("--install-hook"),
@@ -11895,7 +11966,7 @@ async function main(argv) {
11895
11966
  }, io);
11896
11967
  }
11897
11968
  case "deploy-guard": {
11898
- const { deployGuardCommand } = await import("./deploy-guard-D06kPPwV.js");
11969
+ const { deployGuardCommand } = await import("./deploy-guard-Cr_W0kEG.js");
11899
11970
  return deployGuardCommand({
11900
11971
  api: o.api,
11901
11972
  change: value("--change") ?? null,
@@ -11923,7 +11994,7 @@ async function main(argv) {
11923
11994
  stack: flag("--stack")
11924
11995
  }, sys, io.out);
11925
11996
  case "merge": {
11926
- const { mergeCommand } = await import("./merge-DYdlN4fU.js");
11997
+ const { mergeCommand } = await import("./merge-BIp5BCYF.js");
11927
11998
  return mergeCommand({
11928
11999
  cwd: o.cwd,
11929
12000
  entries: positional.slice(1),
@@ -11936,7 +12007,7 @@ async function main(argv) {
11936
12007
  }
11937
12008
  case "tests":
11938
12009
  case "touches": {
11939
- const f = await import("./finishing-DQEath5m.js");
12010
+ const f = await import("./finishing-BbU1rLJs.js");
11940
12011
  const fo = {
11941
12012
  cwd: o.cwd,
11942
12013
  module: positional[1] ?? "",
@@ -11946,7 +12017,7 @@ async function main(argv) {
11946
12017
  };
11947
12018
  return command === "tests" ? f.testsCommand(fo, io.out) : f.touchesCommand(fo, io.out);
11948
12019
  }
11949
- case "resolve": return (await import("./finishing-DQEath5m.js")).resolveCommand({
12020
+ case "resolve": return (await import("./finishing-BbU1rLJs.js")).resolveCommand({
11950
12021
  cwd: o.cwd,
11951
12022
  module: "",
11952
12023
  files: positional.slice(1),
@@ -11955,7 +12026,7 @@ async function main(argv) {
11955
12026
  test: many("--test", "--test")
11956
12027
  }, io.out);
11957
12028
  case "hunt": {
11958
- const { huntCommand } = await import("./hunt-CKCYvtG9.js");
12029
+ const { huntCommand } = await import("./hunt-CLbLxW_a.js");
11959
12030
  return huntCommand({
11960
12031
  cwd: positional[1] ?? o.cwd,
11961
12032
  env: process.env,
@@ -11966,7 +12037,7 @@ async function main(argv) {
11966
12037
  }, (t) => process.stdout.write(t));
11967
12038
  }
11968
12039
  case "code": {
11969
- const { codeCommand } = await import("./code-Cv9xmjOW.js");
12040
+ const { codeCommand } = await import("./code-DqvLLcLa.js");
11970
12041
  return codeCommand({
11971
12042
  api: o.api,
11972
12043
  words: positional.slice(1).join(" "),
@@ -11975,7 +12046,7 @@ async function main(argv) {
11975
12046
  }, sys, io);
11976
12047
  }
11977
12048
  case "findings": {
11978
- const { findingsCommand } = await import("./findings-wu3dKZAq.js");
12049
+ const { findingsCommand } = await import("./findings-Byf5SGMG.js");
11979
12050
  const read$1 = {
11980
12051
  severity: value("--severity"),
11981
12052
  category: value("--category"),
@@ -12000,7 +12071,7 @@ async function main(argv) {
12000
12071
  }, { api: o.api }, sys, secrets, io);
12001
12072
  }
12002
12073
  case "sbom": {
12003
- const { sbomCommand } = await import("./sbom-AGsBNlj-.js");
12074
+ const { sbomCommand } = await import("./sbom-BmjbJiT_.js");
12004
12075
  return sbomCommand({
12005
12076
  cwd: positional[1] ?? o.cwd,
12006
12077
  ...value("--live") ? { live: value("--live") } : {},
@@ -12010,7 +12081,7 @@ async function main(argv) {
12010
12081
  });
12011
12082
  }
12012
12083
  case "languages": {
12013
- const { languagesCommand } = await import("./languages-f62XcE8m.js");
12084
+ const { languagesCommand } = await import("./languages-DEXeFxgO.js");
12014
12085
  return languagesCommand({
12015
12086
  gaps: flag("--gaps"),
12016
12087
  json: flag("--json"),
@@ -12018,7 +12089,7 @@ async function main(argv) {
12018
12089
  });
12019
12090
  }
12020
12091
  case "trace": {
12021
- const { traceCommand } = await import("./trace-BlK_FFnw.js");
12092
+ const { traceCommand } = await import("./trace-ZFYWd9DD.js");
12022
12093
  return traceCommand({
12023
12094
  cwd: o.cwd,
12024
12095
  fix: flag("--fix"),
@@ -1,4 +1,4 @@
1
- import { i as tokenFor, u as Api } from "./apicmd-BHGPPVbb.js";
1
+ import { i as tokenFor, u as Api } from "./apicmd-jzeA2Hy4.js";
2
2
 
3
3
  //#region src/code.ts
4
4
  const plain = (s, max = 400) => String(s ?? "").replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").slice(0, max);
@@ -1,4 +1,4 @@
1
- import { r as gatedService } from "./gated-write-C1W3tG1Z.js";
1
+ import { r as gatedService } from "./gated-write-B4sTpeuD.js";
2
2
  import { readFile, writeFile } from "node:fs/promises";
3
3
  import { isAbsolute, resolve } from "node:path";
4
4
  import { existsSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { i as tokenFor } from "./apicmd-BHGPPVbb.js";
1
+ import { i as tokenFor } from "./apicmd-jzeA2Hy4.js";
2
2
 
3
3
  //#region src/deploy-guard.ts
4
4
  async function deployGuardCommand(o, io, f = fetch, env = process.env) {
@@ -1,5 +1,5 @@
1
- import { c as FACET_AXES, l as checkFacetQuery, lt as SEVERITIES, o as EFFORTS, s as EFFORT_UNMEASURED } from "./src-F88zycxp.js";
2
- import { i as tokenFor, u as Api } from "./apicmd-BHGPPVbb.js";
1
+ import { c as FACET_AXES, l as checkFacetQuery, lt as SEVERITIES, o as EFFORTS, s as EFFORT_UNMEASURED } from "./src-B0vsXZ7G.js";
2
+ import { i as tokenFor, u as Api } from "./apicmd-jzeA2Hy4.js";
3
3
 
4
4
  //#region src/findings.ts
5
5
  /** The order a person reads each closed axis in; an open axis (kind, file) reads busiest first. */
@@ -1,4 +1,4 @@
1
- import { B as jobRunner, I as writeProven, L as contentDigest, d as generateTests, f as proveResolution, p as touchesFor, u as applyTouches } from "./src-F88zycxp.js";
1
+ import { B as jobRunner, I as writeProven, L as contentDigest, d as generateTests, f as proveResolution, p as touchesFor, u as applyTouches } from "./src-B0vsXZ7G.js";
2
2
  import { isAbsolute, join, relative, resolve } from "node:path";
3
3
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
4
  import { execFileSync } from "node:child_process";
@@ -1,4 +1,4 @@
1
- import { I as writeProven, L as contentDigest, P as filesOf, R as valueCopy, z as applyGuarded } from "./src-F88zycxp.js";
1
+ import { I as writeProven, L as contentDigest, P as filesOf, R as valueCopy, z as applyGuarded } from "./src-B0vsXZ7G.js";
2
2
  import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
@@ -1,5 +1,5 @@
1
- import { n as HUNT_CLASSES, t as huntRepository } from "./src-F88zycxp.js";
2
- import { o as stripAnsi, s as styleFor } from "./review-ui-D-aMGRo2.js";
1
+ import { n as HUNT_CLASSES, t as huntRepository } from "./src-B0vsXZ7G.js";
2
+ import { o as stripAnsi, s as styleFor } from "./review-ui-BpNWzPD7.js";
3
3
  import { resolve } from "node:path";
4
4
  import { existsSync, statSync } from "node:fs";
5
5
 
@@ -1,4 +1,4 @@
1
- import { tt as census } from "./src-F88zycxp.js";
1
+ import { tt as census } from "./src-B0vsXZ7G.js";
2
2
 
3
3
  //#region src/languages.ts
4
4
  const TYPES = [
@@ -1,4 +1,4 @@
1
- import { i as tokenFor, u as Api } from "./apicmd-BHGPPVbb.js";
1
+ import { i as tokenFor, u as Api } from "./apicmd-jzeA2Hy4.js";
2
2
 
3
3
  //#region src/limit.ts
4
4
  /** What `xovris limit ...` asks for, or why it cannot be sent - the server's own range is checked there, never guessed here. */
@@ -1,6 +1,6 @@
1
- import { a as runMergeQueue, i as queueOrder, nt as dirReader, r as gitQueueRepo, rt as workOut } from "./src-F88zycxp.js";
2
- import "./gated-write-C1W3tG1Z.js";
3
- import { i as splitCommandLine } from "./collector-join-B_k2_7BR.js";
1
+ import { a as runMergeQueue, i as queueOrder, nt as dirReader, r as gitQueueRepo, rt as workOut } from "./src-B0vsXZ7G.js";
2
+ import "./gated-write-B4sTpeuD.js";
3
+ import { i as splitCommandLine } from "./collector-join-Clmi1Zd4.js";
4
4
 
5
5
  //#region src/merge.ts
6
6
  async function mergeCommand(o, sys, out) {
@@ -1,4 +1,4 @@
1
- import { lt as SEVERITIES, ut as SEVERITY_LABEL } from "./src-F88zycxp.js";
1
+ import { lt as SEVERITIES, ut as SEVERITY_LABEL } from "./src-B0vsXZ7G.js";
2
2
 
3
3
  //#region src/review-ui.ts
4
4
  /** Colour only for a person at a terminal that asked for none of the plain modes (no-color.org; CI is never a terminal). */
@@ -1,4 +1,4 @@
1
- import { H as osvAdvisories, U as dependenciesIn, V as npmDependencies, _ as spdxOf, b as withLicences, g as sbomOf, h as lockOfBom, m as HOSTING_FILES, ot as readingsOf, v as spdxTagValue, y as lockfilesIn } from "./src-F88zycxp.js";
1
+ import { H as osvAdvisories, U as dependenciesIn, V as npmDependencies, _ as spdxOf, b as withLicences, g as sbomOf, h as lockOfBom, m as HOSTING_FILES, ot as readingsOf, v as spdxTagValue, y as lockfilesIn } from "./src-B0vsXZ7G.js";
2
2
  import { basename, dirname, join, relative, resolve } from "node:path";
3
3
  import { existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
4
4
 
@@ -1,4 +1,4 @@
1
- import { $ as secretFindings, Q as findSecrets, ct as parseDiff } from "./src-F88zycxp.js";
1
+ import { $ as secretFindings, Q as findSecrets, ct as parseDiff } from "./src-B0vsXZ7G.js";
2
2
  import { isAbsolute, join, relative, resolve } from "node:path";
3
3
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
4
4
  import { execFileSync } from "node:child_process";
@@ -1,5 +1,5 @@
1
- import "./src-F88zycxp.js";
2
- import { i as gatedWrite } from "./gated-write-C1W3tG1Z.js";
1
+ import "./src-B0vsXZ7G.js";
2
+ import { i as gatedWrite } from "./gated-write-B4sTpeuD.js";
3
3
  import { basename, dirname, join, sep } from "node:path";
4
4
  import { readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
5
5
  import { createHash } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { i as tokenFor, u as Api } from "./apicmd-BHGPPVbb.js";
1
+ import { i as tokenFor, u as Api } from "./apicmd-jzeA2Hy4.js";
2
2
 
3
3
  //#region src/spend.ts
4
4
  /** The ask as `xovris spend` takes it, or why it cannot be read: --since <n>d (1 to 31, the bill's own days) and --group-by. */
@@ -42851,6 +42851,7 @@ async function replayOnce(dir, start, requests, o) {
42851
42851
  if (responder) await responder.stop();
42852
42852
  }
42853
42853
  }
42854
+ const CONTEXT_LINES = 7;
42854
42855
  async function traceError(repo, input, o = {}) {
42855
42856
  const trail = [];
42856
42857
  const notRead = [];
@@ -42911,12 +42912,18 @@ async function traceError(repo, input, o = {}) {
42911
42912
  how: "the error could not be placed in this repository"
42912
42913
  };
42913
42914
  }
42914
- const text = ((await git(repo, ["show", `${rev}:${where.file}`])).out.split("\n")[where.frame.line - 1] ?? "").trim();
42915
+ const file = (await git(repo, ["show", `${rev}:${where.file}`])).out.split("\n").map((l) => l.replace(/\r$/, ""));
42916
+ const text = (file[where.frame.line - 1] ?? "").trim();
42917
+ const from = Math.max(1, where.frame.line - CONTEXT_LINES);
42915
42918
  const line = {
42916
42919
  file: where.file,
42917
42920
  line: where.frame.line,
42918
42921
  fn: where.frame.fn,
42919
- text
42922
+ text,
42923
+ around: {
42924
+ from,
42925
+ lines: file.slice(from - 1, where.frame.line + CONTEXT_LINES)
42926
+ }
42920
42927
  };
42921
42928
  step("line", true, `${where.file} line ${where.frame.line}${where.frame.fn ? ` in ${where.frame.fn}` : ""}`);
42922
42929
  const bl = await git(repo, [
@@ -1,4 +1,4 @@
1
- import { A as hostRest, C as fixTraced, D as parseError, E as openTraced, F as guardStrip, G as leaveBy, O as traceError, T as locate, j as githubRest, k as hostAuth, w as followFix } from "./src-F88zycxp.js";
1
+ import { A as hostRest, C as fixTraced, D as parseError, E as openTraced, F as guardStrip, G as leaveBy, O as traceError, T as locate, j as githubRest, k as hostAuth, w as followFix } from "./src-B0vsXZ7G.js";
2
2
  import { join } from "node:path";
3
3
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
4
4
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "xovris",
3
- "gitHead": "8c4ea16632dacbd3d42aa498287016ff8445a668",
3
+ "gitHead": "92d48aac5472f83bea63beb61c64d853b2f18097",
4
4
  "homepage": "https://xovris.ai",
5
- "version": "0.2.1",
5
+ "version": "0.2.3",
6
6
  "description": "npx xovris@latest init - detects your stack, signs you in through your browser, writes the configuration and verifies the first stored event. Nothing to copy or paste.",
7
7
  "license": "Apache-2.0",
8
8
  "type": "module",
@@ -32,12 +32,12 @@
32
32
  "@opentelemetry/sdk-node": "^0.222.0",
33
33
  "@opentelemetry/sdk-trace-base": "^2.12.0",
34
34
  "tsdown": "^0.15.12",
35
- "@xovris/node": "0.1.1",
36
- "@xovris/stacks": "0.1.0",
37
- "@xovris/setup": "0.1.0",
35
+ "@xovris/node": "0.1.3",
38
36
  "@xovris/checks": "0.1.0",
39
37
  "@xovris/mcp": "0.1.0",
40
- "@xovris/review": "0.1.0"
38
+ "@xovris/stacks": "0.1.0",
39
+ "@xovris/review": "0.1.0",
40
+ "@xovris/setup": "0.1.0"
41
41
  },
42
42
  "exports": {
43
43
  "./plan": "./src/plan.ts",