@bevel-software/platform-shared 0.29.0 → 0.31.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.
- package/dist/git/types.d.ts +174 -3
- package/dist/git/types.d.ts.map +1 -1
- package/dist/workflow/interface.d.ts +89 -7
- package/dist/workflow/interface.d.ts.map +1 -1
- package/dist/workflow/types.d.ts +14 -1
- package/dist/workflow/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/git/types.ts +164 -3
- package/src/workflow/interface.ts +83 -5
- package/src/workflow/types.ts +11 -0
package/dist/git/types.d.ts
CHANGED
|
@@ -55,8 +55,159 @@ export interface RemoteSyncPullResult {
|
|
|
55
55
|
/** Repo-relative paths whose content changed; empty unless `treeChanged`. */
|
|
56
56
|
changedPaths: string[];
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* How one conflicted path is settled when a branch is updated from another:
|
|
60
|
+
* the text to keep, or one side whole, or the file gone.
|
|
61
|
+
*/
|
|
62
|
+
export interface MergeResolution {
|
|
63
|
+
/** The conflicted path, exactly as the conflict named it (repository-relative or workspace-relative). */
|
|
64
|
+
path: string;
|
|
65
|
+
/** The resolved text of the file. */
|
|
66
|
+
content?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Keep one side as it is — `ours` is the branch being updated, `theirs` the
|
|
69
|
+
* branch merged in — or `delete` the file.
|
|
70
|
+
*/
|
|
71
|
+
choose?: 'ours' | 'theirs' | 'delete';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* One path a merge could not settle by itself, with everything a resolver
|
|
75
|
+
* needs to settle it: the file at the merge base, on each side, and the
|
|
76
|
+
* working copy as git left it with its conflict markers.
|
|
77
|
+
*/
|
|
78
|
+
export interface ConflictedFile {
|
|
79
|
+
path: string;
|
|
80
|
+
/** The file at the merge base; null when it did not exist there, or when `truncated` names `base`. */
|
|
81
|
+
base: string | null;
|
|
82
|
+
/** The file on the branch being updated; null when that side deleted it, or when `truncated` names `ours`. */
|
|
83
|
+
ours: string | null;
|
|
84
|
+
/** The file on the branch merged in; null when that side deleted it, or when `truncated` names `theirs`. */
|
|
85
|
+
theirs: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* The working copy with git's conflict markers; null when a side deleted
|
|
88
|
+
* the file (git leaves no marked-up copy then), or when `truncated` names
|
|
89
|
+
* `merged`.
|
|
90
|
+
*/
|
|
91
|
+
merged: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* The sides that were too large or not text and were left out — a null
|
|
94
|
+
* side named here is omitted, not deleted. Read it instead: `ours` is the
|
|
95
|
+
* branch's own file (`read_file`), `theirs` the merged-in branch's
|
|
96
|
+
* (`read_file_at` at that branch), `base` the file at `mergeBase`
|
|
97
|
+
* (`read_file_at` at that commit, which is on the branch's own history); a
|
|
98
|
+
* whole side can still be kept with `choose`.
|
|
99
|
+
*/
|
|
100
|
+
truncated?: Array<'base' | 'ours' | 'theirs' | 'merged'>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* What merging one branch into another, in the receiving branch's own
|
|
104
|
+
* workspace, did:
|
|
105
|
+
*
|
|
106
|
+
* - `merged` — a merge commit `sha` was made on the branch, and
|
|
107
|
+
* `publish` (when given) has run over it; `sha` is the
|
|
108
|
+
* commit as it stands after that, `resolvedPaths` the
|
|
109
|
+
* conflicts the caller's resolutions settled.
|
|
110
|
+
* - `nothing-to-merge` — the branch already held everything; `sha` is its tip.
|
|
111
|
+
* - `conflicts` — the merge was undone and the working tree left as it
|
|
112
|
+
* was: `files` describes every conflicted path,
|
|
113
|
+
* `unresolved` the ones no resolution covered. Call
|
|
114
|
+
* again with a resolution per path.
|
|
115
|
+
*/
|
|
116
|
+
export type MergeIntoBranchOutcome = {
|
|
117
|
+
kind: 'merged';
|
|
118
|
+
sha: string;
|
|
119
|
+
from: string;
|
|
120
|
+
resolvedPaths: string[];
|
|
121
|
+
} | {
|
|
122
|
+
kind: 'nothing-to-merge';
|
|
123
|
+
sha: string;
|
|
124
|
+
from: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'conflicts';
|
|
127
|
+
from: string;
|
|
128
|
+
/** The common ancestor the merge was computed from; null when the histories are unrelated. */
|
|
129
|
+
mergeBase: string | null;
|
|
130
|
+
/** The branch's own tip, what `ours` means in every file. */
|
|
131
|
+
ours: string;
|
|
132
|
+
/** The merged-in branch's tip, what `theirs` means in every file. */
|
|
133
|
+
theirs: string;
|
|
134
|
+
files: ConflictedFile[];
|
|
135
|
+
unresolved: string[];
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* What a merge's `publish` may do while the merge still holds its workspace:
|
|
139
|
+
* `push` the branch, and `pullRebase` it onto its moved remote with the merge
|
|
140
|
+
* kept as a merge — the two moves every workflow push's cooperative recovery
|
|
141
|
+
* is made of, so that recovery can run inside the reservation unchanged.
|
|
142
|
+
*/
|
|
143
|
+
export interface ReservedPushOps {
|
|
144
|
+
push(): Promise<void>;
|
|
145
|
+
pullRebase(): Promise<{
|
|
146
|
+
treeChanged: boolean;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
58
149
|
export interface IGitService {
|
|
59
150
|
status(workspaceId: string): Promise<WorkingTreeStatus>;
|
|
151
|
+
/**
|
|
152
|
+
* Merge `origin/<fromBranch>` into `branch`, in `branch`'s own workspace,
|
|
153
|
+
* as a merge commit authored by `user` — or report what conflicts and undo
|
|
154
|
+
* everything. The working tree is never left mid-merge: a conflict is
|
|
155
|
+
* described (both sides, the base, the marked-up working copy) and the
|
|
156
|
+
* merge aborted in the same reservation, and a later call carrying a
|
|
157
|
+
* resolution for every conflicted path makes the merge for real. A
|
|
158
|
+
* resolution naming a path that is not conflicted is refused before
|
|
159
|
+
* anything is written. `publish`, when given, runs right after the merge
|
|
160
|
+
* commit, inside the same reservation, over the pushes it may make
|
|
161
|
+
* (`ReservedPushOps`): the caller brings the one push policy every
|
|
162
|
+
* workflow push takes, and whatever it throws leaves the merge commit on
|
|
163
|
+
* the local branch, unpublished, the checkout clean (a replay that
|
|
164
|
+
* conflicts undoes itself), a later call answering `nothing-to-merge`
|
|
165
|
+
* without pushing — the commit is published as any local commit is.
|
|
166
|
+
* Without `publish` nothing is pushed. Resolutions come with `authorizeResolutions`
|
|
167
|
+
* (required with them, refused without): it is asked inside the
|
|
168
|
+
* reservation, after the fetch and before the merge touches the checkout,
|
|
169
|
+
* with the two commits the merge is of — `theirs` is the commit merged,
|
|
170
|
+
* described and recorded, never the ref it was read from, which a
|
|
171
|
+
* concurrent fetch may move — the checkout clean at `ours`, so a rule
|
|
172
|
+
* read from it is the branch's own commit's, never a tree mid-merge;
|
|
173
|
+
* throwing refuses before anything is written. Nothing to merge is a
|
|
174
|
+
* question of ancestry: a source the branch does not yet reach is merged
|
|
175
|
+
* in even when the two trees are identical.
|
|
176
|
+
*
|
|
177
|
+
* Refused when the workspace is not on `branch`, or holds edits not yet
|
|
178
|
+
* committed (`kind: 'branch-busy'`, 409): a merge over them could lose them.
|
|
179
|
+
*/
|
|
180
|
+
mergeIntoBranch(workspaceId: string, branch: string, fromBranch: string, user: AuthUser, opts: {
|
|
181
|
+
subject: string;
|
|
182
|
+
body: string;
|
|
183
|
+
publish?: (ops: ReservedPushOps) => Promise<void>;
|
|
184
|
+
} & ({
|
|
185
|
+
resolutions?: undefined;
|
|
186
|
+
authorizeResolutions?: undefined;
|
|
187
|
+
} | {
|
|
188
|
+
resolutions: MergeResolution[];
|
|
189
|
+
authorizeResolutions: (merge: {
|
|
190
|
+
ours: string;
|
|
191
|
+
theirs: string;
|
|
192
|
+
}) => Promise<void>;
|
|
193
|
+
})): Promise<MergeIntoBranchOutcome>;
|
|
194
|
+
/**
|
|
195
|
+
* One file as `branch` has PUBLISHED it (`origin/<branch>`; its local head
|
|
196
|
+
* only for a branch origin does not have), with the commit it was read at.
|
|
197
|
+
* `content` is null when the file is not there; a path that is a folder at
|
|
198
|
+
* that commit is refused, as every per-file history read refuses it.
|
|
199
|
+
* Access to the file at that commit is the caller's to check: `authorize`,
|
|
200
|
+
* when given, is asked inside the reservation before anything is said
|
|
201
|
+
* about the path there (the folder refusal included), with every commit
|
|
202
|
+
* the branch resolves to in this repository (its local head and its
|
|
203
|
+
* published tip, whichever resolve; the served one first), all of which
|
|
204
|
+
* are the caller's to require a grant from; its throw is the answer.
|
|
205
|
+
*/
|
|
206
|
+
readFileAtBranch(workspaceId: string, relativePath: string, branch: string, authorize?: (commits: string[]) => Promise<void>): Promise<{
|
|
207
|
+
sha: string;
|
|
208
|
+
ref: string;
|
|
209
|
+
content: string | null;
|
|
210
|
+
}>;
|
|
60
211
|
listBranches(workspaceId: string, opts?: {
|
|
61
212
|
freshFetch?: boolean;
|
|
62
213
|
strictFetch?: boolean;
|
|
@@ -165,14 +316,34 @@ export interface IGitService {
|
|
|
165
316
|
* Unified diff of a single file between two branches. Both names must
|
|
166
317
|
* resolve to a known branch on this workspace (local head or
|
|
167
318
|
* `refs/remotes/origin/<name>`); arbitrary refspecs and SHAs are
|
|
168
|
-
* rejected upstream.
|
|
319
|
+
* rejected upstream. `diff` is the raw `git diff` output — empty string
|
|
169
320
|
* when the file is identical on both sides, a unified-diff body
|
|
170
321
|
* otherwise (including the "new file mode" / "deleted file mode"
|
|
171
|
-
* headers when the file only exists on one side).
|
|
322
|
+
* headers when the file only exists on one side). `from` and `to` are
|
|
323
|
+
* the COMMITS each side was served from, resolved once inside the
|
|
324
|
+
* reservation (the checked-out side is served from the working tree;
|
|
325
|
+
* its commit is the checkout's head): what a caller authorizes the diff
|
|
326
|
+
* at, so a fetch that moves a branch after this call cannot have swapped
|
|
327
|
+
* in content the verdict never saw. `authorize`, when given, is asked
|
|
328
|
+
* inside the reservation, before anything is said about the path at
|
|
329
|
+
* either side (a refusal that names what the path is there — a folder —
|
|
330
|
+
* is itself an answer), with EVERY commit each branch resolves to in this
|
|
331
|
+
* repository: its local head and its published tip, whichever resolve,
|
|
332
|
+
* the served one first. All of them are the caller's to require a grant
|
|
333
|
+
* from — a grant at the served commit must not outrun a denial at the
|
|
334
|
+
* other, which is what the compare route has always required of both
|
|
335
|
+
* refs — and its throw is the answer.
|
|
172
336
|
*
|
|
173
337
|
* Read-only: nothing is checked out, fetched, or written.
|
|
174
338
|
*/
|
|
175
|
-
diffFileBetweenBranches(workspaceId: string, relativePath: string, fromBranch: string, toBranch: string
|
|
339
|
+
diffFileBetweenBranches(workspaceId: string, relativePath: string, fromBranch: string, toBranch: string, authorize?: (sides: {
|
|
340
|
+
from: string[];
|
|
341
|
+
to: string[];
|
|
342
|
+
}) => Promise<void>): Promise<{
|
|
343
|
+
diff: string;
|
|
344
|
+
from: string;
|
|
345
|
+
to: string;
|
|
346
|
+
}>;
|
|
176
347
|
/**
|
|
177
348
|
* Head and base commit SHAs of a change request, resolved on `origin/*`
|
|
178
349
|
* after a fetch so a force-push is reflected. These are what approvals
|
package/dist/git/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/git/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAExF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IAIrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;CAKpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,OAAO,CAAC;IAKrB,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAMD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACp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
|
|
21
|
-
import type { AcquireLockResult, Branch, BranchSyncOutcome, BranchWorkspaceStatus, CancelChangeRequestResult, Change, ChangeInput, ChangeRequest, ChangeRequestComment, ChangeRequestDetail, ChangeRequestUpdateResult, ChangeRequestState, ChangedFile, DeleteBranchPreview, DeleteBranchResult, FileApproval, FileLock, FolderChangeRequest, FolderChangeRequestRemoval, MergeBranchOutcome, MergeChangeRequestOutcome, OpenChangeRequestInput, PostChangeRequestCommentInput } from './types.js';
|
|
21
|
+
import type { AcquireLockResult, Branch, BranchSyncOutcome, BranchWorkspaceStatus, CancelChangeRequestResult, Change, ChangeInput, ChangeRequest, ChangeRequestComment, ChangeRequestDetail, ChangeRequestUpdateResult, ChangeRequestState, ChangedFile, DeleteBranchPreview, DeleteBranchResult, FileApproval, FileLock, FolderChangeRequest, FolderChangeRequestRemoval, MergeBranchOutcome, MergeChangeRequestOutcome, OpenChangeRequestInput, PostChangeRequestCommentInput, UpdateBranchOutcome } from './types.js';
|
|
22
|
+
import type { MergeResolution } from '../git/types.js';
|
|
22
23
|
export interface IWorkflowService {
|
|
23
24
|
/**
|
|
24
25
|
* `freshFetch` bypasses the fetch TTL; `strictFetch` makes a failed fetch
|
|
@@ -175,12 +176,25 @@ export interface IWorkflowService {
|
|
|
175
176
|
listChangesForFile(workspaceId: string, path: string, limit?: number): Promise<Change[]>;
|
|
176
177
|
/**
|
|
177
178
|
* Diff of one file between two branches. Both names must resolve to a
|
|
178
|
-
* known branch on this workspace (local head or remote-tracking).
|
|
179
|
-
* the raw unified diff body — empty when identical,
|
|
180
|
-
*
|
|
181
|
-
* side.
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
* known branch on this workspace (local head or remote-tracking). `diff`
|
|
180
|
+
* is the raw unified diff body — empty when identical, with the "new
|
|
181
|
+
* file" / "deleted file" headers when the file only exists on one side —
|
|
182
|
+
* and `from`/`to` the commits each side was served from. `authorize` is
|
|
183
|
+
* the caller's read verdict, asked inside the git layer's reservation
|
|
184
|
+
* before anything is said about the path at either side, with every
|
|
185
|
+
* commit each branch resolves to in this repository (local head and
|
|
186
|
+
* published tip, the served one first) — all must grant, as the compare
|
|
187
|
+
* route has always required of both refs; its throw is the answer.
|
|
188
|
+
* Required: content from another branch is never served without it.
|
|
189
|
+
*/
|
|
190
|
+
compareFile(workspaceId: string, path: string, fromBranch: string, toBranch: string, authorize: (sides: {
|
|
191
|
+
from: string[];
|
|
192
|
+
to: string[];
|
|
193
|
+
}) => Promise<void>): Promise<{
|
|
194
|
+
diff: string;
|
|
195
|
+
from: string;
|
|
196
|
+
to: string;
|
|
197
|
+
}>;
|
|
184
198
|
/**
|
|
185
199
|
* Diff of one file at a specific change (sha) — i.e. `git show <sha> -- <path>`.
|
|
186
200
|
* Used by the File viewer's History tab.
|
|
@@ -558,5 +572,73 @@ export interface IWorkflowService {
|
|
|
558
572
|
* `merged` means a merge commit was made.
|
|
559
573
|
*/
|
|
560
574
|
mergeBranch(user: AuthUser, sourceBranch: string, targetBranch: string): Promise<MergeBranchOutcome>;
|
|
575
|
+
/**
|
|
576
|
+
* Bring another branch's published state into the branch this workspace is
|
|
577
|
+
* on — `from` (a target the draft was forked from, say), or, left out, the
|
|
578
|
+
* branch's own published state when it diverged from the local one — as a
|
|
579
|
+
* merge commit authored by `user`, and publish it. The agent's way of
|
|
580
|
+
* refreshing a draft and of resolving conflicts: a conflict comes back
|
|
581
|
+
* described (`conflicts`: both sides, the base, the working copy with
|
|
582
|
+
* markers), the working tree untouched; a second call with a resolution
|
|
583
|
+
* per conflicted path lands the merge. See `IGitService.mergeIntoBranch`.
|
|
584
|
+
*
|
|
585
|
+
* - refused (`WorkflowDomainError`, `kind: 'protected-update-target'`,
|
|
586
|
+
* 403) for a protected branch: those are updated through change requests.
|
|
587
|
+
* - refused (`WorkflowValidationError`) when `from` is not on the shared
|
|
588
|
+
* repository, or when a resolution names a path that is not conflicted.
|
|
589
|
+
* - refused (`WorkflowDomainError`, `kind: 'branch-busy'`, 409) while the
|
|
590
|
+
* workspace holds edits not committed yet: a merge over them could lose
|
|
591
|
+
* them.
|
|
592
|
+
* - `pending-commits` when writes on either branch are still being
|
|
593
|
+
* committed (waited for, up to 20 seconds); nothing merged.
|
|
594
|
+
* - `merged` means the merge commit is PUBLISHED: the push runs inside the
|
|
595
|
+
* merge's own reservation, through the cooperative recovery every
|
|
596
|
+
* workflow push takes — a push the host rejects because the branch
|
|
597
|
+
* moved is retried with the merge replayed on top. A replay that
|
|
598
|
+
* conflicts, or a host that refuses, throws the saved-locally hand-off
|
|
599
|
+
* (`PushNeedsAgentResolutionError`, its `path` the branch: no single
|
|
600
|
+
* file is at issue, and no conflicted path is named), the merge commit
|
|
601
|
+
* kept on the branch, unpublished, the checkout clean.
|
|
602
|
+
*
|
|
603
|
+
* Per-file read access to what a `conflicts` answer carries is the
|
|
604
|
+
* CALLER's to check and withhold, as for `fileAtBranch`. Resolutions come
|
|
605
|
+
* with `validateWrite`, the caller's pre-disk write gate (what its file
|
|
606
|
+
* writes take before a byte lands — a `roles.yaml` that must parse, say):
|
|
607
|
+
* required with them, refused without; asked with the workspace path and
|
|
608
|
+
* the content of every resolution that brings content, inside the merge's
|
|
609
|
+
* reservation before the merge runs; its throw refuses the update. A side
|
|
610
|
+
* kept whole brings no new content and is not asked.
|
|
611
|
+
*/
|
|
612
|
+
updateBranch(workspaceId: string, user: AuthUser, opts?: {
|
|
613
|
+
from?: string;
|
|
614
|
+
} & ({
|
|
615
|
+
resolutions?: undefined;
|
|
616
|
+
validateWrite?: undefined;
|
|
617
|
+
} | {
|
|
618
|
+
resolutions: MergeResolution[];
|
|
619
|
+
validateWrite: (wsPath: string, content: string) => void | Promise<void>;
|
|
620
|
+
})): Promise<UpdateBranchOutcome>;
|
|
621
|
+
/**
|
|
622
|
+
* One file as `branch` has it, with the commit it was read at (`IGitService.readFileAtBranch`).
|
|
623
|
+
* Access to the file at that commit is the caller's to check — through
|
|
624
|
+
* `authorize`, asked before anything is said about the path there with
|
|
625
|
+
* every commit the branch resolves to (local head and published tip, the
|
|
626
|
+
* served one first), all of which must grant. Required: content from
|
|
627
|
+
* another branch is never served without it.
|
|
628
|
+
*/
|
|
629
|
+
fileAtBranch(workspaceId: string, path: string, branch: string, authorize: (commits: string[]) => Promise<void>): Promise<{
|
|
630
|
+
sha: string;
|
|
631
|
+
ref: string;
|
|
632
|
+
content: string | null;
|
|
633
|
+
}>;
|
|
634
|
+
/**
|
|
635
|
+
* The repository-relative paths `branch` changes against `base` — a
|
|
636
|
+
* three-dot diff of their published tips, rename-aware — the list a change
|
|
637
|
+
* request from `branch` into `base` would carry. Unfiltered: a path's name
|
|
638
|
+
* is information too, and which of them the caller may read is the
|
|
639
|
+
* CALLER's to decide (at `origin/<base>`, as the change-request reads do)
|
|
640
|
+
* before any of them is shown.
|
|
641
|
+
*/
|
|
642
|
+
changedPathsBetweenBranches(workspaceId: string, base: string, branch: string): Promise<string[]>;
|
|
561
643
|
}
|
|
562
644
|
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/workflow/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EACV,iBAAiB,EACjB,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,EACN,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot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AAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAC9C,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACjE;;;;;;;OAOG;IACH,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACnG"}
|
package/dist/workflow/types.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* New types that have no git counterpart (file locks, change-request open
|
|
14
14
|
* inputs, conflict-resolution payloads) live here directly.
|
|
15
15
|
*/
|
|
16
|
-
import type { BranchInfo, CommitAttribution, ShareChangesRequest, WorkingTreeStatus } from '../git/types.js';
|
|
16
|
+
import type { BranchInfo, CommitAttribution, MergeIntoBranchOutcome, ShareChangesRequest, WorkingTreeStatus } from '../git/types.js';
|
|
17
17
|
import type { CancelPrResult, FileApprovalState, MergePrResult, PullRequestDetail, PullRequestState, PullRequestSummary, PostPrCommentInput, PrReviewComment, PullRequestFile } from '../git/pr.types.js';
|
|
18
18
|
/** A variation of the ontology. Protected or not. */
|
|
19
19
|
export type Branch = BranchInfo;
|
|
@@ -222,6 +222,19 @@ export type MergeBranchOutcome = {
|
|
|
222
222
|
needsAttention?: string;
|
|
223
223
|
message: string;
|
|
224
224
|
};
|
|
225
|
+
/**
|
|
226
|
+
* What updating a branch from another (`updateBranch`) did: the merge's own
|
|
227
|
+
* outcomes (see `MergeIntoBranchOutcome`; `merged` here means the merge commit
|
|
228
|
+
* was also published), or `pending-commits` when writes on either branch were
|
|
229
|
+
* still being committed and nothing was merged.
|
|
230
|
+
*/
|
|
231
|
+
export type UpdateBranchOutcome = MergeIntoBranchOutcome | {
|
|
232
|
+
kind: 'pending-commits';
|
|
233
|
+
branch: string;
|
|
234
|
+
pending: number;
|
|
235
|
+
needsAttention?: string;
|
|
236
|
+
message: string;
|
|
237
|
+
};
|
|
225
238
|
/**
|
|
226
239
|
* What deleting a branch would do, as an agent's `delete_branch` preview
|
|
227
240
|
* (`dryRun`) reports it. It reserves nothing: every check runs again when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workflow/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAI5B,qDAAqD;AACrD,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAItD;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,iBAAiB,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAI9C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IAC/B,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,eAAe,EAAE,MAAM,CAAC;IACxB,iGAAiG;IACjG,SAAS,EAAE,MAAM,CAA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AAe,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC1G,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,sHAAsH;AACtH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bevel-software/platform-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Shared types and pure domain utilities of the Bevel core platform (auth, workspace, git/workflow contracts, branch registry).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/src/git/types.ts
CHANGED
|
@@ -80,8 +80,155 @@ export interface RemoteSyncPullResult {
|
|
|
80
80
|
changedPaths: string[];
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* How one conflicted path is settled when a branch is updated from another:
|
|
85
|
+
* the text to keep, or one side whole, or the file gone.
|
|
86
|
+
*/
|
|
87
|
+
export interface MergeResolution {
|
|
88
|
+
/** The conflicted path, exactly as the conflict named it (repository-relative or workspace-relative). */
|
|
89
|
+
path: string;
|
|
90
|
+
/** The resolved text of the file. */
|
|
91
|
+
content?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Keep one side as it is — `ours` is the branch being updated, `theirs` the
|
|
94
|
+
* branch merged in — or `delete` the file.
|
|
95
|
+
*/
|
|
96
|
+
choose?: 'ours' | 'theirs' | 'delete';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* One path a merge could not settle by itself, with everything a resolver
|
|
101
|
+
* needs to settle it: the file at the merge base, on each side, and the
|
|
102
|
+
* working copy as git left it with its conflict markers.
|
|
103
|
+
*/
|
|
104
|
+
export interface ConflictedFile {
|
|
105
|
+
path: string;
|
|
106
|
+
/** The file at the merge base; null when it did not exist there, or when `truncated` names `base`. */
|
|
107
|
+
base: string | null;
|
|
108
|
+
/** The file on the branch being updated; null when that side deleted it, or when `truncated` names `ours`. */
|
|
109
|
+
ours: string | null;
|
|
110
|
+
/** The file on the branch merged in; null when that side deleted it, or when `truncated` names `theirs`. */
|
|
111
|
+
theirs: string | null;
|
|
112
|
+
/**
|
|
113
|
+
* The working copy with git's conflict markers; null when a side deleted
|
|
114
|
+
* the file (git leaves no marked-up copy then), or when `truncated` names
|
|
115
|
+
* `merged`.
|
|
116
|
+
*/
|
|
117
|
+
merged: string | null;
|
|
118
|
+
/**
|
|
119
|
+
* The sides that were too large or not text and were left out — a null
|
|
120
|
+
* side named here is omitted, not deleted. Read it instead: `ours` is the
|
|
121
|
+
* branch's own file (`read_file`), `theirs` the merged-in branch's
|
|
122
|
+
* (`read_file_at` at that branch), `base` the file at `mergeBase`
|
|
123
|
+
* (`read_file_at` at that commit, which is on the branch's own history); a
|
|
124
|
+
* whole side can still be kept with `choose`.
|
|
125
|
+
*/
|
|
126
|
+
truncated?: Array<'base' | 'ours' | 'theirs' | 'merged'>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* What merging one branch into another, in the receiving branch's own
|
|
131
|
+
* workspace, did:
|
|
132
|
+
*
|
|
133
|
+
* - `merged` — a merge commit `sha` was made on the branch, and
|
|
134
|
+
* `publish` (when given) has run over it; `sha` is the
|
|
135
|
+
* commit as it stands after that, `resolvedPaths` the
|
|
136
|
+
* conflicts the caller's resolutions settled.
|
|
137
|
+
* - `nothing-to-merge` — the branch already held everything; `sha` is its tip.
|
|
138
|
+
* - `conflicts` — the merge was undone and the working tree left as it
|
|
139
|
+
* was: `files` describes every conflicted path,
|
|
140
|
+
* `unresolved` the ones no resolution covered. Call
|
|
141
|
+
* again with a resolution per path.
|
|
142
|
+
*/
|
|
143
|
+
export type MergeIntoBranchOutcome =
|
|
144
|
+
| { kind: 'merged'; sha: string; from: string; resolvedPaths: string[] }
|
|
145
|
+
| { kind: 'nothing-to-merge'; sha: string; from: string }
|
|
146
|
+
| {
|
|
147
|
+
kind: 'conflicts';
|
|
148
|
+
from: string;
|
|
149
|
+
/** The common ancestor the merge was computed from; null when the histories are unrelated. */
|
|
150
|
+
mergeBase: string | null;
|
|
151
|
+
/** The branch's own tip, what `ours` means in every file. */
|
|
152
|
+
ours: string;
|
|
153
|
+
/** The merged-in branch's tip, what `theirs` means in every file. */
|
|
154
|
+
theirs: string;
|
|
155
|
+
files: ConflictedFile[];
|
|
156
|
+
unresolved: string[];
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* What a merge's `publish` may do while the merge still holds its workspace:
|
|
161
|
+
* `push` the branch, and `pullRebase` it onto its moved remote with the merge
|
|
162
|
+
* kept as a merge — the two moves every workflow push's cooperative recovery
|
|
163
|
+
* is made of, so that recovery can run inside the reservation unchanged.
|
|
164
|
+
*/
|
|
165
|
+
export interface ReservedPushOps {
|
|
166
|
+
push(): Promise<void>;
|
|
167
|
+
pullRebase(): Promise<{ treeChanged: boolean }>;
|
|
168
|
+
}
|
|
169
|
+
|
|
83
170
|
export interface IGitService {
|
|
84
171
|
status(workspaceId: string): Promise<WorkingTreeStatus>;
|
|
172
|
+
/**
|
|
173
|
+
* Merge `origin/<fromBranch>` into `branch`, in `branch`'s own workspace,
|
|
174
|
+
* as a merge commit authored by `user` — or report what conflicts and undo
|
|
175
|
+
* everything. The working tree is never left mid-merge: a conflict is
|
|
176
|
+
* described (both sides, the base, the marked-up working copy) and the
|
|
177
|
+
* merge aborted in the same reservation, and a later call carrying a
|
|
178
|
+
* resolution for every conflicted path makes the merge for real. A
|
|
179
|
+
* resolution naming a path that is not conflicted is refused before
|
|
180
|
+
* anything is written. `publish`, when given, runs right after the merge
|
|
181
|
+
* commit, inside the same reservation, over the pushes it may make
|
|
182
|
+
* (`ReservedPushOps`): the caller brings the one push policy every
|
|
183
|
+
* workflow push takes, and whatever it throws leaves the merge commit on
|
|
184
|
+
* the local branch, unpublished, the checkout clean (a replay that
|
|
185
|
+
* conflicts undoes itself), a later call answering `nothing-to-merge`
|
|
186
|
+
* without pushing — the commit is published as any local commit is.
|
|
187
|
+
* Without `publish` nothing is pushed. Resolutions come with `authorizeResolutions`
|
|
188
|
+
* (required with them, refused without): it is asked inside the
|
|
189
|
+
* reservation, after the fetch and before the merge touches the checkout,
|
|
190
|
+
* with the two commits the merge is of — `theirs` is the commit merged,
|
|
191
|
+
* described and recorded, never the ref it was read from, which a
|
|
192
|
+
* concurrent fetch may move — the checkout clean at `ours`, so a rule
|
|
193
|
+
* read from it is the branch's own commit's, never a tree mid-merge;
|
|
194
|
+
* throwing refuses before anything is written. Nothing to merge is a
|
|
195
|
+
* question of ancestry: a source the branch does not yet reach is merged
|
|
196
|
+
* in even when the two trees are identical.
|
|
197
|
+
*
|
|
198
|
+
* Refused when the workspace is not on `branch`, or holds edits not yet
|
|
199
|
+
* committed (`kind: 'branch-busy'`, 409): a merge over them could lose them.
|
|
200
|
+
*/
|
|
201
|
+
mergeIntoBranch(
|
|
202
|
+
workspaceId: string,
|
|
203
|
+
branch: string,
|
|
204
|
+
fromBranch: string,
|
|
205
|
+
user: AuthUser,
|
|
206
|
+
opts: { subject: string; body: string; publish?: (ops: ReservedPushOps) => Promise<void> } & (
|
|
207
|
+
| { resolutions?: undefined; authorizeResolutions?: undefined }
|
|
208
|
+
| {
|
|
209
|
+
resolutions: MergeResolution[];
|
|
210
|
+
authorizeResolutions: (merge: { ours: string; theirs: string }) => Promise<void>;
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
): Promise<MergeIntoBranchOutcome>;
|
|
214
|
+
/**
|
|
215
|
+
* One file as `branch` has PUBLISHED it (`origin/<branch>`; its local head
|
|
216
|
+
* only for a branch origin does not have), with the commit it was read at.
|
|
217
|
+
* `content` is null when the file is not there; a path that is a folder at
|
|
218
|
+
* that commit is refused, as every per-file history read refuses it.
|
|
219
|
+
* Access to the file at that commit is the caller's to check: `authorize`,
|
|
220
|
+
* when given, is asked inside the reservation before anything is said
|
|
221
|
+
* about the path there (the folder refusal included), with every commit
|
|
222
|
+
* the branch resolves to in this repository (its local head and its
|
|
223
|
+
* published tip, whichever resolve; the served one first), all of which
|
|
224
|
+
* are the caller's to require a grant from; its throw is the answer.
|
|
225
|
+
*/
|
|
226
|
+
readFileAtBranch(
|
|
227
|
+
workspaceId: string,
|
|
228
|
+
relativePath: string,
|
|
229
|
+
branch: string,
|
|
230
|
+
authorize?: (commits: string[]) => Promise<void>,
|
|
231
|
+
): Promise<{ sha: string; ref: string; content: string | null }>;
|
|
85
232
|
listBranches(workspaceId: string, opts?: { freshFetch?: boolean; strictFetch?: boolean }): Promise<BranchInfo[]>;
|
|
86
233
|
createBranch(
|
|
87
234
|
workspaceId: string,
|
|
@@ -218,10 +365,23 @@ export interface IGitService {
|
|
|
218
365
|
* Unified diff of a single file between two branches. Both names must
|
|
219
366
|
* resolve to a known branch on this workspace (local head or
|
|
220
367
|
* `refs/remotes/origin/<name>`); arbitrary refspecs and SHAs are
|
|
221
|
-
* rejected upstream.
|
|
368
|
+
* rejected upstream. `diff` is the raw `git diff` output — empty string
|
|
222
369
|
* when the file is identical on both sides, a unified-diff body
|
|
223
370
|
* otherwise (including the "new file mode" / "deleted file mode"
|
|
224
|
-
* headers when the file only exists on one side).
|
|
371
|
+
* headers when the file only exists on one side). `from` and `to` are
|
|
372
|
+
* the COMMITS each side was served from, resolved once inside the
|
|
373
|
+
* reservation (the checked-out side is served from the working tree;
|
|
374
|
+
* its commit is the checkout's head): what a caller authorizes the diff
|
|
375
|
+
* at, so a fetch that moves a branch after this call cannot have swapped
|
|
376
|
+
* in content the verdict never saw. `authorize`, when given, is asked
|
|
377
|
+
* inside the reservation, before anything is said about the path at
|
|
378
|
+
* either side (a refusal that names what the path is there — a folder —
|
|
379
|
+
* is itself an answer), with EVERY commit each branch resolves to in this
|
|
380
|
+
* repository: its local head and its published tip, whichever resolve,
|
|
381
|
+
* the served one first. All of them are the caller's to require a grant
|
|
382
|
+
* from — a grant at the served commit must not outrun a denial at the
|
|
383
|
+
* other, which is what the compare route has always required of both
|
|
384
|
+
* refs — and its throw is the answer.
|
|
225
385
|
*
|
|
226
386
|
* Read-only: nothing is checked out, fetched, or written.
|
|
227
387
|
*/
|
|
@@ -230,7 +390,8 @@ export interface IGitService {
|
|
|
230
390
|
relativePath: string,
|
|
231
391
|
fromBranch: string,
|
|
232
392
|
toBranch: string,
|
|
233
|
-
|
|
393
|
+
authorize?: (sides: { from: string[]; to: string[] }) => Promise<void>,
|
|
394
|
+
): Promise<{ diff: string; from: string; to: string }>;
|
|
234
395
|
// `workingStatus` + `diffFileWorking` removed: under save=share the
|
|
235
396
|
// working tree is never dirty, so listing dirty files / diffing them
|
|
236
397
|
// against HEAD reports the empty state by definition. Cross-branch
|
|
@@ -43,7 +43,9 @@ import type {
|
|
|
43
43
|
MergeChangeRequestOutcome,
|
|
44
44
|
OpenChangeRequestInput,
|
|
45
45
|
PostChangeRequestCommentInput,
|
|
46
|
+
UpdateBranchOutcome,
|
|
46
47
|
} from './types.js';
|
|
48
|
+
import type { MergeResolution } from '../git/types.js';
|
|
47
49
|
|
|
48
50
|
export interface IWorkflowService {
|
|
49
51
|
// ── Branches ──────────────────────────────────────────────────────────────
|
|
@@ -224,17 +226,24 @@ export interface IWorkflowService {
|
|
|
224
226
|
listChangesForFile(workspaceId: string, path: string, limit?: number): Promise<Change[]>;
|
|
225
227
|
/**
|
|
226
228
|
* Diff of one file between two branches. Both names must resolve to a
|
|
227
|
-
* known branch on this workspace (local head or remote-tracking).
|
|
228
|
-
* the raw unified diff body — empty when identical,
|
|
229
|
-
*
|
|
230
|
-
* side.
|
|
229
|
+
* known branch on this workspace (local head or remote-tracking). `diff`
|
|
230
|
+
* is the raw unified diff body — empty when identical, with the "new
|
|
231
|
+
* file" / "deleted file" headers when the file only exists on one side —
|
|
232
|
+
* and `from`/`to` the commits each side was served from. `authorize` is
|
|
233
|
+
* the caller's read verdict, asked inside the git layer's reservation
|
|
234
|
+
* before anything is said about the path at either side, with every
|
|
235
|
+
* commit each branch resolves to in this repository (local head and
|
|
236
|
+
* published tip, the served one first) — all must grant, as the compare
|
|
237
|
+
* route has always required of both refs; its throw is the answer.
|
|
238
|
+
* Required: content from another branch is never served without it.
|
|
231
239
|
*/
|
|
232
240
|
compareFile(
|
|
233
241
|
workspaceId: string,
|
|
234
242
|
path: string,
|
|
235
243
|
fromBranch: string,
|
|
236
244
|
toBranch: string,
|
|
237
|
-
|
|
245
|
+
authorize: (sides: { from: string[]; to: string[] }) => Promise<void>,
|
|
246
|
+
): Promise<{ diff: string; from: string; to: string }>;
|
|
238
247
|
/**
|
|
239
248
|
* Diff of one file at a specific change (sha) — i.e. `git show <sha> -- <path>`.
|
|
240
249
|
* Used by the File viewer's History tab.
|
|
@@ -725,4 +734,73 @@ export interface IWorkflowService {
|
|
|
725
734
|
* `merged` means a merge commit was made.
|
|
726
735
|
*/
|
|
727
736
|
mergeBranch(user: AuthUser, sourceBranch: string, targetBranch: string): Promise<MergeBranchOutcome>;
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Bring another branch's published state into the branch this workspace is
|
|
740
|
+
* on — `from` (a target the draft was forked from, say), or, left out, the
|
|
741
|
+
* branch's own published state when it diverged from the local one — as a
|
|
742
|
+
* merge commit authored by `user`, and publish it. The agent's way of
|
|
743
|
+
* refreshing a draft and of resolving conflicts: a conflict comes back
|
|
744
|
+
* described (`conflicts`: both sides, the base, the working copy with
|
|
745
|
+
* markers), the working tree untouched; a second call with a resolution
|
|
746
|
+
* per conflicted path lands the merge. See `IGitService.mergeIntoBranch`.
|
|
747
|
+
*
|
|
748
|
+
* - refused (`WorkflowDomainError`, `kind: 'protected-update-target'`,
|
|
749
|
+
* 403) for a protected branch: those are updated through change requests.
|
|
750
|
+
* - refused (`WorkflowValidationError`) when `from` is not on the shared
|
|
751
|
+
* repository, or when a resolution names a path that is not conflicted.
|
|
752
|
+
* - refused (`WorkflowDomainError`, `kind: 'branch-busy'`, 409) while the
|
|
753
|
+
* workspace holds edits not committed yet: a merge over them could lose
|
|
754
|
+
* them.
|
|
755
|
+
* - `pending-commits` when writes on either branch are still being
|
|
756
|
+
* committed (waited for, up to 20 seconds); nothing merged.
|
|
757
|
+
* - `merged` means the merge commit is PUBLISHED: the push runs inside the
|
|
758
|
+
* merge's own reservation, through the cooperative recovery every
|
|
759
|
+
* workflow push takes — a push the host rejects because the branch
|
|
760
|
+
* moved is retried with the merge replayed on top. A replay that
|
|
761
|
+
* conflicts, or a host that refuses, throws the saved-locally hand-off
|
|
762
|
+
* (`PushNeedsAgentResolutionError`, its `path` the branch: no single
|
|
763
|
+
* file is at issue, and no conflicted path is named), the merge commit
|
|
764
|
+
* kept on the branch, unpublished, the checkout clean.
|
|
765
|
+
*
|
|
766
|
+
* Per-file read access to what a `conflicts` answer carries is the
|
|
767
|
+
* CALLER's to check and withhold, as for `fileAtBranch`. Resolutions come
|
|
768
|
+
* with `validateWrite`, the caller's pre-disk write gate (what its file
|
|
769
|
+
* writes take before a byte lands — a `roles.yaml` that must parse, say):
|
|
770
|
+
* required with them, refused without; asked with the workspace path and
|
|
771
|
+
* the content of every resolution that brings content, inside the merge's
|
|
772
|
+
* reservation before the merge runs; its throw refuses the update. A side
|
|
773
|
+
* kept whole brings no new content and is not asked.
|
|
774
|
+
*/
|
|
775
|
+
updateBranch(
|
|
776
|
+
workspaceId: string,
|
|
777
|
+
user: AuthUser,
|
|
778
|
+
opts?: { from?: string } & (
|
|
779
|
+
| { resolutions?: undefined; validateWrite?: undefined }
|
|
780
|
+
| { resolutions: MergeResolution[]; validateWrite: (wsPath: string, content: string) => void | Promise<void> }
|
|
781
|
+
),
|
|
782
|
+
): Promise<UpdateBranchOutcome>;
|
|
783
|
+
/**
|
|
784
|
+
* One file as `branch` has it, with the commit it was read at (`IGitService.readFileAtBranch`).
|
|
785
|
+
* Access to the file at that commit is the caller's to check — through
|
|
786
|
+
* `authorize`, asked before anything is said about the path there with
|
|
787
|
+
* every commit the branch resolves to (local head and published tip, the
|
|
788
|
+
* served one first), all of which must grant. Required: content from
|
|
789
|
+
* another branch is never served without it.
|
|
790
|
+
*/
|
|
791
|
+
fileAtBranch(
|
|
792
|
+
workspaceId: string,
|
|
793
|
+
path: string,
|
|
794
|
+
branch: string,
|
|
795
|
+
authorize: (commits: string[]) => Promise<void>,
|
|
796
|
+
): Promise<{ sha: string; ref: string; content: string | null }>;
|
|
797
|
+
/**
|
|
798
|
+
* The repository-relative paths `branch` changes against `base` — a
|
|
799
|
+
* three-dot diff of their published tips, rename-aware — the list a change
|
|
800
|
+
* request from `branch` into `base` would carry. Unfiltered: a path's name
|
|
801
|
+
* is information too, and which of them the caller may read is the
|
|
802
|
+
* CALLER's to decide (at `origin/<base>`, as the change-request reads do)
|
|
803
|
+
* before any of them is shown.
|
|
804
|
+
*/
|
|
805
|
+
changedPathsBetweenBranches(workspaceId: string, base: string, branch: string): Promise<string[]>;
|
|
728
806
|
}
|
package/src/workflow/types.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import type {
|
|
18
18
|
BranchInfo,
|
|
19
19
|
CommitAttribution,
|
|
20
|
+
MergeIntoBranchOutcome,
|
|
20
21
|
ShareChangesRequest,
|
|
21
22
|
WorkingTreeStatus,
|
|
22
23
|
} from '../git/types.js';
|
|
@@ -234,6 +235,16 @@ export type MergeBranchOutcome =
|
|
|
234
235
|
| { kind: 'conflicts-need-resolution'; conflictedPaths: string[] }
|
|
235
236
|
| { kind: 'pending-commits'; branch: string; pending: number; needsAttention?: string; message: string };
|
|
236
237
|
|
|
238
|
+
/**
|
|
239
|
+
* What updating a branch from another (`updateBranch`) did: the merge's own
|
|
240
|
+
* outcomes (see `MergeIntoBranchOutcome`; `merged` here means the merge commit
|
|
241
|
+
* was also published), or `pending-commits` when writes on either branch were
|
|
242
|
+
* still being committed and nothing was merged.
|
|
243
|
+
*/
|
|
244
|
+
export type UpdateBranchOutcome =
|
|
245
|
+
| MergeIntoBranchOutcome
|
|
246
|
+
| { kind: 'pending-commits'; branch: string; pending: number; needsAttention?: string; message: string };
|
|
247
|
+
|
|
237
248
|
/**
|
|
238
249
|
* What deleting a branch would do, as an agent's `delete_branch` preview
|
|
239
250
|
* (`dryRun`) reports it. It reserves nothing: every check runs again when the
|