Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions components/modals/RepoFormModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const STEP_DEFINITIONS: Record<TaskStepType, { label: string; icon: React.Compon
[TaskStepType.GitCheckout]: { label: 'Git Checkout', icon: ArrowRightOnRectangleIcon, description: 'Switch to a specific branch.' },
[TaskStepType.GitStash]: { label: 'Git Stash', icon: ArchiveBoxIcon, description: 'Stash uncommitted local changes.' },
[TaskStepType.SvnUpdate]: { label: 'SVN Update', icon: ArrowDownTrayIcon, description: 'Update working copy to latest revision.' },
[TaskStepType.SvnSwitch]: { label: 'SVN Switch', icon: ArrowRightOnRectangleIcon, description: 'Switch working copy to a different branch or URL.' },
[TaskStepType.RunCommand]: { label: 'Run Command', icon: CodeBracketIcon, description: 'Execute a custom shell command.' },
// Delphi
[TaskStepType.DelphiBuild]: { label: 'Delphi Build', icon: BeakerIcon, description: 'Build, rebuild, or clean a Delphi project.' },
Expand Down Expand Up @@ -133,7 +134,7 @@ const STEP_DEFINITIONS: Record<TaskStepType, { label: string; icon: React.Compon
const STEP_CATEGORIES = [
{ name: 'General', types: [TaskStepType.RunCommand] },
{ name: 'Git', types: [TaskStepType.GitPull, TaskStepType.GitFetch, TaskStepType.GitCheckout, TaskStepType.GitStash] },
{ name: 'SVN', types: [TaskStepType.SvnUpdate] },
{ name: 'SVN', types: [TaskStepType.SvnUpdate, TaskStepType.SvnSwitch] },
{ name: 'Node.js', types: [TaskStepType.NODE_INSTALL_DEPS, TaskStepType.NODE_RUN_BUILD, TaskStepType.NODE_RUN_TESTS, TaskStepType.NODE_RUN_LINT, TaskStepType.NODE_RUN_FORMAT, TaskStepType.NODE_RUN_TYPECHECK] },
{ name: 'Go', types: [TaskStepType.GO_MOD_TIDY, TaskStepType.GO_FMT, TaskStepType.GO_TEST, TaskStepType.GO_BUILD] },
{ name: 'Rust', types: [TaskStepType.RUST_CARGO_FMT, TaskStepType.RUST_CARGO_CLIPPY, TaskStepType.RUST_CARGO_CHECK, TaskStepType.RUST_CARGO_TEST, TaskStepType.RUST_CARGO_BUILD] },
Expand Down Expand Up @@ -341,10 +342,19 @@ const TaskStepItem: React.FC<{
<button type="button" onClick={() => onRemoveStep(step.id)} className="p-1.5 text-red-500 hover:bg-red-100 dark:hover:bg-red-900/50 rounded-full"><TrashIcon className="h-4 w-4" /></button>
</div>
</div>
{step.type === TaskStepType.GitCheckout && (
{(step.type === TaskStepType.GitCheckout || step.type === TaskStepType.SvnSwitch) && (
<div>
<label className="text-xs font-medium text-gray-500 dark:text-gray-400">Branch Name</label>
<input type="text" placeholder="e.g., main" value={step.branch || ''} onChange={(e) => onStepChange(step.id, { branch: e.target.value })} required className={formInputStyle} />
<label className="text-xs font-medium text-gray-500 dark:text-gray-400">
{step.type === TaskStepType.GitCheckout ? 'Branch Name' : 'Switch Target'}
</label>
<input
type="text"
placeholder={step.type === TaskStepType.GitCheckout ? 'e.g., main' : 'e.g., ^/branches/release/1.2'}
value={step.branch || ''}
onChange={(e) => onStepChange(step.id, { branch: e.target.value })}
required
className={formInputStyle}
/>
</div>
)}
{step.type === TaskStepType.DelphiBuild && (
Expand Down Expand Up @@ -1339,6 +1349,7 @@ const TaskStepsEditor: React.FC<{
const newStep: TaskStep = { id: `step_${Date.now()}`, type, enabled: true };
if (type === TaskStepType.RunCommand) newStep.command = suggestions.length > 0 ? suggestions[0].value : 'npm run build';
if (type === TaskStepType.GitCheckout) newStep.branch = 'main';
if (type === TaskStepType.SvnSwitch) newStep.branch = 'trunk';
setTask({ ...task, steps: [...task.steps, newStep] });
setIsAddingStep(false);
};
Expand Down
3 changes: 3 additions & 0 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,9 @@ ipcMain.on('run-task-step', async (event, { repo, step, settings, executionId, t
case TaskStepType.GitStash: await run(`${gitCmd} stash`); break;
// SVN Steps
case TaskStepType.SvnUpdate: await run(`${svnCmd} update`); break;
case TaskStepType.SvnSwitch:
if (!step.branch) { sendLog('Skipping SVN switch: no target specified.', LogLevel.Warn); sendEnd(0); return; }
await run(`${svnCmd} switch ${step.branch}`); break;
// Common Steps
case TaskStepType.RunCommand:
if (!step.command) { sendLog('Skipping empty command.', LogLevel.Warn); sendEnd(0); return; }
Expand Down
10 changes: 10 additions & 0 deletions hooks/useRepositoryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ const runSimulationStep = async (
randomFail(0.1, 'Simulated SVN conflict.');
addLogEntry(repoId, 'Successfully updated working copy.', LogLevel.Success);
break;
case TaskStepType.SvnSwitch:
if (!step.branch) {
addLogEntry(repoId, 'Skipping SVN switch: no target specified.', LogLevel.Warn);
break;
}
addLogEntry(repoId, `svn switch ${step.branch}`, LogLevel.Command);
await simulateDelay(1200);
randomFail(0.1, 'Simulated SVN switch failure.');
addLogEntry(repoId, `Switched working copy to '${step.branch}'.`, LogLevel.Success);
break;
case TaskStepType.GitFetch:
addLogEntry(repoId, `git fetch`, LogLevel.Command);
await simulateDelay(1000);
Expand Down
3 changes: 2 additions & 1 deletion types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export enum TaskStepType {
GitCheckout = 'GIT_CHECKOUT',
GitStash = 'GIT_STASH',
SvnUpdate = 'SVN_UPDATE',
SvnSwitch = 'SVN_SWITCH',
RunCommand = 'RUN_COMMAND',
// Delphi
DelphiBuild = 'DELPHI_BUILD',
Expand Down Expand Up @@ -195,7 +196,7 @@ export interface TaskStep {
id: string;
type: TaskStepType;
enabled: boolean;
branch?: string; // for GitCheckout
branch?: string; // for GitCheckout / SvnSwitch target
command?: string; // for RunCommand
// Delphi
delphiProjectFile?: string;
Expand Down