@leitwerk-dev/gitlab 0.2.1 → 0.3.1

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/README.md CHANGED
@@ -17,14 +17,15 @@ extensions:
17
17
 
18
18
  `base_url` must be an HTTPS origin without credentials, a query or a fragment. Supply a personal, project or group token with `api` and `write_repository` scopes and permission to push the selected source branches. Tokens stay on the server except for the selected repository's authenticated `worker.start` delivery. No separate Git credential configuration is needed. Missing tokens, identity or permissions are configuration errors.
19
19
 
20
- ## Interface
20
+ ## Public interface
21
21
 
22
22
  - `GitLabClientLike` defines project/group discovery, MR metadata and paginated changes, branches/commits, pipelines, failed jobs, bounded traces, bot identity and notes. `GitLabClient` implements it using HTTPS, pagination and bounded transient read retries. Errors omit response bodies and credentials. Writes are reconciled by their caller rather than blindly repeated.
23
23
  - `gitlabIntegration` exposes `profiles()` and `client(profile)` through the SDK capability registry. `setupGitLabIntegration()` registers an explicit adapter for tools and external observations.
24
24
  - `gitlabRepositoryCredentials(profile, projects)` derives internal credential references. The core authorizes their HTTPS origin and exact repository path against the process projects.
25
25
  - `selectGitLabProjects()` expands exact includes and groups, including subgroups, then applies exclusions. Includes form a union; stable project IDs remove duplicates. An explicit include or `all_accessible: true` is required.
26
- - `observeMergeRequest()` selects the newest pipeline associated with the current MR source revision. Synthetic merge commits must contain that head as a parent. With no matching MR pipeline, it falls back to the current source branch's push pipeline. A newer pending result supersedes older terminal results.
27
- - `gitlabExternal.mergeRequest()` reports MR closure/merge, source-head changes and CI observations. Its `afterKey` is the previous `observationKey()`. An optional `wakeAt` timestamp permits recovery timers without retaining a worker. Poll failures back off from 30 seconds to five minutes and surface diagnostics.
26
+ - `observeMergeRequest()` selects the newest pipeline associated with the current MR source revision. Synthetic merge commits must contain that head as a parent. With no matching MR pipeline, it falls back to the current source branch's push pipeline. A newer pending result supersedes older terminal results. The observation includes GitLab's `has_conflicts`, `merge_status` and `detailed_merge_status`, plus `targetHead` read from the current target branch (not the historical diff base). Closed MRs do not require branch or pipeline reads.
27
+ - `gitLabMergeRepairReason(mr)` identifies explicit conflict and `need_rebase` evidence. `gitLabMergeabilityPending(mr)` distinguishes asynchronous checks; approvals, discussions and generic merge blocking are not Git conflict evidence.
28
+ - `gitlabExternal.mergeRequest()` reports MR closure/merge, source/target project and branch changes, current heads, mergeability and CI observations. Mergeability or target changes wake an idle process even when its source SHA and successful pipeline are unchanged. Its `afterKey` is the previous `observationKey()`. An optional `wakeAt` timestamp permits recovery timers without retaining a worker. Poll failures back off from 30 seconds to five minutes and surface diagnostics.
28
29
 
29
30
  ## Project-bound tools
30
31
 
@@ -32,17 +33,38 @@ Project metadata binds tools to `{ gitlab: { profile, projectId, iid } }`. Each
32
33
 
33
34
  Comments require a stable business `writeKey`. `ensureGitLabComment()` combines it with the instance, project, MR and process IDs, appends a hidden marker, and uses `ctx.externalWrites.ensure()`. It searches remote notes before creating a comment and after an uncertain write. `gitlab_reply` additionally requires `discussionId` and reconciles within that discussion. Repeating a call after losing either the response or the local write-log record reuses the same remote comment.
34
35
 
