@gitkraken/core-gitlens 0.57.0 → 0.58.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 (53) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/git-cli/providers/config.js +2 -2
  3. package/dist/git-cli/providers/pausedOperations.js +2 -2
  4. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  5. package/dist/git-cli/providers/staging.js +1 -1
  6. package/dist/ipc/discovery.js +1 -1
  7. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  8. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  9. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  10. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +4 -0
  11. package/dist/plus/integrations/authentication/configuredIntegrationService.js +8 -2
  12. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  13. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +1 -1
  14. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +2 -2
  15. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  16. package/dist/plus/integrations/authentication/observedAuthenticationProvider.d.ts +2 -1
  17. package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +16 -12
  18. package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
  19. package/dist/plus/integrations/index.d.ts +2 -1
  20. package/dist/plus/integrations/index.js.map +1 -1
  21. package/dist/plus/integrations/integrationService.d.ts +5 -0
  22. package/dist/plus/integrations/integrationService.js +54 -0
  23. package/dist/plus/integrations/integrationService.js.map +1 -1
  24. package/dist/plus/integrations/manager.d.ts +8 -0
  25. package/dist/plus/integrations/models/bitbucketServerPullRequestWrites.d.ts +142 -0
  26. package/dist/plus/integrations/models/bitbucketServerPullRequestWrites.js +0 -0
  27. package/dist/plus/integrations/models/integration.d.ts +6 -3
  28. package/dist/plus/integrations/models/integration.js +11 -10
  29. package/dist/plus/integrations/models/integration.js.map +1 -1
  30. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  31. package/dist/plus/integrations/providers/bitbucket-server.d.ts +4 -1
  32. package/dist/plus/integrations/providers/bitbucket-server.js +23 -0
  33. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  34. package/dist/plus/integrations/providers/bitbucketPullRequestWrites.js +2 -2
  35. package/dist/plus/integrations/providers/bitbucketPullRequestWrites.js.map +1 -1
  36. package/dist/plus/integrations/providers/bitbucketServerPullRequestWriteErrors.d.ts +22 -0
  37. package/dist/plus/integrations/providers/bitbucketServerPullRequestWriteErrors.js +94 -0
  38. package/dist/plus/integrations/providers/bitbucketServerPullRequestWriteErrors.js.map +1 -0
  39. package/dist/plus/integrations/providers/bitbucketServerPullRequestWrites.d.ts +51 -0
  40. package/dist/plus/integrations/providers/bitbucketServerPullRequestWrites.js +593 -0
  41. package/dist/plus/integrations/providers/bitbucketServerPullRequestWrites.js.map +1 -0
  42. package/dist/plus/integrations/providers/github.js +1 -1
  43. package/dist/plus/integrations/providers/providerApiClient.js +4 -3
  44. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  45. package/dist/plus/integrations/providers/providersApi.d.ts +10 -0
  46. package/dist/plus/integrations/providers/providersApi.js +45 -1
  47. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  48. package/dist/plus/integrations/providers/utils/writeInputs.d.ts +1 -0
  49. package/dist/plus/integrations/providers/utils/writeInputs.js +4 -1
  50. package/dist/plus/integrations/providers/utils/writeInputs.js.map +1 -1
  51. package/dist/utils/env/node/exec.js +2 -2
  52. package/docs/integrations.md +81 -0
  53. package/package.json +1 -1
@@ -3,5 +3,6 @@ export declare function isWriteIdentifier(value: unknown): value is string;
3
3
  export declare function isPositiveInt32(value: unknown): value is number;
4
4
  export declare function sameIdentifier(actual: unknown, expected: string): boolean;
5
5
  export declare function isCommitSha(sha: unknown): sha is string;
6
+ export declare function isGitBranchName(name: unknown): name is string;
6
7
  //#endregion
7
8
  //# sourceMappingURL=writeInputs.d.ts.map
