dag fix
Detect and repair broken .dag.json workflow files. The command combines fast static analysis (always available) with optional LLM-assisted diagnosis for ambiguous cases.
Synopsis
dag fix <workflow.dag.json> [--apply] [--run] [--no-llm] [--input key=value]Analysis Modes
Static analysis
Always runs. Checks for unknown node types, disconnected ports, missing required config keys, and malformed edge definitions. For unknown node types it computes the edit distance to all registered types and surfaces the closest match.
LLM analysis
Runs by default when ANTHROPIC_API_KEY is set. The broken file and the static analysis report are sent to the LLM, which confirms or overrides the suggested fix and may surface additional issues that static analysis cannot catch. Pass --no-llm to skip this step.
Example
Consider a DAG file with a misspelled node type:
{
"nodes": [
{ "id": "input", "type": "input" },
{ "id": "llm", "type": "llm-text-antropic" },
{ "id": "output", "type": "text-output" }
],
"edges": ["input→llm", "llm→output"]
}Preview the fix
dag fix broken-pipeline.dag.jsonAnalysing broken-pipeline.dag.json...
Static analysis
✗ Node "llm" has unknown type: "llm-text-antropic"
Closest match: "llm-text-anthropic" (edit distance 1)
LLM analysis
✓ Confirmed: type is a typo. Suggested fix: "llm-text-anthropic"
Proposed fix
- "type": "llm-text-antropic"
+ "type": "llm-text-anthropic"
Run with --apply to write the fix.Apply the fix
dag fix broken-pipeline.dag.json --applyAnalysing broken-pipeline.dag.json...
Static analysis
✗ Node "llm" has unknown type: "llm-text-antropic"
Closest match: "llm-text-anthropic" (edit distance 1)
LLM analysis
✓ Confirmed: type is a typo. Suggested fix: "llm-text-anthropic"
Fixed broken-pipeline.dag.jsonFix and run immediately
dag fix broken-pipeline.dag.json --run --input text="Hello"Static-Only Mode
Run analysis without an API key by passing --no-llm. This is useful in CI environments where keys are not available, or for fast local checks.
dag fix broken-pipeline.dag.json --no-llmFlags
| Flag | Description |
|---|---|
| --apply | Write the fixed DAG back to the original file. Without this flag the fix is printed to stdout only. |
| --run | Execute the fixed DAG immediately after applying the fix. Implies --apply. |
| --no-llm | Skip LLM analysis and rely only on static analysis. No API key required when this flag is set. |
| --input <key=value> | Input values passed to the pipeline when --run is set. |