Skip to content
hs0326 edited this page Mar 14, 2026 · 1 revision

DUDA Modes

DUDA has 7 modes, each designed for a specific workflow:

Overview

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

INIT - Map Your Architecture

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

SCAN - Quick File Check

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

SCOPE - Feature-Centric Analysis (v2.1)

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.


TRANSPLANT - Safe Code Migration

Auto-triggered when migration keywords are detected:

  • "use X in Y", "copy from", "bring over", "migrate", "port"

Process:

  1. Confirm intent
  2. Pre-contamination check at destination
  3. Source dissection (tag every dependency)
  4. Trust score measurement (must reach 95)
  5. Strategy selection
  6. 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

AUDIT - Find Contamination

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)

ACT - Automated Fix

duda fix

After AUDIT or TRANSPLANT diagnosis. Generates fix code with diff preview.

Progressive automation:

  1. SHOW - Read-only assessment
  2. SUGGEST - Strategy + shortfalls
  3. APPLY - Fix + confirm + apply
  4. AUTO - Cached instant fix (memory HIGH+)

GUARD - CI Gate

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.

Clone this wiki locally