@@ -11,7 +11,10 @@ function sameIdentifier(actual, expected) {
11
11
  function isCommitSha(sha) {
12
12
  return typeof sha === "string" && /^(?!0{40}$)[\da-f]{40}$/i.test(sha);
13
13
  }
14
+ function isGitBranchName(name) {
15
+ return typeof name === "string" && name.length > 0 && !name.startsWith("-") && ![...name].some((character) => character <= " " || "~^:?*[\\".includes(character)) && !name.includes("..") && !name.includes("@{") && !name.endsWith(".") && name.split("/").every((part) => part.length > 0 && !part.startsWith(".") && !part.endsWith(".lock"));
16
+ }
14
17
  //#endregion
15
- export { isCommitSha, isPositiveInt32, isWriteIdentifier, sameIdentifier };
18
+ export { isCommitSha, isGitBranchName, isPositiveInt32, isWriteIdentifier, sameIdentifier };
16
19
 
17
20
  //# sourceMappingURL=writeInputs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeInputs.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/utils/writeInputs.ts"],"sourcesContent":["export function isWriteIdentifier(value: unknown): value is string {\n\treturn (\n\t\ttypeof value === 'string' &&\n\t\tvalue.length > 0 &&\n\t\tvalue.trim() === value &&\n\t\t![...value].some(character => character < ' ' || character === '\\x7f')\n\t);\n}\n\nexport function isPositiveInt32(value: unknown): value is number {\n\treturn typeof value === 'number' && Number.isInteger(value) && value > 0 && value <= 2147483647;\n}\n\nexport function sameIdentifier(actual: unknown, expected: string): boolean {\n\treturn typeof actual === 'string' && actual.toLowerCase() === expected.toLowerCase();\n}\n\nexport function isCommitSha(sha: unknown): sha is string {\n\treturn typeof sha === 'string' && /^(?!0{40}$)[\\da-f]{40}$/i.test(sha);\n}\n"],"mappings":";AAAA,SAAgB,kBAAkB,OAAiC;CAClE,OACC,OAAO,UAAU,YACjB,MAAM,SAAS,KACf,MAAM,KAAK,MAAM,SACjB,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAK,cAAa,YAAY,OAAO,cAAc,GAAM;AAEvE;AAEA,SAAgB,gBAAgB,OAAiC;CAChE,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,SAAS;AACtF;AAEA,SAAgB,eAAe,QAAiB,UAA2B;CAC1E,OAAO,OAAO,WAAW,YAAY,OAAO,YAAY,MAAM,SAAS,YAAY;AACpF;AAEA,SAAgB,YAAY,KAA6B;CACxD,OAAO,OAAO,QAAQ,YAAY,2BAA2B,KAAK,GAAG;AACtE"}
1
+ {"version":3,"file":"writeInputs.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/utils/writeInputs.ts"],"sourcesContent":["export function isWriteIdentifier(value: unknown): value is string {\n\treturn (\n\t\ttypeof value === 'string' &&\n\t\tvalue.length > 0 &&\n\t\tvalue.trim() === value &&\n\t\t![...value].some(character => character < ' ' || character === '\\x7f')\n\t);\n}\n\nexport function isPositiveInt32(value: unknown): value is number {\n\treturn typeof value === 'number' && Number.isInteger(value) && value > 0 && value <= 2147483647;\n}\n\nexport function sameIdentifier(actual: unknown, expected: string): boolean {\n\treturn typeof actual === 'string' && actual.toLowerCase() === expected.toLowerCase();\n}\n\nexport function isCommitSha(sha: unknown): sha is string {\n\treturn typeof sha === 'string' && /^(?!0{40}$)[\\da-f]{40}$/i.test(sha);\n}\n\nexport function isGitBranchName(name: unknown): name is string {\n\treturn (\n\t\ttypeof name === 'string' &&\n\t\tname.length > 0 &&\n\t\t!name.startsWith('-') &&\n\t\t![...name].some(character => character <= ' ' || '~^:?*[\\\\\\x7f'.includes(character)) &&\n\t\t!name.includes('..') &&\n\t\t!name.includes('@{') &&\n\t\t!name.endsWith('.') &&\n\t\tname.split('/').every(part => part.length > 0 && !part.startsWith('.') && !part.endsWith('.lock'))\n\t);\n}\n"],"mappings":";AAAA,SAAgB,kBAAkB,OAAiC;CAClE,OACC,OAAO,UAAU,YACjB,MAAM,SAAS,KACf,MAAM,KAAK,MAAM,SACjB,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAK,cAAa,YAAY,OAAO,cAAc,GAAM;AAEvE;AAEA,SAAgB,gBAAgB,OAAiC;CAChE,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,SAAS;AACtF;AAEA,SAAgB,eAAe,QAAiB,UAA2B;CAC1E,OAAO,OAAO,WAAW,YAAY,OAAO,YAAY,MAAM,SAAS,YAAY;AACpF;AAEA,SAAgB,YAAY,KAA6B;CACxD,OAAO,OAAO,QAAQ,YAAY,2BAA2B,KAAK,GAAG;AACtE;AAEA,SAAgB,gBAAgB,MAA+B;CAC9D,OACC,OAAO,SAAS,YAChB,KAAK,SAAS,KACd,CAAC,KAAK,WAAW,GAAG,KACpB,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,MAAK,cAAa,aAAa,OAAO,YAAe,SAAS,SAAS,CAAC,KACnF,CAAC,KAAK,SAAS,IAAI,KACnB,CAAC,KAAK,SAAS,IAAI,KACnB,CAAC,KAAK,SAAS,GAAG,KAClB,KAAK,MAAM,GAAG,CAAC,CAAC,OAAM,SAAQ,KAAK,SAAS,KAAK,CAAC,KAAK,WAAW,GAAG,KAAK,CAAC,KAAK,SAAS,OAAO,CAAC;AAEnG"}
@@ -1,10 +1,10 @@
1
1
  import { getScopedLogger, maybeStartScopedLogger } from "../../logger.scoped.js";
