-
Notifications
You must be signed in to change notification settings - Fork 0
Modes
DUDA has 7 modes, each designed for a specific workflow:
| Mode | Command | Input | When to Use |
|---|---|---|---|
| INIT | duda init |
- | First setup, map your project |
| SCAN | duda scan <path> |
File/dir path | "Is this file safe to import?" |
| SCOPE | duda scope "desc" |
Feature name | "Show all files for this feature" |
| TRANSPLANT | auto-detected | Migration intent | Moving code across layers |
| AUDIT | duda audit |
Symptom | "Why is wrong data showing?" |
| ACT | duda fix |
Diagnosis result | Auto-fix after audit/transplant |
| GUARD | duda guard |
Staged files | Pre-commit isolation check |
duda init
Explores your project using topological sort (leaf files upward) and generates DUDA_MAP.md with isolation layer tags for every file.
Tags assigned:
-
[UPPER-ONLY]- Platform/admin level only -
[SHARED]- Safe to use across layers -
[LAYER:X]- Belongs to specific layer -
[SHARED ?]- Ambiguous, needs review
duda scan src/tenant/components/OrderForm.tsx
Lightweight single-file analysis. No DUDA_MAP required.
Output includes:
- Import analysis with layer tags
- Risk level assessment
- Suggestion for safe usage
duda scope "account permission management"
See SCOPE Mode for full details.
Discovers all files related to a feature by keyword + import chain expansion. Groups by layer and shows cross-layer violations.
Auto-triggered when migration keywords are detected:
- "use X in Y", "copy from", "bring over", "migrate", "port"
Process:
- Confirm intent
- Pre-contamination check at destination
- Source dissection (tag every dependency)
- Trust score measurement (must reach 95)
- Strategy selection
- Execution (only at 95+)
Strategies:
| # | Strategy | When |
|---|---|---|
| 1 | Direct Reference | All deps are [SHARED]
|
| 2 | Adapter | Mixed deps, shared > 60% |
| 3 | Rebuild | Too many upper-only deps |
| 4 | Deny | Core upper-only or deny-listed |
Auto-triggered by contamination keywords:
- "data leak", "wrong tenant", "showing other", "broken isolation"
Root cause types:
- A. Policy leak (missing tenant filters)
- B. Component contamination (most common)
- C. State contamination (shared store/context)
- D. Boundary violation (direct cross-layer import)
duda fix
After AUDIT or TRANSPLANT diagnosis. Generates fix code with diff preview.
Progressive automation:
- SHOW - Read-only assessment
- SUGGEST - Strategy + shortfalls
- APPLY - Fix + confirm + apply
- AUTO - Cached instant fix (memory HIGH+)
duda guard # Interactive
duda guard --ci # CI mode (exit 0/1)
Checks staged files for isolation breaches. Integrates with pre-commit hooks and GitHub Actions.