feat(core): add mercurial adapter for vcs status and diff (#35141)
This commit is contained in:
parent
8d790a9ed5
commit
5657cec4f2
12 changed files with 769 additions and 99 deletions
|
|
@ -744,7 +744,7 @@ export type Project = {
|
|||
id: string
|
||||
worktree: string
|
||||
vcsDir?: string
|
||||
vcs?: "git"
|
||||
vcs?: "git" | "hg"
|
||||
time: {
|
||||
created: number
|
||||
initialized?: number
|
||||
|
|
|
|||
|
|
@ -444,6 +444,10 @@ import type {
|
|||
V2ShellRemoveResponses,
|
||||
V2SkillListErrors,
|
||||
V2SkillListResponses,
|
||||
V2VcsDiffErrors,
|
||||
V2VcsDiffResponses,
|
||||
V2VcsStatusErrors,
|
||||
V2VcsStatusResponses,
|
||||
VcsApplyErrors,
|
||||
VcsApplyResponses,
|
||||
VcsDiffErrors,
|
||||
|
|
@ -452,6 +456,7 @@ import type {
|
|||
VcsDiffResponses,
|
||||
VcsGetErrors,
|
||||
VcsGetResponses,
|
||||
VcsMode2,
|
||||
VcsStatusErrors,
|
||||
VcsStatusResponses,
|
||||
WorktreeCreateErrors,
|
||||
|
|
@ -7933,6 +7938,65 @@ export class ProjectCopy2 extends HeyApiClient {
|
|||
}
|
||||
}
|
||||
|
||||
export class Vcs2 extends HeyApiClient {
|
||||
/**
|
||||
* VCS status
|
||||
*
|
||||
* List uncommitted working-copy changes relative to the requested location.
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
location?: {
|
||||
directory?: string | null
|
||||
workspace?: string | null
|
||||
} | null
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }])
|
||||
return (options?.client ?? this.client).get<V2VcsStatusResponses, V2VcsStatusErrors, ThrowOnError>({
|
||||
url: "/api/vcs/status",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* VCS diff
|
||||
*
|
||||
* Diff the working copy against HEAD (mode git) or the default-branch merge base (mode branch) for the requested location.
|
||||
*/
|
||||
public diff<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
location?: {
|
||||
directory?: string | null
|
||||
workspace?: string | null
|
||||
} | null
|
||||
mode: VcsMode2
|
||||
context?: string | null
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "location" },
|
||||
{ in: "query", key: "mode" },
|
||||
{ in: "query", key: "context" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<V2VcsDiffResponses, V2VcsDiffErrors, ThrowOnError>({
|
||||
url: "/api/vcs/diff",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class V2 extends HeyApiClient {
|
||||
private _health?: Health
|
||||
get health(): Health {
|
||||
|
|
@ -8048,6 +8112,11 @@ export class V2 extends HeyApiClient {
|
|||
get projectCopy(): ProjectCopy2 {
|
||||
return (this._projectCopy ??= new ProjectCopy2({ client: this.client }))
|
||||
}
|
||||
|
||||
private _vcs?: Vcs2
|
||||
get vcs(): Vcs2 {
|
||||
return (this._vcs ??= new Vcs2({ client: this.client }))
|
||||
}
|
||||
}
|
||||
|
||||
export class OpencodeClient extends HeyApiClient {
|
||||
|
|
|
|||
|
|
@ -3194,6 +3194,13 @@ export type ProjectCopyError = {
|
|||
}
|
||||
}
|
||||
|
||||
export type VcsFileStatus2 = {
|
||||
file: string
|
||||
additions: number
|
||||
deletions: number
|
||||
status: "added" | "deleted" | "modified"
|
||||
}
|
||||
|
||||
export type EffectHttpApiErrorForbidden = {
|
||||
_tag: "Forbidden"
|
||||
}
|
||||
|
|
@ -3533,7 +3540,7 @@ export type FormAnswer = {
|
|||
[key: string]: FormValue
|
||||
}
|
||||
|
||||
export type ProjectVcs = "git"
|
||||
export type ProjectVcs = "git" | "hg"
|
||||
|
||||
export type ProjectIcon = {
|
||||
url?: string
|
||||
|
|
@ -6993,6 +7000,8 @@ export type ProjectCopyCopy = {
|
|||
directory: string
|
||||
}
|
||||
|
||||
export type VcsMode = "working" | "branch"
|
||||
|
||||
export type EventModelsDevRefreshed = {
|
||||
id: string
|
||||
type: "models-dev.refreshed"
|
||||
|
|
@ -11913,6 +11922,15 @@ export type ProjectCopyErrorV2 = {
|
|||
}
|
||||
}
|
||||
|
||||
export type VcsFileStatusV2 = {
|
||||
file: string
|
||||
additions: number
|
||||
deletions: number
|
||||
status: "added" | "deleted" | "modified"
|
||||
}
|
||||
|
||||
export type VcsMode2 = "working" | "branch"
|
||||
|
||||
export type AuthRemoveData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
|
@ -19512,6 +19530,82 @@ export type V2ProjectCopyRefreshResponses = {
|
|||
|
||||
export type V2ProjectCopyRefreshResponse = V2ProjectCopyRefreshResponses[keyof V2ProjectCopyRefreshResponses]
|
||||
|
||||
export type V2VcsStatusData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: {
|
||||
location?: {
|
||||
directory?: string | null
|
||||
workspace?: string | null
|
||||
} | null
|
||||
}
|
||||
url: "/api/vcs/status"
|
||||
}
|
||||
|
||||
export type V2VcsStatusErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestErrorV2
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedErrorV2
|
||||
}
|
||||
|
||||
export type V2VcsStatusError = V2VcsStatusErrors[keyof V2VcsStatusErrors]
|
||||
|
||||
export type V2VcsStatusResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
location: LocationInfo2
|
||||
data: Array<VcsFileStatusV2>
|
||||
}
|
||||
}
|
||||
|
||||
export type V2VcsStatusResponse = V2VcsStatusResponses[keyof V2VcsStatusResponses]
|
||||
|
||||
export type V2VcsDiffData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
location?: {
|
||||
directory?: string | null
|
||||
workspace?: string | null
|
||||
} | null
|
||||
mode: VcsMode2
|
||||
context?: string | null
|
||||
}
|
||||
url: "/api/vcs/diff"
|
||||
}
|
||||
|
||||
export type V2VcsDiffErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestErrorV2
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedErrorV2
|
||||
}
|
||||
|
||||
export type V2VcsDiffError = V2VcsDiffErrors[keyof V2VcsDiffErrors]
|
||||
|
||||
export type V2VcsDiffResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
location: LocationInfo2
|
||||
data: Array<SnapshotFileDiffV2>
|
||||
}
|
||||
}
|
||||
|
||||
export type V2VcsDiffResponse = V2VcsDiffResponses[keyof V2VcsDiffResponses]
|
||||
|
||||
export type PtyConnectData = {
|
||||
body?: never
|
||||
path: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue