To extract Cloudflare binding configurations from a project, use findWranglerConfig to locate the configuration file in a directory, then pass that path to parseWranglerConfig. This allows you to programmatically access D1, KV, R2, Durable Objects, and Queue bindings.
import {
parseWranglerConfig,
findWranglerConfig,
WRANGLER_CONFIG_FILES
} from 'localflare-core';
// Find wrangler config in current directory
const configPath = findWranglerConfig(process.cwd());
// Returns: ./wrangler.toml, ./wrangler.json, or ./wrangler.jsonc
// Parse the configuration
const config = parseWranglerConfig(configPath);
// Access binding configurations
console.log(config.d1_databases); // D1 database bindings
console.log(config.kv_namespaces); // KV namespace bindings
console.log(config.r2_buckets); // R2 bucket bindings
console.log(config.durable_objects); // Durable Object bindings
console.log(config.queues); // Queue producer/consumer config