periderm-cli 0.1.26 → 0.1.28

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.
@@ -6,6 +6,7 @@
6
6
  * we can detect via regex + AST without a full type-checker.
7
7
  */
8
8
  import traverseDefault from "@babel/traverse";
9
+ import { reportCliError } from "../error-report.js";
9
10
  // @babel/traverse ships CJS; pick the default export defensively.
10
11
  const traverse = traverseDefault.default
11
12
  ?? traverseDefault;
@@ -726,6 +727,15 @@ export function runChecks(source, file, ast) {
726
727
  out.push(...c(source, file, ast));
727
728
  }
728
729
  catch (e) {
730
+ const err = e instanceof Error ? e : new Error(String(e));
731
+ // Report the crash silently in the background
732
+ reportCliError({
733
+ source: "cli-scan",
734
+ message: `Scanner rule crashed on ${file}`,
735
+ stack: err.stack,
736
+ where: c.name || "anonymous check",
737
+ extra: { file, rawError: String(e) }
738
+ }).catch(() => { });
729
739
  out.push(mkFinding({ id: "internal-error", category: "Runtime Stability", severity: "high", file, line: 1, message: `Scanner crashed: ${e}`, why: "Internal exception in scanner rule.", fix: "Report this issue.", aiPrompt: "Fix the crash in the scanner rule." }));
730
740
  }
731
741
  }
@@ -40,16 +40,29 @@ export async function runRepoChecks(root, _files) {
40
40
  }
41
41
  // .env.example
42
42
  if (!(await has(".env.example"))) {
43
- out.push({
44
- id: "missing-env-example",
45
- category: "Deployment & Testing Readiness",
46
- severity: "medium",
47
- file: ".env.example", line: 1,
48
- message: ".env.example is missing.",
49
- why: "Anyone cloning the repo has to guess which env vars are required.",
50
- fix: "Create a .env.example listing every env var with a placeholder value (no secrets).",
51
- aiPrompt: "Scan the codebase for process.env.* and import.meta.env.* reads and produce a .env.example file listing every variable found with placeholder values.",
52
- });
43
+ let usesEnvVars = false;
44
+ for (const abs of _files) {
45
+ const rel = path.relative(root, abs);
46
+ if (!/\.(tsx|jsx|ts|js|mjs|cjs|svelte|vue|astro)$/.test(rel))
47
+ continue;
48
+ const chunk = await readMaybe(abs);
49
+ if (chunk && /(process\.env|import\.meta\.env)/.test(chunk)) {
50
+ usesEnvVars = true;
51
+ break;
52
+ }
53
+ }
54
+ if (usesEnvVars) {
55
+ out.push({
56
+ id: "missing-env-example",
57
+ category: "Deployment & Testing Readiness",
58
+ severity: "medium",
59
+ file: ".env.example", line: 1,
60
+ message: ".env.example is missing.",
61
+ why: "Anyone cloning the repo has to guess which env vars are required.",
62
+ fix: "Create a .env.example listing every env var with a placeholder value (no secrets).",
63
+ aiPrompt: "Scan the codebase for process.env.* and import.meta.env.* reads and produce a .env.example file listing every variable found with placeholder values.",
64
+ });
65
+ }
53
66
  }
54
67
  // public dir favicon
55
68
  const pkgRaw = await readMaybe(path.join(root, "package.json"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "A pre-launch checklist for your codebase. Scan JS, TS, JSX, and TSX projects before you ship.",
5
5
  "type": "module",
6
6
  "bin": {