@gitkraken/core-gitlens 0.33.0 → 0.35.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/git/cache.d.ts +31 -0
  3. package/dist/git/cache.js +101 -30
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/context.d.ts +3 -1
  6. package/dist/git/context.js.map +1 -1
  7. package/dist/git/errors.d.ts +3 -1
  8. package/dist/git/errors.js +4 -1
  9. package/dist/git/errors.js.map +1 -1
  10. package/dist/git/models/pullRequest.d.ts +90 -1
  11. package/dist/git/models/pullRequest.js +18 -2
  12. package/dist/git/models/pullRequest.js.map +1 -1
  13. package/dist/git/providers/shared/remotes.js +2 -0
  14. package/dist/git/providers/shared/remotes.js.map +1 -1
  15. package/dist/git/utils/pullRequest.utils.d.ts +72 -1
  16. package/dist/git/utils/pullRequest.utils.js +99 -1
  17. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  18. package/dist/git/utils/repository.utils.d.ts +6 -0
  19. package/dist/git/utils/repository.utils.js +14 -2
  20. package/dist/git/utils/repository.utils.js.map +1 -1
  21. package/dist/git/watching/gitDirPoller.d.ts +10 -1
  22. package/dist/git/watching/gitDirPoller.js +9 -3
  23. package/dist/git/watching/gitDirPoller.js.map +1 -1
  24. package/dist/git/watching/unwatchedCacheValidator.d.ts +144 -0
  25. package/dist/git/watching/unwatchedCacheValidator.js +884 -0
  26. package/dist/git/watching/unwatchedCacheValidator.js.map +1 -0
  27. package/dist/git/watching/watchGroup.d.ts +2 -0
  28. package/dist/git/watching/watchGroup.js +4 -8
  29. package/dist/git/watching/watchGroup.js.map +1 -1
  30. package/dist/git/watching/watchService.d.ts +23 -0
  31. package/dist/git/watching/watchService.js +42 -2
  32. package/dist/git/watching/watchService.js.map +1 -1
  33. package/dist/git/watching/watchSession.d.ts +2 -0
  34. package/dist/git/watching/watchSession.js +3 -2
  35. package/dist/git/watching/watchSession.js.map +1 -1
  36. package/dist/git-cli/cliGitProvider.js +1 -1
  37. package/dist/git-cli/cliGitProvider.js.map +1 -1
  38. package/dist/git-cli/exec/commandClassifier.d.ts +31 -1
  39. package/dist/git-cli/exec/commandClassifier.js +67 -16
  40. package/dist/git-cli/exec/commandClassifier.js.map +1 -1
  41. package/dist/git-cli/exec/git.d.ts +46 -2
  42. package/dist/git-cli/exec/git.js +80 -7
  43. package/dist/git-cli/exec/git.js.map +1 -1
  44. package/dist/git-cli/exec/gitDirResolver.d.ts +11 -0
  45. package/dist/git-cli/exec/gitDirResolver.js +34 -1
  46. package/dist/git-cli/exec/gitDirResolver.js.map +1 -1
  47. package/dist/git-cli/exec/gitQueue.js +2 -28
  48. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  49. package/dist/git-cli/providers/branches.d.ts +1 -0
  50. package/dist/git-cli/providers/branches.js +6 -0
  51. package/dist/git-cli/providers/branches.js.map +1 -1
  52. package/dist/git-cli/providers/config.d.ts +13 -1
  53. package/dist/git-cli/providers/config.js +48 -14
  54. package/dist/git-cli/providers/config.js.map +1 -1
  55. package/dist/git-cli/providers/pausedOperations.d.ts +1 -0
  56. package/dist/git-cli/providers/pausedOperations.js +4 -0
  57. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  58. package/dist/git-cli/providers/revision.js +2 -0
  59. package/dist/git-cli/providers/revision.js.map +1 -1
  60. package/dist/git-cli/providers/worktrees.js +2 -0
  61. package/dist/git-cli/providers/worktrees.js.map +1 -1
  62. package/dist/git-cli/service.d.ts +25 -1
  63. package/dist/git-cli/service.js +45 -0
  64. package/dist/git-cli/service.js.map +1 -1
  65. package/dist/plus/ai/errors.d.ts +8 -2
  66. package/dist/plus/ai/errors.js +15 -3
  67. package/dist/plus/ai/errors.js.map +1 -1
  68. package/dist/plus/git-github/api/config.d.ts +11 -0
  69. package/dist/plus/git-github/api/config.js.map +1 -1
  70. package/dist/plus/git-github/api/github.d.ts +82 -1
  71. package/dist/plus/git-github/api/github.js +304 -7
  72. package/dist/plus/git-github/api/github.js.map +1 -1
  73. package/dist/plus/git-github/models.d.ts +61 -1
  74. package/dist/plus/git-github/models.js +49 -3
  75. package/dist/plus/git-github/models.js.map +1 -1
  76. package/dist/plus/integrations/context.d.ts +12 -0
  77. package/dist/plus/integrations/fieldPresence.d.ts +16 -1
  78. package/dist/plus/integrations/fieldPresence.js +37 -10
  79. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  80. package/dist/plus/integrations/integrationService.d.ts +12 -0
  81. package/dist/plus/integrations/integrationService.js +4 -0
  82. package/dist/plus/integrations/integrationService.js.map +1 -1
  83. package/dist/plus/integrations/manager.d.ts +38 -0
  84. package/dist/plus/integrations/models/gitHostIntegration.d.ts +41 -1
  85. package/dist/plus/integrations/models/gitHostIntegration.js +51 -0
  86. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  87. package/dist/plus/integrations/models/integration.d.ts +23 -2
  88. package/dist/plus/integrations/models/integration.js.map +1 -1
  89. package/dist/plus/integrations/providers/github/github.js +2 -1
  90. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  91. package/dist/plus/integrations/providers/github.d.ts +21 -1
  92. package/dist/plus/integrations/providers/github.js +71 -6
  93. package/dist/plus/integrations/providers/github.js.map +1 -1
  94. package/dist/plus/integrations/reads/context.d.ts +7 -0
  95. package/dist/plus/integrations/reads/drains.d.ts +1 -1
  96. package/dist/plus/integrations/reads/drains.js +2 -1
  97. package/dist/plus/integrations/reads/drains.js.map +1 -1
  98. package/dist/plus/integrations/reads/etag.js +13 -0
  99. package/dist/plus/integrations/reads/etag.js.map +1 -1
  100. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +6 -2
  101. package/dist/plus/integrations/reads/pullRequestBatch.js +9 -2
  102. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  103. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
  104. package/dist/plus/integrations/reads/pullRequestBranches.js +3 -1
  105. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  106. package/dist/plus/integrations/reads/pullRequests.d.ts +2 -0
  107. package/dist/plus/integrations/reads/pullRequests.js +2 -1
  108. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  109. package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
  110. package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
  111. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  112. package/docs/integrations.md +77 -15
  113. package/package.json +1 -1
