@skillsmith/core 0.1.1 → 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 +5 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -4
- 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,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-600: Framework Detection
|
|
3
|
+
* SMI-1189: Extracted from CodebaseAnalyzer.ts
|
|
4
|
+
*
|
|
5
|
+
* Detects frameworks and libraries used in a codebase
|
|
6
|
+
* based on imports and dependencies.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Built-in framework detection rules
|
|
10
|
+
*/
|
|
11
|
+
export const FRAMEWORK_RULES = [
|
|
12
|
+
{
|
|
13
|
+
name: 'React',
|
|
14
|
+
depIndicators: ['react', 'react-dom'],
|
|
15
|
+
importIndicators: ['react', 'react-dom'],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'Next.js',
|
|
19
|
+
depIndicators: ['next'],
|
|
20
|
+
importIndicators: ['next', 'next/router', 'next/link', 'next/image'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Vue',
|
|
24
|
+
depIndicators: ['vue'],
|
|
25
|
+
importIndicators: ['vue'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Nuxt',
|
|
29
|
+
depIndicators: ['nuxt'],
|
|
30
|
+
importIndicators: ['nuxt', '#app', '#imports'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Angular',
|
|
34
|
+
depIndicators: ['@angular/core'],
|
|
35
|
+
importIndicators: ['@angular/core', '@angular/common'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Express',
|
|
39
|
+
depIndicators: ['express'],
|
|
40
|
+
importIndicators: ['express'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Fastify',
|
|
44
|
+
depIndicators: ['fastify'],
|
|
45
|
+
importIndicators: ['fastify'],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'NestJS',
|
|
49
|
+
depIndicators: ['@nestjs/core'],
|
|
50
|
+
importIndicators: ['@nestjs/core', '@nestjs/common'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Jest',
|
|
54
|
+
depIndicators: ['jest'],
|
|
55
|
+
importIndicators: ['@jest/globals', 'jest'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Vitest',
|
|
59
|
+
depIndicators: ['vitest'],
|
|
60
|
+
importIndicators: ['vitest'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Playwright',
|
|
64
|
+
depIndicators: ['@playwright/test', 'playwright'],
|
|
65
|
+
importIndicators: ['@playwright/test', 'playwright'],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Prisma',
|
|
69
|
+
depIndicators: ['@prisma/client', 'prisma'],
|
|
70
|
+
importIndicators: ['@prisma/client'],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'TypeORM',
|
|
74
|
+
depIndicators: ['typeorm'],
|
|
75
|
+
importIndicators: ['typeorm'],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Tailwind CSS',
|
|
79
|
+
depIndicators: ['tailwindcss'],
|
|
80
|
+
importIndicators: [],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Electron',
|
|
84
|
+
depIndicators: ['electron'],
|
|
85
|
+
importIndicators: ['electron'],
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Detect frameworks based on imports and dependencies
|
|
90
|
+
*
|
|
91
|
+
* @param imports - All imports found in the codebase
|
|
92
|
+
* @param dependencies - Dependencies from package.json
|
|
93
|
+
* @param rules - Optional custom framework rules (defaults to FRAMEWORK_RULES)
|
|
94
|
+
* @returns Array of detected frameworks sorted by confidence
|
|
95
|
+
*/
|
|
96
|
+
export function detectFrameworks(imports, dependencies, rules = FRAMEWORK_RULES) {
|
|
97
|
+
const frameworks = [];
|
|
98
|
+
const depNames = new Set(dependencies.map((d) => d.name));
|
|
99
|
+
const importModules = new Set(imports.map((i) => i.module));
|
|
100
|
+
for (const rule of rules) {
|
|
101
|
+
const evidence = [];
|
|
102
|
+
// Check dependencies
|
|
103
|
+
for (const dep of rule.depIndicators) {
|
|
104
|
+
if (depNames.has(dep)) {
|
|
105
|
+
evidence.push(`Dependency: ${dep}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Check imports
|
|
109
|
+
for (const imp of rule.importIndicators) {
|
|
110
|
+
if (importModules.has(imp)) {
|
|
111
|
+
evidence.push(`Import: ${imp}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (evidence.length > 0) {
|
|
115
|
+
// Calculate confidence based on evidence
|
|
116
|
+
const confidence = Math.min(1, evidence.length * 0.4);
|
|
117
|
+
frameworks.push({
|
|
118
|
+
name: rule.name,
|
|
119
|
+
confidence,
|
|
120
|
+
evidence,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Sort by confidence
|
|
125
|
+
frameworks.sort((a, b) => b.confidence - a.confidence);
|
|
126
|
+
return frameworks;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Check if a specific framework is detected
|
|
130
|
+
*
|
|
131
|
+
* @param frameworkName - Name of the framework to check
|
|
132
|
+
* @param imports - All imports found in the codebase
|
|
133
|
+
* @param dependencies - Dependencies from package.json
|
|
134
|
+
* @returns True if the framework is detected
|
|
135
|
+
*/
|
|
136
|
+
export function hasFramework(frameworkName, imports, dependencies) {
|
|
137
|
+
const frameworks = detectFrameworks(imports, dependencies);
|
|
138
|
+
return frameworks.some((f) => f.name.toLowerCase() === frameworkName.toLowerCase());
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get the primary framework (highest confidence)
|
|
142
|
+
*
|
|
143
|
+
* @param imports - All imports found in the codebase
|
|
144
|
+
* @param dependencies - Dependencies from package.json
|
|
145
|
+
* @returns The primary framework or null if none detected
|
|
146
|
+
*/
|
|
147
|
+
export function getPrimaryFramework(imports, dependencies) {
|
|
148
|
+
const frameworks = detectFrameworks(imports, dependencies);
|
|
149
|
+
return frameworks.length > 0 ? frameworks[0] : null;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=framework-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-detector.js","sourceRoot":"","sources":["../../../src/analysis/framework-detector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C;QACE,IAAI,EAAE,OAAO;QACb,aAAa,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;QACrC,gBAAgB,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;KACzC;IACD;QACE,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,CAAC;KACrE;IACD;QACE,IAAI,EAAE,KAAK;QACX,aAAa,EAAE,CAAC,KAAK,CAAC;QACtB,gBAAgB,EAAE,CAAC,KAAK,CAAC;KAC1B;IACD;QACE,IAAI,EAAE,MAAM;QACZ,aAAa,EAAE,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;KAC/C;IACD;QACE,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,CAAC,eAAe,CAAC;QAChC,gBAAgB,EAAE,CAAC,eAAe,E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AC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAA;IAEtD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,aAAqB,EACrB,OAAqB,EACrB,YAA8B;IAE9B,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAC1D,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC,CAAA;AACrF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAqB,EACrB,YAA8B;IAE9B,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAC1D,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SMI-600: Codebase Analysis Module
|
|
3
|
+
* SMI-1189: Updated to export from split modules
|
|
3
4
|
*
|
|
4
5
|
* Provides tools for analyzing TypeScript/JavaScript codebases
|
|
5
6
|
* to extract context for skill recommendations.
|
|
6
7
|
*
|
|
7
8
|
* @see ADR-010: Codebase Analysis Scope
|
|
8
9
|
*/
|
|
9
|
-
export { CodebaseAnalyzer
|
|
10
|
+
export { CodebaseAnalyzer } from './CodebaseAnalyzer.js';
|
|
11
|
+
export { default } from './CodebaseAnalyzer.js';
|
|
12
|
+
export { SUPPORTED_EXTENSIONS, DEFAULT_EXCLUDE_DIRS, type ImportInfo, type ExportInfo, type FunctionInfo, type FrameworkInfo, type DependencyInfo, type CodebaseContext, type AnalyzeOptions, type ParseResult, } from './types.js';
|
|
13
|
+
export { parseFile, extractImport, extractExport, extractFunction } from './parsers.js';
|
|
14
|
+
export { detectFrameworks, hasFramework, getPrimaryFramework, FRAMEWORK_RULES, type FrameworkRule, } from './framework-detector.js';
|
|
10
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/analysis/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/analysis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG/C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvF,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,KAAK,aAAa,GACnB,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SMI-600: Codebase Analysis Module
|
|
3
|
+
* SMI-1189: Updated to export from split modules
|
|
3
4
|
*
|
|
4
5
|
* Provides tools for analyzing TypeScript/JavaScript codebases
|
|
5
6
|
* to extract context for skill recommendations.
|
|
6
7
|
*
|
|
7
8
|
* @see ADR-010: Codebase Analysis Scope
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
// Main analyzer class
|
|
11
|
+
export { CodebaseAnalyzer } from './CodebaseAnalyzer.js';
|
|
12
|
+
export { default } from './CodebaseAnalyzer.js';
|
|
13
|
+
// Types and constants
|
|
14
|
+
export { SUPPORTED_EXTENSIONS, DEFAULT_EXCLUDE_DIRS, } from './types.js';
|
|
15
|
+
// Parser functions
|
|
16
|
+
export { parseFile, extractImport, extractExport, extractFunction } from './parsers.js';
|
|
17
|
+
// Framework detection
|
|
18
|
+
export { detectFrameworks, hasFramework, getPrimaryFramework, FRAMEWORK_RULES, } from './framework-detector.js';
|
|
10
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analysis/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analysis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,sBAAsB;AACtB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GASrB,MAAM,YAAY,CAAA;AAEnB,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEvF,sBAAsB;AACtB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,eAAe,GAEhB,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-600: Source File Parsers
|
|
3
|
+
* SMI-1189: Extracted from CodebaseAnalyzer.ts
|
|
4
|
+
*
|
|
5
|
+
* Functions for parsing TypeScript/JavaScript source files
|
|
6
|
+
* and extracting imports, exports, and functions.
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import type { ImportInfo, ExportInfo, FunctionInfo, ParseResult } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Parse a single file and extract information
|
|
12
|
+
*
|
|
13
|
+
* @param content - File content to parse
|
|
14
|
+
* @param relativePath - Relative path for source file tracking
|
|
15
|
+
* @returns Parsed imports, exports, and functions
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseFile(content: string, relativePath: string): ParseResult;
|
|
18
|
+
/**
|
|
19
|
+
* Extract import information from an import declaration
|
|
20
|
+
*
|
|
21
|
+
* @param node - Import declaration node
|
|
22
|
+
* @param sourceFile - Source file path
|
|
23
|
+
* @returns Import info or null if invalid
|
|
24
|
+
*/
|
|
25
|
+
export declare function extractImport(node: ts.ImportDeclaration, sourceFile: string): ImportInfo | null;
|
|
26
|
+
/**
|
|
27
|
+
* Extract export information from an export declaration
|
|
28
|
+
*
|
|
29
|
+
* @param node - Export declaration or assignment node
|
|
30
|
+
* @param sourceFile - Source file path
|
|
31
|
+
* @returns Array of export info
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractExport(node: ts.ExportDeclaration | ts.ExportAssignment, sourceFile: string): ExportInfo[];
|
|
34
|
+
/**
|
|
35
|
+
* Extract function information from a function declaration
|
|
36
|
+
*
|
|
37
|
+
* @param node - Function declaration node
|
|
38
|
+
* @param relativePath - Relative file path
|
|
39
|
+
* @param sourceFile - Source file for position lookup
|
|
40
|
+
* @returns Function info or null if no name
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractFunction(node: ts.FunctionDeclaration, relativePath: string, sourceFile: ts.SourceFile): FunctionInfo | null;
|
|
43
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../../src/analysis/parsers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAA;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEnF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,CAsI5E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAkC/F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,iBAAiB,GAAG,EAAE,CAAC,gBAAgB,EAChD,UAAU,EAAE,MAAM,GACjB,UAAU,EAAE,CAwBd;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,EAAE,CAAC,mBAAmB,EAC5B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,EAAE,CAAC,UAAU,GACxB,YAAY,GAAG,IAAI,CAgBrB"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-600: Source File Parsers
|
|
3
|
+
* SMI-1189: Extracted from CodebaseAnalyzer.ts
|
|
4
|
+
*
|
|
5
|
+
* Functions for parsing TypeScript/JavaScript source files
|
|
6
|
+
* and extracting imports, exports, and functions.
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
/**
|
|
10
|
+
* Parse a single file and extract information
|
|
11
|
+
*
|
|
12
|
+
* @param content - File content to parse
|
|
13
|
+
* @param relativePath - Relative path for source file tracking
|
|
14
|
+
* @returns Parsed imports, exports, and functions
|
|
15
|
+
*/
|
|
16
|
+
export function parseFile(content, relativePath) {
|
|
17
|
+
const imports = [];
|
|
18
|
+
const exports = [];
|
|
19
|
+
const functions = [];
|
|
20
|
+
// Create source file
|
|
21
|
+
const sourceFile = ts.createSourceFile(relativePath, content, ts.ScriptTarget.Latest, true, relativePath.endsWith('.tsx') || relativePath.endsWith('.jsx')
|
|
22
|
+
? ts.ScriptKind.TSX
|
|
23
|
+
: ts.ScriptKind.TS);
|
|
24
|
+
// Walk the AST
|
|
25
|
+
const visit = (node) => {
|
|
26
|
+
// Import declarations
|
|
27
|
+
if (ts.isImportDeclaration(node)) {
|
|
28
|
+
const importInfo = extractImport(node, relativePath);
|
|
29
|
+
if (importInfo) {
|
|
30
|
+
imports.push(importInfo);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Export declarations
|
|
34
|
+
if (ts.isExportDeclaration(node) || ts.isExportAssignment(node)) {
|
|
35
|
+
const exportInfos = extractExport(node, relativePath);
|
|
36
|
+
exports.push(...exportInfos);
|
|
37
|
+
}
|
|
38
|
+
// Function declarations
|
|
39
|
+
if (ts.isFunctionDeclaration(node) && node.name) {
|
|
40
|
+
const funcInfo = extractFunction(node, relativePath, sourceFile);
|
|
41
|
+
if (funcInfo) {
|
|
42
|
+
functions.push(funcInfo);
|
|
43
|
+
// Also track as export if exported
|
|
44
|
+
if (funcInfo.isExported) {
|
|
45
|
+
const isDefault = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword);
|
|
46
|
+
exports.push({
|
|
47
|
+
name: node.name.text,
|
|
48
|
+
kind: 'function',
|
|
49
|
+
isDefault: isDefault ?? false,
|
|
50
|
+
sourceFile: relativePath,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Arrow functions assigned to variables
|
|
56
|
+
if (ts.isVariableStatement(node)) {
|
|
57
|
+
for (const decl of node.declarationList.declarations) {
|
|
58
|
+
if (decl.initializer &&
|
|
59
|
+
ts.isArrowFunction(decl.initializer) &&
|
|
60
|
+
ts.isIdentifier(decl.name)) {
|
|
61
|
+
const isExported = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
62
|
+
const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
63
|
+
functions.push({
|
|
64
|
+
name: decl.name.text,
|
|
65
|
+
parameterCount: decl.initializer.parameters.length,
|
|
66
|
+
isAsync: decl.initializer.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) ??
|
|
67
|
+
false,
|
|
68
|
+
isExported: isExported ?? false,
|
|
69
|
+
sourceFile: relativePath,
|
|
70
|
+
line: line + 1,
|
|
71
|
+
});
|
|
72
|
+
// Also track as export if exported
|
|
73
|
+
if (isExported) {
|
|
74
|
+
exports.push({
|
|
75
|
+
name: decl.name.text,
|
|
76
|
+
kind: 'function',
|
|
77
|
+
isDefault: false,
|
|
78
|
+
sourceFile: relativePath,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Class declarations
|
|
85
|
+
if (ts.isClassDeclaration(node) && node.name) {
|
|
86
|
+
const isExported = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
87
|
+
const isDefault = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword);
|
|
88
|
+
if (isExported) {
|
|
89
|
+
exports.push({
|
|
90
|
+
name: node.name.text,
|
|
91
|
+
kind: 'class',
|
|
92
|
+
isDefault: isDefault ?? false,
|
|
93
|
+
sourceFile: relativePath,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Interface declarations
|
|
98
|
+
if (ts.isInterfaceDeclaration(node)) {
|
|
99
|
+
const isExported = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
100
|
+
if (isExported) {
|
|
101
|
+
exports.push({
|
|
102
|
+
name: node.name.text,
|
|
103
|
+
kind: 'interface',
|
|
104
|
+
isDefault: false,
|
|
105
|
+
sourceFile: relativePath,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Type alias declarations
|
|
110
|
+
if (ts.isTypeAliasDeclaration(node)) {
|
|
111
|
+
const isExported = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
112
|
+
if (isExported) {
|
|
113
|
+
exports.push({
|
|
114
|
+
name: node.name.text,
|
|
115
|
+
kind: 'type',
|
|
116
|
+
isDefault: false,
|
|
117
|
+
sourceFile: relativePath,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
ts.forEachChild(node, visit);
|
|
122
|
+
};
|
|
123
|
+
visit(sourceFile);
|
|
124
|
+
return { imports, exports, functions };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Extract import information from an import declaration
|
|
128
|
+
*
|
|
129
|
+
* @param node - Import declaration node
|
|
130
|
+
* @param sourceFile - Source file path
|
|
131
|
+
* @returns Import info or null if invalid
|
|
132
|
+
*/
|
|
133
|
+
export function extractImport(node, sourceFile) {
|
|
134
|
+
const moduleSpecifier = node.moduleSpecifier;
|
|
135
|
+
if (!ts.isStringLiteral(moduleSpecifier)) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const importInfo = {
|
|
139
|
+
module: moduleSpecifier.text,
|
|
140
|
+
namedImports: [],
|
|
141
|
+
isTypeOnly: node.importClause?.isTypeOnly ?? false,
|
|
142
|
+
sourceFile,
|
|
143
|
+
};
|
|
144
|
+
const importClause = node.importClause;
|
|
145
|
+
if (importClause) {
|
|
146
|
+
// Default import
|
|
147
|
+
if (importClause.name) {
|
|
148
|
+
importInfo.defaultImport = importClause.name.text;
|
|
149
|
+
}
|
|
150
|
+
// Named imports
|
|
151
|
+
const namedBindings = importClause.namedBindings;
|
|
152
|
+
if (namedBindings) {
|
|
153
|
+
if (ts.isNamespaceImport(namedBindings)) {
|
|
154
|
+
importInfo.namespaceImport = namedBindings.name.text;
|
|
155
|
+
}
|
|
156
|
+
else if (ts.isNamedImports(namedBindings)) {
|
|
157
|
+
for (const element of namedBindings.elements) {
|
|
158
|
+
importInfo.namedImports.push(element.name.text);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return importInfo;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Extract export information from an export declaration
|
|
167
|
+
*
|
|
168
|
+
* @param node - Export declaration or assignment node
|
|
169
|
+
* @param sourceFile - Source file path
|
|
170
|
+
* @returns Array of export info
|
|
171
|
+
*/
|
|
172
|
+
export function extractExport(node, sourceFile) {
|
|
173
|
+
const exports = [];
|
|
174
|
+
if (ts.isExportAssignment(node)) {
|
|
175
|
+
// export default X
|
|
176
|
+
exports.push({
|
|
177
|
+
name: 'default',
|
|
178
|
+
kind: 'unknown',
|
|
179
|
+
isDefault: true,
|
|
180
|
+
sourceFile,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
else if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
184
|
+
// export { X, Y }
|
|
185
|
+
for (const element of node.exportClause.elements) {
|
|
186
|
+
exports.push({
|
|
187
|
+
name: element.name.text,
|
|
188
|
+
kind: 'unknown',
|
|
189
|
+
isDefault: false,
|
|
190
|
+
sourceFile,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return exports;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Extract function information from a function declaration
|
|
198
|
+
*
|
|
199
|
+
* @param node - Function declaration node
|
|
200
|
+
* @param relativePath - Relative file path
|
|
201
|
+
* @param sourceFile - Source file for position lookup
|
|
202
|
+
* @returns Function info or null if no name
|
|
203
|
+
*/
|
|
204
|
+
export function extractFunction(node, relativePath, sourceFile) {
|
|
205
|
+
if (!node.name)
|
|
206
|
+
return null;
|
|
207
|
+
const isExported = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
208
|
+
const isAsync = node.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword);
|
|
209
|
+
const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
210
|
+
return {
|
|
211
|
+
name: node.name.text,
|
|
212
|
+
parameterCount: node.parameters.length,
|
|
213
|
+
isAsync: isAsync ?? false,
|
|
214
|
+
isExported: isExported ?? false,
|
|
215
|
+
sourceFile: relativePath,
|
|
216
|
+
line: line + 1,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../src/analysis/parsers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAA;AAGhC;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,YAAoB;IAC7D,MAAM,OAAO,GAAiB,EAAE,CAAA;IAChC,MAAM,OAAO,GAAiB,EAAE,CAAA;IAChC,MAAM,SAAS,GAAmB,EAAE,CAAA;IAEpC,qBAAqB;IACrB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,YAAY,EACZ,OAAO,EACP,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,EACJ,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC5D,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG;QACnB,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CACrB,CAAA;IAED,eAAe;IACf,MAAM,KAAK,GAAG,CAAC,IAAa,EAAQ,EAAE;QACpC,sBAAsB;QACtB,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;YACpD,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC;QAED,sBAAsB;QACtB,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,E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AAA;IAElF,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,6BAA6B,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IAE1E,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;QACpB,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;QACtC,OAAO,EAAE,OAAO,IAAI,KAAK;QACzB,UAAU,EAAE,UAAU,IAAI,KAAK;QAC/B,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,IAAI,GAAG,CAAC;KACf,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-600: Codebase Analysis Types
|
|
3
|
+
* SMI-1189: Extracted from CodebaseAnalyzer.ts
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for codebase analysis functionality.
|
|
6
|
+
*
|
|
7
|
+
* @see ADR-010: Codebase Analysis Scope
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Supported file extensions for analysis
|
|
11
|
+
*/
|
|
12
|
+
export declare const SUPPORTED_EXTENSIONS: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Default directories to exclude from analysis
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_EXCLUDE_DIRS: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Import information extracted from source files
|
|
19
|
+
*/
|
|
20
|
+
export interface ImportInfo {
|
|
21
|
+
/** Module specifier (e.g., 'react', './utils') */
|
|
22
|
+
module: string;
|
|
23
|
+
/** Named imports (e.g., ['useState', 'useEffect']) */
|
|
24
|
+
namedImports: string[];
|
|
25
|
+
/** Default import name if present */
|
|
26
|
+
defaultImport?: string;
|
|
27
|
+
/** Namespace import name if present (import * as X) */
|
|
28
|
+
namespaceImport?: string;
|
|
29
|
+
/** Whether this is a type-only import */
|
|
30
|
+
isTypeOnly: boolean;
|
|
31
|
+
/** Source file where import was found */
|
|
32
|
+
sourceFile: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Export information extracted from source files
|
|
36
|
+
*/
|
|
37
|
+
export interface ExportInfo {
|
|
38
|
+
/** Exported name */
|
|
39
|
+
name: string;
|
|
40
|
+
/** Kind of export (function, class, variable, type, interface) */
|
|
41
|
+
kind: 'function' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'unknown';
|
|
42
|
+
/** Whether this is a default export */
|
|
43
|
+
isDefault: boolean;
|
|
44
|
+
/** Source file where export was found */
|
|
45
|
+
sourceFile: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Function information extracted from source files
|
|
49
|
+
*/
|
|
50
|
+
export interface FunctionInfo {
|
|
51
|
+
/** Function name */
|
|
52
|
+
name: string;
|
|
53
|
+
/** Number of parameters */
|
|
54
|
+
parameterCount: number;
|
|
55
|
+
/** Whether function is async */
|
|
56
|
+
isAsync: boolean;
|
|
57
|
+
/** Whether function is exported */
|
|
58
|
+
isExported: boolean;
|
|
59
|
+
/** Source file where function was found */
|
|
60
|
+
sourceFile: string;
|
|
61
|
+
/** Line number */
|
|
62
|
+
line: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Detected framework information
|
|
66
|
+
*/
|
|
67
|
+
export interface FrameworkInfo {
|
|
68
|
+
/** Framework name */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Confidence level (0-1) */
|
|
71
|
+
confidence: number;
|
|
72
|
+
/** Evidence for detection */
|
|
73
|
+
evidence: string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Package.json dependency information
|
|
77
|
+
*/
|
|
78
|
+
export interface DependencyInfo {
|
|
79
|
+
/** Package name */
|
|
80
|
+
name: string;
|
|
81
|
+
/** Version specifier */
|
|
82
|
+
version: string;
|
|
83
|
+
/** Whether this is a dev dependency */
|
|
84
|
+
isDev: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Complete codebase context for skill recommendations
|
|
88
|
+
*/
|
|
89
|
+
export interface CodebaseContext {
|
|
90
|
+
/** Root directory analyzed */
|
|
91
|
+
rootPath: string;
|
|
92
|
+
/** All imports found in the codebase */
|
|
93
|
+
imports: ImportInfo[];
|
|
94
|
+
/** All exports found in the codebase */
|
|
95
|
+
exports: ExportInfo[];
|
|
96
|
+
/** All functions found in the codebase */
|
|
97
|
+
functions: FunctionInfo[];
|
|
98
|
+
/** Detected frameworks */
|
|
99
|
+
frameworks: FrameworkInfo[];
|
|
100
|
+
/** Dependencies from package.json */
|
|
101
|
+
dependencies: DependencyInfo[];
|
|
102
|
+
/** File statistics */
|
|
103
|
+
stats: {
|
|
104
|
+
/** Total files analyzed */
|
|
105
|
+
totalFiles: number;
|
|
106
|
+
/** Files by extension */
|
|
107
|
+
filesByExtension: Record<string, number>;
|
|
108
|
+
/** Total lines of code (approximate) */
|
|
109
|
+
totalLines: number;
|
|
110
|
+
};
|
|
111
|
+
/** Analysis metadata */
|
|
112
|
+
metadata: {
|
|
113
|
+
/** Analysis duration in ms */
|
|
114
|
+
durationMs: number;
|
|
115
|
+
/** Analyzer version */
|
|
116
|
+
version: string;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Options for codebase analysis
|
|
121
|
+
*/
|
|
122
|
+
export interface AnalyzeOptions {
|
|
123
|
+
/** Maximum files to analyze (default: 1000) */
|
|
124
|
+
maxFiles?: number;
|
|
125
|
+
/** Directories to exclude (default: node_modules, dist, .git) */
|
|
126
|
+
excludeDirs?: string[];
|
|
127
|
+
/** Include dev dependencies in analysis */
|
|
128
|
+
includeDevDeps?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Result of parsing a single file
|
|
132
|
+
*/
|
|
133
|
+
export interface ParseResult {
|
|
134
|
+
imports: ImportInfo[];
|
|
135
|
+
exports: ExportInfo[];
|
|
136
|
+
functions: FunctionInfo[];
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/analysis/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAiD,CAAA;AAElF;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAQhC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yCAAyC;IACzC,UAAU,EAAE,OAAO,CAAA;IACnB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAA;IACnF,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAA;IAClB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,2BAA2B;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,mCAAmC;IACnC,UAAU,EAAE,OAAO,CAAA;IACnB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAA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EAAE,CAAA;IACrB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,SAAS,EAAE,YAAY,EAAE,CAAA;CAC1B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-600: Codebase Analysis Types
|
|
3
|
+
* SMI-1189: Extracted from CodebaseAnalyzer.ts
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for codebase analysis functionality.
|
|
6
|
+
*
|
|
7
|
+
* @see ADR-010: Codebase Analysis Scope
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Supported file extensions for analysis
|
|
11
|
+
*/
|
|
12
|
+
export const SUPPORTED_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'];
|
|
13
|
+
/**
|
|
14
|
+
* Default directories to exclude from analysis
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULT_EXCLUDE_DIRS = [
|
|
17
|
+
'node_modules',
|
|
18
|
+
'dist',
|
|
19
|
+
'build',
|
|
20
|
+
'.git',
|
|
21
|
+
'coverage',
|
|
22
|
+
'.next',
|
|
23
|
+
'.nuxt',
|
|
24
|
+
];
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/analysis/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAElF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,cAAc;IACd,MAAM;IACN,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;IACP,OAAO;CACR,CAAA"}
|