---
phase: 11-refactor
plan: 01
subsystem: cli
tags: [arg-parsing, refactor, cleanup]

requires: []
provides:
  - ArgParser static class — all CLI arg parsing isolated from Program.cs
  - Program.cs with no static state, no inline regex
  - AesCrypt.cs removed (dead code)
affects: [11-02-error-handling]

tech-stack:
  added: []
  patterns: ["ArgParser static method: string[] → InputArgs (pure function)"]

key-files:
  created: [ArgParser.cs]
  modified: [Program.cs, NcProgramManager.csproj]

key-decisions:
  - "VediErrore: changed signature to accept bool debugMode parameter (no longer reads static field)"
  - "Scarica/Invia: now accept InputArgs parameter explicitly"

patterns-established:
  - "ArgParser.Parse(args) is the single entry point for all CLI parsing"

duration: ~15min
started: 2026-05-17T00:00:00Z
completed: 2026-05-17T00:00:00Z
---

# Phase 11 Plan 01: ArgParser extraction + AesCrypt removal

**Extracted all CLI arg parsing into `ArgParser.cs`; `Program.cs` no longer holds static state or inline regex; dead `AesCrypt.cs` deleted.**

## Performance

| Metric | Value |
|--------|-------|
| Duration | ~15min |
| Tasks | 3 completed |
| Files modified | 3 (+ 1 created, 1 deleted) |

## Acceptance Criteria Results

| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: ArgParser extracted | Pass | `ArgParser.Parse(string[]) → InputArgs` — all parsing logic moved |
| AC-2: Program.cs simplified | Pass | No inline regex, no static `inputArgs` field; delegates to `ArgParser.Parse` |
| AC-3: AesCrypt deleted | Pass | File deleted; csproj entry replaced with `ArgParser.cs`; 0 refs in codebase |

## Files Created/Modified

| File | Change | Purpose |
|------|--------|---------|
| `ArgParser.cs` | Created | Static class, single `Parse(string[]) → InputArgs` method |
| `Program.cs` | Modified | `inputArgs` now local var in Main; `Scarica`/`Invia`/`VediErrore` accept `InputArgs` param |
| `NcProgramManager.csproj` | Modified | Replaced `AesCrypt.cs` compile entry with `ArgParser.cs` |
| `AesCrypt.cs` | Deleted | Dead code — no references anywhere in project |

## Decisions Made

| Decision | Rationale | Impact |
|----------|-----------|--------|
| `VediErrore` takes `bool debugMode` param | Removes last dependency on static state | Cleaner signature; no behaviour change |
| `Scarica`/`Invia` take explicit `InputArgs` param | Eliminates static field coupling | Methods now testable in isolation |

## Deviations from Plan

None — plan executed exactly as written.

## Next Phase Readiness

**Ready:**
- `Program.cs` clean entry point — easy to add error surfacing in 11-02
- `ArgParser` isolated — can be unit-tested independently

**Concerns:** None.

**Blockers:** None.

---
*Phase: 11-refactor, Plan: 01*
*Completed: 2026-05-17*
