Workflow Composition
Chain multiple workflows together for complex, multi-stage development processes
Workflow Composition allows you to chain multiple workflows together, creating complex multi-stage processes that execute in sequence.
Overview#
Instead of running workflows independently:
workflow-1 workflow-2 workflow-3
[========] [========] [========]
done done done
Chain them into a composition:
composition: full-feature
┌──────────────────────────────────────────────────────┐
│ workflow-1 ────▶ workflow-2 ────▶ workflow-3 │
│ [========] [========] [========] │
│ ▲ │
│ auto-advance │
└──────────────────────────────────────────────────────┘
Built-in Templates#
Full Feature#
Complete feature from development to launch.
{
name: 'full-feature',
workflows: ['feature-development', 'security-audit', 'launch-preparation']
}Development Cycle#
Standard development cycle with review.
{
name: 'development-cycle',
workflows: ['feature-development', 'performance-optimization']
}Complete Audit#
Full audit across security, performance, and code quality.
{
name: 'complete-audit',
workflows: ['security-audit', 'performance-optimization']
}Creating Compositions#
From Template#
bootspring composition start full-feature1const composer = require('bootspring/intelligence/workflow-composer');
2
3const result = composer.createFromTemplate('full-feature');
4// {
5// success: true,
6// compositionId: 'comp-abc123',
7// workflows: ['feature-development', 'security-audit', 'launch-preparation']
8// }Custom Composition#
bootspring composition create my-process \
--workflows feature-development,testing-workflow,deploy-workflow1composer.createComposition('my-process', [
2 'feature-development',
3 'security-audit',
4 'launch-preparation'
5], {
6 description: 'Full feature lifecycle',
7 autoAdvance: true
8});Running Compositions#
Start a Composition#
bootspring composition start my-process1const result = composer.startComposition('my-process');
2// {
3// success: true,
4// compositionId: 'comp-abc123',
5// currentWorkflow: 'feature-development',
6// currentPhase: { name: 'Design', agents: [...] }
7// }Check Status#
bootspring composition status1const status = composer.getCompositionStatus('comp-abc123');
2// {
3// compositionId: 'comp-abc123',
4// name: 'my-process',
5// status: 'active',
6// currentWorkflowIndex: 0,
7// currentWorkflow: 'feature-development',
8// progress: { completed: 0, total: 3, percent: 0 },
9// completedWorkflows: []
10// }Advance Composition#
When a workflow completes, advance to the next:
bootspring composition advance1const result = composer.advanceComposition();
2// {
3// success: true,
4// previousWorkflow: 'feature-development',
5// currentWorkflow: 'security-audit',
6// isComplete: false
7// }Complete Composition#
1// When last workflow finishes
2const result = composer.advanceComposition();
3// {
4// success: true,
5// isComplete: true,
6// totalDuration: 432000000,
7// completedWorkflows: [...]
8// }Composition Options#
Auto-Advance#
Automatically advance to the next workflow when the current one completes:
composer.createComposition('auto-process', workflows, {
autoAdvance: true // No manual advance needed
});Failure Handling#
Configure how failures are handled:
composer.createComposition('resilient-process', workflows, {
onFailure: 'pause', // 'pause' | 'skip' | 'abort'
notifyOnFailure: true
});Conditional Workflows#
Skip workflows based on conditions:
composer.createComposition('conditional-process', [
'feature-development',
{ workflow: 'security-audit', condition: 'hasSecurityChanges' },
'launch-preparation'
]);Managing Compositions#
List Compositions#
bootspring composition listconst compositions = composer.listCompositions();Resume a Paused Composition#
bootspring composition resume <composition-id>composer.resumeComposition(compositionId);Cancel a Composition#
bootspring composition cancel <composition-id>composer.cancelComposition(compositionId);Workflow Dependencies#
Define dependencies between workflows in a composition:
composer.createComposition('dependent-process', [
{ workflow: 'api-development', id: 'api' },
{ workflow: 'frontend-development', id: 'frontend', dependsOn: ['api'] },
{ workflow: 'testing-workflow', id: 'testing', dependsOn: ['api', 'frontend'] }
]);Composition Events#
Track composition progress with events:
1// Listen for composition events
2composer.on('workflow-started', (event) => {
3 console.log(`Started: ${event.workflow}`);
4});
5
6composer.on('workflow-completed', (event) => {
7 console.log(`Completed: ${event.workflow}`);
8});
9
10composer.on('composition-completed', (event) => {
11 console.log(`All workflows complete: ${event.compositionId}`);
12});Best Practices#
- Plan your sequence - Order workflows logically (dev → test → deploy)
- Use auto-advance - For smooth, uninterrupted processes
- Handle failures - Configure appropriate failure handling
- Monitor progress - Check status regularly for long compositions
- Use templates - Start with built-in templates when possible
Example: Full Feature Lifecycle#
1// Create a comprehensive feature lifecycle
2composer.createComposition('feature-lifecycle', [
3 'feature-development', // Design → Implement → Test → Review
4 'security-audit', // Code Review → Scan → Remediate
5 'performance-optimization', // Analyze → Optimize → Benchmark
6 'launch-preparation' // Final checks → Deploy → Monitor
7], {
8 description: 'Complete feature from idea to production',
9 autoAdvance: true,
10 onFailure: 'pause'
11});
12
13// Start it
14composer.startComposition('feature-lifecycle');
15
16// Check progress
17const status = composer.getCompositionStatus('feature-lifecycle');
18console.log(`Progress: ${status.progress.percent}%`);