@dailephd/my-dev-kit-lab 0.3.1 → 0.3.2

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.
@@ -0,0 +1,67 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { runSecurityValidation } from "../../securityValidation/validate/runSecurityValidation.js";
4
+ import { reportFilenamePrefix } from "../../securityValidation/validate/resolveTarget.js";
5
+ import { renderJsonReport, renderTextReport } from "../../securityValidation/report/renderSecurityReport.js";
6
+ import { buildSecurityReportFromSummary } from "../../securityValidation/report/buildSecurityReport.js";
7
+ import { DEFAULT_SECURITY_CHECKS, DEFAULT_SECURITY_PROFILE } from "../../securityValidation/validate/cliOptions.js";
8
+ import { verdictToHumanLabel } from "../../securityValidation/validate/verdict.js";
9
+ import { mapSecurityFindingToAuditIssue } from "./mapSecurityFindingToAuditIssue.js";
10
+ export async function runSecurityAuditAdapter(options) {
11
+ const { toolRoot, config } = options;
12
+ const summary = await runSecurityValidation({
13
+ cwd: toolRoot,
14
+ targetPath: config.targetPathArg,
15
+ });
16
+ // Only real findings on executed checks become AuditIssue entries. A
17
+ // skipped optional tool never has findings attached to it (see
18
+ // skippedCheck() in runSecurityValidation.ts), so it can never silently
19
+ // masquerade as an issue or as a passed check here.
20
+ const issues = summary.findings.map(mapSecurityFindingToAuditIssue);
21
+ const report = buildSecurityReportFromSummary(summary, {
22
+ profile: DEFAULT_SECURITY_PROFILE,
23
+ selectedChecks: [...DEFAULT_SECURITY_CHECKS],
24
+ formats: ["text", "json"],
25
+ });
26
+ // Always under my-dev-kit-lab's own reports/ tree (toolRoot), never under
27
+ // the audited target's root — matches the target-safety guarantee
28
+ // AuditTarget.safeReportOutputRoot already documents for code-rot reports.
29
+ const reportDir = path.join(toolRoot, "reports", "security");
30
+ if (!fs.existsSync(reportDir)) {
31
+ fs.mkdirSync(reportDir, { recursive: true });
32
+ }
33
+ const prefix = reportFilenamePrefix({
34
+ isSelf: summary.isSelf,
35
+ packageName: summary.packageName,
36
+ packageVersion: summary.packageVersion,
37
+ targetRoot: summary.targetRoot,
38
+ });
39
+ const textPath = path.join(reportDir, `${prefix}-security-validation.txt`);
40
+ const jsonPath = path.join(reportDir, `${prefix}-security-validation.json`);
41
+ fs.writeFileSync(textPath, renderTextReport(report), "utf8");
42
+ fs.writeFileSync(jsonPath, renderJsonReport(report), "utf8");
43
+ const findingCounts = {
44
+ blocker: summary.findings.filter((f) => f.severity === "blocker").length,
45
+ major: summary.findings.filter((f) => f.severity === "major").length,
46
+ minor: summary.findings.filter((f) => f.severity === "minor").length,
47
+ informational: summary.findings.filter((f) => f.severity === "informational").length,
48
+ };
49
+ const securitySummary = {
50
+ ran: true,
51
+ verdict: summary.verdict,
52
+ verdictLabel: verdictToHumanLabel(summary.verdict),
53
+ recommendedNextStep: summary.recommendedNextStep,
54
+ targetDescription: summary.targetDescription,
55
+ isSelf: summary.isSelf,
56
+ totalChecks: summary.checks.length,
57
+ checksPassed: summary.checks.filter((c) => c.status === "passed").length,
58
+ checksWarning: summary.checks.filter((c) => c.status === "warning").length,
59
+ checksFailed: summary.checks.filter((c) => c.status === "failed").length,
60
+ checksSkipped: summary.checks.filter((c) => c.status === "skipped").length,
61
+ findingCounts,
62
+ mappedIssueCount: issues.length,
63
+ verdictReasonSummary: summary.verdictReasonSummary ?? null,
64
+ reportPaths: { text: textPath, json: jsonPath },
65
+ };
66
+ return { issues, summary: securitySummary };
67
+ }
@@ -0,0 +1,17 @@
1
+ export const SECURITY_AUDIT_NOT_RUN_SUMMARY = {
2
+ ran: false,
3
+ verdict: null,
4
+ verdictLabel: null,
5
+ recommendedNextStep: null,
6
+ targetDescription: null,
7
+ isSelf: null,
8
+ totalChecks: 0,
9
+ checksPassed: 0,
10
+ checksWarning: 0,
11
+ checksFailed: 0,
12
+ checksSkipped: 0,
13
+ findingCounts: { blocker: 0, major: 0, minor: 0, informational: 0 },
14
+ mappedIssueCount: 0,
15
+ verdictReasonSummary: null,
16
+ reportPaths: { text: null, json: null },
17
+ };
@@ -0,0 +1,31 @@
1
+ export function buildSecurityReportFromSummary(summary, options = {}) {
2
+ return {
3
+ metadata: {
4
+ toolRoot: summary.toolRoot,
5
+ toolPackageName: summary.toolPackageName,
6
+ toolPackageVersion: summary.toolPackageVersion,
7
+ targetRoot: summary.targetRoot,
8
+ targetDescription: summary.targetDescription,
9
+ packageName: summary.packageName,
10
+ packageVersion: summary.packageVersion,
11
+ branch: summary.auditedBranch,
12
+ commit: summary.auditedCommit,
13
+ isSelf: summary.isSelf,
14
+ generatedAt: summary.finishedAt,
15
+ totalDurationMs: new Date(summary.finishedAt).getTime() - new Date(summary.startedAt).getTime(),
16
+ profile: options.profile,
17
+ selectedChecks: options.selectedChecks,
18
+ failOnThreshold: options.failOnThreshold,
19
+ formats: options.formats,
20
+ failOnBreached: options.failOnBreached,
21
+ isFullReleaseGate: summary.isFullReleaseGate,
22
+ },
23
+ sections: [],
24
+ allChecks: summary.checks,
25
+ allFindings: summary.findings,
26
+ verdict: summary.verdict,
27
+ recommendedNextStep: summary.recommendedNextStep,
28
+ attackResults: summary.attackResults,
29
+ verdictReasonSummary: summary.verdictReasonSummary,
30
+ };
31
+ }
@@ -8,6 +8,15 @@ export function resolveValidationTarget(targetPathArg, toolRoot) {
8
8
  // Returns the prefix to use for report filenames based on target metadata.
9
9
  // For self-validation: "v<version>" (preserves existing behavior).
10
10
  // For external targets: "<sanitized-name>-v<version>" or "<sanitized-dirname>".
11
+ //
12
+ // v0.3.2 Batch 4 — the parameter type is deliberately narrowed to a Pick of
13
+ // SecurityValidationTarget (rather than the full type) so the audit security
14
+ // adapter (src/audits/security/securityAuditAdapter.ts) can call this with a
15
+ // plain object built from a SecurityValidationSummary (which carries these
16
+ // same four fields but isn't itself a SecurityValidationTarget) instead of
17
+ // re-resolving the target a second time. Every existing caller already passes
18
+ // a full SecurityValidationTarget, which satisfies this narrower type
19
+ // unchanged.
11
20
  export function reportFilenamePrefix(target) {
12
21
  if (target.isSelf && target.packageVersion) {
13
22
  return `v${target.packageVersion}`;
package/package.json CHANGED
@@ -1,99 +1,97 @@
1
- {
2
- "name": "@dailephd/my-dev-kit-lab",
3
- "version": "0.3.1",
4
- "type": "module",
5
- "description": "Evidence, benchmark, and evaluation companion for my-dev-kit.",
6
- "bin": {
7
- "my-dev-kit-lab": "dist/scripts/run-final-demo.js"
8
- },
1
+ {
2
+ "name": "@dailephd/my-dev-kit-lab",
3
+ "version": "0.3.2",
4
+ "type": "module",
5
+ "description": "Evidence, benchmark, and evaluation companion for my-dev-kit.",
6
+ "bin": {
7
+ "my-dev-kit-lab": "dist/scripts/run-final-demo.js"
8
+ },
9
9
  "files": [
10
10
  "dist/scripts/",
11
11
  "!dist/scripts/docs/",
12
12
  "dist/src/",
13
13
  "benchmarks/",
14
- "docs/METRICS.md",
15
- "examples/",
16
- "tests/fixtures/"
17
- ],
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/dailephd/my-dev-kit-lab.git"
21
- },
22
- "homepage": "https://github.com/dailephd/my-dev-kit-lab#readme",
23
- "bugs": {
24
- "url": "https://github.com/dailephd/my-dev-kit-lab/issues"
25
- },
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "funding": [
30
- "https://github.com/sponsors/dailephd",
31
- "https://paypal.me/daile88"
32
- ],
33
- "keywords": [
34
- "benchmark",
35
- "evaluation",
36
- "reporting",
37
- "graph-retrieval",
38
- "codex",
39
- "claude"
40
- ],
41
- "author": "Dai Le",
42
- "license": "MIT",
43
- "scripts": {
44
- "build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json",
45
- "typecheck": "tsc --noEmit",
46
- "test": "vitest run",
47
- "test:benchmarks": "vitest run tests/benchmarks tests/scripts",
48
- "test:report": "vitest run tests/report tests/commands",
49
- "test:screenshot": "vitest run tests/screenshot",
50
- "test:evaluation": "vitest run tests/core tests/evaluation tests/commands",
51
- "test:gallery": "vitest run tests/gallery",
52
- "test:demo": "vitest run tests/commands/runLabDemo.spec.ts tests/integration/runLabDemoCommand.spec.ts",
53
- "test:integration": "vitest run tests/integration",
54
- "test:e2e": "vitest run tests/e2e",
55
- "test:agents": "vitest run tests/agents tests/commands/runAgentPromptCommand.spec.ts tests/integration/runAgentPromptFake.spec.ts",
56
- "test:experiments": "vitest run tests/evaluation/buildExperimentMatrix.spec.ts tests/evaluation/classifyAgentRunOutcome.spec.ts tests/evaluation/parseAgentAnswer.spec.ts tests/evaluation/scoreCorrectness.spec.ts tests/evaluation/compareExperimentRuns.spec.ts tests/evaluation/runControlledExperiment.spec.ts tests/commands/runControlledExperimentCommand.spec.ts tests/integration/runControlledExperimentFake.spec.ts",
57
- "capture-demo-report": "tsx scripts/capture-demo-report.ts",
58
- "evaluate-token-savings": "tsx scripts/evaluate-token-savings.ts",
59
- "generate-experiment-plots": "tsx scripts/generate-experiment-plots.ts",
60
- "generate-prompt-variants": "tsx scripts/generate-prompt-variants.ts",
61
- "build-gallery": "tsx scripts/build-gallery.ts",
62
- "lab-demo": "tsx scripts/run-lab-demo.ts",
63
- "render-experiment-report": "tsx scripts/render-experiment-report.ts",
64
- "experiment:list": "tsx scripts/experiments/listExperiments.ts",
65
- "experiment:describe": "tsx scripts/experiments/describeExperiment.ts",
66
- "experiment:run": "tsx scripts/experiments/runExperiment.ts",
67
- "ecosystem:sync": "tsx scripts/docs/syncEcosystemDocs.ts",
68
- "ecosystem:check": "tsx scripts/docs/checkEcosystemDocs.ts",
69
- "run-final-demo": "tsx scripts/run-final-demo.ts",
70
- "run-agent-prompt": "tsx scripts/run-agent-prompt.ts",
71
- "run-controlled-experiment": "tsx scripts/run-controlled-experiment.ts",
72
- "run-visualization-demos": "tsx scripts/run-visualization-demos.ts",
73
- "test:plots": "vitest run tests/plots tests/commands/generateExperimentPlotsCommand.spec.ts",
74
- "test:visualization-demos": "vitest run tests/visualizationDemos tests/commands/runVisualizationDemosCommand.spec.ts",
75
- "verify:benchmarks": "tsx scripts/verify-benchmarks.ts",
76
- "verify": "npm run build && npm run test && npm run test:benchmarks && npm run test:report && npm run test:screenshot && npm run test:evaluation && npm run test:agents && npm run test:experiments && npm run test:plots && npm run test:visualization-demos && npm run test:gallery && npm run test:demo && npm run test:integration && npm run test:e2e && npm run verify:benchmarks",
77
- "security:deps": "tsx scripts/security/runDependencyChecks.ts",
78
- "security:package": "tsx scripts/security/runPackageChecks.ts",
79
- "security:codeql": "tsx scripts/security/runCodeql.ts",
80
- "security:semgrep": "tsx scripts/security/runSemgrep.ts",
81
- "test:security": "vitest run tests/security/",
82
- "test:fuzz:smoke": "tsx scripts/security/runFuzzSmoke.ts",
83
- "security:validate": "tsx scripts/security/validate.ts",
84
- "audit": "tsx scripts/audits/runAudit.ts"
85
- },
86
- "devDependencies": {
87
- "@types/node": "^24.0.0",
88
- "playwright": "^1.54.1",
89
- "tsx": "^4.20.3",
90
- "typescript": "^5.8.3",
91
- "vitest": "^3.2.4"
92
- },
93
- "overrides": {
94
- "vite": "7.3.6"
95
- },
96
- "engines": {
97
- "node": ">=20"
98
- }
99
- }
14
+ "docs/METRICS.md",
15
+ "examples/",
16
+ "tests/fixtures/"
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/dailephd/my-dev-kit-lab.git"
21
+ },
22
+ "homepage": "https://github.com/dailephd/my-dev-kit-lab#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/dailephd/my-dev-kit-lab/issues"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "funding": [
30
+ "https://github.com/sponsors/dailephd",
31
+ "https://paypal.me/daile88"
32
+ ],
33
+ "keywords": [
34
+ "benchmark",
35
+ "evaluation",
36
+ "reporting",
37
+ "graph-retrieval",
38
+ "codex",
39
+ "claude"
40
+ ],
41
+ "author": "Dai Le",
42
+ "license": "MIT",
43
+ "scripts": {
44
+ "build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run",
47
+ "test:benchmarks": "vitest run tests/benchmarks tests/scripts",
48
+ "test:report": "vitest run tests/report tests/commands",
49
+ "test:screenshot": "vitest run tests/screenshot",
50
+ "test:evaluation": "vitest run tests/core tests/evaluation tests/commands",
51
+ "test:gallery": "vitest run tests/gallery",
52
+ "test:demo": "vitest run tests/commands/runLabDemo.spec.ts tests/integration/runLabDemoCommand.spec.ts",
53
+ "test:integration": "vitest run tests/integration",
54
+ "test:e2e": "vitest run tests/e2e",
55
+ "test:agents": "vitest run tests/agents tests/commands/runAgentPromptCommand.spec.ts tests/integration/runAgentPromptFake.spec.ts",
56
+ "test:experiments": "vitest run tests/evaluation/buildExperimentMatrix.spec.ts tests/evaluation/classifyAgentRunOutcome.spec.ts tests/evaluation/parseAgentAnswer.spec.ts tests/evaluation/scoreCorrectness.spec.ts tests/evaluation/compareExperimentRuns.spec.ts tests/evaluation/runControlledExperiment.spec.ts tests/commands/runControlledExperimentCommand.spec.ts tests/integration/runControlledExperimentFake.spec.ts",
57
+ "capture-demo-report": "tsx scripts/capture-demo-report.ts",
58
+ "evaluate-token-savings": "tsx scripts/evaluate-token-savings.ts",
59
+ "generate-experiment-plots": "tsx scripts/generate-experiment-plots.ts",
60
+ "generate-prompt-variants": "tsx scripts/generate-prompt-variants.ts",
61
+ "build-gallery": "tsx scripts/build-gallery.ts",
62
+ "lab-demo": "tsx scripts/run-lab-demo.ts",
63
+ "render-experiment-report": "tsx scripts/render-experiment-report.ts",
64
+ "experiment:list": "tsx scripts/experiments/listExperiments.ts",
65
+ "experiment:describe": "tsx scripts/experiments/describeExperiment.ts",
66
+ "experiment:run": "tsx scripts/experiments/runExperiment.ts",
67
+ "run-final-demo": "tsx scripts/run-final-demo.ts",
68
+ "run-agent-prompt": "tsx scripts/run-agent-prompt.ts",
69
+ "run-controlled-experiment": "tsx scripts/run-controlled-experiment.ts",
70
+ "run-visualization-demos": "tsx scripts/run-visualization-demos.ts",
71
+ "test:plots": "vitest run tests/plots tests/commands/generateExperimentPlotsCommand.spec.ts",
72
+ "test:visualization-demos": "vitest run tests/visualizationDemos tests/commands/runVisualizationDemosCommand.spec.ts",
73
+ "verify:benchmarks": "tsx scripts/verify-benchmarks.ts",
74
+ "verify": "npm run build && npm run test && npm run test:benchmarks && npm run test:report && npm run test:screenshot && npm run test:evaluation && npm run test:agents && npm run test:experiments && npm run test:plots && npm run test:visualization-demos && npm run test:gallery && npm run test:demo && npm run test:integration && npm run test:e2e && npm run verify:benchmarks",
75
+ "security:deps": "tsx scripts/security/runDependencyChecks.ts",
76
+ "security:package": "tsx scripts/security/runPackageChecks.ts",
77
+ "security:codeql": "tsx scripts/security/runCodeql.ts",
78
+ "security:semgrep": "tsx scripts/security/runSemgrep.ts",
79
+ "test:security": "vitest run tests/security/",
80
+ "test:fuzz:smoke": "tsx scripts/security/runFuzzSmoke.ts",
81
+ "security:validate": "tsx scripts/security/validate.ts",
82
+ "audit": "tsx scripts/audits/runAudit.ts"
83
+ },
84
+ "devDependencies": {
85
+ "@types/node": "^24.0.0",
86
+ "playwright": "^1.54.1",
87
+ "tsx": "^4.20.3",
88
+ "typescript": "^5.8.3",
89
+ "vitest": "^3.2.4"
90
+ },
91
+ "overrides": {
92
+ "vite": "7.3.6"
93
+ },
94
+ "engines": {
95
+ "node": ">=20"
96
+ }
97
+ }