periderm-cli 0.1.28 → 0.1.30

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/index.js CHANGED
@@ -7,6 +7,7 @@ import open from "open";
7
7
  import { scan } from "./scanner/index.js";
8
8
  import { runDeepReview } from "./review/deep.js";
9
9
  import { printTerminal } from "./report/terminal.js";
10
+ import { getAiInstructions } from "./report/ai-instructions.js";
10
11
  import { readConfig, writeConfig } from "./config.js";
11
12
  import { verifyToken, uploadScan, fetchCloudPolicies } from "./api.js";
12
13
  import http from "node:http";
@@ -30,7 +31,7 @@ const program = new Command();
30
31
  program
31
32
  .name("periderm")
32
33
  .description("A pre-launch checklist.")
33
- .version("0.1.18");
34
+ .version("0.1.30");
34
35
  // Easter egg: `periderm bless` — hidden, undocumented
35
36
  program
36
37
  .command("bless", { hidden: true })
@@ -153,6 +154,7 @@ program
153
154
  await fs.mkdir(outDir, { recursive: true });
154
155
  await fs.writeFile(path.join(outDir, "last-report.md"), result.markdown, "utf8");
155
156
  await fs.writeFile(path.join(outDir, "last-report.json"), JSON.stringify(result, null, 2), "utf8");
