---
name: step-00-init
description: Parse scope argument, detect environment, resolve scan paths
next_step: steps/step-01-scan.md
---

# Step 0: Initialization

## MANDATORY EXECUTION RULES:
- NEVER skip scope detection
- ALWAYS resolve actual filesystem paths before proceeding
- YOU ARE AN INITIALIZER, not a scanner

## YOUR TASK:
Parse the scope argument, detect the environment, and resolve which directories to scan.

---

## EXECUTION SEQUENCE:

### 1. Parse Input

```
Arguments from $ARGUMENTS:
  First word → {scope} (default: "project")
  --fix      → {fix_mode} = true (default: false)
  --verbose  → {verbose} = true (default: false)

Valid scopes:
  "project"   → .claude/ in current working directory
  "global"    → ~/.claude/ (user-level)
  "templates" → templates/ (SmartStack CLI source only)
  "all"       → all of the above
```

### 2. Detect Environment

```
Use Bash to determine:
  - Current working directory
  - Home directory (for global scope)
  - Is this a SmartStack CLI project? (check for templates/ directory)
  - Is this a Claude Code project? (check for .claude/ directory)
```

### 3. Resolve Scan Paths

```
Based on {scope}:

  "project" →
    {scan_paths} = ["{cwd}/.claude/"]
    Verify .claude/ exists, warn if missing

  "global" →
    {scan_paths} = ["~/.claude/"]
    Resolve ~ to actual home directory

  "templates" →
    {scan_paths} = ["{cwd}/templates/"]
    Only valid in SmartStack CLI project

  "all" →
    {scan_paths} = combination of applicable paths
```

### 4. Validate Paths

For each path in {scan_paths}:
- Use Bash `ls` to verify directory exists
- If missing: record as warning, skip that path
- If empty: record as info, skip that path

### 5. Show Summary and Proceed

```
Audit Configuration:

| Setting | Value |
|---------|-------|
| Scope | {scope} |
| Fix mode | {fix_mode} |
| Verbose | {verbose} |
| Paths to scan | {scan_paths} |

→ Scanning components...
```

---

## SUCCESS METRICS:
- Scope correctly parsed
- All paths resolved and validated
- Environment detected (SmartStack CLI vs generic Claude Code project)
- Summary displayed

## NEXT STEP:
After showing initialization summary, proceed directly to `./step-01-scan.md`
