distill-mcp 0.6.0-beta
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/bin/cli.js +133 -0
- package/dist/analytics/session-tracker.d.ts +74 -0
- package/dist/analytics/session-tracker.d.ts.map +1 -0
- package/dist/analytics/session-tracker.js +123 -0
- package/dist/ast/benchmark.test.d.ts +7 -0
- package/dist/ast/benchmark.test.d.ts.map +1 -0
- package/dist/ast/benchmark.test.js +175 -0
- package/dist/ast/go/index.d.ts +9 -0
- package/dist/ast/go/index.d.ts.map +1 -0
- package/dist/ast/go/index.js +8 -0
- package/dist/ast/go/parser.d.ts +31 -0
- package/dist/ast/go/parser.d.ts.map +1 -0
- package/dist/ast/go/parser.js +428 -0
- package/dist/ast/go/parser.test.d.ts +5 -0
- package/dist/ast/go/parser.test.d.ts.map +1 -0
- package/dist/ast/go/parser.test.js +241 -0
- package/dist/ast/go/queries.d.ts +51 -0
- package/dist/ast/go/queries.d.ts.map +1 -0
- package/dist/ast/go/queries.js +114 -0
- package/dist/ast/go/utils.d.ts +66 -0
- package/dist/ast/go/utils.d.ts.map +1 -0
- package/dist/ast/go/utils.js +140 -0
- package/dist/ast/index.d.ts +39 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +245 -0
- package/dist/ast/php/index.d.ts +9 -0
- package/dist/ast/php/index.d.ts.map +1 -0
- package/dist/ast/php/index.js +8 -0
- package/dist/ast/php/parser.d.ts +31 -0
- package/dist/ast/php/parser.d.ts.map +1 -0
- package/dist/ast/php/parser.js +388 -0
- package/dist/ast/php/parser.test.d.ts +5 -0
- package/dist/ast/php/parser.test.d.ts.map +1 -0
- package/dist/ast/php/parser.test.js +328 -0
- package/dist/ast/php/queries.d.ts +61 -0
- package/dist/ast/php/queries.d.ts.map +1 -0
- package/dist/ast/php/queries.js +117 -0
- package/dist/ast/php/utils.d.ts +83 -0
- package/dist/ast/php/utils.d.ts.map +1 -0
- package/dist/ast/php/utils.js +246 -0
- package/dist/ast/python/index.d.ts +9 -0
- package/dist/ast/python/index.d.ts.map +1 -0
- package/dist/ast/python/index.js +8 -0
- package/dist/ast/python/parser.d.ts +32 -0
- package/dist/ast/python/parser.d.ts.map +1 -0
- package/dist/ast/python/parser.js +422 -0
- package/dist/ast/python/parser.test.d.ts +5 -0
- package/dist/ast/python/parser.test.d.ts.map +1 -0
- package/dist/ast/python/parser.test.js +186 -0
- package/dist/ast/python/queries.d.ts +73 -0
- package/dist/ast/python/queries.d.ts.map +1 -0
- package/dist/ast/python/queries.js +137 -0
- package/dist/ast/python/utils.d.ts +63 -0
- package/dist/ast/python/utils.d.ts.map +1 -0
- package/dist/ast/python/utils.js +159 -0
- package/dist/ast/quick-scan.d.ts +40 -0
- package/dist/ast/quick-scan.d.ts.map +1 -0
- package/dist/ast/quick-scan.js +287 -0
- package/dist/ast/rust/index.d.ts +9 -0
- package/dist/ast/rust/index.d.ts.map +1 -0
- package/dist/ast/rust/index.js +8 -0
- package/dist/ast/rust/parser.d.ts +31 -0
- package/dist/ast/rust/parser.d.ts.map +1 -0
- package/dist/ast/rust/parser.js +416 -0
- package/dist/ast/rust/parser.test.d.ts +5 -0
- package/dist/ast/rust/parser.test.d.ts.map +1 -0
- package/dist/ast/rust/parser.test.js +329 -0
- package/dist/ast/rust/queries.d.ts +66 -0
- package/dist/ast/rust/queries.d.ts.map +1 -0
- package/dist/ast/rust/queries.js +132 -0
- package/dist/ast/rust/utils.d.ts +91 -0
- package/dist/ast/rust/utils.d.ts.map +1 -0
- package/dist/ast/rust/utils.js +254 -0
- package/dist/ast/swift/index.d.ts +10 -0
- package/dist/ast/swift/index.d.ts.map +1 -0
- package/dist/ast/swift/index.js +8 -0
- package/dist/ast/swift/parser.d.ts +31 -0
- package/dist/ast/swift/parser.d.ts.map +1 -0
- package/dist/ast/swift/parser.js +554 -0
- package/dist/ast/swift/parser.test.d.ts +5 -0
- package/dist/ast/swift/parser.test.d.ts.map +1 -0
- package/dist/ast/swift/parser.test.js +398 -0
- package/dist/ast/swift/queries.d.ts +71 -0
- package/dist/ast/swift/queries.d.ts.map +1 -0
- package/dist/ast/swift/queries.js +137 -0
- package/dist/ast/swift/utils.d.ts +94 -0
- package/dist/ast/swift/utils.d.ts.map +1 -0
- package/dist/ast/swift/utils.js +411 -0
- package/dist/ast/types.d.ts +96 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +21 -0
- package/dist/ast/typescript.d.ts +24 -0
- package/dist/ast/typescript.d.ts.map +1 -0
- package/dist/ast/typescript.js +357 -0
- package/dist/cache/file-hash.d.ts +33 -0
- package/dist/cache/file-hash.d.ts.map +1 -0
- package/dist/cache/file-hash.js +59 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +8 -0
- package/dist/cache/smart-cache.d.ts +68 -0
- package/dist/cache/smart-cache.d.ts.map +1 -0
- package/dist/cache/smart-cache.js +266 -0
- package/dist/cache/types.d.ts +102 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +6 -0
- package/dist/cli/analyze.d.ts +43 -0
- package/dist/cli/analyze.d.ts.map +1 -0
- package/dist/cli/analyze.js +250 -0
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +127 -0
- package/dist/cli/hooks.d.ts +14 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +229 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/setup.d.ts +10 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +117 -0
- package/dist/cli/utils.d.ts +30 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +116 -0
- package/dist/compressors/config.d.ts +9 -0
- package/dist/compressors/config.d.ts.map +1 -0
- package/dist/compressors/config.js +183 -0
- package/dist/compressors/conversation.d.ts +109 -0
- package/dist/compressors/conversation.d.ts.map +1 -0
- package/dist/compressors/conversation.js +404 -0
- package/dist/compressors/diff.d.ts +35 -0
- package/dist/compressors/diff.d.ts.map +1 -0
- package/dist/compressors/diff.js +389 -0
- package/dist/compressors/generic.d.ts +9 -0
- package/dist/compressors/generic.d.ts.map +1 -0
- package/dist/compressors/generic.js +188 -0
- package/dist/compressors/index.d.ts +31 -0
- package/dist/compressors/index.d.ts.map +1 -0
- package/dist/compressors/index.js +82 -0
- package/dist/compressors/logs.d.ts +9 -0
- package/dist/compressors/logs.d.ts.map +1 -0
- package/dist/compressors/logs.js +245 -0
- package/dist/compressors/multifile.d.ts +106 -0
- package/dist/compressors/multifile.d.ts.map +1 -0
- package/dist/compressors/multifile.js +498 -0
- package/dist/compressors/semantic.d.ts +33 -0
- package/dist/compressors/semantic.d.ts.map +1 -0
- package/dist/compressors/semantic.js +233 -0
- package/dist/compressors/stacktrace.d.ts +9 -0
- package/dist/compressors/stacktrace.d.ts.map +1 -0
- package/dist/compressors/stacktrace.js +259 -0
- package/dist/compressors/types.d.ts +146 -0
- package/dist/compressors/types.d.ts.map +1 -0
- package/dist/compressors/types.js +6 -0
- package/dist/config/output-config.d.ts +56 -0
- package/dist/config/output-config.d.ts.map +1 -0
- package/dist/config/output-config.js +78 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/middleware/chain.d.ts +49 -0
- package/dist/middleware/chain.d.ts.map +1 -0
- package/dist/middleware/chain.js +126 -0
- package/dist/middleware/index.d.ts +4 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +3 -0
- package/dist/middleware/logging.d.ts +8 -0
- package/dist/middleware/logging.d.ts.map +1 -0
- package/dist/middleware/logging.js +71 -0
- package/dist/middleware/types.d.ts +58 -0
- package/dist/middleware/types.d.ts.map +1 -0
- package/dist/middleware/types.js +7 -0
- package/dist/parsers/eslint.d.ts +8 -0
- package/dist/parsers/eslint.d.ts.map +1 -0
- package/dist/parsers/eslint.js +132 -0
- package/dist/parsers/generic.d.ts +8 -0
- package/dist/parsers/generic.d.ts.map +1 -0
- package/dist/parsers/generic.js +234 -0
- package/dist/parsers/index.d.ts +34 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +216 -0
- package/dist/parsers/types.d.ts +84 -0
- package/dist/parsers/types.d.ts.map +1 -0
- package/dist/parsers/types.js +6 -0
- package/dist/parsers/typescript.d.ts +8 -0
- package/dist/parsers/typescript.d.ts.map +1 -0
- package/dist/parsers/typescript.js +107 -0
- package/dist/pipelines/definitions.d.ts +50 -0
- package/dist/pipelines/definitions.d.ts.map +1 -0
- package/dist/pipelines/definitions.js +206 -0
- package/dist/sandbox/executor.d.ts +12 -0
- package/dist/sandbox/executor.d.ts.map +1 -0
- package/dist/sandbox/executor.js +191 -0
- package/dist/sandbox/index.d.ts +11 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +9 -0
- package/dist/sandbox/sandbox.test.d.ts +7 -0
- package/dist/sandbox/sandbox.test.d.ts.map +1 -0
- package/dist/sandbox/sandbox.test.js +202 -0
- package/dist/sandbox/sdk/analyze.d.ts +36 -0
- package/dist/sandbox/sdk/analyze.d.ts.map +1 -0
- package/dist/sandbox/sdk/analyze.js +413 -0
- package/dist/sandbox/sdk/analyze.test.d.ts +7 -0
- package/dist/sandbox/sdk/analyze.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/analyze.test.js +191 -0
- package/dist/sandbox/sdk/code.d.ts +20 -0
- package/dist/sandbox/sdk/code.d.ts.map +1 -0
- package/dist/sandbox/sdk/code.js +104 -0
- package/dist/sandbox/sdk/compress.d.ts +23 -0
- package/dist/sandbox/sdk/compress.d.ts.map +1 -0
- package/dist/sandbox/sdk/compress.js +107 -0
- package/dist/sandbox/sdk/conversation.d.ts +148 -0
- package/dist/sandbox/sdk/conversation.d.ts.map +1 -0
- package/dist/sandbox/sdk/conversation.js +177 -0
- package/dist/sandbox/sdk/files.d.ts +29 -0
- package/dist/sandbox/sdk/files.d.ts.map +1 -0
- package/dist/sandbox/sdk/files.js +41 -0
- package/dist/sandbox/sdk/git.d.ts +37 -0
- package/dist/sandbox/sdk/git.d.ts.map +1 -0
- package/dist/sandbox/sdk/git.js +313 -0
- package/dist/sandbox/sdk/git.test.d.ts +8 -0
- package/dist/sandbox/sdk/git.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/git.test.js +160 -0
- package/dist/sandbox/sdk/index.d.ts +16 -0
- package/dist/sandbox/sdk/index.d.ts.map +1 -0
- package/dist/sandbox/sdk/index.js +15 -0
- package/dist/sandbox/sdk/multifile.d.ts +63 -0
- package/dist/sandbox/sdk/multifile.d.ts.map +1 -0
- package/dist/sandbox/sdk/multifile.js +130 -0
- package/dist/sandbox/sdk/pipeline.d.ts +16 -0
- package/dist/sandbox/sdk/pipeline.d.ts.map +1 -0
- package/dist/sandbox/sdk/pipeline.js +454 -0
- package/dist/sandbox/sdk/pipeline.test.d.ts +7 -0
- package/dist/sandbox/sdk/pipeline.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/pipeline.test.js +197 -0
- package/dist/sandbox/sdk/search.d.ts +36 -0
- package/dist/sandbox/sdk/search.d.ts.map +1 -0
- package/dist/sandbox/sdk/search.js +338 -0
- package/dist/sandbox/sdk/search.test.d.ts +7 -0
- package/dist/sandbox/sdk/search.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/search.test.js +183 -0
- package/dist/sandbox/sdk/utils.d.ts +18 -0
- package/dist/sandbox/sdk/utils.d.ts.map +1 -0
- package/dist/sandbox/sdk/utils.js +24 -0
- package/dist/sandbox/security/code-analyzer.d.ts +15 -0
- package/dist/sandbox/security/code-analyzer.d.ts.map +1 -0
- package/dist/sandbox/security/code-analyzer.js +87 -0
- package/dist/sandbox/security/index.d.ts +6 -0
- package/dist/sandbox/security/index.d.ts.map +1 -0
- package/dist/sandbox/security/index.js +5 -0
- package/dist/sandbox/security/path-validator.d.ts +23 -0
- package/dist/sandbox/security/path-validator.d.ts.map +1 -0
- package/dist/sandbox/security/path-validator.js +113 -0
- package/dist/sandbox/types.d.ts +577 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +14 -0
- package/dist/server.d.ts +36 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +133 -0
- package/dist/summarizers/build-logs.d.ts +11 -0
- package/dist/summarizers/build-logs.d.ts.map +1 -0
- package/dist/summarizers/build-logs.js +234 -0
- package/dist/summarizers/generic.d.ts +11 -0
- package/dist/summarizers/generic.d.ts.map +1 -0
- package/dist/summarizers/generic.js +93 -0
- package/dist/summarizers/index.d.ts +20 -0
- package/dist/summarizers/index.d.ts.map +1 -0
- package/dist/summarizers/index.js +43 -0
- package/dist/summarizers/server-logs.d.ts +11 -0
- package/dist/summarizers/server-logs.d.ts.map +1 -0
- package/dist/summarizers/server-logs.js +215 -0
- package/dist/summarizers/test-logs.d.ts +11 -0
- package/dist/summarizers/test-logs.d.ts.map +1 -0
- package/dist/summarizers/test-logs.js +258 -0
- package/dist/summarizers/types.d.ts +146 -0
- package/dist/summarizers/types.d.ts.map +1 -0
- package/dist/summarizers/types.js +21 -0
- package/dist/tools/analyze-build-output.d.ts +30 -0
- package/dist/tools/analyze-build-output.d.ts.map +1 -0
- package/dist/tools/analyze-build-output.js +45 -0
- package/dist/tools/analyze-context.d.ts +23 -0
- package/dist/tools/analyze-context.d.ts.map +1 -0
- package/dist/tools/analyze-context.js +78 -0
- package/dist/tools/auto-optimize.d.ts +9 -0
- package/dist/tools/auto-optimize.d.ts.map +1 -0
- package/dist/tools/auto-optimize.js +191 -0
- package/dist/tools/code-execute.d.ts +9 -0
- package/dist/tools/code-execute.d.ts.map +1 -0
- package/dist/tools/code-execute.js +84 -0
- package/dist/tools/code-skeleton.d.ts +33 -0
- package/dist/tools/code-skeleton.d.ts.map +1 -0
- package/dist/tools/code-skeleton.js +206 -0
- package/dist/tools/compress-context.d.ts +33 -0
- package/dist/tools/compress-context.d.ts.map +1 -0
- package/dist/tools/compress-context.js +64 -0
- package/dist/tools/context-budget.d.ts +43 -0
- package/dist/tools/context-budget.d.ts.map +1 -0
- package/dist/tools/context-budget.js +260 -0
- package/dist/tools/context-budget.test.d.ts +5 -0
- package/dist/tools/context-budget.test.d.ts.map +1 -0
- package/dist/tools/context-budget.test.js +219 -0
- package/dist/tools/conversation-compress.d.ts +46 -0
- package/dist/tools/conversation-compress.d.ts.map +1 -0
- package/dist/tools/conversation-compress.js +78 -0
- package/dist/tools/conversation-memory.d.ts +75 -0
- package/dist/tools/conversation-memory.d.ts.map +1 -0
- package/dist/tools/conversation-memory.js +289 -0
- package/dist/tools/deduplicate-errors.d.ts +30 -0
- package/dist/tools/deduplicate-errors.d.ts.map +1 -0
- package/dist/tools/deduplicate-errors.js +72 -0
- package/dist/tools/detect-retry-loop.d.ts +40 -0
- package/dist/tools/detect-retry-loop.d.ts.map +1 -0
- package/dist/tools/detect-retry-loop.js +212 -0
- package/dist/tools/diff-compress.d.ts +40 -0
- package/dist/tools/diff-compress.d.ts.map +1 -0
- package/dist/tools/diff-compress.js +94 -0
- package/dist/tools/discover-tools.d.ts +11 -0
- package/dist/tools/discover-tools.d.ts.map +1 -0
- package/dist/tools/discover-tools.js +163 -0
- package/dist/tools/dynamic-loader.d.ts +131 -0
- package/dist/tools/dynamic-loader.d.ts.map +1 -0
- package/dist/tools/dynamic-loader.js +378 -0
- package/dist/tools/dynamic-loader.test.d.ts +10 -0
- package/dist/tools/dynamic-loader.test.d.ts.map +1 -0
- package/dist/tools/dynamic-loader.test.js +164 -0
- package/dist/tools/lazy-mcp.d.ts +31 -0
- package/dist/tools/lazy-mcp.d.ts.map +1 -0
- package/dist/tools/lazy-mcp.js +151 -0
- package/dist/tools/lazy-mcp.test.d.ts +10 -0
- package/dist/tools/lazy-mcp.test.d.ts.map +1 -0
- package/dist/tools/lazy-mcp.test.js +172 -0
- package/dist/tools/multifile-compress.d.ts +36 -0
- package/dist/tools/multifile-compress.d.ts.map +1 -0
- package/dist/tools/multifile-compress.js +223 -0
- package/dist/tools/optimization-tips.d.ts +18 -0
- package/dist/tools/optimization-tips.d.ts.map +1 -0
- package/dist/tools/optimization-tips.js +133 -0
- package/dist/tools/registry.d.ts +70 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +169 -0
- package/dist/tools/semantic-compress.d.ts +39 -0
- package/dist/tools/semantic-compress.d.ts.map +1 -0
- package/dist/tools/semantic-compress.js +113 -0
- package/dist/tools/semantic-compress.test.d.ts +5 -0
- package/dist/tools/semantic-compress.test.d.ts.map +1 -0
- package/dist/tools/semantic-compress.test.js +182 -0
- package/dist/tools/session-stats.d.ts +34 -0
- package/dist/tools/session-stats.d.ts.map +1 -0
- package/dist/tools/session-stats.js +194 -0
- package/dist/tools/set-output-config.d.ts +38 -0
- package/dist/tools/set-output-config.d.ts.map +1 -0
- package/dist/tools/set-output-config.js +122 -0
- package/dist/tools/smart-cache-tool.d.ts +38 -0
- package/dist/tools/smart-cache-tool.d.ts.map +1 -0
- package/dist/tools/smart-cache-tool.js +224 -0
- package/dist/tools/smart-file-read.d.ts +52 -0
- package/dist/tools/smart-file-read.d.ts.map +1 -0
- package/dist/tools/smart-file-read.js +481 -0
- package/dist/tools/smart-pipeline.d.ts +40 -0
- package/dist/tools/smart-pipeline.d.ts.map +1 -0
- package/dist/tools/smart-pipeline.js +295 -0
- package/dist/tools/summarize-logs.d.ts +36 -0
- package/dist/tools/summarize-logs.d.ts.map +1 -0
- package/dist/tools/summarize-logs.js +184 -0
- package/dist/tools/token-budget.test.d.ts +11 -0
- package/dist/tools/token-budget.test.d.ts.map +1 -0
- package/dist/tools/token-budget.test.js +275 -0
- package/dist/utils/bm25.d.ts +86 -0
- package/dist/utils/bm25.d.ts.map +1 -0
- package/dist/utils/bm25.js +153 -0
- package/dist/utils/bm25.test.d.ts +5 -0
- package/dist/utils/bm25.test.d.ts.map +1 -0
- package/dist/utils/bm25.test.js +156 -0
- package/dist/utils/command-normalizer.d.ts +39 -0
- package/dist/utils/command-normalizer.d.ts.map +1 -0
- package/dist/utils/command-normalizer.js +90 -0
- package/dist/utils/content-detector.d.ts +27 -0
- package/dist/utils/content-detector.d.ts.map +1 -0
- package/dist/utils/content-detector.js +127 -0
- package/dist/utils/embeddings.d.ts +54 -0
- package/dist/utils/embeddings.d.ts.map +1 -0
- package/dist/utils/embeddings.js +97 -0
- package/dist/utils/embeddings.test.d.ts +8 -0
- package/dist/utils/embeddings.test.d.ts.map +1 -0
- package/dist/utils/embeddings.test.js +96 -0
- package/dist/utils/error-normalizer.d.ts +39 -0
- package/dist/utils/error-normalizer.d.ts.map +1 -0
- package/dist/utils/error-normalizer.js +233 -0
- package/dist/utils/hybrid-search.d.ts +79 -0
- package/dist/utils/hybrid-search.d.ts.map +1 -0
- package/dist/utils/hybrid-search.js +146 -0
- package/dist/utils/hybrid-search.test.d.ts +5 -0
- package/dist/utils/hybrid-search.test.d.ts.map +1 -0
- package/dist/utils/hybrid-search.test.js +172 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/language-detector.d.ts +27 -0
- package/dist/utils/language-detector.d.ts.map +1 -0
- package/dist/utils/language-detector.js +94 -0
- package/dist/utils/log-parser.d.ts +46 -0
- package/dist/utils/log-parser.d.ts.map +1 -0
- package/dist/utils/log-parser.js +287 -0
- package/dist/utils/output-estimator.d.ts +54 -0
- package/dist/utils/output-estimator.d.ts.map +1 -0
- package/dist/utils/output-estimator.js +119 -0
- package/dist/utils/output-estimator.test.d.ts +5 -0
- package/dist/utils/output-estimator.test.d.ts.map +1 -0
- package/dist/utils/output-estimator.test.js +115 -0
- package/dist/utils/output-similarity.d.ts +48 -0
- package/dist/utils/output-similarity.d.ts.map +1 -0
- package/dist/utils/output-similarity.js +140 -0
- package/dist/utils/project-detector.d.ts +16 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +119 -0
- package/dist/utils/segment-scorer.d.ts +99 -0
- package/dist/utils/segment-scorer.d.ts.map +1 -0
- package/dist/utils/segment-scorer.js +148 -0
- package/dist/utils/signature-grouper.d.ts +58 -0
- package/dist/utils/signature-grouper.d.ts.map +1 -0
- package/dist/utils/signature-grouper.js +185 -0
- package/dist/utils/tfidf.d.ts +45 -0
- package/dist/utils/tfidf.d.ts.map +1 -0
- package/dist/utils/tfidf.js +204 -0
- package/dist/utils/tfidf.test.d.ts +5 -0
- package/dist/utils/tfidf.test.d.ts.map +1 -0
- package/dist/utils/tfidf.test.js +115 -0
- package/dist/utils/token-counter.d.ts +35 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +83 -0
- package/dist/utils/toon-serializer.d.ts +120 -0
- package/dist/utils/toon-serializer.d.ts.map +1 -0
- package/dist/utils/toon-serializer.js +472 -0
- package/dist/utils/toon-serializer.test.d.ts +7 -0
- package/dist/utils/toon-serializer.test.d.ts.map +1 -0
- package/dist/utils/toon-serializer.test.js +290 -0
- package/package.json +63 -0
- package/scripts/install.ps1 +133 -0
- package/scripts/install.sh +183 -0
- package/scripts/pre-commit-hook.sh +86 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint Error Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses ESLint output in various formats (default, stylish, compact).
|
|
5
|
+
*/
|
|
6
|
+
// Default/stylish format: /path/file.js
|
|
7
|
+
// 12:5 error 'foo' is not defined no-undef
|
|
8
|
+
const ESLINT_DEFAULT_PATTERN = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s{2,}(\S+)\s*$/;
|
|
9
|
+
// File header pattern
|
|
10
|
+
const FILE_HEADER_PATTERN = /^([^\s].*\.(js|jsx|ts|tsx|mjs|cjs|vue|svelte))$/;
|
|
11
|
+
// Compact format: /path/file.js: line 12, col 5, Error - 'foo' is not defined (no-undef)
|
|
12
|
+
const ESLINT_COMPACT_PATTERN = /^(.+?):\s*line\s+(\d+),\s*col\s+(\d+),\s*(Error|Warning)\s+-\s+(.+?)\s*\((\S+)\)\s*$/;
|
|
13
|
+
// Summary pattern
|
|
14
|
+
const SUMMARY_PATTERN = /(\d+)\s+problems?\s*\((\d+)\s+errors?,\s*(\d+)\s+warnings?\)/;
|
|
15
|
+
/**
|
|
16
|
+
* Get suggestion based on ESLint rule
|
|
17
|
+
*/
|
|
18
|
+
function getSuggestion(rule, message) {
|
|
19
|
+
switch (rule) {
|
|
20
|
+
case "no-undef": {
|
|
21
|
+
const undefMatch = message.match(/'(\w+)' is not defined/);
|
|
22
|
+
if (undefMatch?.[1]) {
|
|
23
|
+
return `Import or declare '${undefMatch[1]}' before using it.`;
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case "no-unused-vars":
|
|
28
|
+
return "Remove the unused variable or use it in your code.";
|
|
29
|
+
case "no-console":
|
|
30
|
+
return "Remove console statements or disable the rule for development.";
|
|
31
|
+
case "semi":
|
|
32
|
+
return "Add or remove semicolons consistently.";
|
|
33
|
+
case "quotes":
|
|
34
|
+
return "Use consistent quote style (single or double).";
|
|
35
|
+
case "indent":
|
|
36
|
+
return "Fix indentation to match the configured style.";
|
|
37
|
+
case "@typescript-eslint/no-explicit-any":
|
|
38
|
+
return "Replace 'any' with a more specific type.";
|
|
39
|
+
case "@typescript-eslint/no-unused-vars":
|
|
40
|
+
return "Remove the unused variable or prefix with underscore.";
|
|
41
|
+
case "react-hooks/rules-of-hooks":
|
|
42
|
+
return "Hooks can only be called at the top level of a function component.";
|
|
43
|
+
case "react-hooks/exhaustive-deps":
|
|
44
|
+
return "Add missing dependencies to the dependency array.";
|
|
45
|
+
case "import/no-unresolved":
|
|
46
|
+
return "Check if the module exists and is properly installed.";
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create error signature for grouping
|
|
52
|
+
*/
|
|
53
|
+
function createSignature(rule, message) {
|
|
54
|
+
const normalizedMessage = message
|
|
55
|
+
.replace(/'[^']+'/g, "'X'")
|
|
56
|
+
.replace(/"[^"]+"/g, '"X"')
|
|
57
|
+
.replace(/\d+/g, "N")
|
|
58
|
+
.replace(/\s+/g, " ")
|
|
59
|
+
.trim();
|
|
60
|
+
return `${rule}:${normalizedMessage}`;
|
|
61
|
+
}
|
|
62
|
+
export const eslintParser = {
|
|
63
|
+
name: "eslint",
|
|
64
|
+
supportedTools: ["eslint"],
|
|
65
|
+
canParse(output) {
|
|
66
|
+
return (ESLINT_DEFAULT_PATTERN.test(output) ||
|
|
67
|
+
ESLINT_COMPACT_PATTERN.test(output) ||
|
|
68
|
+
SUMMARY_PATTERN.test(output) ||
|
|
69
|
+
(output.includes("error") && output.includes("warning") && /\d+:\d+/.test(output)));
|
|
70
|
+
},
|
|
71
|
+
parse(output) {
|
|
72
|
+
const errors = [];
|
|
73
|
+
const lines = output.split("\n");
|
|
74
|
+
let currentFile = "";
|
|
75
|
+
for (const line of lines) {
|
|
76
|
+
const trimmed = line.trim();
|
|
77
|
+
if (!trimmed)
|
|
78
|
+
continue;
|
|
79
|
+
// Check for file header
|
|
80
|
+
const fileMatch = line.match(FILE_HEADER_PATTERN);
|
|
81
|
+
if (fileMatch?.[1]) {
|
|
82
|
+
currentFile = fileMatch[1];
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
// Try default/stylish format
|
|
86
|
+
const defaultMatch = trimmed.match(ESLINT_DEFAULT_PATTERN);
|
|
87
|
+
if (defaultMatch && currentFile) {
|
|
88
|
+
const lineNum = defaultMatch[1] ?? "0";
|
|
89
|
+
const colNum = defaultMatch[2] ?? "0";
|
|
90
|
+
const severityStr = defaultMatch[3] ?? "error";
|
|
91
|
+
const message = defaultMatch[4] ?? "Unknown error";
|
|
92
|
+
const rule = defaultMatch[5] ?? "unknown-rule";
|
|
93
|
+
const severity = severityStr === "warning" ? "warning" : "error";
|
|
94
|
+
errors.push({
|
|
95
|
+
signature: createSignature(rule, message),
|
|
96
|
+
code: rule,
|
|
97
|
+
message,
|
|
98
|
+
file: currentFile,
|
|
99
|
+
line: parseInt(lineNum, 10),
|
|
100
|
+
column: parseInt(colNum, 10),
|
|
101
|
+
severity,
|
|
102
|
+
raw: `${currentFile}: ${trimmed}`,
|
|
103
|
+
context: getSuggestion(rule, message),
|
|
104
|
+
});
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
// Try compact format
|
|
108
|
+
const compactMatch = trimmed.match(ESLINT_COMPACT_PATTERN);
|
|
109
|
+
if (compactMatch) {
|
|
110
|
+
const file = compactMatch[1] ?? "unknown";
|
|
111
|
+
const lineNum = compactMatch[2] ?? "0";
|
|
112
|
+
const colNum = compactMatch[3] ?? "0";
|
|
113
|
+
const severityStr = compactMatch[4] ?? "Error";
|
|
114
|
+
const message = compactMatch[5] ?? "Unknown error";
|
|
115
|
+
const rule = compactMatch[6] ?? "unknown-rule";
|
|
116
|
+
const severity = severityStr.toLowerCase() === "warning" ? "warning" : "error";
|
|
117
|
+
errors.push({
|
|
118
|
+
signature: createSignature(rule, message),
|
|
119
|
+
code: rule,
|
|
120
|
+
message,
|
|
121
|
+
file,
|
|
122
|
+
line: parseInt(lineNum, 10),
|
|
123
|
+
column: parseInt(colNum, 10),
|
|
124
|
+
severity,
|
|
125
|
+
raw: trimmed,
|
|
126
|
+
context: getSuggestion(rule, message),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return errors;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/parsers/generic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAoC,MAAM,YAAY,CAAC;AAkPhF,eAAO,MAAM,aAAa,EAAE,WAwB3B,CAAC"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Build Error Parser
|
|
3
|
+
*
|
|
4
|
+
* Handles various build tools: Webpack, Vite, esbuild, Rust, Go, etc.
|
|
5
|
+
*/
|
|
6
|
+
// Webpack error patterns
|
|
7
|
+
const WEBPACK_ERROR_PATTERN = /^ERROR in (.+?)(?::(\d+):(\d+))?$/;
|
|
8
|
+
const WEBPACK_MODULE_ERROR = /Module (?:build )?failed.+?:\s*(.+)/;
|
|
9
|
+
// Rust/Cargo error patterns
|
|
10
|
+
const RUST_ERROR_PATTERN = /^error\[E(\d+)\]: (.+)/;
|
|
11
|
+
const RUST_LOCATION_PATTERN = /^\s+--> (.+?):(\d+):(\d+)/;
|
|
12
|
+
// Go error patterns
|
|
13
|
+
const GO_ERROR_PATTERN = /^(.+?):(\d+):(\d+):\s*(.+)/;
|
|
14
|
+
// Generic error/warning patterns (fallback)
|
|
15
|
+
const GENERIC_ERROR_LINE = /^(?:error|Error|ERROR)(?:\[([^\]]+)\])?[:\s]+(.+)/i;
|
|
16
|
+
const GENERIC_WARNING_LINE = /^(?:warning|Warning|WARNING)(?:\[([^\]]+)\])?[:\s]+(.+)/i;
|
|
17
|
+
const GENERIC_LOCATION = /^(?:\s*(?:at|in|-->)\s+)?(.+?):(\d+)(?::(\d+))?/;
|
|
18
|
+
/**
|
|
19
|
+
* Detect build tool from output
|
|
20
|
+
*/
|
|
21
|
+
function detectToolFromOutput(output) {
|
|
22
|
+
if (output.includes("ERROR in") || output.includes("webpack")) {
|
|
23
|
+
return "webpack";
|
|
24
|
+
}
|
|
25
|
+
if (output.includes("[vite]") || output.includes("vite")) {
|
|
26
|
+
return "vite";
|
|
27
|
+
}
|
|
28
|
+
if (output.includes("✘ [ERROR]") || output.includes("esbuild")) {
|
|
29
|
+
return "esbuild";
|
|
30
|
+
}
|
|
31
|
+
if (output.includes("error[E") || output.includes("cargo") || output.includes("rustc")) {
|
|
32
|
+
return "rust";
|
|
33
|
+
}
|
|
34
|
+
if (GO_ERROR_PATTERN.test(output)) {
|
|
35
|
+
return "go";
|
|
36
|
+
}
|
|
37
|
+
return "generic";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create signature from code and message
|
|
41
|
+
*/
|
|
42
|
+
function createSignature(code, message) {
|
|
43
|
+
const normalizedMessage = message
|
|
44
|
+
.replace(/'[^']+'/g, "'X'")
|
|
45
|
+
.replace(/"[^"]+"/g, '"X"')
|
|
46
|
+
.replace(/`[^`]+`/g, "`X`")
|
|
47
|
+
.replace(/\d+/g, "N")
|
|
48
|
+
.replace(/\s+/g, " ")
|
|
49
|
+
.slice(0, 100)
|
|
50
|
+
.trim();
|
|
51
|
+
return `${code}:${normalizedMessage}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parse Webpack output
|
|
55
|
+
*/
|
|
56
|
+
function parseWebpack(output) {
|
|
57
|
+
const errors = [];
|
|
58
|
+
const lines = output.split("\n");
|
|
59
|
+
let currentError = null;
|
|
60
|
+
for (const line of lines) {
|
|
61
|
+
const errorMatch = line.match(WEBPACK_ERROR_PATTERN);
|
|
62
|
+
if (errorMatch) {
|
|
63
|
+
if (currentError?.message) {
|
|
64
|
+
errors.push(currentError);
|
|
65
|
+
}
|
|
66
|
+
const file = errorMatch[1] ?? "unknown";
|
|
67
|
+
const lineNum = errorMatch[2] ?? "0";
|
|
68
|
+
const colNum = errorMatch[3] ?? "0";
|
|
69
|
+
currentError = {
|
|
70
|
+
file,
|
|
71
|
+
line: parseInt(lineNum, 10),
|
|
72
|
+
column: parseInt(colNum, 10),
|
|
73
|
+
severity: "error",
|
|
74
|
+
code: "WEBPACK",
|
|
75
|
+
message: "",
|
|
76
|
+
raw: line,
|
|
77
|
+
signature: "",
|
|
78
|
+
};
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const moduleError = line.match(WEBPACK_MODULE_ERROR);
|
|
82
|
+
if (moduleError?.[1] && currentError) {
|
|
83
|
+
currentError.message = moduleError[1];
|
|
84
|
+
currentError.signature = createSignature("WEBPACK", moduleError[1]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (currentError?.message) {
|
|
88
|
+
errors.push(currentError);
|
|
89
|
+
}
|
|
90
|
+
return errors;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parse Rust/Cargo output
|
|
94
|
+
*/
|
|
95
|
+
function parseRust(output) {
|
|
96
|
+
const errors = [];
|
|
97
|
+
const lines = output.split("\n");
|
|
98
|
+
let currentError = null;
|
|
99
|
+
for (const line of lines) {
|
|
100
|
+
const errorMatch = line.match(RUST_ERROR_PATTERN);
|
|
101
|
+
if (errorMatch) {
|
|
102
|
+
if (currentError?.message) {
|
|
103
|
+
errors.push(currentError);
|
|
104
|
+
}
|
|
105
|
+
const code = `E${errorMatch[1] ?? "0000"}`;
|
|
106
|
+
const message = errorMatch[2] ?? "Unknown error";
|
|
107
|
+
currentError = {
|
|
108
|
+
code,
|
|
109
|
+
message,
|
|
110
|
+
severity: "error",
|
|
111
|
+
file: "unknown",
|
|
112
|
+
line: 0,
|
|
113
|
+
column: 0,
|
|
114
|
+
raw: line,
|
|
115
|
+
signature: createSignature(code, message),
|
|
116
|
+
};
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const locationMatch = line.match(RUST_LOCATION_PATTERN);
|
|
120
|
+
if (locationMatch && currentError) {
|
|
121
|
+
currentError.file = locationMatch[1] ?? "unknown";
|
|
122
|
+
currentError.line = parseInt(locationMatch[2] ?? "0", 10);
|
|
123
|
+
currentError.column = parseInt(locationMatch[3] ?? "0", 10);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (currentError?.message) {
|
|
127
|
+
errors.push(currentError);
|
|
128
|
+
}
|
|
129
|
+
return errors;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Parse Go output
|
|
133
|
+
*/
|
|
134
|
+
function parseGo(output) {
|
|
135
|
+
const errors = [];
|
|
136
|
+
const lines = output.split("\n");
|
|
137
|
+
for (const line of lines) {
|
|
138
|
+
const match = line.match(GO_ERROR_PATTERN);
|
|
139
|
+
if (match) {
|
|
140
|
+
const file = match[1] ?? "unknown";
|
|
141
|
+
const lineNum = match[2] ?? "0";
|
|
142
|
+
const colNum = match[3] ?? "0";
|
|
143
|
+
const message = match[4] ?? "Unknown error";
|
|
144
|
+
errors.push({
|
|
145
|
+
signature: createSignature("GO", message),
|
|
146
|
+
code: "GO",
|
|
147
|
+
message,
|
|
148
|
+
file,
|
|
149
|
+
line: parseInt(lineNum, 10),
|
|
150
|
+
column: parseInt(colNum, 10),
|
|
151
|
+
severity: "error",
|
|
152
|
+
raw: line,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return errors;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Parse generic output (fallback)
|
|
160
|
+
*/
|
|
161
|
+
function parseGeneric(output) {
|
|
162
|
+
const errors = [];
|
|
163
|
+
const lines = output.split("\n");
|
|
164
|
+
let lastLocation = null;
|
|
165
|
+
for (const line of lines) {
|
|
166
|
+
// Check for location
|
|
167
|
+
const locationMatch = line.match(GENERIC_LOCATION);
|
|
168
|
+
if (locationMatch) {
|
|
169
|
+
lastLocation = {
|
|
170
|
+
file: locationMatch[1] ?? "unknown",
|
|
171
|
+
line: parseInt(locationMatch[2] ?? "0", 10),
|
|
172
|
+
column: locationMatch[3] ? parseInt(locationMatch[3], 10) : 0,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// Check for error
|
|
176
|
+
const errorMatch = line.match(GENERIC_ERROR_LINE);
|
|
177
|
+
if (errorMatch) {
|
|
178
|
+
const code = errorMatch[1] ?? "ERROR";
|
|
179
|
+
const message = errorMatch[2] ?? "Unknown error";
|
|
180
|
+
errors.push({
|
|
181
|
+
signature: createSignature(code, message),
|
|
182
|
+
code,
|
|
183
|
+
message,
|
|
184
|
+
file: lastLocation?.file ?? "unknown",
|
|
185
|
+
line: lastLocation?.line ?? 0,
|
|
186
|
+
column: lastLocation?.column ?? 0,
|
|
187
|
+
severity: "error",
|
|
188
|
+
raw: line,
|
|
189
|
+
});
|
|
190
|
+
lastLocation = null;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
// Check for warning
|
|
194
|
+
const warningMatch = line.match(GENERIC_WARNING_LINE);
|
|
195
|
+
if (warningMatch) {
|
|
196
|
+
const code = warningMatch[1] ?? "WARNING";
|
|
197
|
+
const message = warningMatch[2] ?? "Unknown warning";
|
|
198
|
+
errors.push({
|
|
199
|
+
signature: createSignature(code, message),
|
|
200
|
+
code,
|
|
201
|
+
message,
|
|
202
|
+
file: lastLocation?.file ?? "unknown",
|
|
203
|
+
line: lastLocation?.line ?? 0,
|
|
204
|
+
column: lastLocation?.column ?? 0,
|
|
205
|
+
severity: "warning",
|
|
206
|
+
raw: line,
|
|
207
|
+
});
|
|
208
|
+
lastLocation = null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return errors;
|
|
212
|
+
}
|
|
213
|
+
export const genericParser = {
|
|
214
|
+
name: "generic",
|
|
215
|
+
supportedTools: ["webpack", "vite", "esbuild", "rust", "go", "generic"],
|
|
216
|
+
canParse(_output) {
|
|
217
|
+
return true;
|
|
218
|
+
},
|
|
219
|
+
parse(output) {
|
|
220
|
+
const tool = detectToolFromOutput(output);
|
|
221
|
+
switch (tool) {
|
|
222
|
+
case "webpack":
|
|
223
|
+
case "vite":
|
|
224
|
+
case "esbuild":
|
|
225
|
+
return parseWebpack(output);
|
|
226
|
+
case "rust":
|
|
227
|
+
return parseRust(output);
|
|
228
|
+
case "go":
|
|
229
|
+
return parseGo(output);
|
|
230
|
+
default:
|
|
231
|
+
return parseGeneric(output);
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Output Parsers
|
|
3
|
+
*
|
|
4
|
+
* Auto-detection and routing for various build tool outputs.
|
|
5
|
+
*/
|
|
6
|
+
import type { ParsedError, ErrorGroup, BuildAnalysisResult, BuildTool } from "./types.js";
|
|
7
|
+
export * from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Detect the build tool from output
|
|
10
|
+
*/
|
|
11
|
+
export declare function detectBuildTool(output: string): BuildTool;
|
|
12
|
+
/**
|
|
13
|
+
* Parse build output using the appropriate parser
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseOutput(output: string): {
|
|
16
|
+
tool: BuildTool;
|
|
17
|
+
errors: ParsedError[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Group errors by signature
|
|
21
|
+
*/
|
|
22
|
+
export declare function groupErrors(errors: ParsedError[]): ErrorGroup[];
|
|
23
|
+
/**
|
|
24
|
+
* Generate a compressed summary from error groups
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateSummary(groups: ErrorGroup[], buildTool: BuildTool, verbosity?: "minimal" | "normal" | "detailed"): string;
|
|
27
|
+
/**
|
|
28
|
+
* Analyze build output and return compressed result
|
|
29
|
+
*/
|
|
30
|
+
export declare function analyzeBuildOutput(output: string, options?: {
|
|
31
|
+
buildTool?: BuildTool;
|
|
32
|
+
verbosity?: "minimal" | "normal" | "detailed";
|
|
33
|
+
}): BuildAnalysisResult;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAe,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvG,cAAc,YAAY,CAAC;AAe3B;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAwCzD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAYtF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,CAmC/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAAE,EACpB,SAAS,EAAE,SAAS,EACpB,SAAS,GAAE,SAAS,GAAG,QAAQ,GAAG,UAAqB,GACtD,MAAM,CA+FR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC1C,GACL,mBAAmB,CAoCrB"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Output Parsers
|
|
3
|
+
*
|
|
4
|
+
* Auto-detection and routing for various build tool outputs.
|
|
5
|
+
*/
|
|
6
|
+
import { encodingForModel } from "js-tiktoken";
|
|
7
|
+
import { typescriptParser } from "./typescript.js";
|
|
8
|
+
import { eslintParser } from "./eslint.js";
|
|
9
|
+
import { genericParser } from "./generic.js";
|
|
10
|
+
export * from "./types.js";
|
|
11
|
+
// All available parsers (order matters for detection priority)
|
|
12
|
+
const parsers = [typescriptParser, eslintParser, genericParser];
|
|
13
|
+
// Token encoder
|
|
14
|
+
const encoding = encodingForModel("gpt-4");
|
|
15
|
+
/**
|
|
16
|
+
* Count tokens in a string
|
|
17
|
+
*/
|
|
18
|
+
function countTokens(text) {
|
|
19
|
+
return encoding.encode(text).length;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Detect the build tool from output
|
|
23
|
+
*/
|
|
24
|
+
export function detectBuildTool(output) {
|
|
25
|
+
// TypeScript
|
|
26
|
+
if (output.includes("error TS") || output.includes("warning TS")) {
|
|
27
|
+
return "tsc";
|
|
28
|
+
}
|
|
29
|
+
// ESLint
|
|
30
|
+
if ((output.includes("error") && output.includes("warning") && /\d+:\d+/.test(output)) ||
|
|
31
|
+
output.includes("eslint")) {
|
|
32
|
+
return "eslint";
|
|
33
|
+
}
|
|
34
|
+
// Webpack
|
|
35
|
+
if (output.includes("ERROR in") || output.includes("webpack")) {
|
|
36
|
+
return "webpack";
|
|
37
|
+
}
|
|
38
|
+
// Vite
|
|
39
|
+
if (output.includes("[vite]")) {
|
|
40
|
+
return "vite";
|
|
41
|
+
}
|
|
42
|
+
// esbuild
|
|
43
|
+
if (output.includes("✘ [ERROR]")) {
|
|
44
|
+
return "esbuild";
|
|
45
|
+
}
|
|
46
|
+
// Rust
|
|
47
|
+
if (output.includes("error[E") || output.includes("rustc")) {
|
|
48
|
+
return "rust";
|
|
49
|
+
}
|
|
50
|
+
// Go
|
|
51
|
+
if (/\.go:\d+:\d+:/.test(output)) {
|
|
52
|
+
return "go";
|
|
53
|
+
}
|
|
54
|
+
return "generic";
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse build output using the appropriate parser
|
|
58
|
+
*/
|
|
59
|
+
export function parseOutput(output) {
|
|
60
|
+
const tool = detectBuildTool(output);
|
|
61
|
+
// Find the best parser
|
|
62
|
+
for (const parser of parsers) {
|
|
63
|
+
if (parser.canParse(output)) {
|
|
64
|
+
return { tool, errors: parser.parse(output) };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Fallback to generic
|
|
68
|
+
return { tool, errors: genericParser.parse(output) };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Group errors by signature
|
|
72
|
+
*/
|
|
73
|
+
export function groupErrors(errors) {
|
|
74
|
+
const groups = new Map();
|
|
75
|
+
for (const error of errors) {
|
|
76
|
+
const existing = groups.get(error.signature);
|
|
77
|
+
if (existing) {
|
|
78
|
+
existing.count++;
|
|
79
|
+
if (!existing.affectedFiles.includes(error.file)) {
|
|
80
|
+
existing.affectedFiles.push(error.file);
|
|
81
|
+
}
|
|
82
|
+
if (existing.samples.length < 3) {
|
|
83
|
+
existing.samples.push(error.raw);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
groups.set(error.signature, {
|
|
88
|
+
signature: error.signature,
|
|
89
|
+
code: error.code,
|
|
90
|
+
message: error.message,
|
|
91
|
+
severity: error.severity,
|
|
92
|
+
count: 1,
|
|
93
|
+
firstOccurrence: {
|
|
94
|
+
file: error.file,
|
|
95
|
+
line: error.line,
|
|
96
|
+
column: error.column,
|
|
97
|
+
},
|
|
98
|
+
affectedFiles: [error.file],
|
|
99
|
+
samples: [error.raw],
|
|
100
|
+
suggestion: error.context,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Sort by count (most frequent first)
|
|
105
|
+
return Array.from(groups.values()).sort((a, b) => b.count - a.count);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Generate a compressed summary from error groups
|
|
109
|
+
*/
|
|
110
|
+
export function generateSummary(groups, buildTool, verbosity = "normal") {
|
|
111
|
+
const errorGroups = groups.filter((g) => g.severity === "error");
|
|
112
|
+
const warningGroups = groups.filter((g) => g.severity === "warning");
|
|
113
|
+
const totalErrors = errorGroups.reduce((sum, g) => sum + g.count, 0);
|
|
114
|
+
const totalWarnings = warningGroups.reduce((sum, g) => sum + g.count, 0);
|
|
115
|
+
const parts = [];
|
|
116
|
+
// Header
|
|
117
|
+
if (totalErrors > 0) {
|
|
118
|
+
parts.push(`**Build failed** with ${totalErrors} error${totalErrors > 1 ? "s" : ""} (${errorGroups.length} unique type${errorGroups.length > 1 ? "s" : ""})${totalWarnings > 0 ? ` and ${totalWarnings} warning${totalWarnings > 1 ? "s" : ""}` : ""}`);
|
|
119
|
+
}
|
|
120
|
+
else if (totalWarnings > 0) {
|
|
121
|
+
parts.push(`**Build succeeded** with ${totalWarnings} warning${totalWarnings > 1 ? "s" : ""} (${warningGroups.length} unique type${warningGroups.length > 1 ? "s" : ""})`);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
parts.push("**Build succeeded** with no errors or warnings.");
|
|
125
|
+
return parts.join("\n");
|
|
126
|
+
}
|
|
127
|
+
parts.push("");
|
|
128
|
+
// Error groups
|
|
129
|
+
if (errorGroups.length > 0) {
|
|
130
|
+
parts.push("### Errors\n");
|
|
131
|
+
const maxGroups = verbosity === "minimal" ? 3 : verbosity === "normal" ? 5 : 10;
|
|
132
|
+
const displayGroups = errorGroups.slice(0, maxGroups);
|
|
133
|
+
for (let i = 0; i < displayGroups.length; i++) {
|
|
134
|
+
const group = displayGroups[i];
|
|
135
|
+
if (!group)
|
|
136
|
+
continue;
|
|
137
|
+
parts.push(`**${i + 1}. ${group.code}**: ${group.message}`);
|
|
138
|
+
parts.push(` - Occurrences: ${group.count}`);
|
|
139
|
+
parts.push(` - First: \`${group.firstOccurrence.file}:${group.firstOccurrence.line}\``);
|
|
140
|
+
if (group.affectedFiles.length > 1) {
|
|
141
|
+
const fileList = group.affectedFiles.length <= 3
|
|
142
|
+
? group.affectedFiles.join(", ")
|
|
143
|
+
: `${group.affectedFiles.slice(0, 3).join(", ")}, +${group.affectedFiles.length - 3} more`;
|
|
144
|
+
parts.push(` - Files: ${fileList}`);
|
|
145
|
+
}
|
|
146
|
+
if (group.suggestion && verbosity !== "minimal") {
|
|
147
|
+
parts.push(` - 💡 ${group.suggestion}`);
|
|
148
|
+
}
|
|
149
|
+
parts.push("");
|
|
150
|
+
}
|
|
151
|
+
if (errorGroups.length > maxGroups) {
|
|
152
|
+
parts.push(`*...and ${errorGroups.length - maxGroups} more error types*\n`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Warning groups (only in normal/detailed)
|
|
156
|
+
if (warningGroups.length > 0 && verbosity !== "minimal") {
|
|
157
|
+
parts.push("### Warnings\n");
|
|
158
|
+
const maxWarnings = verbosity === "normal" ? 3 : 5;
|
|
159
|
+
const displayWarnings = warningGroups.slice(0, maxWarnings);
|
|
160
|
+
for (const group of displayWarnings) {
|
|
161
|
+
parts.push(`- **${group.code}**: ${group.message} (${group.count}x)`);
|
|
162
|
+
}
|
|
163
|
+
if (warningGroups.length > maxWarnings) {
|
|
164
|
+
parts.push(`- *...and ${warningGroups.length - maxWarnings} more warning types*`);
|
|
165
|
+
}
|
|
166
|
+
parts.push("");
|
|
167
|
+
}
|
|
168
|
+
// Quick fix suggestion
|
|
169
|
+
if (errorGroups.length > 0 && errorGroups.length <= 3) {
|
|
170
|
+
const suggestions = errorGroups
|
|
171
|
+
.filter((g) => g.suggestion)
|
|
172
|
+
.map((g) => g.suggestion)
|
|
173
|
+
.slice(0, 2);
|
|
174
|
+
if (suggestions.length > 0) {
|
|
175
|
+
parts.push("### Quick Fix");
|
|
176
|
+
parts.push(suggestions.join(" "));
|
|
177
|
+
parts.push("");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
parts.push(`*Analyzed by CtxOpt (${buildTool})*`);
|
|
181
|
+
return parts.join("\n");
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Analyze build output and return compressed result
|
|
185
|
+
*/
|
|
186
|
+
export function analyzeBuildOutput(output, options = {}) {
|
|
187
|
+
const tokensOriginal = countTokens(output);
|
|
188
|
+
// Parse output
|
|
189
|
+
const { tool, errors } = parseOutput(output);
|
|
190
|
+
const buildTool = options.buildTool || tool;
|
|
191
|
+
// Group errors
|
|
192
|
+
const allGroups = groupErrors(errors);
|
|
193
|
+
const errorGroups = allGroups.filter((g) => g.severity === "error");
|
|
194
|
+
const warningGroups = allGroups.filter((g) => g.severity === "warning");
|
|
195
|
+
// Generate summary
|
|
196
|
+
const summary = generateSummary(allGroups, buildTool, options.verbosity || "normal");
|
|
197
|
+
const tokensCompressed = countTokens(summary);
|
|
198
|
+
const totalErrors = errorGroups.reduce((sum, g) => sum + g.count, 0);
|
|
199
|
+
const totalWarnings = warningGroups.reduce((sum, g) => sum + g.count, 0);
|
|
200
|
+
return {
|
|
201
|
+
buildTool,
|
|
202
|
+
success: totalErrors === 0,
|
|
203
|
+
summary,
|
|
204
|
+
stats: {
|
|
205
|
+
totalErrors,
|
|
206
|
+
totalWarnings,
|
|
207
|
+
uniqueErrorTypes: errorGroups.length,
|
|
208
|
+
uniqueWarningTypes: warningGroups.length,
|
|
209
|
+
tokensOriginal,
|
|
210
|
+
tokensCompressed,
|
|
211
|
+
reductionPercent: tokensOriginal > 0 ? Math.round((1 - tokensCompressed / tokensOriginal) * 100) : 0,
|
|
212
|
+
},
|
|
213
|
+
errorGroups,
|
|
214
|
+
warningGroups,
|
|
215
|
+
};
|
|
216
|
+
}
|