157
+ await fs.writeFile(path.join(outDir, "ai-instructions.md"), getAiInstructions(), "utf8");
156
158
  if (!opts.localOnly) {
157
159
  const cfg = readConfig();
158
160
  if (!cfg.token) {
@@ -0,0 +1,86 @@
1
+ export const getAiInstructions = () => `
2
+ # Periderm CLI - AI Agent Instructions
3
+
4
+ You are assisting a developer with a project that uses **Periderm**, a pre-launch codebase scanner.
5
+
6
+ Your primary goal is to help the user achieve a "LAUNCH READY" verdict by running the scanner and fixing the findings until the report is completely clean.
7
+
8
+ ## Your Task
9
+
10
+ 1. **Install and Run Periderm:**
11
+ - If Periderm CLI is not installed, install it using the instructions below.
12
+ - Run \`periderm scan\` in the root of the project.
13
+ - If the scan fails due to authentication (the user is not logged in), **stop and tell the user to create an account at https://periderm-cli.vercel.app/ and log in by running \`periderm login\`**. DO NOT try to bypass this.
14
+
15
+ 2. **Fix Findings Iteratively:**
16
+ - Review the \`.periderm/last-report.md\` file or the terminal output.
17
+ - Fix the issues prioritized by severity (Critical -> High -> Medium -> Low).
18
+ - Use the "Exact fix" and "AI prompt" provided in the report to understand what needs to be changed.
19
+ - Keep your code changes minimal and focused solely on fixing the Periderm findings.
20
+ - Re-run \`periderm scan\` after making changes to verify the fix.
21
+ - Repeat this process until the scan returns a "LAUNCH READY" verdict with zero findings.
22
+
23
+ ---
24
+
25
+ ## Periderm Documentation
26
+
27
+ Here is the essential documentation for Periderm to help you understand its features and commands.
28
+
29
+ ### Installation
30
+ The easiest way to install Periderm CLI is using our installation script:
31
+ \`\`\`bash
32
+ curl -fsSL https://periderm-cli.vercel.app/install.sh | bash
33
+ \`\`\`
34
+ **Alternative (NPM):**
35
+ \`\`\`bash
36
+ npm install -g periderm-cli
37
+ \`\`\`
38
+
39
+ ### Log in
40
+ \`periderm scan\` requires a linked account. Run login once from any terminal:
41
+ \`\`\`bash
42
+ periderm login
43
+ \`\`\`
44
+ Your browser opens the dashboard CLI login page. After you approve the device, the CLI stores your token locally. Check the session anytime with \`periderm whoami\`.
45
+
46
+ ### Your first scan
47
+ From the project you want to check:
48
+ \`\`\`bash
49
+ cd ~/path/to/your-project
50
+ periderm scan
51
+ \`\`\`
52
+ You get a terminal verdict plus report files at:
53
+ - \`.periderm/last-report.md\`
54
+ - \`.periderm/last-report.json\`
55
+
56
+ ### Severity shorthand
57
+ When viewing scan reports, findings are broken down by severity:
58
+ - **c** (Critical): Application-breaking bugs, severe security vulnerabilities, or runaway cloud costs.
59
+ - **h** (High): Data corruption risks or major UI/accessibility failures.
60
+ - **m** (Medium): Standard technical debt, missing error boundaries, or minor logic flaws.
61
+ - **l** (Low): Best practice warnings and optimization suggestions.
62
+
63
+ ### CLI commands
64
+ - \`periderm scan\`: Scan current directory, upload results, and write reports. Requires login.
65
+ - \`periderm scan --local-only\`: Scan locally without uploading to the dashboard.
66
+ - \`periderm review --deep\`: (Scale/Unlimited plan only) AI agent review for edge cases static checks miss. Appends to your last report.
67
+ - \`periderm login\`: Link the CLI to your Periderm account via browser.
68
+ - \`periderm logout\`: Clear the locally stored CLI token.
69
+ - \`periderm whoami\`: Print API URL, user id, plan, and remaining scan quota.
70
+ - \`periderm watch\`: Re-run scans on file change.
71
+
72
+ ### Deep review (Scale / Unlimited)
73
+ \`periderm review --deep\` runs an AI agent locally against your codebase **after** a scan. It is designed for nuanced edge cases that deterministic rules cannot enumerate upfront.
74
+ Deep review **adds** findings; it does not replace the fast deterministic layer. Use both together before launch.
75
+
76
+ ### Uninstalling
77
+ If you ever need to remove the CLI and its local configuration:
78
+ \`\`\`bash
79
+ npm uninstall -g periderm-cli
80
+ rm -rf ~/.periderm
81
+ \`\`\`
82
+
83
+ ### Privacy & Terms
84
+ - **Privacy Policy:** Periderm CLI scans are designed to be privacy-first and run locally on your machine. **It does NOT access, collect, or store your source code, API keys, environment variables, or any sensitive project data.** Only high-level telemetry and metadata about the scan results are securely transmitted.
85
+ - **Terms:** Scan results are guidance, not legal, security, or compliance advice. Periderm CLI is provided "as is".
86
+ `;
@@ -106,6 +106,7 @@ export function renderMarkdown(r) {
106
106
  lines.push(`You are reviewing a Periderm CLI scan: Launch Confidence ${r.scores.confidence}/100, Reality ${r.scores.reality}/100, Perceived ${r.scores.perceived}/100 — verdict ${verdictLabel}.`);
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
+ lines.push(`IMPORTANT: Before you begin, read the instructions in \`.periderm/ai-instructions.md\` for the full iterative process on how to run the scanner, verify fixes, and handle any authentication requirements.`);
109
110
  lines.push("```");
110
111
  lines.push("");
111
112
  // Hidden watermark — only visible in raw .md source
@@ -123,7 +123,10 @@ export async function runRepoChecks(root, _files) {
123
123
  }
124
124
  }
125
125
  if (!isInternalAdmin) {
126
- const legalFilePaths = _files.filter(f => /terms|privacy|cookie|policy|legal|compliance|eula|tos/i.test(path.basename(f)));
126
+ const legalFilePaths = _files.filter(f => {
127
+ const rel = path.relative(root, f);
128
+ return /terms|privacy|cookie|policy|legal|compliance|eula|tos/i.test(rel);
129
+ });
127
130
  if (legalFilePaths.length === 0) {
128
131
  out.push({
129
132
  id: "missing-legal-docs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
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": {
@@ -36,6 +36,12 @@
36
36
  },
37
37
  "author": "Periderm",
38
38
  "license": "MIT",
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json && chmod +x dist/bin.js",
41
+ "postpublish": "cd ../../ && tsx --env-file=.env scripts/broadcast-update.ts",
42
+ "dev": "tsx src/index.ts",
43
+ "start": "node dist/index.js"
44
+ },
39
45
  "dependencies": {
40
46
  "@babel/parser": "^7.25.0",
41
47
  "@babel/traverse": "^7.25.0",
@@ -54,10 +60,5 @@
54
60
  },
55
61
  "engines": {
56
62
  "node": ">=18"
57
- },
58
- "scripts": {
59
- "build": "tsc -p tsconfig.json && chmod +x dist/bin.js",
60
- "dev": "tsx src/index.ts",
61
- "start": "node dist/index.js"
62
63
  }
63
- }
64
+ }