periderm-cli 0.1.13 → 0.1.15

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/api.js CHANGED
@@ -58,3 +58,19 @@ export async function uploadScan(token, result) {
58
58
  return { error: e.message || "Network error: failed to reach server" };
59
59
  }
60
60
  }
61
+ export async function fetchCloudPolicies(token) {
62
+ const { apiUrl } = readConfig();
63
+ try {
64
+ const res = await fetch(`${apiUrl}/api/policies`, {
65
+ method: "POST",
66
+ headers: { "Content-Type": "application/json" },
67
+ body: JSON.stringify({ token }),
68
+ });
69
+ if (!res.ok)
70
+ return { global_ignores: [], custom_ai_rules: "" };
71
+ return (await res.json());
72
+ }
73
+ catch {
74
+ return { global_ignores: [], custom_ai_rules: "" };
75
+ }
76
+ }
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { scan } from "./scanner/index.js";
8
8
  import { runDeepReview } from "./review/deep.js";
9
9
  import { printTerminal } from "./report/terminal.js";
10
10
  import { readConfig, writeConfig } from "./config.js";
11
- import { verifyToken, uploadScan } from "./api.js";
11
+ import { verifyToken, uploadScan, fetchCloudPolicies } from "./api.js";
12
12
  import http from "node:http";
13
13
  import ora from "ora";
14
14
  import { PERIDERM_ASCII } from "./constants.js";
@@ -30,6 +30,29 @@ program
30
30
  .name("periderm")
31
31
  .description("A pre-launch checklist.")
32
32
  .version("0.1.0");
33
+ // Easter egg: `periderm bless` — hidden, undocumented
34
+ program
35
+ .command("bless", { hidden: true })
36
+ .description("")
37
+ .action(() => {
38
+ const lines = [
39
+ "",
40
+ chalk.bold.hex("#FFD700")(" ✞ ─────────────────────────────────── ✞"),
41
+ "",
42
+ chalk.white(" \"For God so loved the world that he gave"),
43
+ chalk.white(" his one and only Son, that whoever"),
44
+ chalk.white(" believes in him shall not perish but"),
45
+ chalk.white(" have eternal life.\""),
46
+ chalk.dim(" — John 3:16"),
47
+ "",
48
+ chalk.bold.hex("#FFD700")(" ✦ Jesus Is Lord ✦"),
49
+ "",
50
+ chalk.bold.hex("#FFD700")(" ✞ ─────────────────────────────────── ✞"),
51
+ "",
52
+ ];
53
+ lines.forEach((l) => console.info(l));
54
+ process.exit(0);
55
+ });
33
56
  program
34
57
  .command("scan")
35
58
  .description("Scan the current directory and write a markdown report.")
@@ -61,6 +84,17 @@ program
61
84
  process.exit(1);
62
85
  }
63
86
  verifySpinner.stop();
87
+ // Fetch cloud policies for Unlimited users
88
+ let cloudIgnores = [];
89
+ let cloudAiRules = "";
90
+ if (v.plan === "unlimited") {
91
+ const policies = await fetchCloudPolicies(cfg.token);
92
+ cloudIgnores = policies.global_ignores ?? [];
93
+ cloudAiRules = policies.custom_ai_rules ?? "";
94
+ if (cloudIgnores.length > 0) {
95
+ console.info(chalk.dim(` ↳ Applying ${cloudIgnores.length} cloud ignore rule(s) from your dashboard policies.`));
96
+ }
97
+ }
64
98
  const startTime = Date.now();
65
99
  console.info(chalk.cyan("Discovering project files…"));
66
100
  let scanSpinner = ora({ text: "Initializing...", color: "cyan" }).start();
@@ -72,7 +106,7 @@ program
72
106
  const empty = 20 - filled;
73
107
  return `[${"█".repeat(filled)}${"░".repeat(empty)}] ${Math.round(pct * 100)}%`;
74
108
  };
