mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 16:02:24 +00:00
* Create PRs directly from Source Control - Replace the modal flow with an inline PR composer in the sidebar - Keep PR creation state and validation scoped per worktree - Rename the recovery action to clarify it only pushes before creating PRs * Clean up fork PR remotes after worktree deletion - Track Orca-created push target remotes in worktree metadata - Reuse ownership markers when later worktrees share the same fork remote - Fetch only the selected PR base instead of every remote before drafting PRs - Mirror local branch cleanup for SSH worktree deletion * Stabilize pull request creation flow - Keep PR actions and composer fields locked while generation or creation is in flight - Refresh git status, branch comparison, and history after remote actions settle - Disable push-only actions on diverged branches so users sync first * Make PR context generation read-only - Stop rebasing or probing HEAD before collecting PR draft context - Allow git operations on known repo roots without refreshing worktree cache Co-authored-by: Orca <help@stably.ai> * fix: address review findings --------- Co-authored-by: Orca <help@stably.ai>
138 lines
4.1 KiB
TypeScript
138 lines
4.1 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
export const WorktreeSelector = z.object({
|
|
worktree: z
|
|
.unknown()
|
|
.transform((v) => (typeof v === 'string' ? v : ''))
|
|
.pipe(z.string().min(1, 'Missing worktree selector'))
|
|
})
|
|
|
|
export const GitStatusParams = WorktreeSelector.extend({
|
|
includeIgnored: z.boolean().optional()
|
|
})
|
|
|
|
export const GitCheckIgnored = WorktreeSelector.extend({
|
|
paths: z.array(z.string().min(1, 'Missing path')).max(2000)
|
|
})
|
|
|
|
export const GitFilePath = WorktreeSelector.extend({
|
|
filePath: z
|
|
.unknown()
|
|
.transform((v) => (typeof v === 'string' ? v : ''))
|
|
.pipe(z.string().min(1, 'Missing file path'))
|
|
})
|
|
|
|
export const GitDiff = GitFilePath.extend({
|
|
staged: z.boolean(),
|
|
compareAgainstHead: z.boolean().optional()
|
|
})
|
|
|
|
export const GitBranchCompare = WorktreeSelector.extend({
|
|
baseRef: z
|
|
.unknown()
|
|
.transform((v) => (typeof v === 'string' ? v : ''))
|
|
.pipe(
|
|
z
|
|
.string()
|
|
.min(1, 'Missing base ref')
|
|
.refine((value) => !value.startsWith('-'), 'Base ref must not start with -')
|
|
)
|
|
})
|
|
|
|
const FullGitObjectId = z
|
|
.string()
|
|
.regex(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/, 'Expected a full git object id')
|
|
|
|
export const GitCommitCompare = WorktreeSelector.extend({
|
|
commitId: z
|
|
.unknown()
|
|
.transform((v) => (typeof v === 'string' ? v : ''))
|
|
.pipe(FullGitObjectId)
|
|
})
|
|
|
|
export const GitHistory = WorktreeSelector.extend({
|
|
limit: z.number().int().min(1).max(200).optional(),
|
|
baseRef: z.string().nullable().optional()
|
|
})
|
|
|
|
export const GitBranchDiff = GitFilePath.extend({
|
|
compare: z.object({
|
|
baseRef: z.string().optional(),
|
|
baseOid: FullGitObjectId.optional(),
|
|
headOid: FullGitObjectId,
|
|
mergeBase: FullGitObjectId
|
|
}),
|
|
oldPath: z.string().optional()
|
|
})
|
|
|
|
export const GitCommitDiff = GitFilePath.extend({
|
|
commitOid: FullGitObjectId,
|
|
parentOid: FullGitObjectId.nullable().optional(),
|
|
oldPath: z.string().optional()
|
|
})
|
|
|
|
export const GitCommit = WorktreeSelector.extend({
|
|
message: z
|
|
.unknown()
|
|
.transform((v) => (typeof v === 'string' ? v : ''))
|
|
.pipe(z.string().min(1, 'Missing commit message'))
|
|
})
|
|
|
|
const CommitMessageModelCapability = z.object({
|
|
id: z.string(),
|
|
label: z.string(),
|
|
thinkingLevels: z.array(z.object({ id: z.string(), label: z.string() })).optional(),
|
|
defaultThinkingLevel: z.string().optional()
|
|
})
|
|
|
|
const CommitMessageAiSettings = z.object({
|
|
enabled: z.boolean(),
|
|
agentId: z.string().nullable(),
|
|
selectedModelByAgent: z.record(z.string(), z.string()),
|
|
selectedModelByAgentByHost: z.record(z.string(), z.record(z.string(), z.string())).optional(),
|
|
discoveredModelsByAgent: z.record(z.string(), z.array(CommitMessageModelCapability)).optional(),
|
|
discoveredModelsByAgentByHost: z
|
|
.record(z.string(), z.record(z.string(), z.array(CommitMessageModelCapability)))
|
|
.optional(),
|
|
selectedThinkingByModel: z.record(z.string(), z.string()),
|
|
customPrompt: z.string(),
|
|
customAgentCommand: z.string()
|
|
})
|
|
|
|
export const GitGenerateCommitMessage = WorktreeSelector.extend({
|
|
commitMessageAi: CommitMessageAiSettings.optional(),
|
|
agentCmdOverrides: z.record(z.string(), z.string()).optional(),
|
|
enableGitHubAttribution: z.boolean().optional(),
|
|
commitMessageDiscoveryHostKey: z.string().optional()
|
|
})
|
|
|
|
export const GitDiscoverCommitMessageModels = WorktreeSelector.extend({
|
|
agentId: z.string().min(1, 'Missing agent id'),
|
|
agentCmdOverrides: z.record(z.string(), z.string()).optional()
|
|
})
|
|
|
|
export const GitGeneratePullRequestFields = GitGenerateCommitMessage.extend({
|
|
base: z.string().min(1, 'Missing base branch'),
|
|
title: z.string(),
|
|
body: z.string(),
|
|
draft: z.boolean()
|
|
})
|
|
|
|
export const GitBulkPaths = WorktreeSelector.extend({
|
|
filePaths: z.array(z.string().min(1, 'Missing file path'))
|
|
})
|
|
|
|
export const GitPush = WorktreeSelector.extend({
|
|
publish: z.boolean().optional(),
|
|
forceWithLease: z.boolean().optional(),
|
|
pushTarget: z.unknown().optional()
|
|
})
|
|
|
|
export const GitRemoteFileUrl = WorktreeSelector.extend({
|
|
relativePath: z
|
|
.unknown()
|
|
.transform((v) => (typeof v === 'string' ? v : ''))
|
|
.pipe(z.string().min(1, 'Missing relative path')),
|
|
line: z.number().int().min(1)
|
|
})
|