Commit Graph
12 Commits
Author SHA1 Message Date
LegGasai 7c4c53fb65 fix(forge-gitlab): select a reviewed merge request by the user's own review state
The `involved` list and its count selected reviewed merge requests with `not: { reviewStates: [UNREVIEWED,
REVIEW_STARTED] }`. GitLab 19.5.1 applies that negation to every reviewer, so a merge request the user approved was left
out while another reviewer had yet to review it. The connection now lists the states a given review can have, which
GitLab reads from the user's own reviewer entry.
2026-11-23 15:13:36 +08:00
LegGasai e69c67eeed Merge remote-tracking branch 'origin/master' into feat/forge-review-activity 2026-11-23 13:52:43 +08:00
imccyu 267805d20d release(dsh): 0.2.3-alpha.2 2026-11-22 15:27:28 +08:00
imccyu aae91d692e release(dsh): 0.2.3-alpha.1 2026-11-21 18:29:41 +08:00
LegGasai 76cf07cf72 fix(forge-gitlab): read one merge request per status query by default
GitLab 19.5.1 answers `detailedMergeStatus: CONFLICT` for a mergeable merge
request at every alias after the first of one status query, once the aliases
select `diffStatsSummary`; read alone, the same merge request answers
`MERGEABLE`. With the default batch of two, the second merge request of a
Session with several bound merge requests showed a conflict and no merge
action.

`statusBatchSize` now defaults to 1. A poll sends one GraphQL query per
watched merge request instead of one per two, at most
`maxConcurrentRequests` at once.
2026-11-20 12:53:03 +08:00
LegGasai 658aeed863 feat(forge): keep the review detail's link actions visible, add the automatic merge, and draw a loading skeleton
The Code review page's detail shows Open on the code host, Copy link, and
Refresh status as three icon buttons after the merge action; a narrow detail
folds them into the More menu as before. The merge action also turns the
code host's automatic merge on, shows that it is on with its cancellation,
and names why the host would not merge.

- forge-github: snapshots carry `autoMerge` from `viewerCanEnableAutoMerge`,
  `viewerCanDisableAutoMerge`, and `autoMergeRequest`; `setAutoMerge` sends
  `enablePullRequestAutoMerge` with the confirmed head or
  `disablePullRequestAutoMerge`. A base branch with a merge queue offers none.
- forge-gitlab: snapshots carry `autoMerge` from `autoMergeEnabled` and the
  available strategies; `setAutoMerge` accepts with the strategy that waits
  for every merge check, or posts `cancel_auto_merge`. Merge trains offer
  none.
- client-ui-forge (Host): `forgePanel.setAutoMerge` and
  `forgePanel.reviewSetAutoMerge`.
- client-ui-forge (Client): the opening actions carry the mark of the
  provider's forge family and name the code host instead of the browser, on
  the review page, the Session panel card, the changes view, and review
  threads. While a change request, its description, or its activity is read,
  a skeleton of the same layout stands in. The comment field is three lines
  tall with a row that names the code host and a primary button. Where the
  header is tight, labels fold and the repository name is cut before the
  actions wrap.
2026-11-20 11:49:59 +08:00
LegGasai 4f600dbef6 feat(forge): show a change request's activity on the Code review page and add comments from it
Under the description, the summary tab lists the comments, submitted
reviews, commits, and changes of state of a change request, oldest first,
with a field that adds a comment to its conversation.

- forge-github: `readActivity` reads the latest 100 timeline entries in one
  GraphQL request; `addComment` posts one REST request. The close a merge
  records is left out.
- forge-gitlab: `readActivity` reads the latest 100 notes through GraphQL
  and the state changes through REST; system notes map by their recorded
  action, and one with no kind of its own shows its sentence. `addComment`
  creates one note.
- client-ui-forge (Host): `forgePanel.reviewActivity` returns null for a
  provider that reads no activity; `forgePanel.reviewComment` refuses a
  blank comment before the host is asked.
- client-ui-forge (Client): runs of commits fold into one line, a review
  that left inline comments opens the changes tab, a long comment starts
  cut short, and the field keeps its text when the host did not save the
  comment. The activity is read again after a comment and when the change
  request's update time or reviews change. Copy in eight languages.
2026-11-19 21:51:22 +08:00
LegGasai 6e94624bc9 feat(forge): list GitLab merge requests on the Code review page and redraw its list card
The Code review page lists the change requests of every host a provider
serves, GitHub and GitLab together, and its filter menu narrows the lists
to one host or one repository on a host.

