shepherd 0.8.3 copy "shepherd: ^0.8.3" to clipboard
shepherd: ^0.8.3 copied to clipboard

Advanced CLI automation and productivity engine for Dart. Simplifies workflows and bridges Design Systems to UI testing.

example/shepherd_example.dart

import 'dart:io';
import 'package:shepherd/shepherd.dart';
import 'package:shepherd_tag/shepherd_tag.dart';

/// Showcase of tagged components for test generation
@ShepherdTag(id: 'US-001', description: 'Authentication Flow')
class LoginScreenShowcase {
  static const String loginButton = 'login_button';
  static const String emailField = 'email_field';
  static const String passwordField = 'password_field';
}

/// Example usage of the shepherd package
/// Demonstrates how to register domains, associate owners, list, and analyze domains.
Future<void> main() async {
  // Project path (current folder)
  final projectPath = Directory.current.path;

  // Initialize the database and services
  final domainsDb = DomainsDatabase(projectPath);
  final configDb = ConfigDatabase(projectPath);
  final configService = ConfigService(domainsDb);
  final infoService = ReportsService(domainsDb);
  final analysisService = AnalysisService();

  print('--- Shepherd Example ---');

  // 1. Register owners (responsible people)
  print('\nRegistering example owners...');
  final aliceId = await configDb.insertPerson(
    firstName: 'Alice',
    lastName: 'Silva',
    email: 'alice.silva@example.com',
    type: 'lead_domain',
    githubUsername: 'alicehub',
  );
  final bobId = await configDb.insertPerson(
    firstName: 'Bob',
    lastName: 'Souza',
    email: 'bob.souza@example.com',
    type: 'developer',
    githubUsername: 'bobdev',
  );
  print('Registered owners: Alice Silva (lead_domain), Bob Souza (developer)');

  // 2. Register domains and associate owners
  print('\nRegistering domains and associating owners...');
  final domains = ['auth_domain', 'user_domain', 'product_domain'];
  for (final domain in domains) {
    await configService.addDomain(domain, [aliceId, bobId]);
    print('Domain "$domain" registered with owners.');
  }

  // 3. List registered domains
  print('\nDomains registered in the project:');
  final domainList = await infoService.listDomains();
  for (final d in domainList) {
    print('- ${d.domainName}');
  }

  // 4. Analyze domains
  print('\nRunning domain analysis...');
  final analysis = await analysisService.analyzeProject(projectPath);
  for (final result in analysis) {
    print(result);
  }

  // 5. Export (informational only)
  print('\nTo export domains to YAML, use the CLI:');
  print('  shepherd export-yaml');

  await domainsDb.database.then((db) => db.close());
  await configDb.close();
  print('\n--- End of Shepherd example ---');
}
11
likes
160
points
865
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Advanced CLI automation and productivity engine for Dart. Simplifies workflows and bridges Design Systems to UI testing.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

args, http, path, shepherd_tag, sqflite_common_ffi, yaml, yaml_writer

More

Packages that depend on shepherd