TrackerWorkflowConfig.fromMap constructor

TrackerWorkflowConfig.fromMap(
  1. Map<String, dynamic> map, {
  2. required Map<String, String> environment,
})

Builds tracker config from a map.

Implementation

factory TrackerWorkflowConfig.fromMap(
  Map<String, dynamic> map, {
  required Map<String, String> environment,
}) {
  // Defaults to local_plan so spec-driven projects work with no tracker
  // section at all, matching the documented default.
  final kind = _stringValue(map, 'kind') ?? 'local_plan';
  return TrackerWorkflowConfig(
    kind: kind,
    endpoint:
        _stringValue(map, 'endpoint') ?? 'https://api.linear.app/graphql',
    apiKey: _resolveEnvValue(
      _stringValue(map, 'api_key') ?? r'$LINEAR_API_KEY',
      environment,
    ),
    projectSlug: _stringValue(map, 'project_slug'),
    activeStates: _stringListValue(map, 'active_states', const [
      'Todo',
      'In Progress',
    ]),
    terminalStates: _stringListValue(map, 'terminal_states', const [
      'Closed',
      'Cancelled',
      'Canceled',
      'Duplicate',
      'Done',
    ]),
  );
}