75
- const result = await scan(root, {
109
+ const result = await scan(root, { cloudIgnores, cloudAiRules,
76
110
  onProgress: (ev) => {
77
111
  switch (ev.type) {
78
112
  case "discovering":
@@ -108,6 +142,12 @@ program
108
142
  result.counts.low;
109
143
  scanSpinner.succeed(`Scanned ${result.filesScanned} files · ${totalFindings} finding${totalFindings === 1 ? "" : "s"} · ${elapsed}s`);
110
144
  printTerminal(result);
145
+ // 🥚 Easter egg: score 77 = perfection in disguise
146
+ if (result.score === 77) {
147
+ console.info("");
148
+ console.info(chalk.dim(" ✦ " + Buffer.from("SmVzdXMgSXMgTG9yZA==", "base64").toString("utf8") + " ✦"));
149
+ console.info("");
150
+ }
111
151
  const outDir = path.join(root, ".periderm");
112
152
  await fs.mkdir(outDir, { recursive: true });
113
153
  await fs.writeFile(path.join(outDir, "last-report.md"), result.markdown, "utf8");
@@ -107,5 +107,8 @@ export function renderMarkdown(r) {
107
107
  lines.push(`There are ${r.counts.critical} critical, ${r.counts.high} high, ${r.counts.medium} medium, ${r.counts.low} low findings.`);
108
108
  lines.push(`Fix them in priority order. For each finding, open the listed file, apply the Exact fix, and keep the change minimal.`);
109
109
  lines.push("```");
110
+ lines.push("");
111
+ // 🥚 Hidden watermark — only visible in raw .md source
112
+ lines.push("<!-- ✞ Jesus Is Lord ✞ — Philippians 2:10-11 -->");
110
113
  return lines.join("\n");
111
114
  }
@@ -84,6 +84,9 @@ function parseAction(raw) {
84
84
  }
85
85
  }
86
86
  export async function runDeepReview(root, scan, token, apiUrl, onStatus) {
87
+ const orgRulesSection = scan.cloudAiRules?.trim()
88
+ ? `\n\nOrganization-specific instructions (MUST follow):\n${scan.cloudAiRules.trim()}`
89
+ : "";
87
90
  const system = `You are Periderm's deep launch reviewer. Respond with JSON only.
88
91
 
89
92
  Existing static scan found ${scan.findings.length} issues. Your job: find ADDITIONAL nuanced launch risks the deterministic scanner missed — legal/UX/business logic edge cases, contradictions, deceptive flows, subtle security gaps.
@@ -94,7 +97,7 @@ Tools (respond with {"action":"tool",...}):
94
97
 
95
98
  When finished: {"action":"done","summary":"...","findings":[{"message":"...","severity":"high|medium|low|critical","file":"path","why":"...","fix":"..."}]}
96
99
 
97
- Rules: max 5 new findings, be specific, cite files, no hallucinated files.`;
100
+ Rules: max 5 new findings, be specific, cite files, no hallucinated files.${orgRulesSection}`;
98
101
  const context = {
99
102
  project: scan.projectName,
100
103
  verdict: scan.verdict,
@@ -11,10 +11,10 @@ import { renderMarkdown } from "../report/markdown.js";
11
11
  import { mapWithProgress } from "./progress.js";
12
12
  export { formatScanPath } from "./progress.js";
13
13
  export async function scan(root, options = {}) {
14
- const { onProgress } = options;
14
+ const { onProgress, cloudIgnores = [], cloudAiRules = "" } = options;
15
15
  const findings = [];
16
16
  onProgress?.({ type: "discovering" });
17
- const files = await walk(root);
17
+ const files = await walk(root, cloudIgnores);
18
18
  onProgress?.({ type: "discovered", total: files.length });
19
19
  const estimatedChecks = files.length * PER_FILE_CHECK_COUNT +
20
20
  REPO_WIDE_CHECK_COUNT +
@@ -96,5 +96,6 @@ export async function scan(root, options = {}) {
96
96
  verdict,
97
97
  markdown,
98
98
  meta,
99
+ cloudAiRules: cloudAiRules || undefined,
99
100
  };
100
101
  }
@@ -1,7 +1,6 @@
1
1
  import fg from "fast-glob";
2
- export async function walk(root) {
3
- return fg([
4
- "**/*.{ts,tsx,js,jsx,mjs,cjs}",
2
+ export async function walk(root, extraIgnores = []) {
3
+ const baseIgnores = [
5
4
  "!**/node_modules/**",
6
5
  "!**/dist/**",
7
6
  "!**/build/**",
@@ -12,5 +11,12 @@ export async function walk(root) {
12
11
  "!**/*.d.ts",
13
12
  "!**/routeTree.gen.*",
14
13
  "!**/packages/cli/**", // never scan the scanner itself
14
+ ];
15
+ // Cloud policy ignores: normalize to negated globs
16
+ const cloudIgnoreGlobs = extraIgnores.map((ig) => ig.startsWith("!") ? ig : `!${ig}`);
17
+ return fg([
18
+ "**/*.{ts,tsx,js,jsx,mjs,cjs}",
19
+ ...baseIgnores,
20
+ ...cloudIgnoreGlobs,
15
21
  ], { cwd: root, absolute: true, dot: false });
16
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "A pre-launch checklist for your codebase.",
5
5
  "type": "module",
6
6
  "bin": {