lintsure 0.3.12 → 0.3.14

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.
Files changed (2) hide show
  1. package/dist/src/index.js +44 -37
  2. package/package.json +2 -2
package/dist/src/index.js CHANGED
@@ -2,49 +2,51 @@
2
2
  // npx lintsure scan [path] [options] npx lintsure baseline [path]
3
3
  // Writes reports into the current folder. Never sends anything over the network.
4
4
  import { execFileSync } from "node:child_process";
5
+ import { existsSync } from "node:fs";
5
6
  import { access, mkdir, readFile, writeFile } from "node:fs/promises";
6
7
  import { basename, dirname, join, resolve } from "node:path";
7
8
  import { createInterface } from "node:readline/promises";
8
9
  import { status, pick, setup, undo } from "./agents.js";
9
10
  import { parseActivity, toOtlp } from "./otel.js";
10
11
  import { ALL_FRAMEWORKS, BASELINE_FILE, DISCLAIMER, RULES_VERSION, classify, isOpen, nextSteps, readConfig, scan, toAssessmentHtml, toBaseline, toMarkdown, toSarif } from "@lintsure/core";
11
- const HELP = `lintsure scan [path] [options]
12
- lintsure baseline [path]
13
- lintsure init [path] Three questions, saved to lintsure.config.yaml
14
- lintsure info [path] Show the settings a scan would use, and where each comes from
15
- lintsure setup [path] Add the Lintsure MCP server to this project's agent configs
16
- (shows the change; --yes writes it; --undo takes it out;
17
- --agents claude,cursor,vscode,gemini)
18
- lintsure status [path] Check that this project is ready: Node, config, rules, agents
19
- lintsure export --otlp-json [path] Write .lintsure/activity.jsonl as an OpenTelemetry
20
- traces file (lintsure.otlp.json) for your own observability tool
21
-
22
- scan options:
23
- --framework <ids> Comma list: ${ALL_FRAMEWORKS.join(", ")}
24
- (default: lintsure.config.yaml if present, else all)
25
- --all Also list medium-confidence findings (held back by default)
26
- --diff <base> Only list findings on lines changed since <base>, e.g. origin/main
27
- --json Also write lintsure-report.json
28
- --sarif Also write lintsure.sarif (for GitHub code scanning and editors)
29
- --report Also write lintsure-assessment.html, a multi-page report
30
- to review, print or save as PDF
31
- --project <name> Project name on the assessment cover (default: folder name)
32
- --fail-on <status> Exit 1 if any open finding is "gap" or "partial" (for CI)
33
- --new-only With --fail-on: count only findings that are new since
34
- .lintsure/baseline.json
35
- --github Print GitHub Actions annotations, so findings show on the lines
36
- --save-record Also save this run's readiness check record to
37
- .lintsure/records/<id>.json, building a dated history (no code inside)
38
-
39
- baseline:
40
- Saves the current open findings to .lintsure/baseline.json in the scanned folder.
41
- Later scans show what is new, fixed or unchanged. The file holds rule ids, file
42
- paths and one-way fingerprints, never code. You decide whether to commit it.
43
-
44
- Accept a finding after review by adding it to .lintsure/accepted.yaml, with the
45
- fingerprint from lintsure-report.json, your reason, your name and the date.
46
-
47
- ${DISCLAIMER}
12
+ const HELP = `lintsure scan [path] [options]
13
+ lintsure baseline [path]
14
+ lintsure init [path] Three questions, saved to lintsure.config.yaml
15
+ lintsure info [path] Show the settings a scan would use, and where each comes from
16
+ lintsure setup [path] Add the Lintsure MCP server to this project's agent configs
17
+ (shows the change; --yes writes it; --undo takes it out;
18
+ --agents claude,cursor,vscode,gemini)
19
+ lintsure status [path] Check that this project is ready: Node, config, rules, agents
20
+ lintsure export --otlp-json [path] Write .lintsure/activity.jsonl as an OpenTelemetry
21
+ traces file (lintsure.otlp.json) for your own observability tool
22
+
23
+ scan options:
24
+ --framework <ids> Comma list: ${ALL_FRAMEWORKS.join(", ")}
25
+ (default: lintsure.config.yaml if present, else all)
26
+ --all Also list medium-confidence findings (held back by default)
27
+ --diff <base> Only list findings on lines changed since <base>, e.g. origin/main
28
+ --json Also write lintsure-report.json
29
+ --sarif Also write lintsure.sarif (for GitHub code scanning and editors)
30
+ --report Also write lintsure-assessment.html, a multi-page report
31
+ to review, print or save as PDF
32
+ --project <name> Project name on the assessment cover (default: folder name)
33
+ --fail-on <status> Exit 1 if any open finding is "gap" or "partial" (for CI). Held-back
34
+ medium-confidence findings count only with --all
35
+ --new-only With --fail-on: count only findings that are new since
36
+ .lintsure/baseline.json
37
+ --github Print GitHub Actions annotations, so findings show on the lines
38
+ --save-record Also save this run's readiness check record to
39
+ .lintsure/records/<id>.json, building a dated history (no code inside)
40
+
41
+ baseline:
42
+ Saves the current open findings to .lintsure/baseline.json in the scanned folder.
43
+ Later scans show what is new, fixed or unchanged. The file holds rule ids, file
44
+ paths and one-way fingerprints, never code. You decide whether to commit it.
45
+
46
+ Accept a finding after review by adding it to .lintsure/accepted.yaml, with the
47
+ fingerprint from lintsure-report.json, your reason, your name and the date.
48
+
49
+ ${DISCLAIMER}
48
50
  Lintsure never sends your code anywhere.`;
49
51
  const VALUE_FLAGS = ["--framework", "--fail-on", "--project", "--diff"];
50
52
  const BOOL_FLAGS = ["--json", "--sarif", "--report", "--new-only", "--github", "--save-record", "--all"];
@@ -210,6 +212,10 @@ async function main(argv) {
210
212
  const flag = (n) => { const i = rest.indexOf(n); return i >= 0 ? rest[i + 1] : undefined; };
211
213
  const path = resolve(rest.find((a, i) => !a.startsWith("--") && !VALUE_FLAGS.includes(rest[i - 1])) ?? ".");
212
214
  const wanted = flag("--framework")?.split(",").map((s) => s.trim());
215
+ if (!existsSync(path)) {
216
+ console.error(`No folder at ${path}. Pass the project folder to scan, for example: lintsure scan .`);
217
+ return 2;
218
+ }
213
219
  const config = await readConfig(path);
214
220
  // Checked after the config loads its rule packs, so a pack's framework id is accepted.
215
221
  const bad = wanted?.filter((f) => !ALL_FRAMEWORKS.includes(f));
@@ -281,6 +287,7 @@ async function main(argv) {
281
287
  console.log(`Record ${report.record.id} · ${report.record.createdAt.replace("T", " ").slice(0, 16)} UTC · ${report.record.counts.checkPoints} check points${report.policy ? ` · Policy #${report.policy.fingerprint}` : ""}`);
282
288
  // A check mark only when nothing is open: "✓ 3 gaps" read as a pass.
283
289
  console.log(`${open.length ? "!" : "✓"} ${open.length} open findings · ${n("gap")} gap · ${n("partial")} partial${accepted ? ` · ${accepted} accepted` : ""} · ${report.met.length} rules met · ${report.outside.length} outside code`);
290
+ console.log(` Read ${report.filesChecked} file${report.filesChecked === 1 ? "" : "s"}${report.filesSkipped ? `, skipped ${report.filesSkipped} (over 1 MB, binary or unreadable)` : ""}`);
284
291
  if (report.diffBase)
285
292
  console.log(` Only lines changed since ${report.diffBase}`);
286
293
  if (report.held)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lintsure",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Readiness checks for the code your AI writes: EU AI Act, GDPR, OWASP, CWE Top 25, EU Cyber Resilience Act. Runs locally. Not an audit or legal advice.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "dependencies": {
16
- "@lintsure/core": "0.3.12"
16
+ "@lintsure/core": "0.3.14"
17
17
  },
18
18
  "author": "Lintsure <hello@lintsure.com>",
19
19
  "homepage": "https://lintsure.com/docs",