- Git Platform: validates repo via git.probe before enabling Next, supports GitHub + GitLab + any git URL - Template dir configurable in Advanced Settings (template_dir key) - SSHFS: checks sshfs availability, mountpoint selector when enabled - CustomDropdown: flip-up when insufficient space below - 50 Lucide icons (was 24) with categories (AI, Data, DevOps, Security, Media, Comms) - Model: CustomDropdown from live API, max_tokens as slider, effort only with adaptive thinking - Keyboard: Escape closes wizard, Tab navigation with :focus-visible rings, source cards navigable
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
/**
|
|
* Wizard state management — field update dispatch and default values.
|
|
*
|
|
* Extracted from ProjectWizard.svelte to keep it under 300 lines.
|
|
*/
|
|
|
|
export type SourceType = 'local' | 'git-clone' | 'github' | 'template' | 'remote';
|
|
export type AuthMethod = 'password' | 'key' | 'agent' | 'config';
|
|
export type PathState = 'idle' | 'checking' | 'valid' | 'invalid' | 'not-dir';
|
|
export type ProbeState = 'idle' | 'probing' | 'ok' | 'error';
|
|
|
|
export interface WizardState {
|
|
step: number;
|
|
sourceType: SourceType;
|
|
localPath: string;
|
|
repoUrl: string;
|
|
cloneTarget: string;
|
|
githubRepo: string;
|
|
selectedTemplate: string;
|
|
templateTargetDir: string;
|
|
templateOriginDir: string;
|
|
remoteHost: string;
|
|
remoteUser: string;
|
|
remotePath: string;
|
|
remoteAuthMethod: AuthMethod;
|
|
remotePassword: string;
|
|
remoteKeyPath: string;
|
|
remoteSshfs: boolean;
|
|
remoteSshfsMountpoint: string;
|
|
pathValid: PathState;
|
|
isGitRepo: boolean;
|
|
gitBranch: string;
|
|
gitProbeStatus: ProbeState;
|
|
gitProbeBranches: string[];
|
|
githubInfo: { stars: number; description: string; defaultBranch: string } | null;
|
|
githubProbeStatus: ProbeState;
|
|
githubLoading: boolean;
|
|
cloning: boolean;
|
|
projectName: string;
|
|
nameError: string;
|
|
selectedBranch: string;
|
|
branches: string[];
|
|
useWorktrees: boolean;
|
|
selectedGroupId: string;
|
|
projectIcon: string;
|
|
projectColor: string;
|
|
shellChoice: string;
|
|
provider: string;
|
|
model: string;
|
|
permissionMode: string;
|
|
systemPrompt: string;
|
|
autoStart: boolean;
|
|
providerModels: Array<{ id: string; name: string; provider: string }>;
|
|
modelsLoading: boolean;
|
|
}
|
|
|
|
export function getDefaults(groupId: string): WizardState {
|
|
return {
|
|
step: 1, sourceType: 'local', localPath: '', repoUrl: '', cloneTarget: '',
|
|
githubRepo: '', selectedTemplate: '', templateTargetDir: '~/projects',
|
|
templateOriginDir: '',
|
|
remoteHost: '', remoteUser: '', remotePath: '',
|
|
remoteAuthMethod: 'agent', remotePassword: '', remoteKeyPath: '~/.ssh/id_ed25519',
|
|
remoteSshfs: false, remoteSshfsMountpoint: '',
|
|
pathValid: 'idle', isGitRepo: false, gitBranch: '',
|
|
gitProbeStatus: 'idle', gitProbeBranches: [], githubInfo: null,
|
|
githubProbeStatus: 'idle', githubLoading: false,
|
|
cloning: false, projectName: '', nameError: '', selectedBranch: '',
|
|
branches: [], useWorktrees: false, selectedGroupId: groupId,
|
|
projectIcon: 'Terminal', projectColor: 'var(--ctp-blue)', shellChoice: 'bash',
|
|
provider: 'claude', model: '', permissionMode: 'default',
|
|
systemPrompt: '', autoStart: false, providerModels: [], modelsLoading: false,
|
|
};
|
|
}
|