35
- The MR external source can also observe review feedback using `feedback: { afterId, since, quietPeriodMs }`. It reads paginated discussions, preserving inline file/line context, and excludes system/resolved notes, the authenticated bot and accounts flagged as bots. Each new unseen note resets the trailing quiet period; a mature batch wakes the process even when the MR revision and CI status are unchanged. The process owns the durable cursor and decides when feedback is consumed. The provider recomputes timing from note timestamps after restart.
36
+ The MR external source can also observe review feedback using `feedback: { afterId, since, quietPeriodMs }`. It reads paginated discussions, preserving inline file/line context, and excludes system/resolved notes, Leitwerk-generated comment markers and accounts flagged as bots. Human comments by the authenticated PAT owner remain actionable. Each new unseen note resets the trailing quiet period; a mature batch wakes the process even when the MR revision and CI status are unchanged. The process owns the durable cursor and decides when feedback is consumed. The provider recomputes timing from note timestamps after restart.
36
37
 
37
38
  `ensureGitLabSeenReaction()` lets a process acknowledge an authorized MR comment with an eyes reaction. It reconciles the authenticated bot's reaction and records it with `ctx.externalWrites.ensure()`. Other users' eyes reactions do not suppress the bot's acknowledgement; retries and restarts do not duplicate it. The calling process owns selection and lifecycle checks.
38
39
 
39
40
  The extension contains no Renovate selection or repair policy. `./testing` exports a persistent `LocalGitLabAdapter` with real local repository ancestry for integration tests.
40
41
 
42
+ ## Creating repository changes
43
+
44
+ Load [gitlab-repo-change](../gitlab-repo-change/README.md) for UI and labeled-issue
45
+ change workflows. Repository-only metadata `{ gitlab: { profile, projectId } }`
46
+ permits identity resolution and MR creation. `gitlab_ensure_merge_request` validates
47
+ the process branches, reconciles its remote marker through the durable write log,
48
+ and pins `iid` through server project persistence. Existing MR-bound metadata and
49
+ tool calls remain supported. MR-only tools reject missing bindings.
50
+
51
+ Source-issue tools require the launch-pinned `issueIid`. Issue updates, comments,
52
+ labels, MR creation, and feedback acknowledgements reconcile uncertain writes.
53
+ `gitlab_list_merge_request_feedback` and `gitlab_acknowledge_feedback` expose the
54
+ existing discussion and seen-reaction operations as project-bound tools.
55
+
56
+ The issue watcher uses exact project/group selection and rechecks eligibility at
57
+ launch. The MR source accepts optional `delivery` tracking to emit settled feedback,
58
+ confirmed conflict evidence, and an observation cursor alongside existing MR and CI
59
+ facts. Existing source callers retain their event kind and observation behavior.
60
+ HTTPS preflight performs repository reads and a dry-run feature-branch push without
61
+ putting credentials in URLs or command arguments.
62
+
41
63
  ## API support
42
64
 
43
65
  The following exported declarations are `@public`:
44
66
 
45
- - `@leitwerk-dev/gitlab`: `GitLabDiff`, `GitLabFeedback`, `GitLabIdentity`, `GitLabIntegration`, `GitLabJob`, `GitLabMergeRequest`, `GitLabObservation`, `GitLabProject`, `GitLabSelection`, `default`, `ensureGitLabSeenReaction`, `gitLabFeedbackReadyAt`, `gitlabExternal`, `gitlabIntegration`, `gitlabRepositoryCredentials`, `observationKey`, `observeMergeRequest`, `parseGitLabSelection`, `pendingGitLabFeedback`, `resolveGitLabBinding`, `selectGitLabProjects`.
67
+ - `@leitwerk-dev/gitlab`: `GitLabDeliveryObservation`, `GitLabIssueWatcherEvent`, `gitlabIssueExternalId`, `gitlabIssueWatcherSource`, `GitLabDiff`, `GitLabFeedback`, `GitLabIdentity`, `GitLabIntegration`, `GitLabJob`, `GitLabMergeRequest`, `GitLabObservation`, `GitLabProject`, `GitLabSelection`, `default`, `ensureGitLabSeenReaction`, `gitLabFeedbackReadyAt`, `gitlabExternal`, `gitlabIntegration`, `gitlabRepositoryCredentials`, `observationKey`, `observeMergeRequest`, `parseGitLabSelection`, `pendingGitLabFeedback`, `resolveGitLabBinding`, `selectGitLabProjects`.
46
68
  - `@leitwerk-dev/gitlab/testing`: `GitLabClientLike`, `GitLabMergeRequest`, `GitLabPipeline`, `GitLabProject`, `LocalGitLabAdapter`, `setupGitLabIntegration`.
47
69
 
48
70
  Members have individual classifications; these exports do not make every member