- forge: `ChangeRequestSummary` drops `closingIssues` and
  `closingIssuesTruncated`; a list row no longer names linked issues.
- forge-gitlab: the provider declares `viewer` and implements
  `listForViewer`, `countForViewer`, and `readDescription` through GraphQL
  `currentUser` connections. "Involving me" is the merge requests the user
  reviewed or is assigned to.
- client-ui-forge (Host): each host backs off on its own failed reads, so
  one failing host no longer slows the others; a repository scope names its
  host and is read on that host only; a host that failed for lack of
  sign-in carries the provider's sign-in command.
- client-ui-forge (Client): the list card shows the title on at most two
  lines, then repository, number, author, one hint, and a short time; a
  host that could not be read shows one notice after the lists with the
  sign-in command and a way to the host settings; a section keeps skeleton
  rows and holds back its count while a host's first read still runs. The
  re-request hint is shortened in eight languages.
2026-11-19 21:03:30 +08:00
LegGasai 8c5ea0e638 feat(forge): edit the hosts of the GitHub and GitLab providers on the Plugins page
The GitHub and GitLab rows of the Forge bundle each gain a page on the
Plugins page that lists the hosts the provider serves. Hosts are added and
removed there and saved to the profile patch, and the provider serves the
saved list without a restart. Each saved host shows whether the provider's
CLI is signed in to it, with the sign-in command to copy.

- forge: `ctx.forge.register` returns a handle whose `replace(provider)`
  puts another provider of the same family in the registered one's place in
  one step; `readiness` reads only the forge family and the host.
- forge-github, forge-gitlab: `hosts` is a volatile Config field that the
  schema validates; a changed list replaces the registered provider.
- client-ui-forge: `forgePanel.hostReadiness`, the two row pages, and an
  "Add host…" action on the review page for a link whose host no provider
  serves. That state's copy is reworded in eight languages.
