| b69ab31 | | | 1 | /** |
| b69ab31 | | | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| b69ab31 | | | 3 | * |
| b69ab31 | | | 4 | * This source code is licensed under the MIT license found in the |
| b69ab31 | | | 5 | * LICENSE file in the root directory of this source tree. |
| b69ab31 | | | 6 | */ |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | import type {TypeaheadResult} from 'isl-components/Types'; |
| b69ab31 | | | 9 | import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; |
| b69ab31 | | | 10 | import type {TrackDataWithEventName} from 'isl-server/src/analytics/types'; |
| b69ab31 | | | 11 | import type {GitHubDiffSummary} from 'isl-server/src/github/githubCodeReviewProvider'; |
| e272900 | | | 12 | import type {GroveDiffSummary} from 'isl-server/src/grove/groveCodeReviewProvider'; |
| b69ab31 | | | 13 | import type {Comparison} from 'shared/Comparison'; |
| b69ab31 | | | 14 | import type {ParsedDiff} from 'shared/patch/types'; |
| b69ab31 | | | 15 | import type {AllUndefined, Json} from 'shared/typeUtils'; |
| b69ab31 | | | 16 | import type {Hash} from 'shared/types/common'; |
| b69ab31 | | | 17 | import type {ExportStack, ImportedStack, ImportStack} from 'shared/types/stack'; |
| b69ab31 | | | 18 | import type {TypeaheadKind} from './CommitInfoView/types'; |
| b69ab31 | | | 19 | import type {InternalTypes} from './InternalTypes'; |
| b69ab31 | | | 20 | import type {CodeReviewIssue} from './firstPassCodeReview/types'; |
| b69ab31 | | | 21 | import type {Serializable} from './serialize'; |
| b69ab31 | | | 22 | import type {Args, DiffCommit, PartiallySelectedDiffCommit} from './stackEdit/diffSplitTypes'; |
| b69ab31 | | | 23 | |
| b69ab31 | | | 24 | export type Result<T> = {value: T; error?: undefined} | {value?: undefined; error: Error}; |
| b69ab31 | | | 25 | |
| b69ab31 | | | 26 | /** known supported "Platforms" in which ISL may be embedded */ |
| b69ab31 | | | 27 | export type PlatformName = |
| b69ab31 | | | 28 | | 'browser' |
| b69ab31 | | | 29 | | 'androidStudio' |
| b69ab31 | | | 30 | | 'androidStudioRemote' |
| b69ab31 | | | 31 | | 'vscode' |
| b69ab31 | | | 32 | | 'webview' |
| b69ab31 | | | 33 | | 'chromelike_app' |
| b69ab31 | | | 34 | | 'visualStudio' |
| b69ab31 | | | 35 | | 'obsidian'; |
| b69ab31 | | | 36 | |
| b69ab31 | | | 37 | export type AbsolutePath = string; |
| b69ab31 | | | 38 | /** |
| b69ab31 | | | 39 | * Path relative to repository root dir. Generally, most paths should be RepoRelativePaths, |
| b69ab31 | | | 40 | * and only convert to CwdRelativePath or basenames or AbsolutePath when needed. |
| b69ab31 | | | 41 | */ |
| b69ab31 | | | 42 | export type RepoRelativePath = string; |
| b69ab31 | | | 43 | |
| b69ab31 | | | 44 | /** |
| b69ab31 | | | 45 | * cwd may be a subdirectory of the repository root. |
| b69ab31 | | | 46 | * Some commands expect cwd-relative paths, |
| b69ab31 | | | 47 | * but we generally prefer {@link RepoRelativePaths} when possible. */ |
| b69ab31 | | | 48 | export type CwdRelativePath = string; |
| b69ab31 | | | 49 | |
| b69ab31 | | | 50 | export type {Hash}; |
| b69ab31 | | | 51 | |
| b69ab31 | | | 52 | /** Revsets are an eden concept that let you specify commits. |
| b69ab31 | | | 53 | * This could be a Hash, '.' for HEAD, .^ for parent of head, etc. See `eden help revset` */ |
| b69ab31 | | | 54 | export type Revset = string; |
| b69ab31 | | | 55 | |
| b69ab31 | | | 56 | /** |
| b69ab31 | | | 57 | * Diff identifier according to the current repo's remote repository provider (e.g. GitHub) |
| b69ab31 | | | 58 | * For Github, this is a PR number, like "7" (for PR #7) |
| b69ab31 | | | 59 | * For Phabricator, this is a Diff number, like "D12345" |
| b69ab31 | | | 60 | */ |
| b69ab31 | | | 61 | export type DiffId = string; |
| b69ab31 | | | 62 | /** |
| b69ab31 | | | 63 | * "Diff" means a unit of Code Review according to your remote repo provider |
| b69ab31 | | | 64 | * For GitHub, this is a "Pull Request" |
| b69ab31 | | | 65 | * For Phabricator, this is a "Diff" |
| b69ab31 | | | 66 | */ |
| b69ab31 | | | 67 | |
| b69ab31 | | | 68 | /** |
| b69ab31 | | | 69 | * Short info about a Diff fetched in bulk for all diffs to render an overview |
| b69ab31 | | | 70 | */ |
| e272900 | | | 71 | export type DiffSummary = GitHubDiffSummary | GroveDiffSummary | InternalTypes['PhabricatorDiffSummary']; |
| b69ab31 | | | 72 | |
| b69ab31 | | | 73 | export type DiffCommentReaction = { |
| b69ab31 | | | 74 | name: string; |
| b69ab31 | | | 75 | reaction: |
| b69ab31 | | | 76 | | 'ANGER' |
| b69ab31 | | | 77 | | 'HAHA' |
| b69ab31 | | | 78 | | 'LIKE' |
| b69ab31 | | | 79 | | 'LOVE' |
| b69ab31 | | | 80 | | 'WOW' |
| b69ab31 | | | 81 | | 'SORRY' |
| b69ab31 | | | 82 | | 'SAD' |
| b69ab31 | | | 83 | | 'CONFUSED' |
| b69ab31 | | | 84 | | 'EYES' |
| b69ab31 | | | 85 | | 'HEART' |
| b69ab31 | | | 86 | | 'HOORAY' |
| b69ab31 | | | 87 | | 'LAUGH' |
| b69ab31 | | | 88 | | 'ROCKET' |
| b69ab31 | | | 89 | | 'THUMBS_DOWN' |
| b69ab31 | | | 90 | | 'THUMBS_UP'; |
| b69ab31 | | | 91 | }; |
| b69ab31 | | | 92 | |
| b69ab31 | | | 93 | export type InternalCommitMessageFields = InternalTypes['InternalCommitMessageFields']; |
| b69ab31 | | | 94 | |
| b69ab31 | | | 95 | export enum CodePatchSuggestionStatus { |
| b69ab31 | | | 96 | Accepted = 'ACCEPTED', |
| b69ab31 | | | 97 | Declined = 'DECLINED', |
| b69ab31 | | | 98 | Unset = 'UNSET', |
| b69ab31 | | | 99 | } |
| b69ab31 | | | 100 | |
| b69ab31 | | | 101 | export enum SuggestedChangeType { |
| b69ab31 | | | 102 | HUMAN_SUGGESTION = 'HUMAN_SUGGESTION', |
| b69ab31 | | | 103 | METAMATE_SUGGESTION = 'METAMATE_SUGGESTION', |
| b69ab31 | | | 104 | CI_SIGNAL = 'CI_SIGNAL', |
| b69ab31 | | | 105 | } |
| b69ab31 | | | 106 | |
| b69ab31 | | | 107 | export enum ArchivedStateType { |
| b69ab31 | | | 108 | ARCHIVED = 'ARCHIVED', |
| b69ab31 | | | 109 | NOT_ARCHIVED = 'NOT_ARCHIVED', |
| b69ab31 | | | 110 | } |
| b69ab31 | | | 111 | |
| b69ab31 | | | 112 | export enum ArchivedReasonType { |
| b69ab31 | | | 113 | APPLIED_IN_EDITOR = 'APPLIED_IN_EDITOR', |
| b69ab31 | | | 114 | APPLIED_MERGED = 'APPLIED_MERGED', |
| b69ab31 | | | 115 | APPLIED_STACKED_DIFF = 'APPLIED_STACKED_DIFF', |
| b69ab31 | | | 116 | AUTHOR_DISCARDED = 'AUTHOR_DISCARDED', |
| b69ab31 | | | 117 | STALE_DIFF_CLOSED = 'STALE_DIFF_CLOSED', |
| b69ab31 | | | 118 | STALE_FILE_CHANGED = 'STALE_FILE_CHANGED', |
| b69ab31 | | | 119 | } |
| b69ab31 | | | 120 | |
| b69ab31 | | | 121 | export enum WarningCheckResult { |
| b69ab31 | | | 122 | PASS = 'PASS', |
| b69ab31 | | | 123 | FAIL = 'FAIL', |
| b69ab31 | | | 124 | BYPASS = 'BYPASS', |
| b69ab31 | | | 125 | } |
| b69ab31 | | | 126 | |
| b69ab31 | | | 127 | export type CodeChange = { |
| b69ab31 | | | 128 | oldContent?: string; |
| b69ab31 | | | 129 | newContent?: string; |
| b69ab31 | | | 130 | oldLineNumber?: number; |
| b69ab31 | | | 131 | trimmedLineNumber?: number; |
| b69ab31 | | | 132 | trimmedLength?: number; |
| b69ab31 | | | 133 | adjustedLineNumber?: number; |
| b69ab31 | | | 134 | patch?: ParsedDiff; |
| b69ab31 | | | 135 | }; |
| b69ab31 | | | 136 | |
| b69ab31 | | | 137 | export type SuggestedChange = { |
| b69ab31 | | | 138 | id?: string; |
| b69ab31 | | | 139 | type?: SuggestedChangeType; |
| b69ab31 | | | 140 | codePatchSuggestionID?: string; |
| b69ab31 | | | 141 | codePatchID?: string; |
| b69ab31 | | | 142 | status?: CodePatchSuggestionStatus; |
| b69ab31 | | | 143 | archivedState?: ArchivedStateType; |
| b69ab31 | | | 144 | archivedReason?: ArchivedReasonType; |
| b69ab31 | | | 145 | commitHashBefore?: string; |
| b69ab31 | | | 146 | patch?: ParsedDiff; |
| b69ab31 | | | 147 | oldPath?: string; |
| b69ab31 | | | 148 | currentPath?: string; |
| b69ab31 | | | 149 | codeChange?: CodeChange[]; |
| b69ab31 | | | 150 | }; |
| b69ab31 | | | 151 | |
| b69ab31 | | | 152 | export type DiffComment = { |
| b69ab31 | | | 153 | id?: string; |
| b69ab31 | | | 154 | author: string; |
| b69ab31 | | | 155 | authorName?: string; |
| b69ab31 | | | 156 | authorAvatarUri?: string; |
| b69ab31 | | | 157 | html: string; |
| b69ab31 | | | 158 | content?: string; |
| b69ab31 | | | 159 | created: Date; |
| b69ab31 | | | 160 | commitHash?: string; |
| b69ab31 | | | 161 | /** If it's an inline comment, this is the file path with the comment */ |
| b69ab31 | | | 162 | filename?: string; |
| b69ab31 | | | 163 | /** If it's an inline comment, this is the line it was added */ |
| b69ab31 | | | 164 | line?: number; |
| b69ab31 | | | 165 | reactions: Array<DiffCommentReaction>; |
| b69ab31 | | | 166 | /** Suggestion for how to change the code, as a patch */ |
| b69ab31 | | | 167 | suggestedChange?: SuggestedChange; |
| b69ab31 | | | 168 | replies: Array<DiffComment>; |
| b69ab31 | | | 169 | /** If this comment has been resolved. true => "resolved", false => "unresolved", null => the comment is not resolvable, don't show any UI for it */ |
| b69ab31 | | | 170 | isResolved?: boolean; |
| b69ab31 | | | 171 | }; |
| b69ab31 | | | 172 | |
| b69ab31 | | | 173 | /** |
| b69ab31 | | | 174 | * Summary of CI test results for a Diff. |
| b69ab31 | | | 175 | * 'pass' if ALL signals succeed and not still running. |
| b69ab31 | | | 176 | * 'failed' if ANY signal doesn't succeed, even if some are still running. |
| b69ab31 | | | 177 | * 'deferred' if tests are deferred and waiting to be started. |
| b69ab31 | | | 178 | */ |
| b69ab31 | | | 179 | export type DiffSignalSummary = |
| b69ab31 | | | 180 | | 'running' |
| b69ab31 | | | 181 | | 'pass' |
| b69ab31 | | | 182 | | 'failed' |
| b69ab31 | | | 183 | | 'warning' |
| b69ab31 | | | 184 | | 'no-signal' |
| b69ab31 | | | 185 | | 'land-cancelled' |
| b69ab31 | | | 186 | | 'deferred'; |
| b69ab31 | | | 187 | |
| b69ab31 | | | 188 | /** |
| b69ab31 | | | 189 | * Information about a land request, specific to each Code Review Provider. |
| b69ab31 | | | 190 | */ |
| b69ab31 | | | 191 | export type LandInfo = undefined | InternalTypes['PhabricatorLandInfo']; |
| b69ab31 | | | 192 | |
| b69ab31 | | | 193 | /** |
| b69ab31 | | | 194 | * Information used to confirm a land from a given initiation LandInfo. |
| b69ab31 | | | 195 | */ |
| b69ab31 | | | 196 | export type LandConfirmationInfo = undefined | InternalTypes['PhabricatorLandConfirmationInfo']; |
| b69ab31 | | | 197 | |
| b69ab31 | | | 198 | /** An error causing the entire Repository to not be accessible */ |
| b69ab31 | | | 199 | export type RepositoryError = |
| b69ab31 | | | 200 | | { |
| b69ab31 | | | 201 | type: 'invalidCommand'; |
| b69ab31 | | | 202 | command: string; |
| b69ab31 | | | 203 | path: string | undefined; |
| b69ab31 | | | 204 | } |
| b69ab31 | | | 205 | | {type: 'edenFsUnhealthy'; cwd: string} |
| b69ab31 | | | 206 | | {type: 'cwdNotARepository'; cwd: string} |
| b69ab31 | | | 207 | | {type: 'cwdDoesNotExist'; cwd: string} |
| b69ab31 | | | 208 | | { |
| b69ab31 | | | 209 | type: 'unknownError'; |
| b69ab31 | | | 210 | error: Error; |
| b69ab31 | | | 211 | }; |
| b69ab31 | | | 212 | |
| b69ab31 | | | 213 | export type CwdInfo = { |
| b69ab31 | | | 214 | /** Full cwd path, like /Users/username/repoRoot/some/subfolder */ |
| b69ab31 | | | 215 | cwd: AbsolutePath; |
| b69ab31 | | | 216 | /** Full real path to the repository root, like /Users/username/repoRoot |
| b69ab31 | | | 217 | * Undefined for cwds that are not valid repositories */ |
| b69ab31 | | | 218 | repoRoot?: AbsolutePath; |
| b69ab31 | | | 219 | /** Label for a cwd, which is <repoBasename>/<cwd>, like 'sapling/addons'. |
| b69ab31 | | | 220 | * Intended for display. Undefined for cwds that are not valid repositories */ |
| b69ab31 | | | 221 | repoRelativeCwdLabel?: string; |
| b69ab31 | | | 222 | }; |
| b69ab31 | | | 223 | |
| b69ab31 | | | 224 | export type RepoInfo = RepositoryError | ValidatedRepoInfo; |
| b69ab31 | | | 225 | |
| b69ab31 | | | 226 | /** Proven valid repositories with valid repoRoot / dotdir */ |
| b69ab31 | | | 227 | export type ValidatedRepoInfo = { |
| b69ab31 | | | 228 | type: 'success'; |
| b69ab31 | | | 229 | /** Which cli command name this repository should use for sapling, e.g. `sl` */ |
| b69ab31 | | | 230 | command: string; |
| b69ab31 | | | 231 | /** |
| b69ab31 | | | 232 | * Direct repo root that is the closest to the cwd. |
| b69ab31 | | | 233 | */ |
| b69ab31 | | | 234 | repoRoot: AbsolutePath; |
| b69ab31 | | | 235 | /** |
| b69ab31 | | | 236 | * All the nested repo roots up to the system root, |
| b69ab31 | | | 237 | * in the order of furthest to closest to the cwd. |
| b69ab31 | | | 238 | * |
| b69ab31 | | | 239 | * For instance, ['/repo', '/repo/submodule', '/repo/submodule/nested_submodule'] |
| b69ab31 | | | 240 | * |
| b69ab31 | | | 241 | * The repoRoot above is not simply replaced with this because of different error conditions - |
| b69ab31 | | | 242 | * Sapling may refuse to return the list when it's nested illegally, while repoRoot can still be valid. |
| b69ab31 | | | 243 | */ |
| b69ab31 | | | 244 | repoRoots?: AbsolutePath[]; |
| b69ab31 | | | 245 | /** |
| b69ab31 | | | 246 | * Directory containing sl internal information for this repo, usually `${repoRoot}/.sl`. |
| b69ab31 | | | 247 | */ |
| b69ab31 | | | 248 | dotdir: AbsolutePath; |
| b69ab31 | | | 249 | codeReviewSystem: CodeReviewSystem; |
| b69ab31 | | | 250 | pullRequestDomain: string | undefined; |
| b69ab31 | | | 251 | preferredSubmitCommand?: PreferredSubmitCommand; |
| b69ab31 | | | 252 | isEdenFs: boolean; |
| b69ab31 | | | 253 | }; |
| b69ab31 | | | 254 | |
| b69ab31 | | | 255 | export type ApplicationInfo = { |
| b69ab31 | | | 256 | platformName: string; |
| b69ab31 | | | 257 | version: string; |
| b69ab31 | | | 258 | logFilePath: string; |
| 4bb999b | | | 259 | readOnly?: boolean; |
| b69ab31 | | | 260 | }; |
| b69ab31 | | | 261 | |
| b69ab31 | | | 262 | /** |
| b69ab31 | | | 263 | * Which "mode" for the App to run. Controls the basic rendering. |
| b69ab31 | | | 264 | * Useful to render full-screen alternate views. |
| b69ab31 | | | 265 | * isl => normal, full ISL |
| b69ab31 | | | 266 | * comparison => just the comparison viewer is rendered, set to some specific comparison |
| b69ab31 | | | 267 | */ |
| b69ab31 | | | 268 | export type AppMode = |
| b69ab31 | | | 269 | | { |
| b69ab31 | | | 270 | mode: 'isl'; |
| b69ab31 | | | 271 | } |
| b69ab31 | | | 272 | | { |
| b69ab31 | | | 273 | mode: 'comparison'; |
| b69ab31 | | | 274 | comparison: Comparison; |
| b69ab31 | | | 275 | }; |
| b69ab31 | | | 276 | |
| b69ab31 | | | 277 | export type CodeReviewSystem = |
| b69ab31 | | | 278 | | { |
| b69ab31 | | | 279 | type: 'github'; |
| b69ab31 | | | 280 | owner: string; |
| b69ab31 | | | 281 | repo: string; |
| b69ab31 | | | 282 | /** github enterprise may use a different hostname than 'github.com' */ |
| b69ab31 | | | 283 | hostname: string; |
| b69ab31 | | | 284 | } |
| b69ab31 | | | 285 | | { |
| b69ab31 | | | 286 | type: 'phabricator'; |
| b69ab31 | | | 287 | repo: string; |
| b69ab31 | | | 288 | callsign?: string; |
| b69ab31 | | | 289 | } |
| e272900 | | | 290 | | { |
| e272900 | | | 291 | type: 'grove'; |
| e272900 | | | 292 | /** Grove API base URL, e.g. https://grove.host/api */ |
| e272900 | | | 293 | apiUrl: string; |
| e272900 | | | 294 | /** Repository owner (username or org) */ |
| e272900 | | | 295 | owner: string; |
| e272900 | | | 296 | /** Repository name */ |
| e272900 | | | 297 | repo: string; |
| 23ab721 | | | 298 | /** Whether pushes should automatically create diffs for code review */ |
| 23ab721 | | | 299 | requireDiffs?: boolean; |
| e272900 | | | 300 | } |
| b69ab31 | | | 301 | | { |
| b69ab31 | | | 302 | type: 'none'; |
| b69ab31 | | | 303 | } |
| b69ab31 | | | 304 | | { |
| b69ab31 | | | 305 | type: 'unknown'; |
| b69ab31 | | | 306 | path?: string; |
| b69ab31 | | | 307 | }; |
| b69ab31 | | | 308 | |
| b69ab31 | | | 309 | export type PreferredSubmitCommand = 'pr' | 'ghstack' | 'push'; |
| b69ab31 | | | 310 | |
| b69ab31 | | | 311 | export type StableCommitMetadata = { |
| b69ab31 | | | 312 | value: string; |
| b69ab31 | | | 313 | description: string; |
| b69ab31 | | | 314 | isRecommended?: boolean; |
| b69ab31 | | | 315 | }; |
| b69ab31 | | | 316 | |
| b69ab31 | | | 317 | export type StableCommitFetchConfig = { |
| b69ab31 | | | 318 | template: string; |
| b69ab31 | | | 319 | parse: (data: string) => Array<StableCommitMetadata>; |
| b69ab31 | | | 320 | }; |
| b69ab31 | | | 321 | |
| b69ab31 | | | 322 | export type StableLocationData = { |
| b69ab31 | | | 323 | /** Stables found automatically from recent builds */ |
| b69ab31 | | | 324 | stables: Array<Result<StableInfo>>; |
| b69ab31 | | | 325 | /** Stables that enabled automatically for certain users */ |
| b69ab31 | | | 326 | special: Array<Result<StableInfo>>; |
| b69ab31 | | | 327 | /** Stables entered in the UI. Map of provided name to a Result. null means the stable is loading. */ |
| b69ab31 | | | 328 | manual: Record<string, Result<StableInfo> | null>; |
| b69ab31 | | | 329 | /** Whether this repo supports entering custom stables via input. */ |
| b69ab31 | | | 330 | repoSupportsCustomStables: boolean; |
| b69ab31 | | | 331 | }; |
| b69ab31 | | | 332 | export type StableInfo = { |
| b69ab31 | | | 333 | hash: string; |
| b69ab31 | | | 334 | name: string; |
| b69ab31 | | | 335 | /** If present, this is informational text, like the reason it's been added */ |
| b69ab31 | | | 336 | byline?: string; |
| b69ab31 | | | 337 | /** If present, this is extra details that might be shown in a tooltip */ |
| b69ab31 | | | 338 | info?: string; |
| b69ab31 | | | 339 | date: Date; |
| b69ab31 | | | 340 | }; |
| b69ab31 | | | 341 | |
| b69ab31 | | | 342 | export type SlocInfo = { |
| b69ab31 | | | 343 | /** Significant lines of code for commit */ |
| b69ab31 | | | 344 | sloc: number | undefined; |
| b69ab31 | | | 345 | }; |
| b69ab31 | | | 346 | |
| b69ab31 | | | 347 | export type CommitInfo = { |
| b69ab31 | | | 348 | title: string; |
| b69ab31 | | | 349 | hash: Hash; |
| b69ab31 | | | 350 | /** |
| b69ab31 | | | 351 | * This matches the "parents" information from source control without the |
| b69ab31 | | | 352 | * "null" hash. Most of the time a commit has 1 parent. For merges there |
| b69ab31 | | | 353 | * could be 2 or more parents. The initial commit (and initial commits of |
| b69ab31 | | | 354 | * other merged-in repos) have no parents. |
| b69ab31 | | | 355 | */ |
| b69ab31 | | | 356 | parents: ReadonlyArray<Hash>; |
| b69ab31 | | | 357 | /** |
| b69ab31 | | | 358 | * Grandparents are the closest but indirect ancestors in a set of commits . |
| b69ab31 | | | 359 | * In ISL, this is used for connecting nodes whose direct parents are NOT present. |
| b69ab31 | | | 360 | * Note that this field will be empty by design when direct parents are already present in the set. |
| b69ab31 | | | 361 | * See eden/scm/tests/test-template-grandparents.t for examples. |
| b69ab31 | | | 362 | */ |
| b69ab31 | | | 363 | grandparents: ReadonlyArray<Hash>; |
| b69ab31 | | | 364 | phase: CommitPhaseType; |
| b69ab31 | | | 365 | /** |
| b69ab31 | | | 366 | * Whether this commit is the "." (working directory parent). |
| b69ab31 | | | 367 | * It is the parent of "wdir()" or the "You are here" virtual commit. |
| b69ab31 | | | 368 | */ |
| b69ab31 | | | 369 | isDot: boolean; |
| b69ab31 | | | 370 | author: string; |
| b69ab31 | | | 371 | date: Date; |
| b69ab31 | | | 372 | description: string; |
| b69ab31 | | | 373 | bookmarks: ReadonlyArray<string>; |
| b69ab31 | | | 374 | remoteBookmarks: ReadonlyArray<string>; |
| b69ab31 | | | 375 | /** if this commit is obsolete, it is succeeded by another commit */ |
| b69ab31 | | | 376 | successorInfo?: Readonly<SuccessorInfo>; |
| b69ab31 | | | 377 | /** |
| b69ab31 | | | 378 | * Closest predecessors (not all recursive predecessors, which can be a long |
| b69ab31 | | | 379 | * chain and hurt performance). Useful to deal with optimistic states where |
| b69ab31 | | | 380 | * we know the hashes of predecessors (commits being rewritten) but not their |
| b69ab31 | | | 381 | * successors (rewritten result). |
| b69ab31 | | | 382 | * |
| b69ab31 | | | 383 | * Most of the time a commit only has one predecessor. In case of a fold |
| b69ab31 | | | 384 | * there are multiple predecessors. |
| b69ab31 | | | 385 | */ |
| b69ab31 | | | 386 | closestPredecessors?: ReadonlyArray<Hash>; |
| b69ab31 | | | 387 | /** |
| b69ab31 | | | 388 | * If this is a fake optimistic commit created by a running Operation, |
| b69ab31 | | | 389 | * this is the revset that can be used by sl to find the real commit. |
| b69ab31 | | | 390 | * This is only valid after the operation which creates this commit has completed. |
| b69ab31 | | | 391 | */ |
| b69ab31 | | | 392 | optimisticRevset?: Revset; |
| b69ab31 | | | 393 | /** only a subset of the total changed file paths for this commit. |
| b69ab31 | | | 394 | * File statuses must be fetched separately for performance. |
| b69ab31 | | | 395 | */ |
| b69ab31 | | | 396 | filePathsSample: ReadonlyArray<RepoRelativePath>; |
| b69ab31 | | | 397 | totalFileCount: number; |
| b69ab31 | | | 398 | /** @see {@link DiffId} */ |
| b69ab31 | | | 399 | diffId?: DiffId; |
| b69ab31 | | | 400 | isFollower?: boolean; |
| b69ab31 | | | 401 | stableCommitMetadata?: ReadonlyArray<StableCommitMetadata>; |
| b69ab31 | | | 402 | /** |
| b69ab31 | | | 403 | * Longest path prefix shared by all files in this commit. |
| b69ab31 | | | 404 | * For example, if a commit changes files like `a/b/c` and `a/b/d`, this is `a/b/`. |
| b69ab31 | | | 405 | * Note: this always acts on `/` delimited paths, and is done on complete subdir names, |
| b69ab31 | | | 406 | * never on matching prefixes of directories. For example, `a/dir1/a` and `a/dir2/a` |
| b69ab31 | | | 407 | * have `a/` as the common prefix, not `a/dir`. |
| b69ab31 | | | 408 | * If no commonality is found (due to edits to top level files or multiple subdirs), this is empty string. |
| b69ab31 | | | 409 | * This can be useful to determine if a commit is relevant to your cwd. |
| b69ab31 | | | 410 | */ |
| b69ab31 | | | 411 | maxCommonPathPrefix: RepoRelativePath; |
| b69ab31 | | | 412 | |
| b69ab31 | | | 413 | fullRepoBranch?: InternalTypes['FullRepoBranch']; |
| b69ab31 | | | 414 | }; |
| b69ab31 | | | 415 | export type SuccessorInfo = { |
| b69ab31 | | | 416 | hash: string; |
| b69ab31 | | | 417 | type: string; |
| b69ab31 | | | 418 | }; |
| b69ab31 | | | 419 | export type CommitPhaseType = 'public' | 'draft'; |
| b69ab31 | | | 420 | export type ChangedFileStatus = 'A' | 'M' | 'R' | '?' | '!' | 'U' | 'Resolved'; |
| b69ab31 | | | 421 | export type ChangedFile = { |
| b69ab31 | | | 422 | path: RepoRelativePath; |
| b69ab31 | | | 423 | status: ChangedFileStatus; |
| b69ab31 | | | 424 | /** |
| b69ab31 | | | 425 | * If this file is copied from another, this is the path of the original file |
| b69ab31 | | | 426 | * If this file is renamed from another, this is the path of the original file, and another change of type 'R' will exist. |
| b69ab31 | | | 427 | * */ |
| b69ab31 | | | 428 | copy?: RepoRelativePath; |
| b69ab31 | | | 429 | }; |
| b69ab31 | | | 430 | export enum ChangedFileMode { |
| b69ab31 | | | 431 | // "Regular" is from the perspective of the ISL - it's a file that's not a submodule. |
| b69ab31 | | | 432 | // This can be different from more granular categorizations in the underlying |
| b69ab31 | | | 433 | // source control system, such as symlinks, executables, and gitlinks. |
| b69ab31 | | | 434 | Regular = 'regular', |
| b69ab31 | | | 435 | Submodule = 'submodule', |
| b69ab31 | | | 436 | } |
| b69ab31 | | | 437 | |
| b69ab31 | | | 438 | export type FilesSample = { |
| b69ab31 | | | 439 | filesSample: Array<ChangedFile>; |
| b69ab31 | | | 440 | totalFileCount: number; |
| b69ab31 | | | 441 | }; |
| b69ab31 | | | 442 | |
| b69ab31 | | | 443 | /** A revset that selects for a commit which we only have a fake optimistic preview of */ |
| b69ab31 | | | 444 | export type OptimisticRevset = {type: 'optimistic-revset'; revset: Revset; fake: string}; |
| b69ab31 | | | 445 | /** A revset that selects for the latest version of a commit hash */ |
| b69ab31 | | | 446 | export type SucceedableRevset = {type: 'succeedable-revset'; revset: Revset}; |
| b69ab31 | | | 447 | /** A revset that selects for a specific commit, without considering any successors */ |
| b69ab31 | | | 448 | export type ExactRevset = {type: 'exact-revset'; revset: Revset}; |
| b69ab31 | | | 449 | |
| b69ab31 | | | 450 | /** |
| b69ab31 | | | 451 | * Most arguments to eden commands are literal `string`s, except: |
| b69ab31 | | | 452 | * - When specifying file paths, the server needs to know which args are files to convert them to be cwd-relative. |
| b69ab31 | | | 453 | * - For long file lists, we pass them in a single bulk arg, which will be passed via stdin instead |
| b69ab31 | | | 454 | * to avoid command line length limits. |
| b69ab31 | | | 455 | * - When specifying commit hashes, you may be acting on optimistic version of those hashes. |
| b69ab31 | | | 456 | * The server can re-write hashes using a revset that transforms into the latest successor instead. |
| b69ab31 | | | 457 | * This allows you to act on the optimistic versions of commits in queued commands, |
| b69ab31 | | | 458 | * without a race with the server telling you new versions of those hashes. |
| b69ab31 | | | 459 | * - If you want an exact commit that's already obsolete or should never be replaced with a succeeded version, |
| b69ab31 | | | 460 | * you can use an exact revset. |
| b69ab31 | | | 461 | * - Specifying config values to override for just this command, so they can be processed separately. |
| b69ab31 | | | 462 | */ |
| b69ab31 | | | 463 | export type CommandArg = |
| b69ab31 | | | 464 | | string |
| b69ab31 | | | 465 | | {type: 'repo-relative-file'; path: RepoRelativePath} |
| b69ab31 | | | 466 | | {type: 'repo-relative-file-list'; paths: Array<RepoRelativePath>} |
| b69ab31 | | | 467 | | {type: 'config'; key: string; value: string} |
| b69ab31 | | | 468 | | ExactRevset |
| b69ab31 | | | 469 | | SucceedableRevset |
| b69ab31 | | | 470 | | OptimisticRevset; |
| b69ab31 | | | 471 | |
| b69ab31 | | | 472 | /** |
| b69ab31 | | | 473 | * What process to execute a given operation in, such as `sl` |
| b69ab31 | | | 474 | */ |
| b69ab31 | | | 475 | export enum CommandRunner { |
| b69ab31 | | | 476 | Sapling = 'sl', |
| b69ab31 | | | 477 | /** |
| b69ab31 | | | 478 | * Use the configured Code Review provider to run this command, |
| b69ab31 | | | 479 | * such as a non-sapling external submit command |
| b69ab31 | | | 480 | */ |
| b69ab31 | | | 481 | CodeReviewProvider = 'codeReviewProvider', |
| b69ab31 | | | 482 | /** Internal arcanist commands */ |
| b69ab31 | | | 483 | InternalArcanist = 'arc', |
| b69ab31 | | | 484 | /** Configerator conf commands */ |
| b69ab31 | | | 485 | Conf = 'conf', |
| b69ab31 | | | 486 | } |
| b69ab31 | | | 487 | |
| b69ab31 | | | 488 | /** |
| b69ab31 | | | 489 | * {@link CommandArg} representing a hash or revset which should be re-written |
| b69ab31 | | | 490 | * to the latest successor of that revset when being run. |
| b69ab31 | | | 491 | * This enables queued commands to act on optimistic state without knowing |
| b69ab31 | | | 492 | * the optimistic commit's hashes directly. |
| b69ab31 | | | 493 | */ |
| b69ab31 | | | 494 | export function succeedableRevset(revset: Revset): SucceedableRevset { |
| b69ab31 | | | 495 | return {type: 'succeedable-revset', revset}; |
| b69ab31 | | | 496 | } |
| b69ab31 | | | 497 | |
| b69ab31 | | | 498 | /** |
| b69ab31 | | | 499 | * {@link CommandArg} representing a hash or revset for a fake optimistic commit. |
| b69ab31 | | | 500 | * This enables queued commands to act on optimistic state without knowing |
| b69ab31 | | | 501 | * the optimistic commit's hashes directly, and without knowing a predecessor hash at all. |
| b69ab31 | | | 502 | * The fake optimistic commit hash is also stored to know what the revset refers to. |
| b69ab31 | | | 503 | */ |
| b69ab31 | | | 504 | export function optimisticRevset(revset: Revset, fake: string): OptimisticRevset { |
| b69ab31 | | | 505 | return {type: 'optimistic-revset', revset, fake}; |
| b69ab31 | | | 506 | } |
| b69ab31 | | | 507 | |
| b69ab31 | | | 508 | /** |
| b69ab31 | | | 509 | * {@link CommandArg} representing a hash or revset which should *not* be re-written |
| b69ab31 | | | 510 | * to the latest successor of that revset when being run. |
| b69ab31 | | | 511 | * This uses the revset directly in the command run. Useful if you want to specifically |
| b69ab31 | | | 512 | * use an obsolete commit in an operation. |
| b69ab31 | | | 513 | */ |
| b69ab31 | | | 514 | export function exactRevset(revset: Revset): ExactRevset { |
| b69ab31 | | | 515 | return {type: 'exact-revset', revset}; |
| b69ab31 | | | 516 | } |
| b69ab31 | | | 517 | |
| b69ab31 | | | 518 | /* Subscriptions */ |
| b69ab31 | | | 519 | |
| b69ab31 | | | 520 | /** |
| b69ab31 | | | 521 | * A subscription allows the client to ask for a stream of events from the server. |
| b69ab31 | | | 522 | * The client may send subscribe and corresponding unsubscribe messages. |
| b69ab31 | | | 523 | * Subscriptions are indexed by a subscriptionId field. |
| b69ab31 | | | 524 | * Responses to subscriptions are of type Fetched<T> |
| b69ab31 | | | 525 | */ |
| b69ab31 | | | 526 | export type Subscribe<K extends string> = |
| b69ab31 | | | 527 | | {type: `subscribe${K}`; subscriptionID: string} |
| b69ab31 | | | 528 | | {type: `unsubscribe${K}`; subscriptionID: string}; |
| b69ab31 | | | 529 | |
| b69ab31 | | | 530 | /** Responses to subscriptions, including data and the time duration the fetch lasted */ |
| b69ab31 | | | 531 | export type Fetched<K extends string, V> = { |
| b69ab31 | | | 532 | type: `fetched${K}`; |
| b69ab31 | | | 533 | subscriptionID: string; |
| b69ab31 | | | 534 | } & V; |
| b69ab31 | | | 535 | |
| b69ab31 | | | 536 | export type UncommittedChanges = Array<ChangedFile>; |
| b69ab31 | | | 537 | export type FetchedUncommittedChanges = { |
| b69ab31 | | | 538 | files: Result<UncommittedChanges>; |
| b69ab31 | | | 539 | fetchStartTimestamp: number; |
| b69ab31 | | | 540 | fetchCompletedTimestamp: number; |
| b69ab31 | | | 541 | }; |
| b69ab31 | | | 542 | |
| b69ab31 | | | 543 | export type BeganFetchingUncommittedChangesEvent = { |
| b69ab31 | | | 544 | type: 'beganFetchingUncommittedChangesEvent'; |
| b69ab31 | | | 545 | }; |
| b69ab31 | | | 546 | |
| b69ab31 | | | 547 | export type SmartlogCommits = Array<CommitInfo>; |
| b69ab31 | | | 548 | export type FetchedCommits = { |
| b69ab31 | | | 549 | commits: Result<SmartlogCommits>; |
| b69ab31 | | | 550 | fetchStartTimestamp: number; |
| b69ab31 | | | 551 | fetchCompletedTimestamp: number; |
| b69ab31 | | | 552 | }; |
| b69ab31 | | | 553 | |
| b69ab31 | | | 554 | export type BeganFetchingSmartlogCommitsEvent = { |
| b69ab31 | | | 555 | type: 'beganFetchingSmartlogCommitsEvent'; |
| b69ab31 | | | 556 | }; |
| b69ab31 | | | 557 | |
| b69ab31 | | | 558 | export type ShelvedChange = { |
| b69ab31 | | | 559 | hash: Hash; |
| b69ab31 | | | 560 | name: string; |
| b69ab31 | | | 561 | date: Date; |
| b69ab31 | | | 562 | filesSample: Array<ChangedFile>; |
| b69ab31 | | | 563 | totalFileCount: number; |
| b69ab31 | | | 564 | description: string; |
| b69ab31 | | | 565 | }; |
| b69ab31 | | | 566 | |
| b69ab31 | | | 567 | export enum CommitCloudBackupStatus { |
| b69ab31 | | | 568 | InProgress = 'IN_PROGRESS', |
| b69ab31 | | | 569 | Pending = 'PENDING', |
| b69ab31 | | | 570 | Failed = 'FAILED', |
| b69ab31 | | | 571 | } |
| b69ab31 | | | 572 | export type CommitCloudSyncState = { |
| b69ab31 | | | 573 | isFetching?: boolean; |
| b69ab31 | | | 574 | /** Last time we ran commands to check the cloud status */ |
| b69ab31 | | | 575 | lastChecked: Date; |
| b69ab31 | | | 576 | /** Last time there was an actual sync */ |
| b69ab31 | | | 577 | lastBackup?: Date; |
| b69ab31 | | | 578 | currentWorkspace?: string; |
| b69ab31 | | | 579 | workspaceChoices?: Array<string>; |
| b69ab31 | | | 580 | commitStatuses?: Map<Hash, CommitCloudBackupStatus>; |
| b69ab31 | | | 581 | fetchError?: Error; |
| b69ab31 | | | 582 | syncError?: Error; |
| b69ab31 | | | 583 | workspaceError?: Error; |
| b69ab31 | | | 584 | // if true, commit cloud is disabled in this repo |
| b69ab31 | | | 585 | isDisabled?: boolean; |
| b69ab31 | | | 586 | }; |
| b69ab31 | | | 587 | |
| b69ab31 | | | 588 | export type Submodule = { |
| b69ab31 | | | 589 | name: string; |
| b69ab31 | | | 590 | path: RepoRelativePath; |
| b69ab31 | | | 591 | url: string; |
| b69ab31 | | | 592 | ref?: string; |
| b69ab31 | | | 593 | active: boolean; |
| b69ab31 | | | 594 | }; |
| b69ab31 | | | 595 | /** |
| b69ab31 | | | 596 | * An undefined value if git submodules are not supported by the repo. |
| b69ab31 | | | 597 | * An error if unexpected errors occurred during the fetch process. |
| b69ab31 | | | 598 | */ |
| b69ab31 | | | 599 | export type FetchedSubmodules = Result<Submodule[] | undefined>; |
| b69ab31 | | | 600 | export type SubmodulesByRoot = Map<AbsolutePath, FetchedSubmodules>; |
| b69ab31 | | | 601 | |
| b69ab31 | | | 602 | export type AlertSeverity = 'SEV 0' | 'SEV 1' | 'SEV 2' | 'SEV 3' | 'SEV 4' | 'UBN'; |
| b69ab31 | | | 603 | export type Alert = { |
| b69ab31 | | | 604 | key: string; |
| b69ab31 | | | 605 | title: string; |
| b69ab31 | | | 606 | description: string; |
| b69ab31 | | | 607 | url: string; |
| b69ab31 | | | 608 | severity: AlertSeverity; |
| b69ab31 | | | 609 | ['show-in-isl']: boolean; |
| b69ab31 | | | 610 | ['isl-version-regex']?: string; |
| b69ab31 | | | 611 | }; |
| b69ab31 | | | 612 | |
| b69ab31 | | | 613 | /** |
| b69ab31 | | | 614 | * A file can be auto-generated, partially auto-generated, or not generated (manual). |
| b69ab31 | | | 615 | * Numbered according to expected visual sort order. |
| b69ab31 | | | 616 | */ |
| b69ab31 | | | 617 | export enum GeneratedStatus { |
| b69ab31 | | | 618 | Manual = 0, |
| b69ab31 | | | 619 | PartiallyGenerated = 1, |
| b69ab31 | | | 620 | Generated = 2, |
| b69ab31 | | | 621 | } |
| b69ab31 | | | 622 | |
| b69ab31 | | | 623 | export enum ConflictType { |
| b69ab31 | | | 624 | BothChanged = 'both_changed', |
| b69ab31 | | | 625 | DeletedInDest = 'dest_deleted', |
| b69ab31 | | | 626 | DeletedInSource = 'source_deleted', |
| b69ab31 | | | 627 | } |
| b69ab31 | | | 628 | |
| b69ab31 | | | 629 | type ConflictInfo = { |
| b69ab31 | | | 630 | command: string; |
| b69ab31 | | | 631 | toContinue: string; |
| b69ab31 | | | 632 | toAbort: string; |
| b69ab31 | | | 633 | files: Array<ChangedFile & {conflictType: ConflictType}>; |
| b69ab31 | | | 634 | fetchStartTimestamp: number; |
| b69ab31 | | | 635 | fetchCompletedTimestamp: number; |
| b69ab31 | | | 636 | hashes?: {local?: string; other?: string}; |
| b69ab31 | | | 637 | }; |
| b69ab31 | | | 638 | export type MergeConflicts = |
| b69ab31 | | | 639 | | ({state: 'loading'} & AllUndefined<ConflictInfo>) |
| b69ab31 | | | 640 | | ({ |
| b69ab31 | | | 641 | state: 'loaded'; |
| b69ab31 | | | 642 | } & ConflictInfo); |
| b69ab31 | | | 643 | |
| b69ab31 | | | 644 | /* Operations */ |
| b69ab31 | | | 645 | |
| b69ab31 | | | 646 | export type RunnableOperation = { |
| b69ab31 | | | 647 | args: Array<CommandArg>; |
| b69ab31 | | | 648 | id: string; |
| b69ab31 | | | 649 | stdin?: string | undefined; |
| b69ab31 | | | 650 | runner: CommandRunner; |
| b69ab31 | | | 651 | trackEventName: TrackEventName; |
| b69ab31 | | | 652 | }; |
| b69ab31 | | | 653 | |
| b69ab31 | | | 654 | export type OperationProgress = |
| b69ab31 | | | 655 | // another operation is running, so this one has been queued to run. Also include full state of the queue. |
| b69ab31 | | | 656 | | {id: string; kind: 'queue'; queue: Array<string>} |
| b69ab31 | | | 657 | // the server has started the process. This also servers as a "dequeue" notification. Also include full state of the queue. |
| b69ab31 | | | 658 | | {id: string; kind: 'spawn'; queue: Array<string>} |
| b69ab31 | | | 659 | | {id: string; kind: 'stderr'; message: string} |
| b69ab31 | | | 660 | | {id: string; kind: 'stdout'; message: string} |
| b69ab31 | | | 661 | // overally progress information, typically for a progress bar or progress not found directly in the stdout |
| b69ab31 | | | 662 | | {id: string; kind: 'progress'; progress: ProgressStep} |
| b69ab31 | | | 663 | // progress information for a specific commit, shown inline. Null hash means to apply the message to all hashes. Null message means to clear the message. |
| b69ab31 | | | 664 | | {id: string; kind: 'inlineProgress'; hash?: string; message?: string} |
| b69ab31 | | | 665 | | {id: string; kind: 'exit'; exitCode: number; timestamp: number} |
| b69ab31 | | | 666 | | {id: string; kind: 'error'; error: string} |
| b69ab31 | | | 667 | | {id: string; kind: 'warning'; warning: string} |
| b69ab31 | | | 668 | // used by requestMissedOperationProgress, client thinks this operation is running but server no longer knows about it. |
| b69ab31 | | | 669 | | {id: string; kind: 'forgot'}; |
| b69ab31 | | | 670 | |
| b69ab31 | | | 671 | export type ProgressStep = { |
| b69ab31 | | | 672 | message: string; |
| b69ab31 | | | 673 | progress?: number; |
| b69ab31 | | | 674 | progressTotal?: number; |
| b69ab31 | | | 675 | unit?: string; |
| b69ab31 | | | 676 | }; |
| b69ab31 | | | 677 | |
| b69ab31 | | | 678 | export type OperationCommandProgressReporter = ( |
| b69ab31 | | | 679 | ...args: |
| b69ab31 | | | 680 | | ['spawn'] |
| b69ab31 | | | 681 | | ['stdout', string] |
| b69ab31 | | | 682 | | ['stderr', string] |
| b69ab31 | | | 683 | // null message -> clear inline progress for this hash. Null hash -> apply to all affected hashes (set message or clear) |
| b69ab31 | | | 684 | | [type: 'inlineProgress', hash?: string, message?: string] |
| b69ab31 | | | 685 | | ['progress', ProgressStep] |
| b69ab31 | | | 686 | | ['warning', string] |
| b69ab31 | | | 687 | | ['exit', number] |
| b69ab31 | | | 688 | ) => void; |
| b69ab31 | | | 689 | |
| b69ab31 | | | 690 | export type OperationProgressEvent = {type: 'operationProgress'} & OperationProgress; |
| b69ab31 | | | 691 | |
| b69ab31 | | | 692 | /** A line number starting from 1 */ |
| b69ab31 | | | 693 | export type OneIndexedLineNumber = Exclude<number, 0>; |
| b69ab31 | | | 694 | |
| b69ab31 | | | 695 | export type DiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint'; |
| b69ab31 | | | 696 | |
| b69ab31 | | | 697 | export type Diagnostic = { |
| b69ab31 | | | 698 | range: {startLine: number; startCol: number; endLine: number; endCol: number}; |
| b69ab31 | | | 699 | message: string; |
| b69ab31 | | | 700 | severity: DiagnosticSeverity; |
| b69ab31 | | | 701 | /** LSP providing this diagnostic, like "typescript" or "eslint" */ |
| b69ab31 | | | 702 | source?: string; |
| b69ab31 | | | 703 | /** Code or name for this kind of diagnostic */ |
| b69ab31 | | | 704 | code?: string; |
| b69ab31 | | | 705 | }; |
| b69ab31 | | | 706 | |
| b69ab31 | | | 707 | export type DiagnosticAllowlistValue = |
| b69ab31 | | | 708 | | {block: Set<string>; allow?: undefined} |
| b69ab31 | | | 709 | | {allow: Set<string>; block?: undefined}; |
| b69ab31 | | | 710 | export type DiagnosticAllowlist = Map<'warning' | 'error', Map<string, DiagnosticAllowlistValue>>; |
| b69ab31 | | | 711 | |
| b69ab31 | | | 712 | export type CodeReviewScope = |
| b69ab31 | | | 713 | | 'uncommitted changes' |
| b69ab31 | | | 714 | | 'current commit' |
| b69ab31 | | | 715 | | 'current commit and uncommitted changes'; |
| b69ab31 | | | 716 | |
| b69ab31 | | | 717 | /* protocol */ |
| b69ab31 | | | 718 | |
| b69ab31 | | | 719 | /** |
| b69ab31 | | | 720 | * messages sent by platform-specific (browser, vscode, electron) implementations |
| b69ab31 | | | 721 | * to be handled uniquely per server type. |
| b69ab31 | | | 722 | */ |
| b69ab31 | | | 723 | export type PlatformSpecificClientToServerMessages = |
| b69ab31 | | | 724 | | {type: 'platform/openFile'; path: RepoRelativePath; options?: {line?: OneIndexedLineNumber}} |
| b69ab31 | | | 725 | | { |
| b69ab31 | | | 726 | type: 'platform/openFiles'; |
| b69ab31 | | | 727 | paths: ReadonlyArray<RepoRelativePath>; |
| b69ab31 | | | 728 | options?: {line?: OneIndexedLineNumber}; |
| b69ab31 | | | 729 | } |
| b69ab31 | | | 730 | | {type: 'platform/openContainingFolder'; path: RepoRelativePath} |
| b69ab31 | | | 731 | | {type: 'platform/openDiff'; path: RepoRelativePath; comparison: Comparison} |
| b69ab31 | | | 732 | | {type: 'platform/openExternal'; url: string} |
| b69ab31 | | | 733 | | {type: 'platform/changeTitle'; title: string} |
| b69ab31 | | | 734 | | {type: 'platform/confirm'; message: string; details?: string | undefined} |
| b69ab31 | | | 735 | | {type: 'platform/subscribeToAvailableCwds'} |
| b69ab31 | | | 736 | | {type: 'platform/subscribeToUnsavedFiles'} |
| b69ab31 | | | 737 | | {type: 'platform/saveAllUnsavedFiles'} |
| b69ab31 | | | 738 | | {type: 'platform/setPersistedState'; key: string; data?: string} |
| b69ab31 | | | 739 | | {type: 'platform/subscribeToSuggestedEdits'} |
| b69ab31 | | | 740 | | { |
| b69ab31 | | | 741 | type: 'platform/resolveSuggestedEdits'; |
| b69ab31 | | | 742 | action: 'accept' | 'reject'; |
| b69ab31 | | | 743 | files: Array<AbsolutePath>; |
| b69ab31 | | | 744 | } |
| b69ab31 | | | 745 | | { |
| b69ab31 | | | 746 | type: 'platform/setVSCodeConfig'; |
| b69ab31 | | | 747 | config: string; |
| b69ab31 | | | 748 | value: Json | undefined; |
| b69ab31 | | | 749 | scope: 'workspace' | 'global'; |
| b69ab31 | | | 750 | } |
| b69ab31 | | | 751 | | {type: 'platform/checkForDiagnostics'; paths: Array<RepoRelativePath>} |
| b69ab31 | | | 752 | | {type: 'platform/executeVSCodeCommand'; command: string; args: Array<Json>} |
| b69ab31 | | | 753 | | {type: 'platform/subscribeToVSCodeConfig'; config: string} |
| b69ab31 | | | 754 | | { |
| b69ab31 | | | 755 | type: 'platform/resolveAllCommentsWithAI'; |
| b69ab31 | | | 756 | diffId: string; |
| b69ab31 | | | 757 | comments: Array<DiffComment>; |
| b69ab31 | | | 758 | filePaths: Array<RepoRelativePath>; |
| b69ab31 | | | 759 | repoPath?: string; |
| b69ab31 | | | 760 | userContext?: string; |
| b69ab31 | | | 761 | } |
| b69ab31 | | | 762 | | { |
| b69ab31 | | | 763 | type: 'platform/resolveFailedSignalsWithAI'; |
| b69ab31 | | | 764 | diffId: string; |
| b69ab31 | | | 765 | diffVersionNumber: number; |
| b69ab31 | | | 766 | repoPath?: string; |
| b69ab31 | | | 767 | userContext?: string; |
| b69ab31 | | | 768 | } |
| b69ab31 | | | 769 | | { |
| b69ab31 | | | 770 | type: 'platform/fillCommitMessageWithAI'; |
| b69ab31 | | | 771 | id: string; |
| b69ab31 | | | 772 | source: 'commitInfoView' | 'smartAction'; |
| b69ab31 | | | 773 | userContext?: string; |
| b69ab31 | | | 774 | } |
| b69ab31 | | | 775 | | { |
| b69ab31 | | | 776 | type: 'platform/splitCommitWithAI'; |
| b69ab31 | | | 777 | diffCommit: string; |
| b69ab31 | | | 778 | args?: string; |
| b69ab31 | | | 779 | repoPath?: string; |
| b69ab31 | | | 780 | userContext?: string; |
| b69ab31 | | | 781 | } |
| b69ab31 | | | 782 | | { |
| b69ab31 | | | 783 | type: 'platform/createTestForModifiedCodeWithAI'; |
| b69ab31 | | | 784 | } |
| b69ab31 | | | 785 | | { |
| b69ab31 | | | 786 | type: 'platform/recommendTestPlanWithAI'; |
| b69ab31 | | | 787 | commitHash?: string; |
| b69ab31 | | | 788 | userContext?: string; |
| b69ab31 | | | 789 | } |
| b69ab31 | | | 790 | | { |
| b69ab31 | | | 791 | type: 'platform/generateSummaryWithAI'; |
| b69ab31 | | | 792 | commitHash?: string; |
| b69ab31 | | | 793 | userContext?: string; |
| b69ab31 | | | 794 | } |
| b69ab31 | | | 795 | | { |
| b69ab31 | | | 796 | type: 'platform/validateChangesWithAI'; |
| b69ab31 | | | 797 | userContext?: string; |
| b69ab31 | | | 798 | } |
| b69ab31 | | | 799 | | { |
| b69ab31 | | | 800 | type: 'platform/resolveAllConflictsWithAI'; |
| b69ab31 | | | 801 | conflicts: MergeConflicts; |
| b69ab31 | | | 802 | userContext?: string; |
| b69ab31 | | | 803 | } |
| b69ab31 | | | 804 | | { |
| b69ab31 | | | 805 | type: 'platform/runAICodeReviewPlatform'; |
| b69ab31 | | | 806 | cwd: string; |
| b69ab31 | | | 807 | } |
| b69ab31 | | | 808 | | { |
| b69ab31 | | | 809 | type: 'platform/runAICodeReviewChat'; |
| b69ab31 | | | 810 | source: 'commitInfoView' | 'smartAction'; |
| b69ab31 | | | 811 | reviewScope: CodeReviewScope; |
| b69ab31 | | | 812 | userContext?: string; |
| b69ab31 | | | 813 | } |
| b69ab31 | | | 814 | | { |
| b69ab31 | | | 815 | type: 'platform/subscribeToAIReviewComments'; |
| b69ab31 | | | 816 | }; |
| b69ab31 | | | 817 | |
| b69ab31 | | | 818 | /** |
| b69ab31 | | | 819 | * messages returned by platform-specific (browser, vscode, electron) server implementation, |
| b69ab31 | | | 820 | * usually in response to a platform-specific ClientToServer message |
| b69ab31 | | | 821 | */ |
| b69ab31 | | | 822 | export type PlatformSpecificServerToClientMessages = |
| b69ab31 | | | 823 | | { |
| b69ab31 | | | 824 | type: 'platform/confirmResult'; |
| b69ab31 | | | 825 | result: boolean; |
| b69ab31 | | | 826 | } |
| b69ab31 | | | 827 | | { |
| b69ab31 | | | 828 | type: 'platform/availableCwds'; |
| b69ab31 | | | 829 | options: Array<CwdInfo>; |
| b69ab31 | | | 830 | } |
| b69ab31 | | | 831 | | {type: 'platform/unsavedFiles'; unsaved: Array<{path: RepoRelativePath; uri: string}>} |
| b69ab31 | | | 832 | | {type: 'platform/savedAllUnsavedFiles'; success: boolean} |
| b69ab31 | | | 833 | | { |
| b69ab31 | | | 834 | type: 'platform/gotDiagnostics'; |
| b69ab31 | | | 835 | diagnostics: Map<RepoRelativePath, Array<Diagnostic>>; |
| b69ab31 | | | 836 | } |
| b69ab31 | | | 837 | | {type: 'platform/onDidChangeSuggestedEdits'; files: Array<AbsolutePath>} |
| b69ab31 | | | 838 | | { |
| b69ab31 | | | 839 | type: 'platform/vscodeConfigChanged'; |
| b69ab31 | | | 840 | config: string; |
| b69ab31 | | | 841 | value: Json | undefined; |
| b69ab31 | | | 842 | } |
| b69ab31 | | | 843 | | { |
| b69ab31 | | | 844 | type: 'platform/gotAIReviewComments'; |
| b69ab31 | | | 845 | comments: Result<CodeReviewIssue[]>; |
| b69ab31 | | | 846 | }; |
| b69ab31 | | | 847 | |
| b69ab31 | | | 848 | export type CodeReviewProviderSpecificClientToServerMessages = |
| b69ab31 | | | 849 | | never |
| b69ab31 | | | 850 | | InternalTypes['PhabricatorClientToServerMessages']; |
| b69ab31 | | | 851 | |
| b69ab31 | | | 852 | export type CodeReviewProviderSpecificServerToClientMessages = |
| b69ab31 | | | 853 | | never |
| b69ab31 | | | 854 | | InternalTypes['PhabricatorServerToClientMessages']; |
| b69ab31 | | | 855 | |
| b69ab31 | | | 856 | export type PageVisibility = 'focused' | 'visible' | 'hidden'; |
| b69ab31 | | | 857 | |
| b69ab31 | | | 858 | export type FileABugFields = {title: string; description: string; repro: string}; |
| b69ab31 | | | 859 | export type FileABugProgress = |
| b69ab31 | | | 860 | | {status: 'starting'} |
| b69ab31 | | | 861 | | { |
| b69ab31 | | | 862 | status: 'inProgress'; |
| b69ab31 | | | 863 | currentSteps: Record<string, 'blocked' | 'loading' | 'finished'>; |
| b69ab31 | | | 864 | } |
| b69ab31 | | | 865 | | {status: 'success'; taskNumber: string; taskLink: string} |
| b69ab31 | | | 866 | | {status: 'error'; error: Error}; |
| b69ab31 | | | 867 | export type FileABugProgressMessage = {type: 'fileBugReportProgress'} & FileABugProgress; |
| b69ab31 | | | 868 | |
| b69ab31 | | | 869 | export type SubscriptionKind = |
| b69ab31 | | | 870 | | 'uncommittedChanges' |
| b69ab31 | | | 871 | | 'smartlogCommits' |
| b69ab31 | | | 872 | | 'mergeConflicts' |
| b69ab31 | | | 873 | | 'submodules' |
| b69ab31 | | | 874 | | 'subscribedFullRepoBranches'; |
| b69ab31 | | | 875 | |
| b69ab31 | | | 876 | export const allConfigNames = [ |
| b69ab31 | | | 877 | // these config names are for compatibility. |
| b69ab31 | | | 878 | 'isl.submitAsDraft', |
| b69ab31 | | | 879 | 'isl.publishWhenReady', |
| b69ab31 | | | 880 | 'isl.changedFilesDisplayType', |
| b69ab31 | | | 881 | // sapling config prefers foo-bar naming. |
| b69ab31 | | | 882 | 'isl.pull-button-choice', |
| b69ab31 | | | 883 | 'isl.show-stack-submit-confirmation', |
| b69ab31 | | | 884 | 'isl.show-diff-number', |
| b69ab31 | | | 885 | 'isl.render-compact', |
| b69ab31 | | | 886 | 'isl.download-commit-should-goto', |
| b69ab31 | | | 887 | 'isl.download-commit-rebase-type', |
| b69ab31 | | | 888 | 'isl.experimental-features', |
| b69ab31 | | | 889 | 'isl.hold-off-refresh-ms', |
| b69ab31 | | | 890 | 'isl.sl-progress-enabled', |
| b69ab31 | | | 891 | 'isl.use-sl-graphql', |
| b69ab31 | | | 892 | 'github.preferred_submit_command', |
| b69ab31 | | | 893 | 'isl.open-file-cmd', |
| b69ab31 | | | 894 | 'isl.generated-files-regex', |
| b69ab31 | | | 895 | 'ui.username', |
| b69ab31 | | | 896 | 'ui.merge', |
| b69ab31 | | | 897 | 'fbcodereview.code-browser-url', |
| b69ab31 | | | 898 | 'extensions.commitcloud', |
| b69ab31 | | | 899 | ] as const; |
| b69ab31 | | | 900 | |
| b69ab31 | | | 901 | /** sl configs read by ISL */ |
| b69ab31 | | | 902 | export type ConfigName = (typeof allConfigNames)[number]; |
| b69ab31 | | | 903 | |
| b69ab31 | | | 904 | /** |
| b69ab31 | | | 905 | * Not all configs should be set-able from the UI, for security. |
| b69ab31 | | | 906 | * Only configs which could not possibly allow code execution should be allowed. |
| b69ab31 | | | 907 | * This also includes values allowed to be passed in the args for Operations. |
| b69ab31 | | | 908 | * Most ISL configs are OK. |
| b69ab31 | | | 909 | */ |
| b69ab31 | | | 910 | export const settableConfigNames = [ |
| b69ab31 | | | 911 | 'isl.submitAsDraft', |
| b69ab31 | | | 912 | 'isl.publishWhenReady', |
| b69ab31 | | | 913 | 'isl.changedFilesDisplayType', |
| b69ab31 | | | 914 | 'isl.pull-button-choice', |
| b69ab31 | | | 915 | 'isl.show-stack-submit-confirmation', |
| b69ab31 | | | 916 | 'isl.show-diff-number', |
| b69ab31 | | | 917 | 'isl.render-compact', |
| b69ab31 | | | 918 | 'isl.download-commit-should-goto', |
| b69ab31 | | | 919 | 'isl.download-commit-rebase-type', |
| b69ab31 | | | 920 | 'isl.experimental-features', |
| b69ab31 | | | 921 | 'isl.hold-off-refresh-ms', |
| b69ab31 | | | 922 | 'isl.use-sl-graphql', |
| b69ab31 | | | 923 | 'isl.experimental-graph-renderer', |
| b69ab31 | | | 924 | 'isl.generated-files-regex', |
| b69ab31 | | | 925 | 'github.preferred_submit_command', |
| b69ab31 | | | 926 | 'ui.allowemptycommit', |
| b69ab31 | | | 927 | 'ui.merge', |
| b69ab31 | | | 928 | 'amend.autorestack', |
| b69ab31 | | | 929 | ] as const; |
| b69ab31 | | | 930 | |
| b69ab31 | | | 931 | /** sl configs written to by ISL */ |
| b69ab31 | | | 932 | export type SettableConfigName = (typeof settableConfigNames)[number]; |
| b69ab31 | | | 933 | |
| b69ab31 | | | 934 | /** local storage keys written by ISL */ |
| b69ab31 | | | 935 | export type LocalStorageName = |
| b69ab31 | | | 936 | | 'isl.drawer-state' |
| b69ab31 | | | 937 | | 'isl.bookmarks' |
| b69ab31 | | | 938 | | 'isl.recommended-bookmarks-reminder' |
| b69ab31 | | | 939 | | 'isl.recommended-bookmarks-onboarding' |
| b69ab31 | | | 940 | | 'isl.ui-zoom' |
| b69ab31 | | | 941 | | 'isl.has-shown-getting-started' |
| b69ab31 | | | 942 | | 'isl.dismissed-split-suggestion' |
| b69ab31 | | | 943 | | 'isl.amend-autorestack' |
| b69ab31 | | | 944 | | 'isl.dismissed-alerts' |
| b69ab31 | | | 945 | | 'isl.debug-react-tools' |
| b69ab31 | | | 946 | | 'isl.debug-redux-tools' |
| b69ab31 | | | 947 | | 'isl.condense-obsolete-stacks' |
| b69ab31 | | | 948 | | 'isl.deemphasize-cwd-irrelevant-commits' |
| b69ab31 | | | 949 | | 'isl.hide-cwd-irrelevant-stacks' |
| b69ab31 | | | 950 | | 'isl.split-suggestion-enabled' |
| b69ab31 | | | 951 | | 'isl.comparison-display-mode' |
| b69ab31 | | | 952 | | 'isl.expand-generated-files' |
| b69ab31 | | | 953 | | 'isl-color-theme' |
| b69ab31 | | | 954 | | 'isl.auto-resolve-before-continue' |
| b69ab31 | | | 955 | | 'isl.warn-about-diagnostics' |
| b69ab31 | | | 956 | | 'isl.hide-non-blocking-diagnostics' |
| b69ab31 | | | 957 | | 'isl.rebase-off-warm-warning-enabled' |
| b69ab31 | | | 958 | | 'isl.distant-rebase-warning-enabled' |
| b69ab31 | | | 959 | | 'isl.rebase-onto-master-warning-enabled' |
| b69ab31 | | | 960 | | 'isl.experimental-features-local-override' |
| b69ab31 | | | 961 | | 'isl.partial-abort' |
| b69ab31 | | | 962 | | 'isl.smart-actions-order' |
| b69ab31 | | | 963 | // The keys below are prefixes, with further dynamic keys appended afterwards |
| b69ab31 | | | 964 | | 'isl.edited-commit-messages:' |
| b69ab31 | | | 965 | | 'isl.first-pass-comments:'; |
| b69ab31 | | | 966 | |
| b69ab31 | | | 967 | export type ClientToServerMessage = |
| b69ab31 | | | 968 | | {type: 'heartbeat'; id: string} |
| b69ab31 | | | 969 | | {type: 'stress'; id: number; time: number; message: string} |
| b69ab31 | | | 970 | | {type: 'refresh'} |
| b69ab31 | | | 971 | | {type: 'clientReady'} |
| b69ab31 | | | 972 | | {type: 'getConfig'; name: ConfigName} |
| b69ab31 | | | 973 | | {type: 'setConfig'; name: SettableConfigName; value: string} |
| b69ab31 | | | 974 | | {type: 'setDebugLogging'; name: 'debug' | 'verbose'; enabled: boolean} |
| b69ab31 | | | 975 | | {type: 'changeCwd'; cwd: string} |
| b69ab31 | | | 976 | | {type: 'track'; data: TrackDataWithEventName} |
| b69ab31 | | | 977 | | {type: 'fileBugReport'; data: FileABugFields; uiState?: Json; collectRage: boolean} |
| b69ab31 | | | 978 | | {type: 'runOperation'; operation: RunnableOperation} |
| b69ab31 | | | 979 | | {type: 'abortRunningOperation'; operationId: string} |
| b69ab31 | | | 980 | | {type: 'fetchActiveAlerts'} |
| b69ab31 | | | 981 | | {type: 'fetchGeneratedStatuses'; paths: Array<RepoRelativePath>} |
| b69ab31 | | | 982 | | {type: 'fetchCommitMessageTemplate'} |
| b69ab31 | | | 983 | | {type: 'fetchShelvedChanges'} |
| b69ab31 | | | 984 | | {type: 'fetchLatestCommit'; revset: string} |
| b69ab31 | | | 985 | | {type: 'fetchCommitChangedFiles'; hash: Hash; limit?: number} |
| b69ab31 | | | 986 | | { |
| b69ab31 | | | 987 | type: 'uploadFile'; |
| b69ab31 | | | 988 | filename: string; |
| b69ab31 | | | 989 | id: string; |
| b69ab31 | | | 990 | b64Content: string; |
| b69ab31 | | | 991 | } |
| b69ab31 | | | 992 | | {type: 'renderMarkup'; markup: string; id: number} |
| b69ab31 | | | 993 | | {type: 'typeahead'; kind: TypeaheadKind; query: string; id: string} |
| b69ab31 | | | 994 | | {type: 'requestRepoInfo'} |
| b69ab31 | | | 995 | | {type: 'requestApplicationInfo'} |
| b69ab31 | | | 996 | | {type: 'requestMissedOperationProgress'; operationId: string} |
| b69ab31 | | | 997 | | {type: 'fetchAvatars'; authors: Array<string>} |
| b69ab31 | | | 998 | | {type: 'fetchCommitCloudState'} |
| b69ab31 | | | 999 | | {type: 'fetchDiffSummaries'; diffIds?: Array<DiffId>} |
| e7069e1 | | | 1000 | | {type: 'fetchCanopySignals'} |
| b69ab31 | | | 1001 | | {type: 'fetchDiffComments'; diffId: DiffId} |
| b69ab31 | | | 1002 | | {type: 'fetchLandInfo'; topOfStack: DiffId} |
| b69ab31 | | | 1003 | | {type: 'fetchAndSetStables'; additionalStables: Array<string>} |
| b69ab31 | | | 1004 | | {type: 'fetchStableLocationAutocompleteOptions'} |
| b69ab31 | | | 1005 | | {type: 'confirmLand'; landConfirmationInfo: LandConfirmationInfo} |
| b69ab31 | | | 1006 | | {type: 'getSuggestedReviewers'; context: {paths: Array<string>}; key: string} |
| b69ab31 | | | 1007 | | {type: 'getConfiguredMergeTool'} |
| b69ab31 | | | 1008 | | {type: 'updateRemoteDiffMessage'; diffId: DiffId; title: string; description: string} |
| b69ab31 | | | 1009 | | {type: 'pageVisibility'; state: PageVisibility} |
| b69ab31 | | | 1010 | | {type: 'getRepoUrlAtHash'; revset: Revset; path?: string} |
| b69ab31 | | | 1011 | | {type: 'requestComparison'; comparison: Comparison} |
| b69ab31 | | | 1012 | | { |
| b69ab31 | | | 1013 | type: 'requestComparisonContextLines'; |
| b69ab31 | | | 1014 | id: { |
| b69ab31 | | | 1015 | comparison: Comparison; |
| b69ab31 | | | 1016 | path: RepoRelativePath; |
| b69ab31 | | | 1017 | }; |
| b69ab31 | | | 1018 | start: number; |
| b69ab31 | | | 1019 | numLines: number; |
| b69ab31 | | | 1020 | } |
| b69ab31 | | | 1021 | | {type: 'loadMoreCommits'} |
| b69ab31 | | | 1022 | | {type: 'subscribe'; kind: SubscriptionKind; subscriptionID: string} |
| b69ab31 | | | 1023 | | {type: 'unsubscribe'; kind: SubscriptionKind; subscriptionID: string} |
| b69ab31 | | | 1024 | | {type: 'exportStack'; revs: string; assumeTracked?: Array<string>} |
| b69ab31 | | | 1025 | | {type: 'importStack'; stack: ImportStack} |
| b69ab31 | | | 1026 | | {type: 'fetchQeFlag'; name: string} |
| b69ab31 | | | 1027 | | {type: 'fetchFeatureFlag'; name: string} |
| b69ab31 | | | 1028 | | {type: 'bulkFetchFeatureFlags'; id: string; names: Array<string>} |
| b69ab31 | | | 1029 | | {type: 'fetchInternalUserInfo'} |
| b69ab31 | | | 1030 | | {type: 'fetchDevEnvType'; id: string} |
| b69ab31 | | | 1031 | | {type: 'splitCommitWithAI'; id: string; diffCommit: DiffCommit; args: Args} |
| b69ab31 | | | 1032 | | {type: 'gotUiState'; state: string} |
| 6c9fcae | | | 1033 | | {type: 'fetchGroveOwners'} |
| 6c9fcae | | | 1034 | | {type: 'createGroveRepo'; name: string; owner?: string} |
| b69ab31 | | | 1035 | | CodeReviewProviderSpecificClientToServerMessages |
| b69ab31 | | | 1036 | | PlatformSpecificClientToServerMessages |
| b69ab31 | | | 1037 | | {type: 'fetchSignificantLinesOfCode'; hash: Hash; excludedFiles: string[]} |
| b69ab31 | | | 1038 | | { |
| b69ab31 | | | 1039 | type: 'fetchPendingSignificantLinesOfCode'; |
| b69ab31 | | | 1040 | requestId: number; |
| b69ab31 | | | 1041 | hash: Hash; |
| b69ab31 | | | 1042 | includedFiles: string[]; |
| b69ab31 | | | 1043 | } |
| b69ab31 | | | 1044 | | { |
| b69ab31 | | | 1045 | type: 'fetchPendingAmendSignificantLinesOfCode'; |
| b69ab31 | | | 1046 | requestId: number; |
| b69ab31 | | | 1047 | hash: Hash; |
| b69ab31 | | | 1048 | includedFiles: string[]; |
| b69ab31 | | | 1049 | } |
| b69ab31 | | | 1050 | | { |
| b69ab31 | | | 1051 | type: 'fetchGkDetails'; |
| b69ab31 | | | 1052 | id: string; |
| b69ab31 | | | 1053 | name: string; |
| b69ab31 | | | 1054 | } |
| b69ab31 | | | 1055 | | { |
| b69ab31 | | | 1056 | type: 'fetchJkDetails'; |
| b69ab31 | | | 1057 | id: string; |
| b69ab31 | | | 1058 | names: string[]; |
| b69ab31 | | | 1059 | } |
| b69ab31 | | | 1060 | | { |
| b69ab31 | | | 1061 | type: 'fetchKnobsetDetails'; |
| b69ab31 | | | 1062 | id: string; |
| b69ab31 | | | 1063 | configPath: string; |
| b69ab31 | | | 1064 | } |
| b69ab31 | | | 1065 | | { |
| b69ab31 | | | 1066 | type: 'fetchQeDetails'; |
| b69ab31 | | | 1067 | id: string; |
| b69ab31 | | | 1068 | name: string; |
| b69ab31 | | | 1069 | } |
| b69ab31 | | | 1070 | | { |
| b69ab31 | | | 1071 | type: 'fetchTaskDetails'; |
| b69ab31 | | | 1072 | id: string; |
| b69ab31 | | | 1073 | taskNumber: number; |
| b69ab31 | | | 1074 | } |
| b69ab31 | | | 1075 | | { |
| b69ab31 | | | 1076 | type: 'fetchABPropDetails'; |
| b69ab31 | | | 1077 | id: string; |
| b69ab31 | | | 1078 | name: string; |
| b69ab31 | | | 1079 | } |
| b69ab31 | | | 1080 | | { |
| b69ab31 | | | 1081 | type: 'runDevmateCommand'; |
| b69ab31 | | | 1082 | args: Array<string>; |
| b69ab31 | | | 1083 | cwd: string; |
| b69ab31 | | | 1084 | requestId: string; |
| b69ab31 | | | 1085 | } |
| b69ab31 | | | 1086 | | { |
| b69ab31 | | | 1087 | type: 'fetchSubscribedFullRepoBranches'; |
| b69ab31 | | | 1088 | id: string; |
| b69ab31 | | | 1089 | } |
| b69ab31 | | | 1090 | | { |
| b69ab31 | | | 1091 | type: 'fetchFullRepoBranchAllChangedFiles'; |
| b69ab31 | | | 1092 | id: string; |
| b69ab31 | | | 1093 | fullRepoBranch: InternalTypes['FullRepoBranch']; |
| b69ab31 | | | 1094 | } |
| b69ab31 | | | 1095 | | { |
| b69ab31 | | | 1096 | type: 'fetchFullRepoBranchMergeSubtreePaths'; |
| b69ab31 | | | 1097 | id: string; |
| b69ab31 | | | 1098 | fullRepoBranch: InternalTypes['FullRepoBranch']; |
| b69ab31 | | | 1099 | paths: Array<RepoRelativePath>; |
| b69ab31 | | | 1100 | } |
| b69ab31 | | | 1101 | | { |
| b69ab31 | | | 1102 | type: 'subscribeToFullRepoBranch'; |
| b69ab31 | | | 1103 | id: string; |
| b69ab31 | | | 1104 | fullRepoBranch: InternalTypes['FullRepoBranch']; |
| b69ab31 | | | 1105 | } |
| b69ab31 | | | 1106 | | { |
| b69ab31 | | | 1107 | type: 'unsubscribeToFullRepoBranch'; |
| b69ab31 | | | 1108 | id: string; |
| b69ab31 | | | 1109 | fullRepoBranch: InternalTypes['FullRepoBranch']; |
| b69ab31 | | | 1110 | }; |
| b69ab31 | | | 1111 | |
| b69ab31 | | | 1112 | export type SubscriptionResultsData = { |
| b69ab31 | | | 1113 | uncommittedChanges: FetchedUncommittedChanges; |
| b69ab31 | | | 1114 | smartlogCommits: FetchedCommits; |
| b69ab31 | | | 1115 | mergeConflicts: MergeConflicts | undefined; |
| b69ab31 | | | 1116 | submodules: SubmodulesByRoot; |
| b69ab31 | | | 1117 | subscribedFullRepoBranches: Array<InternalTypes['FullRepoBranch']>; |
| b69ab31 | | | 1118 | }; |
| b69ab31 | | | 1119 | |
| b69ab31 | | | 1120 | export type SubscriptionResult<K extends SubscriptionKind> = { |
| b69ab31 | | | 1121 | type: 'subscriptionResult'; |
| b69ab31 | | | 1122 | subscriptionID: string; |
| b69ab31 | | | 1123 | kind: K; |
| b69ab31 | | | 1124 | data: SubscriptionResultsData[K]; |
| b69ab31 | | | 1125 | }; |
| b69ab31 | | | 1126 | |
| b69ab31 | | | 1127 | export type ServerToClientMessage = |
| b69ab31 | | | 1128 | | SubscriptionResult<'smartlogCommits'> |
| b69ab31 | | | 1129 | | SubscriptionResult<'uncommittedChanges'> |
| b69ab31 | | | 1130 | | SubscriptionResult<'mergeConflicts'> |
| b69ab31 | | | 1131 | | SubscriptionResult<'submodules'> |
| b69ab31 | | | 1132 | | SubscriptionResult<'subscribedFullRepoBranches'> |
| b69ab31 | | | 1133 | | BeganFetchingUncommittedChangesEvent |
| b69ab31 | | | 1134 | | BeganFetchingSmartlogCommitsEvent |
| b69ab31 | | | 1135 | | { |
| b69ab31 | | | 1136 | type: 'beganFetchingSubscribedFullRepoBranchesEvent'; |
| b69ab31 | | | 1137 | } |
| b69ab31 | | | 1138 | | FileABugProgressMessage |
| b69ab31 | | | 1139 | | {type: 'heartbeat'; id: string} |
| b69ab31 | | | 1140 | | {type: 'stress'; id: number; time: number; message: string} |
| b69ab31 | | | 1141 | | {type: 'gotConfig'; name: ConfigName; value: string | undefined} |
| b69ab31 | | | 1142 | | { |
| b69ab31 | | | 1143 | type: 'fetchedGeneratedStatuses'; |
| b69ab31 | | | 1144 | results: Record<RepoRelativePath, GeneratedStatus>; |
| b69ab31 | | | 1145 | } |
| b69ab31 | | | 1146 | | {type: 'fetchedActiveAlerts'; alerts: Array<Alert>} |
| b69ab31 | | | 1147 | | {type: 'fetchedCommitMessageTemplate'; template: string} |
| b69ab31 | | | 1148 | | {type: 'fetchedShelvedChanges'; shelvedChanges: Result<Array<ShelvedChange>>} |
| b69ab31 | | | 1149 | | {type: 'fetchedLatestCommit'; info: Result<CommitInfo>; revset: string} |
| b69ab31 | | | 1150 | | { |
| b69ab31 | | | 1151 | type: 'fetchedCommitChangedFiles'; |
| b69ab31 | | | 1152 | hash: Hash; |
| b69ab31 | | | 1153 | result: Result<FilesSample>; |
| b69ab31 | | | 1154 | } |
| b69ab31 | | | 1155 | | {type: 'typeaheadResult'; id: string; result: Array<TypeaheadResult>} |
| b69ab31 | | | 1156 | | {type: 'applicationInfo'; info: ApplicationInfo} |
| b69ab31 | | | 1157 | | {type: 'repoInfo'; info: RepoInfo; cwd?: string} |
| b69ab31 | | | 1158 | | {type: 'repoError'; error: RepositoryError | undefined} |
| b69ab31 | | | 1159 | | {type: 'fetchedAvatars'; avatars: Map<string, string>; authors: Array<string>} |
| b69ab31 | | | 1160 | | {type: 'fetchedDiffSummaries'; summaries: Result<Map<DiffId, DiffSummary>>} |
| e7069e1 | | | 1161 | | {type: 'fetchedCanopySignals'; runs: Array<{commitMessage: string; signal: DiffSignalSummary; runId?: number; commitId?: string}>} |
| b69ab31 | | | 1162 | | {type: 'fetchedDiffComments'; diffId: DiffId; comments: Result<Array<DiffComment>>} |
| b69ab31 | | | 1163 | | {type: 'fetchedLandInfo'; topOfStack: DiffId; landInfo: Result<LandInfo>} |
| b69ab31 | | | 1164 | | {type: 'confirmedLand'; result: Result<undefined>} |
| b69ab31 | | | 1165 | | {type: 'fetchedCommitCloudState'; state: Result<CommitCloudSyncState>} |
| b69ab31 | | | 1166 | | {type: 'fetchedStables'; stables: StableLocationData} |
| b69ab31 | | | 1167 | | {type: 'fetchedRecommendedBookmarks'; bookmarks: Array<string>} |
| b69ab31 | | | 1168 | | { |
| b69ab31 | | | 1169 | type: 'fetchedHiddenMasterBranchConfig'; |
| b69ab31 | | | 1170 | config: Record<string, Array<string>> | null; |
| b69ab31 | | | 1171 | odType: string | null; |
| b69ab31 | | | 1172 | cwd: string; |
| b69ab31 | | | 1173 | } |
| b69ab31 | | | 1174 | | {type: 'fetchedStableLocationAutocompleteOptions'; result: Result<Array<TypeaheadResult>>} |
| b69ab31 | | | 1175 | | {type: 'renderedMarkup'; html: string; id: number} |
| b69ab31 | | | 1176 | | {type: 'gotSuggestedReviewers'; reviewers: Array<string>; key: string} |
| b69ab31 | | | 1177 | | {type: 'gotConfiguredMergeTool'; tool: string | undefined} |
| b69ab31 | | | 1178 | | {type: 'updatedRemoteDiffMessage'; diffId: DiffId; error?: string} |
| b69ab31 | | | 1179 | | { |
| b69ab31 | | | 1180 | type: 'updateDraftCommitMessage'; |
| b69ab31 | | | 1181 | title: string; |
| b69ab31 | | | 1182 | description: string; |
| b69ab31 | | | 1183 | mode?: 'commit' | 'amend'; |
| b69ab31 | | | 1184 | hash?: string; |
| b69ab31 | | | 1185 | } |
| b69ab31 | | | 1186 | | {type: 'uploadFileResult'; id: string; result: Result<string>} |
| 4fe1f34 | | | 1187 | | {type: 'watchmanStatus'; status: 'initializing' | 'reconnecting' | 'healthy' | 'ended' | 'errored' | 'unavailable'} |
| b69ab31 | | | 1188 | | {type: 'gotRepoUrlAtHash'; url: Result<string>} |
| b69ab31 | | | 1189 | | {type: 'comparison'; comparison: Comparison; data: ComparisonData} |
| b69ab31 | | | 1190 | | {type: 'comparisonContextLines'; path: RepoRelativePath; lines: Result<Array<string>>} |
| b69ab31 | | | 1191 | | {type: 'beganLoadingMoreCommits'} |
| b69ab31 | | | 1192 | | {type: 'commitsShownRange'; rangeInDays: number | undefined} |
| b69ab31 | | | 1193 | | {type: 'additionalCommitAvailability'; moreAvailable: boolean} |
| b69ab31 | | | 1194 | | { |
| b69ab31 | | | 1195 | type: 'exportedStack'; |
| b69ab31 | | | 1196 | revs: string; |
| b69ab31 | | | 1197 | assumeTracked: Array<string>; |
| b69ab31 | | | 1198 | stack: ExportStack; |
| b69ab31 | | | 1199 | error: string | undefined; |
| b69ab31 | | | 1200 | } |
| b69ab31 | | | 1201 | | {type: 'importedStack'; imported: ImportedStack; error: string | undefined} |
| b69ab31 | | | 1202 | | {type: 'fetchedQeFlag'; name: string; passes: boolean} |
| b69ab31 | | | 1203 | | {type: 'fetchedFeatureFlag'; name: string; passes: boolean} |
| b69ab31 | | | 1204 | | {type: 'bulkFetchedFeatureFlags'; id: string; result: Record<string, boolean>} |
| b69ab31 | | | 1205 | | {type: 'fetchedInternalUserInfo'; info: Serializable} |
| b69ab31 | | | 1206 | | {type: 'fetchedDevEnvType'; envType: string; id: string} |
| b69ab31 | | | 1207 | | { |
| b69ab31 | | | 1208 | type: 'splitCommitWithAI'; |
| b69ab31 | | | 1209 | id: string; |
| b69ab31 | | | 1210 | result: Result<ReadonlyArray<PartiallySelectedDiffCommit>>; |
| b69ab31 | | | 1211 | } |
| b69ab31 | | | 1212 | | {type: 'getUiState'} |
| b69ab31 | | | 1213 | | OperationProgressEvent |
| 6c9fcae | | | 1214 | | {type: 'fetchedGroveOwners'; owners: Array<{name: string; type: 'user' | 'org'}>} |
| 6c9fcae | | | 1215 | | {type: 'createdGroveRepo'; result: Result<{owner: string; repo: string}>} |
| b69ab31 | | | 1216 | | PlatformSpecificServerToClientMessages |
| b69ab31 | | | 1217 | | CodeReviewProviderSpecificServerToClientMessages |
| b69ab31 | | | 1218 | | { |
| b69ab31 | | | 1219 | type: 'fetchedSignificantLinesOfCode'; |
| b69ab31 | | | 1220 | hash: Hash; |
| b69ab31 | | | 1221 | result: Result<number>; |
| b69ab31 | | | 1222 | } |
| b69ab31 | | | 1223 | | { |
| b69ab31 | | | 1224 | type: 'fetchedPendingSignificantLinesOfCode'; |
| b69ab31 | | | 1225 | requestId: number; |
| b69ab31 | | | 1226 | hash: Hash; |
| b69ab31 | | | 1227 | result: Result<number>; |
| b69ab31 | | | 1228 | } |
| b69ab31 | | | 1229 | | { |
| b69ab31 | | | 1230 | type: 'fetchedPendingAmendSignificantLinesOfCode'; |
| b69ab31 | | | 1231 | requestId: number; |
| b69ab31 | | | 1232 | hash: Hash; |
| b69ab31 | | | 1233 | result: Result<number>; |
| b69ab31 | | | 1234 | } |
| b69ab31 | | | 1235 | | { |
| b69ab31 | | | 1236 | type: 'fetchedGkDetails'; |
| b69ab31 | | | 1237 | id: string; |
| b69ab31 | | | 1238 | result: Result<InternalTypes['InternalGatekeeper']>; |
| b69ab31 | | | 1239 | } |
| b69ab31 | | | 1240 | | { |
| b69ab31 | | | 1241 | type: 'fetchedJkDetails'; |
| b69ab31 | | | 1242 | id: string; |
| b69ab31 | | | 1243 | result: Result<InternalTypes['InternalJustknob']>; |
| b69ab31 | | | 1244 | } |
| b69ab31 | | | 1245 | | { |
| b69ab31 | | | 1246 | type: 'fetchedKnobsetDetails'; |
| b69ab31 | | | 1247 | id: string; |
| b69ab31 | | | 1248 | result: Result<InternalTypes['InternalKnobset']>; |
| b69ab31 | | | 1249 | } |
| b69ab31 | | | 1250 | | { |
| b69ab31 | | | 1251 | type: 'fetchedQeDetails'; |
| b69ab31 | | | 1252 | id: string; |
| b69ab31 | | | 1253 | result: Result<InternalTypes['InternalQuickExperiment']>; |
| b69ab31 | | | 1254 | } |
| b69ab31 | | | 1255 | | { |
| b69ab31 | | | 1256 | type: 'fetchedABPropDetails'; |
| b69ab31 | | | 1257 | id: string; |
| b69ab31 | | | 1258 | result: Result<InternalTypes['InternalMetaConfig']>; |
| b69ab31 | | | 1259 | } |
| b69ab31 | | | 1260 | | { |
| b69ab31 | | | 1261 | type: 'fetchedTaskDetails'; |
| b69ab31 | | | 1262 | id: string; |
| b69ab31 | | | 1263 | result: Result<InternalTypes['InternalTaskDetails']>; |
| b69ab31 | | | 1264 | } |
| b69ab31 | | | 1265 | | { |
| b69ab31 | | | 1266 | type: 'devmateCommandResult'; |
| b69ab31 | | | 1267 | result: ( |
| b69ab31 | | | 1268 | | { |
| b69ab31 | | | 1269 | type: 'value'; |
| b69ab31 | | | 1270 | stdout: string; |
| b69ab31 | | | 1271 | } |
| b69ab31 | | | 1272 | | { |
| b69ab31 | | | 1273 | type: 'error'; |
| b69ab31 | | | 1274 | stderr: string; |
| b69ab31 | | | 1275 | } |
| b69ab31 | | | 1276 | ) & {requestId: string}; |
| b69ab31 | | | 1277 | } |
| b69ab31 | | | 1278 | | { |
| b69ab31 | | | 1279 | type: 'fetchedSubscribedFullRepoBranches'; |
| b69ab31 | | | 1280 | result: Result<Array<InternalTypes['FullRepoBranch']>>; |
| b69ab31 | | | 1281 | } |
| b69ab31 | | | 1282 | | { |
| b69ab31 | | | 1283 | type: 'fetchedFullRepoBranchAllChangedFiles'; |
| b69ab31 | | | 1284 | id: string; |
| b69ab31 | | | 1285 | result: Result<Array<ChangedFile>>; |
| b69ab31 | | | 1286 | } |
| b69ab31 | | | 1287 | | { |
| b69ab31 | | | 1288 | type: 'fetchedFullRepoBranchMergeSubtreePaths'; |
| b69ab31 | | | 1289 | id: string; |
| b69ab31 | | | 1290 | result: Result<Array<string>>; |
| b69ab31 | | | 1291 | } |
| b69ab31 | | | 1292 | | { |
| b69ab31 | | | 1293 | type: 'openSplitViewForCommit'; |
| b69ab31 | | | 1294 | commitHash: string; |
| b69ab31 | | | 1295 | commits?: Array<PartiallySelectedDiffCommit>; |
| b69ab31 | | | 1296 | }; |
| b69ab31 | | | 1297 | |
| b69ab31 | | | 1298 | export type Disposable = { |
| b69ab31 | | | 1299 | dispose(): void; |
| b69ab31 | | | 1300 | }; |
| b69ab31 | | | 1301 | |
| b69ab31 | | | 1302 | export type ComparisonData = { |
| b69ab31 | | | 1303 | diff: Result<string>; |
| b69ab31 | | | 1304 | }; |
| b69ab31 | | | 1305 | |
| b69ab31 | | | 1306 | export type MessageBusStatus = |
| b69ab31 | | | 1307 | | {type: 'initializing'} |
| b69ab31 | | | 1308 | | {type: 'open'} |
| b69ab31 | | | 1309 | | {type: 'reconnecting'} |
| b69ab31 | | | 1310 | | {type: 'error'; error?: string}; |
| b69ab31 | | | 1311 | |
| b69ab31 | | | 1312 | export type ArcStableGKInfo = { |
| b69ab31 | | | 1313 | gk: string; |
| b69ab31 | | | 1314 | id: string; |
| b69ab31 | | | 1315 | label: string; |
| b69ab31 | | | 1316 | }; |