AI autosetup
Dhal can scan your project and propose a dhal.json policy.
It supports two paths:
- deterministic heuristic autosetup;
- optional AI SDK-assisted autosetup.
Generated config should be reviewed before enforcement.
Heuristic mode
npx dhal autosetup . --no-ai --json
npx dhal autosetup . --no-ai --write
AI-assisted mode
Install optional AI dependencies:
npm install ai @ai-sdk/openai
Run:
npx dhal autosetup . --provider openai --model gpt-4.1-mini --json
Gateway-style model string:
npx dhal autosetup . --provider gateway --model openai/gpt-4.1-mini --write
Custom provider module
npx dhal autosetup . \
--provider custom \
--provider-module ./my-ai-provider.js \
--provider-export default \
--model my-model \
--json
Safe workflow
- Generate config to JSON.
- Review route profiles and rules.
- Save to a proposed file.
- Run
dhal test-config,dhal doctor, anddhal replay. - Commit only reviewed policy.