2026-11-19 13:07:21 +08:00
imccyu 26ac56f780 chore(release): align master-only packages to 0.2.2-rc.5 2026-11-18 18:29:39 +08:00
imccyu 7400626e6e chore(release): sync release/dsh-0.2.2 0.2.2-rc.4 to master
# Conflicts:
#	packages/client/hmr/package.json
#	packages/client/script-realm-iframe/package.json
#	packages/client/ui-jobs/package.json
#	packages/client/ui-session-panel/package.json
#	packages/experimental/action-cards/package.json
#	packages/experimental/client-ui-forge/package.json
#	packages/experimental/cua-bundle/package.json
#	packages/experimental/forge-gitlab/package.json
#	packages/ptc-runtime/ptc-runtime-node/package.json
#	packages/session/tool-working-directory/package.json
#	packages/util/atomic-write/package.json
2026-11-17 21:37:34 +08:00
LegGasai cb44a3c2ee feat(forge): read, review, and bind GitLab merge requests (#8317)
* feat(forge): let providers declare their hosts, names, sign-in, and review decisions

Prepare the forge contract for a second provider:

- ForgeProvider lists the hosts it serves and names itself (label,
  changeRequestNoun); registering a provider that lists a host another
  registered provider lists throws, so each URL has at most one provider.
  ctx.forge.describe(forge) returns the family's ForgeDescription.
- ForgeReadiness carries the sign-in command, which the panel's sign-in
  banner shows instead of building `gh auth login` for the github family.
- ForgeReviewData lists the review decisions the host lets the reader
  record; the review dialog offers only those instead of hardcoding the
  GitHub rule that a pull request's author may only comment.
- ForgeReviewThread.original may name a later commit the host carried the
  thread to while its lines stayed unchanged.
- The changes view names the code host and its word for a change request
  from the entry's ForgeDescription instead of hardcoding GitHub and PR.

The GitHub provider declares its configured hosts, GitHub, pull requests,
`gh auth login --hostname <host>`, and reads viewerDidAuthor for the
review decisions. Upgrade guide: forge-provider-hosts.

* feat(forge-gitlab): read GitLab merge requests through the GitLab CLI

Add the experimental forge-gitlab provider. It serves the configured
GitLab hosts through glab: status batches over GraphQL, head-pinned
patches from merge request diff versions, commit listings, merge bases,
pipeline jobs, closing issues, and review threads mapped from REST
discussions, including outdated threads' hunks.

The forge bundle composes the provider, disabled by default.

* feat(forge-gitlab): write GitLab reviews, retry pipelines, request reviews, and rebase

The GitLab provider now writes through glab as well as reading:
comments start discussions at positions derived from the head's diff
version, pending replies and comments are draft notes that a review
publishes with its summary and review state, and approving checks the
head through GitLab's sha parameter. Review reads carry the signed-in
user's rights from GraphQL, their draft notes as the pending review,
and the decisions GitLab lets them record.

Snapshots name the head pipeline as every job's rerun, offer rebase as
the branch update, and follow GitLab's permissions for reruns and
review requests. updateBranch's contract now states how a provider
whose host takes no expected head checks it.

* feat(forge): let forge providers register the commands that bind change requests

forge-session no longer recognizes gh commands by itself. A provider now
registers a declarative ForgeCommandRule through
ctx.forgeSession.registerCommands: its executable, creation and reference
subcommands, change request page path, JSON URL members, declared
options, and a pure select that maps one parsed reference command to a
URL or a read-only lookup. forge-github registers gh and forge-gitlab
registers glab, which adds glab mr create, view, update, and checkout,
including numbers with -R: a full project URL binds directly, and other
repository forms resolve through glab mr view in the call's shell.

forge-session keeps the shared parts: the literal shell tokenizer,
option parsing, output reading, lookups, and the projection. The
forgeChangeRequests state version derives from the recognized rules, so
a changed rule set refolds every Session, including commands that ran
before the provider loaded. Ending a registration keeps its rule
recognized until restart, so unloading providers at shutdown does not
rewrite every checkpoint.

* refactor(forge-gitlab): publish the GitLab provider as @deepseek-ai/dsh-forge-gitlab

New experimental packages omit the experimental prefix so that promotion
keeps their npm name. Register the directory in
EXPERIMENTAL_PACKAGE_NAME_EXCEPTIONS instead of growing the legacy
prefixed list, and rename every dependency, configuration row, path
mapping, and document that names the package.

* fix(forge-gitlab): keep review writes, comment positions, and reads within GitLab's facts and the limits

- After GitLab refuses a publication, read the drafts again: delete
  them only when all remain, since GitLab can publish them before it
  refuses the summary, and report the outcome as unknown otherwise.
  A rollback that leaves drafts reports how many may remain.
- Place comments on files GitLab collapsed through the diff compared
  from their texts, and let a file's new path name it over another
  file's old path after chained renames.
- Keep the final newline of raw file reads.
- Apply maxOutputBytes to the complete review result, and report a
  read whose rights stop early or skip a discussion's later notes as
  truncated.
- Serve a version over maxCachedVersionBytes without keeping it.
- Resolve uploaded avatars GitLab names by their path on the host.
- Schedule bounded reads through p-limit.

* fix(forge-session): run lookups only for live command rules and keep the projection registered

- Reference lookups use the rules of live registrations, so a disposed
  provider's rule still folds but starts no gh or glab process.
- A failed re-registration registers the projection again with the
  earlier rules, so clients keep its view; an error is logged only when
  that fails too.
- Document the startup re-registration, test that the checkpointed
  state version survives a real Loader start, shutdown, and restart,
  and record that starting without a provider removes the bindings only
  its commands made.
- Describe the changes view's pending review and single comment
  without naming GitHub, which keeps its own rule in forge-github, and
  render registerCommands as code in the generated service reference.

* fix(forge-bundle): name GitLab merge requests in the bundle description

The bundle now follows GitLab merge requests as well as GitHub pull
requests, so the description's first sentence in every locale names
both kinds of change request.

* feat(forge): bind the change requests that gh api and glab api requests name

Models often read a merge request through `glab api` or a pull request
through `gh api` instead of `glab mr view` or `gh pr view`, which left
the change request unbound. A command rule now declares raw API request
subcommands beside its reference subcommands, each group with its own
options, since `-f` is a value of `gh api` and a flag of
`gh pr checkout`.

An API request binds, as referenced, only the change request its REST
path names, such as `projects/group%2Fapp/merge_requests/7/changes` or
`repos/octo/demo/pulls/7/files`; its output is not read, since one
request can list many change requests. A path whose host the command
names binds directly, and one without a host, or with the current
repository's placeholders, resolves through the CLI's view command in
the call's shell. The gh and glab rules move to version 2.

* docs(forge): add forge-gitlab and the forge-session peers to the module graph

Regenerate docs/module-graph for the renamed GitLab provider and the
optional forge-session peer of both providers.

* test(web): refresh the forge bundle description in the recommended plugin catalog

The creation recommendation recording carries every recommended
plugin's description; refresh it for the forge bundle description that
now names GitLab merge requests and the glab sign-in.

* chore(forge-gitlab): carry the 0.2.2-rc.3 release version and move upgrade guides to v0.2.2-rc.3
2026-11-13 07:56:57 +00:00