feat: add file manager context actions (#3027)

* feat(app): add file manager context actions

* fix: reshape file context actions

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
nikuscs
2026-08-10 18:18:23 +02:00
committed by GitHub
co-authored by Mohamed Boudra
parent a98d154b6b
commit ca2b633286
36 changed files with 4159 additions and 227 deletions
+123
View File
@@ -1777,6 +1777,13 @@ export const CheckoutRefreshRequestSchema = z.object({
requestId: z.string(),
});
export const CheckoutDiscardChangesRequestSchema = z.object({
type: z.literal("checkout.discard_changes.request"),
cwd: z.string(),
paths: z.array(z.string()).min(1),
requestId: z.string(),
});
export const CheckoutPrCreateRequestSchema = z.object({
type: z.literal("checkout_pr_create_request"),
cwd: z.string(),
@@ -2204,6 +2211,8 @@ const DiffHunkSchema = z.object({
const ParsedDiffFileSchema = z.object({
path: z.string(),
// COMPAT(diffOldPath): added in v0.3.0, remove gate after 2027-02-09.
oldPath: z.string().optional(),
isNew: z.boolean(),
isDeleted: z.boolean(),
additions: z.number(),
@@ -2291,6 +2300,37 @@ export const FileWriteRequestSchema = z.object({
requestId: z.string(),
});
export const FileEntryCreateRequestSchema = z.object({
type: z.literal("fs.entry.create.request"),
cwd: z.string(),
parentPath: z.string(),
name: z.string(),
kind: z.enum(["file", "directory"]),
requestId: z.string(),
});
export const FileEntryRenameRequestSchema = z.object({
type: z.literal("fs.entry.rename.request"),
cwd: z.string(),
path: z.string(),
name: z.string(),
requestId: z.string(),
});
export const FileEntryDuplicateRequestSchema = z.object({
type: z.literal("fs.entry.duplicate.request"),
cwd: z.string(),
path: z.string(),
requestId: z.string(),
});
export const FileEntryDeleteRequestSchema = z.object({
type: z.literal("fs.entry.delete.request"),
cwd: z.string(),
path: z.string(),
requestId: z.string(),
});
export const ProjectIconRequestSchema = z.object({
type: z.literal("project_icon_request"),
cwd: z.string(),
@@ -2661,6 +2701,7 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
CheckoutPullRequestSchema,
CheckoutPushRequestSchema,
CheckoutRefreshRequestSchema,
CheckoutDiscardChangesRequestSchema,
CheckoutPrCreateRequestSchema,
CheckoutPrMergeRequestSchema,
CheckoutForgeSetAutoMergeRequestSchema,
@@ -2699,6 +2740,10 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
FileSubscribeRequestSchema,
FileUnsubscribeRequestSchema,
FileWriteRequestSchema,
FileEntryCreateRequestSchema,
FileEntryRenameRequestSchema,
FileEntryDuplicateRequestSchema,
FileEntryDeleteRequestSchema,
ProjectIconRequestSchema,
ProjectIconGetRequestSchema,
FileDownloadTokenRequestSchema,
@@ -3004,6 +3049,12 @@ export const ServerInfoStatusPayloadSchema = z
workspaceScriptManagement: z.boolean().optional(),
// COMPAT(projectCustomIcon): added in v0.2.0, remove after 2027-01-20.
projectCustomIcon: z.boolean().optional(),
// COMPAT(fsEntryOps): added in v0.3.0, remove gate after 2027-02-08.
fsEntryOps: z.boolean().optional(),
// COMPAT(fsEntryDuplicate): added in v0.3.0, remove gate after 2027-02-09.
fsEntryDuplicate: z.boolean().optional(),
// COMPAT(checkoutDiscardChanges): added in v0.3.0, remove gate after 2027-02-08.
checkoutDiscardChanges: z.boolean().optional(),
})
.optional(),
})
@@ -4493,6 +4544,16 @@ export const CheckoutGithubSetAutoMergeResponseSchema = z.object({
}),
});
export const CheckoutDiscardChangesResponseSchema = z.object({
type: z.literal("checkout.discard_changes.response"),
payload: z.object({
cwd: z.string(),
success: z.boolean(),
error: CheckoutErrorSchema.nullable(),
requestId: z.string(),
}),
});
export const CheckoutCommitsListResponseSchema = z.object({
type: z.literal("checkout.commits.list.response"),
payload: z.object({
@@ -4957,6 +5018,53 @@ export const FileWriteResponseSchema = z.object({
}),
});
export const FileEntryCreateResponseSchema = z.object({
type: z.literal("fs.entry.create.response"),
payload: z.object({
cwd: z.string(),
parentPath: z.string(),
path: z.string().nullable(),
success: z.boolean(),
error: z.string().nullable(),
requestId: z.string(),
}),
});
export const FileEntryRenameResponseSchema = z.object({
type: z.literal("fs.entry.rename.response"),
payload: z.object({
cwd: z.string(),
path: z.string(),
renamedPath: z.string().nullable(),
success: z.boolean(),
error: z.string().nullable(),
requestId: z.string(),
}),
});
export const FileEntryDuplicateResponseSchema = z.object({
type: z.literal("fs.entry.duplicate.response"),
payload: z.object({
cwd: z.string(),
path: z.string(),
duplicatedPath: z.string().nullable(),
success: z.boolean(),
error: z.string().nullable(),
requestId: z.string(),
}),
});
export const FileEntryDeleteResponseSchema = z.object({
type: z.literal("fs.entry.delete.response"),
payload: z.object({
cwd: z.string(),
path: z.string(),
success: z.boolean(),
error: z.string().nullable(),
requestId: z.string(),
}),
});
export const FileUpdateSchema = z.object({
type: z.literal("fs.file.update"),
payload: z.object({
@@ -5549,6 +5657,7 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
CheckoutPullResponseSchema,
CheckoutPushResponseSchema,
CheckoutRefreshResponseSchema,
CheckoutDiscardChangesResponseSchema,
CheckoutPrCreateResponseSchema,
CheckoutPrMergeResponseSchema,
CheckoutForgeSetAutoMergeResponseSchema,
@@ -5576,6 +5685,10 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
FileSubscribeResponseSchema,
FileUnsubscribeResponseSchema,
FileWriteResponseSchema,
FileEntryCreateResponseSchema,
FileEntryRenameResponseSchema,
FileEntryDuplicateResponseSchema,
FileEntryDeleteResponseSchema,
FileUpdateSchema,
ProjectIconResponseSchema,
ProjectIconGetResponseSchema,
@@ -5896,6 +6009,8 @@ export type CheckoutPushRequest = z.infer<typeof CheckoutPushRequestSchema>;
export type CheckoutPushResponse = z.infer<typeof CheckoutPushResponseSchema>;
export type CheckoutRefreshRequest = z.infer<typeof CheckoutRefreshRequestSchema>;
export type CheckoutRefreshResponse = z.infer<typeof CheckoutRefreshResponseSchema>;
export type CheckoutDiscardChangesRequest = z.infer<typeof CheckoutDiscardChangesRequestSchema>;
export type CheckoutDiscardChangesResponse = z.infer<typeof CheckoutDiscardChangesResponseSchema>;
export type CheckoutCommitFile = z.infer<typeof CheckoutCommitFileSchema>;
export type CheckoutCommit = z.infer<typeof CheckoutCommitSchema>;
export type CheckoutCommitsListRequest = z.infer<typeof CheckoutCommitsListRequestSchema>;
@@ -5999,6 +6114,14 @@ export type FileUnsubscribeRequest = z.infer<typeof FileUnsubscribeRequestSchema
export type FileUnsubscribeResponse = z.infer<typeof FileUnsubscribeResponseSchema>;
export type FileWriteRequest = z.infer<typeof FileWriteRequestSchema>;
export type FileWriteResponse = z.infer<typeof FileWriteResponseSchema>;
export type FileEntryCreateRequest = z.infer<typeof FileEntryCreateRequestSchema>;
export type FileEntryCreateResponse = z.infer<typeof FileEntryCreateResponseSchema>;
export type FileEntryRenameRequest = z.infer<typeof FileEntryRenameRequestSchema>;
export type FileEntryRenameResponse = z.infer<typeof FileEntryRenameResponseSchema>;
export type FileEntryDuplicateRequest = z.infer<typeof FileEntryDuplicateRequestSchema>;
export type FileEntryDuplicateResponse = z.infer<typeof FileEntryDuplicateResponseSchema>;
export type FileEntryDeleteRequest = z.infer<typeof FileEntryDeleteRequestSchema>;
export type FileEntryDeleteResponse = z.infer<typeof FileEntryDeleteResponseSchema>;
export type FileWriteResult = z.infer<typeof FileWriteResultSchema>;
export type FileUpdate = z.infer<typeof FileUpdateSchema>;
export type ProjectIconRequest = z.infer<typeof ProjectIconRequestSchema>;