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,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Git Functions
|
|
3
|
+
*
|
|
4
|
+
* Git operations for sandbox use.
|
|
5
|
+
* Uses child_process.execSync for git commands.
|
|
6
|
+
*/
|
|
7
|
+
import { execSync } from "child_process";
|
|
8
|
+
import { validatePath } from "../security/path-validator.js";
|
|
9
|
+
const GIT_TIMEOUT = 5000; // 5 seconds
|
|
10
|
+
/**
|
|
11
|
+
* Blocked git commands that could access network or modify remote state
|
|
12
|
+
*/
|
|
13
|
+
const BLOCKED_GIT_COMMANDS = [
|
|
14
|
+
"push",
|
|
15
|
+
"fetch",
|
|
16
|
+
"pull",
|
|
17
|
+
"clone",
|
|
18
|
+
"remote",
|
|
19
|
+
"submodule",
|
|
20
|
+
"ls-remote",
|
|
21
|
+
"archive",
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Sanitize git argument to prevent shell injection
|
|
25
|
+
*/
|
|
26
|
+
function sanitizeGitArg(arg) {
|
|
27
|
+
// Block shell metacharacters that could enable command injection
|
|
28
|
+
if (/[;&|`$(){}[\]<>\\!'"]/.test(arg)) {
|
|
29
|
+
throw new Error(`Invalid git argument: contains shell metacharacters`);
|
|
30
|
+
}
|
|
31
|
+
// Block newlines which could inject additional commands
|
|
32
|
+
if (/[\r\n]/.test(arg)) {
|
|
33
|
+
throw new Error(`Invalid git argument: contains newlines`);
|
|
34
|
+
}
|
|
35
|
+
return arg;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validate git command is not blocked
|
|
39
|
+
*/
|
|
40
|
+
function validateGitCommand(command) {
|
|
41
|
+
const cmd = command.toLowerCase();
|
|
42
|
+
if (BLOCKED_GIT_COMMANDS.includes(cmd)) {
|
|
43
|
+
throw new Error(`Git command '${command}' is blocked for security reasons`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Execute git command safely
|
|
48
|
+
*/
|
|
49
|
+
function execGit(args, workingDir) {
|
|
50
|
+
// Validate the git subcommand
|
|
51
|
+
if (args.length > 0 && args[0]) {
|
|
52
|
+
validateGitCommand(args[0]);
|
|
53
|
+
}
|
|
54
|
+
// Sanitize all arguments
|
|
55
|
+
const sanitizedArgs = args.map(sanitizeGitArg);
|
|
56
|
+
try {
|
|
57
|
+
const result = execSync(`git ${sanitizedArgs.join(" ")}`, {
|
|
58
|
+
cwd: workingDir,
|
|
59
|
+
timeout: GIT_TIMEOUT,
|
|
60
|
+
encoding: "utf-8",
|
|
61
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
62
|
+
});
|
|
63
|
+
return result.trim();
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const err = error;
|
|
67
|
+
const stderr = err.stderr?.toString().trim() || "";
|
|
68
|
+
if (stderr.includes("not a git repository")) {
|
|
69
|
+
throw new Error("Not a git repository");
|
|
70
|
+
}
|
|
71
|
+
throw new Error(stderr || err.message || "Git command failed");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parse git diff --numstat output
|
|
76
|
+
*/
|
|
77
|
+
function parseDiffStats(numstat) {
|
|
78
|
+
const files = [];
|
|
79
|
+
let totalAdditions = 0;
|
|
80
|
+
let totalDeletions = 0;
|
|
81
|
+
for (const line of numstat.split("\n")) {
|
|
82
|
+
if (!line.trim())
|
|
83
|
+
continue;
|
|
84
|
+
const parts = line.split("\t");
|
|
85
|
+
if (parts.length < 3)
|
|
86
|
+
continue;
|
|
87
|
+
const addStr = parts[0] ?? "";
|
|
88
|
+
const delStr = parts[1] ?? "";
|
|
89
|
+
const file = parts[2] ?? "";
|
|
90
|
+
const additions = addStr === "-" ? 0 : parseInt(addStr, 10);
|
|
91
|
+
const deletions = delStr === "-" ? 0 : parseInt(delStr, 10);
|
|
92
|
+
totalAdditions += additions;
|
|
93
|
+
totalDeletions += deletions;
|
|
94
|
+
files.push({
|
|
95
|
+
file,
|
|
96
|
+
status: "modified", // Will be refined below
|
|
97
|
+
additions,
|
|
98
|
+
deletions,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return { files, additions: totalAdditions, deletions: totalDeletions };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Refine file status from diff --name-status
|
|
105
|
+
*/
|
|
106
|
+
function refineFileStatuses(files, nameStatus) {
|
|
107
|
+
const statusMap = new Map();
|
|
108
|
+
for (const line of nameStatus.split("\n")) {
|
|
109
|
+
if (!line.trim())
|
|
110
|
+
continue;
|
|
111
|
+
const parts = line.split("\t");
|
|
112
|
+
const status = parts[0];
|
|
113
|
+
const file = parts[parts.length - 1]; // Handle renames (R100 old new)
|
|
114
|
+
if (!status || !file)
|
|
115
|
+
continue;
|
|
116
|
+
switch (status[0]) {
|
|
117
|
+
case "A":
|
|
118
|
+
statusMap.set(file, "added");
|
|
119
|
+
break;
|
|
120
|
+
case "D":
|
|
121
|
+
statusMap.set(file, "deleted");
|
|
122
|
+
break;
|
|
123
|
+
case "R":
|
|
124
|
+
statusMap.set(file, "renamed");
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
statusMap.set(file, "modified");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return files.map((f) => ({
|
|
131
|
+
...f,
|
|
132
|
+
status: statusMap.get(f.file) || f.status,
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Parse git log output (custom format)
|
|
137
|
+
*/
|
|
138
|
+
function parseLogOutput(output) {
|
|
139
|
+
const commits = [];
|
|
140
|
+
const entries = output.split("\n---COMMIT---\n").filter(Boolean);
|
|
141
|
+
for (const entry of entries) {
|
|
142
|
+
const lines = entry.split("\n");
|
|
143
|
+
if (lines.length < 4)
|
|
144
|
+
continue;
|
|
145
|
+
commits.push({
|
|
146
|
+
hash: lines[0] || "",
|
|
147
|
+
shortHash: lines[1] || "",
|
|
148
|
+
author: lines[2] || "",
|
|
149
|
+
date: lines[3] || "",
|
|
150
|
+
message: lines.slice(4).join("\n").trim(),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return commits;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Parse git blame output (porcelain format)
|
|
157
|
+
*/
|
|
158
|
+
function parseBlameOutput(output) {
|
|
159
|
+
const lines = [];
|
|
160
|
+
const chunks = output.split(/^([a-f0-9]{40})/m).filter(Boolean);
|
|
161
|
+
for (let i = 0; i < chunks.length; i += 2) {
|
|
162
|
+
const hash = chunks[i];
|
|
163
|
+
const data = chunks[i + 1] || "";
|
|
164
|
+
const authorMatch = data.match(/^author (.+)$/m);
|
|
165
|
+
const dateMatch = data.match(/^author-time (\d+)$/m);
|
|
166
|
+
const lineMatch = data.match(/^(\d+) \d+ \d+$/m);
|
|
167
|
+
const contentMatch = data.match(/\t(.*)$/m);
|
|
168
|
+
const lineNum = lineMatch?.[1];
|
|
169
|
+
if (hash && lineNum) {
|
|
170
|
+
const authorTime = dateMatch?.[1];
|
|
171
|
+
lines.push({
|
|
172
|
+
hash: hash.slice(0, 7),
|
|
173
|
+
author: authorMatch?.[1] ?? "Unknown",
|
|
174
|
+
date: authorTime
|
|
175
|
+
? new Date(parseInt(authorTime, 10) * 1000).toISOString()
|
|
176
|
+
: "",
|
|
177
|
+
line: parseInt(lineNum, 10),
|
|
178
|
+
content: contentMatch?.[1] ?? "",
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return lines;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Parse git status --porcelain output
|
|
186
|
+
*/
|
|
187
|
+
function parseStatusOutput(porcelain, branchInfo) {
|
|
188
|
+
const staged = [];
|
|
189
|
+
const modified = [];
|
|
190
|
+
const untracked = [];
|
|
191
|
+
for (const line of porcelain.split("\n")) {
|
|
192
|
+
if (!line.trim())
|
|
193
|
+
continue;
|
|
194
|
+
const index = line[0];
|
|
195
|
+
const worktree = line[1];
|
|
196
|
+
const file = line.slice(3);
|
|
197
|
+
if (index === "?") {
|
|
198
|
+
untracked.push(file);
|
|
199
|
+
}
|
|
200
|
+
else if (index !== " ") {
|
|
201
|
+
staged.push(file);
|
|
202
|
+
}
|
|
203
|
+
else if (worktree !== " ") {
|
|
204
|
+
modified.push(file);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Parse branch info: "## main...origin/main [ahead 1, behind 2]"
|
|
208
|
+
let branch = "HEAD";
|
|
209
|
+
let ahead = 0;
|
|
210
|
+
let behind = 0;
|
|
211
|
+
const branchMatch = branchInfo.match(/^## ([^.]+)/);
|
|
212
|
+
const branchName = branchMatch?.[1];
|
|
213
|
+
if (branchName) {
|
|
214
|
+
branch = branchName;
|
|
215
|
+
}
|
|
216
|
+
const aheadMatch = branchInfo.match(/ahead (\d+)/);
|
|
217
|
+
const aheadNum = aheadMatch?.[1];
|
|
218
|
+
if (aheadNum) {
|
|
219
|
+
ahead = parseInt(aheadNum, 10);
|
|
220
|
+
}
|
|
221
|
+
const behindMatch = branchInfo.match(/behind (\d+)/);
|
|
222
|
+
const behindNum = behindMatch?.[1];
|
|
223
|
+
if (behindNum) {
|
|
224
|
+
behind = parseInt(behindNum, 10);
|
|
225
|
+
}
|
|
226
|
+
return { branch, ahead, behind, staged, modified, untracked };
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Create Git API for sandbox
|
|
230
|
+
*/
|
|
231
|
+
export function createGitAPI(workingDir) {
|
|
232
|
+
return {
|
|
233
|
+
/**
|
|
234
|
+
* Get git diff
|
|
235
|
+
* @param ref - Optional ref to diff against (default: HEAD)
|
|
236
|
+
*/
|
|
237
|
+
diff(ref) {
|
|
238
|
+
const refArg = ref || "HEAD";
|
|
239
|
+
// Get the raw diff
|
|
240
|
+
const raw = execGit(["diff", refArg], workingDir);
|
|
241
|
+
// Get stats
|
|
242
|
+
const numstat = execGit(["diff", "--numstat", refArg], workingDir);
|
|
243
|
+
const { files, additions, deletions } = parseDiffStats(numstat);
|
|
244
|
+
// Get file statuses
|
|
245
|
+
const nameStatus = execGit(["diff", "--name-status", refArg], workingDir);
|
|
246
|
+
const refinedFiles = refineFileStatuses(files, nameStatus);
|
|
247
|
+
return {
|
|
248
|
+
raw,
|
|
249
|
+
files: refinedFiles,
|
|
250
|
+
stats: { additions, deletions },
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* Get git log
|
|
255
|
+
* @param limit - Number of commits to return (default: 10)
|
|
256
|
+
*/
|
|
257
|
+
log(limit) {
|
|
258
|
+
const count = Math.min(limit || 10, 100); // Cap at 100
|
|
259
|
+
const format = "%H%n%h%n%an%n%aI%n%s%n---COMMIT---";
|
|
260
|
+
const output = execGit(["log", `-${count}`, `--format=${format}`], workingDir);
|
|
261
|
+
return parseLogOutput(output);
|
|
262
|
+
},
|
|
263
|
+
/**
|
|
264
|
+
* Get git blame for a file
|
|
265
|
+
* @param file - File path to blame
|
|
266
|
+
* @param line - Optional specific line number
|
|
267
|
+
*/
|
|
268
|
+
blame(file, line) {
|
|
269
|
+
// Validate file path
|
|
270
|
+
const validation = validatePath(file, workingDir);
|
|
271
|
+
if (!validation.safe) {
|
|
272
|
+
throw new Error(validation.error || "Invalid file path");
|
|
273
|
+
}
|
|
274
|
+
const args = ["blame", "--porcelain"];
|
|
275
|
+
if (line !== undefined) {
|
|
276
|
+
args.push(`-L${line},${line}`);
|
|
277
|
+
}
|
|
278
|
+
args.push("--", file);
|
|
279
|
+
const output = execGit(args, workingDir);
|
|
280
|
+
return { lines: parseBlameOutput(output) };
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* Get git status
|
|
284
|
+
*/
|
|
285
|
+
status() {
|
|
286
|
+
const porcelain = execGit(["status", "--porcelain"], workingDir);
|
|
287
|
+
const branchInfo = execGit(["status", "--porcelain", "-b"], workingDir);
|
|
288
|
+
// First line of -b output is branch info
|
|
289
|
+
const firstLine = branchInfo.split("\n")[0] || "";
|
|
290
|
+
return parseStatusOutput(porcelain, firstLine);
|
|
291
|
+
},
|
|
292
|
+
/**
|
|
293
|
+
* Get git branch info
|
|
294
|
+
*/
|
|
295
|
+
branch() {
|
|
296
|
+
// Get current branch
|
|
297
|
+
let current = "";
|
|
298
|
+
try {
|
|
299
|
+
current = execGit(["rev-parse", "--abbrev-ref", "HEAD"], workingDir);
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
current = "HEAD";
|
|
303
|
+
}
|
|
304
|
+
// Get all branches
|
|
305
|
+
const branchOutput = execGit(["branch", "--format=%(refname:short)"], workingDir);
|
|
306
|
+
const branches = branchOutput
|
|
307
|
+
.split("\n")
|
|
308
|
+
.map((b) => b.trim())
|
|
309
|
+
.filter(Boolean);
|
|
310
|
+
return { current, branches };
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.test.d.ts","sourceRoot":"","sources":["../../../src/sandbox/sdk/git.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git SDK Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests for ctx.git.* functions.
|
|
5
|
+
* These tests run against the actual git repository.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect, beforeAll } from "vitest";
|
|
8
|
+
import { createGitAPI } from "./git.js";
|
|
9
|
+
import { execSync } from "child_process";
|
|
10
|
+
// Check if git is available in the test environment
|
|
11
|
+
function isGitAvailable() {
|
|
12
|
+
try {
|
|
13
|
+
execSync("git --version", {
|
|
14
|
+
encoding: "utf-8",
|
|
15
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
16
|
+
});
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Get repository root from git
|
|
24
|
+
function getGitRoot() {
|
|
25
|
+
try {
|
|
26
|
+
return execSync("git rev-parse --show-toplevel", {
|
|
27
|
+
encoding: "utf-8",
|
|
28
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
29
|
+
}).trim();
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const gitAvailable = isGitAvailable();
|
|
36
|
+
const repoRoot = gitAvailable ? getGitRoot() : null;
|
|
37
|
+
describe.skipIf(!gitAvailable || !repoRoot)("Git SDK", () => {
|
|
38
|
+
let git;
|
|
39
|
+
beforeAll(() => {
|
|
40
|
+
git = createGitAPI(repoRoot);
|
|
41
|
+
});
|
|
42
|
+
describe("status", () => {
|
|
43
|
+
it("should return branch name", () => {
|
|
44
|
+
const status = git.status();
|
|
45
|
+
expect(status.branch).toBeDefined();
|
|
46
|
+
expect(typeof status.branch).toBe("string");
|
|
47
|
+
});
|
|
48
|
+
it("should return ahead/behind counts", () => {
|
|
49
|
+
const status = git.status();
|
|
50
|
+
expect(typeof status.ahead).toBe("number");
|
|
51
|
+
expect(typeof status.behind).toBe("number");
|
|
52
|
+
});
|
|
53
|
+
it("should return file arrays", () => {
|
|
54
|
+
const status = git.status();
|
|
55
|
+
expect(Array.isArray(status.staged)).toBe(true);
|
|
56
|
+
expect(Array.isArray(status.modified)).toBe(true);
|
|
57
|
+
expect(Array.isArray(status.untracked)).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("branch", () => {
|
|
61
|
+
it("should return current branch", () => {
|
|
62
|
+
const branch = git.branch();
|
|
63
|
+
expect(branch.current).toBeDefined();
|
|
64
|
+
expect(typeof branch.current).toBe("string");
|
|
65
|
+
});
|
|
66
|
+
it("should return branches array", () => {
|
|
67
|
+
const branch = git.branch();
|
|
68
|
+
expect(Array.isArray(branch.branches)).toBe(true);
|
|
69
|
+
expect(branch.branches.length).toBeGreaterThan(0);
|
|
70
|
+
});
|
|
71
|
+
it("should include current branch in branches list", () => {
|
|
72
|
+
const branch = git.branch();
|
|
73
|
+
expect(branch.branches).toContain(branch.current);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe("log", () => {
|
|
77
|
+
it("should return commit history", () => {
|
|
78
|
+
const commits = git.log();
|
|
79
|
+
expect(Array.isArray(commits)).toBe(true);
|
|
80
|
+
expect(commits.length).toBeGreaterThan(0);
|
|
81
|
+
});
|
|
82
|
+
it("should return commits with required fields", () => {
|
|
83
|
+
const commits = git.log(1);
|
|
84
|
+
expect(commits.length).toBe(1);
|
|
85
|
+
const commit = commits[0];
|
|
86
|
+
expect(commit.hash).toBeDefined();
|
|
87
|
+
expect(commit.hash.length).toBe(40);
|
|
88
|
+
expect(commit.shortHash).toBeDefined();
|
|
89
|
+
expect(commit.shortHash.length).toBe(7);
|
|
90
|
+
expect(commit.author).toBeDefined();
|
|
91
|
+
expect(commit.date).toBeDefined();
|
|
92
|
+
expect(commit.message).toBeDefined();
|
|
93
|
+
});
|
|
94
|
+
it("should respect limit parameter", () => {
|
|
95
|
+
const commits5 = git.log(5);
|
|
96
|
+
expect(commits5.length).toBeLessThanOrEqual(5);
|
|
97
|
+
const commits2 = git.log(2);
|
|
98
|
+
expect(commits2.length).toBeLessThanOrEqual(2);
|
|
99
|
+
});
|
|
100
|
+
it("should default to 10 commits", () => {
|
|
101
|
+
const commits = git.log();
|
|
102
|
+
expect(commits.length).toBeLessThanOrEqual(10);
|
|
103
|
+
});
|
|
104
|
+
it("should cap at 100 commits", () => {
|
|
105
|
+
const commits = git.log(200);
|
|
106
|
+
expect(commits.length).toBeLessThanOrEqual(100);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe("diff", () => {
|
|
110
|
+
it("should return diff structure", () => {
|
|
111
|
+
const diff = git.diff();
|
|
112
|
+
expect(diff).toBeDefined();
|
|
113
|
+
expect(typeof diff.raw).toBe("string");
|
|
114
|
+
expect(Array.isArray(diff.files)).toBe(true);
|
|
115
|
+
expect(typeof diff.stats.additions).toBe("number");
|
|
116
|
+
expect(typeof diff.stats.deletions).toBe("number");
|
|
117
|
+
});
|
|
118
|
+
it("should return file changes with proper fields", () => {
|
|
119
|
+
// This test depends on there being changes
|
|
120
|
+
const diff = git.diff();
|
|
121
|
+
if (diff.files.length > 0) {
|
|
122
|
+
const file = diff.files[0];
|
|
123
|
+
expect(file.file).toBeDefined();
|
|
124
|
+
expect(["added", "modified", "deleted", "renamed"]).toContain(file.status);
|
|
125
|
+
expect(typeof file.additions).toBe("number");
|
|
126
|
+
expect(typeof file.deletions).toBe("number");
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
describe("blame", () => {
|
|
131
|
+
it("should return blame for existing file", () => {
|
|
132
|
+
// Test on package.json which should always exist
|
|
133
|
+
const blame = git.blame("package.json");
|
|
134
|
+
expect(blame.lines).toBeDefined();
|
|
135
|
+
expect(Array.isArray(blame.lines)).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it("should return blame lines with proper fields", () => {
|
|
138
|
+
const blame = git.blame("package.json");
|
|
139
|
+
if (blame.lines.length > 0) {
|
|
140
|
+
const line = blame.lines[0];
|
|
141
|
+
expect(line.hash).toBeDefined();
|
|
142
|
+
expect(line.author).toBeDefined();
|
|
143
|
+
expect(typeof line.line).toBe("number");
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
it("should support line parameter", () => {
|
|
147
|
+
const blame = git.blame("package.json", 1);
|
|
148
|
+
expect(blame.lines.length).toBeLessThanOrEqual(1);
|
|
149
|
+
});
|
|
150
|
+
it("should throw for non-existent file", () => {
|
|
151
|
+
expect(() => git.blame("non-existent-file-xyz.ts")).toThrow();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
describe("error handling", () => {
|
|
155
|
+
it("should throw for non-git directory", () => {
|
|
156
|
+
const nonGitApi = createGitAPI("/tmp");
|
|
157
|
+
expect(() => nonGitApi.status()).toThrow("Not a git repository");
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Entry Point
|
|
3
|
+
*
|
|
4
|
+
* All SDK functions available in the sandbox.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./compress.js";
|
|
7
|
+
export * from "./code.js";
|
|
8
|
+
export { createFilesAPI } from "./files.js";
|
|
9
|
+
export { createGitAPI } from "./git.js";
|
|
10
|
+
export { createSearchAPI } from "./search.js";
|
|
11
|
+
export { createAnalyzeAPI } from "./analyze.js";
|
|
12
|
+
export { createPipelineAPI } from "./pipeline.js";
|
|
13
|
+
export { createMultifileAPI } from "./multifile.js";
|
|
14
|
+
export { createConversationAPI } from "./conversation.js";
|
|
15
|
+
export * from "./utils.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sandbox/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Entry Point
|
|
3
|
+
*
|
|
4
|
+
* All SDK functions available in the sandbox.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./compress.js";
|
|
7
|
+
export * from "./code.js";
|
|
8
|
+
export { createFilesAPI } from "./files.js";
|
|
9
|
+
export { createGitAPI } from "./git.js";
|
|
10
|
+
export { createSearchAPI } from "./search.js";
|
|
11
|
+
export { createAnalyzeAPI } from "./analyze.js";
|
|
12
|
+
export { createPipelineAPI } from "./pipeline.js";
|
|
13
|
+
export { createMultifileAPI } from "./multifile.js";
|
|
14
|
+
export { createConversationAPI } from "./conversation.js";
|
|
15
|
+
export * from "./utils.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Multi-File Functions
|
|
3
|
+
*
|
|
4
|
+
* Multi-file compression and analysis for sandbox use.
|
|
5
|
+
* Provides cross-file deduplication, skeleton extraction, and chunking.
|
|
6
|
+
*/
|
|
7
|
+
import type { HostCallbacks } from "../types.js";
|
|
8
|
+
import { type MultiFileCompressResult, type SharedElements, type ChunkInfo } from "../../compressors/multifile.js";
|
|
9
|
+
/**
|
|
10
|
+
* SDK Multi-file compress options (simplified)
|
|
11
|
+
*/
|
|
12
|
+
export interface SdkMultiFileOptions {
|
|
13
|
+
/** Maximum tokens for output */
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
/** Compression strategy */
|
|
16
|
+
strategy?: "deduplicate" | "skeleton" | "smart-chunk";
|
|
17
|
+
/** File patterns to preserve fully */
|
|
18
|
+
preservePatterns?: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create multi-file API with host callbacks
|
|
22
|
+
*/
|
|
23
|
+
export declare function createMultifileAPI(workingDir: string, callbacks: HostCallbacks): {
|
|
24
|
+
/**
|
|
25
|
+
* Compress multiple files with cross-file deduplication
|
|
26
|
+
*
|
|
27
|
+
* @param patterns - Glob patterns for files to include
|
|
28
|
+
* @param options - Compression options
|
|
29
|
+
* @returns Compressed result with shared elements and stats
|
|
30
|
+
*/
|
|
31
|
+
compress(patterns: string[], options?: SdkMultiFileOptions): MultiFileCompressResult;
|
|
32
|
+
/**
|
|
33
|
+
* Extract shared elements (imports, types) across files
|
|
34
|
+
*
|
|
35
|
+
* @param patterns - Glob patterns for files to analyze
|
|
36
|
+
* @returns Shared imports, types, and constants
|
|
37
|
+
*/
|
|
38
|
+
extractShared(patterns: string[]): SharedElements;
|
|
39
|
+
/**
|
|
40
|
+
* Create chunks from files for incremental processing
|
|
41
|
+
*
|
|
42
|
+
* @param patterns - Glob patterns for files to chunk
|
|
43
|
+
* @param maxTokensPerChunk - Maximum tokens per chunk
|
|
44
|
+
* @returns Array of chunk information
|
|
45
|
+
*/
|
|
46
|
+
chunk(patterns: string[], maxTokensPerChunk: number): ChunkInfo[];
|
|
47
|
+
/**
|
|
48
|
+
* Get dependency-aware skeletons for files
|
|
49
|
+
*
|
|
50
|
+
* @param patterns - Glob patterns for entry point files
|
|
51
|
+
* @param depth - Optional depth limit for dependency traversal
|
|
52
|
+
* @returns Compressed skeleton output
|
|
53
|
+
*/
|
|
54
|
+
skeletons(patterns: string[], depth?: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* Read multiple files into a combined context
|
|
57
|
+
*
|
|
58
|
+
* @param patterns - Glob patterns for files to read
|
|
59
|
+
* @returns Combined file contents with headers
|
|
60
|
+
*/
|
|
61
|
+
readAll(patterns: string[]): string;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=multifile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multifile.d.ts","sourceRoot":"","sources":["../../../src/sandbox/sdk/multifile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,gCAAgC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,aAAa,GAAG,UAAU,GAAG,aAAa,CAAC;IACtD,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,aAAa;IAmCtB;;;;;;OAMG;uBAES,MAAM,EAAE,YACR,mBAAmB,GAC5B,uBAAuB;IAyB1B;;;;;OAKG;4BACqB,MAAM,EAAE,GAAG,cAAc;IAKjD;;;;;;OAMG;oBACa,MAAM,EAAE,qBAAqB,MAAM,GAAG,SAAS,EAAE;IAKjE;;;;;;OAMG;wBACiB,MAAM,EAAE,UAAU,MAAM,GAAG,MAAM;IAerD;;;;;OAKG;sBACe,MAAM,EAAE,GAAG,MAAM;EAiBtC"}
|