@@ -297,7 +297,9 @@ export interface SearchQueryProvider {
297
297
  * Used by sub-providers for workspace folder lookup and to gate operations
298
298
  * in untrusted workspaces.
299
299
  *
300
- * When `isTrusted` is absent, the workspace is assumed trusted.
300
+ * When `isTrusted` is absent, the workspace is assumed trusted. A host serving several repositories that
301
+ * needs a verdict per repository leaves it absent and supplies the git executor's per-path
302
+ * `gitOptions.isTrusted` instead; a set `isTrusted` here wins and answers for every path.
301
303
  */
302
304
  export interface WorkspaceProvider {
303
305
  /** Fires when the workspace trust state changes (e.g., user grants trust) */
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":[],"sources":["../../../git/src/context.ts"],"sourcesContent":["import type { Event } from '@gitlens/utils/event.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport type { CachedGitTypes } from './cache.js';\nimport type { SigningErrorReason } from './errors.js';\nimport type { GitRemote } from './models/remote.js';\nimport type { RemoteProvider, RemoteProviderId } from './models/remoteProvider.js';\nimport type { RepositoryChange } from './models/repository.js';\nimport type { SearchQuery } from './models/search.js';\nimport type { SigningFormat } from './models/signature.js';\nimport type { GitConflictFile } from './models/staging.js';\nimport type { RemoteProviderConfig } from './remotes/matcher.js';\n\n/**\n * Context provided to sub-providers at construction time.\n * Replaces the Container dependency in the GitLens extension.\n *\n * This is intentionally minimal — most configuration is passed as explicit\n * per-call options on sub-provider methods, not hidden in a context object.\n */\nexport interface GitServiceContext {\n\t/**\n\t * Provides default values for sub-provider options when callers omit them.\n\t * If not provided, sub-providers use their own built-in defaults.\n\t */\n\treadonly config?: GitServiceConfig;\n\t/** File system abstraction for reading files, checking stats, and listing directories. */\n\treadonly fs: FileSystemProvider;\n\t/** Outbound hooks for events from library to host */\n\treadonly hooks?: GitServiceHooks;\n\t/** Host-side remote capabilities (custom providers, sorting, repo info) */\n\treadonly remotes?: RemotesProvider;\n\t/** Search query preprocessing hooks (e.g., NLP → structured search). */\n\treadonly searchQuery?: SearchQueryProvider;\n\t/** Workspace environment (folder resolution, trust state) */\n\treadonly workspace?: WorkspaceProvider;\n}\n\n/**\n * Provides default values for sub-provider options when callers omit them.\n *\n * Consumers implement this backed by their own config system (e.g., VS Code settings).\n * Properties are getters so values are read fresh each time — consumers can make them\n * reactive to config changes.\n *\n * Library sub-providers check `context.config?.{property}` when the caller doesn't\n * pass the corresponding option, falling back to sensible built-in defaults if the\n * config provider is also absent.\n */\nexport interface GitServiceConfig {\n\treadonly commits: {\n\t\t/**\n\t\t * Whether commit/stash queries include per-commit file details by default, resolved per\n\t\t * repository so a host can defer them where loading them has proven slow.\n\t\t */\n\t\treadonly includeFileDetails?: (repoPath: string) => boolean;\n\t\t/** Default commit ordering for log/branch queries (e.g., `'date'`, `'author-date'`, `'topo'`). */\n\t\treadonly ordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t/** Default maximum items for operations (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t\t/** Similarity threshold for rename detection (0–100). `null` uses Git's default. */\n\t\treadonly similarityThreshold?: number | null;\n\t};\n\n\t/** File-history–specific defaults for `getLogForPath`. */\n\treadonly fileHistory?: {\n\t\t/** Whether to show commits from all branches (maps to `--all`). */\n\t\treadonly showAllBranches?: boolean;\n\t\t/** Whether to include merge commits (maps to `--no-merges` when false). */\n\t\treadonly showMergeCommits?: boolean;\n\t\t/** Whether to follow renames (maps to `--follow`). */\n\t\treadonly followRenames?: boolean;\n\t};\n\n\t/** Search-specific defaults for `searchCommits`. */\n\treadonly search?: {\n\t\t/** Default maximum items for search results (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t};\n\n\t/** Graph-specific configuration defaults. */\n\treadonly graph?: {\n\t\t/** Whether to keep git's commit-graph file up to date in the background after graph loads —\n\t\t * written when missing, periodically refreshed to cover new commits (accelerates ordered\n\t\t * history walks — the graph's initial load). Fed from the master switch\n\t\t * (`gitlens.gitOptimizations.enabled`); `false` disables the background write. */\n\t\treadonly writeCommitGraph?: boolean;\n\t\t/** Graph commit ordering (falls back to `commits.ordering` or `'date'`). */\n\t\treadonly commitOrdering?: 'date' | 'author-date' | 'topo';\n\t\t/** Whether to only follow first parent in graph. */\n\t\treadonly onlyFollowFirstParent?: boolean;\n\t\t/** Whether to use avatars in graph. */\n\t\treadonly avatars?: boolean;\n\t\t/** Maximum search items (0 = unlimited). */\n\t\treadonly maxSearchItems?: number;\n\t};\n\n\t/** Auto-tier git-optimization (maintenance) preferences. */\n\treadonly maintenance?: {\n\t\t/** Master switch for the auto-tier optimizations (maps to `gitlens.gitOptimizations.enabled`). Defaults to `true`. */\n\t\treadonly enabled?: boolean;\n\t};\n\n\t/** Force-push preferences. */\n\treadonly push?: {\n\t\t/** Whether to use `--force-with-lease` instead of a plain `--force` when force-pushing. Defaults to `true`. */\n\t\treadonly useForceWithLease?: boolean;\n\t\t/**\n\t\t * Whether to add `--force-if-includes` when force-pushing. Only applies when `useForceWithLease` is `true`\n\t\t * and the installed Git supports it. Defaults to `true`.\n\t\t */\n\t\treadonly useForceIfIncludes?: boolean;\n\t};\n\n\t/** Commit-signing preferences. */\n\treadonly signing?: {\n\t\t/**\n\t\t * Host-level override for whether commit signing is enabled (e.g. VS Code's `git.enableCommitSigning`).\n\t\t * When `true`, signing is treated as enabled even if the repo's `commit.gpgsign` is unset/false. It never\n\t\t * forces signing off.\n\t\t */\n\t\treadonly enabled?: boolean;\n\t};\n}\n\n/** Git command types that can produce conflicts. */\nexport type GitConflictCommand = 'merge' | 'rebase' | 'cherry-pick' | 'revert' | 'stash-apply' | 'stash-pop';\n\n/**\n * Hooks for outbound events from library to host.\n *\n * All hooks are optional — the library calls them when events occur,\n * and the host decides what to do (telemetry, logging, UI updates, etc.).\n *\n * Provider-augmented hooks (`cache`, `repository`) are wired by the provider\n * to its emitters at construction time. Pass-through hooks (`commits`,\n * `operations`) are provided by the host and forwarded unchanged.\n */\nexport interface GitServiceHooks {\n\t/** Cache lifecycle hooks — wired by the provider to its cache-reset emitter */\n\treadonly cache?: {\n\t\t/**\n\t\t * Called after the provider changed repository state (a typed write, or `notifyChanged`). The provider\n\t\t * has already cleared its own caches for those types and the repository's pending commands (its sibling\n\t\t * worktrees included); the handler only needs to update host-side state. Forwarding to\n\t\t * `Cache.clearCaches` as well is redundant but harmless.\n\t\t */\n\t\tonReset?(repoPath: string, ...types: CachedGitTypes[]): void;\n\t};\n\t/** Repository state hooks — wired by the provider to its repository-changed emitter */\n\treadonly repository?: {\n\t\t/**\n\t\t * Called when repository state has changed.\n\t\t *\n\t\t * `refs`, when given, are the full ref names (`refs/heads/main`, `refs/remotes/origin/main`) the write\n\t\t * created, moved or deleted. A ref kind in `changes` (`heads`, `remotes`, `tags`, `stash`) with at least\n\t\t * one name of its kind in `refs` is fully described by those names: no other ref of that kind moved. A ref\n\t\t * kind in `changes` with no name in `refs` stays unnamed — any ref of that kind may have moved. A host that\n\t\t * ignores `refs` treats every ref kind as unnamed, as before.\n\t\t *\n\t\t * `options.configConfinedToRefs`, given only with `config` among `changes`, says the write changed\n\t\t * `.git/config` only in the `branch.<name>` sections of the local branches `refs` names (`refs/heads/<name>`),\n\t\t * as a branch create, delete, rename or upstream change does. A branch's section matters only to a checkout on\n\t\t * that branch or one whose upstream or base is that branch, so the config change concerns exactly the\n\t\t * checkouts following those branches. Without it, the config change may be anywhere in the file, whatever\n\t\t * `refs` names. A host that ignores it treats every config change as unconfined, as before.\n\t\t */\n\t\tonChanged?(\n\t\t\trepoPath: string,\n\t\t\tchanges: RepositoryChange[],\n\t\t\trefs?: readonly string[],\n\t\t\toptions?: { readonly configConfinedToRefs?: boolean },\n\t\t): void;\n\t};\n\t/** Commit lifecycle hooks */\n\treadonly commits?: {\n\t\t/**\n\t\t * Called when a commit is signed successfully.\n\t\t *\n\t\t * Note: currently fired only from explicit-sign paths — the patch provider's\n\t\t * `commit-tree -S` and the commit operation when the host signing override\n\t\t * (`config.signing.enabled`) adds `-S`. Operations that sign implicitly via\n\t\t * `commit.gpgsign=true` (`commit` without the override, `merge`, `pull`,\n\t\t * `rebase`, `revert`, `cherryPick`) do not fire this hook because the\n\t\t * library cannot cheaply confirm that signing actually occurred without an\n\t\t * extra `git config`/`log --show-signature` call.\n\t\t */\n\t\tonSigned?(format: SigningFormat, source?: unknown): void;\n\t\t/** Called when commit signing fails — fired from all signing-capable paths. */\n\t\tonSigningFailed?(reason: SigningErrorReason, format: SigningFormat, source?: unknown): void;\n\t};\n\t/** Git operation hooks */\n\treadonly operations?: {\n\t\t/**\n\t\t * Called when a git command produced a conflict.\n\t\t * @param conflicts Optional conflicted file list. Populated for merge/rebase/cherry-pick/revert;\n\t\t * may be absent for stash operations or when the file list couldn't be read.\n\t\t */\n\t\tonConflicted?(command: GitConflictCommand, conflicts?: GitConflictFile[]): void;\n\t\t/** Called when getGitDir resolves to a non-existent .git directory or rev-parse fails */\n\t\tonGitDirResolveFailed?(repoPath: string, gitDir: string, errorMessage: string): void;\n\t\t/**\n\t\t * Called when a git operation that can start a rebase begins (`'started'`, before the\n\t\t * process runs) and again when the command exits (`'ended'`, on success and failure alike).\n\t\t * Fired at start (not from the result) because `git rebase` exits 0 when stopping at\n\t\t * `edit`/`break`, and fired for every pull because `pull.rebase=true` config can start\n\t\t * a rebase the host can't predict from the arguments. The `'ended'` phase lets the host\n\t\t * check whether the operation actually left a rebase in progress.\n\t\t * @param repoPath The path the rebase state will appear under (the worktree path for\n\t\t * worktree-targeted pulls)\n\t\t */\n\t\tonRebaseCapableOperation?(repoPath: string, command: 'rebase' | 'pull', phase: 'started' | 'ended'): void;\n\t};\n}\n\n/**\n * Host-provided context attached to remote providers at construction time.\n * Subset of {@link RemotesProvider} — only the fields individual providers need.\n */\nexport interface RemoteProviderContext {\n\t/** Returns repository info (e.g., ID) from the host's integration system */\n\treadonly getRepositoryInfo?: (\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t) => Promise<{ id: string } | undefined>;\n}\n\n/**\n * File system abstraction following the `workspace.fs` model.\n *\n * Hosts provide an implementation backed by their platform:\n * - Desktop (Node.js): wraps `workspace.fs` or `fs/promises`\n * - Browser: wraps `workspace.fs` for virtual file systems\n *\n * Used by sub-providers that need file system access without\n * importing Node.js `fs` or VS Code APIs directly.\n */\nexport interface FileStat {\n\ttype: number;\n\tctime: number;\n\tmtime: number;\n\tsize: number;\n}\n\n/**\n * File type bitmask matching `vscode.FileType`.\n * Values can be combined (e.g., `FileType.File | FileType.SymbolicLink`).\n */\nexport const FileType = {\n\tUnknown: 0,\n\tFile: 1,\n\tDirectory: 2,\n\tSymbolicLink: 64,\n} as const;\nexport type FileType = (typeof FileType)[keyof typeof FileType];\n\nexport interface FileSystemProvider {\n\treadDirectory(uri: Uri): Promise<[string, number][]>;\n\treadFile(uri: Uri): Promise<Uint8Array>;\n\tstat(uri: Uri): Promise<FileStat | undefined>;\n}\n\n/**\n * Host-side remote capabilities: custom provider configs, sorting, and repository info.\n *\n * The host provides extra provider configs (user custom remotes, cloud self-managed hosts)\n * and the library combines them with built-in providers to build a matcher.\n * Sorting lets the host control remote priority (integration metadata, user preferences).\n * Repository info enables cross-fork PR URLs via integration API lookups.\n */\nexport interface RemotesProvider {\n\t/**\n\t * Returns extra remote provider configurations beyond built-ins.\n\t * Includes user-configured custom remotes (from settings) and\n\t * cloud self-managed host integrations.\n\t */\n\tgetCustomProviders?(repoPath: string): Promise<RemoteProviderConfig[] | undefined>;\n\n\t/**\n\t * Returns repository info from the host's integration system.\n\t * Used by remote providers for cross-fork PR creation URLs.\n\t * Returns `undefined` if no integration is available or connected.\n\t */\n\tgetRepositoryInfo?(\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t): Promise<{ id: string } | undefined>;\n\n\t/**\n\t * Sorts remotes by priority. The host owns the full ranking policy\n\t * (remote name heuristics, integration metadata, user preferences).\n\t * If not provided, the library returns remotes in their original order.\n\t */\n\tsort?(remotes: GitRemote<RemoteProvider>[], cancellation?: AbortSignal): Promise<GitRemote<RemoteProvider>[]>;\n}\n\n/**\n * Provides search query preprocessing.\n *\n * Hosts implement this to add capabilities like NLP → structured search\n * conversion before the library executes the query.\n */\nexport interface SearchQueryProvider {\n\t/**\n\t * Pre-processes a search query before execution (e.g., converts natural language to structured search).\n\t * Called by commits sub-provider before executing `searchCommits`.\n\t */\n\tpreprocessQuery?(search: SearchQuery, source?: unknown): Promise<SearchQuery>;\n}\n\n/**\n * Provides workspace environment info: folder resolution and trust state.\n * Used by sub-providers for workspace folder lookup and to gate operations\n * in untrusted workspaces.\n *\n * When `isTrusted` is absent, the workspace is assumed trusted.\n */\nexport interface WorkspaceProvider {\n\t/** Fires when the workspace trust state changes (e.g., user grants trust) */\n\treadonly onDidChangeTrust?: Event<boolean>;\n\n\t/** Whether the workspace is currently trusted */\n\treadonly isTrusted?: boolean;\n\n\t/** Resolves the workspace folder that contains the given repoPath */\n\tgetFolder(repoPath: string): { path: string } | undefined;\n\n\t/** Returns the default URI for new worktrees, given a repository path. */\n\tgetWorktreeDefaultUri?(repoPath: string): Uri | undefined;\n}\n"],"mappings":";;;;;AAuPA,MAAa,WAAW;CACvB,SAAS;CACT,MAAM;CACN,WAAW;CACX,cAAc;AACf"}
1
+ {"version":3,"file":"context.js","names":[],"sources":["../../../git/src/context.ts"],"sourcesContent":["import type { Event } from '@gitlens/utils/event.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport type { CachedGitTypes } from './cache.js';\nimport type { SigningErrorReason } from './errors.js';\nimport type { GitRemote } from './models/remote.js';\nimport type { RemoteProvider, RemoteProviderId } from './models/remoteProvider.js';\nimport type { RepositoryChange } from './models/repository.js';\nimport type { SearchQuery } from './models/search.js';\nimport type { SigningFormat } from './models/signature.js';\nimport type { GitConflictFile } from './models/staging.js';\nimport type { RemoteProviderConfig } from './remotes/matcher.js';\n\n/**\n * Context provided to sub-providers at construction time.\n * Replaces the Container dependency in the GitLens extension.\n *\n * This is intentionally minimal — most configuration is passed as explicit\n * per-call options on sub-provider methods, not hidden in a context object.\n */\nexport interface GitServiceContext {\n\t/**\n\t * Provides default values for sub-provider options when callers omit them.\n\t * If not provided, sub-providers use their own built-in defaults.\n\t */\n\treadonly config?: GitServiceConfig;\n\t/** File system abstraction for reading files, checking stats, and listing directories. */\n\treadonly fs: FileSystemProvider;\n\t/** Outbound hooks for events from library to host */\n\treadonly hooks?: GitServiceHooks;\n\t/** Host-side remote capabilities (custom providers, sorting, repo info) */\n\treadonly remotes?: RemotesProvider;\n\t/** Search query preprocessing hooks (e.g., NLP → structured search). */\n\treadonly searchQuery?: SearchQueryProvider;\n\t/** Workspace environment (folder resolution, trust state) */\n\treadonly workspace?: WorkspaceProvider;\n}\n\n/**\n * Provides default values for sub-provider options when callers omit them.\n *\n * Consumers implement this backed by their own config system (e.g., VS Code settings).\n * Properties are getters so values are read fresh each time — consumers can make them\n * reactive to config changes.\n *\n * Library sub-providers check `context.config?.{property}` when the caller doesn't\n * pass the corresponding option, falling back to sensible built-in defaults if the\n * config provider is also absent.\n */\nexport interface GitServiceConfig {\n\treadonly commits: {\n\t\t/**\n\t\t * Whether commit/stash queries include per-commit file details by default, resolved per\n\t\t * repository so a host can defer them where loading them has proven slow.\n\t\t */\n\t\treadonly includeFileDetails?: (repoPath: string) => boolean;\n\t\t/** Default commit ordering for log/branch queries (e.g., `'date'`, `'author-date'`, `'topo'`). */\n\t\treadonly ordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t/** Default maximum items for operations (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t\t/** Similarity threshold for rename detection (0–100). `null` uses Git's default. */\n\t\treadonly similarityThreshold?: number | null;\n\t};\n\n\t/** File-history–specific defaults for `getLogForPath`. */\n\treadonly fileHistory?: {\n\t\t/** Whether to show commits from all branches (maps to `--all`). */\n\t\treadonly showAllBranches?: boolean;\n\t\t/** Whether to include merge commits (maps to `--no-merges` when false). */\n\t\treadonly showMergeCommits?: boolean;\n\t\t/** Whether to follow renames (maps to `--follow`). */\n\t\treadonly followRenames?: boolean;\n\t};\n\n\t/** Search-specific defaults for `searchCommits`. */\n\treadonly search?: {\n\t\t/** Default maximum items for search results (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t};\n\n\t/** Graph-specific configuration defaults. */\n\treadonly graph?: {\n\t\t/** Whether to keep git's commit-graph file up to date in the background after graph loads —\n\t\t * written when missing, periodically refreshed to cover new commits (accelerates ordered\n\t\t * history walks — the graph's initial load). Fed from the master switch\n\t\t * (`gitlens.gitOptimizations.enabled`); `false` disables the background write. */\n\t\treadonly writeCommitGraph?: boolean;\n\t\t/** Graph commit ordering (falls back to `commits.ordering` or `'date'`). */\n\t\treadonly commitOrdering?: 'date' | 'author-date' | 'topo';\n\t\t/** Whether to only follow first parent in graph. */\n\t\treadonly onlyFollowFirstParent?: boolean;\n\t\t/** Whether to use avatars in graph. */\n\t\treadonly avatars?: boolean;\n\t\t/** Maximum search items (0 = unlimited). */\n\t\treadonly maxSearchItems?: number;\n\t};\n\n\t/** Auto-tier git-optimization (maintenance) preferences. */\n\treadonly maintenance?: {\n\t\t/** Master switch for the auto-tier optimizations (maps to `gitlens.gitOptimizations.enabled`). Defaults to `true`. */\n\t\treadonly enabled?: boolean;\n\t};\n\n\t/** Force-push preferences. */\n\treadonly push?: {\n\t\t/** Whether to use `--force-with-lease` instead of a plain `--force` when force-pushing. Defaults to `true`. */\n\t\treadonly useForceWithLease?: boolean;\n\t\t/**\n\t\t * Whether to add `--force-if-includes` when force-pushing. Only applies when `useForceWithLease` is `true`\n\t\t * and the installed Git supports it. Defaults to `true`.\n\t\t */\n\t\treadonly useForceIfIncludes?: boolean;\n\t};\n\n\t/** Commit-signing preferences. */\n\treadonly signing?: {\n\t\t/**\n\t\t * Host-level override for whether commit signing is enabled (e.g. VS Code's `git.enableCommitSigning`).\n\t\t * When `true`, signing is treated as enabled even if the repo's `commit.gpgsign` is unset/false. It never\n\t\t * forces signing off.\n\t\t */\n\t\treadonly enabled?: boolean;\n\t};\n}\n\n/** Git command types that can produce conflicts. */\nexport type GitConflictCommand = 'merge' | 'rebase' | 'cherry-pick' | 'revert' | 'stash-apply' | 'stash-pop';\n\n/**\n * Hooks for outbound events from library to host.\n *\n * All hooks are optional — the library calls them when events occur,\n * and the host decides what to do (telemetry, logging, UI updates, etc.).\n *\n * Provider-augmented hooks (`cache`, `repository`) are wired by the provider\n * to its emitters at construction time. Pass-through hooks (`commits`,\n * `operations`) are provided by the host and forwarded unchanged.\n */\nexport interface GitServiceHooks {\n\t/** Cache lifecycle hooks — wired by the provider to its cache-reset emitter */\n\treadonly cache?: {\n\t\t/**\n\t\t * Called after the provider changed repository state (a typed write, or `notifyChanged`). The provider\n\t\t * has already cleared its own caches for those types and the repository's pending commands (its sibling\n\t\t * worktrees included); the handler only needs to update host-side state. Forwarding to\n\t\t * `Cache.clearCaches` as well is redundant but harmless.\n\t\t */\n\t\tonReset?(repoPath: string, ...types: CachedGitTypes[]): void;\n\t};\n\t/** Repository state hooks — wired by the provider to its repository-changed emitter */\n\treadonly repository?: {\n\t\t/**\n\t\t * Called when repository state has changed.\n\t\t *\n\t\t * `refs`, when given, are the full ref names (`refs/heads/main`, `refs/remotes/origin/main`) the write\n\t\t * created, moved or deleted. A ref kind in `changes` (`heads`, `remotes`, `tags`, `stash`) with at least\n\t\t * one name of its kind in `refs` is fully described by those names: no other ref of that kind moved. A ref\n\t\t * kind in `changes` with no name in `refs` stays unnamed — any ref of that kind may have moved. A host that\n\t\t * ignores `refs` treats every ref kind as unnamed, as before.\n\t\t *\n\t\t * `options.configConfinedToRefs`, given only with `config` among `changes`, says the write changed\n\t\t * `.git/config` only in the `branch.<name>` sections of the local branches `refs` names (`refs/heads/<name>`),\n\t\t * as a branch create, delete, rename or upstream change does. A branch's section matters only to a checkout on\n\t\t * that branch or one whose upstream or base is that branch, so the config change concerns exactly the\n\t\t * checkouts following those branches. Without it, the config change may be anywhere in the file, whatever\n\t\t * `refs` names. A host that ignores it treats every config change as unconfined, as before.\n\t\t */\n\t\tonChanged?(\n\t\t\trepoPath: string,\n\t\t\tchanges: RepositoryChange[],\n\t\t\trefs?: readonly string[],\n\t\t\toptions?: { readonly configConfinedToRefs?: boolean },\n\t\t): void;\n\t};\n\t/** Commit lifecycle hooks */\n\treadonly commits?: {\n\t\t/**\n\t\t * Called when a commit is signed successfully.\n\t\t *\n\t\t * Note: currently fired only from explicit-sign paths — the patch provider's\n\t\t * `commit-tree -S` and the commit operation when the host signing override\n\t\t * (`config.signing.enabled`) adds `-S`. Operations that sign implicitly via\n\t\t * `commit.gpgsign=true` (`commit` without the override, `merge`, `pull`,\n\t\t * `rebase`, `revert`, `cherryPick`) do not fire this hook because the\n\t\t * library cannot cheaply confirm that signing actually occurred without an\n\t\t * extra `git config`/`log --show-signature` call.\n\t\t */\n\t\tonSigned?(format: SigningFormat, source?: unknown): void;\n\t\t/** Called when commit signing fails — fired from all signing-capable paths. */\n\t\tonSigningFailed?(reason: SigningErrorReason, format: SigningFormat, source?: unknown): void;\n\t};\n\t/** Git operation hooks */\n\treadonly operations?: {\n\t\t/**\n\t\t * Called when a git command produced a conflict.\n\t\t * @param conflicts Optional conflicted file list. Populated for merge/rebase/cherry-pick/revert;\n\t\t * may be absent for stash operations or when the file list couldn't be read.\n\t\t */\n\t\tonConflicted?(command: GitConflictCommand, conflicts?: GitConflictFile[]): void;\n\t\t/** Called when getGitDir resolves to a non-existent .git directory or rev-parse fails */\n\t\tonGitDirResolveFailed?(repoPath: string, gitDir: string, errorMessage: string): void;\n\t\t/**\n\t\t * Called when a git operation that can start a rebase begins (`'started'`, before the\n\t\t * process runs) and again when the command exits (`'ended'`, on success and failure alike).\n\t\t * Fired at start (not from the result) because `git rebase` exits 0 when stopping at\n\t\t * `edit`/`break`, and fired for every pull because `pull.rebase=true` config can start\n\t\t * a rebase the host can't predict from the arguments. The `'ended'` phase lets the host\n\t\t * check whether the operation actually left a rebase in progress.\n\t\t * @param repoPath The path the rebase state will appear under (the worktree path for\n\t\t * worktree-targeted pulls)\n\t\t */\n\t\tonRebaseCapableOperation?(repoPath: string, command: 'rebase' | 'pull', phase: 'started' | 'ended'): void;\n\t};\n}\n\n/**\n * Host-provided context attached to remote providers at construction time.\n * Subset of {@link RemotesProvider} — only the fields individual providers need.\n */\nexport interface RemoteProviderContext {\n\t/** Returns repository info (e.g., ID) from the host's integration system */\n\treadonly getRepositoryInfo?: (\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t) => Promise<{ id: string } | undefined>;\n}\n\n/**\n * File system abstraction following the `workspace.fs` model.\n *\n * Hosts provide an implementation backed by their platform:\n * - Desktop (Node.js): wraps `workspace.fs` or `fs/promises`\n * - Browser: wraps `workspace.fs` for virtual file systems\n *\n * Used by sub-providers that need file system access without\n * importing Node.js `fs` or VS Code APIs directly.\n */\nexport interface FileStat {\n\ttype: number;\n\tctime: number;\n\tmtime: number;\n\tsize: number;\n}\n\n/**\n * File type bitmask matching `vscode.FileType`.\n * Values can be combined (e.g., `FileType.File | FileType.SymbolicLink`).\n */\nexport const FileType = {\n\tUnknown: 0,\n\tFile: 1,\n\tDirectory: 2,\n\tSymbolicLink: 64,\n} as const;\nexport type FileType = (typeof FileType)[keyof typeof FileType];\n\nexport interface FileSystemProvider {\n\treadDirectory(uri: Uri): Promise<[string, number][]>;\n\treadFile(uri: Uri): Promise<Uint8Array>;\n\tstat(uri: Uri): Promise<FileStat | undefined>;\n}\n\n/**\n * Host-side remote capabilities: custom provider configs, sorting, and repository info.\n *\n * The host provides extra provider configs (user custom remotes, cloud self-managed hosts)\n * and the library combines them with built-in providers to build a matcher.\n * Sorting lets the host control remote priority (integration metadata, user preferences).\n * Repository info enables cross-fork PR URLs via integration API lookups.\n */\nexport interface RemotesProvider {\n\t/**\n\t * Returns extra remote provider configurations beyond built-ins.\n\t * Includes user-configured custom remotes (from settings) and\n\t * cloud self-managed host integrations.\n\t */\n\tgetCustomProviders?(repoPath: string): Promise<RemoteProviderConfig[] | undefined>;\n\n\t/**\n\t * Returns repository info from the host's integration system.\n\t * Used by remote providers for cross-fork PR creation URLs.\n\t * Returns `undefined` if no integration is available or connected.\n\t */\n\tgetRepositoryInfo?(\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t): Promise<{ id: string } | undefined>;\n\n\t/**\n\t * Sorts remotes by priority. The host owns the full ranking policy\n\t * (remote name heuristics, integration metadata, user preferences).\n\t * If not provided, the library returns remotes in their original order.\n\t */\n\tsort?(remotes: GitRemote<RemoteProvider>[], cancellation?: AbortSignal): Promise<GitRemote<RemoteProvider>[]>;\n}\n\n/**\n * Provides search query preprocessing.\n *\n * Hosts implement this to add capabilities like NLP → structured search\n * conversion before the library executes the query.\n */\nexport interface SearchQueryProvider {\n\t/**\n\t * Pre-processes a search query before execution (e.g., converts natural language to structured search).\n\t * Called by commits sub-provider before executing `searchCommits`.\n\t */\n\tpreprocessQuery?(search: SearchQuery, source?: unknown): Promise<SearchQuery>;\n}\n\n/**\n * Provides workspace environment info: folder resolution and trust state.\n * Used by sub-providers for workspace folder lookup and to gate operations\n * in untrusted workspaces.\n *\n * When `isTrusted` is absent, the workspace is assumed trusted. A host serving several repositories that\n * needs a verdict per repository leaves it absent and supplies the git executor's per-path\n * `gitOptions.isTrusted` instead; a set `isTrusted` here wins and answers for every path.\n */\nexport interface WorkspaceProvider {\n\t/** Fires when the workspace trust state changes (e.g., user grants trust) */\n\treadonly onDidChangeTrust?: Event<boolean>;\n\n\t/** Whether the workspace is currently trusted */\n\treadonly isTrusted?: boolean;\n\n\t/** Resolves the workspace folder that contains the given repoPath */\n\tgetFolder(repoPath: string): { path: string } | undefined;\n\n\t/** Returns the default URI for new worktrees, given a repository path. */\n\tgetWorktreeDefaultUri?(repoPath: string): Uri | undefined;\n}\n"],"mappings":";;;;;AAuPA,MAAa,WAAW;CACvB,SAAS;CACT,MAAM;CACN,WAAW;CACX,cAAc;AACf"}
@@ -368,8 +368,10 @@ export declare class ReferenceUpdateError extends GitCommandError<ReferenceUpdat
368
368
  protected buildErrorMessage(details: ReferenceUpdateErrorDetails, l10n: Translator): string;
369
369
  }
370
370
  export declare class WorkspaceUntrustedError extends Error {
371
+ readonly path?: string | undefined;
371
372
  static is(ex: unknown): ex is WorkspaceUntrustedError;
372
- constructor();
373
+ /** @param path The exact path the host refused (as passed to `GitOptions.isTrusted`), when one path was refused */
374
+ constructor(path?: string | undefined);
373
375
  }
374
376
  export type WorktreeCreateErrorReason = 'alreadyCheckedOut' | 'alreadyExists';
375
377
  interface WorktreeCreateErrorDetails {
@@ -835,11 +835,14 @@ var ReferenceUpdateError = class ReferenceUpdateError extends GitCommandError {
835
835
  }
836
836
  };
837
837
  var WorkspaceUntrustedError = class WorkspaceUntrustedError extends Error {
838
+ path;
838
839
  static is(ex) {
839
840
  return ex instanceof WorkspaceUntrustedError;
840
841
  }
841
- constructor() {
842
+ /** @param path The exact path the host refused (as passed to `GitOptions.isTrusted`), when one path was refused */
843
+ constructor(path) {
842
844
  super(l10n.t("Unable to perform Git operations because the current workspace is untrusted"));
845
+ this.path = path;
843
846
  Error.captureStackTrace?.(this, new.target);
844
847
  }
845
848
  };