@lintsure/core 0.1.1 → 0.1.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.
- package/dist/src/guidance.d.ts +13 -1
- package/dist/src/guidance.js +22 -3
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +12 -6
- package/dist/src/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/src/guidance.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Control, Proposal } from "./types.js";
|
|
2
|
+
/** The approval rule every agent must follow before doing anything. Part of AGENT_GUIDANCE and every scan reply. */
|
|
3
|
+
export declare const APPROVAL_RULES = "Before you do anything (edit, create or delete a file, run a command, install a package, or treat a framework as applying), stop and present a proposal with all four parts:\n1. What you plan to do.\n2. Why: the problem and the rule or control it relates to.\n3. Where, exactly: the file and line, or the document and section.\n4. The benefit to the user if they approve it.\nThen ask the user to approve that one proposal and wait. Only a clear yes is approval. Silence, \"maybe\" or a question is not. Do only what was approved, then show what changed. One proposal at a time.";
|
|
4
|
+
/** Lays a finding out as a proposal a person can approve or decline. */
|
|
5
|
+
export declare function proposalFor(f: {
|
|
6
|
+
file: string;
|
|
7
|
+
line: number;
|
|
8
|
+
title: string;
|
|
9
|
+
fix: string;
|
|
10
|
+
note: string;
|
|
11
|
+
controls: Control[];
|
|
12
|
+
}): Proposal;
|
|
13
|
+
export declare const AGENT_GUIDANCE = "You are using Lintsure, a readiness tool that checks code against compliance frameworks.\n\nBefore you do anything (edit, create or delete a file, run a command, install a package, or treat a framework as applying), stop and present a proposal with all four parts:\n1. What you plan to do.\n2. Why: the problem and the rule or control it relates to.\n3. Where, exactly: the file and line, or the document and section.\n4. The benefit to the user if they approve it.\nThen ask the user to approve that one proposal and wait. Only a clear yes is approval. Silence, \"maybe\" or a question is not. Do only what was approved, then show what changed. One proposal at a time.\n\nWhen you report Lintsure results:\n- Never say or imply the user is compliant, certified, approved, audit-ready, \"good to go\", or that they passed. Lintsure cannot decide that.\n- Never make a decision for the user. Present findings and options; the user chooses what to do.\n- Every finding comes with a proposal (where, what, why, benefit). Show it as a proposal, never as something you have already done.\n- Say that results cover code only, against Lintsure's reading of the publicly available text of each framework.\n- Always mention the items outside code (policies, training, contracts, evidence) that still need to be done before a full review.\n- Recommend that a qualified person review the results before any audit, certification or business decision.\n- A control marked Met only means Lintsure's rules found no problem in the files they read. Say so if you mention Met.";
|
|
2
14
|
/** Phrases that read as a verdict. Lintsure's own output must never claim these. */
|
|
3
15
|
export declare const FORBIDDEN_CLAIMS: RegExp[];
|
package/dist/src/guidance.js
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** The approval rule every agent must follow before doing anything. Part of AGENT_GUIDANCE and every scan reply. */
|
|
2
|
+
export const APPROVAL_RULES = `Before you do anything (edit, create or delete a file, run a command, install a package, or treat a framework as applying), stop and present a proposal with all four parts:
|
|
3
|
+
1. What you plan to do.
|
|
4
|
+
2. Why: the problem and the rule or control it relates to.
|
|
5
|
+
3. Where, exactly: the file and line, or the document and section.
|
|
6
|
+
4. The benefit to the user if they approve it.
|
|
7
|
+
Then ask the user to approve that one proposal and wait. Only a clear yes is approval. Silence, "maybe" or a question is not. Do only what was approved, then show what changed. One proposal at a time.`;
|
|
8
|
+
const NAMES = { "eu-ai-act": "EU AI Act", gdpr: "GDPR", soc2: "SOC 2", "iso-27001": "ISO 27001" };
|
|
9
|
+
const refs = (cs) => cs.map((c) => `${NAMES[c.framework]} ${c.id}`).join(", ");
|
|
10
|
+
/** Lays a finding out as a proposal a person can approve or decline. */
|
|
11
|
+
export function proposalFor(f) {
|
|
12
|
+
return {
|
|
13
|
+
where: `${f.file}:${f.line}`,
|
|
14
|
+
what: f.fix,
|
|
15
|
+
why: `${f.title}. ${f.note} Relates to ${refs(f.controls)}.`,
|
|
16
|
+
benefit: `Removes this finding from the code side of ${refs(f.controls)}, so it no longer shows up when this file is reviewed. Work outside code may still be needed.`,
|
|
17
|
+
needsApproval: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
3
20
|
export const AGENT_GUIDANCE = `You are using Lintsure, a readiness tool that checks code against compliance frameworks.
|
|
4
21
|
|
|
22
|
+
${APPROVAL_RULES}
|
|
23
|
+
|
|
5
24
|
When you report Lintsure results:
|
|
6
25
|
- Never say or imply the user is compliant, certified, approved, audit-ready, "good to go", or that they passed. Lintsure cannot decide that.
|
|
7
26
|
- Never make a decision for the user. Present findings and options; the user chooses what to do.
|
|
8
|
-
-
|
|
27
|
+
- Every finding comes with a proposal (where, what, why, benefit). Show it as a proposal, never as something you have already done.
|
|
9
28
|
- Say that results cover code only, against Lintsure's reading of the publicly available text of each framework.
|
|
10
29
|
- Always mention the items outside code (policies, training, contracts, evidence) that still need to be done before a full review.
|
|
11
30
|
- Recommend that a qualified person review the results before any audit, certification or business decision.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { rules } from "./rules/index.js";
|
|
2
2
|
import type { FrameworkId, Report } from "./types.js";
|
|
3
|
+
/** Heading above every proposed change, in every report. Tests check it is there for each finding. */
|
|
4
|
+
export declare const PROPOSAL_HEADING = "Proposed change. Nothing changes until you approve it.";
|
|
3
5
|
export * from "./types.js";
|
|
4
6
|
export { rules };
|
|
5
7
|
export * from "./guidance.js";
|
|
6
8
|
export { toAssessmentHtml } from "./assessment.js";
|
|
7
9
|
export * from "./knowledge/index.js";
|
|
8
|
-
export declare const RULES_VERSION = "0.1.
|
|
10
|
+
export declare const RULES_VERSION = "0.1.3";
|
|
9
11
|
/** Shown with every result, in every interface. Lintsure prepares; people decide. */
|
|
10
12
|
export declare const DISCLAIMER: string;
|
|
11
13
|
/** What a report must never be read as. Used in the report and by the MCP server. */
|
package/dist/src/index.js
CHANGED
|
@@ -4,12 +4,15 @@ import { readdir, readFile } from "node:fs/promises";
|
|
|
4
4
|
import { extname, join, relative, sep } from "node:path";
|
|
5
5
|
import { outsideFor } from "./knowledge/index.js";
|
|
6
6
|
import { rules } from "./rules/index.js";
|
|
7
|
+
import { proposalFor } from "./guidance.js";
|
|
8
|
+
/** Heading above every proposed change, in every report. Tests check it is there for each finding. */
|
|
9
|
+
export const PROPOSAL_HEADING = "Proposed change. Nothing changes until you approve it.";
|
|
7
10
|
export * from "./types.js";
|
|
8
11
|
export { rules };
|
|
9
12
|
export * from "./guidance.js";
|
|
10
13
|
export { toAssessmentHtml } from "./assessment.js";
|
|
11
14
|
export * from "./knowledge/index.js";
|
|
12
|
-
export const RULES_VERSION = "0.1.
|
|
15
|
+
export const RULES_VERSION = "0.1.3";
|
|
13
16
|
/** Shown with every result, in every interface. Lintsure prepares; people decide. */
|
|
14
17
|
export const DISCLAIMER = "Lintsure is a readiness tool, not an audit, a certification or legal advice. " +
|
|
15
18
|
"Its rules reflect our reading of the publicly available text of each framework, and they check code only. " +
|
|
@@ -118,10 +121,13 @@ export async function scan(root, frameworks = ALL_FRAMEWORKS) {
|
|
|
118
121
|
if (lines.some((l) => l.length > MAX_LINE))
|
|
119
122
|
continue; // minified or generated
|
|
120
123
|
filesChecked++;
|
|
121
|
-
const add = (r, line) =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
const add = (r, line) => {
|
|
125
|
+
const controls = r.controls.filter((c) => frameworks.includes(c.framework));
|
|
126
|
+
findings.push({
|
|
127
|
+
ruleId: r.id, file, line, status: r.status, severity: r.severity, title: r.title, controls, fix: r.fix, note: r.note,
|
|
128
|
+
proposal: proposalFor({ file, line, title: r.title, fix: r.fix, note: r.note, controls }),
|
|
129
|
+
});
|
|
130
|
+
};
|
|
125
131
|
for (const r of relevant) {
|
|
126
132
|
if (r.test)
|
|
127
133
|
lines.forEach((text, i) => { if (r.test(text))
|
|
@@ -159,7 +165,7 @@ export function toMarkdown(r) {
|
|
|
159
165
|
if (!r.findings.length)
|
|
160
166
|
lines.push("No issues found by the current rules.", "");
|
|
161
167
|
for (const f of r.findings)
|
|
162
|
-
lines.push(`### ${LABEL[f.status]} · \`${f.file}:${f.line}\``, `**${f.title}** (${f.severity})`, "", `- Rules: ${ctl(f.controls)}`, `-
|
|
168
|
+
lines.push(`### ${LABEL[f.status]} · \`${f.file}:${f.line}\``, `**${f.title}** (${f.severity})`, "", `- Rules: ${ctl(f.controls)}`, `- Auditor note: ${f.note}`, "", `**${PROPOSAL_HEADING}**`, "", `- Where: \`${f.proposal.where}\``, `- What: ${f.proposal.what}`, `- Why: ${f.proposal.why}`, `- Benefit: ${f.proposal.benefit}`, "");
|
|
163
169
|
lines.push(`## Met (${r.met.length})`, "", ...r.met.map((m) => `- ${m.title} · ${ctl(m.controls)}`), "");
|
|
164
170
|
lines.push(`## Outside code (${r.outside.length})`, "", "Code can't prove these. They still need to be done before a full review.", "", ...r.outside.map((o) => `- ${o.framework.toUpperCase()} ${o.control} · ${o.title}: ${o.evidence}`), "");
|
|
165
171
|
lines.push("## What to do next", "", ...nextSteps(r).map((s, i) => `${i + 1}. ${s}`), "");
|
package/dist/src/types.d.ts
CHANGED
|
@@ -25,6 +25,19 @@ export interface Rule {
|
|
|
25
25
|
mappedBy: string;
|
|
26
26
|
reviewedAt: string;
|
|
27
27
|
}
|
|
28
|
+
/** A change Lintsure suggests. It is only ever a proposal: a person must approve it first. */
|
|
29
|
+
export interface Proposal {
|
|
30
|
+
/** Exactly where: "file:line". */
|
|
31
|
+
where: string;
|
|
32
|
+
/** What would change. */
|
|
33
|
+
what: string;
|
|
34
|
+
/** Why: the problem and the controls it relates to. */
|
|
35
|
+
why: string;
|
|
36
|
+
/** What the person gains if they approve it. */
|
|
37
|
+
benefit: string;
|
|
38
|
+
/** Always true. Nothing changes without an explicit yes. */
|
|
39
|
+
needsApproval: true;
|
|
40
|
+
}
|
|
28
41
|
export interface Finding {
|
|
29
42
|
ruleId: string;
|
|
30
43
|
file: string;
|
|
@@ -35,6 +48,8 @@ export interface Finding {
|
|
|
35
48
|
controls: Control[];
|
|
36
49
|
fix: string;
|
|
37
50
|
note: string;
|
|
51
|
+
/** The suggested change, laid out for a person to approve or decline. */
|
|
52
|
+
proposal: Proposal;
|
|
38
53
|
}
|
|
39
54
|
export interface OutsideItem {
|
|
40
55
|
framework: FrameworkId;
|
package/package.json
CHANGED