2
2
  import { isWindows } from "./platform.js";
3
3
  import { join } from "path";
4
- import { execFile, spawn } from "child_process";
5
- import { access, constants } from "fs";
6
4
  import { stat } from "fs/promises";
7
5
  import * as process from "process";
6
+ import { execFile, spawn } from "child_process";
7
+ import { access, constants } from "fs";
8
8
  //#region ../utils/src/env/node/exec.ts
9
9
  var RunError = class extends Error {
10
10
  cmd;
@@ -1394,6 +1394,87 @@ Bitbucket's `555` timeout. For pending or uncertain writes, reconcile with a rea
1394
1394
  Core sends each mutation once. See the
1395
1395
  [pull requests API](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/).
1396
1396
 
1397
+ ### Bitbucket Data Center pull request writes
1398
+
1399
+ The following `IntegrationManager` methods and their types are exported from
1400
+ `@gitkraken/core-gitlens/plus/integrations/index.js`. They address one Bitbucket Data Center installation through
1401
+ the selected connection and are separate from the Bitbucket Cloud methods above.
1402
+
1403
+ | Method | Input | Success |
1404
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
1405
+ | `getBitbucketServerPullRequestCreateCapability` | `BitbucketServerPullRequestWriteScope`. | Live account id, canonical repository with its numeric ids and `serverVersion`, default branch and `draft`. |
1406
+ | `resolveBitbucketServerPullRequestWriteTarget` | The same scope plus the pull request `number`. | Live account id, pull request snapshot with its `version`, and action capabilities. |
1407
+ | `writeBitbucketServerPullRequest` | The scope with `expectedAccountId`, the numeric `repositoryId` and one action below. | A typed write status and pull request receipt, or `deleted` with the number. |
1408
+
1409
+ ```ts
1410
+ const scope = {
1411
+ providerId: GitSelfManagedHostIntegrationId.BitbucketServer,
1412
+ connectionId,
1413
+ baseUrl, // The selected connection's installation URL, including any context path.
1414
+ projectKey, // As the read path reports the repository's owner.
1415
+ repositorySlug,
1416
+ };
1417
+ const capability = await manager.getBitbucketServerPullRequestCreateCapability(scope);
1418
+ const target = await manager.resolveBitbucketServerPullRequestWriteTarget({ ...scope, number });
1419
+ ```
1420
+
1421
+ - `create` takes `sourceBranch` and `targetBranch` in the selected repository, `title`, optional `description` and
1422
+ optional `draft`. Drafts need Bitbucket Data Center 8.18 or later; the capability reports `draft`, and a draft
1423
+ create on an older server answers `unsupported`.
1424
+ - `edit` takes `number`, `expectedVersion` and at least one of `title` or `description`. Pass an empty description
1425
+ to clear it.
1426
+ - `decline`, `reopen` and `delete` take `number` and `expectedVersion`. Only open pull requests decline and only
1427
+ declined ones reopen.
1428
+ - `merge` takes `number`, `expectedVersion`, `expectedSourceBranch`, `expectedSourceSha`, `expectedTargetBranch`,
1429
+ `expectedTargetSha` and an optional `strategy`, one of the strategy ids the target lists (`no-ff`, `squash`,
1430
+ `ff-only` and so on, as the repository enables them). Without `strategy`, Bitbucket applies the repository's
1431
+ default.
1432
+
1433
+ Branches are plain branch names; Core sends them as `refs/heads/` refs. SHAs are full 40-character commit ids.
1434
+ `connectionId` must be one of `getConfigured(GitSelfManagedHostIntegrationId.BitbucketServer)`; any other id, including
1435
+ another provider's connection, answers `no-connection` before any request. `projectKey` accepts personal projects
1436
+ (`~username`). `baseUrl` is the connection's own installation URL or configured domain; Core compares it the way a
1437
+ request reaches it, ignoring host case, a default port, trailing slashes and a `/rest/api/1.0` suffix, and taking the
1438
+ connection's protocol for a bare host, while the context path must match exactly. Another installation, even on the same
1439
+ host, answers `not-found` before any repository request, and `domain` is only a fallback from trusted connection
1440
+ configuration, as for the other self-managed writes. Core reads the installation version from `application-properties`
1441
+ and the account from the `X-AUSERID` header of the repository read, falling back to Bitbucket's current-user lookup
1442
+ when needed. It compares that account with `expectedAccountId`:
1443
+ the numeric Bitbucket user id as a string, the same `id` `getCurrentAccount` and pull request authors report for that
1444
+ connection. Keep the returned `accountId`, the numeric `repositoryId` and the pull request `number` and `version` across
1445
+ confirmation; a repository whose id is not `repositoryId` answers `not-found`. Core checks that the same credential is
1446
+ still current immediately before dispatch, sends every request through that connection's own address with redirects
1447
+ disabled, and honors the connection's SSL setting. Bitbucket evaluates permissions at dispatch, so a capability is not a
1448
+ grant: merging needs repository write access, deleting needs the pull request's author (when authors may delete, the
1449
+ default) or a repository administrator.
1450
+
1451
+ Every action on an existing pull request names its `expectedVersion`, Bitbucket's optimistic-locking version. Core
1452
+ refuses with `stale-version` before dispatch when the pull request it reads is at another version, and Bitbucket
1453
+ refuses with `409`, also reported as `stale-version`, when the pull request changed in between. Bitbucket raises the
1454
+ version with every edit, decline, reopen and merge and when a push to either branch rescopes the PR. Writes approved
1455
+ at an earlier version return `stale-version`. Edits send the current reviewers because Bitbucket's update replaces
1456
+ the full set. Core refuses the edit if it cannot read the complete reviewer list. Versioned writes can apply only
1457
+ once at the approved version. After `outcome-unknown`, read the target again before deciding whether to write at its
1458
+ new version. Bitbucket allows one open pull request per source and target branch pair. A retry while that PR is open
1459
+ returns `conflict` and includes the existing `pullRequest` when Core can read it. Once the PR closes, reconcile with
1460
+ a read before retrying an uncertain create.
1461
+
1462
+ Merge capabilities come from the repository's enabled merge strategies (`settings/pull-requests`) and Bitbucket's
1463
+ merge test (`GET .../merge`). A conflicted pull request reports `conflict`; merge-check vetoes report
1464
+ `policy-blocked` with their `vetoes` (summary and detail); a draft reports `policy-blocked`. When the settings are not
1465
+ readable, `strategies` is empty and only a merge without `strategy` is accepted. Core rereads the pull request,
1466
+ requires a positive merge test, checks the strategy, and then rechecks both live branch tips before posting the merge
1467
+ at the approved version. The merge endpoint accepts the PR version and does not accept atomic SHA preconditions.
1468
+ Core reports `outcome-unknown` if the merge receipt does not confirm both approved commits.
1469
+
1470
+ Delete is available for open and declined pull requests on Bitbucket Server 5.1 and later; a merged pull request
1471
+ reports `conflict` and an older server `unsupported`. Bitbucket answers a delete on an archived repository with
1472
+ `409` (`conflict`). Typed reasons follow the HTTP status: `forbidden` for a `401` or `403` from a credential that
1473
+ authenticated, `invalid-input` for `400`, `not-found` for `404`, `rate-limit` for throttling, and `conflict` for any
1474
+ other `409`. `outcome-unknown` means Core dispatched the write and could not confirm the result. Core sends each
1475
+ mutation once. See the
1476
+ [Bitbucket Data Center REST API](https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-pull-requests/).
1477
+
1397
1478
  ### GitHub and GitHub Enterprise Server pull request writes
1398
1479
 
1399
1480
  Use `providerId: 'github'` and the `connectionId` that read the repository or pull request. Pass the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gitkraken/core-gitlens",
3
3
  "description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
4
- "version": "0.57.0",
4
+ "version": "0.58.0",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
7
7
  "name": "GitKraken",