DEW-0013: Enhanced search filters (already implemented in DEW-0011 pass) - dew kanban search already had --column/--type/--label/--milestone filters - Closed ticket DEW-0014: Column transition validation - ColumnConfig gains optional allowedTransitions: List<String> - Parsed from allowed_transitions YAML list on each column entry - MoveCommand validates current column's allowedTransitions before moving; unconfigured (empty list) = all transitions allowed (existing behaviour) - Test: transition validation integration test with constrained + unconstrained columns Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
65 lines
1.7 KiB
Dart
65 lines
1.7 KiB
Dart
import 'package:dew_core/dew_core.dart';
|
|
import 'package:yaml/yaml.dart';
|
|
|
|
class TicketTypeConfig {
|
|
final String id;
|
|
final String name;
|
|
|
|
const TicketTypeConfig({required this.id, required this.name});
|
|
}
|
|
|
|
class ColumnConfig {
|
|
final String id;
|
|
final String name;
|
|
final String color;
|
|
|
|
/// Optional list of column IDs that this column can transition to.
|
|
/// If null/empty, all transitions are allowed.
|
|
final List<String> allowedTransitions;
|
|
|
|
const ColumnConfig({
|
|
required this.id,
|
|
required this.name,
|
|
required this.color,
|
|
this.allowedTransitions = const [],
|
|
});
|
|
}
|
|
|
|
class KanbanConfig {
|
|
final String prefix;
|
|
final List<TicketTypeConfig> ticketTypes;
|
|
final List<ColumnConfig> columns;
|
|
|
|
const KanbanConfig({
|
|
required this.prefix,
|
|
required this.ticketTypes,
|
|
required this.columns,
|
|
});
|
|
}
|
|
|
|
extension KanbanDewConfig on DewConfig {
|
|
KanbanConfig get kanban {
|
|
final kanbanYaml = (raw['dew'] as YamlMap)['kanban'] as YamlMap;
|
|
return KanbanConfig(
|
|
prefix: kanbanYaml['prefix'] as String,
|
|
ticketTypes:
|
|
(kanbanYaml['ticket_types'] as YamlList)
|
|
.map((t) => TicketTypeConfig(id: t['id'] as String, name: t['name'] as String))
|
|
.toList(),
|
|
columns:
|
|
(kanbanYaml['columns'] as YamlList)
|
|
.map(
|
|
(c) => ColumnConfig(
|
|
id: c['id'] as String,
|
|
name: c['name'] as String,
|
|
color: c['color'] as String,
|
|
allowedTransitions: (c['allowed_transitions'] as YamlList?)
|
|
?.map((t) => t as String)
|
|
.toList() ??
|
|
const [],
|
|
),
|
|
)
|
|
.toList(),
|
|
);
|
|
}
|
|
}
|