Skip to content

Commit f199bae

Browse files
committed
feat(workflows): implement hierarchical condition groups for onboarding
Add support for nested condition groups in workflow templates with track filtering and multi-select capabilities. Update onboarding UI to handle grouped conditions with child questions and improve validation for the new structure.
1 parent 3b1bb0b commit f199bae

File tree

6 files changed

+556
-76
lines changed

6 files changed

+556
-76
lines changed

src/cli/tui/app-shell.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { resolvePackageJson } from "../../shared/runtime/root.js"
2626
import { getSelectedTrack, setSelectedTrack, hasSelectedConditions, setSelectedConditions, getProjectName, setProjectName, getControllerAgents, initControllerAgent, loadControllerConfig } from "../../shared/workflows/index.js"
2727
import { loadTemplate } from "../../workflows/templates/loader.js"
2828
import { getTemplatePathFromTracking } from "../../shared/workflows/template.js"
29-
import type { TrackConfig, ConditionConfig } from "../../workflows/templates/types"
29+
import type { TrackConfig, ConditionGroup } from "../../workflows/templates/types"
3030
import type { AgentDefinition } from "../../shared/agents/config/types"
3131
import type { InitialToast } from "./app"
3232

@@ -126,7 +126,7 @@ export function App(props: { initialToast?: InitialToast }) {
126126
const [view, setView] = createSignal<"home" | "onboard" | "workflow">("home")
127127
const [workflowEventBus, setWorkflowEventBus] = createSignal<WorkflowEventBus | null>(null)
128128
const [templateTracks, setTemplateTracks] = createSignal<Record<string, TrackConfig> | null>(null)
129-
const [templateConditions, setTemplateConditions] = createSignal<Record<string, ConditionConfig> | null>(null)
129+
const [templateConditionGroups, setTemplateConditionGroups] = createSignal<ConditionGroup[] | null>(null)
130130
const [initialProjectName, setInitialProjectName] = createSignal<string | null>(null)
131131
const [controllerAgents, setControllerAgents] = createSignal<AgentDefinition[] | null>(null)
132132

@@ -152,9 +152,9 @@ export function App(props: { initialToast?: InitialToast }) {
152152
const existingProjectName = await getProjectName(cmRoot)
153153

154154
const hasTracks = template.tracks && Object.keys(template.tracks).length > 0
155-
const hasConditions = template.conditions && Object.keys(template.conditions).length > 0
155+
const hasConditionGroups = template.conditionGroups && template.conditionGroups.length > 0
156156
const needsTrackSelection = hasTracks && !selectedTrack
157-
const needsConditionsSelection = hasConditions && !conditionsSelected
157+
const needsConditionsSelection = hasConditionGroups && !conditionsSelected
158158
const needsProjectName = !existingProjectName
159159

160160
// Check if workflow requires controller selection
@@ -170,7 +170,7 @@ export function App(props: { initialToast?: InitialToast }) {
170170
// If project name, tracks, conditions, or controller need selection, show onboard view
171171
if (needsProjectName || needsTrackSelection || needsConditionsSelection || needsControllerSelection) {
172172
if (hasTracks) setTemplateTracks(template.tracks!)
173-
if (hasConditions) setTemplateConditions(template.conditions!)
173+
if (hasConditionGroups) setTemplateConditionGroups(template.conditionGroups!)
174174
if (needsControllerSelection) setControllerAgents(controllers)
175175
setInitialProjectName(existingProjectName) // Pass existing name if any (to skip that step)
176176
currentView = "onboard"
@@ -343,7 +343,7 @@ export function App(props: { initialToast?: InitialToast }) {
343343
<Match when={view() === "onboard"}>
344344
<Onboard
345345
tracks={templateTracks() ?? undefined}
346-
conditions={templateConditions() ?? undefined}
346+
conditionGroups={templateConditionGroups() ?? undefined}
347347
controllerAgents={controllerAgents() ?? undefined}
348348
initialProjectName={initialProjectName()}
349349
onComplete={handleOnboardComplete}

0 commit comments

Comments
 (0)