@skillsmith/core 0.1.2 → 0.2.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/dist/.tsbuildinfo +1 -1
- package/dist/src/analysis/CodebaseAnalyzer.d.ts +4 -134
- package/dist/src/analysis/CodebaseAnalyzer.d.ts.map +1 -1
- package/dist/src/analysis/CodebaseAnalyzer.js +7 -315
- package/dist/src/analysis/CodebaseAnalyzer.js.map +1 -1
- package/dist/src/analysis/framework-detector.d.ts +47 -0
- package/dist/src/analysis/framework-detector.d.ts.map +1 -0
- package/dist/src/analysis/framework-detector.js +151 -0
- package/dist/src/analysis/framework-detector.js.map +1 -0
- package/dist/src/analysis/index.d.ts +6 -1
- package/dist/src/analysis/index.d.ts.map +1 -1
- package/dist/src/analysis/index.js +10 -1
- package/dist/src/analysis/index.js.map +1 -1
- package/dist/src/analysis/parsers.d.ts +43 -0
- package/dist/src/analysis/parsers.d.ts.map +1 -0
- package/dist/src/analysis/parsers.js +219 -0
- package/dist/src/analysis/parsers.js.map +1 -0
- package/dist/src/analysis/types.d.ts +138 -0
- package/dist/src/analysis/types.d.ts.map +1 -0
- package/dist/src/analysis/types.js +25 -0
- package/dist/src/analysis/types.js.map +1 -0
- package/dist/src/analytics/AnalyticsRepository.d.ts.map +1 -1
- package/dist/src/analytics/AnalyticsRepository.js +4 -4
- package/dist/src/analytics/AnalyticsRepository.js.map +1 -1
- package/dist/src/api/cache.d.ts +108 -0
- package/dist/src/api/cache.d.ts.map +1 -0
- package/dist/src/api/cache.js +216 -0
- package/dist/src/api/cache.js.map +1 -0
- package/dist/src/api/client.d.ts +152 -0
- package/dist/src/api/client.d.ts.map +1 -0
- package/dist/src/api/client.js +221 -0
- package/dist/src/api/client.js.map +1 -0
- package/dist/src/api/index.d.ts +10 -0
- package/dist/src/api/index.d.ts.map +1 -0
- package/dist/src/api/index.js +10 -0
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/benchmarks/BenchmarkRunner.d.ts +6 -175
- package/dist/src/benchmarks/BenchmarkRunner.d.ts.map +1 -1
- package/dist/src/benchmarks/BenchmarkRunner.js +6 -123
- package/dist/src/benchmarks/BenchmarkRunner.js.map +1 -1
- package/dist/src/benchmarks/MemoryProfiler.d.ts +4 -262
- package/dist/src/benchmarks/MemoryProfiler.d.ts.map +1 -1
- package/dist/src/benchmarks/MemoryProfiler.js +4 -400
- package/dist/src/benchmarks/MemoryProfiler.js.map +1 -1
- package/dist/src/benchmarks/comparator.d.ts +38 -0
- package/dist/src/benchmarks/comparator.d.ts.map +1 -0
- package/dist/src/benchmarks/comparator.js +81 -0
- package/dist/src/benchmarks/comparator.js.map +1 -0
- package/dist/src/benchmarks/formatters.d.ts +30 -0
- package/dist/src/benchmarks/formatters.d.ts.map +1 -0
- package/dist/src/benchmarks/formatters.js +88 -0
- package/dist/src/benchmarks/formatters.js.map +1 -0
- package/dist/src/benchmarks/index.d.ts +5 -1
- package/dist/src/benchmarks/index.d.ts.map +1 -1
- package/dist/src/benchmarks/index.js +9 -2
- package/dist/src/benchmarks/index.js.map +1 -1
- package/dist/src/benchmarks/memory/MemoryProfiler.d.ts +165 -0
- package/dist/src/benchmarks/memory/MemoryProfiler.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/MemoryProfiler.js +312 -0
- package/dist/src/benchmarks/memory/MemoryProfiler.js.map +1 -0
- package/dist/src/benchmarks/memory/baseline-manager.d.ts +64 -0
- package/dist/src/benchmarks/memory/baseline-manager.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/baseline-manager.js +95 -0
- package/dist/src/benchmarks/memory/baseline-manager.js.map +1 -0
- package/dist/src/benchmarks/memory/index.d.ts +12 -0
- package/dist/src/benchmarks/memory/index.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/index.js +12 -0
- package/dist/src/benchmarks/memory/index.js.map +1 -0
- package/dist/src/benchmarks/memory/leak-detector.d.ts +23 -0
- package/dist/src/benchmarks/memory/leak-detector.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/leak-detector.js +46 -0
- package/dist/src/benchmarks/memory/leak-detector.js.map +1 -0
- package/dist/src/benchmarks/memory/regression-detector.d.ts +17 -0
- package/dist/src/benchmarks/memory/regression-detector.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/regression-detector.js +56 -0
- package/dist/src/benchmarks/memory/regression-detector.js.map +1 -0
- package/dist/src/benchmarks/memory/types.d.ts +111 -0
- package/dist/src/benchmarks/memory/types.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/types.js +7 -0
- package/dist/src/benchmarks/memory/types.js.map +1 -0
- package/dist/src/benchmarks/memory/utils.d.ts +17 -0
- package/dist/src/benchmarks/memory/utils.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/utils.js +29 -0
- package/dist/src/benchmarks/memory/utils.js.map +1 -0
- package/dist/src/benchmarks/types.d.ts +175 -0
- package/dist/src/benchmarks/types.d.ts.map +1 -0
- package/dist/src/benchmarks/types.js +20 -0
- package/dist/src/benchmarks/types.js.map +1 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/repositories/QuarantineRepository.d.ts +4 -251
- package/dist/src/repositories/QuarantineRepository.d.ts.map +1 -1
- package/dist/src/repositories/QuarantineRepository.js +4 -441
- package/dist/src/repositories/QuarantineRepository.js.map +1 -1
- package/dist/src/repositories/quarantine/QuarantineRepository.d.ts +168 -0
- package/dist/src/repositories/quarantine/QuarantineRepository.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/QuarantineRepository.js +341 -0
- package/dist/src/repositories/quarantine/QuarantineRepository.js.map +1 -0
- package/dist/src/repositories/quarantine/index.d.ts +10 -0
- package/dist/src/repositories/quarantine/index.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/index.js +10 -0
- package/dist/src/repositories/quarantine/index.js.map +1 -0
- package/dist/src/repositories/quarantine/queries.d.ts +58 -0
- package/dist/src/repositories/quarantine/queries.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/queries.js +88 -0
- package/dist/src/repositories/quarantine/queries.js.map +1 -0
- package/dist/src/repositories/quarantine/query-builder.d.ts +44 -0
- package/dist/src/repositories/quarantine/query-builder.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/query-builder.js +87 -0
- package/dist/src/repositories/quarantine/query-builder.js.map +1 -0
- package/dist/src/repositories/quarantine/types.d.ts +155 -0
- package/dist/src/repositories/quarantine/types.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/types.js +13 -0
- package/dist/src/repositories/quarantine/types.js.map +1 -0
- package/dist/src/scripts/__tests__/scan-imported-skills.test.d.ts +1 -0
- package/dist/src/scripts/__tests__/scan-imported-skills.test.d.ts.map +1 -1
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js +7 -43
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js.map +1 -1
- package/dist/src/scripts/github-import/checkpoint.d.ts +21 -0
- package/dist/src/scripts/github-import/checkpoint.d.ts.map +1 -0
- package/dist/src/scripts/github-import/checkpoint.js +52 -0
- package/dist/src/scripts/github-import/checkpoint.js.map +1 -0
- package/dist/src/scripts/github-import/deduplication.d.ts +15 -0
- package/dist/src/scripts/github-import/deduplication.d.ts.map +1 -0
- package/dist/src/scripts/github-import/deduplication.js +33 -0
- package/dist/src/scripts/github-import/deduplication.js.map +1 -0
- package/dist/src/scripts/github-import/github-client.d.ts +29 -0
- package/dist/src/scripts/github-import/github-client.d.ts.map +1 -0
- package/dist/src/scripts/github-import/github-client.js +184 -0
- package/dist/src/scripts/github-import/github-client.js.map +1 -0
- package/dist/src/scripts/github-import/index.d.ts +29 -0
- package/dist/src/scripts/github-import/index.d.ts.map +1 -0
- package/dist/src/scripts/github-import/index.js +198 -0
- package/dist/src/scripts/github-import/index.js.map +1 -0
- package/dist/src/scripts/github-import/output.d.ts +12 -0
- package/dist/src/scripts/github-import/output.d.ts.map +1 -0
- package/dist/src/scripts/github-import/output.js +34 -0
- package/dist/src/scripts/github-import/output.js.map +1 -0
- package/dist/src/scripts/github-import/types.d.ts +108 -0
- package/dist/src/scripts/github-import/types.d.ts.map +1 -0
- package/dist/src/scripts/github-import/types.js +44 -0
- package/dist/src/scripts/github-import/types.js.map +1 -0
- package/dist/src/scripts/github-import/utils.d.ts +13 -0
- package/dist/src/scripts/github-import/utils.d.ts.map +1 -0
- package/dist/src/scripts/github-import/utils.js +28 -0
- package/dist/src/scripts/github-import/utils.js.map +1 -0
- package/dist/src/scripts/import-github-skills.d.ts +3 -12
- package/dist/src/scripts/import-github-skills.d.ts.map +1 -1
- package/dist/src/scripts/import-github-skills.js +18 -398
- package/dist/src/scripts/import-github-skills.js.map +1 -1
- package/dist/src/scripts/scan-imported-skills.d.ts +7 -7
- package/dist/src/scripts/scan-imported-skills.d.ts.map +1 -1
- package/dist/src/scripts/scan-imported-skills.js +8 -397
- package/dist/src/scripts/scan-imported-skills.js.map +1 -1
- package/dist/src/scripts/skill-scanner/categorizer.d.ts +43 -0
- package/dist/src/scripts/skill-scanner/categorizer.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/categorizer.js +61 -0
- package/dist/src/scripts/skill-scanner/categorizer.js.map +1 -0
- package/dist/src/scripts/skill-scanner/file-scanner.d.ts +43 -0
- package/dist/src/scripts/skill-scanner/file-scanner.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/file-scanner.js +90 -0
- package/dist/src/scripts/skill-scanner/file-scanner.js.map +1 -0
- package/dist/src/scripts/skill-scanner/index.d.ts +22 -0
- package/dist/src/scripts/skill-scanner/index.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/index.js +43 -0
- package/dist/src/scripts/skill-scanner/index.js.map +1 -0
- package/dist/src/scripts/skill-scanner/logger.d.ts +59 -0
- package/dist/src/scripts/skill-scanner/logger.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/logger.js +104 -0
- package/dist/src/scripts/skill-scanner/logger.js.map +1 -0
- package/dist/src/scripts/skill-scanner/reporter.d.ts +56 -0
- package/dist/src/scripts/skill-scanner/reporter.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/reporter.js +166 -0
- package/dist/src/scripts/skill-scanner/reporter.js.map +1 -0
- package/dist/src/scripts/skill-scanner/scanner.d.ts +44 -0
- package/dist/src/scripts/skill-scanner/scanner.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/scanner.js +140 -0
- package/dist/src/scripts/skill-scanner/scanner.js.map +1 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.d.ts +59 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.js +62 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.js.map +1 -0
- package/dist/src/scripts/skill-scanner/types.d.ts +98 -0
- package/dist/src/scripts/skill-scanner/types.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/types.js +7 -0
- package/dist/src/scripts/skill-scanner/types.js.map +1 -0
- package/dist/src/scripts/validate-skills.d.ts +3 -172
- package/dist/src/scripts/validate-skills.d.ts.map +1 -1
- package/dist/src/scripts/validate-skills.js +6 -519
- package/dist/src/scripts/validate-skills.js.map +1 -1
- package/dist/src/scripts/validation/deduplication.d.ts +23 -0
- package/dist/src/scripts/validation/deduplication.d.ts.map +1 -0
- package/dist/src/scripts/validation/deduplication.js +127 -0
- package/dist/src/scripts/validation/deduplication.js.map +1 -0
- package/dist/src/scripts/validation/field-validators.d.ts +9 -0
- package/dist/src/scripts/validation/field-validators.d.ts.map +1 -0
- package/dist/src/scripts/validation/field-validators.js +135 -0
- package/dist/src/scripts/validation/field-validators.js.map +1 -0
- package/dist/src/scripts/validation/index.d.ts +29 -0
- package/dist/src/scripts/validation/index.d.ts.map +1 -0
- package/dist/src/scripts/validation/index.js +84 -0
- package/dist/src/scripts/validation/index.js.map +1 -0
- package/dist/src/scripts/validation/normalizers.d.ts +29 -0
- package/dist/src/scripts/validation/normalizers.d.ts.map +1 -0
- package/dist/src/scripts/validation/normalizers.js +79 -0
- package/dist/src/scripts/validation/normalizers.js.map +1 -0
- package/dist/src/scripts/validation/pipeline.d.ts +13 -0
- package/dist/src/scripts/validation/pipeline.d.ts.map +1 -0
- package/dist/src/scripts/validation/pipeline.js +126 -0
- package/dist/src/scripts/validation/pipeline.js.map +1 -0
- package/dist/src/scripts/validation/types.d.ts +128 -0
- package/dist/src/scripts/validation/types.d.ts.map +1 -0
- package/dist/src/scripts/validation/types.js +43 -0
- package/dist/src/scripts/validation/types.js.map +1 -0
- package/dist/src/security/index.d.ts +5 -4
- package/dist/src/security/index.d.ts.map +1 -1
- package/dist/src/security/index.js +8 -2
- package/dist/src/security/index.js.map +1 -1
- package/dist/src/security/rate-limiter/RateLimiter.d.ts +86 -0
- package/dist/src/security/rate-limiter/RateLimiter.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/RateLimiter.js +260 -0
- package/dist/src/security/rate-limiter/RateLimiter.js.map +1 -0
- package/dist/src/security/rate-limiter/constants.d.ts +15 -0
- package/dist/src/security/rate-limiter/constants.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/constants.js +15 -0
- package/dist/src/security/rate-limiter/constants.js.map +1 -0
- package/dist/src/security/rate-limiter/errors.d.ts +22 -0
- package/dist/src/security/rate-limiter/errors.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/errors.js +32 -0
- package/dist/src/security/rate-limiter/errors.js.map +1 -0
- package/dist/src/security/rate-limiter/index.d.ts +12 -0
- package/dist/src/security/rate-limiter/index.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/index.js +16 -0
- package/dist/src/security/rate-limiter/index.js.map +1 -0
- package/dist/src/security/rate-limiter/metrics-manager.d.ts +55 -0
- package/dist/src/security/rate-limiter/metrics-manager.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/metrics-manager.js +144 -0
- package/dist/src/security/rate-limiter/metrics-manager.js.map +1 -0
- package/dist/src/security/rate-limiter/presets.d.ts +52 -0
- package/dist/src/security/rate-limiter/presets.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/presets.js +53 -0
- package/dist/src/security/rate-limiter/presets.js.map +1 -0
- package/dist/src/security/rate-limiter/queue-manager.d.ts +59 -0
- package/dist/src/security/rate-limiter/queue-manager.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/queue-manager.js +189 -0
- package/dist/src/security/rate-limiter/queue-manager.js.map +1 -0
- package/dist/src/security/rate-limiter/storage.d.ts +34 -0
- package/dist/src/security/rate-limiter/storage.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/storage.js +80 -0
- package/dist/src/security/rate-limiter/storage.js.map +1 -0
- package/dist/src/security/rate-limiter/token-bucket.d.ts +44 -0
- package/dist/src/security/rate-limiter/token-bucket.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/token-bucket.js +99 -0
- package/dist/src/security/rate-limiter/token-bucket.js.map +1 -0
- package/dist/src/security/rate-limiter/types.d.ts +104 -0
- package/dist/src/security/rate-limiter/types.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/types.js +7 -0
- package/dist/src/security/rate-limiter/types.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts +94 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.js +403 -0
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -0
- package/dist/src/security/scanner/index.d.ts +11 -0
- package/dist/src/security/scanner/index.d.ts.map +1 -0
- package/dist/src/security/scanner/index.js +14 -0
- package/dist/src/security/scanner/index.js.map +1 -0
- package/dist/src/security/scanner/patterns.d.ts +14 -0
- package/dist/src/security/scanner/patterns.d.ts.map +1 -0
- package/dist/src/security/scanner/patterns.js +147 -0
- package/dist/src/security/scanner/patterns.js.map +1 -0
- package/dist/src/security/scanner/regex-utils.d.ts +33 -0
- package/dist/src/security/scanner/regex-utils.d.ts.map +1 -0
- package/dist/src/security/scanner/regex-utils.js +41 -0
- package/dist/src/security/scanner/regex-utils.js.map +1 -0
- package/dist/src/security/scanner/types.d.ts +63 -0
- package/dist/src/security/scanner/types.d.ts.map +1 -0
- package/dist/src/security/scanner/types.js +7 -0
- package/dist/src/security/scanner/types.js.map +1 -0
- package/dist/src/security/scanner/weights.d.ts +15 -0
- package/dist/src/security/scanner/weights.d.ts.map +1 -0
- package/dist/src/security/scanner/weights.js +28 -0
- package/dist/src/security/scanner/weights.js.map +1 -0
- package/dist/src/session/SessionHealthMonitor.d.ts +5 -168
- package/dist/src/session/SessionHealthMonitor.d.ts.map +1 -1
- package/dist/src/session/SessionHealthMonitor.js +22 -91
- package/dist/src/session/SessionHealthMonitor.js.map +1 -1
- package/dist/src/session/health-checks.d.ts +37 -0
- package/dist/src/session/health-checks.d.ts.map +1 -0
- package/dist/src/session/health-checks.js +64 -0
- package/dist/src/session/health-checks.js.map +1 -0
- package/dist/src/session/health-types.d.ts +78 -0
- package/dist/src/session/health-types.d.ts.map +1 -0
- package/dist/src/session/health-types.js +16 -0
- package/dist/src/session/health-types.js.map +1 -0
- package/dist/src/session/index.d.ts +5 -1
- package/dist/src/session/index.d.ts.map +1 -1
- package/dist/src/session/index.js +9 -0
- package/dist/src/session/index.js.map +1 -1
- package/dist/src/session/metrics-collector.d.ts +23 -0
- package/dist/src/session/metrics-collector.d.ts.map +1 -0
- package/dist/src/session/metrics-collector.js +44 -0
- package/dist/src/session/metrics-collector.js.map +1 -0
- package/dist/src/session/typed-event-emitter.d.ts +70 -0
- package/dist/src/session/typed-event-emitter.d.ts.map +1 -0
- package/dist/src/session/typed-event-emitter.js +79 -0
- package/dist/src/session/typed-event-emitter.js.map +1 -0
- package/dist/src/sources/BaseSourceAdapter.d.ts +1 -1
- package/dist/src/sources/BaseSourceAdapter.d.ts.map +1 -1
- package/dist/src/sources/BaseSourceAdapter.js +2 -2
- package/dist/src/sources/BaseSourceAdapter.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +1 -0
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +2 -0
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/posthog.d.ts +125 -0
- package/dist/src/telemetry/posthog.d.ts.map +1 -0
- package/dist/src/telemetry/posthog.js +198 -0
- package/dist/src/telemetry/posthog.js.map +1 -0
- package/dist/tests/RateLimiter.test.js +4 -4
- package/dist/tests/RateLimiter.test.js.map +1 -1
- package/dist/tests/e2e/security/security.e2e.test.js +3 -3
- package/dist/tests/e2e/security/security.e2e.test.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1189: File Scanner
|
|
3
|
+
*
|
|
4
|
+
* File system scanning and content extraction.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs/promises';
|
|
7
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
8
|
+
/**
|
|
9
|
+
* Extracts scannable content from an imported skill
|
|
10
|
+
* Combines all text fields that should be scanned
|
|
11
|
+
*
|
|
12
|
+
* @param skill - The imported skill to extract content from
|
|
13
|
+
* @returns Combined text content for scanning
|
|
14
|
+
*/
|
|
15
|
+
export function extractScannableContent(skill) {
|
|
16
|
+
const parts = [];
|
|
17
|
+
if (skill.name)
|
|
18
|
+
parts.push(`# ${skill.name}`);
|
|
19
|
+
if (skill.description)
|
|
20
|
+
parts.push(skill.description);
|
|
21
|
+
if (skill.content)
|
|
22
|
+
parts.push(skill.content);
|
|
23
|
+
if (skill.instructions)
|
|
24
|
+
parts.push(skill.instructions);
|
|
25
|
+
if (skill.trigger)
|
|
26
|
+
parts.push(skill.trigger);
|
|
27
|
+
if (skill.tags?.length)
|
|
28
|
+
parts.push(`Tags: ${skill.tags.join(', ')}`);
|
|
29
|
+
// Include metadata if present
|
|
30
|
+
if (skill.metadata) {
|
|
31
|
+
try {
|
|
32
|
+
parts.push(JSON.stringify(skill.metadata));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Ignore serialization errors
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return parts.join('\n\n');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Read and parse imported skills from a JSON file
|
|
42
|
+
*
|
|
43
|
+
* @param inputPath - Path to the imported skills JSON file
|
|
44
|
+
* @returns Array of imported skills
|
|
45
|
+
* @throws Error if file cannot be read or parsed
|
|
46
|
+
*/
|
|
47
|
+
export async function readImportedSkills(inputPath) {
|
|
48
|
+
const content = await fs.readFile(inputPath, 'utf-8');
|
|
49
|
+
const parsed = JSON.parse(content);
|
|
50
|
+
// Handle both array format and object with skills property
|
|
51
|
+
if (Array.isArray(parsed)) {
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
if (typeof parsed === 'object' &&
|
|
55
|
+
parsed !== null &&
|
|
56
|
+
'skills' in parsed &&
|
|
57
|
+
Array.isArray(parsed.skills)) {
|
|
58
|
+
return parsed.skills;
|
|
59
|
+
}
|
|
60
|
+
throw new Error('Invalid format: expected array or object with skills array');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Ensure a directory exists, creating it if necessary
|
|
64
|
+
*
|
|
65
|
+
* @param dirPath - Path to the directory
|
|
66
|
+
*/
|
|
67
|
+
export function ensureDirectoryExists(dirPath) {
|
|
68
|
+
if (!existsSync(dirPath)) {
|
|
69
|
+
mkdirSync(dirPath, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if a file exists
|
|
74
|
+
*
|
|
75
|
+
* @param filePath - Path to the file
|
|
76
|
+
* @returns true if file exists
|
|
77
|
+
*/
|
|
78
|
+
export function fileExists(filePath) {
|
|
79
|
+
return existsSync(filePath);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Write JSON data to a file
|
|
83
|
+
*
|
|
84
|
+
* @param filePath - Path to the output file
|
|
85
|
+
* @param data - Data to write
|
|
86
|
+
*/
|
|
87
|
+
export async function writeJsonFile(filePath, data) {
|
|
88
|
+
await fs.writeFile(filePath, JSON.stringify(data, null, 2));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=file-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-scanner.js","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/file-scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAG1C;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAoB;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,IAAI,KAAK,CAAC,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC7C,IAAI,KAAK,CAAC,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACpD,IAAI,KAAK,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5C,IAAI,KAAK,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IACtD,IAAI,KAAK,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5C,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEpE,8BAA8B;IAC9B,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,8BAA8B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@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-864: Security Scanner for Imported Skills
|
|
3
|
+
* SMI-1189: Refactored into modular structure
|
|
4
|
+
*
|
|
5
|
+
* Scans all skills from imported-skills.json for security vulnerabilities
|
|
6
|
+
* and categorizes them by severity level.
|
|
7
|
+
*
|
|
8
|
+
* Usage: npx tsx packages/core/src/scripts/skill-scanner/index.ts [path-to-imported-skills.json]
|
|
9
|
+
*
|
|
10
|
+
* Output Files:
|
|
11
|
+
* - data/security-report.json: Full security report with all findings
|
|
12
|
+
* - data/quarantine-skills.json: Skills with HIGH/CRITICAL findings (blocked)
|
|
13
|
+
* - data/safe-skills.json: Skills approved for import (passed security scan)
|
|
14
|
+
*/
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export * from './categorizer.js';
|
|
17
|
+
export * from './trust-scorer.js';
|
|
18
|
+
export * from './file-scanner.js';
|
|
19
|
+
export * from './logger.js';
|
|
20
|
+
export * from './reporter.js';
|
|
21
|
+
export { scanImportedSkills, DEFAULT_CONFIG } from './scanner.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-864: Security Scanner for Imported Skills
|
|
3
|
+
* SMI-1189: Refactored into modular structure
|
|
4
|
+
*
|
|
5
|
+
* Scans all skills from imported-skills.json for security vulnerabilities
|
|
6
|
+
* and categorizes them by severity level.
|
|
7
|
+
*
|
|
8
|
+
* Usage: npx tsx packages/core/src/scripts/skill-scanner/index.ts [path-to-imported-skills.json]
|
|
9
|
+
*
|
|
10
|
+
* Output Files:
|
|
11
|
+
* - data/security-report.json: Full security report with all findings
|
|
12
|
+
* - data/quarantine-skills.json: Skills with HIGH/CRITICAL findings (blocked)
|
|
13
|
+
* - data/safe-skills.json: Skills approved for import (passed security scan)
|
|
14
|
+
*/
|
|
15
|
+
import { scanImportedSkills, DEFAULT_CONFIG } from './scanner.js';
|
|
16
|
+
// Re-export all public types and functions
|
|
17
|
+
export * from './types.js';
|
|
18
|
+
export * from './categorizer.js';
|
|
19
|
+
export * from './trust-scorer.js';
|
|
20
|
+
export * from './file-scanner.js';
|
|
21
|
+
export * from './logger.js';
|
|
22
|
+
export * from './reporter.js';
|
|
23
|
+
export { scanImportedSkills, DEFAULT_CONFIG } from './scanner.js';
|
|
24
|
+
/**
|
|
25
|
+
* CLI entry point
|
|
26
|
+
*/
|
|
27
|
+
async function main() {
|
|
28
|
+
// Get input file from command line args or use default
|
|
29
|
+
const inputPath = process.argv[2] || DEFAULT_CONFIG.defaultInput;
|
|
30
|
+
try {
|
|
31
|
+
await scanImportedSkills(inputPath);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error('Fatal error:', error.message);
|
|
35
|
+
console.error(error.stack);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
main().catch((error) => {
|
|
40
|
+
console.error('Unhandled error:', error);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEjE,2CAA2C;AAC3C,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEjE;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,uDAAuD;IACvD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,YAAY,CAAA;IAEhE,IAAI,CAAC;QACH,MAAM,kBAAkB,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAG,KAAe,CAAC,OAAO,CAAC,CAAA;QACvD,OAAO,CAAC,KAAK,CAAE,KAAe,CAAC,KAAK,CAAC,CAAA;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1189: Logger
|
|
3
|
+
*
|
|
4
|
+
* Logging utilities for the security scanner.
|
|
5
|
+
*/
|
|
6
|
+
import type { SecurityFinding } from '../../security/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Formats a duration in milliseconds to human-readable string
|
|
9
|
+
*
|
|
10
|
+
* @param ms - Duration in milliseconds
|
|
11
|
+
* @returns Formatted duration string
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatDuration(ms: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Log a section header
|
|
16
|
+
*
|
|
17
|
+
* @param title - Header title
|
|
18
|
+
*/
|
|
19
|
+
export declare function logHeader(title: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Log a security finding
|
|
22
|
+
*
|
|
23
|
+
* @param finding - The security finding to log
|
|
24
|
+
* @param skillId - The skill ID associated with the finding
|
|
25
|
+
*/
|
|
26
|
+
export declare function logFinding(finding: SecurityFinding, skillId: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Log a list of findings with truncation
|
|
29
|
+
*
|
|
30
|
+
* @param findings - Array of findings with skill context
|
|
31
|
+
* @param maxDisplay - Maximum number of findings to display
|
|
32
|
+
* @param title - Section title
|
|
33
|
+
*/
|
|
34
|
+
export declare function logFindings(findings: Array<SecurityFinding & {
|
|
35
|
+
skillId: string;
|
|
36
|
+
}>, maxDisplay: number, title: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Log progress update
|
|
39
|
+
*
|
|
40
|
+
* @param processed - Number of items processed
|
|
41
|
+
* @param total - Total number of items
|
|
42
|
+
*/
|
|
43
|
+
export declare function logProgress(processed: number, total: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Log completion message
|
|
46
|
+
*
|
|
47
|
+
* @param processed - Number of items processed
|
|
48
|
+
* @param total - Total number of items
|
|
49
|
+
*/
|
|
50
|
+
export declare function logCompletion(processed: number, total: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Log file output success
|
|
53
|
+
*
|
|
54
|
+
* @param filename - Name of the file
|
|
55
|
+
* @param count - Number of items in the file
|
|
56
|
+
* @param description - Optional description of the file
|
|
57
|
+
*/
|
|
58
|
+
export declare function logFileOutput(filename: string, count: number, description?: string): void;
|
|
59
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,yBAAyB,CAAA;AAYhF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAK7C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAW1E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,KAAK,CAAC,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,IAAI,CAUN;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAGzF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1189: Logger
|
|
3
|
+
*
|
|
4
|
+
* Logging utilities for the security scanner.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Severity icons for console output
|
|
8
|
+
*/
|
|
9
|
+
const SEVERITY_ICONS = {
|
|
10
|
+
critical: '[CRITICAL]',
|
|
11
|
+
high: '[HIGH] ',
|
|
12
|
+
medium: '[MEDIUM] ',
|
|
13
|
+
low: '[LOW] ',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Formats a duration in milliseconds to human-readable string
|
|
17
|
+
*
|
|
18
|
+
* @param ms - Duration in milliseconds
|
|
19
|
+
* @returns Formatted duration string
|
|
20
|
+
*/
|
|
21
|
+
export function formatDuration(ms) {
|
|
22
|
+
if (ms < 1000)
|
|
23
|
+
return `${ms.toFixed(0)}ms`;
|
|
24
|
+
if (ms < 60000)
|
|
25
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
26
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Log a section header
|
|
30
|
+
*
|
|
31
|
+
* @param title - Header title
|
|
32
|
+
*/
|
|
33
|
+
export function logHeader(title) {
|
|
34
|
+
const border = '='.repeat(60);
|
|
35
|
+
console.log(`\n${border}`);
|
|
36
|
+
console.log(` ${title}`);
|
|
37
|
+
console.log(`${border}\n`);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Log a security finding
|
|
41
|
+
*
|
|
42
|
+
* @param finding - The security finding to log
|
|
43
|
+
* @param skillId - The skill ID associated with the finding
|
|
44
|
+
*/
|
|
45
|
+
export function logFinding(finding, skillId) {
|
|
46
|
+
console.log(` ${SEVERITY_ICONS[finding.severity]} ${finding.type}`);
|
|
47
|
+
console.log(` Skill: ${skillId}`);
|
|
48
|
+
console.log(` ${finding.message}`);
|
|
49
|
+
if (finding.lineNumber) {
|
|
50
|
+
console.log(` Line: ${finding.lineNumber}`);
|
|
51
|
+
}
|
|
52
|
+
if (finding.location) {
|
|
53
|
+
console.log(` Location: ${finding.location.slice(0, 80)}...`);
|
|
54
|
+
}
|
|
55
|
+
console.log();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Log a list of findings with truncation
|
|
59
|
+
*
|
|
60
|
+
* @param findings - Array of findings with skill context
|
|
61
|
+
* @param maxDisplay - Maximum number of findings to display
|
|
62
|
+
* @param title - Section title
|
|
63
|
+
*/
|
|
64
|
+
export function logFindings(findings, maxDisplay, title) {
|
|
65
|
+
if (findings.length === 0)
|
|
66
|
+
return;
|
|
67
|
+
logHeader(title);
|
|
68
|
+
for (const finding of findings.slice(0, maxDisplay)) {
|
|
69
|
+
logFinding(finding, finding.skillId);
|
|
70
|
+
}
|
|
71
|
+
if (findings.length > maxDisplay) {
|
|
72
|
+
console.log(` ... and ${findings.length - maxDisplay} more findings\n`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Log progress update
|
|
77
|
+
*
|
|
78
|
+
* @param processed - Number of items processed
|
|
79
|
+
* @param total - Total number of items
|
|
80
|
+
*/
|
|
81
|
+
export function logProgress(processed, total) {
|
|
82
|
+
console.log(` Processed ${processed}/${total} skills...`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Log completion message
|
|
86
|
+
*
|
|
87
|
+
* @param processed - Number of items processed
|
|
88
|
+
* @param total - Total number of items
|
|
89
|
+
*/
|
|
90
|
+
export function logCompletion(processed, total) {
|
|
91
|
+
console.log(` Completed: ${processed}/${total} skills\n`);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Log file output success
|
|
95
|
+
*
|
|
96
|
+
* @param filename - Name of the file
|
|
97
|
+
* @param count - Number of items in the file
|
|
98
|
+
* @param description - Optional description of the file
|
|
99
|
+
*/
|
|
100
|
+
export function logFileOutput(filename, count, description) {
|
|
101
|
+
const desc = description ? ` ${description}` : '';
|
|
102
|
+
console.log(` [OK] ${filename} (${count} skills${desc})`);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,cAAc,GAAqC;IACvD,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,GAAG,EAAE,YAAY;CAClB,CAAA;AAED;;;;;GAKG;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SMI-1189: Reporter
|
|
3
|
+
*
|
|
4
|
+
* Report generation and summary output.
|
|
5
|
+
*/
|
|
6
|
+
import type { SecuritySeverity } from '../../security/index.js';
|
|
7
|
+
import type { SkillScanResult, SecurityReportOutput, QuarantineOutput, SafeSkillsOutput, FindingWithContext } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Log summary statistics to console
|
|
10
|
+
*
|
|
11
|
+
* @param results - Array of scan results
|
|
12
|
+
*/
|
|
13
|
+
export declare function logSummary(results: SkillScanResult[]): void;
|
|
14
|
+
/**
|
|
15
|
+
* Calculate top findings by type
|
|
16
|
+
*
|
|
17
|
+
* @param findings - Array of findings with context
|
|
18
|
+
* @param limit - Maximum number of top findings to return
|
|
19
|
+
* @returns Array of top findings with counts
|
|
20
|
+
*/
|
|
21
|
+
export declare function calculateTopFindings(findings: FindingWithContext[], limit?: number): Array<{
|
|
22
|
+
type: string;
|
|
23
|
+
count: number;
|
|
24
|
+
severity: SecuritySeverity;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Generate the full security report
|
|
28
|
+
*
|
|
29
|
+
* @param results - Array of scan results
|
|
30
|
+
* @param findings - Array of findings with context
|
|
31
|
+
* @param inputPath - Path to the input file
|
|
32
|
+
* @returns SecurityReportOutput object
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateSecurityReport(results: SkillScanResult[], findings: FindingWithContext[], inputPath: string): SecurityReportOutput;
|
|
35
|
+
/**
|
|
36
|
+
* Generate the quarantine output
|
|
37
|
+
*
|
|
38
|
+
* @param results - Array of quarantined scan results
|
|
39
|
+
* @returns QuarantineOutput object
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateQuarantineOutput(results: SkillScanResult[]): QuarantineOutput;
|
|
42
|
+
/**
|
|
43
|
+
* Generate the safe skills output
|
|
44
|
+
*
|
|
45
|
+
* @param results - Array of scan results
|
|
46
|
+
* @returns SafeSkillsOutput object
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateSafeSkillsOutput(results: SkillScanResult[]): SafeSkillsOutput;
|
|
49
|
+
/**
|
|
50
|
+
* Log recommendations based on scan results
|
|
51
|
+
*
|
|
52
|
+
* @param results - Array of scan results
|
|
53
|
+
* @param criticalCount - Number of critical findings
|
|
54
|
+
*/
|
|
55
|
+
export declare function logRecommendations(results: SkillScanResult[], criticalCount: number): void;
|
|
56
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAQnB;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI,CAyB3D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,KAAK,GAAE,MAAW,GACjB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC,CA0BpE;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,EAAE,EAC1B,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,SAAS,EAAE,MAAM,GAChB,oBAAoB,CAsBtB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,eAAe,EAAE,GACzB,gBAAgB,CAmBlB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,eAAe,EAAE,GACzB,gBAAgB,CAclB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EAAE,EAC1B,aAAa,EAAE,MAAM,GACpB,IAAI,CAkBN"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1189: Reporter
|
|
3
|
+
*
|
|
4
|
+
* Report generation and summary output.
|
|
5
|
+
*/
|
|
6
|
+
import { countBySeverity } from './categorizer.js';
|
|
7
|
+
import { calculateAverageRiskScore, calculateMaxRiskScore, getPassFailStats, } from './trust-scorer.js';
|
|
8
|
+
/**
|
|
9
|
+
* Log summary statistics to console
|
|
10
|
+
*
|
|
11
|
+
* @param results - Array of scan results
|
|
12
|
+
*/
|
|
13
|
+
export function logSummary(results) {
|
|
14
|
+
const total = results.length;
|
|
15
|
+
const { passed, quarantined } = getPassFailStats(results);
|
|
16
|
+
const bySeverity = countBySeverity(results);
|
|
17
|
+
const avgRiskScore = calculateAverageRiskScore(results);
|
|
18
|
+
const maxRiskScore = calculateMaxRiskScore(results);
|
|
19
|
+
console.log('\n' + '='.repeat(60));
|
|
20
|
+
console.log(' SCAN SUMMARY');
|
|
21
|
+
console.log('='.repeat(60));
|
|
22
|
+
console.log(` Total Skills Scanned: ${total}`);
|
|
23
|
+
console.log(` Passed (Safe): ${passed} (${((passed / total) * 100).toFixed(1)}%)`);
|
|
24
|
+
console.log(` Quarantined: ${quarantined} (${((quarantined / total) * 100).toFixed(1)}%)`);
|
|
25
|
+
console.log();
|
|
26
|
+
console.log(' By Severity:');
|
|
27
|
+
console.log(` CRITICAL: ${bySeverity.CRITICAL}`);
|
|
28
|
+
console.log(` HIGH: ${bySeverity.HIGH}`);
|
|
29
|
+
console.log(` MEDIUM: ${bySeverity.MEDIUM}`);
|
|
30
|
+
console.log(` LOW: ${bySeverity.LOW}`);
|
|
31
|
+
console.log();
|
|
32
|
+
console.log(` Average Risk Score: ${avgRiskScore.toFixed(1)}`);
|
|
33
|
+
console.log(` Maximum Risk Score: ${maxRiskScore}`);
|
|
34
|
+
console.log('='.repeat(60) + '\n');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Calculate top findings by type
|
|
38
|
+
*
|
|
39
|
+
* @param findings - Array of findings with context
|
|
40
|
+
* @param limit - Maximum number of top findings to return
|
|
41
|
+
* @returns Array of top findings with counts
|
|
42
|
+
*/
|
|
43
|
+
export function calculateTopFindings(findings, limit = 10) {
|
|
44
|
+
const findingCounts = new Map();
|
|
45
|
+
for (const finding of findings) {
|
|
46
|
+
const existing = findingCounts.get(finding.type);
|
|
47
|
+
if (existing) {
|
|
48
|
+
existing.count++;
|
|
49
|
+
// Keep the highest severity seen for this type
|
|
50
|
+
if (finding.severity === 'critical' ||
|
|
51
|
+
(finding.severity === 'high' && existing.severity !== 'critical') ||
|
|
52
|
+
(finding.severity === 'medium' &&
|
|
53
|
+
existing.severity !== 'critical' &&
|
|
54
|
+
existing.severity !== 'high')) {
|
|
55
|
+
existing.severity = finding.severity;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
findingCounts.set(finding.type, { count: 1, severity: finding.severity });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return Array.from(findingCounts.entries())
|
|
63
|
+
.map(([type, data]) => ({ type, count: data.count, severity: data.severity }))
|
|
64
|
+
.sort((a, b) => b.count - a.count)
|
|
65
|
+
.slice(0, limit);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Generate the full security report
|
|
69
|
+
*
|
|
70
|
+
* @param results - Array of scan results
|
|
71
|
+
* @param findings - Array of findings with context
|
|
72
|
+
* @param inputPath - Path to the input file
|
|
73
|
+
* @returns SecurityReportOutput object
|
|
74
|
+
*/
|
|
75
|
+
export function generateSecurityReport(results, findings, inputPath) {
|
|
76
|
+
const total = results.length;
|
|
77
|
+
const { passed, quarantined } = getPassFailStats(results);
|
|
78
|
+
const bySeverity = countBySeverity(results);
|
|
79
|
+
const avgRiskScore = calculateAverageRiskScore(results);
|
|
80
|
+
const maxRiskScore = calculateMaxRiskScore(results);
|
|
81
|
+
const topFindings = calculateTopFindings(findings);
|
|
82
|
+
return {
|
|
83
|
+
scanDate: new Date().toISOString(),
|
|
84
|
+
inputFile: inputPath,
|
|
85
|
+
summary: {
|
|
86
|
+
totalScanned: total,
|
|
87
|
+
passed,
|
|
88
|
+
quarantined,
|
|
89
|
+
bySeverity,
|
|
90
|
+
averageRiskScore: Math.round(avgRiskScore * 100) / 100,
|
|
91
|
+
maxRiskScore,
|
|
92
|
+
},
|
|
93
|
+
results,
|
|
94
|
+
topFindings,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Generate the quarantine output
|
|
99
|
+
*
|
|
100
|
+
* @param results - Array of quarantined scan results
|
|
101
|
+
* @returns QuarantineOutput object
|
|
102
|
+
*/
|
|
103
|
+
export function generateQuarantineOutput(results) {
|
|
104
|
+
const quarantinedSkills = results.filter((r) => r.isQuarantined);
|
|
105
|
+
return {
|
|
106
|
+
generatedAt: new Date().toISOString(),
|
|
107
|
+
reason: 'Skills with HIGH or CRITICAL security findings, or risk score >= 40',
|
|
108
|
+
count: quarantinedSkills.length,
|
|
109
|
+
skills: quarantinedSkills.map((r) => ({
|
|
110
|
+
skillId: r.skillId,
|
|
111
|
+
skillName: r.skillName,
|
|
112
|
+
author: r.author,
|
|
113
|
+
riskScore: r.scanReport.riskScore,
|
|
114
|
+
severityCategory: r.severityCategory,
|
|
115
|
+
topFindings: r.scanReport.findings
|
|
116
|
+
.filter((f) => f.severity === 'critical' || f.severity === 'high')
|
|
117
|
+
.slice(0, 5)
|
|
118
|
+
.map((f) => `${f.type}: ${f.message}`),
|
|
119
|
+
})),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Generate the safe skills output
|
|
124
|
+
*
|
|
125
|
+
* @param results - Array of scan results
|
|
126
|
+
* @returns SafeSkillsOutput object
|
|
127
|
+
*/
|
|
128
|
+
export function generateSafeSkillsOutput(results) {
|
|
129
|
+
const safeSkills = results.filter((r) => !r.isQuarantined);
|
|
130
|
+
return {
|
|
131
|
+
generatedAt: new Date().toISOString(),
|
|
132
|
+
count: safeSkills.length,
|
|
133
|
+
skills: safeSkills.map((r) => ({
|
|
134
|
+
skillId: r.skillId,
|
|
135
|
+
skillName: r.skillName,
|
|
136
|
+
author: r.author,
|
|
137
|
+
source: r.source,
|
|
138
|
+
riskScore: r.scanReport.riskScore,
|
|
139
|
+
})),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Log recommendations based on scan results
|
|
144
|
+
*
|
|
145
|
+
* @param results - Array of scan results
|
|
146
|
+
* @param criticalCount - Number of critical findings
|
|
147
|
+
*/
|
|
148
|
+
export function logRecommendations(results, criticalCount) {
|
|
149
|
+
const { passed, quarantined } = getPassFailStats(results);
|
|
150
|
+
console.log('RECOMMENDATIONS:');
|
|
151
|
+
if (quarantined > 0) {
|
|
152
|
+
console.log(` - ${quarantined} skills have been quarantined`);
|
|
153
|
+
console.log(' - Review quarantine-skills.json for manual triage');
|
|
154
|
+
console.log(' - Critical/high findings require security review before import');
|
|
155
|
+
}
|
|
156
|
+
if (criticalCount > 0) {
|
|
157
|
+
console.log(` - ${criticalCount} CRITICAL findings detected`);
|
|
158
|
+
console.log(' - These skills should NOT be imported without thorough review');
|
|
159
|
+
}
|
|
160
|
+
if (passed > 0) {
|
|
161
|
+
console.log(` - ${passed} skills passed security checks`);
|
|
162
|
+
console.log(' - These are ready for import from safe-skills.json');
|
|
163
|
+
}
|
|
164
|
+
console.log();
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,yBAAyB,E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
5
|
+
*/
|
|
6
|
+
import { SecurityScanner } from '../../security/index.js';
|
|
7
|
+
import type { ImportedSkill, SkillScanResult } from './types.js';
|
|
8
|
+
import { type TrustScorerConfig } from './trust-scorer.js';
|
|
9
|
+
/**
|
|
10
|
+
* Scanner configuration
|
|
11
|
+
*/
|
|
12
|
+
export interface ScannerConfig {
|
|
13
|
+
/** Default input file path */
|
|
14
|
+
defaultInput: string;
|
|
15
|
+
/** Output directory for reports */
|
|
16
|
+
outputDir: string;
|
|
17
|
+
/** Scanner options */
|
|
18
|
+
scannerOptions: {
|
|
19
|
+
riskThreshold: number;
|
|
20
|
+
};
|
|
21
|
+
/** Trust scorer config */
|
|
22
|
+
trustConfig: TrustScorerConfig;
|
|
23
|
+
/** Progress logging interval */
|
|
24
|
+
progressInterval: number;
|
|
25
|
+
}
|
|
26
|
+
/** Default scanner configuration */
|
|
27
|
+
export declare const DEFAULT_CONFIG: ScannerConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Scan a single skill and return the result
|
|
30
|
+
*
|
|
31
|
+
* @param skill - The skill to scan
|
|
32
|
+
* @param scanner - The security scanner instance
|
|
33
|
+
* @param config - Trust scorer configuration
|
|
34
|
+
* @returns The scan result
|
|
35
|
+
*/
|
|
36
|
+
export declare function scanSkill(skill: ImportedSkill, scanner: SecurityScanner, config?: TrustScorerConfig): SkillScanResult;
|
|
37
|
+
/**
|
|
38
|
+
* Scan all imported skills
|
|
39
|
+
*
|
|
40
|
+
* @param inputPath - Path to the imported skills JSON file
|
|
41
|
+
* @param config - Scanner configuration
|
|
42
|
+
*/
|
|
43
|
+
export declare function scanImportedSkills(inputPath: string, config?: ScannerConfig): Promise<void>;
|
|
44
|
+
//# sourceMappingURL=scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../../src/scripts/skill-scanner/scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAEhB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAoB,KAAK,iBAAiB,EAAwB,MAAM,mBAAmB,CAAA;AAyBlG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,sBAAsB;IACtB,cAAc,EAAE;QACd,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,0BAA0B;IAC1B,WAAW,EAAE,iBAAiB,CAAA;IAC9B,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,oCAAoC;AACpC,eAAO,MAAM,cAAc,EAAE,aAQ5B,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,eAAe,EACxB,MAAM,GAAE,iBAAwC,GAC/C,eAAe,CAgBjB;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,aAA8B,GACrC,OAAO,CAAC,IAAI,CAAC,CAgHf"}
|