Skip to content

Commit 3bf2b1d

Browse files
committed
feat(workflows): enhance track selection with question and options
refactor workflow templates to support structured track configuration with a question and options update types and UI components to handle new tracks configuration add conditional logic for research options in bmad workflow
1 parent f199bae commit 3bf2b1d

File tree

5 files changed

+61
-19
lines changed

5 files changed

+61
-19
lines changed

src/cli/tui/app-shell.tsx

Lines changed: 3 additions & 3 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, ConditionGroup } from "../../workflows/templates/types"
29+
import type { TracksConfig, ConditionGroup } from "../../workflows/templates/types"
3030
import type { AgentDefinition } from "../../shared/agents/config/types"
3131
import type { InitialToast } from "./app"
3232

@@ -125,7 +125,7 @@ export function App(props: { initialToast?: InitialToast }) {
125125
let ctrlCTimeout: NodeJS.Timeout | null = null
126126
const [view, setView] = createSignal<"home" | "onboard" | "workflow">("home")
127127
const [workflowEventBus, setWorkflowEventBus] = createSignal<WorkflowEventBus | null>(null)
128-
const [templateTracks, setTemplateTracks] = createSignal<Record<string, TrackConfig> | null>(null)
128+
const [templateTracks, setTemplateTracks] = createSignal<TracksConfig | null>(null)
129129
const [templateConditionGroups, setTemplateConditionGroups] = createSignal<ConditionGroup[] | null>(null)
130130
const [initialProjectName, setInitialProjectName] = createSignal<string | null>(null)
131131
const [controllerAgents, setControllerAgents] = createSignal<AgentDefinition[] | null>(null)
@@ -151,7 +151,7 @@ export function App(props: { initialToast?: InitialToast }) {
151151
const conditionsSelected = await hasSelectedConditions(cmRoot)
152152
const existingProjectName = await getProjectName(cmRoot)
153153

154-
const hasTracks = template.tracks && Object.keys(template.tracks).length > 0
154+
const hasTracks = template.tracks && Object.keys(template.tracks.options).length > 0
155155
const hasConditionGroups = template.conditionGroups && template.conditionGroups.length > 0
156156
const needsTrackSelection = hasTracks && !selectedTrack
157157
const needsConditionsSelection = hasConditionGroups && !conditionsSelected

src/cli/tui/routes/onboard/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import { createSignal, For, onMount, Show, createEffect, createMemo } from "solid-js"
99
import { useKeyboard, useTerminalDimensions } from "@opentui/solid"
1010
import { useTheme } from "@tui/shared/context/theme"
11-
import type { TrackConfig, ConditionGroup, ConditionConfig } from "../../../../workflows/templates/types"
11+
import type { TracksConfig, ConditionGroup, ConditionConfig } from "../../../../workflows/templates/types"
1212
import type { AgentDefinition } from "../../../../shared/agents/config/types"
1313

1414
export interface OnboardProps {
15-
tracks?: Record<string, TrackConfig>
15+
tracks?: TracksConfig
1616
conditionGroups?: ConditionGroup[]
1717
controllerAgents?: AgentDefinition[] // Available controller agents
1818
initialProjectName?: string | null // If set, skip project name input
@@ -50,7 +50,7 @@ export function Onboard(props: OnboardProps) {
5050
// Track selections within current group (for multi-select groups)
5151
const [currentGroupSelections, setCurrentGroupSelections] = createSignal<Set<string>>(new Set())
5252

53-
const hasTracks = () => props.tracks && Object.keys(props.tracks).length > 0
53+
const hasTracks = () => props.tracks && Object.keys(props.tracks.options).length > 0
5454
const hasControllers = () => props.controllerAgents && props.controllerAgents.length > 0
5555

5656
// Filter condition groups by selected track
@@ -90,10 +90,10 @@ export function Onboard(props: OnboardProps) {
9090
})
9191

9292
const projectNameQuestion = "What is your project name?"
93-
const trackQuestion = "What is your project size?"
93+
const trackQuestion = () => props.tracks?.question ?? "Select a track:"
9494
const controllerQuestion = "Select a controller agent for autonomous mode:"
9595

96-
const trackEntries = () => props.tracks ? Object.entries(props.tracks) : []
96+
const trackEntries = () => props.tracks ? Object.entries(props.tracks.options) : []
9797
const controllerEntries = () => props.controllerAgents ? props.controllerAgents.map(a => [a.id, a] as const) : []
9898

9999
// Current condition entries (for group or child)
@@ -113,7 +113,7 @@ export function Onboard(props: OnboardProps) {
113113
const step = currentStep()
114114
switch (step) {
115115
case 'project_name': return projectNameQuestion
116-
case 'tracks': return trackQuestion
116+
case 'tracks': return trackQuestion()
117117
case 'condition_group': return currentGroup()?.question ?? ""
118118
case 'condition_child': return currentChildContext()?.question ?? ""
119119
case 'controller': return controllerQuestion

src/workflows/templates/types.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ export function isModuleStep(step: WorkflowStep): step is ModuleStep {
5656
return step.type === 'module';
5757
}
5858

59-
export interface TrackConfig {
59+
export interface TrackOption {
6060
label: string;
6161
description?: string;
6262
}
6363

64+
export interface TracksConfig {
65+
question: string;
66+
options: Record<string, TrackOption>;
67+
}
68+
6469
export interface ConditionConfig {
6570
label: string;
6671
description?: string;
@@ -85,7 +90,7 @@ export interface WorkflowTemplate {
8590
name: string;
8691
steps: WorkflowStep[];
8792
subAgentIds?: string[];
88-
tracks?: Record<string, TrackConfig>;
93+
tracks?: TracksConfig; // Track selection with question and options
8994
conditionGroups?: ConditionGroup[]; // Grouped conditions with optional nested children
9095
controller?: boolean; // Enables autonomous mode with controller agent selection
9196
}

templates/workflows/bmad.workflow.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,41 @@ export default {
22
name: 'BMAD Method',
33
controller: true,
44

5+
tracks: {
6+
question: 'What is your project size? (only greenfield is tested)',
7+
options: {
8+
small: {
9+
label: 'Small Project',
10+
description: 'Quick start with minimal planning overhead'
11+
},
12+
medium: {
13+
label: 'Medium Project',
14+
description: 'Balanced approach with optional research phase'
15+
},
16+
enterprise: {
17+
label: 'Enterprise Project',
18+
description: 'Full methodology with comprehensive analysis'
19+
},
20+
},
21+
},
22+
523
conditionGroups: [
24+
{
25+
id: 'research_options',
26+
question: 'What research approach do you prefer?',
27+
multiSelect: false,
28+
tracks: ['medium', 'enterprise'], // Only show for medium/enterprise tracks
29+
conditions: {
30+
know_project: {
31+
label: 'I know my project',
32+
description: 'Skip research phase - I have clear requirements ready'
33+
},
34+
use_analyst: {
35+
label: 'Use Analyst',
36+
description: 'Let the analyst research and gather requirements'
37+
},
38+
},
39+
},
640
{
741
id: 'features',
842
question: 'What features does your project have?',
@@ -17,7 +51,7 @@ export default {
1751
],
1852

1953
steps: [
20-
resolveStep('bmad-analyst', {engine: 'codex'}),
54+
resolveStep('bmad-analyst', {engine: 'codex', conditions: ['use_analyst']}),
2155
resolveStep('bmad-pm', {engine: 'codex'}),
2256
resolveStep('bmad-ux', {engine: 'codex', conditions: ['has_ui']}),
2357
resolveStep('bmad-architect', {engine: 'codex'}),

templates/workflows/test.workflow.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ export default {
22
name: 'Test Workflow',
33
controller: true,
44
tracks: {
5-
quick: {
6-
label: 'Small Project',
7-
description: 'Fast iteration, minimal documentation'
8-
},
9-
bmad: {
10-
label: 'Enterprise',
11-
description: 'Full BMAD methodology with all phases'
5+
question: 'What type of project workflow do you want?',
6+
options: {
7+
quick: {
8+
label: 'Small Project',
9+
description: 'Fast iteration, minimal documentation'
10+
},
11+
bmad: {
12+
label: 'Enterprise',
13+
description: 'Full BMAD methodology with all phases'
14+
},
1215
},
1316
},
1417
conditionGroups: [

0 commit comments

Comments
 (0)