@methiu/raigal 1.0.2 → 1.0.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.
@@ -1,4 +1,4 @@
1
- import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-o3KNKhg2.js";
1
+ import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-kJtASBYe.js";
2
2
  //#region src/framework-adapters/astro.ts
3
3
  const createAstroRaigalScripts = () => createRaigalPackageScripts("astro");
4
4
  const createAstroAislopScripts = createAstroRaigalScripts;
@@ -1,4 +1,4 @@
1
- import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-o3KNKhg2.js";
1
+ import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-kJtASBYe.js";
2
2
  //#region src/framework-adapters/expo.ts
3
3
  const createExpoRaigalScripts = () => createRaigalPackageScripts("expo");
4
4
  const createExpoAislopScripts = createExpoRaigalScripts;
@@ -1,4 +1,4 @@
1
- import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-o3KNKhg2.js";
1
+ import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-kJtASBYe.js";
2
2
  //#region src/framework-adapters/nuxt.ts
3
3
  const DEFAULTS = {
4
4
  command: "ci",
@@ -1,4 +1,4 @@
1
- import { n as createRaigalPackageScripts, t as createRaigalCiWorkflow } from "../core-o3KNKhg2.js";
1
+ import { n as createRaigalPackageScripts, t as createRaigalCiWorkflow } from "../core-kJtASBYe.js";
2
2
  import raigalVite, { runRaigalVite } from "./vite.js";
3
3
  //#region src/framework-adapters/sveltekit.ts
4
4
  const createSvelteKitRaigalScripts = () => createRaigalPackageScripts("sveltekit");
@@ -1,4 +1,4 @@
1
- import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-o3KNKhg2.js";
1
+ import { n as createRaigalPackageScripts, r as maybeRunRaigal, t as createRaigalCiWorkflow } from "../core-kJtASBYe.js";
2
2
  //#region src/framework-adapters/vite.ts
3
3
  const createViteRaigalScripts = (framework = "vite") => {
4
4
  const scripts = createRaigalPackageScripts(framework);
package/dist/cli.js CHANGED
@@ -884,7 +884,7 @@ const createLogger = (deps = {}) => {
884
884
  const log = createLogger();
885
885
  //#endregion
886
886
  //#region src/version.ts
887
- const APP_VERSION = "1.0.2";
887
+ const APP_VERSION = "1.0.3";
888
888
  //#endregion
889
889
  //#region src/commands/agent-connect.ts
890
890
  const commandText = (status) => [status.provider.loginCommand.command, ...status.provider.loginCommand.args].join(" ");
@@ -1383,7 +1383,7 @@ const verifyEntitlementJwt = (jwt, options = {}) => {
1383
1383
  const claims = parsed.data;
1384
1384
  const expectedIssuer = process.env.RAIGAL_ISSUER?.trim() || "https://app.raigal.dev";
1385
1385
  if (claims.iss !== expectedIssuer) throw new JwtVerificationError(`Untrusted issuer: ${claims.iss}`, "invalid_issuer");
1386
- if (!isVersionAtLeast("1.0.2", claims.min_cli_version)) throw new JwtVerificationError(`CLI version ${APP_VERSION} is below required minimum ${claims.min_cli_version}. Run "raigal update" or "npm install -g @methiu/raigal@latest".`, "cli_version_unsupported");
1386
+ if (!isVersionAtLeast("1.0.3", claims.min_cli_version)) throw new JwtVerificationError(`CLI version ${APP_VERSION} is below required minimum ${claims.min_cli_version}. Run "raigal update" or "npm install -g @methiu/raigal@latest".`, "cli_version_unsupported");
1387
1387
  const now = options.nowSeconds ?? Math.floor(Date.now() / 1e3);
1388
1388
  const grace = options.allowGraceSeconds ?? 0;
1389
1389
  if (now > claims.exp + grace) {
@@ -1550,7 +1550,7 @@ const getEntitlement = async () => {
1550
1550
  };
1551
1551
  //#endregion
1552
1552
  //#region src/cloud/owner.ts
1553
- const GITHUB_REMOTE_RE$1 = /^(?:git@github\.com:|https:\/\/(?:[^@]+@)?github\.com\/)([^/]+)\/([^/.\s]+?)(?:\.git)?\s*$/;
1553
+ const GITHUB_REMOTE_RE$1 = /^(?:(?:git@|ssh:\/\/(?:git@)?)github\.com(?::(?:\d+\/)?|[:/])|https:\/\/(?:[^@]+@)?github\.com\/)([^/]+)\/([^/.\s]+?)(?:\.git)?\s*$/;
1554
1554
  const parseGitRemote = (rawUrl) => {
1555
1555
  if (!rawUrl) return {
1556
1556
  owner: null,
@@ -2744,8 +2744,15 @@ const detectGitContext = (directory) => {
2744
2744
  let prNumber;
2745
2745
  if (typeof pr?.number === "number") prNumber = pr.number;
2746
2746
  else if (typeof eventPayload?.number === "number") prNumber = eventPayload.number;
2747
- else if (process.env.GITHUB_REF) {
2748
- const match = process.env.GITHUB_REF.match(/^refs\/pull\/(\d+)\//);
2747
+ else if (process.env.RAIGAL_PR_NUMBER || process.env.PR_NUMBER) {
2748
+ const parsed = Number.parseInt(process.env.RAIGAL_PR_NUMBER || process.env.PR_NUMBER || "", 10);
2749
+ if (!Number.isNaN(parsed) && parsed > 0) prNumber = parsed;
2750
+ } else if (process.env.GITHUB_REF) {
2751
+ const match = process.env.GITHUB_REF.match(/refs\/pull\/(\d+)(?:\/|$)/);
2752
+ if (match && match[1]) prNumber = Number.parseInt(match[1], 10);
2753
+ }
2754
+ if (!prNumber && branch) {
2755
+ const match = branch.match(/pull\/(\d+)/i) || branch.match(/^pr-(\d+)/i);
2749
2756
  if (match && match[1]) prNumber = Number.parseInt(match[1], 10);
2750
2757
  }
2751
2758
  const result = {};
@@ -21504,7 +21511,17 @@ const atomicWrite = (targetPath, content) => {
21504
21511
  const rand = Math.random().toString(36).slice(2, 10);
21505
21512
  const tmp = path.join(dir, `.aislop-tmp-${process.pid}-${rand}`);
21506
21513
  fs.writeFileSync(tmp, content, "utf-8");
21507
- fs.renameSync(tmp, targetPath);
21514
+ try {
21515
+ fs.renameSync(tmp, targetPath);
21516
+ } catch (err) {
21517
+ const code = err?.code;
21518
+ if (code === "EPERM" || code === "EBUSY") {
21519
+ fs.copyFileSync(tmp, targetPath);
21520
+ try {
21521
+ fs.unlinkSync(tmp);
21522
+ } catch {}
21523
+ } else throw err;
21524
+ }
21508
21525
  };
21509
21526
  const readIfExists = (targetPath) => {
21510
21527
  try {
@@ -24342,7 +24359,7 @@ const maybeNotifyUpdate = async (now = Date.now()) => {
24342
24359
  if (!process.stderr.isTTY) return;
24343
24360
  const cachePath = resolveUpdateCachePath();
24344
24361
  const cache = readCache(cachePath);
24345
- if (cache && isOutdated("1.0.2", cache.latest)) process.stderr.write(formatUpdateNotice(APP_VERSION, cache.latest));
24362
+ if (cache && isOutdated("1.0.3", cache.latest)) process.stderr.write(formatUpdateNotice(APP_VERSION, cache.latest));
24346
24363
  if (!cache || now - cache.checkedAt > CHECK_INTERVAL_MS) {
24347
24364
  const latest = await fetchLatestVersion$1();
24348
24365
  if (latest) writeCache(cachePath, {
@@ -24862,7 +24879,7 @@ const renderCommandGroup = (group, commandWidth) => {
24862
24879
  return lines;
24863
24880
  };
24864
24881
  const renderCommandReference = (input = {}) => {
24865
- const version = input.version ?? "1.0.2";
24882
+ const version = input.version ?? "1.0.3";
24866
24883
  const commandWidth = Math.max(...COMMAND_REFERENCE.map((item) => item.command.length));
24867
24884
  const lines = [renderHeader({
24868
24885
  version,
@@ -25085,7 +25102,7 @@ const renderHelpDetails = () => [
25085
25102
  ].map((line) => highlightRaigal(line, theme)).join("\n");
25086
25103
  const renderHome = (input = {}) => {
25087
25104
  let out = renderHeader({
25088
- version: input.version ?? "1.0.2",
25105
+ version: input.version ?? "1.0.3",
25089
25106
  command: "--bare",
25090
25107
  context: []
25091
25108
  });
@@ -29542,13 +29559,18 @@ const safeTelemetryConfig = (dir) => {
29542
29559
  return;
29543
29560
  }
29544
29561
  };
29545
- const handleTerminationSignal = async () => {
29562
+ const handleTerminationSignal = async (signal) => {
29546
29563
  killActiveChildren();
29547
- await finishActiveRecorder(130);
29548
- process.exit(0);
29564
+ const exitCode = signal === "SIGINT" ? 130 : 143;
29565
+ await finishActiveRecorder(exitCode);
29566
+ process.exit(exitCode);
29549
29567
  };
29550
- process.on("SIGINT", handleTerminationSignal);
29551
- process.on("SIGTERM", handleTerminationSignal);
29568
+ process.on("SIGINT", () => {
29569
+ handleTerminationSignal("SIGINT");
29570
+ });
29571
+ process.on("SIGTERM", () => {
29572
+ handleTerminationSignal("SIGTERM");
29573
+ });
29552
29574
  const fireInstalledOnce = () => {
29553
29575
  if (isTelemetryDisabled(safeTelemetryConfig(process.cwd()))) return;
29554
29576
  if (ensureInstallId(resolveInstallIdPath()).created) track({
@@ -20,11 +20,21 @@ const resolveRaigalRunRequest = (framework, options = {}) => {
20
20
  };
21
21
  };
22
22
  const runRaigal = async (request) => new Promise((resolve) => {
23
- spawn(request.bin, request.args, {
23
+ const child = spawn(request.bin, request.args, {
24
24
  cwd: request.cwd,
25
25
  env: request.env,
26
26
  stdio: "inherit"
27
- }).on("close", (exitCode, signal) => {
27
+ });
28
+ child.on("error", () => {
29
+ resolve({
30
+ command: request.bin,
31
+ args: request.args,
32
+ exitCode: 1,
33
+ signal: null,
34
+ skipped: false
35
+ });
36
+ });
37
+ child.on("close", (exitCode, signal) => {
28
38
  resolve({
29
39
  command: request.bin,
30
40
  args: request.args,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as APP_VERSION } from "./version-DW_ZBtce.js";
1
+ import { t as APP_VERSION } from "./version-gBpAhuDc.js";
2
2
  import { a as getEngineLabel, i as ENGINE_INFO, r as scoreImpactForRule, t as summarizeFindingAssessments } from "./finding-assessment-M5fUTE-C.js";
3
3
  import { n as isSecretClassRule, r as maskSecrets, t as FIXED_SECRET_DIAGNOSTIC_MESSAGE } from "./mask-secrets-BXn-ZSEh.js";
4
4
  import { createRequire, isBuiltin } from "node:module";
@@ -16068,7 +16068,7 @@ const verifyEntitlementJwt = (jwt, options = {}) => {
16068
16068
  const claims = parsed.data;
16069
16069
  const expectedIssuer = process.env.RAIGAL_ISSUER?.trim() || "https://app.raigal.dev";
16070
16070
  if (claims.iss !== expectedIssuer) throw new JwtVerificationError(`Untrusted issuer: ${claims.iss}`, "invalid_issuer");
16071
- if (!isVersionAtLeast("1.0.2", claims.min_cli_version)) throw new JwtVerificationError(`CLI version ${APP_VERSION} is below required minimum ${claims.min_cli_version}. Run "raigal update" or "npm install -g @methiu/raigal@latest".`, "cli_version_unsupported");
16071
+ if (!isVersionAtLeast("1.0.3", claims.min_cli_version)) throw new JwtVerificationError(`CLI version ${APP_VERSION} is below required minimum ${claims.min_cli_version}. Run "raigal update" or "npm install -g @methiu/raigal@latest".`, "cli_version_unsupported");
16072
16072
  const now = options.nowSeconds ?? Math.floor(Date.now() / 1e3);
16073
16073
  const grace = options.allowGraceSeconds ?? 0;
16074
16074
  if (now > claims.exp + grace) {
@@ -16235,7 +16235,7 @@ const getEntitlement = async () => {
16235
16235
  };
16236
16236
  //#endregion
16237
16237
  //#region src/cloud/owner.ts
16238
- const GITHUB_REMOTE_RE = /^(?:git@github\.com:|https:\/\/(?:[^@]+@)?github\.com\/)([^/]+)\/([^/.\s]+?)(?:\.git)?\s*$/;
16238
+ const GITHUB_REMOTE_RE = /^(?:(?:git@|ssh:\/\/(?:git@)?)github\.com(?::(?:\d+\/)?|[:/])|https:\/\/(?:[^@]+@)?github\.com\/)([^/]+)\/([^/.\s]+?)(?:\.git)?\s*$/;
16239
16239
  const parseGitRemote = (rawUrl) => {
16240
16240
  if (!rawUrl) return {
16241
16241
  owner: null,
@@ -19200,12 +19200,12 @@ const runScanBody = async (resolvedDir, config, options, projectInfo, scanScope,
19200
19200
  scoreFileCount
19201
19201
  });
19202
19202
  if (options.sarif) {
19203
- const { buildSarifLog } = await import("./sarif-BHrT2Drf.js");
19203
+ const { buildSarifLog } = await import("./sarif-CuuawcSp.js");
19204
19204
  console.log(JSON.stringify(buildSarifLog(results), null, 2));
19205
19205
  return completion;
19206
19206
  }
19207
19207
  if (options.json) {
19208
- const { buildJsonOutput } = await import("./json-CjTR6e4V.js");
19208
+ const { buildJsonOutput } = await import("./json-BpPaIvrn.js");
19209
19209
  const jsonOut = buildJsonOutput(results, scoreResult, scoreFileCount, elapsedMs, scanCoverage);
19210
19210
  console.log(JSON.stringify(jsonOut, null, 2));
19211
19211
  return completion;
@@ -1,4 +1,4 @@
1
- import { t as APP_VERSION } from "./version-DW_ZBtce.js";
1
+ import { t as APP_VERSION } from "./version-gBpAhuDc.js";
2
2
  import { i as ENGINE_INFO, n as withFindingAssessments, t as summarizeFindingAssessments } from "./finding-assessment-M5fUTE-C.js";
3
3
  //#region src/output/json.ts
4
4
  const buildJsonOutput = (results, scoreResult, fileCount, elapsedMs, coverage) => {
package/dist/mcp.js CHANGED
@@ -84,7 +84,7 @@ const getActiveToken = () => {
84
84
  };
85
85
  //#endregion
86
86
  //#region src/version.ts
87
- const APP_VERSION = "1.0.2";
87
+ const APP_VERSION = "1.0.3";
88
88
  //#endregion
89
89
  //#region src/cloud/contract.ts
90
90
  const Severity = z.enum(["error", "warning"]);
@@ -359,7 +359,7 @@ const verifyEntitlementJwt = (jwt, options = {}) => {
359
359
  const claims = parsed.data;
360
360
  const expectedIssuer = process.env.RAIGAL_ISSUER?.trim() || "https://app.raigal.dev";
361
361
  if (claims.iss !== expectedIssuer) throw new JwtVerificationError(`Untrusted issuer: ${claims.iss}`, "invalid_issuer");
362
- if (!isVersionAtLeast("1.0.2", claims.min_cli_version)) throw new JwtVerificationError(`CLI version ${APP_VERSION} is below required minimum ${claims.min_cli_version}. Run "raigal update" or "npm install -g @methiu/raigal@latest".`, "cli_version_unsupported");
362
+ if (!isVersionAtLeast("1.0.3", claims.min_cli_version)) throw new JwtVerificationError(`CLI version ${APP_VERSION} is below required minimum ${claims.min_cli_version}. Run "raigal update" or "npm install -g @methiu/raigal@latest".`, "cli_version_unsupported");
363
363
  const now = options.nowSeconds ?? Math.floor(Date.now() / 1e3);
364
364
  const grace = options.allowGraceSeconds ?? 0;
365
365
  if (now > claims.exp + grace) {
@@ -526,7 +526,7 @@ const getEntitlement = async () => {
526
526
  };
527
527
  //#endregion
528
528
  //#region src/cloud/owner.ts
529
- const GITHUB_REMOTE_RE = /^(?:git@github\.com:|https:\/\/(?:[^@]+@)?github\.com\/)([^/]+)\/([^/.\s]+?)(?:\.git)?\s*$/;
529
+ const GITHUB_REMOTE_RE = /^(?:(?:git@|ssh:\/\/(?:git@)?)github\.com(?::(?:\d+\/)?|[:/])|https:\/\/(?:[^@]+@)?github\.com\/)([^/]+)\/([^/.\s]+?)(?:\.git)?\s*$/;
530
530
  const parseGitRemote = (rawUrl) => {
531
531
  if (!rawUrl) return {
532
532
  owner: null,
@@ -1,4 +1,4 @@
1
- import { t as APP_VERSION } from "./version-DW_ZBtce.js";
1
+ import { t as APP_VERSION } from "./version-gBpAhuDc.js";
2
2
  import { n as isSecretClassRule, t as FIXED_SECRET_DIAGNOSTIC_MESSAGE } from "./mask-secrets-BXn-ZSEh.js";
3
3
  import path from "node:path";
4
4
  //#region src/output/sarif.ts
@@ -1,6 +1,6 @@
1
1
  import "node:fs";
2
2
  import "node:url";
3
3
  //#region src/version.ts
4
- const APP_VERSION = "1.0.2";
4
+ const APP_VERSION = "1.0.3";
5
5
  //#endregion
6
6
  export { APP_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@methiu/raigal",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },