@gitkraken/core-gitlens 0.28.0 → 0.30.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 (120) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/dist/git/cache.d.ts +39 -1
  3. package/dist/git/cache.js +108 -7
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/providers/branches.d.ts +17 -12
  6. package/dist/git/providers/revision.d.ts +4 -0
  7. package/dist/git/watching/worktreeSummary.d.ts +16 -7
  8. package/dist/git/watching/worktreeSummary.js +44 -14
  9. package/dist/git/watching/worktreeSummary.js.map +1 -1
  10. package/dist/git-cli/cliGitProvider.js +3 -3
  11. package/dist/git-cli/cliGitProvider.js.map +1 -1
  12. package/dist/git-cli/exec/exec.d.ts +2 -2
  13. package/dist/git-cli/exec/exec.js +2 -2
  14. package/dist/git-cli/exec/gitDirResolver.d.ts +6 -1
  15. package/dist/git-cli/exec/gitDirResolver.js +9 -4
  16. package/dist/git-cli/exec/gitDirResolver.js.map +1 -1
  17. package/dist/git-cli/providers/branches.d.ts +91 -13
  18. package/dist/git-cli/providers/branches.js +673 -176
  19. package/dist/git-cli/providers/branches.js.map +1 -1
  20. package/dist/git-cli/providers/config.js +1 -1
  21. package/dist/git-cli/providers/config.js.map +1 -1
  22. package/dist/git-cli/providers/revision.d.ts +4 -0
  23. package/dist/git-cli/providers/revision.js +64 -3
  24. package/dist/git-cli/providers/revision.js.map +1 -1
  25. package/dist/ipc/ipcServer.d.ts +6 -1
  26. package/dist/ipc/ipcServer.js +15 -6
  27. package/dist/ipc/ipcServer.js.map +1 -1
  28. package/dist/plus/ai/errors.js +4 -4
  29. package/dist/plus/ai/errors.js.map +1 -1
  30. package/dist/plus/ai/models/model.d.ts +1 -1
  31. package/dist/plus/ai/models/model.js.map +1 -1
  32. package/dist/plus/ai/models/promptTemplates.d.ts +45 -2
  33. package/dist/plus/ai/models/results.d.ts +41 -0
  34. package/dist/plus/ai/models/results.js +14 -0
  35. package/dist/plus/ai/models/results.js.map +1 -0
  36. package/dist/plus/ai/prompts.d.ts +6 -0
  37. package/dist/plus/ai/prompts.js +255 -5
  38. package/dist/plus/ai/prompts.js.map +1 -1
  39. package/dist/plus/ai/providers/gitkrakenProvider.js +2 -2
  40. package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
  41. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -0
  42. package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
  43. package/dist/plus/ai/utils/ai.utils.d.ts +4 -0
  44. package/dist/plus/ai/utils/ai.utils.js +8 -1
  45. package/dist/plus/ai/utils/ai.utils.js.map +1 -1
  46. package/dist/plus/ai/utils/results.utils.d.ts +15 -1
  47. package/dist/plus/ai/utils/results.utils.js +80 -4
  48. package/dist/plus/ai/utils/results.utils.js.map +1 -1
  49. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +2 -0
  50. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  51. package/dist/plus/integrations/authentication/models.d.ts +1 -1
  52. package/dist/plus/integrations/authentication/models.js +2 -0
  53. package/dist/plus/integrations/authentication/models.js.map +1 -1
  54. package/dist/plus/integrations/constants.d.ts +2 -1
  55. package/dist/plus/integrations/constants.js +12 -2
  56. package/dist/plus/integrations/constants.js.map +1 -1
  57. package/dist/plus/integrations/fieldPresence.js +17 -1
  58. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  59. package/dist/plus/integrations/integrationService.d.ts +1 -1
  60. package/dist/plus/integrations/integrationService.js +8 -2
  61. package/dist/plus/integrations/integrationService.js.map +1 -1
  62. package/dist/plus/integrations/lite.js +5 -6
  63. package/dist/plus/integrations/lite.js.map +1 -1
  64. package/dist/plus/integrations/models/gitHostIntegration.d.ts +11 -1
  65. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  66. package/dist/plus/integrations/providers/asana.d.ts +91 -0
  67. package/dist/plus/integrations/providers/asana.js +344 -0
  68. package/dist/plus/integrations/providers/asana.js.map +1 -0
  69. package/dist/plus/integrations/providers/azure/azure.js +3 -2
  70. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  71. package/dist/plus/integrations/providers/azure/models.js +3 -2
  72. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  73. package/dist/plus/integrations/providers/azureDevOps.d.ts +7 -1
  74. package/dist/plus/integrations/providers/azureDevOps.js +9 -1
  75. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  76. package/dist/plus/integrations/providers/bitbucket-server/discovery.js +2 -1
  77. package/dist/plus/integrations/providers/bitbucket-server/discovery.js.map +1 -1
  78. package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
  79. package/dist/plus/integrations/providers/github.d.ts +2 -2
  80. package/dist/plus/integrations/providers/github.js +2 -2
  81. package/dist/plus/integrations/providers/github.js.map +1 -1
  82. package/dist/plus/integrations/providers/issueSorts.d.ts +5 -0
  83. package/dist/plus/integrations/providers/issueSorts.js +6 -1
  84. package/dist/plus/integrations/providers/issueSorts.js.map +1 -1
  85. package/dist/plus/integrations/providers/jiraIssueByKey.js +2 -1
  86. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  87. package/dist/plus/integrations/providers/models.d.ts +19 -3
  88. package/dist/plus/integrations/providers/models.js +12 -1
  89. package/dist/plus/integrations/providers/models.js.map +1 -1
  90. package/dist/plus/integrations/providers/providerApiClient.d.ts +0 -3
  91. package/dist/plus/integrations/providers/providerApiClient.js +1 -3
  92. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  93. package/dist/plus/integrations/providers/providersApi.d.ts +22 -1
  94. package/dist/plus/integrations/providers/providersApi.js +63 -12
  95. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  96. package/dist/plus/integrations/providers/utils.d.ts +1 -0
  97. package/dist/plus/integrations/providers/utils.js +8 -2
  98. package/dist/plus/integrations/providers/utils.js.map +1 -1
  99. package/dist/plus/integrations/reads/hierarchy.utils.d.ts +3 -3
  100. package/dist/plus/integrations/reads/hierarchy.utils.js +4 -4
  101. package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -1
  102. package/dist/plus/integrations/reads/resolveRepository.js +29 -21
  103. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  104. package/dist/plus/integrations/results.d.ts +18 -10
  105. package/dist/plus/integrations/results.js.map +1 -1
  106. package/dist/plus/integrations/utils/domain.utils.js +2 -1
  107. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  108. package/dist/plus/integrations/utils/integration.utils.js +5 -13
  109. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  110. package/dist/utils/diff.d.ts +19 -0
  111. package/dist/utils/diff.js +121 -3
  112. package/dist/utils/diff.js.map +1 -1
  113. package/dist/utils/env/node/exec.d.ts +0 -1
  114. package/dist/utils/env/node/exec.js +2 -14
  115. package/dist/utils/env/node/exec.js.map +1 -1
  116. package/dist/utils/path.d.ts +2 -0
  117. package/dist/utils/path.js +7 -1
  118. package/dist/utils/path.js.map +1 -1
  119. package/docs/integrations.md +72 -43
  120. package/package.json +2 -2
@@ -10,6 +10,10 @@ import { Cache, GkConfigInvalidationTarget } from "../../git/cache.js";
10
10
  import { Git } from "../exec/git.js";
11
11
  import { CliGitProviderInternal } from "../cliGitProvider.js";
12
12
  //#region ../git-cli/src/providers/branches.d.ts
13
+ /** The clock an unfinished patch comparison's expiry is read from, exported for testing */
14
+ export declare const patchCheckClock: {
15
+ now: () => number;
16
+ };
13
17
  export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
14
18
  private readonly context;
15
19
  private readonly git;
@@ -34,6 +38,19 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
34
38
  * count in the one read, even one whose previous answer was taken at another old tip
35
39
  */
36
40
  private readonly aheadOfMovedBase;
41
+ /**
42
+ * Each base's reflog file, parsed, by `<commonPath>\0<ref>` and stamped by its size and mtime, so every worktree
43
+ * measured against one base shares one read of it until it changes
44
+ */
45
+ private readonly baseReflogs;
46
+ /** Whether the repository at a common git directory keeps its refs and reflogs in reftables, by `<commonPath>` */
47
+ private readonly reftableRepositories;
48
+ /**
49
+ * When each patch comparison that ran out of time, by `<commonPath>\0<forkPoint>\0<tip>`, may run again (see
50
+ * {@link patchCheckClock}). The merge base it falls back to is the safe answer, so one that ran out of time isn't
51
+ * run again on every full read of the base while the machine is likely still as busy
52
+ */
53
+ private readonly unfinishedPatchChecks;
37
54
  /**
38
55
  * When each `commonPath\0branch\0key` was last stamped by this process. Bounded: a dropped entry only costs a
39
56
  * read of the stored stamp, which still holds off a write under 5 minutes old
@@ -64,7 +81,16 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
64
81
  getBranch(repoPath: string, name?: string, options?: {
65
82
  force?: boolean;
66
83
  }, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
84
+ /**
85
+ * What `getBranches(repoPath)` would answer for the named branch, or for the current one when `name` is omitted,
86
+ * without keeping that worktree's copy of the whole list, and whether the shared list it read is still kept
87
+ */
88
+ private getBranchFromSharedList;
89
+ /** The current ref of `repoPath` and the default worktree path of `commonPath`, rejecting if the caller aborted mid-read */
90
+ private getCurrentRefAndDefaultWorktreePath;
67
91
  private getCurrentBranch;
92
+ /** The branches of the repository at `commonPath`, as the list every one of its worktrees maps from */
93
+ private getSharedBranchesCore;
68
94
  getBranches(repoPath: string, options?: {
69
95
  filter?: (b: GitBranch) => boolean;
70
96
  ordering?: 'date' | 'author-date' | 'topo' | null;
@@ -228,20 +254,37 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
228
254
  */
229
255
  private getMovedForward;
230
256
  /**
231
- * A stamp of `ref`'s reflog file in the common git directory, by its size and mtime; `undefined` when there's no
232
- * file to stat (a reftable repository, or a ref without a reflog)
257
+ * Where `ref`'s reflog is kept, with a stamp that changes whenever the reflog may have: its file in the common git
258
+ * directory, by its size and mtime, or in a reftable repository, which keeps every reflog in the same tables, read
259
+ * only from git, the table list's. `stamp` is `undefined` when there's no such file (a ref without a reflog); the
260
+ * whole answer when that can't be told.
233
261
  */
234
- private getReflogStamp;
262
+ private getReflogSource;
263
+ /** Whether the repository keeps its refs in reftables, which it does for good once it has the table list */
264
+ private isReftableRepository;
235
265
  /**
236
266
  * A stamp of the common git directory's `shallow` file, by its size and mtime; `null` when the repository isn't
237
267
  * shallow, `undefined` when that can't be read
238
268
  */
239
269
  private getShallowStamp;
240
270
  /**
241
- * Reads {@link getMovedForward} from git, in `commonPath`, which holds the refs, their reflogs and the objects for
242
- * every worktree. Not bound to one caller's cancellation, since every worktree the move reached rides this one
243
- * read. `false` when the ref didn't move only forward, or reaches too much history off `newTip`'s to tell;
244
- * `undefined` when git couldn't say.
271
+ * The values `ref`'s reflog took, newest first, and the one it held before its oldest entry, which `--fork-point`
272
+ * reads too and no entry lists once the entries before it expired; `null` when that entry created the ref. Read from
273
+ * the reflog's file by {@link readBaseReflog} when that has it, else from git. `false` when git can't name the value
274
+ * before (before 2.31), `undefined` when it couldn't say.
275
+ */
276
+ private readReflogValues;
277
+ /**
278
+ * `ref`'s reflog entries, newest first, and the value it held before the oldest one (`null` when that entry created
279
+ * the ref), by asking git in `commonPath`. `false` when git can't name the value before (before 2.31), `undefined`
280
+ * when it couldn't say.
281
+ */
282
+ private readReflogFromGit;
283
+ /**
284
+ * Reads {@link getMovedForward}: the reflog by {@link readReflogValues}, then git, in `commonPath`, which holds the
285
+ * refs, their reflogs and the objects for every worktree. Not bound to one caller's cancellation, since every
286
+ * worktree the move reached rides this one read. `false` when the ref didn't move only forward, or reaches too much
287
+ * history off `newTip`'s to tell; `undefined` when git couldn't say.
245
288
  */
246
289
  private readMovedForward;
247
290
  /**
@@ -314,11 +357,44 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
314
357
  /**
315
358
  * The base for a branch created from `createdFrom`: that branch, unless the default branch forked strictly nearer
316
359
  * HEAD, as it does once `createdFrom` merged into it and the branch was rebased onto it. A stacked branch's
317
- * unmerged parent forked nearer, and stays its base. `undefined` when neither is usable.
360
+ * unmerged parent forked nearer, and stays its base, also once the default was moved onto one of the branch's
361
+ * commits and back, since both fork points are settled. `undefined` when neither is usable.
318
362
  */
319
363
  private getCreatedFromForkTarget;
320
364
  /** Counts HEAD's commits past `target` for {@link getAheadOfBase} */
321
365
  private measureAheadOfBase;
366
+ /**
367
+ * HEAD's count past `settled`, a fork point of `ref`, from `ahead`, its count past their merge base: that count,
368
+ * unless `ref` was rewritten off the fork point, where it's counted past it, since that's what HEAD lists past it.
369
+ * When that count can't be read, the merge base is taken, with `ahead`, and `reads.pinnable` cleared; the fork point
370
+ * stays, with `ahead`, only when the merge base can't be read either.
371
+ */
372
+ private countPastForkPoint;
373
+ /** {@link settleForkPoint} from HEAD, then {@link countPastForkPoint} */
374
+ private settleForkPointAndCount;
375
+ /**
376
+ * Where `reads.from` forked from `ref` (a base at `tip`), from `forkPoint`, git's reading of `ref`'s reflog. A fork
377
+ * point the base left behind (rebased, moved back and on, reset and moved on in one fetch) is settled by patch: the
378
+ * commits it holds that the base lacks are compared with the base's, and `reads.from` forked below the first one the
379
+ * base has no copy of (`rewritten`), the merge base when that's the oldest. Only where that answer is known is the
380
+ * comparison skipped: when the reflog's file shows every move since the fork point forward, which spawns nothing, or
381
+ * one ancestry check finds the fork point in the tip's history (it stays), the tip in the fork point's (the tip,
382
+ * which `reads.from` holds), or no history shared (the merge base). A read that fails clears `reads.pinnable` and
383
+ * takes the merge base, which never hides a commit; `forkPoint` stays only when that read fails too.
384
+ */
385
+ private settleForkPoint;
386
+ /**
387
+ * Where HEAD forked from a base at `tip` rewritten off `forkPoint`, by comparing patches (see
388
+ * {@link getForkPointFromPatches}) with the base's newest commits only; `undefined`, for the merge base, when that
389
+ * leaves none, or when git can't say in time, which also clears `reads.pinnable`
390
+ */
391
+ private readRewrittenForkPoint;
392
+ /**
393
+ * `ref`'s reflog (a full ref name), oldest line first, parsed from its file in the common git directory, which
394
+ * spawns nothing; empty when there's no file, which leaves git no reflog to read either. `undefined` in a reftable
395
+ * repository, which keeps reflogs out of files, or when the file can't be read or parsed.
396
+ */
397
+ private readBaseReflog;
322
398
  /** Counts the default branch's own commits past its upstream (see {@link getSelfUpstreamTarget}) for {@link getAheadOfBase} */
323
399
  private measureAheadOfSelfUpstream;
324
400
  /**
@@ -373,11 +449,13 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
373
449
  /** {@link getNearestForkTarget} with the `upstream` remote's copy of `candidate` as its contender */
374
450
  private getUpstreamNearestForkTarget;
375
451
  /**
376
- * A candidate base as the ref `reads.from` is measured against: the candidate or its tracking ref, whichever forked
377
- * nearer, so a stale local base defers to its upstream while one carrying unpushed work wins over it. A
378
- * `contender` other than the tracking ref is taken only when it forked strictly nearer than both, so a tie keeps
379
- * the candidate's own pick. A candidate none forks from is used as-is unless git confirms it names no ref: one the
380
- * cached ref list names is kept, and so is one whose check fails. `undefined` when the candidate is unusable.
452
+ * A candidate base as the ref `reads.from` is measured against, with its fork point settled (see
453
+ * {@link settleForkPoint}): the candidate or its tracking ref, whichever forked nearer, so a stale local base defers
454
+ * to its upstream while one carrying unpushed work wins over it. The candidate must fork past git's reading of its
455
+ * tracking ref, so commits the tracking ref held and moved off don't make it nearer. A `contender` other than the
456
+ * tracking ref is taken only when it forked strictly nearer than both, so a tie keeps the candidate's own pick. A
457
+ * candidate none forks from is used as-is unless git confirms it names no ref: one the cached ref list names is
458
+ * kept, and so is one whose check fails. `undefined` when the candidate is unusable.
381
459
  */
382
460
  private getNearestForkTarget;
383
461
  /**