@skillsmith/core 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/analysis/CodebaseAnalyzer.d.ts.map +1 -1
- package/dist/src/analysis/CodebaseAnalyzer.js.map +1 -1
- package/dist/src/analysis/adapters/__tests__/python.test.js.map +1 -1
- package/dist/src/analysis/adapters/java-parsers.d.ts +64 -0
- package/dist/src/analysis/adapters/java-parsers.d.ts.map +1 -0
- package/dist/src/analysis/adapters/java-parsers.js +114 -0
- package/dist/src/analysis/adapters/java-parsers.js.map +1 -0
- package/dist/src/analysis/adapters/java.d.ts +1 -51
- package/dist/src/analysis/adapters/java.d.ts.map +1 -1
- package/dist/src/analysis/adapters/java.js +94 -205
- package/dist/src/analysis/adapters/java.js.map +1 -1
- package/dist/src/analysis/adapters/python-frameworks.d.ts +21 -0
- package/dist/src/analysis/adapters/python-frameworks.d.ts.map +1 -0
- package/dist/src/analysis/adapters/python-frameworks.js +86 -0
- package/dist/src/analysis/adapters/python-frameworks.js.map +1 -0
- package/dist/src/analysis/adapters/python.d.ts +0 -50
- package/dist/src/analysis/adapters/python.d.ts.map +1 -1
- package/dist/src/analysis/adapters/python.js +5 -120
- package/dist/src/analysis/adapters/python.js.map +1 -1
- package/dist/src/analysis/adapters/rust-parsers.d.ts +33 -0
- package/dist/src/analysis/adapters/rust-parsers.d.ts.map +1 -0
- package/dist/src/analysis/adapters/rust-parsers.js +94 -0
- package/dist/src/analysis/adapters/rust-parsers.js.map +1 -0
- package/dist/src/analysis/adapters/rust.d.ts +1 -43
- package/dist/src/analysis/adapters/rust.d.ts.map +1 -1
- package/dist/src/analysis/adapters/rust.js +74 -173
- package/dist/src/analysis/adapters/rust.js.map +1 -1
- package/dist/src/analysis/language-detector.d.ts +4 -20
- package/dist/src/analysis/language-detector.d.ts.map +1 -1
- package/dist/src/analysis/language-detector.js +2 -399
- package/dist/src/analysis/language-detector.js.map +1 -1
- package/dist/src/analysis/language-detector.patterns.d.ts +17 -0
- package/dist/src/analysis/language-detector.patterns.d.ts.map +1 -0
- package/dist/src/analysis/language-detector.patterns.js +413 -0
- package/dist/src/analysis/language-detector.patterns.js.map +1 -0
- package/dist/src/analysis/language-detector.types.d.ts +48 -0
- package/dist/src/analysis/language-detector.types.d.ts.map +1 -0
- package/dist/src/analysis/language-detector.types.js +6 -0
- package/dist/src/analysis/language-detector.types.js.map +1 -0
- package/dist/src/analysis/metrics.d.ts +22 -219
- package/dist/src/analysis/metrics.d.ts.map +1 -1
- package/dist/src/analysis/metrics.implementations.d.ts +39 -0
- package/dist/src/analysis/metrics.implementations.d.ts.map +1 -0
- package/dist/src/analysis/metrics.implementations.js +114 -0
- package/dist/src/analysis/metrics.implementations.js.map +1 -0
- package/dist/src/analysis/metrics.js +21 -224
- package/dist/src/analysis/metrics.js.map +1 -1
- package/dist/src/analysis/metrics.types.d.ts +79 -0
- package/dist/src/analysis/metrics.types.d.ts.map +1 -0
- package/dist/src/analysis/metrics.types.js +6 -0
- package/dist/src/analysis/metrics.types.js.map +1 -0
- package/dist/src/analysis/worker-pool.d.ts +25 -52
- package/dist/src/analysis/worker-pool.d.ts.map +1 -1
- package/dist/src/analysis/worker-pool.js +29 -181
- package/dist/src/analysis/worker-pool.js.map +1 -1
- package/dist/src/analysis/worker-types.d.ts +64 -0
- package/dist/src/analysis/worker-types.d.ts.map +1 -0
- package/dist/src/analysis/worker-types.js +11 -0
- package/dist/src/analysis/worker-types.js.map +1 -0
- package/dist/src/analysis/worker-utils.d.ts +49 -0
- package/dist/src/analysis/worker-utils.d.ts.map +1 -0
- package/dist/src/analysis/worker-utils.js +206 -0
- package/dist/src/analysis/worker-utils.js.map +1 -0
- package/dist/src/analytics/AnalyticsRepository.d.ts +1 -5
- package/dist/src/analytics/AnalyticsRepository.d.ts.map +1 -1
- package/dist/src/analytics/AnalyticsRepository.helpers.d.ts +28 -0
- package/dist/src/analytics/AnalyticsRepository.helpers.d.ts.map +1 -0
- package/dist/src/analytics/AnalyticsRepository.helpers.js +90 -0
- package/dist/src/analytics/AnalyticsRepository.helpers.js.map +1 -0
- package/dist/src/analytics/AnalyticsRepository.js +16 -129
- package/dist/src/analytics/AnalyticsRepository.js.map +1 -1
- package/dist/src/analytics/AnalyticsRepository.types.d.ts +82 -0
- package/dist/src/analytics/AnalyticsRepository.types.d.ts.map +1 -0
- package/dist/src/analytics/AnalyticsRepository.types.js +8 -0
- package/dist/src/analytics/AnalyticsRepository.types.js.map +1 -0
- package/dist/src/analytics/ROIDashboardService.js +4 -2
- package/dist/src/analytics/ROIDashboardService.js.map +1 -1
- package/dist/src/api/cache.d.ts.map +1 -1
- package/dist/src/api/cache.js.map +1 -1
- package/dist/src/api/client.d.ts +6 -121
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +29 -129
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/schemas.d.ts +122 -0
- package/dist/src/api/schemas.d.ts.map +1 -0
- package/dist/src/api/schemas.js +71 -0
- package/dist/src/api/schemas.js.map +1 -0
- package/dist/src/api/types.d.ts +1 -1
- package/dist/src/api/types.d.ts.map +1 -1
- package/dist/src/api/utils.d.ts +35 -0
- package/dist/src/api/utils.d.ts.map +1 -0
- package/dist/src/api/utils.js +86 -0
- package/dist/src/api/utils.js.map +1 -0
- package/dist/src/benchmarks/BenchmarkRunner.d.ts.map +1 -1
- package/dist/src/benchmarks/BenchmarkRunner.js +1 -1
- package/dist/src/benchmarks/BenchmarkRunner.js.map +1 -1
- package/dist/src/billing/BillingService.d.ts +15 -53
- package/dist/src/billing/BillingService.d.ts.map +1 -1
- package/dist/src/billing/BillingService.helpers.d.ts +15 -0
- package/dist/src/billing/BillingService.helpers.d.ts.map +1 -0
- package/dist/src/billing/BillingService.helpers.js +45 -0
- package/dist/src/billing/BillingService.helpers.js.map +1 -0
- package/dist/src/billing/BillingService.js +49 -179
- package/dist/src/billing/BillingService.js.map +1 -1
- package/dist/src/billing/BillingService.types.d.ts +52 -0
- package/dist/src/billing/BillingService.types.d.ts.map +1 -0
- package/dist/src/billing/BillingService.types.js +6 -0
- package/dist/src/billing/BillingService.types.js.map +1 -0
- package/dist/src/billing/GDPRComplianceService.d.ts +2 -97
- package/dist/src/billing/GDPRComplianceService.d.ts.map +1 -1
- package/dist/src/billing/GDPRComplianceService.js.map +1 -1
- package/dist/src/billing/StripeClient.d.ts +6 -64
- package/dist/src/billing/StripeClient.d.ts.map +1 -1
- package/dist/src/billing/StripeClient.js +14 -71
- package/dist/src/billing/StripeClient.js.map +1 -1
- package/dist/src/billing/StripeReconciliationJob.d.ts +2 -47
- package/dist/src/billing/StripeReconciliationJob.d.ts.map +1 -1
- package/dist/src/billing/StripeReconciliationJob.js +1 -41
- package/dist/src/billing/StripeReconciliationJob.js.map +1 -1
- package/dist/src/billing/StripeWebhookHandler.d.ts +3 -46
- package/dist/src/billing/StripeWebhookHandler.d.ts.map +1 -1
- package/dist/src/billing/StripeWebhookHandler.js +14 -261
- package/dist/src/billing/StripeWebhookHandler.js.map +1 -1
- package/dist/src/billing/gdpr-types.d.ts +103 -0
- package/dist/src/billing/gdpr-types.d.ts.map +1 -0
- package/dist/src/billing/gdpr-types.js +7 -0
- package/dist/src/billing/gdpr-types.js.map +1 -0
- package/dist/src/billing/reconciliation-helpers.d.ts +16 -0
- package/dist/src/billing/reconciliation-helpers.d.ts.map +1 -0
- package/dist/src/billing/reconciliation-helpers.js +53 -0
- package/dist/src/billing/reconciliation-helpers.js.map +1 -0
- package/dist/src/billing/reconciliation-types.d.ts +71 -0
- package/dist/src/billing/reconciliation-types.d.ts.map +1 -0
- package/dist/src/billing/reconciliation-types.js +7 -0
- package/dist/src/billing/reconciliation-types.js.map +1 -0
- package/dist/src/billing/stripe-client-types.d.ts +45 -0
- package/dist/src/billing/stripe-client-types.d.ts.map +1 -0
- package/dist/src/billing/stripe-client-types.js +7 -0
- package/dist/src/billing/stripe-client-types.js.map +1 -0
- package/dist/src/billing/stripe-helpers.d.ts +17 -0
- package/dist/src/billing/stripe-helpers.d.ts.map +1 -0
- package/dist/src/billing/stripe-helpers.js +50 -0
- package/dist/src/billing/stripe-helpers.js.map +1 -0
- package/dist/src/billing/webhook-handlers.d.ts +56 -0
- package/dist/src/billing/webhook-handlers.d.ts.map +1 -0
- package/dist/src/billing/webhook-handlers.js +303 -0
- package/dist/src/billing/webhook-handlers.js.map +1 -0
- package/dist/src/billing/webhook-types.d.ts +42 -0
- package/dist/src/billing/webhook-types.d.ts.map +1 -0
- package/dist/src/billing/webhook-types.js +7 -0
- package/dist/src/billing/webhook-types.js.map +1 -0
- package/dist/src/config/index.d.ts +118 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +172 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/db/migration-types.d.ts +101 -0
- package/dist/src/db/migration-types.d.ts.map +1 -0
- package/dist/src/db/migration-types.js +6 -0
- package/dist/src/db/migration-types.js.map +1 -0
- package/dist/src/db/migration.d.ts +32 -0
- package/dist/src/db/migration.d.ts.map +1 -0
- package/dist/src/db/migration.js +239 -0
- package/dist/src/db/migration.js.map +1 -0
- package/dist/src/db/schema.d.ts +2 -2
- package/dist/src/db/schema.d.ts.map +1 -1
- package/dist/src/db/schema.js +23 -1
- package/dist/src/db/schema.js.map +1 -1
- package/dist/src/embeddings/embedding-types.d.ts +44 -0
- package/dist/src/embeddings/embedding-types.d.ts.map +1 -0
- package/dist/src/embeddings/embedding-types.js +6 -0
- package/dist/src/embeddings/embedding-types.js.map +1 -0
- package/dist/src/embeddings/embedding-utils.d.ts +42 -0
- package/dist/src/embeddings/embedding-utils.d.ts.map +1 -0
- package/dist/src/embeddings/embedding-utils.js +121 -0
- package/dist/src/embeddings/embedding-utils.js.map +1 -0
- package/dist/src/embeddings/hnsw-store.d.ts +8 -518
- package/dist/src/embeddings/hnsw-store.d.ts.map +1 -1
- package/dist/src/embeddings/hnsw-store.helpers.d.ts +83 -0
- package/dist/src/embeddings/hnsw-store.helpers.d.ts.map +1 -0
- package/dist/src/embeddings/hnsw-store.helpers.js +147 -0
- package/dist/src/embeddings/hnsw-store.helpers.js.map +1 -0
- package/dist/src/embeddings/hnsw-store.js +66 -517
- package/dist/src/embeddings/hnsw-store.js.map +1 -1
- package/dist/src/embeddings/hnsw-store.types.d.ts +154 -0
- package/dist/src/embeddings/hnsw-store.types.d.ts.map +1 -0
- package/dist/src/embeddings/hnsw-store.types.js +26 -0
- package/dist/src/embeddings/hnsw-store.types.js.map +1 -0
- package/dist/src/embeddings/index.d.ts +36 -112
- package/dist/src/embeddings/index.d.ts.map +1 -1
- package/dist/src/embeddings/index.js +37 -210
- package/dist/src/embeddings/index.js.map +1 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +1 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/exports/repositories.d.ts +18 -0
- package/dist/src/exports/repositories.d.ts.map +1 -0
- package/dist/src/exports/repositories.js +30 -0
- package/dist/src/exports/repositories.js.map +1 -0
- package/dist/src/exports/services.d.ts +30 -0
- package/dist/src/exports/services.d.ts.map +1 -0
- package/dist/src/exports/services.js +70 -0
- package/dist/src/exports/services.js.map +1 -0
- package/dist/src/exports/types.d.ts +21 -0
- package/dist/src/exports/types.d.ts.map +1 -0
- package/dist/src/exports/types.js +12 -0
- package/dist/src/exports/types.js.map +1 -0
- package/dist/src/index.d.ts +10 -47
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +31 -48
- package/dist/src/index.js.map +1 -1
- package/dist/src/indexer/GitHubIndexer.d.ts.map +1 -1
- package/dist/src/indexer/GitHubIndexer.js +17 -4
- package/dist/src/indexer/GitHubIndexer.js.map +1 -1
- package/dist/src/indexer/SwarmIndexer.d.ts.map +1 -1
- package/dist/src/indexer/SwarmIndexer.js +1 -1
- package/dist/src/indexer/SwarmIndexer.js.map +1 -1
- package/dist/src/learning/PatternStore.d.ts +6 -426
- package/dist/src/learning/PatternStore.d.ts.map +1 -1
- package/dist/src/learning/PatternStore.helpers.d.ts +88 -0
- package/dist/src/learning/PatternStore.helpers.d.ts.map +1 -0
- package/dist/src/learning/PatternStore.helpers.js +286 -0
- package/dist/src/learning/PatternStore.helpers.js.map +1 -0
- package/dist/src/learning/PatternStore.js +52 -598
- package/dist/src/learning/PatternStore.js.map +1 -1
- package/dist/src/learning/PatternStore.queries.d.ts +83 -0
- package/dist/src/learning/PatternStore.queries.d.ts.map +1 -0
- package/dist/src/learning/PatternStore.queries.js +189 -0
- package/dist/src/learning/PatternStore.queries.js.map +1 -0
- package/dist/src/learning/PatternStore.types.d.ts +308 -0
- package/dist/src/learning/PatternStore.types.d.ts.map +1 -0
- package/dist/src/learning/PatternStore.types.js +44 -0
- package/dist/src/learning/PatternStore.types.js.map +1 -0
- package/dist/src/learning/ReasoningBankIntegration.d.ts +5 -345
- package/dist/src/learning/ReasoningBankIntegration.d.ts.map +1 -1
- package/dist/src/learning/ReasoningBankIntegration.helpers.d.ts +49 -0
- package/dist/src/learning/ReasoningBankIntegration.helpers.d.ts.map +1 -0
- package/dist/src/learning/ReasoningBankIntegration.helpers.js +180 -0
- package/dist/src/learning/ReasoningBankIntegration.helpers.js.map +1 -0
- package/dist/src/learning/ReasoningBankIntegration.js +21 -390
- package/dist/src/learning/ReasoningBankIntegration.js.map +1 -1
- package/dist/src/learning/ReasoningBankIntegration.types.d.ts +167 -0
- package/dist/src/learning/ReasoningBankIntegration.types.d.ts.map +1 -0
- package/dist/src/learning/ReasoningBankIntegration.types.js +51 -0
- package/dist/src/learning/ReasoningBankIntegration.types.js.map +1 -0
- package/dist/src/learning/interfaces.d.ts.map +1 -1
- package/dist/src/pipeline/DailyIndexPipeline.d.ts +4 -176
- package/dist/src/pipeline/DailyIndexPipeline.d.ts.map +1 -1
- package/dist/src/pipeline/DailyIndexPipeline.js +9 -83
- package/dist/src/pipeline/DailyIndexPipeline.js.map +1 -1
- package/dist/src/pipeline/pipeline-types.d.ts +132 -0
- package/dist/src/pipeline/pipeline-types.d.ts.map +1 -0
- package/dist/src/pipeline/pipeline-types.js +6 -0
- package/dist/src/pipeline/pipeline-types.js.map +1 -0
- package/dist/src/repositories/IndexerRepository.d.ts +1 -0
- package/dist/src/repositories/IndexerRepository.d.ts.map +1 -1
- package/dist/src/repositories/IndexerRepository.js +6 -0
- package/dist/src/repositories/IndexerRepository.js.map +1 -1
- package/dist/src/repositories/SkillRepository.d.ts.map +1 -1
- package/dist/src/repositories/SkillRepository.js +20 -5
- package/dist/src/repositories/SkillRepository.js.map +1 -1
- package/dist/src/routing/SONARouter.d.ts +3 -101
- package/dist/src/routing/SONARouter.d.ts.map +1 -1
- package/dist/src/routing/SONARouter.helpers.d.ts +112 -0
- package/dist/src/routing/SONARouter.helpers.d.ts.map +1 -0
- package/dist/src/routing/SONARouter.helpers.js +184 -0
- package/dist/src/routing/SONARouter.helpers.js.map +1 -0
- package/dist/src/routing/SONARouter.js +16 -318
- package/dist/src/routing/SONARouter.js.map +1 -1
- package/dist/src/routing/expert-types.d.ts +109 -0
- package/dist/src/routing/expert-types.d.ts.map +1 -0
- package/dist/src/routing/expert-types.js +162 -0
- package/dist/src/routing/expert-types.js.map +1 -0
- package/dist/src/routing/request-types.d.ts +113 -0
- package/dist/src/routing/request-types.d.ts.map +1 -0
- package/dist/src/routing/request-types.js +9 -0
- package/dist/src/routing/request-types.js.map +1 -0
- package/dist/src/routing/types.d.ts +5 -207
- package/dist/src/routing/types.d.ts.map +1 -1
- package/dist/src/routing/types.js +3 -153
- package/dist/src/routing/types.js.map +1 -1
- package/dist/src/scripts/github-import/github-auth.d.ts +17 -0
- package/dist/src/scripts/github-import/github-auth.d.ts.map +1 -0
- package/dist/src/scripts/github-import/github-auth.js +201 -0
- package/dist/src/scripts/github-import/github-auth.js.map +1 -0
- package/dist/src/scripts/github-import/github-client.d.ts +5 -5
- package/dist/src/scripts/github-import/github-client.d.ts.map +1 -1
- package/dist/src/scripts/github-import/github-client.js +5 -204
- package/dist/src/scripts/github-import/github-client.js.map +1 -1
- package/dist/src/scripts/ingest-lenny-skills.d.ts +40 -0
- package/dist/src/scripts/ingest-lenny-skills.d.ts.map +1 -0
- package/dist/src/scripts/ingest-lenny-skills.js +346 -0
- package/dist/src/scripts/ingest-lenny-skills.js.map +1 -0
- package/dist/src/scripts/merge-skills.d.ts +5 -27
- package/dist/src/scripts/merge-skills.d.ts.map +1 -1
- package/dist/src/scripts/merge-skills.js +4 -144
- package/dist/src/scripts/merge-skills.js.map +1 -1
- package/dist/src/scripts/merge-types.d.ts +72 -0
- package/dist/src/scripts/merge-types.d.ts.map +1 -0
- package/dist/src/scripts/merge-types.js +7 -0
- package/dist/src/scripts/merge-types.js.map +1 -0
- package/dist/src/scripts/merge-utils.d.ts +23 -0
- package/dist/src/scripts/merge-utils.d.ts.map +1 -0
- package/dist/src/scripts/merge-utils.js +150 -0
- package/dist/src/scripts/merge-utils.js.map +1 -0
- package/dist/src/scripts/review-categories.d.ts +41 -0
- package/dist/src/scripts/review-categories.d.ts.map +1 -0
- package/dist/src/scripts/review-categories.js +316 -0
- package/dist/src/scripts/review-categories.js.map +1 -0
- package/dist/src/scripts/review-lenny-skills.d.ts +26 -0
- package/dist/src/scripts/review-lenny-skills.d.ts.map +1 -0
- package/dist/src/scripts/review-lenny-skills.js +215 -0
- package/dist/src/scripts/review-lenny-skills.js.map +1 -0
- package/dist/src/scripts/sync-to-supabase.d.ts +10 -0
- package/dist/src/scripts/sync-to-supabase.d.ts.map +1 -0
- package/dist/src/scripts/sync-to-supabase.js +93 -0
- package/dist/src/scripts/sync-to-supabase.js.map +1 -0
- package/dist/src/security/AuditLogger.d.ts +4 -75
- package/dist/src/security/AuditLogger.d.ts.map +1 -1
- package/dist/src/security/AuditLogger.js +3 -12
- package/dist/src/security/AuditLogger.js.map +1 -1
- package/dist/src/security/__tests__/pathValidation.test.js.map +1 -1
- package/dist/src/security/audit-types.d.ts +96 -0
- package/dist/src/security/audit-types.d.ts.map +1 -0
- package/dist/src/security/audit-types.js +15 -0
- package/dist/src/security/audit-types.js.map +1 -0
- package/dist/src/security/sanitization.d.ts +1 -85
- package/dist/src/security/sanitization.d.ts.map +1 -1
- package/dist/src/security/sanitization.js +2 -133
- package/dist/src/security/sanitization.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.d.ts +12 -88
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.formatters.d.ts +49 -0
- package/dist/src/security/scanner/SecurityScanner.formatters.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.formatters.js +139 -0
- package/dist/src/security/scanner/SecurityScanner.formatters.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.helpers.d.ts +40 -0
- package/dist/src/security/scanner/SecurityScanner.helpers.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.helpers.js +142 -0
- package/dist/src/security/scanner/SecurityScanner.helpers.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.js +26 -255
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -1
- package/dist/src/security/stripe-validators.d.ts +92 -0
- package/dist/src/security/stripe-validators.d.ts.map +1 -0
- package/dist/src/security/stripe-validators.js +139 -0
- package/dist/src/security/stripe-validators.js.map +1 -0
- package/dist/src/services/SearchService.d.ts +5 -29
- package/dist/src/services/SearchService.d.ts.map +1 -1
- package/dist/src/services/SearchService.helpers.d.ts +42 -0
- package/dist/src/services/SearchService.helpers.d.ts.map +1 -0
- package/dist/src/services/SearchService.helpers.js +128 -0
- package/dist/src/services/SearchService.helpers.js.map +1 -0
- package/dist/src/services/SearchService.js +142 -128
- package/dist/src/services/SearchService.js.map +1 -1
- package/dist/src/services/SearchService.types.d.ts +53 -0
- package/dist/src/services/SearchService.types.d.ts.map +1 -0
- package/dist/src/services/SearchService.types.js +7 -0
- package/dist/src/services/SearchService.types.js.map +1 -0
- package/dist/src/services/SkillAnalyzer.d.ts +37 -0
- package/dist/src/services/SkillAnalyzer.d.ts.map +1 -0
- package/dist/src/services/SkillAnalyzer.helpers.d.ts +103 -0
- package/dist/src/services/SkillAnalyzer.helpers.d.ts.map +1 -0
- package/dist/src/services/SkillAnalyzer.helpers.js +237 -0
- package/dist/src/services/SkillAnalyzer.helpers.js.map +1 -0
- package/dist/src/services/SkillAnalyzer.js +270 -0
- package/dist/src/services/SkillAnalyzer.js.map +1 -0
- package/dist/src/services/SkillAnalyzer.types.d.ts +110 -0
- package/dist/src/services/SkillAnalyzer.types.d.ts.map +1 -0
- package/dist/src/services/SkillAnalyzer.types.js +9 -0
- package/dist/src/services/SkillAnalyzer.types.js.map +1 -0
- package/dist/src/services/SkillDecomposer.d.ts +37 -0
- package/dist/src/services/SkillDecomposer.d.ts.map +1 -0
- package/dist/src/services/SkillDecomposer.helpers.d.ts +75 -0
- package/dist/src/services/SkillDecomposer.helpers.d.ts.map +1 -0
- package/dist/src/services/SkillDecomposer.helpers.js +277 -0
- package/dist/src/services/SkillDecomposer.helpers.js.map +1 -0
- package/dist/src/services/SkillDecomposer.js +116 -0
- package/dist/src/services/SkillDecomposer.js.map +1 -0
- package/dist/src/services/SkillDecomposer.types.d.ts +104 -0
- package/dist/src/services/SkillDecomposer.types.d.ts.map +1 -0
- package/dist/src/services/SkillDecomposer.types.js +9 -0
- package/dist/src/services/SkillDecomposer.types.js.map +1 -0
- package/dist/src/services/SubagentGenerator.d.ts +77 -0
- package/dist/src/services/SubagentGenerator.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.js +352 -0
- package/dist/src/services/SubagentGenerator.js.map +1 -0
- package/dist/src/services/TaskRunner.d.ts +227 -0
- package/dist/src/services/TaskRunner.d.ts.map +1 -0
- package/dist/src/services/TaskRunner.js +423 -0
- package/dist/src/services/TaskRunner.js.map +1 -0
- package/dist/src/services/TransformationService.d.ts +167 -0
- package/dist/src/services/TransformationService.d.ts.map +1 -0
- package/dist/src/services/TransformationService.js +315 -0
- package/dist/src/services/TransformationService.js.map +1 -0
- package/dist/src/services/__tests__/SkillAnalyzer.test.d.ts +6 -0
- package/dist/src/services/__tests__/SkillAnalyzer.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SkillAnalyzer.test.js +177 -0
- package/dist/src/services/__tests__/SkillAnalyzer.test.js.map +1 -0
- package/dist/src/services/__tests__/SkillDecomposer.test.d.ts +6 -0
- package/dist/src/services/__tests__/SkillDecomposer.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SkillDecomposer.test.js +235 -0
- package/dist/src/services/__tests__/SkillDecomposer.test.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.d.ts +6 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.js +174 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.js.map +1 -0
- package/dist/src/services/__tests__/TaskRunner.test.d.ts +7 -0
- package/dist/src/services/__tests__/TaskRunner.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/TaskRunner.test.js +316 -0
- package/dist/src/services/__tests__/TaskRunner.test.js.map +1 -0
- package/dist/src/services/__tests__/TransformationService.test.d.ts +6 -0
- package/dist/src/services/__tests__/TransformationService.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/TransformationService.test.js +244 -0
- package/dist/src/services/__tests__/TransformationService.test.js.map +1 -0
- package/dist/src/session/SessionContext.js +1 -1
- package/dist/src/session/SessionContext.js.map +1 -1
- package/dist/src/session/SessionManager.d.ts +3 -67
- package/dist/src/session/SessionManager.d.ts.map +1 -1
- package/dist/src/session/SessionManager.helpers.d.ts +68 -0
- package/dist/src/session/SessionManager.helpers.d.ts.map +1 -0
- package/dist/src/session/SessionManager.helpers.js +152 -0
- package/dist/src/session/SessionManager.helpers.js.map +1 -0
- package/dist/src/session/SessionManager.js +58 -163
- package/dist/src/session/SessionManager.js.map +1 -1
- package/dist/src/session/SessionManager.types.d.ts +88 -0
- package/dist/src/session/SessionManager.types.d.ts.map +1 -0
- package/dist/src/session/SessionManager.types.js +27 -0
- package/dist/src/session/SessionManager.types.js.map +1 -0
- package/dist/src/session/SessionRecovery.d.ts.map +1 -1
- package/dist/src/session/SessionRecovery.js +3 -2
- package/dist/src/session/SessionRecovery.js.map +1 -1
- package/dist/src/sources/RawUrlSourceAdapter.js.map +1 -1
- package/dist/src/sources/SourceAdapterRegistry.js +1 -1
- package/dist/src/sources/SourceAdapterRegistry.js.map +1 -1
- package/dist/src/telemetry/metric-helpers.d.ts +47 -0
- package/dist/src/telemetry/metric-helpers.d.ts.map +1 -0
- package/dist/src/telemetry/metric-helpers.js +96 -0
- package/dist/src/telemetry/metric-helpers.js.map +1 -0
- package/dist/src/telemetry/metric-types.d.ts +73 -0
- package/dist/src/telemetry/metric-types.d.ts.map +1 -0
- package/dist/src/telemetry/metric-types.js +9 -0
- package/dist/src/telemetry/metric-types.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +8 -119
- package/dist/src/telemetry/metrics.d.ts.map +1 -1
- package/dist/src/telemetry/metrics.js +20 -193
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/span-utils.d.ts +30 -0
- package/dist/src/telemetry/span-utils.d.ts.map +1 -0
- package/dist/src/telemetry/span-utils.js +62 -0
- package/dist/src/telemetry/span-utils.js.map +1 -0
- package/dist/src/telemetry/tracer-types.d.ts +91 -0
- package/dist/src/telemetry/tracer-types.d.ts.map +1 -0
- package/dist/src/telemetry/tracer-types.js +6 -0
- package/dist/src/telemetry/tracer-types.js.map +1 -0
- package/dist/src/telemetry/tracer.d.ts +5 -122
- package/dist/src/telemetry/tracer.d.ts.map +1 -1
- package/dist/src/telemetry/tracer.js +24 -170
- package/dist/src/telemetry/tracer.js.map +1 -1
- package/dist/src/testing/MultiLLMProvider.d.ts +17 -293
- package/dist/src/testing/MultiLLMProvider.d.ts.map +1 -1
- package/dist/src/testing/MultiLLMProvider.helpers.d.ts +54 -0
- package/dist/src/testing/MultiLLMProvider.helpers.d.ts.map +1 -0
- package/dist/src/testing/MultiLLMProvider.helpers.js +126 -0
- package/dist/src/testing/MultiLLMProvider.helpers.js.map +1 -0
- package/dist/src/testing/MultiLLMProvider.js +50 -323
- package/dist/src/testing/MultiLLMProvider.js.map +1 -1
- package/dist/src/testing/MultiLLMProvider.types.d.ts +253 -0
- package/dist/src/testing/MultiLLMProvider.types.d.ts.map +1 -0
- package/dist/src/testing/MultiLLMProvider.types.js +111 -0
- package/dist/src/testing/MultiLLMProvider.types.js.map +1 -0
- package/dist/src/triggers/TriggerDetector.d.ts +6 -142
- package/dist/src/triggers/TriggerDetector.d.ts.map +1 -1
- package/dist/src/triggers/TriggerDetector.js +15 -247
- package/dist/src/triggers/TriggerDetector.js.map +1 -1
- package/dist/src/triggers/__tests__/TriggerDetector.test.js +1 -1
- package/dist/src/triggers/__tests__/TriggerDetector.test.js.map +1 -1
- package/dist/src/triggers/trigger-constants.d.ts +22 -0
- package/dist/src/triggers/trigger-constants.d.ts.map +1 -0
- package/dist/src/triggers/trigger-constants.js +185 -0
- package/dist/src/triggers/trigger-constants.js.map +1 -0
- package/dist/src/triggers/trigger-types.d.ts +90 -0
- package/dist/src/triggers/trigger-types.d.ts.map +1 -0
- package/dist/src/triggers/trigger-types.js +6 -0
- package/dist/src/triggers/trigger-types.js.map +1 -0
- package/dist/src/types/skill.d.ts +33 -1
- package/dist/src/types/skill.d.ts.map +1 -1
- package/dist/src/types/skill.js +11 -1
- package/dist/src/types/skill.js.map +1 -1
- package/dist/src/types.d.ts +28 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/retry.js +2 -2
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/validation/index.d.ts +5 -105
- package/dist/src/validation/index.d.ts.map +1 -1
- package/dist/src/validation/index.js +9 -421
- package/dist/src/validation/index.js.map +1 -1
- package/dist/src/validation/input-validators.d.ts +68 -0
- package/dist/src/validation/input-validators.d.ts.map +1 -0
- package/dist/src/validation/input-validators.js +126 -0
- package/dist/src/validation/input-validators.js.map +1 -0
- package/dist/src/validation/path-validators.d.ts +23 -0
- package/dist/src/validation/path-validators.d.ts.map +1 -0
- package/dist/src/validation/path-validators.js +47 -0
- package/dist/src/validation/path-validators.js.map +1 -0
- package/dist/src/validation/url-validators.d.ts +55 -0
- package/dist/src/validation/url-validators.d.ts.map +1 -0
- package/dist/src/validation/url-validators.js +267 -0
- package/dist/src/validation/url-validators.js.map +1 -0
- package/dist/src/validation/validation-error.d.ts +14 -0
- package/dist/src/validation/validation-error.d.ts.map +1 -0
- package/dist/src/validation/validation-error.js +19 -0
- package/dist/src/validation/validation-error.js.map +1 -0
- package/dist/src/webhooks/WebhookHandler.d.ts.map +1 -1
- package/dist/src/webhooks/WebhookHandler.js.map +1 -1
- package/dist/src/webhooks/WebhookPayload.d.ts +4 -215
- package/dist/src/webhooks/WebhookPayload.d.ts.map +1 -1
- package/dist/src/webhooks/WebhookPayload.js +1 -122
- package/dist/src/webhooks/WebhookPayload.js.map +1 -1
- package/dist/src/webhooks/WebhookQueue.d.ts +2 -140
- package/dist/src/webhooks/WebhookQueue.d.ts.map +1 -1
- package/dist/src/webhooks/WebhookQueue.js +4 -11
- package/dist/src/webhooks/WebhookQueue.js.map +1 -1
- package/dist/src/webhooks/WebhookQueue.types.d.ts +149 -0
- package/dist/src/webhooks/WebhookQueue.types.d.ts.map +1 -0
- package/dist/src/webhooks/WebhookQueue.types.js +10 -0
- package/dist/src/webhooks/WebhookQueue.types.js.map +1 -0
- package/dist/src/webhooks/WebhookQueue.utils.d.ts +44 -0
- package/dist/src/webhooks/WebhookQueue.utils.d.ts.map +1 -0
- package/dist/src/webhooks/WebhookQueue.utils.js +58 -0
- package/dist/src/webhooks/WebhookQueue.utils.js.map +1 -0
- package/dist/src/webhooks/webhook-schemas.d.ts +213 -0
- package/dist/src/webhooks/webhook-schemas.d.ts.map +1 -0
- package/dist/src/webhooks/webhook-schemas.js +132 -0
- package/dist/src/webhooks/webhook-schemas.js.map +1 -0
- package/dist/src/webhooks/webhook-types.d.ts +222 -0
- package/dist/src/webhooks/webhook-types.d.ts.map +1 -0
- package/dist/src/webhooks/webhook-types.js +10 -0
- package/dist/src/webhooks/webhook-types.js.map +1 -0
- package/dist/tests/Analytics.integration.test.js +2 -2
- package/dist/tests/Analytics.integration.test.js.map +1 -1
- package/dist/tests/AnalyticsRepository.test.js +3 -5
- package/dist/tests/AnalyticsRepository.test.js.map +1 -1
- package/dist/tests/AnalyticsStorage.test.js.map +1 -1
- package/dist/tests/ApiPartialResponses.test.d.ts +12 -0
- package/dist/tests/ApiPartialResponses.test.d.ts.map +1 -0
- package/dist/tests/ApiPartialResponses.test.js +202 -0
- package/dist/tests/ApiPartialResponses.test.js.map +1 -0
- package/dist/tests/AuditLogger.test.js.map +1 -1
- package/dist/tests/BenchmarkRunner.test.js +6 -6
- package/dist/tests/BenchmarkRunner.test.js.map +1 -1
- package/dist/tests/CacheSecurity.test.js.map +1 -1
- package/dist/tests/CodebaseAnalyzer.test.js.map +1 -1
- package/dist/tests/DailyIndexPipeline.test.js.map +1 -1
- package/dist/tests/EmbeddingService.test.js.map +1 -1
- package/dist/tests/GitHubIndexer.test.js +4 -3
- package/dist/tests/GitHubIndexer.test.js.map +1 -1
- package/dist/tests/MemoryProfiler.test.js +3 -3
- package/dist/tests/MemoryProfiler.test.js.map +1 -1
- package/dist/tests/QualityScorer.test.js.map +1 -1
- package/dist/tests/RateLimiter.test.js.map +1 -1
- package/dist/tests/ScraperAdapters.test.js.map +1 -1
- package/dist/tests/SecurityScanner.test.js +4 -4
- package/dist/tests/SecurityScanner.test.js.map +1 -1
- package/dist/tests/SessionManager.security.test.js +1 -1
- package/dist/tests/SessionManager.security.test.js.map +1 -1
- package/dist/tests/SessionManager.test.js +4 -4
- package/dist/tests/SessionManager.test.js.map +1 -1
- package/dist/tests/SwarmIndexer.test.js +1 -1
- package/dist/tests/SwarmIndexer.test.js.map +1 -1
- package/dist/tests/TieredCache.test.js +2 -11
- package/dist/tests/TieredCache.test.js.map +1 -1
- package/dist/tests/WebhookHandler.test.js.map +1 -1
- package/dist/tests/fixtures/api-responses/index.d.ts +119 -0
- package/dist/tests/fixtures/api-responses/index.d.ts.map +1 -0
- package/dist/tests/fixtures/api-responses/index.js +419 -0
- package/dist/tests/fixtures/api-responses/index.js.map +1 -0
- package/dist/tests/integration/neural/neural-fixtures.d.ts +19 -0
- package/dist/tests/integration/neural/neural-fixtures.d.ts.map +1 -0
- package/dist/tests/integration/neural/neural-fixtures.js +49 -0
- package/dist/tests/integration/neural/neural-fixtures.js.map +1 -0
- package/dist/tests/integration/neural/neural-mocks-privacy.d.ts +78 -0
- package/dist/tests/integration/neural/neural-mocks-privacy.d.ts.map +1 -0
- package/dist/tests/integration/neural/neural-mocks-privacy.js +146 -0
- package/dist/tests/integration/neural/neural-mocks-privacy.js.map +1 -0
- package/dist/tests/integration/neural/neural-mocks.d.ts +90 -0
- package/dist/tests/integration/neural/neural-mocks.d.ts.map +1 -0
- package/dist/tests/integration/neural/neural-mocks.js +288 -0
- package/dist/tests/integration/neural/neural-mocks.js.map +1 -0
- package/dist/tests/integration/neural/neural-test-utils.d.ts +27 -0
- package/dist/tests/integration/neural/neural-test-utils.d.ts.map +1 -0
- package/dist/tests/integration/neural/neural-test-utils.js +35 -0
- package/dist/tests/integration/neural/neural-test-utils.js.map +1 -0
- package/dist/tests/integration/neural/setup.d.ts +6 -165
- package/dist/tests/integration/neural/setup.d.ts.map +1 -1
- package/dist/tests/integration/neural/setup.js +9 -477
- package/dist/tests/integration/neural/setup.js.map +1 -1
- package/dist/tests/logger.test.js +1 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/performance/LargeScalePerformance.test.js +1 -1
- package/dist/tests/performance/LargeScalePerformance.test.js.map +1 -1
- package/dist/tests/sanitization.test.js.map +1 -1
- package/dist/tests/session/SessionManager.helpers.test.d.ts +8 -0
- package/dist/tests/session/SessionManager.helpers.test.d.ts.map +1 -0
- package/dist/tests/session/SessionManager.helpers.test.js +105 -0
- package/dist/tests/session/SessionManager.helpers.test.js.map +1 -0
- package/dist/tests/sources.test.js.map +1 -1
- package/dist/tests/webhooks/WebhookHandler.idempotency.test.js +1 -1
- package/dist/tests/webhooks/WebhookHandler.idempotency.test.js.map +1 -1
- package/dist/tests/webhooks/WebhookPayload.security.test.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1788: SkillAnalyzer Helpers
|
|
3
|
+
*
|
|
4
|
+
* Tool detection patterns, thresholds, and utility functions
|
|
5
|
+
* for skill analysis and optimization.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Tool detection patterns for analyzing skill content
|
|
9
|
+
*/
|
|
10
|
+
export const TOOL_PATTERNS = {
|
|
11
|
+
Read: {
|
|
12
|
+
patterns: ['read file', 'read the file', 'examine', 'view file', 'cat ', 'Read tool'],
|
|
13
|
+
weight: 1,
|
|
14
|
+
},
|
|
15
|
+
Write: {
|
|
16
|
+
patterns: [
|
|
17
|
+
'write file',
|
|
18
|
+
'create file',
|
|
19
|
+
'save to',
|
|
20
|
+
'output to file',
|
|
21
|
+
'Write tool',
|
|
22
|
+
'write the file',
|
|
23
|
+
],
|
|
24
|
+
weight: 2,
|
|
25
|
+
},
|
|
26
|
+
Edit: {
|
|
27
|
+
patterns: ['edit file', 'modify file', 'update file', 'patch', 'Edit tool', 'replace in'],
|
|
28
|
+
weight: 2,
|
|
29
|
+
},
|
|
30
|
+
Bash: {
|
|
31
|
+
patterns: [
|
|
32
|
+
'bash',
|
|
33
|
+
'npm ',
|
|
34
|
+
'npx ',
|
|
35
|
+
'git ',
|
|
36
|
+
'docker',
|
|
37
|
+
'yarn ',
|
|
38
|
+
'pnpm ',
|
|
39
|
+
'execute command',
|
|
40
|
+
'run command',
|
|
41
|
+
'terminal',
|
|
42
|
+
'shell',
|
|
43
|
+
'Bash tool',
|
|
44
|
+
],
|
|
45
|
+
weight: 3,
|
|
46
|
+
},
|
|
47
|
+
Grep: {
|
|
48
|
+
patterns: ['grep', 'search for', 'find text', 'pattern match', 'Grep tool'],
|
|
49
|
+
weight: 1,
|
|
50
|
+
},
|
|
51
|
+
Glob: {
|
|
52
|
+
patterns: ['glob', 'find file', 'file pattern', 'list files', 'Glob tool'],
|
|
53
|
+
weight: 1,
|
|
54
|
+
},
|
|
55
|
+
WebFetch: {
|
|
56
|
+
patterns: ['fetch', 'http', 'api call', 'url', 'WebFetch', 'download', 'request'],
|
|
57
|
+
weight: 2,
|
|
58
|
+
},
|
|
59
|
+
WebSearch: {
|
|
60
|
+
patterns: ['web search', 'search online', 'lookup online', 'WebSearch'],
|
|
61
|
+
weight: 2,
|
|
62
|
+
},
|
|
63
|
+
Task: {
|
|
64
|
+
patterns: ['Task(', 'Task tool', 'spawn agent', 'delegate to', 'subagent'],
|
|
65
|
+
weight: 3,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Thresholds for optimization decisions
|
|
70
|
+
*/
|
|
71
|
+
export const THRESHOLDS = {
|
|
72
|
+
/** Maximum lines before recommending decomposition */
|
|
73
|
+
maxLinesBeforeDecompose: 500,
|
|
74
|
+
/** Minimum lines for an extractable section */
|
|
75
|
+
minSectionLines: 50,
|
|
76
|
+
/** Heavy tool usage count that suggests subagent */
|
|
77
|
+
heavyToolUsageCount: 5,
|
|
78
|
+
/** Sequential Task() calls that should be parallelized */
|
|
79
|
+
sequentialTaskThreshold: 2,
|
|
80
|
+
/** Minimum optimization score to recommend transformation */
|
|
81
|
+
minTransformScore: 30,
|
|
82
|
+
/** Large examples section threshold */
|
|
83
|
+
largeExamplesThreshold: 200,
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Escape special regex characters in a string
|
|
87
|
+
* @param str - String to escape
|
|
88
|
+
* @returns Escaped string safe for use in RegExp
|
|
89
|
+
*/
|
|
90
|
+
export function escapeRegex(str) {
|
|
91
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Determine confidence level based on match count
|
|
95
|
+
* @param matchCount - Number of detected tools
|
|
96
|
+
* @returns Confidence level
|
|
97
|
+
*/
|
|
98
|
+
export function getConfidenceLevel(matchCount) {
|
|
99
|
+
if (matchCount >= 4)
|
|
100
|
+
return 'high';
|
|
101
|
+
if (matchCount >= 2)
|
|
102
|
+
return 'medium';
|
|
103
|
+
return 'low';
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Estimate examples lines by looking for code blocks
|
|
107
|
+
* @param content - Full skill content
|
|
108
|
+
* @returns Estimated number of lines in code blocks
|
|
109
|
+
*/
|
|
110
|
+
export function estimateExamplesLines(content) {
|
|
111
|
+
const codeBlockMatches = content.match(/```[\s\S]*?```/g) || [];
|
|
112
|
+
let totalLines = 0;
|
|
113
|
+
for (const block of codeBlockMatches) {
|
|
114
|
+
totalLines += block.split('\n').length;
|
|
115
|
+
}
|
|
116
|
+
return totalLines;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Detect tools in content
|
|
120
|
+
* @param content - Skill content to analyze
|
|
121
|
+
* @returns Object with detected tools and total weight
|
|
122
|
+
*/
|
|
123
|
+
export function detectTools(content) {
|
|
124
|
+
const detectedTools = [];
|
|
125
|
+
let totalWeight = 0;
|
|
126
|
+
for (const [tool, config] of Object.entries(TOOL_PATTERNS)) {
|
|
127
|
+
for (const pattern of config.patterns) {
|
|
128
|
+
// Use word-boundary regex to avoid false positives
|
|
129
|
+
const regex = new RegExp(`\\b${escapeRegex(pattern)}\\b`, 'i');
|
|
130
|
+
if (regex.test(content)) {
|
|
131
|
+
if (!detectedTools.includes(tool)) {
|
|
132
|
+
detectedTools.push(tool);
|
|
133
|
+
totalWeight += config.weight;
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { tools: detectedTools, totalWeight };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Count specific command patterns in content
|
|
143
|
+
* @param content - Skill content to analyze
|
|
144
|
+
* @returns Counts for bash, read, and write commands
|
|
145
|
+
*/
|
|
146
|
+
export function countCommandPatterns(content) {
|
|
147
|
+
const bashCommandCount = (content.match(/\b(npm|npx|git|docker|yarn|pnpm)\s/gi) || []).length;
|
|
148
|
+
const fileReadCount = (content.match(/\b(read|cat|head|tail|grep|find)\s/gi) || []).length;
|
|
149
|
+
const fileWriteCount = (content.match(/\b(write|edit|modify|create)\s+file/gi) || []).length;
|
|
150
|
+
return { bashCommandCount, fileReadCount, fileWriteCount };
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Determine if tool usage suggests a subagent would be beneficial
|
|
154
|
+
* @param bashCount - Number of bash commands
|
|
155
|
+
* @param fileOpCount - Total file operations (read + write)
|
|
156
|
+
* @param totalWeight - Total tool weight
|
|
157
|
+
* @returns Whether subagent is suggested
|
|
158
|
+
*/
|
|
159
|
+
export function shouldSuggestSubagent(bashCount, fileOpCount, totalWeight) {
|
|
160
|
+
return (bashCount >= THRESHOLDS.heavyToolUsageCount ||
|
|
161
|
+
fileOpCount >= THRESHOLDS.heavyToolUsageCount ||
|
|
162
|
+
totalWeight >= 10);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Count sequential Task() calls in content
|
|
166
|
+
* @param content - Skill content to analyze
|
|
167
|
+
* @returns Count of sequential Task calls
|
|
168
|
+
*/
|
|
169
|
+
export function countSequentialTaskCalls(content) {
|
|
170
|
+
const lines = content.split('\n');
|
|
171
|
+
let sequentialCalls = 0;
|
|
172
|
+
let consecutiveTaskLines = 0;
|
|
173
|
+
for (const line of lines) {
|
|
174
|
+
if (line.includes('Task(') || line.includes('Task (')) {
|
|
175
|
+
consecutiveTaskLines++;
|
|
176
|
+
}
|
|
177
|
+
else if (consecutiveTaskLines > 0) {
|
|
178
|
+
if (consecutiveTaskLines >= THRESHOLDS.sequentialTaskThreshold) {
|
|
179
|
+
sequentialCalls += consecutiveTaskLines;
|
|
180
|
+
}
|
|
181
|
+
consecutiveTaskLines = 0;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Check for final sequence
|
|
185
|
+
if (consecutiveTaskLines >= THRESHOLDS.sequentialTaskThreshold) {
|
|
186
|
+
sequentialCalls += consecutiveTaskLines;
|
|
187
|
+
}
|
|
188
|
+
return sequentialCalls;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Calculate batch savings percentage
|
|
192
|
+
* @param sequentialCalls - Number of sequential Task calls
|
|
193
|
+
* @returns Estimated savings percentage
|
|
194
|
+
*/
|
|
195
|
+
export function calculateBatchSavings(sequentialCalls) {
|
|
196
|
+
// Batching reduces context overhead by ~30-50%
|
|
197
|
+
return sequentialCalls >= THRESHOLDS.sequentialTaskThreshold
|
|
198
|
+
? Math.min(50, sequentialCalls * 10)
|
|
199
|
+
: 0;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Determine extraction reason for a section
|
|
203
|
+
* @param sectionName - Name of the section
|
|
204
|
+
* @param lineCount - Number of lines in section
|
|
205
|
+
* @returns Human-readable extraction reason
|
|
206
|
+
*/
|
|
207
|
+
export function getExtractionReason(sectionName, lineCount) {
|
|
208
|
+
const lowerName = sectionName.toLowerCase();
|
|
209
|
+
if (lowerName.includes('api') || lowerName.includes('reference')) {
|
|
210
|
+
return 'API reference sections can be loaded on-demand';
|
|
211
|
+
}
|
|
212
|
+
if (lowerName.includes('example') || lowerName.includes('usage')) {
|
|
213
|
+
return 'Examples can be progressively disclosed';
|
|
214
|
+
}
|
|
215
|
+
if (lowerName.includes('advanced') || lowerName.includes('configuration')) {
|
|
216
|
+
return 'Advanced topics are rarely needed in initial context';
|
|
217
|
+
}
|
|
218
|
+
if (lineCount > 100) {
|
|
219
|
+
return 'Large section suitable for sub-skill extraction';
|
|
220
|
+
}
|
|
221
|
+
return 'Section size suggests separate loading benefit';
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Calculate extraction priority based on size ratio
|
|
225
|
+
* @param lineCount - Section line count
|
|
226
|
+
* @param totalLines - Total document lines
|
|
227
|
+
* @returns Priority (1 = highest, 3 = lowest)
|
|
228
|
+
*/
|
|
229
|
+
export function calculateExtractionPriority(lineCount, totalLines) {
|
|
230
|
+
const sizeRatio = lineCount / totalLines;
|
|
231
|
+
if (sizeRatio > 0.3)
|
|
232
|
+
return 1;
|
|
233
|
+
if (sizeRatio > 0.15)
|
|
234
|
+
return 2;
|
|
235
|
+
return 3;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=SkillAnalyzer.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillAnalyzer.helpers.js","sourceRoot":"","sources":["../../../src/services/SkillAnalyzer.helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA2D;IACnF,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC;QACrF,MAAM,EAAE,CAAC;KACV;IACD,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,YAAY;YACZ,aAAa;YACb,SAAS;YACT,gBAAgB;YAChB,YAAY;YACZ,gBAAgB;SACjB;QACD,MAAM,EAAE,CAAC;KACV;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC;QACzF,MAAM,EAAE,CAAC;KACV;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,QAAQ;YACR,OAAO;YACP,OAAO;YACP,iBAAiB;YACjB,aAAa;YACb,UAAU;YACV,OAAO;YAC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QAAE,OAAO,CAAC,CAAA;IAC7B,IAAI,SAAS,GAAG,IAAI;QAAE,OAAO,CAAC,CAAA;IAC9B,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1788: SkillAnalyzer - Analyze skills for optimization patterns
|
|
3
|
+
*
|
|
4
|
+
* Detects optimization opportunities based on:
|
|
5
|
+
* - Line count (>500 lines suggests decomposition)
|
|
6
|
+
* - Tool usage patterns (heavy tool usage suggests subagent)
|
|
7
|
+
* - Sequential Task() calls (can be parallelized)
|
|
8
|
+
* - Large examples sections (can use progressive disclosure)
|
|
9
|
+
*
|
|
10
|
+
* Part of the Skillsmith Optimization Layer for transforming
|
|
11
|
+
* community skills into more performant versions.
|
|
12
|
+
*/
|
|
13
|
+
import { THRESHOLDS, detectTools, countCommandPatterns, shouldSuggestSubagent, getConfidenceLevel, estimateExamplesLines, countSequentialTaskCalls, calculateBatchSavings, getExtractionReason, calculateExtractionPriority, } from './SkillAnalyzer.helpers.js';
|
|
14
|
+
// Re-export helpers for testing and advanced usage
|
|
15
|
+
export { TOOL_PATTERNS, THRESHOLDS, escapeRegex, getConfidenceLevel, } from './SkillAnalyzer.helpers.js';
|
|
16
|
+
/**
|
|
17
|
+
* Analyze a skill's content for optimization opportunities
|
|
18
|
+
*
|
|
19
|
+
* @param content - The full SKILL.md content
|
|
20
|
+
* @returns Analysis of optimization potential
|
|
21
|
+
* @remarks The lineCount for an empty string returns 1, matching standard
|
|
22
|
+
* String.split('\n') behavior where ''.split('\n') yields ['']
|
|
23
|
+
*/
|
|
24
|
+
export function analyzeSkill(content) {
|
|
25
|
+
const lines = content.split('\n');
|
|
26
|
+
const lineCount = lines.length;
|
|
27
|
+
// Analyze sections
|
|
28
|
+
const { mainContentLines, examplesLines, sections } = analyzeSections(content);
|
|
29
|
+
// Analyze tool usage
|
|
30
|
+
const toolUsage = analyzeToolUsage(content);
|
|
31
|
+
// Analyze Task() patterns
|
|
32
|
+
const taskPatterns = analyzeTaskPatterns(content);
|
|
33
|
+
// Find extractable sections
|
|
34
|
+
const extractableSections = findExtractableSections(sections, lineCount);
|
|
35
|
+
// Generate recommendations
|
|
36
|
+
const recommendations = generateRecommendations(lineCount, examplesLines, toolUsage, taskPatterns, extractableSections);
|
|
37
|
+
// Calculate optimization score
|
|
38
|
+
const optimizationScore = calculateOptimizationScore(lineCount, toolUsage, taskPatterns, recommendations);
|
|
39
|
+
return {
|
|
40
|
+
lineCount,
|
|
41
|
+
mainContentLines,
|
|
42
|
+
examplesLines,
|
|
43
|
+
toolUsage,
|
|
44
|
+
taskPatterns,
|
|
45
|
+
extractableSections,
|
|
46
|
+
recommendations,
|
|
47
|
+
optimizationScore,
|
|
48
|
+
shouldTransform: optimizationScore >= THRESHOLDS.minTransformScore,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Analyze sections within the skill content
|
|
53
|
+
*/
|
|
54
|
+
function analyzeSections(content) {
|
|
55
|
+
const lines = content.split('\n');
|
|
56
|
+
const sections = [];
|
|
57
|
+
let currentSection = null;
|
|
58
|
+
let examplesStartLine = -1;
|
|
59
|
+
let examplesEndLine = -1;
|
|
60
|
+
for (let i = 0; i < lines.length; i++) {
|
|
61
|
+
const line = lines[i];
|
|
62
|
+
const headerMatch = line.match(/^(#{1,3})\s+(.+)$/);
|
|
63
|
+
if (headerMatch) {
|
|
64
|
+
// Save previous section
|
|
65
|
+
if (currentSection) {
|
|
66
|
+
sections.push({
|
|
67
|
+
name: currentSection.name,
|
|
68
|
+
startLine: currentSection.startLine,
|
|
69
|
+
endLine: i - 1,
|
|
70
|
+
content: currentSection.lines.join('\n'),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
currentSection = {
|
|
74
|
+
name: headerMatch[2].trim(),
|
|
75
|
+
startLine: i,
|
|
76
|
+
lines: [],
|
|
77
|
+
};
|
|
78
|
+
// Track examples section
|
|
79
|
+
const sectionName = headerMatch[2].toLowerCase();
|
|
80
|
+
if (sectionName.includes('example') || sectionName.includes('usage')) {
|
|
81
|
+
examplesStartLine = i;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (currentSection) {
|
|
85
|
+
currentSection.lines.push(line);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Save last section
|
|
89
|
+
if (currentSection) {
|
|
90
|
+
sections.push({
|
|
91
|
+
name: currentSection.name,
|
|
92
|
+
startLine: currentSection.startLine,
|
|
93
|
+
endLine: lines.length - 1,
|
|
94
|
+
content: currentSection.lines.join('\n'),
|
|
95
|
+
});
|
|
96
|
+
if (examplesStartLine >= 0 && examplesEndLine < 0) {
|
|
97
|
+
examplesEndLine = lines.length - 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Calculate line counts
|
|
101
|
+
const examplesLines = examplesStartLine >= 0
|
|
102
|
+
? examplesEndLine - examplesStartLine + 1
|
|
103
|
+
: estimateExamplesLines(content);
|
|
104
|
+
const mainContentLines = lines.length - examplesLines;
|
|
105
|
+
return { mainContentLines, examplesLines, sections };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Analyze tool usage patterns in the content
|
|
109
|
+
*/
|
|
110
|
+
function analyzeToolUsage(content) {
|
|
111
|
+
const { tools: detectedTools, totalWeight } = detectTools(content);
|
|
112
|
+
const { bashCommandCount, fileReadCount, fileWriteCount } = countCommandPatterns(content);
|
|
113
|
+
const suggestsSubagent = shouldSuggestSubagent(bashCommandCount, fileReadCount + fileWriteCount, totalWeight);
|
|
114
|
+
const confidence = getConfidenceLevel(detectedTools.length);
|
|
115
|
+
return {
|
|
116
|
+
detectedTools,
|
|
117
|
+
bashCommandCount,
|
|
118
|
+
fileReadCount,
|
|
119
|
+
fileWriteCount,
|
|
120
|
+
suggestsSubagent,
|
|
121
|
+
confidence,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Analyze Task() call patterns
|
|
126
|
+
*/
|
|
127
|
+
function analyzeTaskPatterns(content) {
|
|
128
|
+
const taskCalls = content.match(/Task\s*\([^)]+\)/g) || [];
|
|
129
|
+
const taskCallCount = taskCalls.length;
|
|
130
|
+
const sequentialCalls = countSequentialTaskCalls(content);
|
|
131
|
+
const canBatch = sequentialCalls >= THRESHOLDS.sequentialTaskThreshold;
|
|
132
|
+
const batchSavingsPercent = calculateBatchSavings(sequentialCalls);
|
|
133
|
+
return {
|
|
134
|
+
taskCallCount,
|
|
135
|
+
sequentialCalls,
|
|
136
|
+
canBatch,
|
|
137
|
+
batchSavingsPercent,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Find sections that could be extracted as sub-skills
|
|
142
|
+
*/
|
|
143
|
+
function findExtractableSections(sections, totalLines) {
|
|
144
|
+
const extractable = [];
|
|
145
|
+
for (const section of sections) {
|
|
146
|
+
const lineCount = section.endLine - section.startLine + 1;
|
|
147
|
+
// Skip small sections
|
|
148
|
+
if (lineCount < THRESHOLDS.minSectionLines) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const priority = calculateExtractionPriority(lineCount, totalLines);
|
|
152
|
+
const reason = getExtractionReason(section.name, lineCount);
|
|
153
|
+
extractable.push({
|
|
154
|
+
name: section.name,
|
|
155
|
+
startLine: section.startLine,
|
|
156
|
+
endLine: section.endLine,
|
|
157
|
+
lineCount,
|
|
158
|
+
priority,
|
|
159
|
+
reason,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Sort by priority
|
|
163
|
+
return extractable.sort((a, b) => a.priority - b.priority);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Generate optimization recommendations
|
|
167
|
+
*/
|
|
168
|
+
function generateRecommendations(lineCount, examplesLines, toolUsage, taskPatterns, extractableSections) {
|
|
169
|
+
const recommendations = [];
|
|
170
|
+
// Recommend decomposition for large skills
|
|
171
|
+
if (lineCount > THRESHOLDS.maxLinesBeforeDecompose) {
|
|
172
|
+
const sectionNames = extractableSections.slice(0, 3).map((s) => s.name);
|
|
173
|
+
recommendations.push({
|
|
174
|
+
type: 'decompose',
|
|
175
|
+
description: `Skill has ${lineCount} lines (threshold: ${THRESHOLDS.maxLinesBeforeDecompose}). Decompose into main SKILL.md + sub-skills.`,
|
|
176
|
+
estimatedSavings: Math.min(70, Math.floor((lineCount - 400) / 10)),
|
|
177
|
+
priority: 1,
|
|
178
|
+
affectedAreas: sectionNames.length > 0 ? sectionNames : ['full-content'],
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
// Recommend subagent for heavy tool usage
|
|
182
|
+
if (toolUsage.suggestsSubagent) {
|
|
183
|
+
recommendations.push({
|
|
184
|
+
type: 'subagent',
|
|
185
|
+
description: `Heavy tool usage detected (${toolUsage.bashCommandCount} bash, ${toolUsage.fileReadCount} reads). Generate companion subagent for context isolation.`,
|
|
186
|
+
estimatedSavings: 40,
|
|
187
|
+
priority: 2,
|
|
188
|
+
affectedAreas: toolUsage.detectedTools,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// Recommend parallelization for sequential Task() calls
|
|
192
|
+
if (taskPatterns.canBatch) {
|
|
193
|
+
recommendations.push({
|
|
194
|
+
type: 'parallelize',
|
|
195
|
+
description: `${taskPatterns.sequentialCalls} sequential Task() calls detected. Batch into single message for parallel execution.`,
|
|
196
|
+
estimatedSavings: taskPatterns.batchSavingsPercent,
|
|
197
|
+
priority: 2,
|
|
198
|
+
affectedAreas: ['Task-calls'],
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
// Recommend progressive disclosure for large examples
|
|
202
|
+
if (examplesLines > THRESHOLDS.largeExamplesThreshold) {
|
|
203
|
+
recommendations.push({
|
|
204
|
+
type: 'progressive-disclosure',
|
|
205
|
+
description: `Large examples section (${examplesLines} lines). Move to sub-skill for on-demand loading.`,
|
|
206
|
+
estimatedSavings: Math.min(60, Math.floor(examplesLines / 5)),
|
|
207
|
+
priority: 3,
|
|
208
|
+
affectedAreas: ['examples'],
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Sort by priority
|
|
212
|
+
return recommendations.sort((a, b) => a.priority - b.priority);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Calculate overall optimization score
|
|
216
|
+
*/
|
|
217
|
+
function calculateOptimizationScore(lineCount, toolUsage, taskPatterns, recommendations) {
|
|
218
|
+
let score = 0;
|
|
219
|
+
// Line count factor (0-40 points)
|
|
220
|
+
if (lineCount > THRESHOLDS.maxLinesBeforeDecompose) {
|
|
221
|
+
score += Math.min(40, Math.floor((lineCount - 400) / 10));
|
|
222
|
+
}
|
|
223
|
+
else if (lineCount > 300) {
|
|
224
|
+
score += Math.floor((lineCount - 300) / 20);
|
|
225
|
+
}
|
|
226
|
+
// Tool usage factor (0-30 points)
|
|
227
|
+
if (toolUsage.suggestsSubagent) {
|
|
228
|
+
score += 20;
|
|
229
|
+
}
|
|
230
|
+
score += Math.min(10, toolUsage.detectedTools.length * 2);
|
|
231
|
+
// Task pattern factor (0-20 points)
|
|
232
|
+
if (taskPatterns.canBatch) {
|
|
233
|
+
score += Math.min(20, taskPatterns.sequentialCalls * 5);
|
|
234
|
+
}
|
|
235
|
+
// Recommendation impact (0-10 points)
|
|
236
|
+
score += Math.min(10, recommendations.length * 3);
|
|
237
|
+
return Math.min(100, score);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Quick check if a skill needs transformation without full analysis
|
|
241
|
+
*
|
|
242
|
+
* @param content - The full SKILL.md content
|
|
243
|
+
* @returns Whether quick transformation check passed
|
|
244
|
+
*/
|
|
245
|
+
export function quickTransformCheck(content) {
|
|
246
|
+
const lineCount = content.split('\n').length;
|
|
247
|
+
// Quick checks that indicate transformation needed
|
|
248
|
+
if (lineCount > THRESHOLDS.maxLinesBeforeDecompose) {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
// Check for heavy tool usage patterns
|
|
252
|
+
const heavyToolPatterns = ['npm ', 'npx ', 'git ', 'docker', 'Bash('];
|
|
253
|
+
let heavyToolCount = 0;
|
|
254
|
+
for (const pattern of heavyToolPatterns) {
|
|
255
|
+
if (content.includes(pattern)) {
|
|
256
|
+
heavyToolCount++;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (heavyToolCount >= 3) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
// Check for sequential Task() calls
|
|
263
|
+
const taskMatches = content.match(/Task\s*\(/g) || [];
|
|
264
|
+
if (taskMatches.length >= THRESHOLDS.sequentialTaskThreshold) {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
export default { analyzeSkill, quickTransformCheck };
|
|
270
|
+
//# sourceMappingURL=SkillAnalyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillAnalyzer.js","sourceRoot":"","sources":["../../../src/services/SkillAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH,OAAO,EACL,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAA;AAEnC,mDAAmD;AACnD,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,4BAA4B,CAAA;AAEnC;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAA;IAE9B,mBAAmB;IACnB,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IAE9E,qBAAqB;I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G,EAAE,KAAK,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;IAE5C,mDAAmD;IACnD,IAAI,SAAS,GAAG,UAAU,CAAC,uBAAuB,EAAE,CAAC;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,sCAAsC;IACtC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IACrE,IAAI,cAAc,GAAG,CAAC,CAAA;IACtB,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACxC,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,cAAc,EAAE,CAAA;QAClB,CAAC;IACH,CAAC;IACD,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,oCAAoC;IACpC,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IACrD,IAAI,WAAW,CAAC,MAAM,IAAI,UAAU,CAAC,uBAAuB,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1788: SkillAnalyzer Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for skill analysis and optimization detection.
|
|
5
|
+
* Used by the Skillsmith Optimization Layer for transforming
|
|
6
|
+
* community skills into more performant versions.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Analysis result for a skill's optimization potential
|
|
10
|
+
*/
|
|
11
|
+
export interface SkillAnalysis {
|
|
12
|
+
/** Total line count of the skill content */
|
|
13
|
+
lineCount: number;
|
|
14
|
+
/** Number of lines in the main content (excluding examples) */
|
|
15
|
+
mainContentLines: number;
|
|
16
|
+
/** Number of lines in examples section */
|
|
17
|
+
examplesLines: number;
|
|
18
|
+
/** Tools detected in the skill content */
|
|
19
|
+
toolUsage: ToolUsageAnalysis;
|
|
20
|
+
/** Task() call patterns detected */
|
|
21
|
+
taskPatterns: TaskPatternAnalysis;
|
|
22
|
+
/** Sections that could be extracted as sub-skills */
|
|
23
|
+
extractableSections: ExtractableSection[];
|
|
24
|
+
/** Recommended optimizations to apply */
|
|
25
|
+
recommendations: OptimizationRecommendation[];
|
|
26
|
+
/** Overall optimization score (0-100) */
|
|
27
|
+
optimizationScore: number;
|
|
28
|
+
/** Whether this skill would benefit from transformation */
|
|
29
|
+
shouldTransform: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Tool usage analysis result
|
|
33
|
+
*/
|
|
34
|
+
export interface ToolUsageAnalysis {
|
|
35
|
+
/** List of detected tools */
|
|
36
|
+
detectedTools: string[];
|
|
37
|
+
/** Number of Bash commands detected */
|
|
38
|
+
bashCommandCount: number;
|
|
39
|
+
/** Number of file reads detected (Read/Glob/Grep) */
|
|
40
|
+
fileReadCount: number;
|
|
41
|
+
/** Number of file writes detected (Write/Edit) */
|
|
42
|
+
fileWriteCount: number;
|
|
43
|
+
/** Whether heavy tool usage suggests subagent */
|
|
44
|
+
suggestsSubagent: boolean;
|
|
45
|
+
/** Confidence in tool detection */
|
|
46
|
+
confidence: 'high' | 'medium' | 'low';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Task() call pattern analysis
|
|
50
|
+
*/
|
|
51
|
+
export interface TaskPatternAnalysis {
|
|
52
|
+
/** Total number of Task() calls detected */
|
|
53
|
+
taskCallCount: number;
|
|
54
|
+
/** Number of sequential Task() calls that could be parallelized */
|
|
55
|
+
sequentialCalls: number;
|
|
56
|
+
/** Whether Task() calls can be batched */
|
|
57
|
+
canBatch: boolean;
|
|
58
|
+
/** Estimated token savings from batching (percentage) */
|
|
59
|
+
batchSavingsPercent: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Section that could be extracted as a sub-skill
|
|
63
|
+
*/
|
|
64
|
+
export interface ExtractableSection {
|
|
65
|
+
/** Section name/title */
|
|
66
|
+
name: string;
|
|
67
|
+
/** Start line number */
|
|
68
|
+
startLine: number;
|
|
69
|
+
/** End line number */
|
|
70
|
+
endLine: number;
|
|
71
|
+
/** Number of lines */
|
|
72
|
+
lineCount: number;
|
|
73
|
+
/** Extraction priority (1 = highest) */
|
|
74
|
+
priority: number;
|
|
75
|
+
/** Reason for extraction recommendation */
|
|
76
|
+
reason: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Optimization recommendation
|
|
80
|
+
*/
|
|
81
|
+
export interface OptimizationRecommendation {
|
|
82
|
+
/** Recommendation type */
|
|
83
|
+
type: 'decompose' | 'parallelize' | 'subagent' | 'progressive-disclosure';
|
|
84
|
+
/** Human-readable description */
|
|
85
|
+
description: string;
|
|
86
|
+
/** Estimated token savings (percentage) */
|
|
87
|
+
estimatedSavings: number;
|
|
88
|
+
/** Priority (1 = highest) */
|
|
89
|
+
priority: number;
|
|
90
|
+
/** Affected sections or patterns */
|
|
91
|
+
affectedAreas: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Parsed section from skill content
|
|
95
|
+
*/
|
|
96
|
+
export interface ParsedSection {
|
|
97
|
+
/** Section name/title */
|
|
98
|
+
name: string;
|
|
99
|
+
/** Start line number */
|
|
100
|
+
startLine: number;
|
|
101
|
+
/** End line number */
|
|
102
|
+
endLine: number;
|
|
103
|
+
/** Full section content */
|
|
104
|
+
content: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Confidence level type
|
|
108
|
+
*/
|
|
109
|
+
export type ConfidenceLevel = 'high' | 'medium' | 'low';
|
|
110
|
+
//# sourceMappingURL=SkillAnalyzer.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillAnalyzer.types.d.ts","sourceRoot":"","sources":["../../../src/services/SkillAnalyzer.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IAEjB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAA;IAExB,0CAA0C;IAC1C,aAAa,EAAE,MAAM,CAAA;IAErB,0CAA0C;IAC1C,SAAS,EAAE,iBAAiB,CAAA;IAE5B,oCAAoC;IACpC,YAAY,EAAE,mBAAmB,CAAA;IAEjC,qDAAqD;IACrD,mBAAmB,EAAE,kBAAkB,EAAE,CAAA;IAEzC,yCAAyC;IACzC,eAAe,EAAE,0BAA0B,EAAE,CAAA;IAE7C,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAA;IAEzB,2DAA2D;IAC3D,eAAe,EAAE,OAAO,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,EAAE,CAAA;IAEvB,uCAAuC;IACvC,gBAAgB,EAAE,MAAM,CAAA;IAExB,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAA;IAErB,kDAAkD;IAClD,cAAc,EAAE,MAAM,CAAA;IAEtB,iDAAiD;IACjD,gBAAgB,EAAE,OAAO,CAAA;IAEzB,mCAAmC;IACnC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAA;IAErB,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAA;IAEvB,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAA;IAEjB,yDAAyD;IACzD,mBAAmB,EAAE,MAAM,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IAEZ,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAA;IAEjB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAA;IAEf,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAA;IAEjB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAA;IAEhB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,0BAA0B;IAC1B,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,wBAAwB,CAAA;IAEzE,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAA;IAEnB,2CAA2C;IAC3C,gBAAgB,EAAE,MAAM,CAAA;IAExB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAEhB,oCAAoC;IACpC,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IAEZ,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAA;IAEjB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAA;IAEf,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1788: SkillAnalyzer Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for skill analysis and optimization detection.
|
|
5
|
+
* Used by the Skillsmith Optimization Layer for transforming
|
|
6
|
+
* community skills into more performant versions.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=SkillAnalyzer.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillAnalyzer.types.js","sourceRoot":"","sources":["../../../src/services/SkillAnalyzer.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|