Skip to main content

Discovery

In update mode, ->discover() rules detect defaults from an existing project directory: a .env key (new Dotenv('SEASON')), a JSON dot-path (new JsonValue('basket.json', 'name')), a path check (new PathExists('harvest.csv')), a directory scan (new Scan('baskets', type: ScanType::Dir)), or a custom fn(Context $c): mixed closure:

$p->text('name', 'Produce name')->discover(new JsonValue('basket.json', 'name'));
$p->confirm('inseason', 'In season?')->discover(new PathExists('harvest.csv'));

Discovered values are badged in the summary, and explicit input (prompts or environment) always wins over discovery:

Discovery summary with provenance badgesDiscovery summary with provenance badges

Every rule type runs against a bundled sample project in playground/08-discovery/.