@agentlighthouse/core 0.1.0-alpha.0
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/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/analyzers/mcp.d.ts +8 -0
- package/dist/analyzers/mcp.d.ts.map +1 -0
- package/dist/analyzers/mcp.js +214 -0
- package/dist/analyzers/openapi.d.ts +7 -0
- package/dist/analyzers/openapi.d.ts.map +1 -0
- package/dist/analyzers/openapi.js +344 -0
- package/dist/analyzers/readiness.d.ts +8 -0
- package/dist/analyzers/readiness.d.ts.map +1 -0
- package/dist/analyzers/readiness.js +766 -0
- package/dist/analyzers/tasks.d.ts +3 -0
- package/dist/analyzers/tasks.d.ts.map +1 -0
- package/dist/analyzers/tasks.js +140 -0
- package/dist/changes/files.d.ts +5 -0
- package/dist/changes/files.d.ts.map +1 -0
- package/dist/changes/files.js +71 -0
- package/dist/comparison/compare.d.ts +14 -0
- package/dist/comparison/compare.d.ts.map +1 -0
- package/dist/comparison/compare.js +323 -0
- package/dist/config/profile.d.ts +16 -0
- package/dist/config/profile.d.ts.map +1 -0
- package/dist/config/profile.js +47 -0
- package/dist/detection/project.d.ts +4 -0
- package/dist/detection/project.d.ts.map +1 -0
- package/dist/detection/project.js +225 -0
- package/dist/findings/helpers.d.ts +36 -0
- package/dist/findings/helpers.d.ts.map +1 -0
- package/dist/findings/helpers.js +115 -0
- package/dist/findings/locations.d.ts +4 -0
- package/dist/findings/locations.d.ts.map +1 -0
- package/dist/findings/locations.js +117 -0
- package/dist/generators/artifacts.d.ts +6 -0
- package/dist/generators/artifacts.d.ts.map +1 -0
- package/dist/generators/artifacts.js +255 -0
- package/dist/index.d.ts +486 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +451 -0
- package/dist/probes/commands.d.ts +7 -0
- package/dist/probes/commands.d.ts.map +1 -0
- package/dist/probes/commands.js +198 -0
- package/dist/reporters/cli.d.ts +4 -0
- package/dist/reporters/cli.d.ts.map +1 -0
- package/dist/reporters/cli.js +42 -0
- package/dist/reporters/comparison.d.ts +13 -0
- package/dist/reporters/comparison.d.ts.map +1 -0
- package/dist/reporters/comparison.js +227 -0
- package/dist/reporters/github-summary.d.ts +4 -0
- package/dist/reporters/github-summary.d.ts.map +1 -0
- package/dist/reporters/github-summary.js +4 -0
- package/dist/reporters/json.d.ts +3 -0
- package/dist/reporters/json.d.ts.map +1 -0
- package/dist/reporters/json.js +3 -0
- package/dist/reporters/markdown.d.ts +3 -0
- package/dist/reporters/markdown.d.ts.map +1 -0
- package/dist/reporters/markdown.js +146 -0
- package/dist/reporters/pr-summary.d.ts +8 -0
- package/dist/reporters/pr-summary.d.ts.map +1 -0
- package/dist/reporters/pr-summary.js +38 -0
- package/dist/reporters/sarif.d.ts +3 -0
- package/dist/reporters/sarif.d.ts.map +1 -0
- package/dist/reporters/sarif.js +119 -0
- package/dist/reporters/shared.d.ts +8 -0
- package/dist/reporters/shared.d.ts.map +1 -0
- package/dist/reporters/shared.js +26 -0
- package/dist/scanners/filesystem.d.ts +6 -0
- package/dist/scanners/filesystem.d.ts.map +1 -0
- package/dist/scanners/filesystem.js +231 -0
- package/dist/schemas/types.d.ts +6652 -0
- package/dist/schemas/types.d.ts.map +1 -0
- package/dist/schemas/types.js +383 -0
- package/dist/scoring/calibration.d.ts +18 -0
- package/dist/scoring/calibration.d.ts.map +1 -0
- package/dist/scoring/calibration.js +231 -0
- package/dist/scoring/model.d.ts +21 -0
- package/dist/scoring/model.d.ts.map +1 -0
- package/dist/scoring/model.js +109 -0
- package/package.json +58 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export const scoringModelVersion = "0.1.0";
|
|
2
|
+
export const severityWeights = {
|
|
3
|
+
critical: 20,
|
|
4
|
+
high: 10,
|
|
5
|
+
medium: 5,
|
|
6
|
+
low: 2,
|
|
7
|
+
info: 0
|
|
8
|
+
};
|
|
9
|
+
const subscoreDefinitions = [
|
|
10
|
+
{
|
|
11
|
+
id: "agent_instructions",
|
|
12
|
+
label: "Agent Instructions",
|
|
13
|
+
categories: ["agent_instructions"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "documentation",
|
|
17
|
+
label: "Documentation",
|
|
18
|
+
categories: ["documentation", "repo_structure"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "api_and_tooling",
|
|
22
|
+
label: "API & Tooling",
|
|
23
|
+
categories: ["api_schema", "mcp_tools", "setup_and_tests"]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "examples_and_tasks",
|
|
27
|
+
label: "Examples & Tasks",
|
|
28
|
+
categories: ["examples", "task_benchmarks"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "security_and_privacy",
|
|
32
|
+
label: "Security & Privacy",
|
|
33
|
+
categories: ["security_and_privacy"]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "freshness_and_consistency",
|
|
37
|
+
label: "Freshness & Consistency",
|
|
38
|
+
categories: ["freshness_and_consistency"]
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
export class TransparentScoringModel {
|
|
42
|
+
id = "transparent-severity-scoring";
|
|
43
|
+
version = scoringModelVersion;
|
|
44
|
+
score(findings, _signals) {
|
|
45
|
+
void _signals;
|
|
46
|
+
const score = clampScore(100 - totalPenalty(findings));
|
|
47
|
+
const subscores = subscoreDefinitions.map((definition) => {
|
|
48
|
+
const relevantFindings = findings.filter((finding) => definition.categories.some((category) => category === finding.category));
|
|
49
|
+
return {
|
|
50
|
+
id: definition.id,
|
|
51
|
+
label: definition.label,
|
|
52
|
+
score: clampScore(100 - totalPenalty(relevantFindings)),
|
|
53
|
+
findingsCount: relevantFindings.filter((finding) => finding.severity !== "info").length
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
scoringModelVersion,
|
|
58
|
+
score,
|
|
59
|
+
summary: summarize(score, findings),
|
|
60
|
+
subscores,
|
|
61
|
+
recommendations: recommendedActions(findings)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function totalPenalty(findings) {
|
|
66
|
+
return findings.reduce((total, finding) => total + severityWeights[finding.severity], 0);
|
|
67
|
+
}
|
|
68
|
+
function clampScore(value) {
|
|
69
|
+
return Math.max(0, Math.min(100, value));
|
|
70
|
+
}
|
|
71
|
+
function summarize(score, findings) {
|
|
72
|
+
const blocking = findings.filter((finding) => ["critical", "high"].includes(finding.severity));
|
|
73
|
+
if (score >= 85) {
|
|
74
|
+
return `Strong agent-readiness with ${blocking.length} high-priority issue(s) remaining.`;
|
|
75
|
+
}
|
|
76
|
+
if (score >= 65) {
|
|
77
|
+
return `Useful foundation, but ${blocking.length} high-priority readiness issue(s) should be fixed.`;
|
|
78
|
+
}
|
|
79
|
+
return `Agent-readiness needs focused work before agents can reliably use this project.`;
|
|
80
|
+
}
|
|
81
|
+
function recommendedActions(findings) {
|
|
82
|
+
const actions = [];
|
|
83
|
+
const ids = new Set(findings.map((finding) => finding.id));
|
|
84
|
+
if (ids.has("agent-instructions.missing-agents-md") || ids.has("llms.missing")) {
|
|
85
|
+
actions.push("Run: agentlighthouse init .");
|
|
86
|
+
}
|
|
87
|
+
if ([...ids].some((id) => id.startsWith("setup."))) {
|
|
88
|
+
actions.push("Add or document setup, test, lint, and typecheck commands.");
|
|
89
|
+
}
|
|
90
|
+
if ([...ids].some((id) => id.startsWith("docs."))) {
|
|
91
|
+
actions.push("Improve README and docs so agents can find quickstart, install, and examples.");
|
|
92
|
+
}
|
|
93
|
+
if ([...ids].some((id) => id.startsWith("benchmarks.") || id.startsWith("TASK_"))) {
|
|
94
|
+
actions.push("Add task benchmarks for the top developer workflows agents should complete.");
|
|
95
|
+
}
|
|
96
|
+
if ([...ids].some((id) => id.startsWith("OPENAPI_"))) {
|
|
97
|
+
actions.push("Improve OpenAPI operation descriptions, examples, auth, and error responses.");
|
|
98
|
+
}
|
|
99
|
+
if ([...ids].some((id) => id.startsWith("MCP_"))) {
|
|
100
|
+
actions.push("Clarify MCP tool names, descriptions, schemas, examples, and safety notes.");
|
|
101
|
+
}
|
|
102
|
+
if ([...ids].some((id) => id.startsWith("COMMAND_"))) {
|
|
103
|
+
actions.push("Use opt-in command probes in trusted environments to verify setup and tests.");
|
|
104
|
+
}
|
|
105
|
+
if ([...ids].some((id) => id.startsWith("security."))) {
|
|
106
|
+
actions.push("Document secret-handling and privacy rules for agent workflows.");
|
|
107
|
+
}
|
|
108
|
+
return actions.slice(0, 5);
|
|
109
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentlighthouse/core",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Core scanner, schemas, scoring, and generators for AgentLighthouse.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/PainDeMie64/agentlighthouse.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/PainDeMie64/agentlighthouse#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/PainDeMie64/agentlighthouse/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"agent-readiness",
|
|
17
|
+
"ai-agents",
|
|
18
|
+
"openapi",
|
|
19
|
+
"mcp",
|
|
20
|
+
"ci",
|
|
21
|
+
"sarif"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/__tests__",
|
|
28
|
+
"!dist/.tsbuildinfo",
|
|
29
|
+
"package.json",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.json",
|
|
46
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
47
|
+
"test": "vitest run"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"yaml": "^2.9.0",
|
|
51
|
+
"zod": "^3.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^22.0.0",
|
|
55
|
+
"typescript": "^5.0.0",
|
|
56
|
+
"vitest": "^3.0.0"
|
|
57
|
+
}
|
|
58
|
+
}
|