addons/isl/src/types.tsblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import type {TypeaheadResult} from 'isl-components/Types';
b69ab319import type {TrackEventName} from 'isl-server/src/analytics/eventNames';
b69ab3110import type {TrackDataWithEventName} from 'isl-server/src/analytics/types';
b69ab3111import type {GitHubDiffSummary} from 'isl-server/src/github/githubCodeReviewProvider';
e27290012import type {GroveDiffSummary} from 'isl-server/src/grove/groveCodeReviewProvider';
b69ab3113import type {Comparison} from 'shared/Comparison';
b69ab3114import type {ParsedDiff} from 'shared/patch/types';
b69ab3115import type {AllUndefined, Json} from 'shared/typeUtils';
b69ab3116import type {Hash} from 'shared/types/common';
b69ab3117import type {ExportStack, ImportedStack, ImportStack} from 'shared/types/stack';
b69ab3118import type {TypeaheadKind} from './CommitInfoView/types';
b69ab3119import type {InternalTypes} from './InternalTypes';
b69ab3120import type {CodeReviewIssue} from './firstPassCodeReview/types';
b69ab3121import type {Serializable} from './serialize';
b69ab3122import type {Args, DiffCommit, PartiallySelectedDiffCommit} from './stackEdit/diffSplitTypes';
b69ab3123
b69ab3124export type Result<T> = {value: T; error?: undefined} | {value?: undefined; error: Error};
b69ab3125
b69ab3126/** known supported "Platforms" in which ISL may be embedded */
b69ab3127export type PlatformName =
b69ab3128 | 'browser'
b69ab3129 | 'androidStudio'
b69ab3130 | 'androidStudioRemote'
b69ab3131 | 'vscode'
b69ab3132 | 'webview'
b69ab3133 | 'chromelike_app'
b69ab3134 | 'visualStudio'
b69ab3135 | 'obsidian';
b69ab3136
b69ab3137export type AbsolutePath = string;
b69ab3138/**
b69ab3139 * Path relative to repository root dir. Generally, most paths should be RepoRelativePaths,
b69ab3140 * and only convert to CwdRelativePath or basenames or AbsolutePath when needed.
b69ab3141 */
b69ab3142export type RepoRelativePath = string;
b69ab3143
b69ab3144/**
b69ab3145 * cwd may be a subdirectory of the repository root.
b69ab3146 * Some commands expect cwd-relative paths,
b69ab3147 * but we generally prefer {@link RepoRelativePaths} when possible. */
b69ab3148export type CwdRelativePath = string;
b69ab3149
b69ab3150export type {Hash};
b69ab3151
b69ab3152/** Revsets are an eden concept that let you specify commits.
b69ab3153 * This could be a Hash, '.' for HEAD, .^ for parent of head, etc. See `eden help revset` */
b69ab3154export type Revset = string;
b69ab3155
b69ab3156/**
b69ab3157 * Diff identifier according to the current repo's remote repository provider (e.g. GitHub)
b69ab3158 * For Github, this is a PR number, like "7" (for PR #7)
b69ab3159 * For Phabricator, this is a Diff number, like "D12345"
b69ab3160 */
b69ab3161export type DiffId = string;
b69ab3162/**
b69ab3163 * "Diff" means a unit of Code Review according to your remote repo provider
b69ab3164 * For GitHub, this is a "Pull Request"
b69ab3165 * For Phabricator, this is a "Diff"
b69ab3166 */
b69ab3167
b69ab3168/**
b69ab3169 * Short info about a Diff fetched in bulk for all diffs to render an overview
b69ab3170 */
e27290071export type DiffSummary = GitHubDiffSummary | GroveDiffSummary | InternalTypes['PhabricatorDiffSummary'];
b69ab3172
b69ab3173export type DiffCommentReaction = {
b69ab3174 name: string;
b69ab3175 reaction:
b69ab3176 | 'ANGER'
b69ab3177 | 'HAHA'
b69ab3178 | 'LIKE'
b69ab3179 | 'LOVE'
b69ab3180 | 'WOW'
b69ab3181 | 'SORRY'
b69ab3182 | 'SAD'
b69ab3183 | 'CONFUSED'
b69ab3184 | 'EYES'
b69ab3185 | 'HEART'
b69ab3186 | 'HOORAY'
b69ab3187 | 'LAUGH'
b69ab3188 | 'ROCKET'
b69ab3189 | 'THUMBS_DOWN'
b69ab3190 | 'THUMBS_UP';
b69ab3191};
b69ab3192
b69ab3193export type InternalCommitMessageFields = InternalTypes['InternalCommitMessageFields'];
b69ab3194
b69ab3195export enum CodePatchSuggestionStatus {
b69ab3196 Accepted = 'ACCEPTED',
b69ab3197 Declined = 'DECLINED',
b69ab3198 Unset = 'UNSET',
b69ab3199}
b69ab31100
b69ab31101export enum SuggestedChangeType {
b69ab31102 HUMAN_SUGGESTION = 'HUMAN_SUGGESTION',
b69ab31103 METAMATE_SUGGESTION = 'METAMATE_SUGGESTION',
b69ab31104 CI_SIGNAL = 'CI_SIGNAL',
b69ab31105}
b69ab31106
b69ab31107export enum ArchivedStateType {
b69ab31108 ARCHIVED = 'ARCHIVED',
b69ab31109 NOT_ARCHIVED = 'NOT_ARCHIVED',
b69ab31110}
b69ab31111
b69ab31112export enum ArchivedReasonType {
b69ab31113 APPLIED_IN_EDITOR = 'APPLIED_IN_EDITOR',
b69ab31114 APPLIED_MERGED = 'APPLIED_MERGED',
b69ab31115 APPLIED_STACKED_DIFF = 'APPLIED_STACKED_DIFF',
b69ab31116 AUTHOR_DISCARDED = 'AUTHOR_DISCARDED',
b69ab31117 STALE_DIFF_CLOSED = 'STALE_DIFF_CLOSED',
b69ab31118 STALE_FILE_CHANGED = 'STALE_FILE_CHANGED',
b69ab31119}
b69ab31120
b69ab31121export enum WarningCheckResult {
b69ab31122 PASS = 'PASS',
b69ab31123 FAIL = 'FAIL',
b69ab31124 BYPASS = 'BYPASS',
b69ab31125}
b69ab31126
b69ab31127export type CodeChange = {
b69ab31128 oldContent?: string;
b69ab31129 newContent?: string;
b69ab31130 oldLineNumber?: number;
b69ab31131 trimmedLineNumber?: number;
b69ab31132 trimmedLength?: number;
b69ab31133 adjustedLineNumber?: number;
b69ab31134 patch?: ParsedDiff;
b69ab31135};
b69ab31136
b69ab31137export type SuggestedChange = {
b69ab31138 id?: string;
b69ab31139 type?: SuggestedChangeType;
b69ab31140 codePatchSuggestionID?: string;
b69ab31141 codePatchID?: string;
b69ab31142 status?: CodePatchSuggestionStatus;
b69ab31143 archivedState?: ArchivedStateType;
b69ab31144 archivedReason?: ArchivedReasonType;
b69ab31145 commitHashBefore?: string;
b69ab31146 patch?: ParsedDiff;
b69ab31147 oldPath?: string;
b69ab31148 currentPath?: string;
b69ab31149 codeChange?: CodeChange[];
b69ab31150};
b69ab31151
b69ab31152export type DiffComment = {
b69ab31153 id?: string;
b69ab31154 author: string;
b69ab31155 authorName?: string;
b69ab31156 authorAvatarUri?: string;
b69ab31157 html: string;
b69ab31158 content?: string;
b69ab31159 created: Date;
b69ab31160 commitHash?: string;
b69ab31161 /** If it's an inline comment, this is the file path with the comment */
b69ab31162 filename?: string;
b69ab31163 /** If it's an inline comment, this is the line it was added */
b69ab31164 line?: number;
b69ab31165 reactions: Array<DiffCommentReaction>;
b69ab31166 /** Suggestion for how to change the code, as a patch */
b69ab31167 suggestedChange?: SuggestedChange;
b69ab31168 replies: Array<DiffComment>;
b69ab31169 /** If this comment has been resolved. true => "resolved", false => "unresolved", null => the comment is not resolvable, don't show any UI for it */
b69ab31170 isResolved?: boolean;
b69ab31171};
b69ab31172
b69ab31173/**
b69ab31174 * Summary of CI test results for a Diff.
b69ab31175 * 'pass' if ALL signals succeed and not still running.
b69ab31176 * 'failed' if ANY signal doesn't succeed, even if some are still running.
b69ab31177 * 'deferred' if tests are deferred and waiting to be started.
b69ab31178 */
b69ab31179export type DiffSignalSummary =
b69ab31180 | 'running'
b69ab31181 | 'pass'
b69ab31182 | 'failed'
b69ab31183 | 'warning'
b69ab31184 | 'no-signal'
b69ab31185 | 'land-cancelled'
b69ab31186 | 'deferred';
b69ab31187
b69ab31188/**
b69ab31189 * Information about a land request, specific to each Code Review Provider.
b69ab31190 */
b69ab31191export type LandInfo = undefined | InternalTypes['PhabricatorLandInfo'];
b69ab31192
b69ab31193/**
b69ab31194 * Information used to confirm a land from a given initiation LandInfo.
b69ab31195 */
b69ab31196export type LandConfirmationInfo = undefined | InternalTypes['PhabricatorLandConfirmationInfo'];
b69ab31197
b69ab31198/** An error causing the entire Repository to not be accessible */
b69ab31199export type RepositoryError =
b69ab31200 | {
b69ab31201 type: 'invalidCommand';
b69ab31202 command: string;
b69ab31203 path: string | undefined;
b69ab31204 }
b69ab31205 | {type: 'edenFsUnhealthy'; cwd: string}
b69ab31206 | {type: 'cwdNotARepository'; cwd: string}
b69ab31207 | {type: 'cwdDoesNotExist'; cwd: string}
b69ab31208 | {
b69ab31209 type: 'unknownError';
b69ab31210 error: Error;
b69ab31211 };
b69ab31212
b69ab31213export type CwdInfo = {
b69ab31214 /** Full cwd path, like /Users/username/repoRoot/some/subfolder */
b69ab31215 cwd: AbsolutePath;
b69ab31216 /** Full real path to the repository root, like /Users/username/repoRoot
b69ab31217 * Undefined for cwds that are not valid repositories */
b69ab31218 repoRoot?: AbsolutePath;
b69ab31219 /** Label for a cwd, which is <repoBasename>/<cwd>, like 'sapling/addons'.
b69ab31220 * Intended for display. Undefined for cwds that are not valid repositories */
b69ab31221 repoRelativeCwdLabel?: string;
b69ab31222};
b69ab31223
b69ab31224export type RepoInfo = RepositoryError | ValidatedRepoInfo;
b69ab31225
b69ab31226/** Proven valid repositories with valid repoRoot / dotdir */
b69ab31227export type ValidatedRepoInfo = {
b69ab31228 type: 'success';
b69ab31229 /** Which cli command name this repository should use for sapling, e.g. `sl` */
b69ab31230 command: string;
b69ab31231 /**
b69ab31232 * Direct repo root that is the closest to the cwd.
b69ab31233 */
b69ab31234 repoRoot: AbsolutePath;
b69ab31235 /**
b69ab31236 * All the nested repo roots up to the system root,
b69ab31237 * in the order of furthest to closest to the cwd.
b69ab31238 *
b69ab31239 * For instance, ['/repo', '/repo/submodule', '/repo/submodule/nested_submodule']
b69ab31240 *
b69ab31241 * The repoRoot above is not simply replaced with this because of different error conditions -
b69ab31242 * Sapling may refuse to return the list when it's nested illegally, while repoRoot can still be valid.
b69ab31243 */
b69ab31244 repoRoots?: AbsolutePath[];
b69ab31245 /**
b69ab31246 * Directory containing sl internal information for this repo, usually `${repoRoot}/.sl`.
b69ab31247 */
b69ab31248 dotdir: AbsolutePath;
b69ab31249 codeReviewSystem: CodeReviewSystem;
b69ab31250 pullRequestDomain: string | undefined;
b69ab31251 preferredSubmitCommand?: PreferredSubmitCommand;
b69ab31252 isEdenFs: boolean;
b69ab31253};
b69ab31254
b69ab31255export type ApplicationInfo = {
b69ab31256 platformName: string;
b69ab31257 version: string;
b69ab31258 logFilePath: string;
4bb999b259 readOnly?: boolean;
b69ab31260};
b69ab31261
b69ab31262/**
b69ab31263 * Which "mode" for the App to run. Controls the basic rendering.
b69ab31264 * Useful to render full-screen alternate views.
b69ab31265 * isl => normal, full ISL
b69ab31266 * comparison => just the comparison viewer is rendered, set to some specific comparison
b69ab31267 */
b69ab31268export type AppMode =
b69ab31269 | {
b69ab31270 mode: 'isl';
b69ab31271 }
b69ab31272 | {
b69ab31273 mode: 'comparison';
b69ab31274 comparison: Comparison;
b69ab31275 };
b69ab31276
b69ab31277export type CodeReviewSystem =
b69ab31278 | {
b69ab31279 type: 'github';
b69ab31280 owner: string;
b69ab31281 repo: string;
b69ab31282 /** github enterprise may use a different hostname than 'github.com' */
b69ab31283 hostname: string;
b69ab31284 }
b69ab31285 | {
b69ab31286 type: 'phabricator';
b69ab31287 repo: string;
b69ab31288 callsign?: string;
b69ab31289 }
e272900290 | {
e272900291 type: 'grove';
e272900292 /** Grove API base URL, e.g. https://grove.host/api */
e272900293 apiUrl: string;
e272900294 /** Repository owner (username or org) */
e272900295 owner: string;
e272900296 /** Repository name */
e272900297 repo: string;
23ab721298 /** Whether pushes should automatically create diffs for code review */
23ab721299 requireDiffs?: boolean;
e272900300 }
b69ab31301 | {
b69ab31302 type: 'none';
b69ab31303 }
b69ab31304 | {
b69ab31305 type: 'unknown';
b69ab31306 path?: string;
b69ab31307 };
b69ab31308
b69ab31309export type PreferredSubmitCommand = 'pr' | 'ghstack' | 'push';
b69ab31310
b69ab31311export type StableCommitMetadata = {
b69ab31312 value: string;
b69ab31313 description: string;
b69ab31314 isRecommended?: boolean;
b69ab31315};
b69ab31316
b69ab31317export type StableCommitFetchConfig = {
b69ab31318 template: string;
b69ab31319 parse: (data: string) => Array<StableCommitMetadata>;
b69ab31320};
b69ab31321
b69ab31322export type StableLocationData = {
b69ab31323 /** Stables found automatically from recent builds */
b69ab31324 stables: Array<Result<StableInfo>>;
b69ab31325 /** Stables that enabled automatically for certain users */
b69ab31326 special: Array<Result<StableInfo>>;
b69ab31327 /** Stables entered in the UI. Map of provided name to a Result. null means the stable is loading. */
b69ab31328 manual: Record<string, Result<StableInfo> | null>;
b69ab31329 /** Whether this repo supports entering custom stables via input. */
b69ab31330 repoSupportsCustomStables: boolean;
b69ab31331};
b69ab31332export type StableInfo = {
b69ab31333 hash: string;
b69ab31334 name: string;
b69ab31335 /** If present, this is informational text, like the reason it's been added */
b69ab31336 byline?: string;
b69ab31337 /** If present, this is extra details that might be shown in a tooltip */
b69ab31338 info?: string;
b69ab31339 date: Date;
b69ab31340};
b69ab31341
b69ab31342export type SlocInfo = {
b69ab31343 /** Significant lines of code for commit */
b69ab31344 sloc: number | undefined;
b69ab31345};
b69ab31346
b69ab31347export type CommitInfo = {
b69ab31348 title: string;
b69ab31349 hash: Hash;
b69ab31350 /**
b69ab31351 * This matches the "parents" information from source control without the
b69ab31352 * "null" hash. Most of the time a commit has 1 parent. For merges there
b69ab31353 * could be 2 or more parents. The initial commit (and initial commits of
b69ab31354 * other merged-in repos) have no parents.
b69ab31355 */
b69ab31356 parents: ReadonlyArray<Hash>;
b69ab31357 /**
b69ab31358 * Grandparents are the closest but indirect ancestors in a set of commits .
b69ab31359 * In ISL, this is used for connecting nodes whose direct parents are NOT present.
b69ab31360 * Note that this field will be empty by design when direct parents are already present in the set.
b69ab31361 * See eden/scm/tests/test-template-grandparents.t for examples.
b69ab31362 */
b69ab31363 grandparents: ReadonlyArray<Hash>;
b69ab31364 phase: CommitPhaseType;
b69ab31365 /**
b69ab31366 * Whether this commit is the "." (working directory parent).
b69ab31367 * It is the parent of "wdir()" or the "You are here" virtual commit.
b69ab31368 */
b69ab31369 isDot: boolean;
b69ab31370 author: string;
b69ab31371 date: Date;
b69ab31372 description: string;
b69ab31373 bookmarks: ReadonlyArray<string>;
b69ab31374 remoteBookmarks: ReadonlyArray<string>;
b69ab31375 /** if this commit is obsolete, it is succeeded by another commit */
b69ab31376 successorInfo?: Readonly<SuccessorInfo>;
b69ab31377 /**
b69ab31378 * Closest predecessors (not all recursive predecessors, which can be a long
b69ab31379 * chain and hurt performance). Useful to deal with optimistic states where
b69ab31380 * we know the hashes of predecessors (commits being rewritten) but not their
b69ab31381 * successors (rewritten result).
b69ab31382 *
b69ab31383 * Most of the time a commit only has one predecessor. In case of a fold
b69ab31384 * there are multiple predecessors.
b69ab31385 */
b69ab31386 closestPredecessors?: ReadonlyArray<Hash>;
b69ab31387 /**
b69ab31388 * If this is a fake optimistic commit created by a running Operation,
b69ab31389 * this is the revset that can be used by sl to find the real commit.
b69ab31390 * This is only valid after the operation which creates this commit has completed.
b69ab31391 */
b69ab31392 optimisticRevset?: Revset;
b69ab31393 /** only a subset of the total changed file paths for this commit.
b69ab31394 * File statuses must be fetched separately for performance.
b69ab31395 */
b69ab31396 filePathsSample: ReadonlyArray<RepoRelativePath>;
b69ab31397 totalFileCount: number;
b69ab31398 /** @see {@link DiffId} */
b69ab31399 diffId?: DiffId;
b69ab31400 isFollower?: boolean;
b69ab31401 stableCommitMetadata?: ReadonlyArray<StableCommitMetadata>;
b69ab31402 /**
b69ab31403 * Longest path prefix shared by all files in this commit.
b69ab31404 * For example, if a commit changes files like `a/b/c` and `a/b/d`, this is `a/b/`.
b69ab31405 * Note: this always acts on `/` delimited paths, and is done on complete subdir names,
b69ab31406 * never on matching prefixes of directories. For example, `a/dir1/a` and `a/dir2/a`
b69ab31407 * have `a/` as the common prefix, not `a/dir`.
b69ab31408 * If no commonality is found (due to edits to top level files or multiple subdirs), this is empty string.
b69ab31409 * This can be useful to determine if a commit is relevant to your cwd.
b69ab31410 */
b69ab31411 maxCommonPathPrefix: RepoRelativePath;
b69ab31412
b69ab31413 fullRepoBranch?: InternalTypes['FullRepoBranch'];
b69ab31414};
b69ab31415export type SuccessorInfo = {
b69ab31416 hash: string;
b69ab31417 type: string;
b69ab31418};
b69ab31419export type CommitPhaseType = 'public' | 'draft';
b69ab31420export type ChangedFileStatus = 'A' | 'M' | 'R' | '?' | '!' | 'U' | 'Resolved';
b69ab31421export type ChangedFile = {
b69ab31422 path: RepoRelativePath;
b69ab31423 status: ChangedFileStatus;
b69ab31424 /**
b69ab31425 * If this file is copied from another, this is the path of the original file
b69ab31426 * If this file is renamed from another, this is the path of the original file, and another change of type 'R' will exist.
b69ab31427 * */
b69ab31428 copy?: RepoRelativePath;
b69ab31429};
b69ab31430export enum ChangedFileMode {
b69ab31431 // "Regular" is from the perspective of the ISL - it's a file that's not a submodule.
b69ab31432 // This can be different from more granular categorizations in the underlying
b69ab31433 // source control system, such as symlinks, executables, and gitlinks.
b69ab31434 Regular = 'regular',
b69ab31435 Submodule = 'submodule',
b69ab31436}
b69ab31437
b69ab31438export type FilesSample = {
b69ab31439 filesSample: Array<ChangedFile>;
b69ab31440 totalFileCount: number;
b69ab31441};
b69ab31442
b69ab31443/** A revset that selects for a commit which we only have a fake optimistic preview of */
b69ab31444export type OptimisticRevset = {type: 'optimistic-revset'; revset: Revset; fake: string};
b69ab31445/** A revset that selects for the latest version of a commit hash */
b69ab31446export type SucceedableRevset = {type: 'succeedable-revset'; revset: Revset};
b69ab31447/** A revset that selects for a specific commit, without considering any successors */
b69ab31448export type ExactRevset = {type: 'exact-revset'; revset: Revset};
b69ab31449
b69ab31450/**
b69ab31451 * Most arguments to eden commands are literal `string`s, except:
b69ab31452 * - When specifying file paths, the server needs to know which args are files to convert them to be cwd-relative.
b69ab31453 * - For long file lists, we pass them in a single bulk arg, which will be passed via stdin instead
b69ab31454 * to avoid command line length limits.
b69ab31455 * - When specifying commit hashes, you may be acting on optimistic version of those hashes.
b69ab31456 * The server can re-write hashes using a revset that transforms into the latest successor instead.
b69ab31457 * This allows you to act on the optimistic versions of commits in queued commands,
b69ab31458 * without a race with the server telling you new versions of those hashes.
b69ab31459 * - If you want an exact commit that's already obsolete or should never be replaced with a succeeded version,
b69ab31460 * you can use an exact revset.
b69ab31461 * - Specifying config values to override for just this command, so they can be processed separately.
b69ab31462 */
b69ab31463export type CommandArg =
b69ab31464 | string
b69ab31465 | {type: 'repo-relative-file'; path: RepoRelativePath}
b69ab31466 | {type: 'repo-relative-file-list'; paths: Array<RepoRelativePath>}
b69ab31467 | {type: 'config'; key: string; value: string}
b69ab31468 | ExactRevset
b69ab31469 | SucceedableRevset
b69ab31470 | OptimisticRevset;
b69ab31471
b69ab31472/**
b69ab31473 * What process to execute a given operation in, such as `sl`
b69ab31474 */
b69ab31475export enum CommandRunner {
b69ab31476 Sapling = 'sl',
b69ab31477 /**
b69ab31478 * Use the configured Code Review provider to run this command,
b69ab31479 * such as a non-sapling external submit command
b69ab31480 */
b69ab31481 CodeReviewProvider = 'codeReviewProvider',
b69ab31482 /** Internal arcanist commands */
b69ab31483 InternalArcanist = 'arc',
b69ab31484 /** Configerator conf commands */
b69ab31485 Conf = 'conf',
b69ab31486}
b69ab31487
b69ab31488/**
b69ab31489 * {@link CommandArg} representing a hash or revset which should be re-written
b69ab31490 * to the latest successor of that revset when being run.
b69ab31491 * This enables queued commands to act on optimistic state without knowing
b69ab31492 * the optimistic commit's hashes directly.
b69ab31493 */
b69ab31494export function succeedableRevset(revset: Revset): SucceedableRevset {
b69ab31495 return {type: 'succeedable-revset', revset};
b69ab31496}
b69ab31497
b69ab31498/**
b69ab31499 * {@link CommandArg} representing a hash or revset for a fake optimistic commit.
b69ab31500 * This enables queued commands to act on optimistic state without knowing
b69ab31501 * the optimistic commit's hashes directly, and without knowing a predecessor hash at all.
b69ab31502 * The fake optimistic commit hash is also stored to know what the revset refers to.
b69ab31503 */
b69ab31504export function optimisticRevset(revset: Revset, fake: string): OptimisticRevset {
b69ab31505 return {type: 'optimistic-revset', revset, fake};
b69ab31506}
b69ab31507
b69ab31508/**
b69ab31509 * {@link CommandArg} representing a hash or revset which should *not* be re-written
b69ab31510 * to the latest successor of that revset when being run.
b69ab31511 * This uses the revset directly in the command run. Useful if you want to specifically
b69ab31512 * use an obsolete commit in an operation.
b69ab31513 */
b69ab31514export function exactRevset(revset: Revset): ExactRevset {
b69ab31515 return {type: 'exact-revset', revset};
b69ab31516}
b69ab31517
b69ab31518/* Subscriptions */
b69ab31519
b69ab31520/**
b69ab31521 * A subscription allows the client to ask for a stream of events from the server.
b69ab31522 * The client may send subscribe and corresponding unsubscribe messages.
b69ab31523 * Subscriptions are indexed by a subscriptionId field.
b69ab31524 * Responses to subscriptions are of type Fetched<T>
b69ab31525 */
b69ab31526export type Subscribe<K extends string> =
b69ab31527 | {type: `subscribe${K}`; subscriptionID: string}
b69ab31528 | {type: `unsubscribe${K}`; subscriptionID: string};
b69ab31529
b69ab31530/** Responses to subscriptions, including data and the time duration the fetch lasted */
b69ab31531export type Fetched<K extends string, V> = {
b69ab31532 type: `fetched${K}`;
b69ab31533 subscriptionID: string;
b69ab31534} & V;
b69ab31535
b69ab31536export type UncommittedChanges = Array<ChangedFile>;
b69ab31537export type FetchedUncommittedChanges = {
b69ab31538 files: Result<UncommittedChanges>;
b69ab31539 fetchStartTimestamp: number;
b69ab31540 fetchCompletedTimestamp: number;
b69ab31541};
b69ab31542
b69ab31543export type BeganFetchingUncommittedChangesEvent = {
b69ab31544 type: 'beganFetchingUncommittedChangesEvent';
b69ab31545};
b69ab31546
b69ab31547export type SmartlogCommits = Array<CommitInfo>;
b69ab31548export type FetchedCommits = {
b69ab31549 commits: Result<SmartlogCommits>;
b69ab31550 fetchStartTimestamp: number;
b69ab31551 fetchCompletedTimestamp: number;
b69ab31552};
b69ab31553
b69ab31554export type BeganFetchingSmartlogCommitsEvent = {
b69ab31555 type: 'beganFetchingSmartlogCommitsEvent';
b69ab31556};
b69ab31557
b69ab31558export type ShelvedChange = {
b69ab31559 hash: Hash;
b69ab31560 name: string;
b69ab31561 date: Date;
b69ab31562 filesSample: Array<ChangedFile>;
b69ab31563 totalFileCount: number;
b69ab31564 description: string;
b69ab31565};
b69ab31566
b69ab31567export enum CommitCloudBackupStatus {
b69ab31568 InProgress = 'IN_PROGRESS',
b69ab31569 Pending = 'PENDING',
b69ab31570 Failed = 'FAILED',
b69ab31571}
b69ab31572export type CommitCloudSyncState = {
b69ab31573 isFetching?: boolean;
b69ab31574 /** Last time we ran commands to check the cloud status */
b69ab31575 lastChecked: Date;
b69ab31576 /** Last time there was an actual sync */
b69ab31577 lastBackup?: Date;
b69ab31578 currentWorkspace?: string;
b69ab31579 workspaceChoices?: Array<string>;
b69ab31580 commitStatuses?: Map<Hash, CommitCloudBackupStatus>;
b69ab31581 fetchError?: Error;
b69ab31582 syncError?: Error;
b69ab31583 workspaceError?: Error;
b69ab31584 // if true, commit cloud is disabled in this repo
b69ab31585 isDisabled?: boolean;
b69ab31586};
b69ab31587
b69ab31588export type Submodule = {
b69ab31589 name: string;
b69ab31590 path: RepoRelativePath;
b69ab31591 url: string;
b69ab31592 ref?: string;
b69ab31593 active: boolean;
b69ab31594};
b69ab31595/**
b69ab31596 * An undefined value if git submodules are not supported by the repo.
b69ab31597 * An error if unexpected errors occurred during the fetch process.
b69ab31598 */
b69ab31599export type FetchedSubmodules = Result<Submodule[] | undefined>;
b69ab31600export type SubmodulesByRoot = Map<AbsolutePath, FetchedSubmodules>;
b69ab31601
b69ab31602export type AlertSeverity = 'SEV 0' | 'SEV 1' | 'SEV 2' | 'SEV 3' | 'SEV 4' | 'UBN';
b69ab31603export type Alert = {
b69ab31604 key: string;
b69ab31605 title: string;
b69ab31606 description: string;
b69ab31607 url: string;
b69ab31608 severity: AlertSeverity;
b69ab31609 ['show-in-isl']: boolean;
b69ab31610 ['isl-version-regex']?: string;
b69ab31611};
b69ab31612
b69ab31613/**
b69ab31614 * A file can be auto-generated, partially auto-generated, or not generated (manual).
b69ab31615 * Numbered according to expected visual sort order.
b69ab31616 */
b69ab31617export enum GeneratedStatus {
b69ab31618 Manual = 0,
b69ab31619 PartiallyGenerated = 1,
b69ab31620 Generated = 2,
b69ab31621}
b69ab31622
b69ab31623export enum ConflictType {
b69ab31624 BothChanged = 'both_changed',
b69ab31625 DeletedInDest = 'dest_deleted',
b69ab31626 DeletedInSource = 'source_deleted',
b69ab31627}
b69ab31628
b69ab31629type ConflictInfo = {
b69ab31630 command: string;
b69ab31631 toContinue: string;
b69ab31632 toAbort: string;
b69ab31633 files: Array<ChangedFile & {conflictType: ConflictType}>;
b69ab31634 fetchStartTimestamp: number;
b69ab31635 fetchCompletedTimestamp: number;
b69ab31636 hashes?: {local?: string; other?: string};
b69ab31637};
b69ab31638export type MergeConflicts =
b69ab31639 | ({state: 'loading'} & AllUndefined<ConflictInfo>)
b69ab31640 | ({
b69ab31641 state: 'loaded';
b69ab31642 } & ConflictInfo);
b69ab31643
b69ab31644/* Operations */
b69ab31645
b69ab31646export type RunnableOperation = {
b69ab31647 args: Array<CommandArg>;
b69ab31648 id: string;
b69ab31649 stdin?: string | undefined;
b69ab31650 runner: CommandRunner;
b69ab31651 trackEventName: TrackEventName;
b69ab31652};
b69ab31653
b69ab31654export type OperationProgress =
b69ab31655 // another operation is running, so this one has been queued to run. Also include full state of the queue.
b69ab31656 | {id: string; kind: 'queue'; queue: Array<string>}
b69ab31657 // the server has started the process. This also servers as a "dequeue" notification. Also include full state of the queue.
b69ab31658 | {id: string; kind: 'spawn'; queue: Array<string>}
b69ab31659 | {id: string; kind: 'stderr'; message: string}
b69ab31660 | {id: string; kind: 'stdout'; message: string}
b69ab31661 // overally progress information, typically for a progress bar or progress not found directly in the stdout
b69ab31662 | {id: string; kind: 'progress'; progress: ProgressStep}
b69ab31663 // 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.
b69ab31664 | {id: string; kind: 'inlineProgress'; hash?: string; message?: string}
b69ab31665 | {id: string; kind: 'exit'; exitCode: number; timestamp: number}
b69ab31666 | {id: string; kind: 'error'; error: string}
b69ab31667 | {id: string; kind: 'warning'; warning: string}
b69ab31668 // used by requestMissedOperationProgress, client thinks this operation is running but server no longer knows about it.
b69ab31669 | {id: string; kind: 'forgot'};
b69ab31670
b69ab31671export type ProgressStep = {
b69ab31672 message: string;
b69ab31673 progress?: number;
b69ab31674 progressTotal?: number;
b69ab31675 unit?: string;
b69ab31676};
b69ab31677
b69ab31678export type OperationCommandProgressReporter = (
b69ab31679 ...args:
b69ab31680 | ['spawn']
b69ab31681 | ['stdout', string]
b69ab31682 | ['stderr', string]
b69ab31683 // null message -> clear inline progress for this hash. Null hash -> apply to all affected hashes (set message or clear)
b69ab31684 | [type: 'inlineProgress', hash?: string, message?: string]
b69ab31685 | ['progress', ProgressStep]
b69ab31686 | ['warning', string]
b69ab31687 | ['exit', number]
b69ab31688) => void;
b69ab31689
b69ab31690export type OperationProgressEvent = {type: 'operationProgress'} & OperationProgress;
b69ab31691
b69ab31692/** A line number starting from 1 */
b69ab31693export type OneIndexedLineNumber = Exclude<number, 0>;
b69ab31694
b69ab31695export type DiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint';
b69ab31696
b69ab31697export type Diagnostic = {
b69ab31698 range: {startLine: number; startCol: number; endLine: number; endCol: number};
b69ab31699 message: string;
b69ab31700 severity: DiagnosticSeverity;
b69ab31701 /** LSP providing this diagnostic, like "typescript" or "eslint" */
b69ab31702 source?: string;
b69ab31703 /** Code or name for this kind of diagnostic */
b69ab31704 code?: string;
b69ab31705};
b69ab31706
b69ab31707export type DiagnosticAllowlistValue =
b69ab31708 | {block: Set<string>; allow?: undefined}
b69ab31709 | {allow: Set<string>; block?: undefined};
b69ab31710export type DiagnosticAllowlist = Map<'warning' | 'error', Map<string, DiagnosticAllowlistValue>>;
b69ab31711
b69ab31712export type CodeReviewScope =
b69ab31713 | 'uncommitted changes'
b69ab31714 | 'current commit'
b69ab31715 | 'current commit and uncommitted changes';
b69ab31716
b69ab31717/* protocol */
b69ab31718
b69ab31719/**
b69ab31720 * messages sent by platform-specific (browser, vscode, electron) implementations
b69ab31721 * to be handled uniquely per server type.
b69ab31722 */
b69ab31723export type PlatformSpecificClientToServerMessages =
b69ab31724 | {type: 'platform/openFile'; path: RepoRelativePath; options?: {line?: OneIndexedLineNumber}}
b69ab31725 | {
b69ab31726 type: 'platform/openFiles';
b69ab31727 paths: ReadonlyArray<RepoRelativePath>;
b69ab31728 options?: {line?: OneIndexedLineNumber};
b69ab31729 }
b69ab31730 | {type: 'platform/openContainingFolder'; path: RepoRelativePath}
b69ab31731 | {type: 'platform/openDiff'; path: RepoRelativePath; comparison: Comparison}
b69ab31732 | {type: 'platform/openExternal'; url: string}
b69ab31733 | {type: 'platform/changeTitle'; title: string}
b69ab31734 | {type: 'platform/confirm'; message: string; details?: string | undefined}
b69ab31735 | {type: 'platform/subscribeToAvailableCwds'}
b69ab31736 | {type: 'platform/subscribeToUnsavedFiles'}
b69ab31737 | {type: 'platform/saveAllUnsavedFiles'}
b69ab31738 | {type: 'platform/setPersistedState'; key: string; data?: string}
b69ab31739 | {type: 'platform/subscribeToSuggestedEdits'}
b69ab31740 | {
b69ab31741 type: 'platform/resolveSuggestedEdits';
b69ab31742 action: 'accept' | 'reject';
b69ab31743 files: Array<AbsolutePath>;
b69ab31744 }
b69ab31745 | {
b69ab31746 type: 'platform/setVSCodeConfig';
b69ab31747 config: string;
b69ab31748 value: Json | undefined;
b69ab31749 scope: 'workspace' | 'global';
b69ab31750 }
b69ab31751 | {type: 'platform/checkForDiagnostics'; paths: Array<RepoRelativePath>}
b69ab31752 | {type: 'platform/executeVSCodeCommand'; command: string; args: Array<Json>}
b69ab31753 | {type: 'platform/subscribeToVSCodeConfig'; config: string}
b69ab31754 | {
b69ab31755 type: 'platform/resolveAllCommentsWithAI';
b69ab31756 diffId: string;
b69ab31757 comments: Array<DiffComment>;
b69ab31758 filePaths: Array<RepoRelativePath>;
b69ab31759 repoPath?: string;
b69ab31760 userContext?: string;
b69ab31761 }
b69ab31762 | {
b69ab31763 type: 'platform/resolveFailedSignalsWithAI';
b69ab31764 diffId: string;
b69ab31765 diffVersionNumber: number;
b69ab31766 repoPath?: string;
b69ab31767 userContext?: string;
b69ab31768 }
b69ab31769 | {
b69ab31770 type: 'platform/fillCommitMessageWithAI';
b69ab31771 id: string;
b69ab31772 source: 'commitInfoView' | 'smartAction';
b69ab31773 userContext?: string;
b69ab31774 }
b69ab31775 | {
b69ab31776 type: 'platform/splitCommitWithAI';
b69ab31777 diffCommit: string;
b69ab31778 args?: string;
b69ab31779 repoPath?: string;
b69ab31780 userContext?: string;
b69ab31781 }
b69ab31782 | {
b69ab31783 type: 'platform/createTestForModifiedCodeWithAI';
b69ab31784 }
b69ab31785 | {
b69ab31786 type: 'platform/recommendTestPlanWithAI';
b69ab31787 commitHash?: string;
b69ab31788 userContext?: string;
b69ab31789 }
b69ab31790 | {
b69ab31791 type: 'platform/generateSummaryWithAI';
b69ab31792 commitHash?: string;
b69ab31793 userContext?: string;
b69ab31794 }
b69ab31795 | {
b69ab31796 type: 'platform/validateChangesWithAI';
b69ab31797 userContext?: string;
b69ab31798 }
b69ab31799 | {
b69ab31800 type: 'platform/resolveAllConflictsWithAI';
b69ab31801 conflicts: MergeConflicts;
b69ab31802 userContext?: string;
b69ab31803 }
b69ab31804 | {
b69ab31805 type: 'platform/runAICodeReviewPlatform';
b69ab31806 cwd: string;
b69ab31807 }
b69ab31808 | {
b69ab31809 type: 'platform/runAICodeReviewChat';
b69ab31810 source: 'commitInfoView' | 'smartAction';
b69ab31811 reviewScope: CodeReviewScope;
b69ab31812 userContext?: string;
b69ab31813 }
b69ab31814 | {
b69ab31815 type: 'platform/subscribeToAIReviewComments';
b69ab31816 };
b69ab31817
b69ab31818/**
b69ab31819 * messages returned by platform-specific (browser, vscode, electron) server implementation,
b69ab31820 * usually in response to a platform-specific ClientToServer message
b69ab31821 */
b69ab31822export type PlatformSpecificServerToClientMessages =
b69ab31823 | {
b69ab31824 type: 'platform/confirmResult';
b69ab31825 result: boolean;
b69ab31826 }
b69ab31827 | {
b69ab31828 type: 'platform/availableCwds';
b69ab31829 options: Array<CwdInfo>;
b69ab31830 }
b69ab31831 | {type: 'platform/unsavedFiles'; unsaved: Array<{path: RepoRelativePath; uri: string}>}
b69ab31832 | {type: 'platform/savedAllUnsavedFiles'; success: boolean}
b69ab31833 | {
b69ab31834 type: 'platform/gotDiagnostics';
b69ab31835 diagnostics: Map<RepoRelativePath, Array<Diagnostic>>;
b69ab31836 }
b69ab31837 | {type: 'platform/onDidChangeSuggestedEdits'; files: Array<AbsolutePath>}
b69ab31838 | {
b69ab31839 type: 'platform/vscodeConfigChanged';
b69ab31840 config: string;
b69ab31841 value: Json | undefined;
b69ab31842 }
b69ab31843 | {
b69ab31844 type: 'platform/gotAIReviewComments';
b69ab31845 comments: Result<CodeReviewIssue[]>;
b69ab31846 };
b69ab31847
b69ab31848export type CodeReviewProviderSpecificClientToServerMessages =
b69ab31849 | never
b69ab31850 | InternalTypes['PhabricatorClientToServerMessages'];
b69ab31851
b69ab31852export type CodeReviewProviderSpecificServerToClientMessages =
b69ab31853 | never
b69ab31854 | InternalTypes['PhabricatorServerToClientMessages'];
b69ab31855
b69ab31856export type PageVisibility = 'focused' | 'visible' | 'hidden';
b69ab31857
b69ab31858export type FileABugFields = {title: string; description: string; repro: string};
b69ab31859export type FileABugProgress =
b69ab31860 | {status: 'starting'}
b69ab31861 | {
b69ab31862 status: 'inProgress';
b69ab31863 currentSteps: Record<string, 'blocked' | 'loading' | 'finished'>;
b69ab31864 }
b69ab31865 | {status: 'success'; taskNumber: string; taskLink: string}
b69ab31866 | {status: 'error'; error: Error};
b69ab31867export type FileABugProgressMessage = {type: 'fileBugReportProgress'} & FileABugProgress;
b69ab31868
b69ab31869export type SubscriptionKind =
b69ab31870 | 'uncommittedChanges'
b69ab31871 | 'smartlogCommits'
b69ab31872 | 'mergeConflicts'
b69ab31873 | 'submodules'
b69ab31874 | 'subscribedFullRepoBranches';
b69ab31875
b69ab31876export const allConfigNames = [
b69ab31877 // these config names are for compatibility.
b69ab31878 'isl.submitAsDraft',
b69ab31879 'isl.publishWhenReady',
b69ab31880 'isl.changedFilesDisplayType',
b69ab31881 // sapling config prefers foo-bar naming.
b69ab31882 'isl.pull-button-choice',
b69ab31883 'isl.show-stack-submit-confirmation',
b69ab31884 'isl.show-diff-number',
b69ab31885 'isl.render-compact',
b69ab31886 'isl.download-commit-should-goto',
b69ab31887 'isl.download-commit-rebase-type',
b69ab31888 'isl.experimental-features',
b69ab31889 'isl.hold-off-refresh-ms',
b69ab31890 'isl.sl-progress-enabled',
b69ab31891 'isl.use-sl-graphql',
b69ab31892 'github.preferred_submit_command',
b69ab31893 'isl.open-file-cmd',
b69ab31894 'isl.generated-files-regex',
b69ab31895 'ui.username',
b69ab31896 'ui.merge',
b69ab31897 'fbcodereview.code-browser-url',
b69ab31898 'extensions.commitcloud',
b69ab31899] as const;
b69ab31900
b69ab31901/** sl configs read by ISL */
b69ab31902export type ConfigName = (typeof allConfigNames)[number];
b69ab31903
b69ab31904/**
b69ab31905 * Not all configs should be set-able from the UI, for security.
b69ab31906 * Only configs which could not possibly allow code execution should be allowed.
b69ab31907 * This also includes values allowed to be passed in the args for Operations.
b69ab31908 * Most ISL configs are OK.
b69ab31909 */
b69ab31910export const settableConfigNames = [
b69ab31911 'isl.submitAsDraft',
b69ab31912 'isl.publishWhenReady',
b69ab31913 'isl.changedFilesDisplayType',
b69ab31914 'isl.pull-button-choice',
b69ab31915 'isl.show-stack-submit-confirmation',
b69ab31916 'isl.show-diff-number',
b69ab31917 'isl.render-compact',
b69ab31918 'isl.download-commit-should-goto',
b69ab31919 'isl.download-commit-rebase-type',
b69ab31920 'isl.experimental-features',
b69ab31921 'isl.hold-off-refresh-ms',
b69ab31922 'isl.use-sl-graphql',
b69ab31923 'isl.experimental-graph-renderer',
b69ab31924 'isl.generated-files-regex',
b69ab31925 'github.preferred_submit_command',
b69ab31926 'ui.allowemptycommit',
b69ab31927 'ui.merge',
b69ab31928 'amend.autorestack',
b69ab31929] as const;
b69ab31930
b69ab31931/** sl configs written to by ISL */
b69ab31932export type SettableConfigName = (typeof settableConfigNames)[number];
b69ab31933
b69ab31934/** local storage keys written by ISL */
b69ab31935export type LocalStorageName =
b69ab31936 | 'isl.drawer-state'
b69ab31937 | 'isl.bookmarks'
b69ab31938 | 'isl.recommended-bookmarks-reminder'
b69ab31939 | 'isl.recommended-bookmarks-onboarding'
b69ab31940 | 'isl.ui-zoom'
b69ab31941 | 'isl.has-shown-getting-started'
b69ab31942 | 'isl.dismissed-split-suggestion'
b69ab31943 | 'isl.amend-autorestack'
b69ab31944 | 'isl.dismissed-alerts'
b69ab31945 | 'isl.debug-react-tools'
b69ab31946 | 'isl.debug-redux-tools'
b69ab31947 | 'isl.condense-obsolete-stacks'
b69ab31948 | 'isl.deemphasize-cwd-irrelevant-commits'
b69ab31949 | 'isl.hide-cwd-irrelevant-stacks'
b69ab31950 | 'isl.split-suggestion-enabled'
b69ab31951 | 'isl.comparison-display-mode'
b69ab31952 | 'isl.expand-generated-files'
b69ab31953 | 'isl-color-theme'
b69ab31954 | 'isl.auto-resolve-before-continue'
b69ab31955 | 'isl.warn-about-diagnostics'
b69ab31956 | 'isl.hide-non-blocking-diagnostics'
b69ab31957 | 'isl.rebase-off-warm-warning-enabled'
b69ab31958 | 'isl.distant-rebase-warning-enabled'
b69ab31959 | 'isl.rebase-onto-master-warning-enabled'
b69ab31960 | 'isl.experimental-features-local-override'
b69ab31961 | 'isl.partial-abort'
b69ab31962 | 'isl.smart-actions-order'
b69ab31963 // The keys below are prefixes, with further dynamic keys appended afterwards
b69ab31964 | 'isl.edited-commit-messages:'
b69ab31965 | 'isl.first-pass-comments:';
b69ab31966
b69ab31967export type ClientToServerMessage =
b69ab31968 | {type: 'heartbeat'; id: string}
b69ab31969 | {type: 'stress'; id: number; time: number; message: string}
b69ab31970 | {type: 'refresh'}
b69ab31971 | {type: 'clientReady'}
b69ab31972 | {type: 'getConfig'; name: ConfigName}
b69ab31973 | {type: 'setConfig'; name: SettableConfigName; value: string}
b69ab31974 | {type: 'setDebugLogging'; name: 'debug' | 'verbose'; enabled: boolean}
b69ab31975 | {type: 'changeCwd'; cwd: string}
b69ab31976 | {type: 'track'; data: TrackDataWithEventName}
b69ab31977 | {type: 'fileBugReport'; data: FileABugFields; uiState?: Json; collectRage: boolean}
b69ab31978 | {type: 'runOperation'; operation: RunnableOperation}
b69ab31979 | {type: 'abortRunningOperation'; operationId: string}
b69ab31980 | {type: 'fetchActiveAlerts'}
b69ab31981 | {type: 'fetchGeneratedStatuses'; paths: Array<RepoRelativePath>}
b69ab31982 | {type: 'fetchCommitMessageTemplate'}
b69ab31983 | {type: 'fetchShelvedChanges'}
b69ab31984 | {type: 'fetchLatestCommit'; revset: string}
b69ab31985 | {type: 'fetchCommitChangedFiles'; hash: Hash; limit?: number}
b69ab31986 | {
b69ab31987 type: 'uploadFile';
b69ab31988 filename: string;
b69ab31989 id: string;
b69ab31990 b64Content: string;
b69ab31991 }
b69ab31992 | {type: 'renderMarkup'; markup: string; id: number}
b69ab31993 | {type: 'typeahead'; kind: TypeaheadKind; query: string; id: string}
b69ab31994 | {type: 'requestRepoInfo'}
b69ab31995 | {type: 'requestApplicationInfo'}
b69ab31996 | {type: 'requestMissedOperationProgress'; operationId: string}
b69ab31997 | {type: 'fetchAvatars'; authors: Array<string>}
b69ab31998 | {type: 'fetchCommitCloudState'}
b69ab31999 | {type: 'fetchDiffSummaries'; diffIds?: Array<DiffId>}
e7069e11000 | {type: 'fetchCanopySignals'}
b69ab311001 | {type: 'fetchDiffComments'; diffId: DiffId}
b69ab311002 | {type: 'fetchLandInfo'; topOfStack: DiffId}
b69ab311003 | {type: 'fetchAndSetStables'; additionalStables: Array<string>}
b69ab311004 | {type: 'fetchStableLocationAutocompleteOptions'}
b69ab311005 | {type: 'confirmLand'; landConfirmationInfo: LandConfirmationInfo}
b69ab311006 | {type: 'getSuggestedReviewers'; context: {paths: Array<string>}; key: string}
b69ab311007 | {type: 'getConfiguredMergeTool'}
b69ab311008 | {type: 'updateRemoteDiffMessage'; diffId: DiffId; title: string; description: string}
b69ab311009 | {type: 'pageVisibility'; state: PageVisibility}
b69ab311010 | {type: 'getRepoUrlAtHash'; revset: Revset; path?: string}
b69ab311011 | {type: 'requestComparison'; comparison: Comparison}
b69ab311012 | {
b69ab311013 type: 'requestComparisonContextLines';
b69ab311014 id: {
b69ab311015 comparison: Comparison;
b69ab311016 path: RepoRelativePath;
b69ab311017 };
b69ab311018 start: number;
b69ab311019 numLines: number;
b69ab311020 }
b69ab311021 | {type: 'loadMoreCommits'}
b69ab311022 | {type: 'subscribe'; kind: SubscriptionKind; subscriptionID: string}
b69ab311023 | {type: 'unsubscribe'; kind: SubscriptionKind; subscriptionID: string}
b69ab311024 | {type: 'exportStack'; revs: string; assumeTracked?: Array<string>}
b69ab311025 | {type: 'importStack'; stack: ImportStack}
b69ab311026 | {type: 'fetchQeFlag'; name: string}
b69ab311027 | {type: 'fetchFeatureFlag'; name: string}
b69ab311028 | {type: 'bulkFetchFeatureFlags'; id: string; names: Array<string>}
b69ab311029 | {type: 'fetchInternalUserInfo'}
b69ab311030 | {type: 'fetchDevEnvType'; id: string}
b69ab311031 | {type: 'splitCommitWithAI'; id: string; diffCommit: DiffCommit; args: Args}
b69ab311032 | {type: 'gotUiState'; state: string}
6c9fcae1033 | {type: 'fetchGroveOwners'}
6c9fcae1034 | {type: 'createGroveRepo'; name: string; owner?: string}
b69ab311035 | CodeReviewProviderSpecificClientToServerMessages
b69ab311036 | PlatformSpecificClientToServerMessages
b69ab311037 | {type: 'fetchSignificantLinesOfCode'; hash: Hash; excludedFiles: string[]}
b69ab311038 | {
b69ab311039 type: 'fetchPendingSignificantLinesOfCode';
b69ab311040 requestId: number;
b69ab311041 hash: Hash;
b69ab311042 includedFiles: string[];
b69ab311043 }
b69ab311044 | {
b69ab311045 type: 'fetchPendingAmendSignificantLinesOfCode';
b69ab311046 requestId: number;
b69ab311047 hash: Hash;
b69ab311048 includedFiles: string[];
b69ab311049 }
b69ab311050 | {
b69ab311051 type: 'fetchGkDetails';
b69ab311052 id: string;
b69ab311053 name: string;
b69ab311054 }
b69ab311055 | {
b69ab311056 type: 'fetchJkDetails';
b69ab311057 id: string;
b69ab311058 names: string[];
b69ab311059 }
b69ab311060 | {
b69ab311061 type: 'fetchKnobsetDetails';
b69ab311062 id: string;
b69ab311063 configPath: string;
b69ab311064 }
b69ab311065 | {
b69ab311066 type: 'fetchQeDetails';
b69ab311067 id: string;
b69ab311068 name: string;
b69ab311069 }
b69ab311070 | {
b69ab311071 type: 'fetchTaskDetails';
b69ab311072 id: string;
b69ab311073 taskNumber: number;
b69ab311074 }
b69ab311075 | {
b69ab311076 type: 'fetchABPropDetails';
b69ab311077 id: string;
b69ab311078 name: string;
b69ab311079 }
b69ab311080 | {
b69ab311081 type: 'runDevmateCommand';
b69ab311082 args: Array<string>;
b69ab311083 cwd: string;
b69ab311084 requestId: string;
b69ab311085 }
b69ab311086 | {
b69ab311087 type: 'fetchSubscribedFullRepoBranches';
b69ab311088 id: string;
b69ab311089 }
b69ab311090 | {
b69ab311091 type: 'fetchFullRepoBranchAllChangedFiles';
b69ab311092 id: string;
b69ab311093 fullRepoBranch: InternalTypes['FullRepoBranch'];
b69ab311094 }
b69ab311095 | {
b69ab311096 type: 'fetchFullRepoBranchMergeSubtreePaths';
b69ab311097 id: string;
b69ab311098 fullRepoBranch: InternalTypes['FullRepoBranch'];
b69ab311099 paths: Array<RepoRelativePath>;
b69ab311100 }
b69ab311101 | {
b69ab311102 type: 'subscribeToFullRepoBranch';
b69ab311103 id: string;
b69ab311104 fullRepoBranch: InternalTypes['FullRepoBranch'];
b69ab311105 }
b69ab311106 | {
b69ab311107 type: 'unsubscribeToFullRepoBranch';
b69ab311108 id: string;
b69ab311109 fullRepoBranch: InternalTypes['FullRepoBranch'];
b69ab311110 };
b69ab311111
b69ab311112export type SubscriptionResultsData = {
b69ab311113 uncommittedChanges: FetchedUncommittedChanges;
b69ab311114 smartlogCommits: FetchedCommits;
b69ab311115 mergeConflicts: MergeConflicts | undefined;
b69ab311116 submodules: SubmodulesByRoot;
b69ab311117 subscribedFullRepoBranches: Array<InternalTypes['FullRepoBranch']>;
b69ab311118};
b69ab311119
b69ab311120export type SubscriptionResult<K extends SubscriptionKind> = {
b69ab311121 type: 'subscriptionResult';
b69ab311122 subscriptionID: string;
b69ab311123 kind: K;
b69ab311124 data: SubscriptionResultsData[K];
b69ab311125};
b69ab311126
b69ab311127export type ServerToClientMessage =
b69ab311128 | SubscriptionResult<'smartlogCommits'>
b69ab311129 | SubscriptionResult<'uncommittedChanges'>
b69ab311130 | SubscriptionResult<'mergeConflicts'>
b69ab311131 | SubscriptionResult<'submodules'>
b69ab311132 | SubscriptionResult<'subscribedFullRepoBranches'>
b69ab311133 | BeganFetchingUncommittedChangesEvent
b69ab311134 | BeganFetchingSmartlogCommitsEvent
b69ab311135 | {
b69ab311136 type: 'beganFetchingSubscribedFullRepoBranchesEvent';
b69ab311137 }
b69ab311138 | FileABugProgressMessage
b69ab311139 | {type: 'heartbeat'; id: string}
b69ab311140 | {type: 'stress'; id: number; time: number; message: string}
b69ab311141 | {type: 'gotConfig'; name: ConfigName; value: string | undefined}
b69ab311142 | {
b69ab311143 type: 'fetchedGeneratedStatuses';
b69ab311144 results: Record<RepoRelativePath, GeneratedStatus>;
b69ab311145 }
b69ab311146 | {type: 'fetchedActiveAlerts'; alerts: Array<Alert>}
b69ab311147 | {type: 'fetchedCommitMessageTemplate'; template: string}
b69ab311148 | {type: 'fetchedShelvedChanges'; shelvedChanges: Result<Array<ShelvedChange>>}
b69ab311149 | {type: 'fetchedLatestCommit'; info: Result<CommitInfo>; revset: string}
b69ab311150 | {
b69ab311151 type: 'fetchedCommitChangedFiles';
b69ab311152 hash: Hash;
b69ab311153 result: Result<FilesSample>;
b69ab311154 }
b69ab311155 | {type: 'typeaheadResult'; id: string; result: Array<TypeaheadResult>}
b69ab311156 | {type: 'applicationInfo'; info: ApplicationInfo}
b69ab311157 | {type: 'repoInfo'; info: RepoInfo; cwd?: string}
b69ab311158 | {type: 'repoError'; error: RepositoryError | undefined}
b69ab311159 | {type: 'fetchedAvatars'; avatars: Map<string, string>; authors: Array<string>}
b69ab311160 | {type: 'fetchedDiffSummaries'; summaries: Result<Map<DiffId, DiffSummary>>}
e7069e11161 | {type: 'fetchedCanopySignals'; runs: Array<{commitMessage: string; signal: DiffSignalSummary; runId?: number; commitId?: string}>}
b69ab311162 | {type: 'fetchedDiffComments'; diffId: DiffId; comments: Result<Array<DiffComment>>}
b69ab311163 | {type: 'fetchedLandInfo'; topOfStack: DiffId; landInfo: Result<LandInfo>}
b69ab311164 | {type: 'confirmedLand'; result: Result<undefined>}
b69ab311165 | {type: 'fetchedCommitCloudState'; state: Result<CommitCloudSyncState>}
b69ab311166 | {type: 'fetchedStables'; stables: StableLocationData}
b69ab311167 | {type: 'fetchedRecommendedBookmarks'; bookmarks: Array<string>}
b69ab311168 | {
b69ab311169 type: 'fetchedHiddenMasterBranchConfig';
b69ab311170 config: Record<string, Array<string>> | null;
b69ab311171 odType: string | null;
b69ab311172 cwd: string;
b69ab311173 }
b69ab311174 | {type: 'fetchedStableLocationAutocompleteOptions'; result: Result<Array<TypeaheadResult>>}
b69ab311175 | {type: 'renderedMarkup'; html: string; id: number}
b69ab311176 | {type: 'gotSuggestedReviewers'; reviewers: Array<string>; key: string}
b69ab311177 | {type: 'gotConfiguredMergeTool'; tool: string | undefined}
b69ab311178 | {type: 'updatedRemoteDiffMessage'; diffId: DiffId; error?: string}
b69ab311179 | {
b69ab311180 type: 'updateDraftCommitMessage';
b69ab311181 title: string;
b69ab311182 description: string;
b69ab311183 mode?: 'commit' | 'amend';
b69ab311184 hash?: string;
b69ab311185 }
b69ab311186 | {type: 'uploadFileResult'; id: string; result: Result<string>}
4fe1f341187 | {type: 'watchmanStatus'; status: 'initializing' | 'reconnecting' | 'healthy' | 'ended' | 'errored' | 'unavailable'}
b69ab311188 | {type: 'gotRepoUrlAtHash'; url: Result<string>}
b69ab311189 | {type: 'comparison'; comparison: Comparison; data: ComparisonData}
b69ab311190 | {type: 'comparisonContextLines'; path: RepoRelativePath; lines: Result<Array<string>>}
b69ab311191 | {type: 'beganLoadingMoreCommits'}
b69ab311192 | {type: 'commitsShownRange'; rangeInDays: number | undefined}
b69ab311193 | {type: 'additionalCommitAvailability'; moreAvailable: boolean}
b69ab311194 | {
b69ab311195 type: 'exportedStack';
b69ab311196 revs: string;
b69ab311197 assumeTracked: Array<string>;
b69ab311198 stack: ExportStack;
b69ab311199 error: string | undefined;
b69ab311200 }
b69ab311201 | {type: 'importedStack'; imported: ImportedStack; error: string | undefined}
b69ab311202 | {type: 'fetchedQeFlag'; name: string; passes: boolean}
b69ab311203 | {type: 'fetchedFeatureFlag'; name: string; passes: boolean}
b69ab311204 | {type: 'bulkFetchedFeatureFlags'; id: string; result: Record<string, boolean>}
b69ab311205 | {type: 'fetchedInternalUserInfo'; info: Serializable}
b69ab311206 | {type: 'fetchedDevEnvType'; envType: string; id: string}
b69ab311207 | {
b69ab311208 type: 'splitCommitWithAI';
b69ab311209 id: string;
b69ab311210 result: Result<ReadonlyArray<PartiallySelectedDiffCommit>>;
b69ab311211 }
b69ab311212 | {type: 'getUiState'}
b69ab311213 | OperationProgressEvent
6c9fcae1214 | {type: 'fetchedGroveOwners'; owners: Array<{name: string; type: 'user' | 'org'}>}
6c9fcae1215 | {type: 'createdGroveRepo'; result: Result<{owner: string; repo: string}>}
b69ab311216 | PlatformSpecificServerToClientMessages
b69ab311217 | CodeReviewProviderSpecificServerToClientMessages
b69ab311218 | {
b69ab311219 type: 'fetchedSignificantLinesOfCode';
b69ab311220 hash: Hash;
b69ab311221 result: Result<number>;
b69ab311222 }
b69ab311223 | {
b69ab311224 type: 'fetchedPendingSignificantLinesOfCode';
b69ab311225 requestId: number;
b69ab311226 hash: Hash;
b69ab311227 result: Result<number>;
b69ab311228 }
b69ab311229 | {
b69ab311230 type: 'fetchedPendingAmendSignificantLinesOfCode';
b69ab311231 requestId: number;
b69ab311232 hash: Hash;
b69ab311233 result: Result<number>;
b69ab311234 }
b69ab311235 | {
b69ab311236 type: 'fetchedGkDetails';
b69ab311237 id: string;
b69ab311238 result: Result<InternalTypes['InternalGatekeeper']>;
b69ab311239 }
b69ab311240 | {
b69ab311241 type: 'fetchedJkDetails';
b69ab311242 id: string;
b69ab311243 result: Result<InternalTypes['InternalJustknob']>;
b69ab311244 }
b69ab311245 | {
b69ab311246 type: 'fetchedKnobsetDetails';
b69ab311247 id: string;
b69ab311248 result: Result<InternalTypes['InternalKnobset']>;
b69ab311249 }
b69ab311250 | {
b69ab311251 type: 'fetchedQeDetails';
b69ab311252 id: string;
b69ab311253 result: Result<InternalTypes['InternalQuickExperiment']>;
b69ab311254 }
b69ab311255 | {
b69ab311256 type: 'fetchedABPropDetails';
b69ab311257 id: string;
b69ab311258 result: Result<InternalTypes['InternalMetaConfig']>;
b69ab311259 }
b69ab311260 | {
b69ab311261 type: 'fetchedTaskDetails';
b69ab311262 id: string;
b69ab311263 result: Result<InternalTypes['InternalTaskDetails']>;
b69ab311264 }
b69ab311265 | {
b69ab311266 type: 'devmateCommandResult';
b69ab311267 result: (
b69ab311268 | {
b69ab311269 type: 'value';
b69ab311270 stdout: string;
b69ab311271 }
b69ab311272 | {
b69ab311273 type: 'error';
b69ab311274 stderr: string;
b69ab311275 }
b69ab311276 ) & {requestId: string};
b69ab311277 }
b69ab311278 | {
b69ab311279 type: 'fetchedSubscribedFullRepoBranches';
b69ab311280 result: Result<Array<InternalTypes['FullRepoBranch']>>;
b69ab311281 }
b69ab311282 | {
b69ab311283 type: 'fetchedFullRepoBranchAllChangedFiles';
b69ab311284 id: string;
b69ab311285 result: Result<Array<ChangedFile>>;
b69ab311286 }
b69ab311287 | {
b69ab311288 type: 'fetchedFullRepoBranchMergeSubtreePaths';
b69ab311289 id: string;
b69ab311290 result: Result<Array<string>>;
b69ab311291 }
b69ab311292 | {
b69ab311293 type: 'openSplitViewForCommit';
b69ab311294 commitHash: string;
b69ab311295 commits?: Array<PartiallySelectedDiffCommit>;
b69ab311296 };
b69ab311297
b69ab311298export type Disposable = {
b69ab311299 dispose(): void;
b69ab311300};
b69ab311301
b69ab311302export type ComparisonData = {
b69ab311303 diff: Result<string>;
b69ab311304};
b69ab311305
b69ab311306export type MessageBusStatus =
b69ab311307 | {type: 'initializing'}
b69ab311308 | {type: 'open'}
b69ab311309 | {type: 'reconnecting'}
b69ab311310 | {type: 'error'; error?: string};
b69ab311311
b69ab311312export type ArcStableGKInfo = {
b69ab311313 gk: string;
b69ab311314 id: string;
b69ab311315 label: string;
b69ab311316};