mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 08:03:14 +00:00
Count imported worktrees in setup guide
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -30,10 +30,11 @@ function makeInput(
|
||||
|
||||
function makeWorktree(
|
||||
id: string,
|
||||
options: { createdAt?: number; isMainWorktree?: boolean } = {}
|
||||
options: { createdAt?: number; isMainWorktree?: boolean; path?: string | null } = {}
|
||||
): Worktree {
|
||||
return {
|
||||
id,
|
||||
path: options.path === null ? undefined : (options.path ?? `/repo/${id}`),
|
||||
createdAt: options.createdAt,
|
||||
isMainWorktree: options.isMainWorktree ?? false
|
||||
} as unknown as Worktree
|
||||
@@ -197,7 +198,7 @@ describe('getFeatureWallSetupProgress', () => {
|
||||
worktreesByRepo: {
|
||||
'repo-1': [
|
||||
makeWorktree('main', { isMainWorktree: true }),
|
||||
makeWorktree('ssh-restored-placeholder')
|
||||
makeWorktree('ssh-restored-placeholder', { path: null })
|
||||
]
|
||||
}
|
||||
})
|
||||
@@ -206,14 +207,11 @@ describe('getFeatureWallSetupProgress', () => {
|
||||
expect(progress.stepDone['two-worktrees']).toBe(false)
|
||||
})
|
||||
|
||||
it('marks the step complete once the user creates a worktree beyond the main checkout', () => {
|
||||
it('marks the step complete once a non-main worktree exists beyond the main checkout', () => {
|
||||
const progress = getFeatureWallSetupProgress(
|
||||
makeInput({
|
||||
worktreesByRepo: {
|
||||
'repo-1': [
|
||||
makeWorktree('main', { isMainWorktree: true }),
|
||||
makeWorktree('worktree-1', { createdAt: 1_700_000_000_000 })
|
||||
]
|
||||
'repo-1': [makeWorktree('main', { isMainWorktree: true }), makeWorktree('worktree-1')]
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
@@ -56,14 +56,14 @@ function hasSplitTerminalInAnyWorktree(input: FeatureWallSetupProgressInput): bo
|
||||
return false
|
||||
}
|
||||
|
||||
function countCreatedWorktrees(worktreesByRepo: Record<string, Worktree[]>): number {
|
||||
// Why: only count confirmed Orca-created worktrees. SSH restore can hydrate
|
||||
// temporary non-main placeholders before the relay sends full worktree data.
|
||||
function countAvailableNonMainWorktrees(worktreesByRepo: Record<string, Worktree[]>): number {
|
||||
// Why: imported git worktrees count as real parallel-work capacity, but
|
||||
// partially hydrated placeholders can appear before a worktree path is known.
|
||||
return Object.values(worktreesByRepo).reduce(
|
||||
(sum, worktrees) =>
|
||||
sum +
|
||||
worktrees.filter(
|
||||
(worktree) => !worktree.isMainWorktree && typeof worktree.createdAt === 'number'
|
||||
(worktree) => !worktree.isMainWorktree && typeof worktree.path === 'string' && worktree.path
|
||||
).length,
|
||||
0
|
||||
)
|
||||
@@ -85,7 +85,7 @@ export function getFeatureWallSetupProgress(
|
||||
input.settings?.notifications.enabled === true &&
|
||||
input.settings.notifications.agentTaskComplete === true,
|
||||
'split-terminal': hasSplitTerminalInAnyWorktree(input),
|
||||
'two-worktrees': countCreatedWorktrees(input.worktreesByRepo) >= 1,
|
||||
'two-worktrees': countAvailableNonMainWorktrees(input.worktreesByRepo) >= 1,
|
||||
'task-sources': input.hasConnectedTaskSource,
|
||||
'agent-capabilities': agentCapabilitiesDone,
|
||||
'setup-script': input.hasSetupScript
|
||||
|
||||
@@ -74,7 +74,7 @@ export const CONTEXTUAL_TOURS = [
|
||||
steps: [
|
||||
{
|
||||
title: 'Work side by side',
|
||||
body: 'Run more than one thread of work at once. Open a second pane with {terminal.splitRight}, or right-click the pane for split options.',
|
||||
body: 'Run more than one thread of work at once. Open a second terminal pane with {terminal.splitRight}, or right-click the pane for split options.',
|
||||
targetSelector:
|
||||
'[data-contextual-tour-target="terminal-pane-split-target"], [data-contextual-tour-target="workspace-agent-terminal-tip"]',
|
||||
requiredForStart: true,
|
||||
|
||||
@@ -25,8 +25,8 @@ export type FeatureWallSetupSectionId = 'parallel-work' | 'setup'
|
||||
export const FEATURE_WALL_SETUP_STEPS: readonly FeatureWallSetupStep[] = [
|
||||
{
|
||||
id: 'split-terminal',
|
||||
name: 'Open a second terminal',
|
||||
subtitle: 'Open a second terminal',
|
||||
name: 'Split a terminal',
|
||||
subtitle: 'Split a terminal',
|
||||
description:
|
||||
'Split the terminal to run two things at once — a second agent, a dev server, or a REPL.'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user