StrategyPlugin class

Generates FetchStrategy skeletons for pluggable data-fetching pipelines.

A StrategyPlugin run produces:

  • An abstract domain strategy base extending FetchStrategy<Input, Output>
  • One concrete variant per --strategies name with canHandle + fetchOne stubs
  • A StrategySelector that wires all variants and selects the first applicable

Files land in data/providers/{domain}/strategies/ — the data layer only. The abstract FetchStrategy<I, O> from Zuraffa core is the only domain contract.

Usage

zfa strategy UrlListing --strategies=scraper,ai --params=UrlSpark --returns=Listing --domain=listing

runAfter

Runs after provider because the generated files live inside the provider folder.

Inheritance

Constructors

StrategyPlugin({required String outputDir, GeneratorOptions options = const GeneratorOptions()})

Properties

capabilities List<ZuraffaCapability>
List of capabilities exposed by this plugin.
no setter
configKey String?
The key in .zfa.json that enables this plugin by default (e.g., 'diByDefault').
no setterinherited
configSchema → JsonSchema
JSON Schema for this plugin's configuration.
no setter
dependsOn List<String>
List of plugin IDs that must run BEFORE this plugin.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for the plugin (e.g., 'usecase', 'di').
no setter
name String
Human-readable name of the plugin.
no setter
options → GeneratorOptions
final
outputDir String
final
runAfter List<String>
List of plugin IDs that this plugin should run AFTER, if they are present. (Like dependsOn, but doesn't force the other plugin to be active).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strategyBuilder → StrategyBuilder
final
version String
Semantic version of the plugin.
no setter

Methods

afterGenerate(PluginContext context) Future<void>
Hook called after generation completes successfully.
inherited
beforeGenerate(PluginContext context) Future<void>
Hook called before generation starts.
inherited
createCommand() → Command
Creates the Command instance for this plugin.
generate(GeneratorConfig config) Future<List<GeneratedFile>>
Legacy generation method for backward compatibility.
override
generateWithContext(PluginContext context) Future<List<GeneratedFile>>
Generates files based on the provided context.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(PluginContext context, Object error, StackTrace stackTrace) Future<void>
Hook called if an error occurs during generation.
inherited
toString() String
A string representation of this object.
inherited
validate(PluginContext context) Future<ValidationResult>
Validates the plugin configuration against the context.
inherited
validateLegacy(GeneratorConfig config) Future<ValidationResult>
Legacy validation method.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited