@gitkraken/core-gitlens 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -1
- package/dist/git/cache.d.ts +49 -9
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +174 -14
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +11 -2
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/models/branch.d.ts +1 -0
- package/dist/git/models/branch.d.ts.map +1 -1
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/commit.d.ts +1 -9
- package/dist/git/models/commit.d.ts.map +1 -1
- package/dist/git/models/commit.js +4 -9
- package/dist/git/models/commit.js.map +1 -1
- package/dist/git/models/graph.d.ts +2 -4
- package/dist/git/models/graph.d.ts.map +1 -1
- package/dist/git/models/reference.d.ts +31 -0
- package/dist/git/models/reference.d.ts.map +1 -1
- package/dist/git/models/remote.d.ts.map +1 -1
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/models/repository.d.ts +20 -3
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +42 -5
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/models/search.d.ts +2 -2
- package/dist/git/models/search.d.ts.map +1 -1
- package/dist/git/models/worktree.d.ts +4 -1
- package/dist/git/models/worktree.d.ts.map +1 -1
- package/dist/git/models/worktree.js +2 -2
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/parsers/diffParser.d.ts +0 -1
- package/dist/git/parsers/diffParser.d.ts.map +1 -1
- package/dist/git/parsers/diffParser.js +22 -61
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/providers/branches.d.ts +18 -4
- package/dist/git/providers/branches.d.ts.map +1 -1
- package/dist/git/providers/commits.d.ts +6 -0
- package/dist/git/providers/commits.d.ts.map +1 -1
- package/dist/git/providers/config.d.ts +6 -1
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/diff.d.ts +2 -0
- package/dist/git/providers/diff.d.ts.map +1 -1
- package/dist/git/providers/operations.d.ts +39 -10
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts +3 -1
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/refs.d.ts +23 -2
- package/dist/git/providers/refs.d.ts.map +1 -1
- package/dist/git/providers/revision.d.ts +1 -1
- package/dist/git/providers/revision.d.ts.map +1 -1
- package/dist/git/providers/staging.d.ts +18 -0
- package/dist/git/providers/staging.d.ts.map +1 -1
- package/dist/git/providers/status.d.ts +4 -1
- package/dist/git/providers/status.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/{exec.types.d.ts → run.types.d.ts} +22 -3
- package/dist/git/run.types.d.ts.map +1 -0
- package/dist/git/run.types.js +2 -0
- package/dist/git/run.types.js.map +1 -0
- package/dist/git/service.d.ts.map +1 -1
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/autolink.utils.d.ts.map +1 -1
- package/dist/git/utils/autolink.utils.js.map +1 -1
- package/dist/git/utils/blame.utils.d.ts.map +1 -1
- package/dist/git/utils/blame.utils.js.map +1 -1
- package/dist/git/utils/conflictResolution.utils.d.ts +6 -0
- package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -0
- package/dist/git/utils/conflictResolution.utils.js +25 -0
- package/dist/git/utils/conflictResolution.utils.js.map +1 -0
- package/dist/git/utils/fileStatus.utils.d.ts +2 -1
- package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/fileStatus.utils.js +4 -0
- package/dist/git/utils/fileStatus.utils.js.map +1 -1
- package/dist/git/utils/search.utils.d.ts.map +1 -1
- package/dist/git/utils/search.utils.js +3 -0
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git/utils/sorting.d.ts +14 -0
- package/dist/git/utils/sorting.d.ts.map +1 -1
- package/dist/git/utils/sorting.js +34 -0
- package/dist/git/utils/sorting.js.map +1 -1
- package/dist/git/utils/status.utils.d.ts.map +1 -1
- package/dist/git/utils/status.utils.js.map +1 -1
- package/dist/git/watching/classifyChange.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.js +8 -0
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.js +1 -1
- package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
- package/dist/git/watching/initWatcher.d.ts.map +1 -1
- package/dist/git/watching/initWatcher.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts.map +1 -1
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +24 -4
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +1 -1
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/exec.types.d.ts +1 -1
- package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
- package/dist/git-cli/exec/git.d.ts +31 -6
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +70 -9
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +22 -6
- package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
- package/dist/git-cli/exec/gitQueue.js +88 -24
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/blameParser.js.map +1 -1
- package/dist/git-cli/parsers/logParser.d.ts +1 -0
- package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/logParser.js +4 -0
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.d.ts +3 -30
- package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/refParser.js +30 -30
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/blame.d.ts.map +1 -1
- package/dist/git-cli/providers/blame.js +1 -1
- package/dist/git-cli/providers/blame.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +17 -5
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +245 -162
- 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 +120 -35
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +11 -2
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +36 -11
- 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 +7 -4
- package/dist/git-cli/providers/contributors.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts +2 -0
- package/dist/git-cli/providers/diff.d.ts.map +1 -1
- package/dist/git-cli/providers/diff.js +92 -20
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +49 -28
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +30 -11
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +146 -43
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.d.ts.map +1 -1
- package/dist/git-cli/providers/patch.js +15 -30
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +3 -1
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +13 -7
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +19 -2
- package/dist/git-cli/providers/refs.d.ts.map +1 -1
- package/dist/git-cli/providers/refs.js +312 -9
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.js +4 -4
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +1 -1
- package/dist/git-cli/providers/revision.d.ts.map +1 -1
- package/dist/git-cli/providers/revision.js +15 -11
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts +8 -0
- package/dist/git-cli/providers/staging.d.ts.map +1 -1
- package/dist/git-cli/providers/staging.js +52 -8
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts +0 -8
- package/dist/git-cli/providers/stash.d.ts.map +1 -1
- package/dist/git-cli/providers/stash.js +63 -119
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +4 -1
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +10 -9
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts.map +1 -1
- package/dist/git-cli/providers/tags.js +13 -9
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/providers/worktrees.js +3 -3
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/ipc/discovery.d.ts +27 -0
- package/dist/ipc/discovery.d.ts.map +1 -0
- package/dist/ipc/discovery.js +38 -0
- package/dist/ipc/discovery.js.map +1 -0
- package/dist/ipc/ipcServer.d.ts +20 -0
- package/dist/ipc/ipcServer.d.ts.map +1 -0
- package/dist/ipc/ipcServer.js +162 -0
- package/dist/ipc/ipcServer.js.map +1 -0
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts +114 -0
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js +1480 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +36 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.js +171 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -0
- package/dist/plus/agents/sanitizePrompt.d.ts +15 -0
- package/dist/plus/agents/sanitizePrompt.d.ts.map +1 -0
- package/dist/plus/agents/sanitizePrompt.js +103 -0
- package/dist/plus/agents/sanitizePrompt.js.map +1 -0
- package/dist/plus/agents/stateMachine.d.ts +32 -0
- package/dist/plus/agents/stateMachine.d.ts.map +1 -0
- package/dist/plus/agents/stateMachine.js +180 -0
- package/dist/plus/agents/stateMachine.js.map +1 -0
- package/dist/plus/agents/types.d.ts +203 -0
- package/dist/plus/agents/types.d.ts.map +1 -0
- package/dist/plus/agents/types.js +49 -0
- package/dist/plus/agents/types.js.map +1 -0
- package/dist/plus/ai/constants.d.ts +2 -1
- package/dist/plus/ai/constants.d.ts.map +1 -1
- package/dist/plus/ai/constants.js +7 -0
- package/dist/plus/ai/constants.js.map +1 -1
- package/dist/plus/ai/errors.d.ts +4 -1
- package/dist/plus/ai/errors.d.ts.map +1 -1
- package/dist/plus/ai/errors.js +38 -0
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +1 -1
- package/dist/plus/ai/models/model.d.ts.map +1 -1
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +28 -2
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/models/results.d.ts +28 -0
- package/dist/plus/ai/models/results.d.ts.map +1 -1
- package/dist/plus/ai/prompts.d.ts +4 -0
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +167 -1
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +2 -0
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +3 -0
- package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/results.utils.js +75 -0
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/ai/utils/truncation.utils.d.ts +1 -1
- package/dist/plus/ai/utils/truncation.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/truncation.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +10 -1
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +156 -49
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/types.d.ts +8 -0
- package/dist/plus/git-github/api/types.d.ts.map +1 -1
- package/dist/plus/git-github/models.d.ts +1 -1
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/blame.js.map +1 -1
- package/dist/plus/git-github/providers/github/branches.d.ts +5 -1
- package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/branches.js +60 -22
- package/dist/plus/git-github/providers/github/branches.js.map +1 -1
- package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/commits.js +144 -92
- package/dist/plus/git-github/providers/github/commits.js.map +1 -1
- package/dist/plus/git-github/providers/github/diff.d.ts +3 -1
- package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/diff.js +23 -9
- package/dist/plus/git-github/providers/github/diff.js.map +1 -1
- package/dist/plus/git-github/providers/github/refs.d.ts +9 -1
- package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/refs.js +38 -13
- package/dist/plus/git-github/providers/github/refs.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/revision.js +1 -2
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +4 -1
- package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/status.js +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/tags.js +35 -36
- package/dist/plus/git-github/providers/github/tags.js.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js.map +1 -1
- package/dist/utils/decorators/log.js +1 -1
- package/dist/utils/decorators/log.js.map +1 -1
- package/dist/utils/decorators/sequentialize.d.ts.map +1 -1
- package/dist/utils/decorators/sequentialize.js +4 -2
- package/dist/utils/decorators/sequentialize.js.map +1 -1
- package/dist/utils/decorators/serializable.d.ts.map +1 -1
- package/dist/utils/decorators/serializable.js.map +1 -1
- package/dist/utils/dedupedAsyncCache.d.ts +37 -0
- package/dist/utils/dedupedAsyncCache.d.ts.map +1 -0
- package/dist/utils/dedupedAsyncCache.js +68 -0
- package/dist/utils/dedupedAsyncCache.js.map +1 -0
- package/dist/utils/diff.d.ts +2 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +53 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/disposable.d.ts.map +1 -1
- package/dist/utils/disposable.js.map +1 -1
- package/dist/utils/env/node/base64.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts.map +1 -1
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +4 -10
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/iterable.d.ts.map +1 -1
- package/dist/utils/iterable.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/lruMap.d.ts +49 -0
- package/dist/utils/lruMap.d.ts.map +1 -0
- package/dist/utils/lruMap.js +103 -0
- package/dist/utils/lruMap.js.map +1 -0
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js.map +1 -1
- package/dist/utils/mru.d.ts.map +1 -1
- package/dist/utils/mru.js.map +1 -1
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/promise.d.ts +1 -0
- package/dist/utils/promise.d.ts.map +1 -1
- package/dist/utils/promise.js +17 -0
- package/dist/utils/promise.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +10 -0
- package/dist/utils/promiseCache.d.ts.map +1 -1
- package/dist/utils/promiseCache.js +22 -0
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/uri.d.ts.map +1 -1
- package/dist/utils/uri.js.map +1 -1
- package/dist/utils/version.d.ts +14 -0
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +48 -0
- package/dist/utils/version.js.map +1 -1
- package/package.json +13 -1
- package/src/git/cache.ts +309 -29
- package/src/git/context.ts +11 -2
- package/src/git/models/branch.ts +1 -0
- package/src/git/models/commit.ts +2 -17
- package/src/git/models/graph.ts +2 -4
- package/src/git/models/reference.ts +33 -0
- package/src/git/models/remote.ts +1 -0
- package/src/git/models/repository.ts +44 -6
- package/src/git/models/search.ts +2 -2
- package/src/git/models/worktree.ts +10 -2
- package/src/git/parsers/diffParser.ts +9 -44
- package/src/git/providers/branches.ts +25 -4
- package/src/git/providers/commits.ts +7 -0
- package/src/git/providers/config.ts +4 -0
- package/src/git/providers/diff.ts +8 -2
- package/src/git/providers/operations.ts +54 -3
- package/src/git/providers/pausedOperations.ts +1 -0
- package/src/git/providers/refs.ts +32 -3
- package/src/git/providers/revision.ts +5 -1
- package/src/git/providers/staging.ts +14 -0
- package/src/git/providers/status.ts +6 -1
- package/src/git/remotes/azure-devops.ts +2 -0
- package/src/git/{exec.types.ts → run.types.ts} +22 -2
- package/src/git/service.ts +1 -0
- package/src/git/utils/autolink.utils.ts +1 -0
- package/src/git/utils/blame.utils.ts +2 -0
- package/src/git/utils/conflictResolution.utils.ts +31 -0
- package/src/git/utils/fileStatus.utils.ts +7 -1
- package/src/git/utils/search.utils.ts +2 -0
- package/src/git/utils/sorting.ts +38 -0
- package/src/git/utils/status.utils.ts +1 -0
- package/src/git/watching/classifyChange.ts +9 -0
- package/src/git/watching/gitIgnoreFilter.ts +2 -2
- package/src/git/watching/initWatcher.ts +2 -0
- package/src/git/watching/watchGroup.ts +3 -0
- package/src/git/watching/watchService.ts +38 -5
- package/src/git/watching/watchSession.ts +10 -0
- package/src/git-cli/cliGitProvider.ts +1 -1
- package/src/git-cli/exec/exec.types.ts +2 -2
- package/src/git-cli/exec/git.ts +76 -23
- package/src/git-cli/exec/gitQueue.ts +98 -25
- package/src/git-cli/parsers/blameParser.ts +1 -0
- package/src/git-cli/parsers/logParser.ts +6 -1
- package/src/git-cli/parsers/refParser.ts +33 -34
- package/src/git-cli/providers/blame.ts +2 -1
- package/src/git-cli/providers/branches.ts +341 -196
- package/src/git-cli/providers/commits.ts +145 -46
- package/src/git-cli/providers/config.ts +50 -16
- package/src/git-cli/providers/contributors.ts +7 -12
- package/src/git-cli/providers/diff.ts +107 -20
- package/src/git-cli/providers/graph.ts +58 -29
- package/src/git-cli/providers/operations.ts +253 -57
- package/src/git-cli/providers/patch.ts +16 -37
- package/src/git-cli/providers/pausedOperations.ts +14 -6
- package/src/git-cli/providers/refs.ts +274 -11
- package/src/git-cli/providers/remotes.ts +4 -4
- package/src/git-cli/providers/revision.ts +22 -15
- package/src/git-cli/providers/staging.ts +51 -8
- package/src/git-cli/providers/stash.ts +67 -134
- package/src/git-cli/providers/status.ts +21 -10
- package/src/git-cli/providers/tags.ts +18 -19
- package/src/git-cli/providers/worktrees.ts +3 -3
- package/src/ipc/discovery.ts +56 -0
- package/src/ipc/ipcServer.ts +171 -0
- package/src/plus/agents/providers/claudeCodeProvider.ts +1782 -0
- package/src/plus/agents/providers/claudeCodeTranscript.ts +214 -0
- package/src/plus/agents/sanitizePrompt.ts +109 -0
- package/src/plus/agents/stateMachine.ts +197 -0
- package/src/plus/agents/types.ts +277 -0
- package/src/plus/ai/constants.ts +8 -0
- package/src/plus/ai/errors.ts +40 -0
- package/src/plus/ai/models/model.ts +1 -0
- package/src/plus/ai/models/promptTemplates.ts +42 -0
- package/src/plus/ai/models/results.ts +30 -0
- package/src/plus/ai/prompts.ts +171 -1
- package/src/plus/ai/utils/ai.utils.ts +2 -0
- package/src/plus/ai/utils/results.utils.ts +101 -0
- package/src/plus/ai/utils/truncation.utils.ts +3 -1
- package/src/plus/git-github/api/github.ts +199 -53
- package/src/plus/git-github/api/types.ts +15 -0
- package/src/plus/git-github/models.ts +1 -1
- package/src/plus/git-github/providers/github/blame.ts +2 -0
- package/src/plus/git-github/providers/github/branches.ts +75 -33
- package/src/plus/git-github/providers/github/commits.ts +231 -160
- package/src/plus/git-github/providers/github/diff.ts +35 -21
- package/src/plus/git-github/providers/github/refs.ts +57 -22
- package/src/plus/git-github/providers/github/revision.ts +1 -2
- package/src/plus/git-github/providers/github/status.ts +6 -1
- package/src/plus/git-github/providers/github/tags.ts +61 -62
- package/src/plus/git-github/providers/githubGitProvider.ts +1 -0
- package/src/utils/color.ts +2 -0
- package/src/utils/decorators/log.ts +1 -1
- package/src/utils/decorators/sequentialize.ts +8 -6
- package/src/utils/decorators/serializable.ts +1 -0
- package/src/utils/dedupedAsyncCache.ts +74 -0
- package/src/utils/diff.ts +61 -0
- package/src/utils/disposable.ts +2 -0
- package/src/utils/env/node/base64.ts +1 -1
- package/src/utils/env/node/exec.ts +4 -2
- package/src/utils/error.ts +1 -0
- package/src/utils/formatter.ts +4 -11
- package/src/utils/iterable.ts +4 -1
- package/src/utils/logger.ts +1 -0
- package/src/utils/lruMap.ts +112 -0
- package/src/utils/markdown.ts +1 -0
- package/src/utils/mru.ts +2 -0
- package/src/utils/path.ts +1 -0
- package/src/utils/promise.ts +22 -0
- package/src/utils/promiseCache.ts +24 -0
- package/src/utils/string.ts +2 -0
- package/src/utils/uri.ts +1 -0
- package/src/utils/version.ts +49 -0
- package/dist/git/exec.types.d.ts.map +0 -1
- package/dist/git/exec.types.js +0 -2
- package/dist/git/exec.types.js.map +0 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import type { IpcHandler } from '../../ipc/ipcServer.js';
|
|
2
|
+
import type { UnifiedDisposable } from '../../utils/disposable.js';
|
|
3
|
+
import type { Event } from '../../utils/event.js';
|
|
4
|
+
|
|
5
|
+
export const claudeCodeNonBlockingHookEvents = [
|
|
6
|
+
'SessionStart',
|
|
7
|
+
'SessionEnd',
|
|
8
|
+
'UserPromptSubmit',
|
|
9
|
+
'PreToolUse',
|
|
10
|
+
'PostToolUse',
|
|
11
|
+
'PostToolUseFailure',
|
|
12
|
+
'Notification',
|
|
13
|
+
'Stop',
|
|
14
|
+
'StopFailure',
|
|
15
|
+
'SubagentStart',
|
|
16
|
+
'SubagentStop',
|
|
17
|
+
'TeammateIdle',
|
|
18
|
+
'TaskCompleted',
|
|
19
|
+
'InstructionsLoaded',
|
|
20
|
+
'ConfigChange',
|
|
21
|
+
'WorktreeCreate',
|
|
22
|
+
'WorktreeRemove',
|
|
23
|
+
'PreCompact',
|
|
24
|
+
'PostCompact',
|
|
25
|
+
'Elicitation',
|
|
26
|
+
'ElicitationResult',
|
|
27
|
+
'PermissionDenied',
|
|
28
|
+
'CwdChanged',
|
|
29
|
+
] as const;
|
|
30
|
+
|
|
31
|
+
export const claudeCodeBlockingHookEvents = ['PermissionRequest'] as const;
|
|
32
|
+
|
|
33
|
+
export type ClaudeCodeHookEvent =
|
|
34
|
+
| (typeof claudeCodeNonBlockingHookEvents)[number]
|
|
35
|
+
| (typeof claudeCodeBlockingHookEvents)[number];
|
|
36
|
+
|
|
37
|
+
export type PermissionDecision = 'allow' | 'deny';
|
|
38
|
+
|
|
39
|
+
export type AgentSessionStatus =
|
|
40
|
+
| 'thinking'
|
|
41
|
+
| 'tool_use'
|
|
42
|
+
| 'responding'
|
|
43
|
+
| 'waiting'
|
|
44
|
+
| 'idle'
|
|
45
|
+
| 'compacting'
|
|
46
|
+
| 'permission_requested';
|
|
47
|
+
|
|
48
|
+
export type AgentSessionPhase = 'idle' | 'working' | 'waiting';
|
|
49
|
+
|
|
50
|
+
export function getPhaseForStatus(status: AgentSessionStatus): AgentSessionPhase {
|
|
51
|
+
switch (status) {
|
|
52
|
+
case 'thinking':
|
|
53
|
+
case 'tool_use':
|
|
54
|
+
case 'responding':
|
|
55
|
+
case 'compacting':
|
|
56
|
+
return 'working';
|
|
57
|
+
case 'waiting':
|
|
58
|
+
case 'permission_requested':
|
|
59
|
+
return 'waiting';
|
|
60
|
+
case 'idle':
|
|
61
|
+
return 'idle';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns whether the given phase represents an agent that is actively doing work or
|
|
67
|
+
* awaiting input (as opposed to fully idle). Uses an explicit allowlist so new phases
|
|
68
|
+
* default to "not active" rather than being silently treated as live.
|
|
69
|
+
*/
|
|
70
|
+
export function isActiveAgentPhase(phase: AgentSessionPhase): boolean {
|
|
71
|
+
return phase === 'working' || phase === 'waiting';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PermissionSuggestion {
|
|
75
|
+
readonly type: string;
|
|
76
|
+
readonly tool?: string;
|
|
77
|
+
readonly rules?: readonly { readonly toolName: string; readonly ruleContent?: string }[];
|
|
78
|
+
readonly destination?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Classification of what the agent is awaiting input for. Drives kind-aware UI: action button
|
|
82
|
+
* labels, phase wording, and which payload field carries the body. Detected at the provider
|
|
83
|
+
* boundary from the tool name / event so webviews don't grow their own classifiers.
|
|
84
|
+
* - `tool`: a regular tool permission (Bash, Edit, Read, …) — body is `toolDescription`.
|
|
85
|
+
* - `plan`: ExitPlanMode — body is `planSummary`; `planFilePath` may link the written plan.
|
|
86
|
+
* - `question`: AskUserQuestion — body is `questionText`; `questionCount` describes the batch.
|
|
87
|
+
* - `elicitation`: MCP elicitation — body is just `toolName`; user must respond in-session. */
|
|
88
|
+
export type PendingPermissionKind = 'tool' | 'plan' | 'question' | 'elicitation';
|
|
89
|
+
|
|
90
|
+
export interface PendingPermission {
|
|
91
|
+
readonly kind: PendingPermissionKind;
|
|
92
|
+
readonly toolName: string;
|
|
93
|
+
readonly toolDescription: string;
|
|
94
|
+
readonly toolInputDescription?: string;
|
|
95
|
+
readonly suggestions?: readonly PermissionSuggestion[];
|
|
96
|
+
/** Plan-mode (`kind === 'plan'`): on-disk path of the plan markdown, when the agent wrote one. */
|
|
97
|
+
readonly planFilePath?: string;
|
|
98
|
+
/** Plan-mode: short summary extracted from the plan content (first heading or leading sentence). */
|
|
99
|
+
readonly planSummary?: string;
|
|
100
|
+
/** Question-mode (`kind === 'question'`): the leading question text. */
|
|
101
|
+
readonly questionText?: string;
|
|
102
|
+
/** Question-mode: total number of questions in the batch. */
|
|
103
|
+
readonly questionCount?: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface AgentSession {
|
|
107
|
+
readonly id: string;
|
|
108
|
+
readonly providerId: string;
|
|
109
|
+
readonly providerName: string;
|
|
110
|
+
readonly name?: string;
|
|
111
|
+
readonly status: AgentSessionStatus;
|
|
112
|
+
readonly phase: AgentSessionPhase;
|
|
113
|
+
readonly statusDetail?: string;
|
|
114
|
+
readonly worktreePath?: string;
|
|
115
|
+
/** Common (parent) repo path shared by every worktree in this session's repo. Set together
|
|
116
|
+
* with `worktreePath` by `resolveGitInfo` — equal to `worktreePath` for a default-worktree
|
|
117
|
+
* session, otherwise the parent repo's common path. Use this for "same repo" identity
|
|
118
|
+
* checks; {@link workspacePath} is the matched workspace folder, not repo identity.
|
|
119
|
+
*
|
|
120
|
+
* `undefined` carries two meanings the host distinguishes internally (via the
|
|
121
|
+
* `gitInfoUnresolvable` bookkeeping flag) but consumers should treat identically: either
|
|
122
|
+
* "not yet resolved" (no probe completed) or "resolved but cwd is not inside any git repo".
|
|
123
|
+
* Either way, no repo identity is available — never attempt to `path.join`/`path.resolve`
|
|
124
|
+
* against it without an explicit `!= null` check. */
|
|
125
|
+
readonly commonPath?: string;
|
|
126
|
+
readonly pid?: number;
|
|
127
|
+
readonly lastActivity: Date;
|
|
128
|
+
readonly phaseSince: Date;
|
|
129
|
+
readonly isSubagent: boolean;
|
|
130
|
+
readonly parentId?: string;
|
|
131
|
+
readonly subagents?: readonly AgentSession[];
|
|
132
|
+
readonly pendingPermission?: PendingPermission;
|
|
133
|
+
/** The VS Code workspace folder containing the agent's cwd, or `undefined` if cwd is outside
|
|
134
|
+
* any open workspace folder. Used for `isInWorkspace` and "Open Folder" only — NOT for repo
|
|
135
|
+
* identity. For "what repo is this session in", use {@link commonPath}. */
|
|
136
|
+
readonly workspacePath?: string;
|
|
137
|
+
readonly cwd?: string;
|
|
138
|
+
readonly planFile?: string;
|
|
139
|
+
readonly isInWorkspace: boolean;
|
|
140
|
+
readonly lastPrompt?: string;
|
|
141
|
+
readonly firstPrompt?: string;
|
|
142
|
+
/** Absolute paths of files targeted by in-flight file-editing tool calls (Edit/Write/MultiEdit/
|
|
143
|
+
* NotebookEdit). Populated on PreToolUse, drained on PostToolUse/PermissionDenied, cleared on
|
|
144
|
+
* Stop/SessionEnd. Empty/undefined when no file-editing tool is active.
|
|
145
|
+
*
|
|
146
|
+
* Mutable array form so `Shape<AgentSession>` projects it as `string[]` (the `Shape<>` type
|
|
147
|
+
* mangles `readonly T[]` into a mapped object that loses its iterator). Treat as immutable. */
|
|
148
|
+
currentFiles?: string[];
|
|
149
|
+
/** Absolute paths of files the agent recently *read* (Read/NotebookRead). Populated on
|
|
150
|
+
* PreToolUse, drained on PostToolUse/PermissionDenied with the same cooldown as
|
|
151
|
+
* `currentFiles`. Distinct from `currentFiles` which tracks write-class tools so consumers can
|
|
152
|
+
* visualize "looking at" vs "working on" differently. Treat as immutable. */
|
|
153
|
+
currentReads?: string[];
|
|
154
|
+
/** `true` when the session was discovered via peer IPC sync (i.e. another GitLens window hosts
|
|
155
|
+
* the agent's hook flow and Claude Code extension panel). Locally-owned sessions leave this
|
|
156
|
+
* unset. The dispatcher uses this to route opens through the peer's IPC route + an OS-level
|
|
157
|
+
* window focus, since calling `claude-vscode.editor.open` in *our* extension only opens an
|
|
158
|
+
* inert local view that isn't connected to the live session running in the peer.
|
|
159
|
+
*
|
|
160
|
+
* Window-local: never serialized faithfully across the IPC wire. Each window decides locally
|
|
161
|
+
* based on how it received the session — `querySiblingWindowSessions` always overrides to
|
|
162
|
+
* `true` regardless of what the peer published. */
|
|
163
|
+
readonly isPeerOwned?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Titles discovered by tailing the Claude Code transcript JSONL at
|
|
166
|
+
* `~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl`. Populated by
|
|
167
|
+
* `ClaudeCodeTranscriptReader`; used by `getSessionDisplayName` as a fallback when no
|
|
168
|
+
* harness-supplied `name` is available. Last occurrence in the transcript wins per type.
|
|
169
|
+
*/
|
|
170
|
+
readonly transcriptTitles?: {
|
|
171
|
+
readonly custom?: string;
|
|
172
|
+
readonly ai?: string;
|
|
173
|
+
readonly agent?: string;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface AgentSessionProvider extends UnifiedDisposable {
|
|
178
|
+
readonly id: string;
|
|
179
|
+
readonly name: string;
|
|
180
|
+
readonly icon: string;
|
|
181
|
+
|
|
182
|
+
readonly onDidChangeSessions: Event<void>;
|
|
183
|
+
readonly sessions: readonly AgentSession[];
|
|
184
|
+
|
|
185
|
+
start(workspacePaths: string[]): void;
|
|
186
|
+
stop(): void;
|
|
187
|
+
updateWorkspacePaths?(workspacePaths: string[]): void;
|
|
188
|
+
|
|
189
|
+
/** Resolves a pending permission. Returns `true` when the resolve was routed (the local IPC
|
|
190
|
+
* owns the session's pending entry); `false` when no local entry exists (typically a peer-
|
|
191
|
+
* discovered session owned by another GitLens window). Callers use this to give the user
|
|
192
|
+
* feedback rather than a silent no-op. */
|
|
193
|
+
resolvePermission?(
|
|
194
|
+
sessionId: string,
|
|
195
|
+
decision: PermissionDecision,
|
|
196
|
+
updatedPermissions?: PermissionSuggestion[],
|
|
197
|
+
): boolean;
|
|
198
|
+
|
|
199
|
+
/** Asks the peer GitLens window that has `workspacePath` open (or any peer whose workspacePath
|
|
200
|
+
* contains, or is contained by, it) to open the given session in its Claude Code extension
|
|
201
|
+
* via the `agents/sessions/open` IPC route. Resolves to `true` when at least one peer claimed
|
|
202
|
+
* the workspace AND was reachable; `false` otherwise. Best-effort: never rejects. The boolean
|
|
203
|
+
* is currently a diagnostic signal only — the dispatcher fires this in parallel with
|
|
204
|
+
* `vscode.openFolder` and relies on VS Code's window-folder matching to focus the owning
|
|
205
|
+
* window (which works whether or not the peer runs GitLens). */
|
|
206
|
+
notifyPeerOpenSession?(workspacePath: string, sessionId: string): Promise<boolean>;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Host-supplied IPC service. The agents package registers handlers and publishes
|
|
211
|
+
* the agents discovery file via this interface so it doesn't depend on the host's
|
|
212
|
+
* IPC service directly.
|
|
213
|
+
*
|
|
214
|
+
* The agents package is the source of truth for the workspacePaths advertised in
|
|
215
|
+
* the agents discovery file — `publishAgents` takes them as an argument and the host
|
|
216
|
+
* is expected to re-publish whenever those paths change.
|
|
217
|
+
*/
|
|
218
|
+
export interface IpcRegistrar {
|
|
219
|
+
readonly port: number | undefined;
|
|
220
|
+
/** Directory scanned for peer-window agent discovery files. Omit to disable peer discovery (tests). */
|
|
221
|
+
readonly agentDiscoveryDir?: string;
|
|
222
|
+
registerHandler<Request = unknown, Response = unknown>(
|
|
223
|
+
name: string,
|
|
224
|
+
handler: IpcHandler<Request, Response>,
|
|
225
|
+
): UnifiedDisposable;
|
|
226
|
+
publishAgents(workspacePaths: string[]): Promise<void>;
|
|
227
|
+
unpublishAgents(): Promise<void>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface AgentProviderCallbacks {
|
|
231
|
+
/** Host-supplied IPC service. Required for agents to receive hook events from the GK CLI. */
|
|
232
|
+
ipc: IpcRegistrar;
|
|
233
|
+
|
|
234
|
+
/** Report that an agent session started. No-op if the host has no telemetry. */
|
|
235
|
+
onSessionStarted?(provider: string): void;
|
|
236
|
+
|
|
237
|
+
/** Report that an agent session ended. No-op if the host has no telemetry. */
|
|
238
|
+
onSessionEnded?(provider: string): void;
|
|
239
|
+
|
|
240
|
+
/** Report that a permission request was resolved. No-op if the host has no telemetry. */
|
|
241
|
+
onPermissionResolved?(info: { provider: string; tool: string; decision: PermissionDecision }): void;
|
|
242
|
+
|
|
243
|
+
/** Notify the host that a branch has agent activity. */
|
|
244
|
+
onBranchAgentActivity?(cwd: string): void;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Run the GK CLI with the given args. Returns stdout.
|
|
248
|
+
*
|
|
249
|
+
* Host responsibilities:
|
|
250
|
+
* - Resolve the CLI executable path (e.g. via `resolveCLIExecutable`)
|
|
251
|
+
* - Provide the default `cwd` if `options.cwd` is not set (e.g. `globalStorageUri.fsPath` in VS Code)
|
|
252
|
+
* - Inject any environment-specific flags (e.g. `--insiders` when the host has insiders mode enabled)
|
|
253
|
+
*/
|
|
254
|
+
runCLICommand(args: string[], options?: { cwd?: string }): Promise<string>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Resolve git metadata for a session's cwd. Returns the stable worktree path; the worktree's
|
|
258
|
+
* display name (branch name for branch-type worktrees) is intentionally NOT returned — it's
|
|
259
|
+
* resolved live at serialization time so `git checkout` updates display without restarting.
|
|
260
|
+
* Optional — if omitted, sessions won't have worktree metadata.
|
|
261
|
+
*/
|
|
262
|
+
resolveGitInfo?(cwd: string): Promise<
|
|
263
|
+
| {
|
|
264
|
+
repoRoot: string;
|
|
265
|
+
isWorktree: boolean;
|
|
266
|
+
worktreePath?: string;
|
|
267
|
+
}
|
|
268
|
+
| undefined
|
|
269
|
+
>;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Open a Claude Code session in the Claude Code VS Code extension. Invoked by the IPC handler
|
|
273
|
+
* when a peer GitLens window asks this window to open a session on its behalf — the host wires
|
|
274
|
+
* this to `claude-vscode.editor.open`. Throws if the extension isn't installed/active.
|
|
275
|
+
*/
|
|
276
|
+
openSessionInClaudeExtension?(sessionId: string): Promise<void>;
|
|
277
|
+
}
|
package/src/plus/ai/constants.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type AIProviders =
|
|
|
13
13
|
| 'openai'
|
|
14
14
|
| 'openaicompatible'
|
|
15
15
|
| 'openrouter'
|
|
16
|
+
| 'simulator'
|
|
16
17
|
| 'vscode'
|
|
17
18
|
| 'xai';
|
|
18
19
|
export type AIPrimaryProviders = Extract<AIProviders, 'gitkraken' | 'vscode'>;
|
|
@@ -119,3 +120,10 @@ export const ollamaProviderDescriptor: AIProviderDescriptor<'ollama'> = {
|
|
|
119
120
|
requiresAccount: true,
|
|
120
121
|
requiresUserKey: false,
|
|
121
122
|
} as const;
|
|
123
|
+
export const simulatorProviderDescriptor: AIProviderDescriptor<'simulator'> = {
|
|
124
|
+
id: 'simulator',
|
|
125
|
+
name: 'Simulator (Debugging)',
|
|
126
|
+
primary: false,
|
|
127
|
+
requiresAccount: false,
|
|
128
|
+
requiresUserKey: false,
|
|
129
|
+
} as const;
|
package/src/plus/ai/errors.ts
CHANGED
|
@@ -10,6 +10,8 @@ export const enum AIErrorReason {
|
|
|
10
10
|
ServiceCapacityExceeded,
|
|
11
11
|
Unauthorized,
|
|
12
12
|
UserQuotaExceeded,
|
|
13
|
+
NoNetwork,
|
|
14
|
+
Unreachable,
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export class AIError extends Error {
|
|
@@ -37,6 +39,12 @@ export class AIError extends Error {
|
|
|
37
39
|
case AIErrorReason.ServiceCapacityExceeded:
|
|
38
40
|
message = 'Service capacity exceeded';
|
|
39
41
|
break;
|
|
42
|
+
case AIErrorReason.NoNetwork:
|
|
43
|
+
message = 'Unable to reach the AI service. Please check your internet connection.';
|
|
44
|
+
break;
|
|
45
|
+
case AIErrorReason.Unreachable:
|
|
46
|
+
message = 'The AI service is temporarily unreachable.';
|
|
47
|
+
break;
|
|
40
48
|
case AIErrorReason.NoRequestData:
|
|
41
49
|
message = original?.message ?? 'No data was provided for the request';
|
|
42
50
|
break;
|
|
@@ -80,3 +88,35 @@ export class AINoRequestDataError extends AIError {
|
|
|
80
88
|
Error.captureStackTrace?.(this, new.target);
|
|
81
89
|
}
|
|
82
90
|
}
|
|
91
|
+
|
|
92
|
+
const noNetworkErrorCodes = new Set([
|
|
93
|
+
'ENOTFOUND',
|
|
94
|
+
'ECONNREFUSED',
|
|
95
|
+
'EAI_AGAIN',
|
|
96
|
+
'EHOSTUNREACH',
|
|
97
|
+
'ENETUNREACH',
|
|
98
|
+
'ENETDOWN',
|
|
99
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
const unreachableErrorCodes = new Set(['ECONNRESET', 'ETIMEDOUT', 'UND_ERR_SOCKET']);
|
|
103
|
+
|
|
104
|
+
export function classifyNetworkError(ex: unknown): AIErrorReason.NoNetwork | AIErrorReason.Unreachable | undefined {
|
|
105
|
+
let current: unknown = ex;
|
|
106
|
+
let sawFetchFailed = false;
|
|
107
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
108
|
+
if (!(current instanceof Error)) break;
|
|
109
|
+
|
|
110
|
+
if (current.name === 'TypeError' && current.message === 'fetch failed') {
|
|
111
|
+
sawFetchFailed = true;
|
|
112
|
+
}
|
|
113
|
+
const code = (current as { code?: unknown }).code;
|
|
114
|
+
if (typeof code === 'string') {
|
|
115
|
+
if (noNetworkErrorCodes.has(code)) return AIErrorReason.NoNetwork;
|
|
116
|
+
if (unreachableErrorCodes.has(code)) return AIErrorReason.Unreachable;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
current = (current as { cause?: unknown }).cause;
|
|
120
|
+
}
|
|
121
|
+
return sawFetchFailed ? AIErrorReason.NoNetwork : undefined;
|
|
122
|
+
}
|
|
@@ -78,6 +78,36 @@ interface ReviewPullRequestPromptTemplateContext {
|
|
|
78
78
|
instructions?: string;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
interface ReviewChangesPromptTemplateContext {
|
|
82
|
+
diff: string;
|
|
83
|
+
message: string;
|
|
84
|
+
context?: string;
|
|
85
|
+
instructions?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface ReviewOverviewPromptTemplateContext {
|
|
89
|
+
files: string;
|
|
90
|
+
message: string;
|
|
91
|
+
context?: string;
|
|
92
|
+
instructions?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface ReviewDetailPromptTemplateContext {
|
|
96
|
+
diff: string;
|
|
97
|
+
overview: string;
|
|
98
|
+
message: string;
|
|
99
|
+
focusArea: string;
|
|
100
|
+
context?: string;
|
|
101
|
+
instructions?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface AddressReviewFindingsPromptTemplateContext {
|
|
105
|
+
reviewMarkdown: string;
|
|
106
|
+
scopeLabel: string;
|
|
107
|
+
granularity: 'review' | 'focusArea' | 'finding';
|
|
108
|
+
instructions?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
81
111
|
interface StartWorkIssuePromptTemplateContext {
|
|
82
112
|
issue: string;
|
|
83
113
|
instructions?: string;
|
|
@@ -91,6 +121,10 @@ export type PromptTemplateType =
|
|
|
91
121
|
| 'generate-commits'
|
|
92
122
|
| 'generate-searchQuery'
|
|
93
123
|
| 'explain-changes'
|
|
124
|
+
| 'review-changes'
|
|
125
|
+
| 'review-overview'
|
|
126
|
+
| 'review-detail'
|
|
127
|
+
| 'address-review-findings'
|
|
94
128
|
| 'start-review-pullRequest'
|
|
95
129
|
| 'start-work-issue';
|
|
96
130
|
|
|
@@ -115,6 +149,14 @@ export type PromptTemplateContext<T extends PromptTemplateType> = T extends 'gen
|
|
|
115
149
|
? SearchQueryPromptTemplateContext
|
|
116
150
|
: T extends 'explain-changes'
|
|
117
151
|
? ExplainChangesPromptTemplateContext
|
|
152
|
+
: T extends 'review-changes'
|
|
153
|
+
? ReviewChangesPromptTemplateContext
|
|
154
|
+
: T extends 'review-overview'
|
|
155
|
+
? ReviewOverviewPromptTemplateContext
|
|
156
|
+
: T extends 'review-detail'
|
|
157
|
+
? ReviewDetailPromptTemplateContext
|
|
158
|
+
: T extends 'address-review-findings'
|
|
159
|
+
? AddressReviewFindingsPromptTemplateContext
|
|
118
160
|
: T extends 'start-review-pullRequest'
|
|
119
161
|
? ReviewPullRequestPromptTemplateContext
|
|
120
162
|
: T extends 'start-work-issue'
|
|
@@ -1 +1,31 @@
|
|
|
1
1
|
export type AISummarizedResult = { summary: string; body: string };
|
|
2
|
+
|
|
3
|
+
export type AIReviewSeverity = 'critical' | 'warning' | 'suggestion';
|
|
4
|
+
|
|
5
|
+
export interface AIReviewFinding {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly severity: AIReviewSeverity;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly filePath?: string;
|
|
11
|
+
readonly lineRange?: { readonly start: number; readonly end: number };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AIReviewFocusArea {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly label: string;
|
|
17
|
+
readonly rationale: string;
|
|
18
|
+
readonly severity: AIReviewSeverity;
|
|
19
|
+
readonly files: readonly string[];
|
|
20
|
+
readonly findings?: readonly AIReviewFinding[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AIReviewResult {
|
|
24
|
+
readonly overview: string;
|
|
25
|
+
readonly focusAreas: readonly AIReviewFocusArea[];
|
|
26
|
+
readonly mode: 'single-pass' | 'two-pass';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AIReviewDetailResult {
|
|
30
|
+
readonly findings: readonly AIReviewFinding[];
|
|
31
|
+
}
|
package/src/plus/ai/prompts.ts
CHANGED
|
@@ -350,7 +350,7 @@ Available search operators:
|
|
|
350
350
|
- 'commit:' - Search by a specific commit SHA (e.g. 'commit:4ce3a')
|
|
351
351
|
- 'file:' - Search by file path (e.g. 'file:"package.json"', 'file:"*.ts"'); maps to \`git log -- <value>\`
|
|
352
352
|
- 'change:' - Search by specific code changes using regular expressions (e.g. 'change:"function.*auth"', 'change:"import.*react"'); maps to \`git log -G<value>\`
|
|
353
|
-
- 'type:' - Search by type -- supports stash and
|
|
353
|
+
- 'type:' - Search by type -- supports stash, tip, and wip (e.g. 'type:stash', 'type:tip', 'type:wip'). Use 'type:wip' for queries about work in progress, uncommitted changes, or pending changes across worktrees.
|
|
354
354
|
- 'ref:' - Search for commits reachable by a reference (branch, tag, commit) or reference range. Supports single refs (e.g. 'ref:main', 'ref:v1.0'), two-dot ranges (e.g. 'ref:main..feature' for commits in feature but not in main), three-dot ranges (e.g. 'ref:main...feature' for symmetric difference), and relative refs (e.g. 'ref:HEAD~5..HEAD'); maps to \`git log <ref>\`
|
|
355
355
|
- 'after:' - Search for commits after a certain date or range (e.g. 'after:2023-01-01', 'after:"6 months ago"', 'after:"last Tuesday"', 'after:"noon"', 'after:"1 month 2 days ago"'); maps to \`git log --since=<value>\`
|
|
356
356
|
- 'before:' - Search for commits before a certain date or range (e.g. 'before:2023-01-01', 'before:"6 months ago"', 'before:"yesterday"', 'before:"3PM GMT"'); maps to \`git log --until=<value>\`
|
|
@@ -526,3 +526,173 @@ You can use GitKraken MCP tools to gather additional context about the repositor
|
|
|
526
526
|
|
|
527
527
|
Now, proceed with your analysis and provide a comprehensive review of the PR. Return only the relevant information without any additional text.`,
|
|
528
528
|
};
|
|
529
|
+
|
|
530
|
+
export const reviewChanges: PromptTemplate<'review-changes'> = {
|
|
531
|
+
id: 'review-changes',
|
|
532
|
+
variables: ['diff', 'message', 'context', 'instructions'],
|
|
533
|
+
template: `You are an expert code reviewer analyzing a set of code changes. Your goal is to identify meaningful issues — bugs, logic errors, security vulnerabilities, missing error handling, and potential regressions — while ignoring style preferences and linter-level concerns. Focus on problems a careful human reviewer would catch.
|
|
534
|
+
|
|
535
|
+
Examine the following code changes in Git diff format. Each non-header line inside a hunk has been annotated with its 1-based new-file line number in a \`[NNNNN]\` block placed immediately after the line-type marker (\` \`, \`+\`, or \`-\`):
|
|
536
|
+
\` [ 42] context line\` // context: exists in both old and new; number = new-file line
|
|
537
|
+
\`+[ 43] added line\` // added: only in new file; number = new-file line
|
|
538
|
+
\`-[ ] removed line\` // removed: not in new file; brackets are blank
|
|
539
|
+
\`@@ -10,5 +12,7 @@ ...\` // hunk header (no annotation; ignore for line citing)
|
|
540
|
+
<~~diff~~>
|
|
541
|
+
\${diff}
|
|
542
|
+
</~~diff~~>
|
|
543
|
+
|
|
544
|
+
Author's description of the changes:
|
|
545
|
+
<~~message~~>
|
|
546
|
+
\${message}
|
|
547
|
+
</~~message~~>
|
|
548
|
+
|
|
549
|
+
Related work items (known pull requests and issues for this change set). Use these for *intent*: what the change is trying to accomplish. They are not authoritative spec — if a finding contradicts the stated intent, flag it rather than defer to it. May be empty.
|
|
550
|
+
\${context}
|
|
551
|
+
|
|
552
|
+
Produce a structured review in the following XML format. Include ONLY the XML tags described — no other text:
|
|
553
|
+
|
|
554
|
+
<overview>
|
|
555
|
+
A concise 1-3 sentence summary of what these changes do and their overall quality. Note any systemic concerns.
|
|
556
|
+
</overview>
|
|
557
|
+
<focus-areas>
|
|
558
|
+
<area severity="critical|warning|suggestion" files="comma-separated file paths">
|
|
559
|
+
<label>Short title of the concern (under 60 chars)</label>
|
|
560
|
+
<rationale>Why this matters — what could go wrong or what is suboptimal</rationale>
|
|
561
|
+
<findings>
|
|
562
|
+
<finding severity="critical|warning|suggestion" file="path/to/file.ts" lines="start-end">
|
|
563
|
+
<title>Specific issue title</title>
|
|
564
|
+
<description>Clear explanation of the problem and how to address it</description>
|
|
565
|
+
</finding>
|
|
566
|
+
</findings>
|
|
567
|
+
</area>
|
|
568
|
+
</focus-areas>
|
|
569
|
+
|
|
570
|
+
Guidelines:
|
|
571
|
+
- Severity levels: "critical" = bugs, security issues, data loss risks; "warning" = logic concerns, missing error handling, potential regressions; "suggestion" = improvements, maintainability, performance
|
|
572
|
+
- Group related findings into focus areas by theme, not by file
|
|
573
|
+
- If changes look correct and well-structured, say so in the overview and include zero focus areas
|
|
574
|
+
- 3-5 high-quality findings are better than 15 low-quality ones
|
|
575
|
+
- For \`lines="start-end"\`, copy the numbers from the \`[NNNNN]\` annotations of the specific lines your finding concerns. Do not count, infer, or estimate — use only the annotated numbers. Removed lines (blank brackets \`[ ]\`) cannot be cited; pick the nearest surrounding new-file line instead. Anchor the range tightly to the lines the finding actually concerns; do not span an entire hunk.
|
|
576
|
+
- Do not flag style issues, naming preferences, or things a linter would catch
|
|
577
|
+
- Base conclusions only on the code shown — do not speculate about unseen code
|
|
578
|
+
|
|
579
|
+
\${instructions}
|
|
580
|
+
|
|
581
|
+
Review the changes and produce the structured XML output above.`,
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
export const reviewOverview: PromptTemplate<'review-overview'> = {
|
|
585
|
+
id: 'review-overview',
|
|
586
|
+
variables: ['files', 'message', 'context', 'instructions'],
|
|
587
|
+
template: `You are an expert code reviewer performing an initial assessment of a set of code changes. You are given a file manifest (not full diffs) — use the file paths, change types, and line counts to identify which areas deserve closer inspection.
|
|
588
|
+
|
|
589
|
+
File manifest (JSON array of changed files):
|
|
590
|
+
<~~files~~>
|
|
591
|
+
\${files}
|
|
592
|
+
</~~files~~>
|
|
593
|
+
|
|
594
|
+
Author's description of the changes:
|
|
595
|
+
<~~message~~>
|
|
596
|
+
\${message}
|
|
597
|
+
</~~message~~>
|
|
598
|
+
|
|
599
|
+
Related work items (known pull requests and issues for this change set). Use these for *intent* — what the change is trying to accomplish — when ranking which areas deserve closer review. May be empty.
|
|
600
|
+
\${context}
|
|
601
|
+
|
|
602
|
+
Produce a structured assessment in the following XML format. Include ONLY the XML tags described — no other text:
|
|
603
|
+
|
|
604
|
+
<overview>
|
|
605
|
+
A concise 1-3 sentence summary of the scope and nature of these changes based on the file manifest and description.
|
|
606
|
+
</overview>
|
|
607
|
+
<focus-areas>
|
|
608
|
+
<area severity="critical|warning|suggestion" files="comma-separated file paths">
|
|
609
|
+
<label>Short title of the area to inspect (under 60 chars)</label>
|
|
610
|
+
<rationale>Why this area deserves closer review — based on the types of files changed, the volume of changes, and potential risk</rationale>
|
|
611
|
+
</area>
|
|
612
|
+
</focus-areas>
|
|
613
|
+
|
|
614
|
+
Guidelines:
|
|
615
|
+
- Severity reflects potential risk: "critical" = security-sensitive files, auth/crypto/payment paths, database migrations; "warning" = core logic changes, API changes, large modifications; "suggestion" = refactoring, config changes, documentation
|
|
616
|
+
- Rank focus areas from highest to lowest risk
|
|
617
|
+
- Group related files into focus areas by theme
|
|
618
|
+
- Include 2-6 focus areas. If changes are very simple, fewer is fine
|
|
619
|
+
- Do NOT include <findings> — those come in a later pass when full diffs are available
|
|
620
|
+
|
|
621
|
+
\${instructions}
|
|
622
|
+
|
|
623
|
+
Assess the changes and produce the structured XML output above.`,
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
export const addressReviewFindings: PromptTemplate<'address-review-findings'> = {
|
|
627
|
+
id: 'address-review-findings',
|
|
628
|
+
variables: ['reviewMarkdown', 'scopeLabel', 'granularity', 'instructions'],
|
|
629
|
+
template: `You are an AI coding agent tasked with addressing the issues identified in a code review. Your goal is to understand each finding and, where appropriate, propose or make the code changes needed to fix it.
|
|
630
|
+
|
|
631
|
+
The review was performed against: \${scopeLabel}
|
|
632
|
+
|
|
633
|
+
The findings are provided as structured markdown below. Each finding includes a severity (\`**[CRITICAL]**\`, \`**[WARNING]**\`, or \`**[SUGGESTION]**\`), a short title, a description of the problem, and (when available) a file path and line range. Focus areas group related findings and include a rationale explaining why they matter.
|
|
634
|
+
|
|
635
|
+
<review>
|
|
636
|
+
\${reviewMarkdown}
|
|
637
|
+
</review>
|
|
638
|
+
|
|
639
|
+
Guidelines:
|
|
640
|
+
- Treat the findings as a working list. Prioritize critical issues, then warnings, then suggestions.
|
|
641
|
+
- For each finding, locate the referenced file(s) in the workspace before proposing a fix. If the file or line range no longer matches the review (the code may have evolved), reconcile against the current state.
|
|
642
|
+
- When making code changes, address the underlying problem the finding describes — do not just paper over symptoms.
|
|
643
|
+
- Prefer minimal, focused edits that don't introduce unrelated changes.
|
|
644
|
+
- If a finding is ambiguous, contradicts the surrounding code's intent, or is already addressed in the current state, say so explicitly rather than fabricating a fix.
|
|
645
|
+
- If a finding is out of scope (touches unrelated systems, requires significant refactoring, or contradicts established patterns), surface that as a tradeoff rather than acting on it.
|
|
646
|
+
|
|
647
|
+
\${instructions}`,
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
export const reviewDetail: PromptTemplate<'review-detail'> = {
|
|
651
|
+
id: 'review-detail',
|
|
652
|
+
variables: ['diff', 'overview', 'message', 'focusArea', 'context', 'instructions'],
|
|
653
|
+
template: `You are an expert code reviewer performing a detailed inspection of specific files that were flagged for closer review. You have the context from an initial overview assessment.
|
|
654
|
+
|
|
655
|
+
Initial overview of the full changeset:
|
|
656
|
+
<~~overview~~>
|
|
657
|
+
\${overview}
|
|
658
|
+
</~~overview~~>
|
|
659
|
+
|
|
660
|
+
Focus area being inspected: \${focusArea}
|
|
661
|
+
|
|
662
|
+
Author's description of the changes:
|
|
663
|
+
<~~message~~>
|
|
664
|
+
\${message}
|
|
665
|
+
</~~message~~>
|
|
666
|
+
|
|
667
|
+
Related work items (known pull requests and issues for this change set). Use these for *intent* — what the change is trying to accomplish. They are not authoritative spec; if a finding contradicts the stated intent, flag it. May be empty.
|
|
668
|
+
\${context}
|
|
669
|
+
|
|
670
|
+
Code changes for the files in this focus area (Git diff format). Each non-header line inside a hunk has been annotated with its 1-based new-file line number in a \`[NNNNN]\` block placed immediately after the line-type marker (\` \`, \`+\`, or \`-\`):
|
|
671
|
+
\` [ 42] context line\` // context: exists in both old and new; number = new-file line
|
|
672
|
+
\`+[ 43] added line\` // added: only in new file; number = new-file line
|
|
673
|
+
\`-[ ] removed line\` // removed: not in new file; brackets are blank
|
|
674
|
+
\`@@ -10,5 +12,7 @@ ...\` // hunk header (no annotation; ignore for line citing)
|
|
675
|
+
<~~diff~~>
|
|
676
|
+
\${diff}
|
|
677
|
+
</~~diff~~>
|
|
678
|
+
|
|
679
|
+
Produce detailed findings in the following XML format. Include ONLY the XML tags — no other text:
|
|
680
|
+
|
|
681
|
+
<findings>
|
|
682
|
+
<finding severity="critical|warning|suggestion" file="path/to/file.ts" lines="start-end">
|
|
683
|
+
<title>Specific issue title</title>
|
|
684
|
+
<description>Clear explanation of the problem and how to address it</description>
|
|
685
|
+
</finding>
|
|
686
|
+
</findings>
|
|
687
|
+
|
|
688
|
+
Guidelines:
|
|
689
|
+
- Severity: "critical" = bugs, security, data loss; "warning" = logic concerns, error handling, regressions; "suggestion" = improvements, maintainability
|
|
690
|
+
- For \`lines="start-end"\`, copy the numbers from the \`[NNNNN]\` annotations of the specific lines your finding concerns. Do not count, infer, or estimate — use only the annotated numbers. Removed lines (blank brackets \`[ ]\`) cannot be cited; pick the nearest surrounding new-file line instead. Anchor the range tightly to the lines the finding actually concerns; do not span an entire hunk.
|
|
691
|
+
- Be concrete — explain what the problem is and how to fix it
|
|
692
|
+
- If the code in this area looks correct, return an empty <findings></findings> block
|
|
693
|
+
- Do not flag style issues or things a linter would catch
|
|
694
|
+
|
|
695
|
+
\${instructions}
|
|
696
|
+
|
|
697
|
+
Inspect the diff for this focus area and produce the structured XML findings above.`,
|
|
698
|
+
};
|
|
@@ -4,6 +4,8 @@ export function getActionName(action: AIActionType): string {
|
|
|
4
4
|
switch (action) {
|
|
5
5
|
case 'explain-changes':
|
|
6
6
|
return 'Explain Changes';
|
|
7
|
+
case 'review-changes':
|
|
8
|
+
return 'Review Changes';
|
|
7
9
|
case 'generate-commitMessage':
|
|
8
10
|
return 'Generate Commit Message';
|
|
9
11
|
case 'generate-stashMessage':
|