@gitkraken/core-gitlens 0.5.110 → 0.5.111
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/CHANGELOG.md +16 -1
- package/dist/git/cache.d.ts +111 -6
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +312 -43
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +11 -0
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/models/fileStatus.d.ts +1 -0
- package/dist/git/models/fileStatus.d.ts.map +1 -1
- package/dist/git/models/fileStatus.js +1 -0
- package/dist/git/models/fileStatus.js.map +1 -1
- package/dist/git/models/issue.d.ts +4 -0
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/mergeConflicts.d.ts +2 -0
- package/dist/git/models/mergeConflicts.d.ts.map +1 -1
- package/dist/git/models/pullRequest.d.ts +38 -2
- package/dist/git/models/pullRequest.d.ts.map +1 -1
- package/dist/git/models/pullRequest.js +12 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/repository.d.ts +32 -5
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +58 -12
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/models/statusFile.d.ts.map +1 -1
- package/dist/git/models/statusFile.js +3 -0
- package/dist/git/models/statusFile.js.map +1 -1
- package/dist/git/providers/branches.d.ts +2 -0
- package/dist/git/providers/branches.d.ts.map +1 -1
- package/dist/git/providers/commits.d.ts +8 -0
- package/dist/git/providers/commits.d.ts.map +1 -1
- package/dist/git/providers/config.d.ts +19 -1
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/operations.d.ts +1 -0
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts +2 -0
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/status.d.ts +1 -0
- package/dist/git/providers/status.d.ts.map +1 -1
- package/dist/git/utils/config.utils.d.ts +3 -0
- package/dist/git/utils/config.utils.d.ts.map +1 -0
- package/dist/git/utils/config.utils.js +8 -0
- package/dist/git/utils/config.utils.js.map +1 -0
- package/dist/git/utils/issue.utils.d.ts.map +1 -1
- package/dist/git/utils/issue.utils.js +2 -0
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.d.ts +14 -0
- package/dist/git/utils/pausedOperationStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.js +23 -0
- package/dist/git/utils/pausedOperationStatus.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts +14 -1
- package/dist/git/utils/pullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/pullRequest.utils.js +31 -0
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +6 -1
- package/dist/git/watching/changeEvent.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.js +14 -1
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +18 -3
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +8 -1
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- package/dist/git/watching/watchSession.js +38 -6
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +2 -2
- package/dist/git/watching/watcherPatterns.d.ts.map +1 -1
- package/dist/git/watching/watcherPatterns.js +1 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +1 -1
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +13 -3
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +19 -0
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +282 -78
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +4 -0
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +84 -11
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +42 -0
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +186 -5
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.d.ts.map +1 -1
- package/dist/git-cli/providers/contributors.js +1 -1
- package/dist/git-cli/providers/contributors.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +2 -2
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +27 -9
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +40 -12
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +5 -0
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +87 -16
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +5 -3
- package/dist/git-cli/providers/refs.d.ts.map +1 -1
- package/dist/git-cli/providers/refs.js +33 -4
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +1 -0
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +18 -3
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts.map +1 -1
- package/dist/git-cli/providers/worktrees.js +4 -0
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts.map +1 -1
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts +39 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.js +978 -71
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +24 -2
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +84 -9
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/types.d.ts +37 -2
- package/dist/plus/agents/types.d.ts.map +1 -1
- package/dist/plus/agents/types.js +2 -0
- package/dist/plus/agents/types.js.map +1 -1
- package/dist/plus/ai/errors.d.ts +10 -0
- package/dist/plus/ai/errors.d.ts.map +1 -1
- package/dist/plus/ai/errors.js +29 -0
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +4 -0
- package/dist/plus/ai/models/model.d.ts.map +1 -1
- package/dist/plus/ai/models/model.js +51 -6
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/models/provider.d.ts +60 -2
- package/dist/plus/ai/models/provider.d.ts.map +1 -1
- package/dist/plus/ai/prompts.d.ts +12 -0
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +177 -61
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.d.ts +10 -2
- package/dist/plus/ai/providers/anthropicProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.js +139 -46
- package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.d.ts +2 -0
- package/dist/plus/ai/providers/deepSeekProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.js +10 -21
- package/dist/plus/ai/providers/deepSeekProvider.js.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.d.ts +1 -0
- package/dist/plus/ai/providers/geminiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.js +19 -0
- package/dist/plus/ai/providers/geminiProvider.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts +5 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +118 -3
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts +1 -0
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.js +5 -0
- package/dist/plus/ai/providers/huggingFaceProvider.js.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.d.ts +3 -1
- package/dist/plus/ai/providers/mistralProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.js +99 -19
- package/dist/plus/ai/providers/mistralProvider.js.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.d.ts +4 -3
- package/dist/plus/ai/providers/ollamaProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.js +38 -3
- package/dist/plus/ai/providers/ollamaProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.d.ts +1 -0
- package/dist/plus/ai/providers/openAICompatibleProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.js +4 -0
- package/dist/plus/ai/providers/openAICompatibleProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +154 -5
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +259 -10
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.d.ts +4 -0
- package/dist/plus/ai/providers/openRouterProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.js +9 -0
- package/dist/plus/ai/providers/openRouterProvider.js.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.d.ts +1 -0
- package/dist/plus/ai/providers/openaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.js +1 -0
- package/dist/plus/ai/providers/openaiProvider.js.map +1 -1
- package/dist/plus/ai/providers/responseFormatCache.d.ts +8 -0
- package/dist/plus/ai/providers/responseFormatCache.d.ts.map +1 -0
- package/dist/plus/ai/providers/responseFormatCache.js +25 -0
- package/dist/plus/ai/providers/responseFormatCache.js.map +1 -0
- package/dist/plus/ai/providers/xaiProvider.d.ts +1 -0
- package/dist/plus/ai/providers/xaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.js +10 -1
- package/dist/plus/ai/providers/xaiProvider.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts +3 -0
- package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +13 -0
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +16 -2
- package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/results.utils.js +204 -28
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +55 -0
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +177 -4
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +16 -0
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js +29 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +1 -0
- package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +4 -0
- package/dist/plus/integrations/context.d.ts.map +1 -1
- package/dist/plus/integrations/index.d.ts.map +1 -1
- package/dist/plus/integrations/index.js +2 -0
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +6 -3
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +12 -2
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +3 -1
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js +2 -2
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/accounts.d.ts.map +1 -1
- package/dist/plus/integrations/providers/accounts.js +4 -0
- package/dist/plus/integrations/providers/accounts.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +3 -0
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js +1 -0
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +14 -2
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +55 -3
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +30 -4
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js +6 -1
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts.map +1 -1
- package/dist/plus/integrations/reads/drains.js +7 -4
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +3 -1
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +8 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issues.js +9 -4
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +9 -4
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/utils/env/browser/base64.d.ts +1 -1
- package/dist/utils/env/browser/base64.d.ts.map +1 -1
- package/dist/utils/env/node/base64.d.ts +1 -1
- package/dist/utils/env/node/base64.d.ts.map +1 -1
- package/dist/utils/env/node/base64.js +2 -0
- package/dist/utils/env/node/base64.js.map +1 -1
- package/dist/utils/keys/chord.d.ts +52 -0
- package/dist/utils/keys/chord.d.ts.map +1 -0
- package/dist/utils/keys/chord.js +135 -0
- package/dist/utils/keys/chord.js.map +1 -0
- package/dist/utils/keys/keybinding.d.ts +53 -0
- package/dist/utils/keys/keybinding.d.ts.map +1 -0
- package/dist/utils/keys/keybinding.js +58 -0
- package/dist/utils/keys/keybinding.js.map +1 -0
- package/dist/utils/path.d.ts +11 -0
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +13 -0
- package/dist/utils/path.js.map +1 -1
- package/package.json +13 -5
- package/src/git/cache.ts +383 -47
- package/src/git/context.ts +11 -0
- package/src/git/models/fileStatus.ts +1 -0
- package/src/git/models/issue.ts +4 -0
- package/src/git/models/mergeConflicts.ts +3 -2
- package/src/git/models/pullRequest.ts +33 -1
- package/src/git/models/repository.ts +58 -17
- package/src/git/models/statusFile.ts +3 -0
- package/src/git/providers/branches.ts +6 -0
- package/src/git/providers/commits.ts +11 -0
- package/src/git/providers/config.ts +18 -0
- package/src/git/providers/operations.ts +1 -0
- package/src/git/providers/pausedOperations.ts +2 -0
- package/src/git/providers/status.ts +1 -0
- package/src/git/utils/config.utils.ts +8 -0
- package/src/git/utils/issue.utils.ts +2 -0
- package/src/git/utils/pausedOperationStatus.utils.ts +28 -0
- package/src/git/utils/pullRequest.utils.ts +36 -0
- package/src/git/watching/changeEvent.ts +6 -1
- package/src/git/watching/classifyChange.ts +15 -1
- package/src/git/watching/watchService.ts +20 -3
- package/src/git/watching/watchSession.ts +41 -6
- package/src/git/watching/watcherPatterns.ts +1 -1
- package/src/git-cli/exec/git.ts +13 -3
- package/src/git-cli/providers/branches.ts +384 -132
- package/src/git-cli/providers/commits.ts +106 -15
- package/src/git-cli/providers/config.ts +229 -8
- package/src/git-cli/providers/contributors.ts +5 -1
- package/src/git-cli/providers/graph.ts +26 -13
- package/src/git-cli/providers/operations.ts +45 -20
- package/src/git-cli/providers/pausedOperations.ts +109 -17
- package/src/git-cli/providers/refs.ts +33 -3
- package/src/git-cli/providers/status.ts +25 -4
- package/src/git-cli/providers/worktrees.ts +5 -0
- package/src/git-cli/service.ts +0 -1
- package/src/plus/agents/providers/claudeCodeProvider.ts +1130 -87
- package/src/plus/agents/providers/claudeCodeTranscript.ts +95 -9
- package/src/plus/agents/types.ts +46 -2
- package/src/plus/ai/errors.ts +30 -0
- package/src/plus/ai/models/model.ts +56 -6
- package/src/plus/ai/models/promptTemplates.ts +1 -1
- package/src/plus/ai/models/provider.ts +69 -2
- package/src/plus/ai/prompts.ts +186 -61
- package/src/plus/ai/providers/anthropicProvider.ts +155 -47
- package/src/plus/ai/providers/deepSeekProvider.ts +11 -21
- package/src/plus/ai/providers/geminiProvider.ts +19 -0
- package/src/plus/ai/providers/gitkrakenProvider.ts +126 -3
- package/src/plus/ai/providers/huggingFaceProvider.ts +6 -0
- package/src/plus/ai/providers/mistralProvider.ts +102 -19
- package/src/plus/ai/providers/ollamaProvider.ts +55 -4
- package/src/plus/ai/providers/openAICompatibleProvider.ts +5 -0
- package/src/plus/ai/providers/openAICompatibleProviderBase.ts +360 -17
- package/src/plus/ai/providers/openRouterProvider.ts +17 -0
- package/src/plus/ai/providers/openaiProvider.ts +1 -0
- package/src/plus/ai/providers/responseFormatCache.ts +39 -0
- package/src/plus/ai/providers/xaiProvider.ts +10 -1
- package/src/plus/ai/utils/ai.utils.ts +14 -0
- package/src/plus/ai/utils/results.utils.ts +255 -31
- package/src/plus/git-github/api/github.ts +291 -7
- package/src/plus/git-github/models.ts +48 -2
- package/src/plus/git-github/providers/github/status.ts +1 -0
- package/src/plus/integrations/context.ts +4 -0
- package/src/plus/integrations/index.ts +2 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +25 -2
- package/src/plus/integrations/models/integration.ts +23 -13
- package/src/plus/integrations/providers/accounts.ts +4 -0
- package/src/plus/integrations/providers/azure/models.ts +3 -0
- package/src/plus/integrations/providers/bitbucket/models.ts +1 -0
- package/src/plus/integrations/providers/github.ts +85 -1
- package/src/plus/integrations/providers/gitlab.ts +2 -10
- package/src/plus/integrations/providers/models.ts +36 -4
- package/src/plus/integrations/reads/broaden.ts +6 -1
- package/src/plus/integrations/reads/drains.ts +7 -4
- package/src/plus/integrations/reads/hierarchy.ts +3 -1
- package/src/plus/integrations/reads/issueTracker.ts +9 -3
- package/src/plus/integrations/reads/issues.ts +9 -4
- package/src/plus/integrations/reads/pullRequests.ts +9 -4
- package/src/utils/env/browser/base64.ts +1 -1
- package/src/utils/env/node/base64.ts +3 -1
- package/src/utils/keys/chord.ts +184 -0
- package/src/utils/keys/keybinding.ts +116 -0
- package/src/utils/path.ts +14 -0
|
@@ -16,7 +16,7 @@ import { getPullRequestComparator } from '../../../git/utils/pullRequest.utils.j
|
|
|
16
16
|
import { createRevisionRange, getRevisionRangeParts, isRevisionRange, isSha, } from '../../../git/utils/revision.utils.js';
|
|
17
17
|
import { chunk } from '../../../utils/array.js';
|
|
18
18
|
import { base64 } from '../../../utils/base64.js';
|
|
19
|
-
import { CancellationError } from '../../../utils/cancellation.js';
|
|
19
|
+
import { CancellationError, isCancellationError } from '../../../utils/cancellation.js';
|
|
20
20
|
import { trace } from '../../../utils/decorators/log.js';
|
|
21
21
|
import { Emitter } from '../../../utils/event.js';
|
|
22
22
|
import { uniqueBy } from '../../../utils/iterable.js';
|
|
@@ -125,6 +125,42 @@ title
|
|
|
125
125
|
updatedAt
|
|
126
126
|
url
|
|
127
127
|
`;
|
|
128
|
+
/**
|
|
129
|
+
* Stacked-pull-request selections, appended to a pull request's selection set rather than baked into
|
|
130
|
+
* the fragments below: GitHub Enterprise Server schemas lag github.com, and selecting `stack` there
|
|
131
|
+
* fails the entire query with "Field 'stack' doesn't exist on type 'PullRequest'" — which would take
|
|
132
|
+
* every PR feature down with it, not just stacks. Always add these via `gqlPullRequestStackFragmentFor`.
|
|
133
|
+
*/
|
|
134
|
+
const gqlPullRequestStackFragment = `
|
|
135
|
+
stack {
|
|
136
|
+
id
|
|
137
|
+
number
|
|
138
|
+
size
|
|
139
|
+
baseRefName
|
|
140
|
+
}
|
|
141
|
+
stackEntry {
|
|
142
|
+
position
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
function gqlPullRequestStackFragmentFor(options) {
|
|
146
|
+
return isGitHubDotCom(options) ? gqlPullRequestStackFragment : '';
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A 409 means a merge request is already in flight and carries its ticket, so it resumes rather than fails.
|
|
150
|
+
*
|
|
151
|
+
* The body has to be dug out of `original`: `requestCore` routes every 4xx through `handleRequestError`,
|
|
152
|
+
* which re-wraps octokit's `RequestError` in a `RequestClientError` carrying only `message` and `original`.
|
|
153
|
+
*/
|
|
154
|
+
function getAsyncMergeUuidFromConflict(ex) {
|
|
155
|
+
const err = (RequestClientError.is(ex) ? ex.original : ex);
|
|
156
|
+
if (err?.status !== 409)
|
|
157
|
+
return undefined;
|
|
158
|
+
return err.response?.data?.details?.uuid;
|
|
159
|
+
}
|
|
160
|
+
const asyncMergePollIntervalMs = 2000;
|
|
161
|
+
/** A stack merges one layer at a time and GitHub only promises "a few minutes", so the ceiling is
|
|
162
|
+
* generous — giving up early would report a failure for a merge still in progress. */
|
|
163
|
+
const maxAsyncMergePolls = 300;
|
|
128
164
|
const gqlPullRequestLiteFragment = `
|
|
129
165
|
${gqlIssueOrPullRequestFragment}
|
|
130
166
|
author {
|
|
@@ -189,6 +225,7 @@ assignees(first: 25) {
|
|
|
189
225
|
url
|
|
190
226
|
}
|
|
191
227
|
}
|
|
228
|
+
changedFiles
|
|
192
229
|
checksUrl
|
|
193
230
|
deletions
|
|
194
231
|
mergeable
|
|
@@ -218,6 +255,7 @@ reviewRequests(first: 25) {
|
|
|
218
255
|
}
|
|
219
256
|
}
|
|
220
257
|
commits(last: 1) {
|
|
258
|
+
totalCount
|
|
221
259
|
nodes {
|
|
222
260
|
commit {
|
|
223
261
|
statusCheckRollup {
|
|
@@ -295,6 +333,7 @@ export class GitHubApi {
|
|
|
295
333
|
try {
|
|
296
334
|
const query = `query getCurrentAccount($avatarSize: Int) {
|
|
297
335
|
viewer {
|
|
336
|
+
databaseId
|
|
298
337
|
name
|
|
299
338
|
email
|
|
300
339
|
login
|
|
@@ -306,7 +345,10 @@ export class GitHubApi {
|
|
|
306
345
|
return undefined;
|
|
307
346
|
return {
|
|
308
347
|
provider: provider,
|
|
309
|
-
id
|
|
348
|
+
// `id` is the provider's own id, as it is for every other provider, and `username` the handle
|
|
349
|
+
// filters and viewer matching key on. Falls back to the login only when GitHub omits the
|
|
350
|
+
// database id, which leaves the two equal rather than leaving `id` empty.
|
|
351
|
+
id: rsp.viewer.databaseId != null ? String(rsp.viewer.databaseId) : rsp.viewer.login,
|
|
310
352
|
name: rsp.viewer.name ?? undefined,
|
|
311
353
|
email: rsp.viewer.email ?? undefined,
|
|
312
354
|
// If we are GitHub Enterprise, we may need to convert the avatar URL since it might require authentication
|
|
@@ -603,6 +645,7 @@ export class GitHubApi {
|
|
|
603
645
|
repository(name: $repo, owner: $owner) {
|
|
604
646
|
pullRequest(number: $number) {
|
|
605
647
|
${gqlPullRequestLiteFragment}
|
|
648
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
606
649
|
}
|
|
607
650
|
}
|
|
608
651
|
}`;
|
|
@@ -638,6 +681,7 @@ export class GitHubApi {
|
|
|
638
681
|
associatedPullRequests(first: $limit, orderBy: {field: UPDATED_AT, direction: DESC}, states: $include) {
|
|
639
682
|
nodes {
|
|
640
683
|
${gqlPullRequestLiteFragment}
|
|
684
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
641
685
|
}
|
|
642
686
|
}
|
|
643
687
|
}
|
|
@@ -683,6 +727,7 @@ export class GitHubApi {
|
|
|
683
727
|
associatedPullRequests(first: 2, orderBy: {field: UPDATED_AT, direction: DESC}) {
|
|
684
728
|
nodes {
|
|
685
729
|
${gqlPullRequestLiteFragment}
|
|
730
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
686
731
|
}
|
|
687
732
|
}
|
|
688
733
|
}
|
|
@@ -1998,6 +2043,17 @@ export class GitHubApi {
|
|
|
1998
2043
|
return promise;
|
|
1999
2044
|
}
|
|
2000
2045
|
async request(provider, token, route, options, scope, cancellation) {
|
|
2046
|
+
return (await this.requestCore(provider, token, route, options, scope, cancellation));
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* REST call for routes `@octokit/types` doesn't describe yet — currently the stacked-pull-request
|
|
2050
|
+
* merge APIs, which are in public preview and absent from the generated endpoint map. Prefer
|
|
2051
|
+
* `request` for anything typed.
|
|
2052
|
+
*/
|
|
2053
|
+
async requestPreview(provider, token, route, options, scope, cancellation) {
|
|
2054
|
+
return (await this.requestCore(provider, token, route, options, scope, cancellation));
|
|
2055
|
+
}
|
|
2056
|
+
async requestCore(provider, token, route, options, scope, cancellation) {
|
|
2001
2057
|
const { accessToken } = token;
|
|
2002
2058
|
try {
|
|
2003
2059
|
let signal;
|
|
@@ -2010,7 +2066,7 @@ export class GitHubApi {
|
|
|
2010
2066
|
// Retry transient gateway/network failures on idempotent reads only
|
|
2011
2067
|
const method = route.split(' ', 1)[0].toUpperCase();
|
|
2012
2068
|
const retryable = method === 'GET' || method === 'HEAD';
|
|
2013
|
-
return
|
|
2069
|
+
return await this.requestWithRetries(() => this.config.wrapForForcedInsecureSSL(provider?.getIgnoreSSLErrors() ?? false, () => this.getDefaults(accessToken, request)(route, options)), retryable, signal, scope);
|
|
2014
2070
|
}
|
|
2015
2071
|
catch (ex) {
|
|
2016
2072
|
if (ex instanceof RequestError || ex.name === 'AbortError') {
|
|
@@ -2215,6 +2271,7 @@ export class GitHubApi {
|
|
|
2215
2271
|
nodes {
|
|
2216
2272
|
...on PullRequest {
|
|
2217
2273
|
${options?.summary ? gqlPullRequestLiteFragment : gqlPullRequestFragment}
|
|
2274
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
2218
2275
|
}
|
|
2219
2276
|
}
|
|
2220
2277
|
}
|
|
@@ -2843,6 +2900,7 @@ export class GitHubApi {
|
|
|
2843
2900
|
nodes {
|
|
2844
2901
|
... on PullRequest {
|
|
2845
2902
|
${gqlPullRequestFragment}
|
|
2903
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
2846
2904
|
}
|
|
2847
2905
|
}
|
|
2848
2906
|
}`);
|
|
@@ -2954,6 +3012,7 @@ export class GitHubApi {
|
|
|
2954
3012
|
nodes {
|
|
2955
3013
|
...on PullRequest {
|
|
2956
3014
|
${gqlPullRequestFragment}
|
|
3015
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
2957
3016
|
}
|
|
2958
3017
|
}
|
|
2959
3018
|
}
|
|
@@ -2996,6 +3055,98 @@ export class GitHubApi {
|
|
|
2996
3055
|
throw this.handleException(ex, provider, scope);
|
|
2997
3056
|
}
|
|
2998
3057
|
}
|
|
3058
|
+
/**
|
|
3059
|
+
* Every stack in the repository, each with its members bottom to top.
|
|
3060
|
+
*
|
|
3061
|
+
* One request regardless of how many pull requests are involved — which is what makes it the right
|
|
3062
|
+
* shape for list surfaces, whose pull requests arrive through the shared providers API and so carry no
|
|
3063
|
+
* stack membership of their own. Callers join the result by pull request number.
|
|
3064
|
+
*
|
|
3065
|
+
* A `404` means the repository isn't enrolled in the stacked-pull-requests preview; that's reported as
|
|
3066
|
+
* `undefined` rather than an error, since "no stacks" and "not available" both mean nothing to show.
|
|
3067
|
+
*/
|
|
3068
|
+
async getRepositoryStacks(provider, token, owner, repo, options, cancellation) {
|
|
3069
|
+
const scope = getScopedLogger();
|
|
3070
|
+
try {
|
|
3071
|
+
const rsp = await this.requestPreview(provider, token, 'GET /repos/{owner}/{repo}/stacks', { owner: owner, repo: repo, baseUrl: options?.baseUrl }, scope, cancellation);
|
|
3072
|
+
return rsp.data;
|
|
3073
|
+
}
|
|
3074
|
+
catch (ex) {
|
|
3075
|
+
if (isCancellationError(ex))
|
|
3076
|
+
throw ex;
|
|
3077
|
+
Logger.warn(scope, `Unable to list stacks for ${owner}/${repo}: ${ex}`);
|
|
3078
|
+
return undefined;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
/**
|
|
3082
|
+
* Merges a stacked pull request, and with it every layer below it.
|
|
3083
|
+
*
|
|
3084
|
+
* Stacks cannot go through `mergePullRequest` — GitHub rejects stacked pull requests on the legacy
|
|
3085
|
+
* synchronous merge endpoints and mutations. The replacement is asynchronous: submit, then poll a
|
|
3086
|
+
* ticket until it reaches a terminal state.
|
|
3087
|
+
*/
|
|
3088
|
+
async mergeStackedPullRequest(provider, token, owner, repo, pullNumber, expectedSourceSha, options, cancellation) {
|
|
3089
|
+
const scope = getScopedLogger();
|
|
3090
|
+
try {
|
|
3091
|
+
let uuid;
|
|
3092
|
+
try {
|
|
3093
|
+
const submitted = await this.requestPreview(provider, token, 'PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async', {
|
|
3094
|
+
owner: owner,
|
|
3095
|
+
repo: repo,
|
|
3096
|
+
pull_number: pullNumber,
|
|
3097
|
+
sha: expectedSourceSha,
|
|
3098
|
+
merge_method: options?.mergeMethod,
|
|
3099
|
+
baseUrl: options?.baseUrl,
|
|
3100
|
+
}, scope, cancellation);
|
|
3101
|
+
// Already merged or rejected outright — nothing to poll for. `enqueued` lands via the merge
|
|
3102
|
+
// queue, which can take several merge groups to settle, so it's transitional like `pending`.
|
|
3103
|
+
if (submitted.data.status !== 'pending' && submitted.data.status !== 'enqueued') {
|
|
3104
|
+
if (submitted.data.status === 'failed') {
|
|
3105
|
+
Logger.warn(scope, `Stacked merge refused: ${submitted.data.details?.message ?? 'no reason given'}`);
|
|
3106
|
+
}
|
|
3107
|
+
return submitted.data.status === 'merged';
|
|
3108
|
+
}
|
|
3109
|
+
uuid = submitted.data.details?.uuid;
|
|
3110
|
+
}
|
|
3111
|
+
catch (ex) {
|
|
3112
|
+
// A merge request is already in flight (a retry, or a double-click) — adopt its ticket and
|
|
3113
|
+
// poll that instead of reporting a failure for a merge that is actually running.
|
|
3114
|
+
uuid = getAsyncMergeUuidFromConflict(ex);
|
|
3115
|
+
if (uuid == null)
|
|
3116
|
+
throw ex;
|
|
3117
|
+
}
|
|
3118
|
+
if (uuid == null)
|
|
3119
|
+
return false;
|
|
3120
|
+
// The stack merges server-side one layer at a time, so this can take a while. Poll on a
|
|
3121
|
+
// fixed interval and give up rather than hang forever if the ticket never settles.
|
|
3122
|
+
for (let attempt = 0; attempt < maxAsyncMergePolls; attempt++) {
|
|
3123
|
+
if (cancellation?.aborted)
|
|
3124
|
+
throw new CancellationError();
|
|
3125
|
+
await new Promise(resolve => setTimeout(resolve, asyncMergePollIntervalMs));
|
|
3126
|
+
const polled = await this.requestPreview(provider, token, 'GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}', {
|
|
3127
|
+
owner: owner,
|
|
3128
|
+
repo: repo,
|
|
3129
|
+
pull_number: pullNumber,
|
|
3130
|
+
uuid: uuid,
|
|
3131
|
+
baseUrl: options?.baseUrl,
|
|
3132
|
+
}, scope, cancellation);
|
|
3133
|
+
if (polled.data.status === 'pending' || polled.data.status === 'enqueued')
|
|
3134
|
+
continue;
|
|
3135
|
+
if (polled.data.status === 'failed') {
|
|
3136
|
+
Logger.warn(scope, `Stacked merge failed: ${polled.data.details?.message ?? 'no reason given'}`);
|
|
3137
|
+
}
|
|
3138
|
+
return polled.data.status === 'merged';
|
|
3139
|
+
}
|
|
3140
|
+
Logger.warn(scope, `Timed out waiting for stacked merge of ${owner}/${repo}#${pullNumber}`);
|
|
3141
|
+
return false;
|
|
3142
|
+
}
|
|
3143
|
+
catch (ex) {
|
|
3144
|
+
if (isCancellationError(ex))
|
|
3145
|
+
throw ex;
|
|
3146
|
+
Logger.error(ex, scope);
|
|
3147
|
+
throw this.handleException(ex, provider, scope);
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
2999
3150
|
async mergePullRequest(provider, token, nodeId, expectedSourceSha, options, cancellation) {
|
|
3000
3151
|
const scope = getScopedLogger();
|
|
3001
3152
|
let githubMergeStrategy;
|
|
@@ -3031,7 +3182,7 @@ export class GitHubApi {
|
|
|
3031
3182
|
mergeMethod: githubMergeStrategy,
|
|
3032
3183
|
baseUrl: options?.baseUrl,
|
|
3033
3184
|
}, scope, cancellation);
|
|
3034
|
-
return rsp?.pullRequest?.id === nodeId;
|
|
3185
|
+
return rsp?.mergePullRequest?.pullRequest?.id === nodeId;
|
|
3035
3186
|
}
|
|
3036
3187
|
catch (ex) {
|
|
3037
3188
|
throw this.handleException(ex, provider, scope);
|
|
@@ -3342,6 +3493,28 @@ __decorate([
|
|
|
3342
3493
|
__decorate([
|
|
3343
3494
|
trace({ args: (provider, token) => ({ provider: provider.name, token: `<token:${token.microHash}>` }) })
|
|
3344
3495
|
], GitHubApi.prototype, "searchPullRequests", null);
|
|
3496
|
+
__decorate([
|
|
3497
|
+
trace({
|
|
3498
|
+
args: (provider, token, owner, repo) => ({
|
|
3499
|
+
provider: provider.name,
|
|
3500
|
+
token: `<token:${token.microHash}>`,
|
|
3501
|
+
owner: owner,
|
|
3502
|
+
repo: repo,
|
|
3503
|
+
}),
|
|
3504
|
+
})
|
|
3505
|
+
], GitHubApi.prototype, "getRepositoryStacks", null);
|
|
3506
|
+
__decorate([
|
|
3507
|
+
trace({
|
|
3508
|
+
args: (provider, token, owner, repo, pullNumber, expectedSourceSha) => ({
|
|
3509
|
+
provider: provider.name,
|
|
3510
|
+
token: `<token:${token.microHash}>`,
|
|
3511
|
+
owner: owner,
|
|
3512
|
+
repo: repo,
|
|
3513
|
+
pullNumber: pullNumber,
|
|
3514
|
+
expectedSourceSha: expectedSourceSha,
|
|
3515
|
+
}),
|
|
3516
|
+
})
|
|
3517
|
+
], GitHubApi.prototype, "mergeStackedPullRequest", null);
|
|
3345
3518
|
__decorate([
|
|
3346
3519
|
trace({
|
|
3347
3520
|
args: (provider, token, nodeId, expectedSourceSha) => ({
|